diff --git a/pkgs/atlas-search/book/development/release-and-rollout.md b/pkgs/atlas-search/book/development/release-and-rollout.md index 932fcf9554..3be4c3bbe3 100644 --- a/pkgs/atlas-search/book/development/release-and-rollout.md +++ b/pkgs/atlas-search/book/development/release-and-rollout.md @@ -133,9 +133,9 @@ them on. The standing examples: the `Install` section arrived at the step-6 cutover. A new service role follows the same shape — declared, inert, enabled by a separate deliberate change. -- **Experimental search paths are off by default and hidden**: the - shard fan-out behind the hidden `--shards` flag is the CLI-side - example. Hidden and off is the correct posture for a path whose +- **Experimental search paths are off by default**: the shard + fan-out behind the EXPERIMENTAL `--shards` flag is the CLI-side + example. Off by default is the correct posture for a path whose evidence is still being gathered. The rule for a new flag: name it, state its default as a literal value diff --git a/pkgs/atlas-search/book/getting-started/installation.md b/pkgs/atlas-search/book/getting-started/installation.md index 63cab8d24e..9bf7c90b51 100644 --- a/pkgs/atlas-search/book/getting-started/installation.md +++ b/pkgs/atlas-search/book/getting-started/installation.md @@ -64,13 +64,13 @@ parity and evaluation instrument, not the install path. ## What gets installed -One package installs exactly six binaries, all version `0.1.0` where a -version surface exists: +One package installs exactly six binaries, all version `0.1.0`, +each with a `--version` surface: | Binary | What it is | | --- | --- | | `atlas-search` | The access layer: `search`, `get-chunk`, `serve`, `init`, `fetch-model`, `traces`, and `feedback`. The package's `mainProgram`. `--version` prints `atlas-search 0.1.0`. | -| `atlas-stage` | Staging units and the staging registry: `provision`, `lookup`, `ingest`, `items`, `promote`, `units`. It has no `--version` flag — passing one is a usage error, exit 2 (source behaviour; the other hand-rolled tools below likewise have no version surface). | +| `atlas-stage` | Staging units and the staging registry: `provision`, `lookup`, `ingest`, `items`, `promote`, `units`. `--version` prints `atlas-stage 0.1.0`. | | `atlas-classify` | The classification operating procedure: `run`, `schema-review`, `schema-apply` against a corpus database. | | `atlas-eval` | The offline ranking-evaluation runner: two positional arguments, an eval document and a `dev` or `test` split. | | `atlas-sweep` | The ingestion sweep runner: pause/resume a source class, run one sweep request, manage dead letters, report. It creates no schedule; cadence is an operator decision. | diff --git a/pkgs/atlas-search/book/reference/atlas-classify.md b/pkgs/atlas-search/book/reference/atlas-classify.md index 96258e52e5..3e3014a446 100644 --- a/pkgs/atlas-search/book/reference/atlas-classify.md +++ b/pkgs/atlas-search/book/reference/atlas-classify.md @@ -6,8 +6,8 @@ Source: `pkgs/atlas-search/crates/atlas-core/src/bin/atlas-classify.rs`, with de Two facts govern everything about this binary, and both are stated plainly here because its own help states neither: -- **Exit code 2 is the only failure code — for everything.** Usage errors *and* runtime/classification failures all exit 2. This binary has **no exit-1 path**. That includes `--help`: there is no successful help path (see below). -- **The help text states no defaults.** The usage text shows only invocation shapes. Every default in the tables below exists **only in source** and is marked *source-only* as such. +- **Exit code 2 is the only failure code — for everything.** Usage errors *and* runtime/classification failures all exit 2. This binary has **no exit-1 path**. (`--help` and `--version` are not failures: both print to stdout and exit 0 — see below.) +- **The usage text states the defaults.** Its final line lists every default; the tables below repeat them. ## Invocation and the strict parser @@ -18,9 +18,10 @@ usage: atlas-classify --db CORPUS run [--commit] [--window-days N] [--actor A] [--now TS] [--schema-version N] [--max-decisions N] [--manifest-out PATH] atlas-classify --db CORPUS schema-review --old-schema F --new-schema F [--reviewer-model M] [--reviewer-model-version V] [--manifest-out PATH] atlas-classify --db CORPUS schema-apply --review F --dispositions F [--now TS] [--manifest-out PATH] + defaults: --window-days 90; --actor atlas-classify/remainder-sweep; --schema-version 1; --reviewer-model atlas-classify; --reviewer-model-version the crate version; --now the current time; --max-decisions unbounded ``` -**There is no `--help`.** Every invocation shape other than the three documented actions — bare invocation, `--help`, `run --help`, unknown flags, unknown actions, a flag given twice, a missing flag value — prints the usage text to **stderr** and exits **2**. +**`--help` / `-h`** prints the usage text to **stdout** and exits **0**, from any position in the argv; **`--version` / `-V`** prints `atlas-classify 0.1.0`, exit 0. Every other invocation shape other than the three documented actions — bare invocation, unknown flags, unknown actions, a flag given twice, a missing flag value — prints the usage text to **stderr** and exits **2**. The global flag: @@ -43,11 +44,11 @@ atlas-classify --db CORPUS run [--commit] [--window-days N] [--actor A] [--now T | Flag | Argument | Default | Meaning | |---|---|---|---| | `--commit` | switch | off | Commit the run: write one classification record per candidate. Without it, the run is a dry-run that only prints the manifest. | -| `--window-days` | integer (i64, ≥ 0) | `90` — *source-only* (the `DEFAULT_WINDOW_DAYS` constant; the help states no default) | The relatedness window, in days. | -| `--actor` | string | `atlas-classify/remainder-sweep` — *source-only* (the run configuration's default) | The actor name recorded for the run's decisions. | -| `--now` | string (timestamp) | current time as ISO-8601 — *source-only* | The run's notion of now. | -| `--schema-version` | integer (u64) | `1` — *source-only* (the `CURRENT_SCHEMA_VERSION` constant) | The classification schema version to classify under. | -| `--max-decisions` | integer (u64) | none (run to completion) — *source-only* | Cap the run at N decisions. | +| `--window-days` | integer (i64, ≥ 0) | `90` (the `DEFAULT_WINDOW_DAYS` constant; also stated in the usage text) | The relatedness window, in days. | +| `--actor` | string | `atlas-classify/remainder-sweep` (the run configuration's default) | The actor name recorded for the run's decisions. | +| `--now` | string (timestamp) | current time as ISO-8601 | The run's notion of now. | +| `--schema-version` | integer (u64) | `1` (the `CURRENT_SCHEMA_VERSION` constant) | The classification schema version to classify under. | +| `--max-decisions` | integer (u64) | none (run to completion) | Cap the run at N decisions. | | `--manifest-out` | path | — (none) | Also write the manifest to this file. The manifest is always printed to stdout as pretty JSON regardless. | Non-integer or negative values are exit-2 errors naming the flag, e.g. `--window-days must be an integer`, `--window-days must not be negative`. @@ -64,8 +65,8 @@ Compares two schema documents section by section — changed sections only, unle |---|---|---|---| | `--old-schema` | path | — (required) | The current schema document. | | `--new-schema` | path | — (required) | The proposed schema document. | -| `--reviewer-model` | string | `atlas-classify` — *source-only* | The reviewing model name recorded in the batch's provenance. | -| `--reviewer-model-version` | string | `0.1.0` — *source-only* (the crate version, from the build environment) | The reviewing model version recorded in the batch's provenance. | +| `--reviewer-model` | string | `atlas-classify` | The reviewing model name recorded in the batch's provenance. | +| `--reviewer-model-version` | string | `0.1.0` (the crate version, from the build environment) | The reviewing model version recorded in the batch's provenance. | | `--manifest-out` | path | — (none) | Also write the review batch to this file; it is always printed to stdout as pretty JSON. | ## `schema-apply`: apply a reviewed schema change @@ -80,7 +81,7 @@ Applies a review batch's proposals. Each proposal is applied **only** with a rev |---|---|---|---| | `--review` | path | — (required) | The review batch file produced by `schema-review`. | | `--dispositions` | path | — (required) | The dispositions file: one reviewed disposition per proposal to apply. | -| `--now` | string (timestamp) | current time — *source-only* | The apply's notion of now. | +| `--now` | string (timestamp) | current time | The apply's notion of now. | | `--manifest-out` | path | — (none) | Also write the report to this file; it is always printed to stdout as pretty JSON. | ## Worked examples @@ -111,7 +112,7 @@ $ atlas-classify --db /tmp/toy-corpus.db schema-review --old-schema /tmp/toy-sch $ atlas-classify --db /tmp/toy-corpus.db schema-apply --review /tmp/toy-review.json --dispositions /tmp/toy-dispositions.json ``` -Asking for help demonstrates the parser contract — usage on stderr, exit 2: +Asking for help prints the usage text to stdout and exits 0: ``` $ atlas-classify --help @@ -119,14 +120,14 @@ usage: atlas-classify --db CORPUS run [--commit] [--window-days N] [--actor A] [--now TS] [--schema-version N] [--max-decisions N] [--manifest-out PATH] … $ echo $? -2 +0 ``` ## Failure shapes All failures print `atlas-classify: <msg>` (or, for usage errors, the usage text) to stderr and exit **2**. There are no other failure shapes. -- Bare invocation, `--help`, `run --help`, an unknown action, an unknown flag, a duplicated flag, or a missing flag value: the usage text on stderr, exit 2. +- Bare invocation, an unknown action, an unknown flag, a duplicated flag, or a missing flag value: the usage text on stderr, exit 2. - `--db` missing, or given twice (`--db given twice`): exit 2. - A required action flag missing (e.g. `schema-review` without `--new-schema`): exit 2. - A malformed numeric value: an error naming the flag (`--window-days must be an integer`, `--window-days must not be negative`), exit 2. diff --git a/pkgs/atlas-search/book/reference/atlas-eval.md b/pkgs/atlas-search/book/reference/atlas-eval.md index bf0b7f83e3..79ae8f00c7 100644 --- a/pkgs/atlas-search/book/reference/atlas-eval.md +++ b/pkgs/atlas-search/book/reference/atlas-eval.md @@ -10,11 +10,11 @@ Source: [pkgs/atlas-search/crates/atlas-core/src/bin/atlas-eval.rs](https://gith atlas-eval ``` -There are no flags. `--help`, `-h`, and `help` are not recognised: each falls into the wrong-arity path, prints the one-line usage text to stderr, and exits 2. +There are no option flags. `--help` / `-h` prints the one-line usage text to stdout and exits 0; `--version` / `-V` prints `atlas-eval 0.1.0`, exit 0. The literal word `help` is not recognised: it falls into the wrong-arity path, prints the usage text to stderr, and exits 2. | Flag | Argument | Default | Meaning | |---|---|---|---| -| (none) | — | — | This binary takes no `--flag` options at all. | +| (none) | — | — | This binary takes no `--flag` options beyond `--help` / `--version`. | | `<eval.json>` (positional 1) | path to an `atlas-eval/v1` document | required | The evaluation input: queries, qrels, and saved rankings (see below). | | `<dev\|test>` (positional 2) | `dev` or `test` | required | Which split of the input document to score. Any other value is an error: `atlas-eval: unknown split "…" (want dev\|test)`. | @@ -84,7 +84,7 @@ The report's per-signal means carry the four metrics above — `ndcg10`, `recall ## Failure shapes -- Wrong number of arguments, or an unrecognised split: the usage line (or the `unknown split` message) on stderr, exit 2. This includes every spelling of a help request. +- Wrong number of arguments, or an unrecognised split: the usage line (or the `unknown split` message) on stderr, exit 2. - The input file cannot be read: `atlas-eval: cannot read <path>: <error>`, exit 1. - The input parses but is invalid `atlas-eval/v1` data (any validation rule above), or evaluation itself fails: `atlas-eval: <error>`, exit 1. No partial report is printed. diff --git a/pkgs/atlas-search/book/reference/atlas-github-comments.md b/pkgs/atlas-search/book/reference/atlas-github-comments.md index 3c759ae95d..5571dfe1a8 100644 --- a/pkgs/atlas-search/book/reference/atlas-github-comments.md +++ b/pkgs/atlas-search/book/reference/atlas-github-comments.md @@ -4,7 +4,7 @@ Source: [pkgs/atlas-search/crates/atlas-core/src/bin/atlas-github-comments.rs](h `atlas-github-comments` is a one-verb writer: it extracts GitHub comments — issue comments, pull-request review comments, and pull-request reviews — from the repositories Drew controls, and appends them as `atlas-github-comment/v1` records to a JSONL file, so the comments become a corpus source (source class `github comments`, source id `github-comments`). There are no subcommands and no other mode; the single invocation below is the whole tool. -There is no help output at all. The complete surface exists only in the source header, and — stated plainly, because it surprises everyone — **every failure in this binary exits 1, including pure argument errors**. `--help` is not a help path; it is an unknown argument, exit 1. There is no exit-2 path. +The complete surface exists only in the source header. `--help` / `-h` prints the usage line to stdout, exit 0, and `--version` / `-V` prints `atlas-github-comments 0.1.0` — and, stated plainly, because it surprises everyone: **every failure in this binary exits 1, including pure argument errors**. There is no exit-2 path. ## Invocation @@ -20,7 +20,7 @@ atlas-github-comments --state --out [--repo | `--via-service` | switch | off | Go through a running service instead of the local store. | | `--service-url` | URL | the default service URL | Service base URL for `--via-service`. Environment variable: `ATLAS_SEARCH_URL`. | -**The vote-shape rule the help text does not state.** Without `--get`, exactly one of `--up` / `--down` is required — but neither flag is marked required in the help, and the rule is enforced only at runtime: casting with neither is exit 2, `atlas-search: feedback needs exactly one of --up / --down (or --get to retrieve)`. Passing both is a clap conflict error, also exit 2. A `@file` comment whose file cannot be read is exit 1. +**The vote-shape rule.** Without `--get`, exactly one of `--up` / `--down` is required — the help states the rule, and it is enforced at runtime: casting with neither is exit 2, `atlas-search: feedback needs exactly one of --up / --down (or --get to retrieve)`. Passing both is a clap conflict error, also exit 2. A `@file` comment whose file cannot be read is exit 1. ## Worked examples diff --git a/pkgs/atlas-search/book/reference/atlas-search.md b/pkgs/atlas-search/book/reference/atlas-search.md index b3aa37dd74..d6b1e4ea19 100644 --- a/pkgs/atlas-search/book/reference/atlas-search.md +++ b/pkgs/atlas-search/book/reference/atlas-search.md @@ -4,7 +4,7 @@ Source: `pkgs/atlas-search/crates/atlas-search/src/main.rs`, `pkgs/atlas-search/ `atlas-search` is the Atlas access layer: hybrid search over the corpus. This chapter covers its two query verbs, `search` and `get-chunk`. The remaining verbs are in [atlas-search: serve, init, fetch-model, traces and feedback](atlas-search-admin.md). -Standalone is the default and is complete: the query is embedded in-process and the tool talks to Turso (the hosted corpus database) or a local file directly. `--via-service` *prefers* a running service and falls back to standalone **loudly** on any service failure — a warning on stderr plus a note spliced into the result envelope's `notes`. Routing details, including the requests that disqualify the service route without any help text saying so, are under "Via-service vs standalone" below. +Standalone is the default and is complete: the query is embedded in-process and the tool talks to Turso (the hosted corpus database) or a local file directly. `--via-service` *prefers* a running service and falls back to standalone **loudly** on any service failure — a warning on stderr plus a note spliced into the result envelope's `notes`. Routing details, including the requests that disqualify the service route (the `--via-service` help states them too), are under "Via-service vs standalone" below. ## Invocation @@ -101,7 +101,7 @@ All 44 flags of `search` are listed below, in three groups: the verb's own flags | `--hydrate` | integer | `0` | Hydrate the top N results to full chunk + message content from the content store. This is **not** `--expand`, which keeps its neighbour-chunks meaning. Validated: at most 1000. | | `--raw-rows` | optional value: `ungrouped\|branches` | — (off) | Ungrouped output rows: bare `--raw-rows` means `ungrouped` (flat fused rows); `--raw-rows=branches` means pre-fusion branch rows. Distinct from `--raw` (verbatim query), which is not repurposed. | | `--text` | switch | off | Human-readable output instead of JSON. | -| `--shards` | string | — (off) | **Hidden in help** (`hide = true`; it does not appear in `--help` output). Environment variable: `ATLAS_SHARDS`. EXPERIMENTAL, off by default: serve the vector branch from the Atlas core shard fan-out — `dir:<path>` for local shard files, or `turso` / `turso:<org>` for hosted shards. FTS, details and `--expand` stay on the backend. Skips `--via-service` entirely. | +| `--shards` | string | — (off) | Shown in `--help` output. Environment variable: `ATLAS_SHARDS`. EXPERIMENTAL, off by default: serve the vector branch from the Atlas core shard fan-out — `dir:<path>` for local shard files, or `turso` / `turso:<org>` for hosted shards. FTS, details and `--expand` stay on the backend. Skips `--via-service` entirely. | ### Backend flags (flattened, shared with `get-chunk`) @@ -110,7 +110,7 @@ All 44 flags of `search` are listed below, in three groups: the verb's own flags | `--backend` | `auto\|turso\|local` | `auto` | Data backend. `auto`: Turso when a token resolves, else local. | | `--db` | path | canonical `atlas.db` | Local backend: SQLite DB path. Resolution is covered in [Configuration and environment](configuration.md) (the `ATLAS_DB` variable is the first step). | | `--vecdb` | comma-separated paths | — (none) | Local backend: vector DB path(s), if the corpus DB has no vector table. | -| `--via-service` | switch | off | Prefer a running Atlas service; fall back to standalone, loudly. | +| `--via-service` | switch | off | Prefer a running Atlas service; fall back to standalone, loudly. The help states the eligibility restrictions, detailed under "Via-service vs standalone". | | `--service-url` | URL | `http://127.0.0.1:18760` | Service base URL for `--via-service`. Environment variable: `ATLAS_SEARCH_URL`. | ### Vector flags (flattened, `search` only) diff --git a/pkgs/atlas-search/book/reference/atlas-stage.md b/pkgs/atlas-search/book/reference/atlas-stage.md index d38e7abe14..0e58b2d3bc 100644 --- a/pkgs/atlas-search/book/reference/atlas-stage.md +++ b/pkgs/atlas-search/book/reference/atlas-stage.md @@ -20,7 +20,7 @@ Commands: units List units in a lifecycle state (open|closing|merged) ``` -There is **no `--version` / `-V`** on this binary: its command definition sets only a name and an about text, so both spellings are clap errors, exit 2. `-h, --help` works as usual for a clap binary. +`--version` / `-V` prints `atlas-stage 0.1.0` (the crate version), exit 0 — the command definition carries a version, as `atlas-search`'s does. `-h, --help` works as usual for a clap binary. All output is one JSON object per line on stdout. Errors print `atlas-stage: <msg>` on stderr. @@ -74,7 +74,7 @@ Stages one code/config artifact file as an embedding entry in an already-provisi | `--file` | path | — (required) | The local file whose bytes are staged. | | `--commit` | string | — (required) | The commit SHA the bytes were read at. | | `--kind` | `prose\|code\|config` | `config` | The entry kind. | -| `--language` | string | `""` (see note) | The artifact language (yaml, toml, rust, …). **Source behaviour the help does not state:** an empty language is silently replaced by the staged file's extension before the entry is built — the help's `[default: ""]` is therefore misleading. | +| `--language` | string | `""` (see note) | The artifact language (yaml, toml, rust, …). An empty language is replaced by the staged file's extension before the entry is built, as the help states. | | `--sensitivity` | `public\|internal\|secret` | `internal` | Staging tier vocabulary, as in `provision`. | | `--segments` | path | — (none) | Optional JSON file declaring the artifact's source-native classification segments: an array of `{"start": <byte>, "end": <byte>, "sensitivity": shareable\|personal\|local-only\|secret-bearing, "certain": <bool, default true>}` — note the segment sensitivities use the four-level ladder, not the tier vocabulary. When given, the artifact is staged classified: boundary-safe chunks plus one persisted classification record per chunk. Segment files are parsed strictly — missing or mistyped fields, or an unknown sensitivity name, are errors, never defaults. | @@ -145,7 +145,6 @@ $ atlas-stage units --registry /tmp/toy-registry.db --state merged ## Failure shapes - Missing required flags or an unknown verb: a clap usage error, exit 2 — e.g. bare `atlas-stage lookup` fails on its required arguments. -- `--version` / `-V`: a clap `error: unexpected argument`, exit 2 — this binary has no version surface. - Unknown unit in `lookup`: `atlas-stage: no staging unit "<unit>" in the registry`, exit 1. - Unknown sensitivity tier or unknown unit state: `atlas-stage: <msg>`, exit 1. - A malformed `--segments` file (missing/mistyped field, unknown sensitivity name): an error, exit 1 — never a defaulted segment. @@ -158,4 +157,4 @@ $ atlas-stage units --registry /tmp/toy-registry.db --state merged |---|---| | 0 | Success. | | 1 | **All** runtime errors: unknown sensitivity/state, missing unit, file reads, embedder/model absence, registry/DB errors. | -| 2 | Clap usage errors only: unknown verb, missing required flags, and `--version`/`-V`. | +| 2 | Clap usage errors only: unknown verb, missing required flags. | diff --git a/pkgs/atlas-search/book/reference/atlas-sweep.md b/pkgs/atlas-search/book/reference/atlas-sweep.md index 93ea863650..52e744a42d 100644 --- a/pkgs/atlas-search/book/reference/atlas-sweep.md +++ b/pkgs/atlas-search/book/reference/atlas-sweep.md @@ -4,7 +4,7 @@ Source: [pkgs/atlas-search/crates/atlas-core/src/bin/atlas-sweep.rs](https://git `atlas-sweep` is the operator tool for the ingestion sweep: the periodic pass that walks a source class on a host, filters the candidates it finds, applies guardrails, and records what it did. The binary exposes the complete operator set for that core — pausing and resuming classes, running one sweep from a request file, managing the dead-letter store (items that failed repeatedly), and reading run reports. It creates and enables **no schedule**: cadence is an operator/platform decision, gated on Drew's go-ahead on #7969. State lives in a state directory the operator names on every invocation. -There is no help output at all. The complete surface exists only in the source header; an unrecognised first token — including `--help` and `-h` — is an `unknown action` error. +`--help` / `-h` prints the usage text to stdout, exit 0, and `--version` / `-V` prints `atlas-sweep 0.1.0`; the complete surface is otherwise in the source header, and any other unrecognised first token is an `unknown action` error. ## Invocation @@ -79,7 +79,7 @@ The empty `dead-letter list` output and the `[]` cycle report are both successes ## Failure shapes -Every failure in this binary goes through one path: `atlas-sweep: <message>` on stderr, exit 2. That includes missing `--state-dir`, a missing action (`missing action (pause-class|resume-class|run-once|dead-letter|report)`), an unknown action (including `--help`), an unknown source class, missing `--class`/`--host`/`REF`/`RUN_ID` values, an unreadable or unparseable `REQUEST.json`, and I/O and core errors from inside a run. There is no exit-1 path. +Every failure in this binary goes through one path: `atlas-sweep: <message>` on stderr, exit 2. That includes missing `--state-dir`, a missing action (`missing action (pause-class|resume-class|run-once|dead-letter|report)`), an unknown action, an unknown source class, missing `--class`/`--host`/`REF`/`RUN_ID` values, an unreadable or unparseable `REQUEST.json`, and I/O and core errors from inside a run. There is no exit-1 path. ## Exit codes diff --git a/pkgs/atlas-search/book/reference/configuration.md b/pkgs/atlas-search/book/reference/configuration.md index 48e8d6a75a..70035245fe 100644 --- a/pkgs/atlas-search/book/reference/configuration.md +++ b/pkgs/atlas-search/book/reference/configuration.md @@ -12,9 +12,9 @@ Every Atlas configuration surface, in one place: the environment variables the b |---|---|---| | `ATLAS_SEARCH_MODEL` | clap env for `--model` (atlas-search; the Python CLI's argparse default) | `Snowflake/snowflake-arctic-embed-m-v2.0` when unset. | | `ATLAS_VEC_TABLE` | clap env for `--vec-table` (atlas-search; Python) | `vec_snowflake_m_v2_768_f32` when unset. | -| `ATLAS_SEARCH_URL` | `service::base_url` / fleet `client::base_url`, when the `--service-url` flag is absent | `http://127.0.0.1:18760` (`DEFAULT_SERVICE_URL`); trailing `/` trimmed; empty string ignored. Fleet's chain is longer: flag → fleet.toml `[search] url` → this env → default. | -| `ATLAS_SEARCH_SERVICE_CONFIG` | `resolve_service_config_path` (serve/init; the fleet serve/client host marker), when `--config` is absent | `~/.local/state/atlas-search/service.json`; empty string ignored. | -| `ATLAS_SHARDS` | clap env for the hidden `--shards` flag (search) | Unset = monolith backend, no shard fan-out. Grammar: `dir:<path>` (local `atlas-core-*.db` files) or `turso` / `turso:<org>` (default org `dezren39`). | +| `ATLAS_SEARCH_URL` | clap env for `--service-url` (atlas-search); fleet `client::base_url` reads it in its own chain | `http://127.0.0.1:18760` (`DEFAULT_SERVICE_URL`); trailing `/` trimmed; empty string ignored. Fleet's chain is longer: flag → fleet.toml `[search] url` → this env → default. | +| `ATLAS_SEARCH_SERVICE_CONFIG` | clap env for `--config` (serve/init); the default path is resolved by `resolve_service_config_path` when the flag is absent | `~/.local/state/atlas-search/service.json`; empty string ignored. | +| `ATLAS_SHARDS` | clap env for the `--shards` flag (search) | Unset = monolith backend, no shard fan-out. Grammar: `dir:<path>` (local `atlas-core-*.db` files) or `turso` / `turso:<org>` (default org `dezren39`). | | `ATLAS_SEARCH_VIA` | `service::via_env` / fleet `client::via_env` | Only the exact value `service` requests the via-service route; anything else, including unset, = not requested. Fleet delegation explicitly removes it from the standalone child's environment. | | `ATLAS_SEARCH_TOKEN` | `client_token()` (via-service clients: atlas-search and fleet) | First source tried; if unset or empty, resolution falls to the client-config file (`ATLAS_SEARCH_CLIENT_CONFIG`, below). Never printed or logged. | | `ATLAS_SEARCH_CLIENT_CONFIG` | `client_token()` file-path override | Default path `~/.config/atlas-search/client.json` — a JSON object with one `token` string field, expected mode 0600. | diff --git a/pkgs/atlas-search/crates/atlas-core/src/bin/atlas-classify.rs b/pkgs/atlas-search/crates/atlas-core/src/bin/atlas-classify.rs index 2b9b696e1e..1fc795c0cb 100644 --- a/pkgs/atlas-search/crates/atlas-core/src/bin/atlas-classify.rs +++ b/pkgs/atlas-search/crates/atlas-core/src/bin/atlas-classify.rs @@ -20,6 +20,13 @@ //! atlas-classify --db CORPUS.db schema-apply //! --review REVIEW.json --dispositions DISPOSITIONS.json //! [--now TS] [--manifest-out PATH] +//! atlas-classify --help | --version +//! +//! Defaults: --window-days 90, --actor +//! `atlas-classify/remainder-sweep`, --schema-version 1, +//! --reviewer-model `atlas-classify`, --reviewer-model-version +//! the crate version, --now the current time, --max-decisions +//! unbounded. //! //! `run` is a dry-run unless `--commit` is given: it enumerates //! only unclassified/default-state/unresolved embeds, prints the @@ -51,15 +58,19 @@ fn fail(msg: &str) -> ExitCode { ExitCode::from(2) } -fn usage() -> ExitCode { - eprintln!( - "usage:\n atlas-classify --db CORPUS run [--commit] [--window-days N] [--actor A] \ +const USAGE: &str = "usage:\n atlas-classify --db CORPUS run [--commit] [--window-days N] [--actor A] \ [--now TS] [--schema-version N] [--max-decisions N] [--manifest-out PATH]\n \ atlas-classify --db CORPUS schema-review --old-schema F --new-schema F \ [--reviewer-model M] [--reviewer-model-version V] [--manifest-out PATH]\n \ atlas-classify --db CORPUS schema-apply --review F --dispositions F \ - [--now TS] [--manifest-out PATH]" - ); + [--now TS] [--manifest-out PATH]\n \ + defaults: --window-days 90; --actor atlas-classify/remainder-sweep; \ + --schema-version 1; --reviewer-model atlas-classify; \ + --reviewer-model-version the crate version; --now the current time; \ + --max-decisions unbounded"; + +fn usage() -> ExitCode { + eprintln!("{USAGE}"); ExitCode::from(2) } @@ -257,6 +268,14 @@ fn action_schema_apply(db: &Path, args: &[String]) -> Result { fn main() -> ExitCode { let args: Vec = std::env::args().skip(1).collect(); + if args.iter().any(|a| a == "--help" || a == "-h") { + println!("{USAGE}"); + return ExitCode::SUCCESS; + } + if args.iter().any(|a| a == "--version" || a == "-V") { + println!("atlas-classify {}", env!("CARGO_PKG_VERSION")); + return ExitCode::SUCCESS; + } // Global flags: exactly one --db, then the action and its args. let mut db: Option = None; let mut rest: Vec = Vec::new(); diff --git a/pkgs/atlas-search/crates/atlas-core/src/bin/atlas-eval.rs b/pkgs/atlas-search/crates/atlas-core/src/bin/atlas-eval.rs index c2e375a304..69489177d6 100644 --- a/pkgs/atlas-search/crates/atlas-core/src/bin/atlas-eval.rs +++ b/pkgs/atlas-search/crates/atlas-core/src/bin/atlas-eval.rs @@ -1,6 +1,8 @@ //! atlas-eval — the offline ranking-evaluation runner (#5741). //! -//! Usage: `atlas-eval ` +//! Usage: `atlas-eval `; `atlas-eval +//! --help` prints the usage line and `--version` the version, +//! both exit 0. //! //! Reads an `atlas-eval/v1` document (queries, qrels, and saved //! rankings from any signals) and prints the `atlas-eval-report/v1` @@ -21,6 +23,14 @@ use atlas_core::eval::{EvalData, Split, evaluate}; fn main() -> ExitCode { let args: Vec = std::env::args().collect(); let (path, split) = match args.as_slice() { + [_, flag] if flag == "--help" || flag == "-h" => { + println!("usage: atlas-eval "); + return ExitCode::SUCCESS; + } + [_, flag] if flag == "--version" || flag == "-V" => { + println!("atlas-eval {}", env!("CARGO_PKG_VERSION")); + return ExitCode::SUCCESS; + } [_, path, split] => { let split = match split.as_str() { "dev" => Split::Dev, diff --git a/pkgs/atlas-search/crates/atlas-core/src/bin/atlas-github-comments.rs b/pkgs/atlas-search/crates/atlas-core/src/bin/atlas-github-comments.rs index 92ad314830..a869b48641 100644 --- a/pkgs/atlas-search/crates/atlas-core/src/bin/atlas-github-comments.rs +++ b/pkgs/atlas-search/crates/atlas-core/src/bin/atlas-github-comments.rs @@ -4,6 +4,8 @@ //! Usage: `atlas-github-comments --state //! --out [--repo ]... [--skip-reviews] //! [--observed-date ]` +//! (`--help` prints the usage line, `--version` the version; +//! both exit 0.) //! //! With no `--repo`, the estate is enumerated from the GitHub API //! (the `developing-today` and `developing-today-forks` orgs and @@ -412,7 +414,20 @@ fn is_access_blocked(error: &str) -> bool { error.contains("Repository access blocked") || error.contains("HTTP 451") } +const USAGE: &str = "usage: atlas-github-comments --state \ + --out [--repo ]... [--skip-reviews] \ + [--observed-date ]"; + fn main() -> ExitCode { + let argv: Vec = std::env::args().skip(1).collect(); + if argv.iter().any(|a| a == "--help" || a == "-h") { + println!("{USAGE}"); + return ExitCode::SUCCESS; + } + if argv.iter().any(|a| a == "--version" || a == "-V") { + println!("atlas-github-comments {}", env!("CARGO_PKG_VERSION")); + return ExitCode::SUCCESS; + } match run() { Ok(()) => ExitCode::SUCCESS, Err(e) => { diff --git a/pkgs/atlas-search/crates/atlas-core/src/bin/atlas-sweep.rs b/pkgs/atlas-search/crates/atlas-core/src/bin/atlas-sweep.rs index 5834195c6a..9a7a2fd9f9 100644 --- a/pkgs/atlas-search/crates/atlas-core/src/bin/atlas-sweep.rs +++ b/pkgs/atlas-search/crates/atlas-core/src/bin/atlas-sweep.rs @@ -1,6 +1,8 @@ //! atlas-sweep — the Atlas ingestion sweep runner CLI (#7969). //! //! Usage: `atlas-sweep --state-dir DIR ...` +//! (`--help` prints the usage text, `--version` the version; +//! both exit 0.) //! //! Actions (design §6, the complete operator set this core exposes): //! pause-class --class CLASS --host HOST @@ -28,6 +30,10 @@ fn fail(msg: &str) -> ExitCode { ExitCode::from(2) } +const USAGE: &str = "usage: atlas-sweep --state-dir DIR ...\n \ + actions: pause-class --class CLASS --host HOST | resume-class --class CLASS --host HOST | \ + run-once REQUEST.json | dead-letter list|retry REF|drop REF | report [--run RUN_ID]"; + fn class_and_host(args: &[String]) -> Result<(SourceClass, String), String> { let mut class = None; let mut host = None; @@ -54,6 +60,14 @@ fn class_and_host(args: &[String]) -> Result<(SourceClass, String), String> { fn main() -> ExitCode { let args: Vec = std::env::args().skip(1).collect(); + if args.iter().any(|a| a == "--help" || a == "-h") { + println!("{USAGE}"); + return ExitCode::SUCCESS; + } + if args.iter().any(|a| a == "--version" || a == "-V") { + println!("atlas-sweep {}", env!("CARGO_PKG_VERSION")); + return ExitCode::SUCCESS; + } let mut state_dir: Option = None; let mut rest: Vec = Vec::new(); let mut i = 0; diff --git a/pkgs/atlas-search/crates/atlas-search/src/bin/atlas-stage.rs b/pkgs/atlas-search/crates/atlas-search/src/bin/atlas-stage.rs index 9f6587c4ab..1e13fa5efc 100644 --- a/pkgs/atlas-search/crates/atlas-search/src/bin/atlas-stage.rs +++ b/pkgs/atlas-search/crates/atlas-search/src/bin/atlas-stage.rs @@ -3,7 +3,7 @@ //! versioned schema, provisioning tool and registry; design //! `doc/2026-11-04T21-27-34Z_design_atlas_scaler_revision` section 4.1). //! -//! Two verbs: +//! Six verbs: //! * `atlas-stage provision --db --unit --owner //! [--sensitivity internal] --registry ` — create the unit's //! staging DB, apply the v1 schema, and register the unit as `open`. @@ -33,9 +33,11 @@ //! ONNX runtime (ATLAS_MODEL_DIR / ATLAS_ORT_LIB, the same //! resolution the atlas-search binary uses). //! -//! All three are offline: a staging DB is a local libSQL/SQLite file -//! today; hosted Turso creation is the aggregator slice's deployment -//! surface, not this foundation. +//! Five of the six are offline: a staging DB is a local libSQL/SQLite +//! file today; hosted Turso creation is the aggregator slice's +//! deployment surface, not this foundation. `promote` is the +//! exception: it needs the embedding model + ONNX runtime, as its +//! entry above states. use std::path::PathBuf; use std::process::ExitCode; @@ -47,6 +49,7 @@ use clap::{Parser, Subcommand}; #[derive(Parser)] #[command( name = "atlas-stage", + version, about = "Provision Atlas staging units and read the staging registry (#5669)" )] struct Cli { @@ -104,7 +107,8 @@ enum Command { /// The entry kind (prose|code|config). #[arg(long, default_value = "config")] kind: String, - /// The artifact language (yaml, toml, rust, ...). + /// The artifact language (yaml, toml, rust, ...); when empty, + /// the staged file's extension is used. #[arg(long, default_value = "")] language: String, /// Physical sensitivity level (public|internal|secret; default internal). diff --git a/pkgs/atlas-search/crates/atlas-search/src/main.rs b/pkgs/atlas-search/crates/atlas-search/src/main.rs index d81c26edcd..e920619a16 100644 --- a/pkgs/atlas-search/crates/atlas-search/src/main.rs +++ b/pkgs/atlas-search/crates/atlas-search/src/main.rs @@ -74,7 +74,7 @@ enum Cmd { FetchModel, /// ingest query traces as a statistics-and-reports corpus, or run trace retention (design s4) Traces(TracesArgs), - /// cast a thumbs vote on a served result, or retrieve feedback by its IDs (design s6.1) + /// cast a thumbs vote on a served result, or retrieve feedback by its IDs (design s6.1); a vote requires exactly one of --up / --down — use --get to retrieve instead Feedback(FeedbackArgs), } @@ -104,7 +104,7 @@ struct FeedbackArgs { /// stable requester id #[arg(long, default_value = "cli")] requester_id: String, - /// retrieve the feedback for --query [--chunk] instead of casting a vote + /// retrieve the feedback for --query [--chunk] instead of casting a vote (with --get, neither --up nor --down is needed; without it, exactly one of them is required) #[arg(long)] get: bool, /// feedback store directory (default: the JsonlFeedbackSink default dir) @@ -114,7 +114,7 @@ struct FeedbackArgs { #[arg(long)] via_service: bool, /// service base URL for --via-service (env ATLAS_SEARCH_URL) - #[arg(long)] + #[arg(long, env = "ATLAS_SEARCH_URL")] service_url: Option, } @@ -132,7 +132,7 @@ enum TracesCmd { Retention(TraceRetentionArgs), /// daily batch aggregation over stored traces (design s5) Stats(TraceStatsArgs), - /// weekly statistics report into the statistics-and-reports source set (design s7) + /// weekly statistics report into the statistics-and-reports source set (design s7); also writes the report JSONL and a Markdown rendering into the traces dir and reports both paths as report_file / markdown_file Report(TraceReportArgs), /// agent normalisation pass over the raw feedback store (design s6.2) Normalise(TraceNormaliseArgs), @@ -209,7 +209,7 @@ struct TraceNormaliseArgs { #[derive(Args)] struct ServeArgs { /// service config path (default: ~/.local/state/atlas-search/service.json; env ATLAS_SEARCH_SERVICE_CONFIG) - #[arg(long)] + #[arg(long, env = "ATLAS_SEARCH_SERVICE_CONFIG")] config: Option, /// listen address override (loopback only) #[arg(long)] @@ -225,7 +225,7 @@ struct ServeArgs { #[derive(Args)] struct InitArgs { /// service config path (default: ~/.local/state/atlas-search/service.json; env ATLAS_SEARCH_SERVICE_CONFIG) - #[arg(long)] + #[arg(long, env = "ATLAS_SEARCH_SERVICE_CONFIG")] config: Option, /// replace an existing config (rotates every client token) #[arg(long)] @@ -310,11 +310,15 @@ struct BackendArgs { /// local backend: comma-separated vector DB path(s) if the corpus DB has no vec table #[arg(long)] vecdb: Option, - /// prefer a running atlas service; fall back to standalone, loudly + /// prefer a running atlas service; fall back to standalone, loudly. + /// The service route serves only the Turso backend with the + /// production vector table: --backend local or a non-default + /// --vec-table fall back with a note, and any --shards spec is + /// served standalone without attempting the service #[arg(long)] via_service: bool, /// service base URL for --via-service (env ATLAS_SEARCH_URL) - #[arg(long)] + #[arg(long, env = "ATLAS_SEARCH_URL")] service_url: Option, } @@ -436,7 +440,7 @@ struct SearchArgs { #[arg(long)] text: bool, /// EXPERIMENTAL, off by default: serve the vector branch from the atlas core shard fan-out (dir: or turso[:]); FTS, details and --expand stay on the backend (issue #5755). Skips --via-service. - #[arg(long, env = "ATLAS_SHARDS", hide = true)] + #[arg(long, env = "ATLAS_SHARDS")] shards: Option, #[command(flatten)] backend: BackendArgs, diff --git a/pkgs/atlas-search/crates/atlas-search/src/server.rs b/pkgs/atlas-search/crates/atlas-search/src/server.rs index 188a12623e..616be677e7 100644 --- a/pkgs/atlas-search/crates/atlas-search/src/server.rs +++ b/pkgs/atlas-search/crates/atlas-search/src/server.rs @@ -270,7 +270,10 @@ pub fn default_service_config_path() -> PathBuf { } pub fn resolve_service_config_path(flag: Option<&Path>) -> PathBuf { - if let Some(p) = flag { + // An empty flag value counts as absent (same reasoning as + // service::base_url: the clap env binding on --config passes a + // set-but-empty ATLAS_SEARCH_SERVICE_CONFIG through as a value). + if let Some(p) = flag.filter(|p| !p.as_os_str().is_empty()) { return p.to_path_buf(); } if let Ok(p) = std::env::var("ATLAS_SEARCH_SERVICE_CONFIG") diff --git a/pkgs/atlas-search/crates/atlas-search/src/service.rs b/pkgs/atlas-search/crates/atlas-search/src/service.rs index a259fc1555..eb47cdee11 100644 --- a/pkgs/atlas-search/crates/atlas-search/src/service.rs +++ b/pkgs/atlas-search/crates/atlas-search/src/service.rs @@ -30,7 +30,11 @@ const PAGE_LIMIT: usize = 50; /// Resolve the base URL: flag, then `ATLAS_SEARCH_URL`, then the /// default. pub fn base_url(flag: Option<&str>) -> String { - if let Some(u) = flag { + // An empty flag value counts as absent: since --service-url + // gained a clap env binding (#13278), a set-but-empty + // ATLAS_SEARCH_URL arrives here as a value, and the hand-rolled + // env read it replaced ignored empty values. + if let Some(u) = flag.filter(|u| !u.is_empty()) { return u.trim_end_matches('/').to_string(); } if let Ok(u) = std::env::var("ATLAS_SEARCH_URL")