Commit fa6c607
feat(capabilities): turn
Reframes `cass capabilities --json` from "feature discovery" to a
single self-describing entry point that hands an agent everything it
needs to drive cass without reading help text or external docs.
Payload additions (the schema is additive — old keys are preserved):
- `workflows[]` — named recipes (`bounded-search`, etc.) showing the
canonical command sequence for an intent, plus the exit codes and
output shapes a caller should branch on.
- `mistake_recoveries[]` — paired "common mistake" → "what to do
next" entries, lifted from the existing `get_common_mistakes`
table so an agent can recover without re-querying.
- `commands[]` — full command list with `name`, `summary`,
`arguments[]` (positional vs option, required, value_type,
default, possible_values), and `subcommands[]` for two-level
paths like `robot-docs guide`.
- `global_flags[]` — typed schemas for `--robot-help`, `--color`,
`--no-color`, `--quiet`, `--max-tokens`, etc., with `value_type`
("enum" | "string" | …) and defaults so callers don't guess.
- `exit_codes[]` — every exit code the binary can return, with
`meaning`, `retryable` ("yes" | "no" | "after-recovery"), and
`agent_action` text the caller can act on (e.g. exit 2 → "Fix
argv and retry"; exit 15 → semantic-fallback guidance).
- `env_vars[]` — `CASS_DATA_DIR`, `CASS_OUTPUT_FORMAT`,
`CASS_TRACE_FILE`, etc. with default values.
- New feature flag `self_describing_capabilities` advertises the
upgrade so callers can detect it.
Argv recovery improvements (in `heuristic_parse_recovery` /
`normalize_args`):
- New `CANONICAL_TOP_LEVEL_COMMANDS` table backs a Levenshtein
typo corrector (`closest_top_level_command`) so a misspelt
subcommand like `cass searh` is rewritten to `cass search` with
a structured correction note rather than re-routing through the
generic "implicit search" fallback. Distance ≤2; minimum length 3.
- `cass robot-docs` (no subtopic) now defaults to `robot-docs guide`
with a recorded correction; redundant `--robot` / `--json` flags
on robot-docs are stripped (those outputs are already
machine-readable).
Surface adjustments:
- `Commands::Capabilities` doc string updated from "Discover
features, versions, and limits" to "First-stop agent
self-description: workflows, mistake recoveries, commands,
flags, env vars, exit codes, and limits".
- `print_robot_help` section header renamed
`Subcommands:` → `Core subcommands:` so the help output
matches the new `commands[]` framing.
- README + docs/ROBOT_MODE.md prose updated to the new framing.
Tests + goldens:
- `capabilities_are_self_describing_for_agents` exercises every
new section: features list contains the new flag, global_flags
has typed entries, commands include arguments/subcommands,
exit_codes include retryability + agent_action, env_vars cover
the documented list, and the `bounded-search` workflow is
present.
- New helper `recommended_command(json, id)` for asserting
recommended-command shape across cli_robot tests.
- Goldens regenerated:
- `tests/golden/robot/capabilities.json.golden` (full payload,
~2882 lines)
- `tests/golden/robot/capabilities_shape.json.golden` (new
shape-only snapshot — order-insensitive structure)
- `tests/golden/robot/introspect{,_shape}.json.golden`
- `tests/golden/robot/diag*.json.golden` (api_version field
threaded through)
- `tests/golden/robot_docs/{commands,examples,guide,robot_help,schemas}.txt.golden`
- `tests/golden_robot_docs.rs` / `tests/golden_robot_json.rs`
drivers refreshed for the new sections.
Drive-by formatting:
- `src/connectors/codex.rs`: re-ordered the `super::*` import list
alphabetically (rustfmt drift; no behaviour change).
- `src/ui/app.rs`: collapsed three multi-line method-chain Paragraph
styles per rustfmt; also a single `paragraph.style(...).render(...)`
flattened. No behaviour change.
Co-Authored-By: Claude <noreply@anthropic.com>cass capabilities into a first-stop agent self-description1 parent a0ac607 commit fa6c607
20 files changed
Lines changed: 5204 additions & 158 deletions
File tree
- docs
- src
- connectors
- ui
- tests
- golden
- robot_docs
- robot
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
727 | 727 | | |
728 | 728 | | |
729 | 729 | | |
730 | | - | |
| 730 | + | |
731 | 731 | | |
732 | | - | |
| 732 | + | |
733 | 733 | | |
734 | 734 | | |
735 | 735 | | |
| |||
1158 | 1158 | | |
1159 | 1159 | | |
1160 | 1160 | | |
1161 | | - | |
| 1161 | + | |
1162 | 1162 | | |
1163 | 1163 | | |
1164 | 1164 | | |
| |||
2425 | 2425 | | |
2426 | 2426 | | |
2427 | 2427 | | |
2428 | | - | |
| 2428 | + | |
2429 | 2429 | | |
2430 | 2430 | | |
2431 | 2431 | | |
| |||
2458 | 2458 | | |
2459 | 2459 | | |
2460 | 2460 | | |
2461 | | - | |
| 2461 | + | |
2462 | 2462 | | |
2463 | 2463 | | |
2464 | 2464 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
180 | | - | |
| 180 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | | - | |
| 8 | + | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
0 commit comments