fix(help): give every selector key a rule and list every selector command

Merged
IM
5d ago
+201-10

Summary

Follow-up to #5009, from its review notes.

  • Shape: a term is key=value or a bare boolean key (checked means checked=true).
  • Keys: appname and windowtitle say what they match and which snapshots report them: Linux, the macOS desktop, frontmost-app and menubar surfaces, and macOS app sessions on the native backend. checked states its three values: checked=true and checked=false match only an explicit state; mixed or absent match neither.
  • Commands: the list adds gesture pinch (#4998) and screenshot --crop-on. selectors.md also adds click, hover and gesture drag.
  • Test: cli-help-selectors.test.ts parses every agent-device example selector in the topic and selectors.md. Nine rule examples (bare key, escaped quote, button="Save" rejected, whole-field match, both checked values, || order) must appear in both texts and get the expected parser or matcher result. Every parser key must open a rule clause in the topic's Matching section and have a table row or Boolean keys entry in selectors.md. The prose around an example is not checked.

Before / after

$ agent-device help selectors   (lines that differ)
base aecafaf30:
  ... is, wait, scroll --until, and gesture drag accept a selector wherever they accept an @ref; ...
  One or more key=value terms separated by spaces. ...
  Boolean keys take true or false, and a bare key means true: visible=false, editable=true, checked.
head:
  ... and gesture pinch as the element to pinch. find takes one as its query, and scroll --until and screenshot --crop-on as the flag value.
  One or more terms separated by spaces. ... A term is key=value, or a boolean key alone, which means key=true: checked is checked=true. ...
  appname and windowtitle are the owning app's name and window title. Linux snapshots and the macOS desktop, frontmost-app, and menubar surfaces report them; ...
  checked tests a switch, checkbox, or radio. checked=true matches only an explicitly checked control and checked=false only an explicitly unchecked one; ...

Validation

  • check:affected --run --head 23d94bfc7: format, lint, typecheck, layering, fallow, build and vitest-related pass. check:doc-links and check:doc-prose pass.
  • The new test fails 3 of 13 against the base topic and docs. Fourteen parser, matcher and text mutants each fail it.

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