Agent-first winapp ui help, unknown-command suggestions, and hosted-app targeting - #942
Draft
Nikola Metulev (nmetulev) wants to merge 3 commits into
Draft
Nikola Metulev (nmetulev) wants to merge 3 commits into
Nikola Metulev (nmetulev) wants to merge 3 commits into
Conversation
…ilters - -a falls back to title matching (preferring ApplicationFrameHost frames) when the matched process owns no top-level window, and fails instead of reporting an empty target - inspect --interactive includes Document and writable-value elements - --type/--root/--class-name on every single-selector ui command; invoke accepts them without --action Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…d examples - `winapp ui --help` renders plain text: golden path, -a/<selector> definitions, and commands grouped by task (2,741 bytes redirected, down from 6,538) - every ui command gets plain-text help with 1-3 placeholder examples and a one-line global options pointer; examples are data (IHelpExamples) and are parse-tested - `winapp ui <unknown>` fails with exit 1 (even with --help) before sandbox routing, suggesting up to two commands; --json emits the error envelope with `suggestions` - `find` and `tree` are aliases for `search` and `inspect` - root help points agents at `winapp ui --help` - a missing option value ends with a pointer to --help instead of the full help - inspect's footer example uses set-value for editable-only elements Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ghten unknown-command detection - `-a` falls back only to ApplicationFrameHost frames; a process with no window yet keeps the process-scoped target so `wait-for` and `status` behave as before - bare `winapp ui` still prints the group help after "Required command was not provided" - only the first unmatched token counts as a command, so `ui -a Notepad` and `ui -- inspect` report the normal parse error instead of an unknown command Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Nikola Metulev (nmetulev)
added a commit
that referenced
this pull request
Sep 30, 2026
- Generalize #942's ui help renderer and unknown-command handling to any compact help group; winapp ui output is unchanged apart from one pointer line. - winapp devtools --help: purpose, the main workflow, what -a and <selector> mean, commands grouped by task, and when to use winapp ui instead. Every devtools command has examples, stored as data and parsed in tests. Unknown devtools commands suggest the closest one. - Root help gets a short 'Start here' block for winapp ui and winapp devtools. - A winapp ui command whose target has the DevTools agent prints one tip line on stderr (not with --json or --quiet). Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Nikola Metulev (nmetulev)
added a commit
that referenced
this pull request
Sep 30, 2026
#942 added the options to ui record; the hand-written argument builder did not forward them, which failed the generated-options sync test. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Nikola Metulev (nmetulev)
added a commit
that referenced
this pull request
Sep 30, 2026
A Type argument cannot be serialized for discovery, so the two rows were discovered as one case and ran as two. CI's CLI shard 2 requires the reported total to match discovery exactly, which failed on #942 and here. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Agents driving an app with
winapp uihad to read a 6.5 KB help page with no starting point. They guessed command names that don't exist (ui dump,ui tree), and then hit two dead ends on the most common path:-a calculatorfound nothing, but still reported success.inspect --interactivehid Notepad's editor.This PR makes the first minutes with
winapp uiwork (Stage 1 of the agent-guidance spec):winapp ui --help: plain text that starts with the golden path (inspect --interactive→invoke/set-value→get-value). It defines-aand<selector>, then lists the commands grouped by task: Discover, Act, Read and wait, Capture, Gestures, Workflow coordination. Edge-case commands say when to use them. It is 2,741 bytes redirected, down from 6,538.uicommand, also plain text: summary, usage, 1–3 examples (placeholders only), arguments, options, and oneGlobal options:line. Examples are stored as data and a test parses each one against its command. Help for other command groups is unchanged.winapp ui dumpexits 1 withDid you mean 'inspect'?, a short command list, and a pointer towinapp ui --help. This holds even with--help, and it happens before--on sandboxrouting, so no sandbox starts. With--jsonit emits the existing UI error envelope pluserror.suggestions.findandtreeare aliases forsearchandinspect. They are hidden fromui --help.Driving an app's UI from an agent or script? Start with 'winapp ui --help'.--type/--root/--class-nameon every single-selector command (set-value, click, focus, hover, scroll, scroll-into-view, screenshot, record, touch, pen, and inspect with a selector). With filters, the selector must match exactly one element.invokenow accepts the filters without--action; filtered invoke skips the ancestor fallback.dragis unchanged.-a. When the matched process owns no top-level window, as with Calculator hosted by ApplicationFrameHost,-anow uses the ApplicationFrameHost frame whose title matches. Only frames qualify, so a window likemyapp - Visual Studio Codeis never picked. A process with no window yet, such as an app that is still starting, keeps the process-scoped target, sowait-forstill polls for its window.list-windows -afalls back to title matches too.inspect --interactiveshows editable elements. Documents, such as Notepad'sText editor, and elements with a writable Value pattern now appear, and--jsonelements carryisEditable: true. The footer example suggestsset-valuefor such elements.winapp ui invoke Cancel -w) now prints the error andRun 'winapp ui invoke --help' for usage.instead of the full help.Usage Example
Observed with the built CLI (win-arm64 NativeAOT):
Notepad golden path, run against a Notepad window the test launched itself (
-w <hwnd>):New
winapp ui --help(full output, 2,741 bytes):Related Issue
Stacked on #932 (scoped
--type/--root/--class-nametargeting forui invoke). Retarget tomainafter #932 merges.Type of Change
Checklist
plugins/winapp/skills/(if CLI commands/workflows changed)Screenshots / Demo
Not applicable: these are text-only CLI changes. See the observed output above.
Additional Notes
Compatibility:
winapp ui <unknown> --helpchanged from exit 0 (it printed theuihelp) to exit 1 with an error. This is the 0.7.0 behavior, and no known consumer depends on it.ui invokewith--type/--root/--class-namebut without--actionwas rejected on #932 and is now accepted. That behavior was never released.Validation:
.\scripts\build-cli.ps1 -SkipTestssucceeded. It regenerateddocs/cli-schema.json,src/winapp-npm/src/winapp-commands.ts, anddocs/npm-usage.md..\scripts\validate-plugin-package.ps1passes.WinApp.UIAutomation.Testspass.uicommand is in exactly one help category.selectorargument accepts the three filters.--help,--on sandbox,--json=false).-a(search, invoke, get-value, inspect,--json), and a self-launched Notepad window via-w(inspect--interactive, set-value/get-value/focus with--type Document,tree/findaliases). Also checked: barewinapp uistill shows the group help, andwinapp ui -a Notepadreports the normal parse error rather thanUnknown command 'Notepad'.Limitations: A process that has no window and no matching app frame still gets a process-scoped target, as before, so read commands like
searchcan report 0 matches instead of an error. Failing there would breakwait-forwhile an app starts.ui invoke --helpis about 1.6 KB, over the spec's ~1 KB target, because it keeps the full action and filter explanations. JSON error strings escape'as\u0027, the same as existing UI errors.AI Description
This section is auto-generated by AI when the PR is opened or updated. To opt out, delete this entire section including the marker comments.