#2569

feat(cli): suggest the intended subcommand on unknown children (did you mean)

Openrudrankriyamopened 1mo ago

Summary

When a command group receives an unknown subcommand, print up to three "Did you mean" suggestions as full invocations on stderr, then the group usage, exit 2.

Motivation

Telemetry, 30 days, distinct installs invoking an unknown child (5.x installs in parentheses): versions 2,241 (260), apps 2,119 (277), builds 1,882 (274), review 1,622 (171), auth 1,449 (178), subscriptions 1,214 (186), testflight 1,078 (163), agreements 877 (84), testflight groups 845 (113), age-rating 610 (73), subscriptions review screenshots 566 (41), iap 557 (100), localizations/screenshots/pricing availability/docs/web/metadata ~400-450 each, subscriptions groups 82 (56 on 5.x). About 15% of 5.x installs hit one. The attempted child is never recorded by design, so an in-CLI suggester is the only lever.

Contract

  • Ranker over the group's registered subcommands: curated synonym map, prefix/substring match, Damerau-Levenshtein <= 2.
  • Synonyms seeded from the groups above (versions latest/current/status/show/get, apps get/show/find, builds latest/status/show/get, auth whoami/me, ...).
  • Telemetry unchanged: the positional token never enters failure_parameter or any field.
  • Reuses/generalizes the existing builds intent-hint code rather than duplicating it.

Acceptance criteria

  • ranker unit tests; a test walking the synonym map asserting every target is a real command path
  • cmdtest for five groups asserting stderr and exit 2
  • --help output unchanged

Partial work: worktree ~/Developer/CLIs/asc-did-you-mean (branch claude/did-you-mean-20260913).

Activity

0

No activity yet.