claw-code/rust/crates
YeonGyu-Kim 79352a2d20 feat: #152 — hint `--output-format json` when user types `--json` on diagnostic verbs
## Problem

Users commonly type `claw doctor --json`, `claw status --json`, or
`claw system-prompt --json` expecting JSON output. These fail with
`unrecognized argument \`--json\` for subcommand` with no hint that
`--output-format json` is the correct flag.

## Discovery

Filed as #152 during 21:17 dogfood nudge. The #127 worktree contained
a more comprehensive patch but conflicted with #141 (unified --help).
On re-investigation of main, Bugs 1 and 3 from #127 are already closed
(positional arg rejection works, no double "error:" prefix). Only
Bug 2 (the `--json` hint) remained.

## Fix

Two call sites add the hint:

1. `parse_single_word_command_alias`'s diagnostic-verb suffix path:
   when rest[1] == "--json", append "Did you mean \`--output-format json\`?"

2. `parse_system_prompt_options` unknown-option path: same hint when
   the option is exactly `--json`.

## Verification

Before:
  $ claw doctor --json
  error: unrecognized argument `--json` for subcommand `doctor`
  Run `claw --help` for usage.

After:
  $ claw doctor --json
  error: unrecognized argument `--json` for subcommand `doctor`
  Did you mean `--output-format json`?
  Run `claw --help` for usage.

Covers: `doctor --json`, `status --json`, `sandbox --json`,
`system-prompt --json`, and any other diagnostic verb that routes
through `parse_single_word_command_alias`.

Other unrecognized args (`claw doctor garbage`) correctly don't
trigger the hint.

## Tests

- 2 new assertions in `parses_multiple_diagnostic_subcommands`:
  - `claw doctor --json` produces hint
  - `claw doctor garbage` does NOT produce hint
- 177 rusty-claude-cli tests pass
- Workspace tests green

Closes ROADMAP #152.
2026-04-21 21:23:17 +09:00
..
api US-024: Add token limit metadata for kimi models 2026-04-17 04:15:38 +00:00
commands feat: #144 phase 1 + ROADMAP filing — claw mcp degrades gracefully on malformed config 2026-04-21 19:07:17 +09:00
compat-harness feat: ultraclaw droid batch — ROADMAP #41 test isolation + #50 PowerShell permissions 2026-04-12 03:06:24 +09:00
mock-anthropic-service feat(harness+usage): add auto_compact and token_cost parity scenarios 2026-04-03 22:41:42 +09:00
plugins Keep poisoned test locks from cascading across unrelated regressions 2026-04-12 13:52:41 +00:00
runtime feat: #151 — canonicalize workspace path in SessionStore::from_cwd/data_dir 2026-04-21 21:06:09 +09:00
rusty-claude-cli feat: #152 — hint `--output-format json` when user types `--json` on diagnostic verbs 2026-04-21 21:23:17 +09:00
telemetry feat: anthropic SDK header matching + request profile 2026-04-01 05:55:25 +00:00
tools ROADMAP #133: Blocked-state subphase contract — implement §6.5 2026-04-20 15:04:08 +09:00