Repository navigation
feat(devserver-cli): app verbs that call the App MCP tools from a shell - #25374
Conversation
… a shell `uno-devserver app <verb> [--param value]... [--json] [--out file]` runs one uno_app_* tool over the host's /mcp endpoint, the same channel the stdio proxy uses, so a script, a hook or a shell-only agent gets the tools an MCP client gets, plus an exit code: 1 for an error result or a find that matched nothing, 2 for a tool the host does not offer. Starts the host like `start` when none is registered for the solution. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NzKY9EQxsHN7uhcmPniyJZ
…ad verdict A hook or script must never start a DevServer by accident: with --no-start, no running host for the solution is exit code 2, like a tool that is not offered. `app hot-reload --file` exits 0 only when the app runs the edit, 1 when it does not (the text says why), 3 for a rude edit that needs a start, so a PostToolUse hook can act on the code alone. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NzKY9EQxsHN7uhcmPniyJZ
…oad-status` Saving the file triggers Hot Reload; the verb only reports whether the edit was applied, and its name said otherwise. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NzKY9EQxsHN7uhcmPniyJZ
There was a problem hiding this comment.
🔵 Needs a closer look
It introduces a new multi-process CLI command surface with live-host MCP orchestration and exit-code contracts that external hooks/CI will depend on, and several paths were only partially exercised end-to-end, warranting human review.
1 open finding
What changed in this PR
This PR adds a new app command group to the Uno DevServer CLI (Uno.UI.DevServer.Cli). Each app verb maps to one App MCP tool (uno_app_*) and is invoked over the host's /mcp HTTP endpoint using the same MCP client the stdio proxy already uses, giving shells, Claude Code hooks, and CI scripts the same tool surface as an MCP client plus a meaningful process exit code. It fits into the DevServer subsystem alongside the existing start/stop/mcp command routing, and its first consumer is a hot-reload PostToolUse hook.
Changes:
- New
AppCommandHandlerthat parsesapp <verb|tool> [--param value]... [--json] [--out file] [--no-start], calls the tool, renders text/image/JSON results, and maps results to exit codes (0 ok, 1 error/no-match/not-applied, 2 bad args/no host, 3 rude edit). CliManagerroutes theappverb and addsEnsureHostAsync, which reuses a registered DevServer or starts one the same waystartdoes (unless--no-start).ProgramaddsIsAppCommandsoapplogs are routed to stderr (keeping stdout clean for results), plus help text for the new commands.- New unit tests for argument parsing, value typing, and exit-code logic.
| File | Description |
|---|---|
| src/Uno.UI.DevServer.Cli/AppCommandHandler.cs | New handler: parse args, call one MCP tool, render output, derive exit codes. |
| src/Uno.UI.DevServer.Cli/CliManager.cs | Routes app to the handler and adds EnsureHostAsync host-reuse/start logic. |
| src/Uno.UI.DevServer.Cli/Program.cs | Adds IsAppCommand stderr-logging routing and help text for app commands. |
| src/Uno.UI.DevServer.Cli.Tests/Given_AppCommandHandler.cs | Unit tests for parsing, value typing, and exit-code mapping. |
Notes: The code is consistent with existing MCP client usage (McpUpstreamClient, ToolListManager), disposes transport/client via await using, and honors --no-start semantics. The parse/exit-code logic is well covered by the new tests; the live network/host-start orchestration (RunAsync HTTP flow, EnsureHostAsync) is not unit-tested, which is understandable given it requires a running host.
🧠 Review effort: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-25374/wasm-skia-net9/index.html |
|
The build 239048 found UI Test snapshots differences: Details
|
|
|
…n for elementRef-only tools
Three script-side verbs that need nothing new from the host:
- `wait [--timeoutSeconds] [--ready]` polls the runtime info until an app
is connected, then until Hot Reload is Ready (through the status tool
when offered, else 15 s by the clock). Exit 1 on timeout or Disabled.
- `assert <find selectors> [--state tok,..] [--absent] [--count N]` is a
find with a verdict on the {state} tokens of every match; exit 1 on fail.
- On an App MCP whose element tools take only elementRef, `--name` is
resolved through a compact tree snapshot (#Name), like the DevFlow CLI
resolves --automationId. --automationId cannot be resolved there, since
the tree does not print it, and says so (exit 2).
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NzKY9EQxsHN7uhcmPniyJZ
…ad-status exit codes
App MCP hosts that send `{ matched }` and `{ verdict }` decide the exit
code directly; the text checks stay for older hosts.
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_01NzKY9EQxsHN7uhcmPniyJZ
There was a problem hiding this comment.
🔵 Needs a closer look
It adds a sizable new user-facing CLI surface whose main execution paths (host start, live MCP tool calls, the untested wait --ready status path) depend on host behavior that can't be verified here and warrant human sign-off.
1 open finding
🧠 Review effort: Balanced
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-25374/wasm-skia-net9/index.html |
|
The build 239065 found UI Test snapshots differences: Details
|
|
|
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NzKY9EQxsHN7uhcmPniyJZ
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-25374/wasm-skia-net9/index.html |
|
|
…t does not list A hook pays this wait on every edit when the App MCP is older than the status tool; with --no-start the host was already running, so a tool it does not list now is not coming. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NzKY9EQxsHN7uhcmPniyJZ
✅ Backports have been createdDetails
|
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Fd9qv2ueBstmsvPi99nW4L
There was a problem hiding this comment.
🔵 Needs a closer look
It is a sizeable new CLI feature whose key runtime paths (on-demand host spawning and live MCP interaction) are validated only manually and cannot be exercised by the automated tests, warranting human review.
0 open findings
1 resolved since last review
🧠 Review effort: Balanced
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Fd9qv2ueBstmsvPi99nW4L
There was a problem hiding this comment.
🔵 Needs a closer look
It introduces a large (~646-line) new CLI surface that spawns the DevServer and performs MCP/process I/O whose end-to-end behavior cannot be verified here, so it warrants final human review.
0 open findings
🧠 Review effort: Balanced
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-25374/wasm-skia-net9/index.html |
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-25374/docs/index.html |
|
The build 239466 found UI Test snapshots differences: Details
|
vatsashah45
left a comment
There was a problem hiding this comment.
Reviewed at c73bdbc against uno.app-mcp main as of today (which now includes #188's 2a58bfc). The verb table, parameter names, restart, wait --ready and the find matched field all line up with main, and the IsAppCommand tests close Copilot's finding. Three things inline: the verdict exit-code table predates 2a58bfc, a file query can exit 0 on an unavailable status, and the global logging options do not survive the app verb.
…tions around `app` - hot-reload-status --file: noChanges, superseded and ignored exit 0; queued, processing, notReceived and applying exit 4 (call again); a file query with no verdict (status unavailable) exits 1 instead of 0. - --log-level/-l/--file-log/-fl are applied by Program before or after the verb, and are no longer sent to the tool or rejected. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Fd9qv2ueBstmsvPi99nW4L
There was a problem hiding this comment.
🔵 Needs a closer look
It introduces a large new user-facing CLI surface whose core runtime behavior depends on a live host and an external App MCP contract that cannot be validated in automated review, so it warrants final human review.
0 open findings
🧠 Review effort: Balanced
|
🤖 Your Docs stage site is ready! Visit it here: https://unodocsprstaging.z13.web.core.windows.net/pr-25374/docs/index.html |
|
🤖 Your WebAssembly Skia Sample App stage site is ready! Visit it here: https://unowasmprstaging.z20.web.core.windows.net/pr-25374/wasm-skia-net9/index.html |
|
The build 239483 found UI Test snapshots differences: Details
|
|
|
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |

What
uno-devserver app <verb|tool> [--param value]... [--json] [--out <file>] [--no-start]One new command on the existing DevServer CLI. Every verb is one App MCP tool (
uno_app_*) called over the host's/mcpHTTP endpoint with the same MCP client the stdio proxy uses, so a shell, a Claude Code hook, or a CI script gets the same tools as an MCP client, plus an exit code.tools,start,close,info,hot-reload-status,screenshot,tree,find,invoke,action,click,key,type,datacontext,memory,diag. An unknown verb is sent verbatim, so app-definedapp_*tools work too.wait [--timeoutSeconds] [--ready](until an app is connected, then until Hot Reload is Ready),assert <find selectors> [--state tok,..] [--absent] [--count N](a find with a verdict on the{state}tokens). On an App MCP whose element tools take onlyelementRef,--nameis resolved through a compact tree snapshot, like the DevFlow CLI resolves--automationId;--automationIdcannot be (the tree does not print it) and says so.structuredContent(matched,verdict) when the host sends it (unoplatform/uno.app-mcp#197), and fall back to the text checks on older hosts.--name valuebecomes a typed tool argument (JSON when it parses as JSON, string otherwise, bare--flagistrue).--jsonprints the rawCallToolResult; an image block goes to--outor a timestamped file.startdoes when none is registered for the solution, unless--no-start.findmatched nothing; 2 bad arguments, no host with--no-start, or tool not offered.hot-reload-status --filemaps everyHotReloadVerdict: 0applied/noChanges/superseded/ignored; 1notApplied/noOperation/probablyNotApplied/unknown, or no verdict at all; 3rudeEdit; 4queued/processing/notReceived/applying(call again).--log-level/-l/--file-log/-flwork before or after theappverb and are never sent to the tool.uno-devserver app --help(alsoapp helpand a bareapp) prints the full reference: verbs and their tools, parameter typing,wait/assert, exit codes, examples. The global--helppoints to it.doc/articles/features/devserver-app-commands.md(in the Dev Server TOC), linked fromdev-server.mdandusing-the-uno-mcps.md.Why
The App MCP already is the Uno equivalent of the Dart MCP server. What was missing is the half that a shell can drive: hooks and CI cannot call MCP tools, exit codes are assertions, a command line is replayable by a person, and one install serves every agent. The first consumer is the
uno-testingPostToolUse hook in unoplatform/studio#188, which runsapp hot-reload-status --no-start --file <edited>after each edit and reports the verdict to the agent.Testing
Uno.UI.DevServer.Cli.Tests: 394 total, 389 pass. The 5 failures (Given_CliCommandProcesslist/cleanup/stop nested-workspace,Given_McpRootsFallbackProcess×2) fail identically onmasteron the same machine.End to end against a real host and app (Uno.Sdk 6.8.0-dev.12, host 6.8.0-dev.42):
app toolscold-started the host and listed the tools;app start→info→tree→screenshot --fileType png→closereturned the right text and exit codes;app findexits 2 there because that App MCP predatesuno_app_find_elements.--no-start: reuses a registered host, exits 2 with a message when none runs, never spawns one.hot-reload-statusexit codes are unit-tested against the status text format; the tool itself ships with App MCP 2.0 and was not exercised live.Live on testingground (App MCP 1.3-era host):
app wait --readyreturned after the connection plus the 15 s fallback;app datacontext --name HelloTextresolved^4tthrough the tree and returned the real result; unknown name → 1,--automationIdon an elementRef-only tool → 2,assertwithout the find tool → 2,waitwith no app → 1 after the timeout.Known
/mcp(host 6.8 + App MCP 1.4);app toolsdedupes.appcall itself spawns the host, the host inherits the CLI's stdout handle, souno-devserver app ... | tailwaits until the host exits. Same spawn path asstart;--no-startor a redirect to a file avoids it.🤖 Generated with Claude Code
https://claude.ai/code/session_01NzKY9EQxsHN7uhcmPniyJZ