-
Notifications
You must be signed in to change notification settings - Fork 231
feat: migrate nostream scripts to unified CLI/TUI #574
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
540c128
chore(deps): add CLI and import/export dependencies
Mahmoud-s-Khedr a96789f
feat(import-export): support JSON array workflows
Mahmoud-s-Khedr 398ae0c
feat(cli): add nostream CLI and replace shell scripts
Mahmoud-s-Khedr 0d168ab
docs(ci): update docs and checks for CLI workflow
Mahmoud-s-Khedr 86b5a00
chore: sync package-lock with package.json
Mahmoud-s-Khedr 7db20be
feat: add CLI management commands and config tooling
Mahmoud-s-Khedr 6793145
feat(cli): update TUI to include stop menu and remove unused formatti…
Mahmoud-s-Khedr c19adc9
feat(tests): ensure test reports directory is created after build in …
Mahmoud-s-Khedr 09c7793
Merge remote-tracking branch 'origin/main' into feat-001
Mahmoud-s-Khedr 12331f9
Merge branch 'main' into feat-001
Mahmoud-s-Khedr cce1670
Merge main into feat-001 and resolve conflicts
Mahmoud-s-Khedr 3a6ee40
feat(cli): add JSON output support for info and config commands; remo…
Mahmoud-s-Khedr 7f5fb26
feat(cli): enhance setup and info commands with JSON output and secre…
Mahmoud-s-Khedr 2652d9c
Merge branch 'main' into feat-001
cameri 0ca25c7
feat(cli): refactor setup prompts and error handling in runSetup func…
Mahmoud-s-Khedr 3b54936
feat(cli): update CLI version to match package.json and refactor impo…
Mahmoud-s-Khedr 674e288
chore(merge): resolve main merge conflicts in ci/scripts/docs and rem…
Mahmoud-s-Khedr a9ecb6a
fix: update integration test scripts to use npm and npx for compatibi…
Mahmoud-s-Khedr 5a45436
docs: update CONTRIBUTING.md to include unified CLI commands for deve…
Mahmoud-s-Khedr 38c0aef
feat(docker): update docker compose commands to use CLI for improved …
Mahmoud-s-Khedr 4ea34d5
Merge branch 'main' into feat-001
Mahmoud-s-Khedr a612f50
fix: update CLI commands to use pnpm for consistency
Mahmoud-s-Khedr 79074b8
chore: remove outdated development quick start instructions from README
Mahmoud-s-Khedr b4c9643
Merge branch 'main' into feat-001
Mahmoud-s-Khedr 08456ed
fix: update CLI commands to use pnpm for consistency
Mahmoud-s-Khedr b158df6
feat: introduce unified nostream CLI/TUI to replace legacy shell wrap…
Mahmoud-s-Khedr 73575ab
fix: correct consistency issues in CLI/TUI after pnpm migration
Mahmoud-s-Khedr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| "nostream": major | ||
| --- | ||
|
|
||
| Add a brand-new unified `nostream` CLI/TUI that replaces the legacy `scripts/*` shell wrappers for lifecycle, setup, info, config, data, and development workflows. | ||
|
|
||
| **Fixes** | ||
| - fixed some consistnacy issues after the migration from `npm` to `pnpm` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,22 +1,26 @@ | ||
| { | ||
| "$schema": "https://unpkg.com/knip@2/schema.json", | ||
| "entry": [ | ||
| "src/index.ts", | ||
| "src/import-events.ts", | ||
| "knexfile.js" | ||
| "src/index.ts!", | ||
| "src/import-events.ts!", | ||
| "src/cli/index.ts!", | ||
| "src/scripts/benchmark-queries.ts!", | ||
| "knexfile.js!" | ||
| ], | ||
| "project": [ | ||
| "src/**/*.ts" | ||
| "src/**/*.ts!" | ||
| ], | ||
| "ignoreDependencies": [ | ||
| "lzma-native" | ||
| ], | ||
| "ignoreFiles": [], | ||
| "ignore": [ | ||
| ".nostr/**" | ||
| ], | ||
| "commitlint": false, | ||
| "eslint": false, | ||
| "github-actions": false, | ||
| "husky": false, | ||
| "mocha": false, | ||
| "nyc": false, | ||
| "semantic-release": false | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,138 @@ | ||
| # Nostream CLI | ||
|
|
||
| Nostream ships a unified command-line interface: | ||
|
|
||
| ```bash | ||
| nostream --help | ||
| pnpm run cli -- --help | ||
| ``` | ||
|
|
||
| When run with no arguments in an interactive terminal, `nostream` launches an interactive TUI. | ||
| In non-interactive environments, it prints help and exits successfully. | ||
|
|
||
| ## Exit Codes | ||
|
|
||
| - `0`: success | ||
| - `1`: runtime/validation error | ||
| - `2`: usage error (invalid command/options) | ||
|
|
||
| ## Core Commands | ||
|
|
||
| ```bash | ||
| nostream start [--tor] [--i2p] [--nginx] [--debug] [--port 8008] | ||
| nostream stop [--all|--tor|--i2p|--nginx|--local] | ||
| nostream info [--tor-hostname] [--i2p-hostname] [--json] | ||
| nostream update | ||
| nostream clean | ||
| nostream setup [--yes] [--start] | ||
| nostream seed [--count 100] | ||
| nostream import [file.jsonl|file.json] [--file file.jsonl|file.json] [--batch-size 1000] | ||
| nostream export [output] [--output output] [--format jsonl|json] | ||
| ``` | ||
|
|
||
| ## Removed Legacy Wrappers | ||
|
|
||
| The old shell wrapper scripts are no longer shipped in `scripts/`. | ||
| Use the unified `nostream` CLI directly instead: | ||
|
|
||
| ```bash | ||
| scripts/start -> nostream start | ||
| scripts/start_with_tor -> nostream start --tor | ||
| scripts/start_with_i2p -> nostream start --i2p | ||
| scripts/start_with_nginx -> nostream start --nginx | ||
| scripts/stop -> nostream stop | ||
| scripts/print_tor_hostname -> nostream info --tor-hostname | ||
| scripts/print_i2p_hostname -> nostream info --i2p-hostname | ||
| scripts/update -> nostream update | ||
| scripts/clean -> nostream clean | ||
| ``` | ||
|
|
||
| ## Configuration Commands | ||
|
|
||
| ```bash | ||
| nostream config list | ||
| nostream config list --json | ||
| nostream config get <path> | ||
| nostream config get <path> --json | ||
| nostream config set <path> <value> [--type inferred|json] [--validate|--no-validate] [--restart] | ||
| nostream config validate | ||
|
|
||
| nostream config env list [--show-secrets] | ||
| nostream config env get <key> [--show-secrets] | ||
| nostream config env set <key> <value> | ||
| nostream config env validate | ||
| ``` | ||
|
|
||
| Path syntax supports dot keys and array indexes: | ||
|
|
||
| ```bash | ||
| nostream config get limits.event.content[0].maxLength | ||
| nostream config set limits.event.content[0].maxLength 2048 | ||
| nostream config set nip05.domainWhitelist '["example.com","relay.io"]' --type json | ||
| ``` | ||
|
|
||
| ## Development Commands | ||
|
|
||
| ```bash | ||
| nostream dev db:clean [--all|--older-than=30|--kinds=1,7,4] [--dry-run] [--force] | ||
| nostream dev db:reset [--yes] | ||
| nostream dev seed:relay | ||
| nostream dev docker:clean [--yes] | ||
| nostream dev test:unit | ||
| nostream dev test:cli | ||
| nostream dev test:integration | ||
| ``` | ||
|
|
||
| ## TUI Navigation | ||
|
|
||
| Run: | ||
|
|
||
| ```bash | ||
| nostream | ||
| ``` | ||
|
|
||
| Main menu includes: | ||
| - Start relay | ||
| - Stop relay | ||
| - Configure settings | ||
| - Manage data (export/import) | ||
| - Development tools | ||
| - View relay info | ||
| - Exit | ||
|
|
||
| TUI behavior highlights: | ||
| - Each submenu includes an explicit `Back` option, so you can return without using signal keys. | ||
| - Start menu prompts for Tor/I2P/Debug, optional custom port, and final confirmation. | ||
| - Configure menu offers guided editing for common categories such as payments, network, and limits. | ||
| - Advanced dot-path get/set remains available for full settings access. | ||
| - Manage menu asks for import/export format and file paths. | ||
| - Dev menu displays explicit destructive warnings before DB reset/clean and Docker clean. | ||
|
|
||
| ## Common Workflows | ||
|
|
||
| ```bash | ||
| # Start relay with Tor + I2P | ||
| nostream start --tor --i2p | ||
|
|
||
| # Print Tor hostname | ||
| nostream info --tor-hostname | ||
|
|
||
| # Machine-readable output for automation | ||
| nostream info --json | ||
| nostream config list --json | ||
| nostream config get payments.enabled --json | ||
|
|
||
| # Import and export events | ||
| nostream import --file ./events.jsonl --batch-size 500 | ||
| nostream import --file ./events.json --batch-size 500 | ||
| nostream export --output backup.jsonl --format jsonl | ||
| nostream export --output backup.json --format json | ||
|
|
||
| # Update YAML settings and restart relay | ||
| nostream config set payments.enabled true --restart | ||
|
|
||
| # Update env settings | ||
| nostream config env set RELAY_PORT 8008 | ||
| nostream config env get SECRET --show-secrets | ||
| nostream config env validate | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.