|
| 1 | +# Nostream CLI |
| 2 | + |
| 3 | +Nostream ships a unified command-line interface: |
| 4 | + |
| 5 | +```bash |
| 6 | +nostream --help |
| 7 | +pnpm run cli -- --help |
| 8 | +``` |
| 9 | + |
| 10 | +When run with no arguments in an interactive terminal, `nostream` launches an interactive TUI. |
| 11 | +In non-interactive environments, it prints help and exits successfully. |
| 12 | + |
| 13 | +## Exit Codes |
| 14 | + |
| 15 | +- `0`: success |
| 16 | +- `1`: runtime/validation error |
| 17 | +- `2`: usage error (invalid command/options) |
| 18 | + |
| 19 | +## Core Commands |
| 20 | + |
| 21 | +```bash |
| 22 | +nostream start [--tor] [--i2p] [--nginx] [--debug] [--port 8008] |
| 23 | +nostream stop [--all|--tor|--i2p|--nginx|--local] |
| 24 | +nostream info [--tor-hostname] [--i2p-hostname] [--json] |
| 25 | +nostream update |
| 26 | +nostream clean |
| 27 | +nostream setup [--yes] [--start] |
| 28 | +nostream seed [--count 100] |
| 29 | +nostream import [file.jsonl|file.json] [--file file.jsonl|file.json] [--batch-size 1000] |
| 30 | +nostream export [output] [--output output] [--format jsonl|json] |
| 31 | +``` |
| 32 | + |
| 33 | +## Removed Legacy Wrappers |
| 34 | + |
| 35 | +The old shell wrapper scripts are no longer shipped in `scripts/`. |
| 36 | +Use the unified `nostream` CLI directly instead: |
| 37 | + |
| 38 | +```bash |
| 39 | +scripts/start -> nostream start |
| 40 | +scripts/start_with_tor -> nostream start --tor |
| 41 | +scripts/start_with_i2p -> nostream start --i2p |
| 42 | +scripts/start_with_nginx -> nostream start --nginx |
| 43 | +scripts/stop -> nostream stop |
| 44 | +scripts/print_tor_hostname -> nostream info --tor-hostname |
| 45 | +scripts/print_i2p_hostname -> nostream info --i2p-hostname |
| 46 | +scripts/update -> nostream update |
| 47 | +scripts/clean -> nostream clean |
| 48 | +``` |
| 49 | + |
| 50 | +## Configuration Commands |
| 51 | + |
| 52 | +```bash |
| 53 | +nostream config list |
| 54 | +nostream config list --json |
| 55 | +nostream config get <path> |
| 56 | +nostream config get <path> --json |
| 57 | +nostream config set <path> <value> [--type inferred|json] [--validate|--no-validate] [--restart] |
| 58 | +nostream config validate |
| 59 | + |
| 60 | +nostream config env list [--show-secrets] |
| 61 | +nostream config env get <key> [--show-secrets] |
| 62 | +nostream config env set <key> <value> |
| 63 | +nostream config env validate |
| 64 | +``` |
| 65 | + |
| 66 | +Path syntax supports dot keys and array indexes: |
| 67 | + |
| 68 | +```bash |
| 69 | +nostream config get limits.event.content[0].maxLength |
| 70 | +nostream config set limits.event.content[0].maxLength 2048 |
| 71 | +nostream config set nip05.domainWhitelist '["example.com","relay.io"]' --type json |
| 72 | +``` |
| 73 | + |
| 74 | +## Development Commands |
| 75 | + |
| 76 | +```bash |
| 77 | +nostream dev db:clean [--all|--older-than=30|--kinds=1,7,4] [--dry-run] [--force] |
| 78 | +nostream dev db:reset [--yes] |
| 79 | +nostream dev seed:relay |
| 80 | +nostream dev docker:clean [--yes] |
| 81 | +nostream dev test:unit |
| 82 | +nostream dev test:cli |
| 83 | +nostream dev test:integration |
| 84 | +``` |
| 85 | + |
| 86 | +## TUI Navigation |
| 87 | + |
| 88 | +Run: |
| 89 | + |
| 90 | +```bash |
| 91 | +nostream |
| 92 | +``` |
| 93 | + |
| 94 | +Main menu includes: |
| 95 | +- Start relay |
| 96 | +- Stop relay |
| 97 | +- Configure settings |
| 98 | +- Manage data (export/import) |
| 99 | +- Development tools |
| 100 | +- View relay info |
| 101 | +- Exit |
| 102 | + |
| 103 | +TUI behavior highlights: |
| 104 | +- Each submenu includes an explicit `Back` option, so you can return without using signal keys. |
| 105 | +- Start menu prompts for Tor/I2P/Debug, optional custom port, and final confirmation. |
| 106 | +- Configure menu offers guided editing for common categories such as payments, network, and limits. |
| 107 | +- Advanced dot-path get/set remains available for full settings access. |
| 108 | +- Manage menu asks for import/export format and file paths. |
| 109 | +- Dev menu displays explicit destructive warnings before DB reset/clean and Docker clean. |
| 110 | + |
| 111 | +## Common Workflows |
| 112 | + |
| 113 | +```bash |
| 114 | +# Start relay with Tor + I2P |
| 115 | +nostream start --tor --i2p |
| 116 | + |
| 117 | +# Print Tor hostname |
| 118 | +nostream info --tor-hostname |
| 119 | + |
| 120 | +# Machine-readable output for automation |
| 121 | +nostream info --json |
| 122 | +nostream config list --json |
| 123 | +nostream config get payments.enabled --json |
| 124 | + |
| 125 | +# Import and export events |
| 126 | +nostream import --file ./events.jsonl --batch-size 500 |
| 127 | +nostream import --file ./events.json --batch-size 500 |
| 128 | +nostream export --output backup.jsonl --format jsonl |
| 129 | +nostream export --output backup.json --format json |
| 130 | + |
| 131 | +# Update YAML settings and restart relay |
| 132 | +nostream config set payments.enabled true --restart |
| 133 | + |
| 134 | +# Update env settings |
| 135 | +nostream config env set RELAY_PORT 8008 |
| 136 | +nostream config env get SECRET --show-secrets |
| 137 | +nostream config env validate |
| 138 | +``` |
0 commit comments