YeonGyu-Kim fbb0ab4be7 fix(#171): classify unexpected extra arguments errors as cli_parse
Pinpoint #171: typed-error classifier gap discovered during #141 probe cycle #97.

`claw list-sessions --help` emits:
  error: unexpected extra arguments after `claw list-sessions`: --help

This format is used by multiple verbs that reject trailing positional args:
- list-sessions
- plugins (subcommands)
- config (subcommands)
- diff
- load-session

Before fix:
  {"error": "unexpected extra arguments after `claw list-sessions`: --help",
   "hint": null,
   "kind": "unknown",
   "type": "error"}

After fix:
  {"error": "unexpected extra arguments after `claw list-sessions`: --help",
   "hint": "Run `claw --help` for usage.",
   "kind": "cli_parse",
   "type": "error"}

The pattern `unexpected extra arguments after \`claw` is specific enough
that it won't hijack generic prose mentioning "unexpected extra arguments"
in other contexts (sanity test included).

Side benefit: like #169/#170, correctly classified cli_parse errors now
auto-trigger the #247 hint synthesizer.

Related #141 gap not yet closed: `claw list-sessions --help` still errors
instead of showing help (requires separate parser fix to recognize --help
as a distinct path). This classifier fix at least makes the error surface
typed correctly so consumers can distinguish "parse failure" from "unknown"
and potentially retry without the --help flag.

Test added:
- `classify_error_kind_covers_unexpected_extra_args_171` (4 positive cases
  + 1 sanity guard)

Tests: 226/226 pass (+1 from #171).

Typed-error family: #121, #127, #129, #130, #164, #169, #170, #247.
2026-04-23 08:02:12 +09:00
..