fix(cli): route reload, restart and pull-to-refresh intents to existing commands

Merged
TH
3d ago
+176-35

Summary

An agent that wanted to pull to refresh, restart an app, or load new JavaScript spent a help read or a failing command on it in every measured run. Each answer now sits with its owner.

The skill routing card names scroll refresh, open <app> --relaunch, and metro reload, and says: when your host allows agent-device by command name, run one call per command. A chained or quoted-path call misses that rule and runs sandboxed, away from the daemon.

src/cli/parser/command-suggestions.ts owns unknown-command hints. reload joins restart in its curated map, and an entry can carry a second shape, so one hint names both working commands; reload used to fall through to the nearest-name match and suggest the unrelated record. usageForUnknownCommand owns what a help read prints for an unknown name: a one-line pointer when a suggestion already answered it, the root card otherwise. help gestures now leads with pull to refresh; help scroll already did.

Before / after

agent-device reload --help

  • Before: Did you mean record? plus the root card, about 3.1 KB.
  • After: Did you mean open <app> --relaunch (or metro reload)? plus one pointer line, 213 bytes.

agent-device help gestures: pull to refresh moved from a mid-topic line to the opening sentence.

Validation

At 24201c5bf8: typecheck, format, lint, build, fallow, layering, agent-guidance, command-docs, doc-prose, doc-links, plus vitest --project unit-core over src, scripts, and test: 20599 passed, 9 skipped. New tests cover the hint, its byte bound, short help output, and first-line mentions. CI owns the rest.