fix(cli): drop the removed durationMs positional from swipe help - #1534
Conversation
swipe --help still advertised a trailing [durationMs] positional that #1393 stopped accepting, so agents following the help text hit the runtime's migration-hint rejection. Remove it from the swipe command's help-schema positionals and defer arity enforcement to swipePayloadFromPositionals so the migration-hint error keeps firing unchanged. Refs #1393 Co-Authored-By: Claude <noreply@anthropic.com>
Size Report
Startup median (7 runs, lower is better):
Top changed chunks:
|
|
Implementation direction is correct: the help schema now advertises only the four supported swipe coordinates, while One test gap blocks readiness: the current tests are vacuous for this regression. They still pass if |
|
Summary
agent-device swipe --helpstill advertised a trailing[durationMs]positional that #1393 removed from runtime acceptance, so following the help text produces theINVALID_ARGSmigration-hint rejection instead of a working command.The stale text is generated from the
swipecommand's help schema —positionalArgs: ['x1', 'y1', 'x2', 'y2', 'durationMs?']insrc/commands/interaction/index.ts— which bothcli-help.tsrenders into the usage line andassertCommandPositionalArity(src/cli-schema/command-schema.ts) uses to bound how many positionals the parser accepts. Simply deleting'durationMs?'from that array would also tighten the parser-level arity check, causing a 5th positional to be rejected there with a generic "accepts at most 4 positional argument(s)" error — before the richer, migration-aware rejection inpackages/contracts/src/gesture-normalization.ts(assertGestureArity/migrateRetiredSwipeDuration) ever runs.Fix: drop
'durationMs?'frompositionalArgs(fixes the help text) and setallowsExtraPositionals: trueon theswipeschema so the generic parser-level arity check steps aside andswipePayloadFromPositionalsremains the sole arity gate, preserving the exact runtime migration-hint error.New first line of
swipe --help:Other commands checked for the same drift (grepped the
gesture-normalization.tsretiredmigration table for every command that lost a positional in #1393):gesture pan/gesture transform— unaffected,durationMsis still a valid optional positional for these.gesture fling(lostdurationMs),gesture swipe(lostdurationMs),gesture rotate(lostvelocity) — all render through the single umbrellagesture --helpdescription insrc/commands/interaction/index.ts, which already omits the retired positionals for each subcommand (verified live). No drift found.No pinned test assertions needed updating —
cli-help-topics.test.tsandcli-help-command-usage.test.tsonly assert/swipe <x1> <y1> <x2> <y2>/(unanchored, still matches) and don't pin the removed[durationMs]segment.Gate results
pnpm typecheck— passpnpm lint— passpnpm format:check— pass (no changes needed)npx vitest run src/cli— 15 files / 214 tests passnpx vitest run src/replay/__tests__/script.test.ts packages/contracts/src/gesture-normalization.test.ts(runtime migration-message coverage) — 2 files / 55 tests passnpx fallow audit --base origin/main— 0 issuesnode --experimental-strip-types src/bin.ts swipe --helpshows the corrected usage;swipe 197 650 197 300 300still throws the unchangedINVALID_ARGSmigration-hint error.Test plan
pnpm typecheckpnpm lintpnpm format:checknpx vitest run src/clinpx fallow audit --base origin/mainswipe --helpand the runtime rejection message