{"_id":"@abbacchio/tui","name":"@abbacchio/tui","dist-tags":{"latest":"0.1.2"},"versions":{"0.1.2":{"name":"@abbacchio/tui","version":"0.1.2","description":"Terminal user interface for Abbacchio real-time log viewer","type":"module","bin":{"abbacchio":"dist/cli.js"},"main":"./dist/index.js","types":"./dist/index.d.ts","keywords":["logs","logging","terminal","tui","cli","real-time","sse"],"license":"MIT","dependencies":{"ink":"^5.1.0","ink-text-input":"^6.0.0","ink-select-input":"^6.0.0","react":"^18.3.1","meow":"^13.2.0","centrifuge":"^5.2.2","ws":"^8.18.0","chalk":"^5.4.1"},"devDependencies":{"@types/node":"^22.10.2","@types/react":"^18.3.18","@types/ws":"^8.5.13","tsx":"^4.19.2","typescript":"^5.7.2"},"engines":{"node":">=18"},"scripts":{"dev":"tsx src/cli.ts","build":"tsc","start":"node dist/cli.js"},"_id":"@abbacchio/tui@0.1.2","_integrity":"sha512-C3dJZP0jCLewAiwlQJ1dv1Im4YdH1hgaEvP+7yQGffnnq8c8XwO4FMbKaI2dhRSFJRzGfPCh85h5rBGHq7ENUQ==","_resolved":"/tmp/58333f2a8ef77fb281eb768ee585dce5/abbacchio-tui-0.1.2.tgz","_from":"file:abbacchio-tui-0.1.2.tgz","_nodeVersion":"20.19.6","_npmVersion":"10.8.2","dist":{"integrity":"sha512-C3dJZP0jCLewAiwlQJ1dv1Im4YdH1hgaEvP+7yQGffnnq8c8XwO4FMbKaI2dhRSFJRzGfPCh85h5rBGHq7ENUQ==","shasum":"49229bf629d72c92088aa516bb3432a1cf0b4ace","tarball":"https://registry.npmjs.org/@abbacchio/tui/-/tui-0.1.2.tgz","fileCount":75,"unpackedSize":131428,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDQt4ruR8Pm0Uh2pR68ibKoxQqb0m5AIBhFDXHHMPwNkQIhANytVRaePfwhcJ6tPaVA6irDFbcZV5MVrTfKihYAYciC"}]},"_npmUser":{"name":"argenisleon","email":"argenisleon@gmail.com"},"directories":{},"maintainers":[{"name":"argenisleon","email":"argenisleon@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/tui_0.1.2_1768798354156_0.4842444116068556"},"_hasShrinkwrap":false}},"time":{"created":"2026-01-19T04:52:34.077Z","0.1.2":"2026-01-19T04:52:34.310Z","modified":"2026-01-19T04:52:34.565Z"},"maintainers":[{"name":"argenisleon","email":"argenisleon@gmail.com"}],"description":"Terminal user interface for Abbacchio real-time log viewer","keywords":["logs","logging","terminal","tui","cli","real-time","sse"],"license":"MIT","readme":"# @abbacchio/tui\n\nTerminal user interface for the Abbacchio real-time log viewer. Connects to Centrifugo via WebSocket (same as Dashboard) and displays logs in the terminal with colors, filtering, and keyboard navigation.\n\n## Installation\n\n```bash\n# From the monorepo root\npnpm install\n```\n\n## Building\n\n```bash\n# Build only the TUI package\npnpm build:tui\n\n# Or from packages/tui\ncd packages/tui\npnpm build\n```\n\n## Usage\n\n### Development (with hot reload)\n\n```bash\n# From monorepo root\npnpm tui -c <channel>\n\n# Or directly\ncd packages/tui\npnpm dev -- -c <channel>\n\n# Using npx\nnpx tsx src/cli.ts -c <channel>\n```\n\n### Production (after build)\n\n```bash\ncd packages/tui\nnode dist/cli.js -c <channel>\n```\n\n## CLI Options\n\n| Option | Alias | Description | Default |\n|--------|-------|-------------|---------|\n| `--channel` | `-c` | Channel name (required) | - |\n| `--api-url` | `-u` | API server URL | `http://localhost:4000` |\n| `--key` | `-k` | Decryption key for encrypted logs | - |\n| `--level` | `-l` | Minimum log level filter | - |\n\n### Examples\n\n```bash\n# Basic usage\npnpm tui -c my-app\n\n# With custom API URL\npnpm tui -c production -u https://logs.example.com\n\n# With encryption key (will be saved for future sessions)\npnpm tui -c secure-channel -k mySecretKey123\n\n# Filter by level (only show warn and above)\npnpm tui -c my-app -l warn\n```\n\n## Channel & Key Management\n\nThe TUI stores channel configurations and encryption keys in a local JSON file at `~/.abbacchio/tui-config.json`. This allows you to:\n\n- **Remember encryption keys**: Once you provide a key via CLI (`-k`), it's saved and automatically used next time\n- **Switch channels**: Press `C` to open the channel selector\n- **Update keys**: When switching channels, you can view/edit the stored key\n\n### How it works\n\n1. First time connecting to an encrypted channel:\n   ```bash\n   pnpm tui -c my-channel -k mySecretKey123\n   ```\n   The key is saved to the database.\n\n2. Subsequent connections:\n   ```bash\n   pnpm tui -c my-channel\n   ```\n   The stored key is automatically loaded.\n\n3. To change a key, press `C` to open the channel selector, select the channel, and enter the new key.\n\n### Config File Location\n\n- **Linux/macOS**: `~/.abbacchio/tui-config.json`\n- **Windows**: `C:\\Users\\<username>\\.abbacchio\\tui-config.json`\n\n## Keyboard Shortcuts\n\n| Key | Action |\n|-----|--------|\n| `q` | Quit |\n| `p` / `Space` | Pause/Resume log stream |\n| `j` / `↓` | Scroll down |\n| `k` / `↑` | Scroll up |\n| `g` | Go to top |\n| `G` | Go to bottom |\n| `/` | Search logs |\n| `1` | Filter: trace+ |\n| `2` | Filter: debug+ |\n| `3` | Filter: info+ |\n| `4` | Filter: warn+ |\n| `5` | Filter: error+ |\n| `6` | Filter: fatal only |\n| `0` | Show all levels |\n| `c` | Clear logs |\n| `C` | Open channel selector |\n| `?` | Show help |\n| `Esc` | Clear filters / Go back |\n\n## Architecture\n\n```\nsrc/\n├── cli.ts                # CLI entry point (meow)\n├── index.tsx             # Ink render entry\n├── App.tsx               # Main component\n├── components/\n│   ├── Header.tsx        # Channel, status, log count\n│   ├── LogList.tsx       # Scrollable log list\n│   ├── LogRow.tsx        # Individual log with colors\n│   ├── FilterBar.tsx     # Level filter, search\n│   ├── StatusBar.tsx     # Keyboard shortcuts\n│   ├── HelpOverlay.tsx   # Full help screen\n│   └── ChannelSelector.tsx # Channel/key management UI\n├── hooks/\n│   ├── useCentrifugo.ts  # Centrifugo WebSocket connection\n│   ├── useLogStore.ts    # Log state and filtering\n│   ├── useKeyBindings.ts # Keyboard input\n│   └── useChannelConfig.ts # Channel config persistence\n├── lib/\n│   ├── colors.ts         # Level colors (chalk)\n│   ├── crypto.ts         # AES-256-GCM decryption\n│   └── storage.ts        # JSON file storage for config\n└── types/\n    └── index.ts          # TypeScript types\n```\n\n## Dependencies\n\n- **ink** - React for CLI\n- **react** - UI framework\n- **meow** - CLI argument parsing\n- **centrifuge** - Centrifugo client for WebSocket\n- **ws** - WebSocket implementation for Node.js\n- **chalk** - Terminal colors\n- **ink-text-input** - Text input component\n- **ink-select-input** - Select/dropdown component\n\n## Connection Flow\n\n```\n1. TUI fetches token from API: GET /api/centrifugo/token\n2. TUI connects directly to Centrifugo: ws://localhost:8000/connection/websocket\n3. TUI subscribes to channel: logs:{channelName}\n4. Logs are received in real-time via WebSocket\n```\n\nThis is the same connection flow used by the Dashboard and Tauri app.\n\n## Data Storage\n\nThe TUI uses a JSON file for local persistence at `~/.abbacchio/tui-config.json`:\n\n```json\n{\n  \"channels\": [\n    {\n      \"name\": \"my-channel\",\n      \"secretKey\": \"encryption-key-here\",\n      \"createdAt\": 1705123456789,\n      \"lastUsedAt\": 1705123456789\n    }\n  ]\n}\n```\n\nEach channel entry stores:\n- **name**: Channel name (unique identifier)\n- **secretKey**: Encryption key for decrypting logs\n- **createdAt**: Unix timestamp when channel was first added\n- **lastUsedAt**: Unix timestamp of last access (used for sorting)\n","readmeFilename":"README.md","_rev":"1-c19a3e94f4020a880cfb6b6ea4d3ef9e"}