#2612

feat(cli): suggest the intended flag on unknown flags for every command

Openrudrankriyamopened 1mo ago

Summary

Unknown flags are the largest remaining usage-error class: 973 distinct installs / 8,447 events in 14 days on 5.x (413 installs in the last 48 h). About 400 of those installs use spellings not in the 5.0 removed-alias table handled by #2547, e.g. review details-get --version-id (48), metadata validate --version (45), submit status --app (45), subscriptions list --group (44), pricing availability territory-availabilities --app (29), profiles list --bundle-id (26), builds groups list --app (26), categories list --app (25), subscriptions versions view --version-id (23), bundle-ids capabilities list --id (21), builds upload --file (15).

What to do

suggest.Flags() already exists in internal/cli/shared/suggest/suggest.go with zero non-test callers. Wire it into the generic unknown-flag path in cmd/run.go / cmd/invocation_context.go so every command prints up to three Try: suggestions (nearest defined flags of that command, by edit distance and prefix, plus a small synonym map: --app→--app-id/--id, --version-id↔--version, --group→--group-id, --file→--ipa/--path), after the removed-alias hint when both apply. Keep exit 2 and telemetry failure_parameter behavior unchanged (allowlisted flag names only, never values).

Acceptance criteria

  • cmdtest for at least six of the commands above asserting the suggestion text
  • a test that every suggested flag exists on the target command
  • no change to --help output

Activity

0

No activity yet.