Skip to content
Merged
Show file tree
Hide file tree
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 Apr 19, 2026
a96789f
feat(import-export): support JSON array workflows
Mahmoud-s-Khedr Apr 19, 2026
398ae0c
feat(cli): add nostream CLI and replace shell scripts
Mahmoud-s-Khedr Apr 20, 2026
0d168ab
docs(ci): update docs and checks for CLI workflow
Mahmoud-s-Khedr Apr 20, 2026
86b5a00
chore: sync package-lock with package.json
Mahmoud-s-Khedr Apr 20, 2026
7db20be
feat: add CLI management commands and config tooling
Mahmoud-s-Khedr Apr 20, 2026
6793145
feat(cli): update TUI to include stop menu and remove unused formatti…
Mahmoud-s-Khedr Apr 20, 2026
c19adc9
feat(tests): ensure test reports directory is created after build in …
Mahmoud-s-Khedr Apr 20, 2026
09c7793
Merge remote-tracking branch 'origin/main' into feat-001
Mahmoud-s-Khedr Apr 20, 2026
12331f9
Merge branch 'main' into feat-001
Mahmoud-s-Khedr Apr 22, 2026
cce1670
Merge main into feat-001 and resolve conflicts
Mahmoud-s-Khedr Apr 25, 2026
3a6ee40
feat(cli): add JSON output support for info and config commands; remo…
Mahmoud-s-Khedr Apr 25, 2026
7f5fb26
feat(cli): enhance setup and info commands with JSON output and secre…
Mahmoud-s-Khedr Apr 25, 2026
2652d9c
Merge branch 'main' into feat-001
cameri Apr 25, 2026
0ca25c7
feat(cli): refactor setup prompts and error handling in runSetup func…
Mahmoud-s-Khedr Apr 25, 2026
3b54936
feat(cli): update CLI version to match package.json and refactor impo…
Mahmoud-s-Khedr Apr 25, 2026
674e288
chore(merge): resolve main merge conflicts in ci/scripts/docs and rem…
Mahmoud-s-Khedr Apr 25, 2026
a9ecb6a
fix: update integration test scripts to use npm and npx for compatibi…
Mahmoud-s-Khedr Apr 25, 2026
5a45436
docs: update CONTRIBUTING.md to include unified CLI commands for deve…
Mahmoud-s-Khedr Apr 25, 2026
38c0aef
feat(docker): update docker compose commands to use CLI for improved …
Mahmoud-s-Khedr Apr 25, 2026
4ea34d5
Merge branch 'main' into feat-001
Mahmoud-s-Khedr Apr 25, 2026
a612f50
fix: update CLI commands to use pnpm for consistency
Mahmoud-s-Khedr Apr 25, 2026
79074b8
chore: remove outdated development quick start instructions from README
Mahmoud-s-Khedr Apr 25, 2026
b4c9643
Merge branch 'main' into feat-001
Mahmoud-s-Khedr Apr 25, 2026
08456ed
fix: update CLI commands to use pnpm for consistency
Mahmoud-s-Khedr Apr 25, 2026
b158df6
feat: introduce unified nostream CLI/TUI to replace legacy shell wrap…
Mahmoud-s-Khedr Apr 25, 2026
73575ab
fix: correct consistency issues in CLI/TUI after pnpm migration
Mahmoud-s-Khedr Apr 25, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/sour-dolls-sip.md
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`
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@ WORKER_COUNT=2 # Defaults to CPU count. Use 1 or 2 for local testing.
# HIDDEN_SERVICE_PORT=80

# --- I2P (Optional) ---
# To enable I2P, use: ./scripts/start_with_i2p
# To enable I2P, use: nostream start --i2p
# I2P tunnel configuration lives in i2p/tunnels.conf and i2p/i2pd.conf.
# No application-level env vars are needed; the i2pd sidecar handles everything.
6 changes: 6 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ jobs:
run: pnpm install --frozen-lockfile
- name: Run build check
run: pnpm run build:check
- name: Build artifacts
run: pnpm run build
- name: Verify built CLI entrypoint
run: pnpm run verify:cli:build
test-units-and-cover:
name: Unit Tests And Coverage
runs-on: ubuntu-latest
Expand All @@ -80,6 +84,8 @@ jobs:
run: pnpm install --frozen-lockfile
- name: Run unit tests
run: pnpm run test:unit
- name: Run CLI test suite
run: pnpm run test:cli
- name: Run coverage for unit tests
run: pnpm run cover:unit
if: ${{ always() }}
Expand Down
16 changes: 10 additions & 6 deletions .knip.json
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!"
],
Comment thread
Mahmoud-s-Khedr marked this conversation as resolved.
"ignoreDependencies": [
"lzma-native"
],
"ignoreFiles": [],
"ignore": [
".nostr/**"
],
"commitlint": false,
"eslint": false,
"github-actions": false,
"husky": false,
"mocha": false,
"nyc": false,
"semantic-release": false
}
}
138 changes: 138 additions & 0 deletions CLI.md
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
```
3 changes: 1 addition & 2 deletions CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ Tunnel keys are persisted at `.nostr/i2p/data/` so the `.b32.i2p` address surviv

The i2pd web console (tunnel status, `.b32.i2p` destinations) is published to the host on **`127.0.0.1:7070`** only. Remove the `ports:` mapping in `docker-compose.i2p.yml` to disable host-side access.

- Start with I2P: `./scripts/start_with_i2p`
- Print hostname hints: `./scripts/print_i2p_hostname`
- Start with I2P: `nostream start --i2p`

If you've set READ_REPLICAS to 4, you should configure RR0_ through RR3_.

Expand Down
13 changes: 10 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ corepack enable
pnpm install
```

Use the unified CLI for relay lifecycle and supported development operations from this source
checkout:

```
pnpm run cli -- --help
```

> **Important:** Pre-commit hooks installed by Husky run linting and formatting checks on every
> commit. Do **not** bypass them with `git commit --no-verify`. If a hook fails, fix the reported
> issues before committing.
Expand All @@ -56,7 +63,7 @@ pnpm install
Start the relay (runs in the foreground until stopped with Ctrl+C):

```
./scripts/start
pnpm run cli -- start
```

### Development Quick Start (Standalone)
Expand Down Expand Up @@ -149,7 +156,7 @@ cd /path/to/nostream
Run unit tests:

```
pnpm test:unit
pnpm run cli -- dev test:unit
```

Run unit tests in watch mode:
Expand Down Expand Up @@ -223,7 +230,7 @@ DB_MAX_POOL_SIZE=2
Run the integration tests:

```
pnpm test:integration
pnpm run cli -- dev test:integration
```

Open the integration test report:
Expand Down
Loading
Loading