fix(cli): say what a refused flag, fill target, or drag endpoint expects

Merged
IM
5d ago
+317-41

Summary

Three CLI messages sent agents the wrong way:

  • A refused flag value didn't say what was allowed.
  • fill $REF "136849" with an empty REF suggested text="136849", and fill "" 136849 was read as the point (0, 136849).
  • gesture drag "170 1595" "540 160" reached the device and failed there as a selector term.

Each refusal now names the fix and carries a typed details.reason: flag_value_invalid (with the bounds), fill_target_missing, or drag_endpoint_is_coordinates (with the equivalent pan). Env and config refusals share the range wording. help gestures now says that drag takes refs or selectors.

Before / after

Pixel 9 AVD (Android 16); base a4f2dcad0, head 944f1c74d:

$ open com.android.chrome --wait 240000
base: Invalid wait: 240000
head: Invalid wait: 240000. Expected integer from 100 to 120000.
$ fill 136849
base: …use text="136849"…
head: fill needs <target> <text> but got one value, "136849"…
$ gesture drag "170 1595" "540 160" 1200 800 600      # with a session open
base: Invalid selector term "170", expected key=value. May have reached the device.
head: INVALID_ARGS before dispatch. Next: For a coordinate hold-then-drag, use gesture pan 170 1595 370 -1435 800 --hold-ms 1200.

Validation

  • Head 944f1c74d, check:affected --run --head, exactCommit: true. Every gate passes except unit, where upload-http-deadline and committed-source-tree fail the same way on clean main on this macOS host. command-docs, doc-links and doc-prose pass when run directly.
  • The new tests assert reasons and details, and fail with their fixes reverted.

Run Proof
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.