Repository navigation
fix(cli): measure and diff tell an agent what to type after a wrong call - #7072
Conversation
The top measure and diff errors since 0.9.4 (PostHog, CLI project) were agents' calls, not bad videos: - A flag from another command: --from/--to on ops that take --start/--end (extract is the other way round), -o for --out. The unknown-flag error now names the flag that means the same here. - measure sync without --roi stopped at citty's bare "Missing required argument"; diff with one video at "Missing required positional argument: YOURS". Both now reach their own message with the command to run. - A Windows path whose backslashes bash dropped (D:videoclip.mp4) was only "no file at". The fix line now says to quote it or write it with /.
jrusso1020
left a comment
There was a problem hiding this comment.
Reviewed at e202feef1e122c1afb8bec3ed9308cbc3444d9a1.
No Important finding. Synonym suggestions are limited to flags actually declared by the receiving command; unknown flags remain rejected rather than becoming execution aliases. Missing diff input and mouth ROI now reach actionable guidance, and raw mangled Windows paths get the quoting/slash suggestion.
Nit: the two newly manual missing-argument checks use Fix and exit 1, where the previous required-argument validation exited 2. CLI AGENTS.md distinguishes usage errors from execution failures. Keep the improved guidance while returning usage exit 2, and pin missing-YOURS/ROI output alongside the new synonym test. This remains nonblocking: both paths still fail clearly. On POSIX, diff's existing resolve-before-probe path prevents the Windows regex hint from matching; measure's raw path does receive it.
Validation: full workspace build succeeds. CLI bun run test src/utils/reject-unknown-flags.test.ts src/measure src/commands/diff.exit.test.ts → 120 passed / 16 files. Independent flag suite → 33 passed; actual CLI calls verified human/JSON missing-YOURS guidance, ROI guidance, --from suggestion and mangled path advice. No user media or reported bug-bash films rerun. The shared flag rejection and stderr/data conventions remain in place.
Need: yes · Size: ok · Reuse: existing Fix, flag-rejection and nearest-name helpers · Simpler: bounded synonym map and explicit guidance · Structure: fine
Risk: low — corrective error messages, with a nonblocking exit-code note.
Verdict: APPROVE
Reasoning: Guidance matches the supported commands and does not silently accept mistaken flags. Focused tests and actual wrong-call outputs pass.
— hf-review
What
The most common
measure/differrors since 0.9.4 (PostHogcli_error, CLI project) come from how agents call them, not from bad videos:Unknown flag: --from/--to/-oDid you mean --start?(--end,--out;extractthe other way round)Missing required argument: --roi(measure sync)measure faceto find the faceMissing required positional argument: YOURS(diff)diff compares two: the original and yours+ the commandno file at D:video-studio작업대상…(bash dropped a Windows path's backslashes)/measure <file>with no command (20 users) already prints the commands to put first (#6997), so it's unchanged.Test plan
fails without the fix:
reject-unknown-flags.test.ts"names the flag that means the same here…"reject-unknown-flags,src/measure,difftests; typecheck; oxlint/oxfmt.