diff --git a/pkgs/id/README.md b/pkgs/id/README.md index 2554cf5162..ad36038f3e 100644 --- a/pkgs/id/README.md +++ b/pkgs/id/README.md @@ -44,9 +44,10 @@ just serve ### With Cargo ```bash -# Library-only (no web UI) -cargo build --no-default-features -cargo run --no-default-features -- serve +# Default build: sandbox and world included, no web UI +# (--no-default-features would also remove sandbox and world) +cargo build +cargo run -- serve # With web UI (build assets first) cd web && bun install && bun run build && cd .. @@ -66,8 +67,8 @@ id get myfile.txt # List all files id list -# Find files by pattern -id find "*.rs" +# Find files by query (case-insensitive substring; no glob matching) +id find ".rs" # Search files id search "hello" @@ -256,7 +257,7 @@ it is — a valid world capability, minted by the host's admin with | `peek` | | Preview with configurable head/tail lines | | `find` | | Find files by query, optionally output content | | `search` | | Search files and list all matches | -| `list` | `ls` | List all stored files | +| `list` | | List all stored files | | `tag` | `label`, `link` | Manage metadata tags on files | | `migrate-tags` | `migrate` | Add name/file auto-tags to existing files | | `id` | | Print local node public ID | @@ -313,7 +314,8 @@ id repl > tag search author:Jane # Structured search syntax > tag find readme # find = search alias > migrate-tags # Add name/file tags to all files -> cat myfile.txt | head -5 # Pipe output to shell +> !head -5 myfile.txt # Shell escape: run any shell command +> printf 'bread\n' |> put - bakery.txt # Pipe shell output into a stored file > $(id id) # Subshell expansion > help # Show all commands ``` diff --git a/pkgs/id/book/getting-started/installation.md b/pkgs/id/book/getting-started/installation.md index 6cfb7c0979..6181f179b1 100644 --- a/pkgs/id/book/getting-started/installation.md +++ b/pkgs/id/book/getting-started/installation.md @@ -69,10 +69,10 @@ The root package's feature table is the authority: - `currency-poc-tb` adds the TigerBeetle client for the currency proof of concept. It adds no CLI surface. -### The `--no-default-features` trap (disagreement CLI-2) +### The `--no-default-features` trap (disagreement CLI-2, resolved) -The README's Cargo quick start presents this command as the library-only -build: +The README's Cargo quick start once presented this command as the +library-only build: ```bash cargo build --no-default-features @@ -84,8 +84,9 @@ Because `default = [sandbox, world]`, `--no-default-features` removes in a `--no-default-features` build are: - `id match-audit` and the four sandbox world commands — `id world dev`, - `id world measure`, `id world replay`, `id world verify` — do not exist - in the parser at all. Clap reports them as unrecognized subcommands. + `id world measure`, `id world replay`, `id world verify` — still parse + and print their `--help`, but fail at dispatch with the error + `this build has no sandbox support`. - Every other `id world …` command still parses and still prints its full `--help` tree, but fails at runtime with the error `this build has no world support`. @@ -136,9 +137,10 @@ Inside the data directory, the layout is: | `groups.jsonl` | The group log used by `group`, `delegate`, and `revoke`. This is the runtime default of the global `--groups-log ` flag; a relative value is relative to the data directory. | One disagreement is worth knowing before you go looking for the lock: -the module documentation in `crates/id-cli/src/commands/serve.rs` draws -the lock file as `.id-serve-lock`. That spelling is wrong (disagreement -CLI-5). The constant, the `--data-dir` help text, and the code all use +the module documentation in `crates/id-cli/src/commands/serve.rs` once +drew the lock file as `.id-serve-lock`. That spelling was wrong +(disagreement CLI-5, resolved — the module documentation now matches). +The constant, the `--data-dir` help text, and the code all use `.iroh-serve.lock`. `id serve --ephemeral` skips provisioning entirely: it uses in-memory diff --git a/pkgs/id/book/reference/cli-files.md b/pkgs/id/book/reference/cli-files.md index 58aa190ea8..365260e6fc 100644 --- a/pkgs/id/book/reference/cli-files.md +++ b/pkgs/id/book/reference/cli-files.md @@ -36,7 +36,7 @@ Aliases: `in`, `add`, `store`, `import`. Behaviour notes: - Each `FILES` entry is a path. The form `path:name` renames the file during storage: the bytes come from `path` and the stored name is `name`. -- With `--content`, the single positional argument is the stored name, not a path. Supplying zero or more than one name fails with `--content requires exactly one name argument`. Discrepancy CLI-14: the `--help` summary line for `--content` ("Read content from stdin instead of file paths") omits the one-name requirement; the requirement is stated in the field documentation and enforced by the handler. +- With `--content`, the single positional argument is the stored name, not a path. Supplying zero or more than one name fails with `--content requires exactly one name argument`. The `--help` summary line for `--content` states the requirement ("Read content from stdin instead of file paths (requires exactly one name argument)"); an earlier summary line omitted it (discrepancy CLI-14, resolved). The requirement is also stated in the field documentation and enforced by the handler. - With no files and no stdin input, `put` fails with `no files provided`. - When several files are stored and some fail, the failures are collected into one aggregated error, `some puts failed:` followed by the individual failures, and the command exits 1. @@ -204,7 +204,7 @@ id list [NODE] Behaviour notes: - Lists all stored files (names) in the local store, or in the remote node's store when `NODE` (a 64-character hex node ID) is given. -- Discrepancy CLI-1: `list` has no `ls` alias in the clap parser. `id ls` fails with `error: unrecognized subcommand 'ls'` and the tip "a similar subcommand exists: 'list'" (exit 2), even though the README command table lists `ls` as an alias. The `ls` spelling exists only inside the REPL, and as the alias of `tag list` (see [The tag family](cli-tags.md)). +- `list` has no `ls` alias in the clap parser. `id ls` fails with `error: unrecognized subcommand 'ls'` and the tip "a similar subcommand exists: 'list'" (exit 2). The README command table once listed `ls` as an alias (discrepancy CLI-1, resolved — the table no longer does). The `ls` spelling exists only inside the REPL, and as the alias of `tag list` (see [The tag family](cli-tags.md)). Worked example (toy data): @@ -250,7 +250,7 @@ Failure shapes: a store that cannot be opened is a handler error (exit 1). - Queries are case-insensitive and match against both names and hashes. - Match quality is ordered: exact match ranks above prefix match, which ranks above contains (substring) match. -- Discrepancy CLI-8: there is no glob or wildcard matching anywhere in the search implementation. A query of `*.rs` is the literal two-character substring `*.` followed by `rs`; in practice it matches nothing, despite the README usage example `id find "*.rs"` being labelled "Find files by pattern". +- There is no glob or wildcard matching anywhere in the search implementation. A query of `*.rs` is the literal two-character substring `*.` followed by `rs`; in practice it matches nothing. The README usage example once labelled `id find "*.rs"` "Find files by pattern" (discrepancy CLI-8, resolved — the example now uses a substring query). - `--first [N]` and `--last [N]` are optional-value flags on all four commands. Each takes zero or one value (`num_args = 0..=1`); a bare `--first` or `--last` means `1`. The two flags conflict with each other. A value of `0` is rejected by the value parser with `zero is not a valid limit: use at least 1` (clap error, exit 2); a non-numeric value fails in the same parser. - `--exclude ` is repeatable on all four commands and drops matches whose name or hash contains the pattern. - `--name` is accepted by all four commands and makes name matches rank above hash matches. @@ -267,7 +267,7 @@ Failure shapes: a store that cannot be opened is a handler error (exit 1). | `group` | Matches grouped by query. | | `union` | Matches deduplicated by hash. | -The clap default is `tag`. Discrepancy CLI-11: the REPL's `find` and `search` default to `union`, because the REPL hand parser enters with `union` as its default format. The same query therefore prints tag-grouped output from the command line and union-deduplicated output in the REPL, and neither side's help mentions the other's default. +The clap default is `tag`. The REPL's `find` and `search` default to `union`, because the REPL hand parser enters with `union` as its default format. The same query therefore prints tag-grouped output from the command line and union-deduplicated output in the REPL. Each side's help now names the other's default (discrepancy CLI-11, resolved). ## `find` diff --git a/pkgs/id/book/reference/cli-gallery-walk.md b/pkgs/id/book/reference/cli-gallery-walk.md index e22e136c11..adf3681206 100644 --- a/pkgs/id/book/reference/cli-gallery-walk.md +++ b/pkgs/id/book/reference/cli-gallery-walk.md @@ -6,7 +6,7 @@ Three unrelated command groups share this chapter. `id gallery` administers the Exit behaviour, all commands in this chapter unless a command states otherwise: success exits `0`; a handler error prints `Error: ` to stderr and exits `1`; a clap parse error (unknown subcommand or flag, missing required argument, conflicting flags, bad value) prints the error and usage to stderr and exits `2`. -Feature gating differs per group. `id gallery` and `id walk` are not feature-gated: both work in every build, including a `--no-default-features` build. `id match-audit` is gated on the `sandbox` cargo feature at the parser level: in a build without `sandbox` the command does not exist in help or in the parser, and invoking it is a clap error, exit `2`. That is one half of disagreement CLI-10; the other half is `id world`, which parses without its feature and fails only at runtime — see [World commands: joining and playing](cli-worlds.md). +Feature gating differs per group. `id gallery` and `id walk` are not feature-gated: both work in every build, including a `--no-default-features` build. `id match-audit` parses in every build but needs the `sandbox` cargo feature at dispatch: in a build without `sandbox` it fails with `this build has no sandbox support`, exit `1` — the same parse-everywhere, fail-at-dispatch pattern as `id world`, which parses without its feature and fails only at runtime (disagreement CLI-10, resolved; see [World commands: joining and playing](cli-worlds.md)). ## `gallery` @@ -229,7 +229,7 @@ Failures: giving neither `--program` nor `--author` is a clap error, exit `2` (t ## `match-audit` -Exports and verifies match-audit v0 logs for tic-tac-toe. The whole command is gated on the `sandbox` cargo feature; see the gating note at the top of this chapter. +Exports and verifies match-audit v0 logs for tic-tac-toe. The whole command needs the `sandbox` cargo feature at dispatch; see the gating note at the top of this chapter. ### `match-audit export-tic-tac-toe` @@ -249,7 +249,7 @@ Example: $ id match-audit export-tic-tac-toe --output ./toy-match.log ``` -Failures: an unwritable output path fails the command, exit `1`. In a build without the `sandbox` feature the command does not exist: clap error, exit `2`. +Failures: an unwritable output path fails the command, exit `1`. In a build without the `sandbox` feature the command fails at dispatch with `this build has no sandbox support`, exit `1`. ### `match-audit verify` @@ -269,7 +269,7 @@ Example: $ id match-audit verify ./toy-match.log ``` -Failures: a log that does not verify against the pinned program fails the command, exit `1`. A missing log file fails the command, exit `1`. In a build without the `sandbox` feature the command does not exist: clap error, exit `2`. +Failures: a log that does not verify against the pinned program fails the command, exit `1`. A missing log file fails the command, exit `1`. In a build without the `sandbox` feature the command fails at dispatch with `this build has no sandbox support`, exit `1`. ## `walk` diff --git a/pkgs/id/book/reference/cli-groups-identity.md b/pkgs/id/book/reference/cli-groups-identity.md index 3cca343ea9..bd26675c6b 100644 --- a/pkgs/id/book/reference/cli-groups-identity.md +++ b/pkgs/id/book/reference/cli-groups-identity.md @@ -170,7 +170,7 @@ Failures: a non-Admin author is refused, exit `1`, and the refused event stays i ### `group join` -Parses an invitation ticket, then always fails. Group admission and network joining are not implemented: no group membership is ever recorded by this command. This is the source behaviour, and it contradicts the top-level help, which lists `join` among the things `group` can do (disagreement CLI-9). The subcommand's own help states the truth in its first line: `Unavailable: group admission and network joining are not implemented yet`. +Parses an invitation ticket, then always fails. Group admission and network joining are not implemented: no group membership is ever recorded by this command. This is the source behaviour; the top-level help once listed `join` among the things `group` can do (disagreement CLI-9, resolved — it no longer does). The subcommand's own help states the truth in its first line: `Unavailable: group admission and network joining are not implemented yet`. ``` id group join diff --git a/pkgs/id/book/reference/cli-serve.md b/pkgs/id/book/reference/cli-serve.md index 84f2d71984..18fa582f79 100644 --- a/pkgs/id/book/reference/cli-serve.md +++ b/pkgs/id/book/reference/cli-serve.md @@ -28,7 +28,7 @@ id serve [FLAGS] | `--dht` | none (switch) | off | Enable mainline DHT address lookup and publishing for the server's endpoint. The flag exists in the parser regardless of the `dht` cargo feature. | | `--iroh-port` | `PORT` | `0` | Port for the Iroh QUIC endpoint. `0` lets the OS assign a random available port. | -Topic and secret default caveat (discrepancy CLI-6): the help text for `--topic` states "Default: `id-peer-discovery-v1`" and the help text for `--topic-secret` states "Default: `id-public-discovery-v1`". Those two strings are the hardcoded constants, and the constants are the fallback, not the operative default. On a stock serve, the topic and secret are read first from `defaults.json`; the constants apply only when `defaults.json` supplies neither, or when `--no-default-topic` is passed. The `--version` provenance line (see [The id command line](cli.md)) reports which defaults source is in force. Help alone therefore misstates what a stock serve uses. +Topic and secret default caveat: the strings `id-peer-discovery-v1` (topic) and `id-public-discovery-v1` (secret) are the hardcoded constants, and the constants are the fallback, not the operative default. On a stock serve, the topic and secret are read first from `defaults.json`; the constants apply only when `defaults.json` supplies neither, or when `--no-default-topic` is passed. The `--version` provenance line (see [The id command line](cli.md)) reports which defaults source is in force. The `--topic`/`--topic-secret` help text once presented the constants as "the default" (discrepancy CLI-6, resolved — the help now describes them as the fallback). ### Web UI flags diff --git a/pkgs/id/book/reference/cli-worlds.md b/pkgs/id/book/reference/cli-worlds.md index 29bbde03b5..7165931541 100644 --- a/pkgs/id/book/reference/cli-worlds.md +++ b/pkgs/id/book/reference/cli-worlds.md @@ -4,7 +4,7 @@ Source: `pkgs/id/crates/id-cli/src/cli/world.rs` under https://github.com/develo Every `id world` subcommand is a client. No `world` subcommand hosts a world: hosting is `id serve --world`, covered in [serve and publications](cli-serve.md). The commands in this chapter are the participant and authoring side: minting an invite, installing and compiling a program, reading records, joining and chatting, mirroring and downloading, and the local-only commands that scaffold, fork and inspect world directories on disk. The operator side — changing capabilities and profiles, drift, fixtures, replicas and journal files — is in [World commands: administering and verifying](cli-worlds-admin.md). The runtime model behind these commands is in [Worlds and the Roc guest runtime](../concepts/worlds.md) and [Capabilities, ceilings and providers](../concepts/capabilities.md). -Feature gating is inconsistent, and the source behaviour is what this chapter documents (disagreement CLI-10). `id world dev` is gated on the `sandbox` cargo feature at the parser level: in a build without `sandbox`, the subcommand does not exist and clap reports `unrecognized subcommand`, exit `2`. The rest of the `world` tree is not parser-gated: in a build without the `world` feature, `id world --help` prints the full tree, but every `id world` invocation fails at runtime with `this build has no world support`, exit `1`. The default build (`default = [sandbox, world]`) and both Nix packages (`id-web`, `id-lib`) include both features. +Feature gating follows one rule: everything parses, and a missing feature fails at dispatch (disagreement CLI-10, resolved — gating was once inconsistent). The whole `world` tree parses in every build: in a build without the `world` feature, `id world --help` prints the full tree, but every `id world` invocation fails at runtime with `this build has no world support`, exit `1`. The four sandbox commands — `id world dev`, `id world measure`, `id world replay`, `id world verify` — likewise parse in every build and fail at dispatch in a build without `sandbox` with `this build has no sandbox support`, exit `1`; `id match-audit` follows the same pattern. The default build (`default = [sandbox, world]`) and both Nix packages (`id-web`, `id-lib`) include both features. Exit behaviour, all `world` commands unless a command states otherwise: success exits `0`; a handler error prints `Error: ` to stderr and exits `1`; a clap parse error (unknown subcommand or flag, missing required argument, conflicting flags, bad value) prints the error and usage to stderr and exits `2`. There is no per-command exit-code table in the binary. diff --git a/pkgs/id/book/reference/repl.md b/pkgs/id/book/reference/repl.md index b7c3312dc9..747d1d7a46 100644 --- a/pkgs/id/book/reference/repl.md +++ b/pkgs/id/book/reference/repl.md @@ -33,15 +33,15 @@ The mode is detected at startup and printed in the banner as `id repl ()`. The session target is fixed at startup. In local-serve (`Remote`) mode, individual commands can additionally be aimed at another node with the `@NODE_ID` syntax described below. -### The banner, and what it omits (CLI-12) +### The banner (CLI-12, resolved) At startup the REPL prints a one-line command summary: ```text -commands: list, put, get, cat, gethash, peers, help, quit +commands: list, put, get, cat, gethash, delete, rename, copy, send, find, search, show, peek, tag, tags, peers, migrate-tags, help, quit ``` -That line lists 8 commands. The dispatch in `runner.rs` implements 20 command groups. The banner omits `delete`, `rename`, `copy`, `send`, `find`, `search`, `show`, `peek`, the whole `tag` family, `tags`, and `migrate-tags`, all of which work and all of which the REPL's own `help` command lists. This is disagreement CLI-12: the banner is the incomplete side; the dispatch table in this chapter is the complete one. +The dispatch in `runner.rs` implements 20 command groups, and the banner now names them all. It once listed only 8 commands, omitting `delete`, `rename`, `copy`, `send`, `find`, `search`, `show`, `peek`, the whole `tag` family, `tags`, and `migrate-tags` (disagreement CLI-12, resolved). The dispatch table in this chapter remains the complete reference. ## Command list @@ -112,7 +112,7 @@ Queries are case-insensitive. Match quality is exact, then prefix, then contains ### The format default differs from the clap CLI (CLI-11) -In the REPL, `find` and `search` default to `--format union`. The clap `id find` and `id search` commands default to `--format tag`. The same query therefore prints union-deduplicated output interactively and tag-grouped output non-interactively. Neither side's help mentions the other's default, and the REPL `help` text lists no `--format` flag at all even though the hand parser accepts one. This is disagreement CLI-11; the code behaviour is as stated here. +In the REPL, `find` and `search` default to `--format union`. The clap `id find` and `id search` commands default to `--format tag`. The same query therefore prints union-deduplicated output interactively and tag-grouped output non-interactively. Each side's help now mentions the other's default, and the REPL `help` text lists the `--format` flag the hand parser accepts (disagreement CLI-11, resolved); the code behaviour is as stated here. ### Interactive match selection @@ -177,15 +177,15 @@ error: content requires a name (e.g., put $(cmd) name.txt) - An empty delimiter is an error: `heredoc delimiter cannot be empty`. - Ctrl+C cancels the heredoc. Ctrl+D ends it with what was read. -### The pipe that does not exist (CLI-7) +### The pipe that does not exist (CLI-7, resolved) -The README's REPL section shows: +The README's REPL section once showed: ```text > cat myfile.txt | head -5 # Pipe output to shell ``` -That example does not work. The REPL implements exactly four operators — `<` pipe-in, and `$(…)`/backtick capture — and dispatch splits on whitespace with no `|` handling. The line parses as `cat` with the extra arguments `|`, `head` and `-5`, matches no pattern, and is reported as an unknown command. To send REPL output to a shell tool, fetch the file with `get` first and run the tool outside the REPL, or use the shell escape below. This is disagreement CLI-7; the code behaviour is as stated here. +That example did not work, and the README no longer shows it (disagreement CLI-7, resolved — the example now uses the shell escape and the `|>` pipe-in). The REPL implements exactly four operators — `<` pipe-in, and `$(…)`/backtick capture — and dispatch splits on whitespace with no `|` handling. The line parses as `cat` with the extra arguments `|`, `head` and `-5`, matches no pattern, and is reported as an unknown command. To send REPL output to a shell tool, fetch the file with `get` first and run the tool outside the REPL, or use the shell escape below. The code behaviour is as stated here. ## Shell escape diff --git a/pkgs/id/crates/id-cli/src/cli/match_audit.rs b/pkgs/id/crates/id-cli/src/cli/match_audit.rs index 35a600ff8c..16eea97ba1 100644 --- a/pkgs/id/crates/id-cli/src/cli/match_audit.rs +++ b/pkgs/id/crates/id-cli/src/cli/match_audit.rs @@ -5,7 +5,6 @@ use std::path::PathBuf; use clap::Subcommand; /// Subcommands for `id match-audit`. -#[cfg(feature = "sandbox")] #[derive(Subcommand, Debug)] pub enum MatchAuditCommand { /// Export a reference tic-tac-toe transcript using synthetic demo keys. diff --git a/pkgs/id/crates/id-cli/src/cli/mod.rs b/pkgs/id/crates/id-cli/src/cli/mod.rs index 17f4cf314c..4ebbfe8eec 100644 --- a/pkgs/id/crates/id-cli/src/cli/mod.rs +++ b/pkgs/id/crates/id-cli/src/cli/mod.rs @@ -109,7 +109,6 @@ pub mod claim; pub mod doc; pub mod gallery; pub mod groups; -#[cfg(feature = "sandbox")] pub mod match_audit; pub mod tag; pub mod walk; @@ -120,7 +119,6 @@ pub use claim::{ClaimCommand, ClaimScope}; pub use doc::DocCommand; pub use gallery::{GalleryArgs, GalleryCommand}; pub use groups::{DelegateArgs, GroupCommand, GroupRemoveMode, GroupTemplate, RevokeArgs}; -#[cfg(feature = "sandbox")] pub use match_audit::MatchAuditCommand; pub use tag::TagCommand; pub use walk::WalkCommand; @@ -402,7 +400,10 @@ pub struct ServeArgs { /// Gossip topic name for peer discovery. /// /// All servers on the same topic can discover each other. - /// Default: "id-peer-discovery-v1" (public network). + /// A stock serve reads its topic from `defaults.json` first; + /// the hardcoded constant "id-peer-discovery-v1" (public network) + /// is only the fallback, used when `defaults.json` supplies no + /// topic or `--no-default-topic` is passed. /// Use a custom topic for private networks. #[arg(long)] pub topic: Option, @@ -410,7 +411,10 @@ pub struct ServeArgs { /// /// Used to encrypt DHT bootstrap records. Only nodes with /// the same secret can discover each other via DHT. - /// Default: "id-public-discovery-v1" (public network). + /// A stock serve reads its secret from `defaults.json` first; + /// the hardcoded constant "id-public-discovery-v1" (public + /// network) is only the fallback, used when `defaults.json` + /// supplies no secret or `--no-default-topic` is passed. #[arg(long)] pub topic_secret: Option, /// Skip default bootstrap node IDs from `defaults.json`. @@ -774,7 +778,7 @@ pub enum Command { /// are sent to that remote node. #[arg(required = false)] files: Vec, - /// Read content from stdin instead of file paths. + /// Read content from stdin instead of file paths (requires exactly one name argument). /// /// Requires exactly one name argument for the stored content. #[arg(long, visible_alias = "data", conflicts_with = "stdin")] @@ -1191,6 +1195,9 @@ pub enum Command { /// - `tag`: each match with its query /// - `group`: matches grouped by query /// - `union`: deduplicated by hash + /// + /// The command-line default is `tag`; the REPL's `find` + /// defaults to `union` instead. #[arg(long, default_value = "tag", value_parser = ["tag", "group", "union"])] format: String, /// Return only the first N matches (default 1 if no number given). @@ -1269,7 +1276,10 @@ pub enum Command { /// Output directory for `--all`. #[arg(long)] dir: Option, - /// Output format: tag, group, or union. + /// Output format: tag (default), group, or union. + /// + /// The command-line default is `tag`; the REPL's `search` + /// defaults to `union` instead. #[arg(long, default_value = "tag", value_parser = ["tag", "group", "union"])] format: String, /// Return only the first N matches (default 1 if no number given). @@ -1387,7 +1397,6 @@ pub enum Command { /// posture and operator tags, all on the public transparency list. Gallery(GalleryArgs), /// Export and verify signed match-audit v0 logs. - #[cfg(feature = "sandbox")] #[command(subcommand)] MatchAudit(MatchAuditCommand), /// The #9106 walking skeleton, driven by hand: stored nodes, @@ -1395,7 +1404,7 @@ pub enum Command { /// federation exchange protocol, conflict reports (#12232). #[command(subcommand)] Walk(WalkCommand), - /// Groups: create, show the policy, add, remove, set roles, list, and join (P6.7a). + /// Groups: create, show the policy, add, remove, set roles, and list (P6.7a). /// /// Each action records one event in the group log and prints one line, or one JSON object with /// `--json`. A refused action exits non-zero, and its event stays in the log. @@ -1604,7 +1613,11 @@ pub enum Command { bootstrap: Vec, /// Gossip topic name for peer discovery. /// - /// Default: "id-peer-discovery-v1" (public network). + /// A stock invocation reads its topic from `defaults.json` + /// first; the hardcoded constant "id-peer-discovery-v1" + /// (public network) is only the fallback, used when + /// `defaults.json` supplies no topic or `--no-default-topic` + /// is passed. /// Use a custom topic for private networks. #[arg(long)] topic: Option, diff --git a/pkgs/id/crates/id-cli/src/cli/tests.rs b/pkgs/id/crates/id-cli/src/cli/tests.rs index cb722beb6b..34e2fcaf5e 100644 --- a/pkgs/id/crates/id-cli/src/cli/tests.rs +++ b/pkgs/id/crates/id-cli/src/cli/tests.rs @@ -1489,6 +1489,26 @@ fn test_cli_rejects_serve_replace_defaults() { assert!(Cli::try_parse_from(["id", "serve", "--replace-defaults"]).is_err()); } +#[test] +fn test_cli_rejects_top_level_ls() { + // CLI-1 (#13363): top-level `list` has no `ls` alias in the clap + // parser; `ls` exists only in the REPL and on `tag list`. + assert!(Cli::try_parse_from(["id", "ls"]).is_err()); +} + +#[test] +fn test_cli_parses_match_audit() { + // CLI-10 (#13363): `match-audit` parses in every build, like + // `world`; a build without the `sandbox` feature rejects it at + // dispatch time instead of at parse time. + let cli = Cli::try_parse_from(["id", "match-audit", "verify", "log.bin"]) + .expect("match-audit verify should parse"); + assert!(matches!( + cli.command, + Some(Command::MatchAudit(MatchAuditCommand::Verify { .. })) + )); +} + #[test] fn test_cli_parse_serve_all_new_flags() { let cli = Cli::parse_from([ diff --git a/pkgs/id/crates/id-cli/src/cli/world.rs b/pkgs/id/crates/id-cli/src/cli/world.rs index 5792a3b589..0c098afeb6 100644 --- a/pkgs/id/crates/id-cli/src/cli/world.rs +++ b/pkgs/id/crates/id-cli/src/cli/world.rs @@ -946,7 +946,6 @@ pub enum WorldCommand { /// a named world, and the scratch world is discarded when the /// session ends. Prints one JSON report: the compiled module's /// provenance, the initial view, and the view after each `--input`. - #[cfg(feature = "sandbox")] Dev(WorldDevArgs), /// Show (and, with `--grant`/`--revoke`/`--ceiling`, change) a world's capabilities. /// @@ -1015,7 +1014,6 @@ pub enum WorldCommand { /// Prints one JSON object with, per call kind, the calls made, total and /// worst fuel, and the worst call as a percent of the fuel limit. Exits /// nonzero only if the module fails to compile or a call traps. - #[cfg(feature = "sandbox")] Measure(WorldMeasureArgs), /// Tail a world's recent events (bounded by retention and a deadline). Logs(WorldLogsArgs), @@ -1026,7 +1024,6 @@ pub enum WorldCommand { Record(WorldRecordArgs), /// Replay a recorded fixture offline through a module and compare records. /// Prints a verdict line first; exits nonzero when the records differ. - #[cfg(feature = "sandbox")] Replay(WorldReplayArgs), /// Verify a recorded fixture's determinism: replay it twice offline /// through a module and compare the records after every event. Prints a @@ -1038,7 +1035,6 @@ pub enum WorldCommand { /// Verification covers the events captured by the admin-authorized fixture, /// including host-originated events in their recorded order. It proves /// determinism for that history, not correctness of host policy. - #[cfg(feature = "sandbox")] Verify(WorldVerifyArgs), /// List the worlds a host serves. Without `--admin-token` this reads /// the host's public directory (#812: names, loaded state, presence diff --git a/pkgs/id/crates/id-cli/src/commands/serve.rs b/pkgs/id/crates/id-cli/src/commands/serve.rs index 4abe578ef6..8df00ab0e4 100644 --- a/pkgs/id/crates/id-cli/src/commands/serve.rs +++ b/pkgs/id/crates/id-cli/src/commands/serve.rs @@ -22,14 +22,14 @@ //! │ │ └───────────┘ └───────────┘ │ //! │ │ │ //! │ ▼ │ -//! │ Lock File: .id-serve-lock │ +//! │ Lock File: .iroh-serve.lock │ //! │ - Node ID, PID, Socket addresses │ //! └─────────────────────────────────────────────────────────────┘ //! ``` //! //! # Lock File Protocol //! -//! The serve process creates a lock file (`.id-serve-lock`) containing: +//! The serve process creates a lock file (`.iroh-serve.lock`) containing: //! 1. Node ID (line 1) //! 2. Process ID (line 2) //! 3. Socket addresses (remaining lines) diff --git a/pkgs/id/crates/id-cli/src/commands/world.rs b/pkgs/id/crates/id-cli/src/commands/world.rs index b5221efd11..bd920ca230 100644 --- a/pkgs/id/crates/id-cli/src/commands/world.rs +++ b/pkgs/id/crates/id-cli/src/commands/world.rs @@ -641,6 +641,10 @@ pub async fn cmd_world(command: WorldCommand) -> Result<()> { } => { bail!("--check and --check-suite cannot be combined"); } + #[cfg(not(feature = "sandbox"))] + WorldCommand::Measure(_) => { + bail!("this build has no sandbox support") + } #[cfg(feature = "sandbox")] WorldCommand::Measure(args) => { let crate::cli::WorldMeasureArgs { @@ -759,6 +763,10 @@ pub async fn cmd_world(command: WorldCommand) -> Result<()> { )) .await } + #[cfg(not(feature = "sandbox"))] + WorldCommand::Replay(_) => { + bail!("this build has no sandbox support") + } #[cfg(feature = "sandbox")] WorldCommand::Replay(args) => { let crate::cli::WorldReplayArgs { @@ -770,6 +778,10 @@ pub async fn cmd_world(command: WorldCommand) -> Result<()> { } = args; replay_fixture(&module, &fixture, seed, allow_partial) } + #[cfg(not(feature = "sandbox"))] + WorldCommand::Verify(_) => { + bail!("this build has no sandbox support") + } #[cfg(feature = "sandbox")] WorldCommand::Verify(args) => { let crate::cli::WorldVerifyArgs { @@ -781,6 +793,10 @@ pub async fn cmd_world(command: WorldCommand) -> Result<()> { } = args; verify_fixture(&module, &fixture, seed, allow_partial) } + #[cfg(not(feature = "sandbox"))] + WorldCommand::Dev(_) => { + bail!("this build has no sandbox support") + } #[cfg(feature = "sandbox")] WorldCommand::Dev(args) => { let crate::cli::WorldDevArgs { diff --git a/pkgs/id/crates/id-cli/src/repl/runner.rs b/pkgs/id/crates/id-cli/src/repl/runner.rs index f4ced70b90..e38ebf2e7e 100644 --- a/pkgs/id/crates/id-cli/src/repl/runner.rs +++ b/pkgs/id/crates/id-cli/src/repl/runner.rs @@ -67,7 +67,7 @@ use crate::{ /// ```text /// $ id repl /// id repl (local-serve) -/// commands: list, put, get, cat, gethash, help, quit +/// commands: list, put, get, cat, gethash, delete, rename, copy, send, find, search, show, peek, tag, tags, peers, migrate-tags, help, quit /// input: $(...), `...`, |>, <<<, < list /// abc123... config.json @@ -90,7 +90,9 @@ use crate::{ pub async fn run_repl(target_node: Option) -> Result<()> { let mut ctx = ReplContext::new(target_node).await?; println!("id repl ({})", ctx.mode_str()); - println!("commands: list, put, get, cat, gethash, peers, help, quit"); + println!( + "commands: list, put, get, cat, gethash, delete, rename, copy, send, find, search, show, peek, tag, tags, peers, migrate-tags, help, quit" + ); println!("input: $(...), `...`, |>, <<<, < - Save matches to directory"); println!(" --file, >FILE - Save to file"); + println!( + " --format tag|group|union - Output format (default: union; the command line defaults to tag)" + ); println!(); println!("peek flags:"); println!(" --all - Peek all matches (excerpt of each)"); diff --git a/pkgs/id/src/main.rs b/pkgs/id/src/main.rs index 60f53414bd..8d416e53a3 100644 --- a/pkgs/id/src/main.rs +++ b/pkgs/id/src/main.rs @@ -469,6 +469,8 @@ async fn main() -> Result<()> { Some(Command::Gallery(args)) => id::commands::cmd_gallery(args), #[cfg(feature = "sandbox")] Some(Command::MatchAudit(command)) => id::commands::cmd_match_audit(command), + #[cfg(not(feature = "sandbox"))] + Some(Command::MatchAudit(_)) => anyhow::bail!("this build has no sandbox support"), Some(Command::Walk(command)) => id::commands::cmd_walk(command).await, #[cfg(feature = "world")] Some(Command::World(world_cmd)) => id::commands::cmd_world(*world_cmd).await,