Repository navigation
DevFlow skills: prefer unified maui CLI over standalone tools + improve JSON/error guidance #197
Description
Summary
The maui-devflow-debug and maui-devflow-onboard agent skills (under plugins/dotnet-maui/skills/) currently steer AI agents toward a mix of clients to prepare and handle devices:
androidsdk.tool(android sdk|avd|device|jdk …)appledev.tools(apple xcode|runtime|simulator …)- Raw
adb …andxcrun simctl … - Plus
lsof,pgrep, etc.
Most of those operations are already covered by the unified maui CLI (Microsoft.Maui.Cli). Mixing tools forces agents to install three global tools, learn three command surfaces, and parse three different output shapes. JSON / error guidance in the skills is also weak — agents are not told to use --json, parse error.code, or follow remediation.command hints that the CLI already emits via MauiToolException.
This issue tracks (a) retargeting the active DevFlow skills to the maui CLI everywhere it supports the operation today, (b) improving JSON and error-troubleshooting guidance inline, and (c) capturing the real maui CLI gaps as follow-up work.
Audit — maui CLI coverage matrix
Verified against src/Cli/Microsoft.Maui.Cli/Commands/.
| Skill operation | Old reference | maui equivalent |
Status |
|---|---|---|---|
| List devices/emulators | adb devices / xcrun simctl list devices booted / apple simulator list / android device list |
maui device list --platform android|apple |
✅ replace |
| List AVDs | android avd list |
maui android emulator list |
✅ replace |
| Create / start / stop / delete AVD | android avd … |
maui android emulator create|start|stop|delete |
✅ replace |
| Android SDK install / list / info / accept-licenses | android sdk … |
maui android sdk … (+ maui android install for guided setup) |
✅ replace |
| JDK install / check | android jdk … |
maui android jdk … |
✅ replace |
| Xcode list | apple xcode list |
maui apple xcode list |
✅ replace |
| Simulator runtime list | (n/a in skills today) | maui apple runtime list |
✅ added as a discovery hint |
| List sims | apple simulator list / xcrun simctl list devices |
maui apple simulator list |
✅ replace |
| Boot / shutdown / delete sim | apple simulator boot|shutdown|delete / xcrun simctl … |
maui apple simulator start|stop|delete |
✅ replace |
| Environment health check | (n/a) | maui doctor |
✅ added |
| Connectivity diagnostic | mixed | maui devflow diagnose |
✅ surfaced earlier |
| Create / erase simulator | xcrun simctl create|erase |
❌ not in maui |
|
| Install / launch app on sim | xcrun simctl install|launch |
❌ not in maui |
|
| Sim privacy / appearance / openurl / push / location / addmedia | xcrun simctl … |
❌ not in maui |
|
| Sim screenshot (non-MAUI app) | xcrun simctl io booted screenshot |
❌ not in maui (use maui devflow ui screenshot for a running MAUI app) |
|
Android adb reverse 19223 (broker) |
adb reverse tcp:19223 tcp:19223 |
❌ not in maui |
|
Android adb forward <agent port> |
adb forward tcp:<port> tcp:<port> |
❌ not in maui |
|
| APK install / uninstall / launch / stop | adb install / am start / am force-stop |
❌ not in maui |
|
| logcat / app logs (pre-agent) | adb logcat |
maui devflow ui logs works once the agent is up; adb logcat still required pre-agent |
|
| Screencap / screenrecord (Android, pre-agent) | adb shell screencap|screenrecord |
maui devflow ui screenshot once agent is up |
|
| Port-in-use diagnosis | lsof -i :<port> |
❌ not in maui |
|
| Build / run app | dotnet build -t:Run / dotnet run |
(intentionally out of maui CLI scope) |
✅ keep dotnet |
What changed in the skills (this PR)
All edits are under plugins/dotnet-maui/skills/:
maui-devflow-debug/SKILL.md— INVOKES line rewritten to lead with themauiCLI; new "Reading machine-readable output" section covering--json, error code categories (E1xxx–E5xxx),remediation.type(AutoFixable/UserAction/Terminal), and--cifor non-interactive failure-fast use.references/android.md— fully rewritten to bemaui-first. Rawadbops (port forwarding, install, logcat, screencap, push/pull/shell) grouped under a clearly labeled "Raw fallbacks not yet inmauiCLI" section.references/ios-and-mac.md— restructured aroundmaui apple xcode|runtime|simulator …. Rawxcrun simctlops (create/erase/install/launch/privacy/appearance/openurl/push/location/addmedia) grouped under the same labeled fallback section. Permission and dark-mode subsections explicitly flag the raw fallback.references/connectivity.md— leads withmaui devflow diagnose+maui device list; new "Reading errors from the CLI" section with the structured error envelope and code-prefix table.references/troubleshooting.md— new top section "Reading machine-readable output and errors" with the full envelope JSON, code taxonomy, remediation types, and a worked example usingE2106 (AndroidEmulatorNotFound). Existing items now referencemauicommands and concrete codes (E2101,E2103,E2402).references/setup.md—Microsoft.Maui.Cliis the only required global tool;androidsdk.toolandappledev.toolsmoved to an "Optional extras" subsection. Rawadbport-forwarding step labeled.maui doctoradded to verification.maui-devflow-onboard/SKILL.md— addedmaui doctorto the verify block, plus a one-line note: "Use--jsonand readerror.code/remediation.commandfor programmatic recovery."references/macos.md,linux.md,batch.md— verified clean (no changes needed).
Verification
rg -n '^\s*(android |apple |xcrun simctl |adb )' \
plugins/dotnet-maui/skills/maui-devflow-debug \
plugins/dotnet-maui/skills/maui-devflow-onboard
Every remaining match is inside a clearly labeled "Raw fallbacks not yet in maui CLI" section or is preceded by a # Not yet wrapped by 'maui' CLI comment.
JSON / error troubleshooting improvements
Skills now teach agents to:
- Pass
--jsonto any command an agent will parse. - Branch on
error.code(categories fromsrc/Cli/Microsoft.Maui.Cli/Errors/ErrorCodes.cs):E1xxx— tool/internalE2xxx— platform/SDK (E20xxJDK,E21xxAndroid,E22xxApple,E23xxWindows,E24xx.NET)E3xxx— user actionE4xxx— networkE5xxx— permission
- When
error.remediation.type == AutoFixable, runerror.remediation.commandand retry. - When
error.remediation.type == UserAction, followerror.remediation.manualSteps. - Use
--cifor non-interactive failure-fast runs.
Worked example (E2106) is included in references/troubleshooting.md.
Follow-up backlog — real maui CLI gaps
These are out of scope for this PR but should drive future maui CLI work so the skills can drop more raw fallbacks:
maui apple simulator create|erase|install|launch|screenshot|openurl|push|location|addmedia— today onlylist|start|stop|delete.maui apple simulator privacy grant|revoke|reset— for permission management.maui apple simulator appearance light|dark— for theme toggling in tests.maui android port reverse|forward|list|clear— wrapadb reverse/adb forward, with the broker port19223as a default and an--agent-portshortcut for DevFlow.maui android device install|uninstall|launch|stop— wrapadb install -r,pm uninstall,am start,am force-stop.maui android device logcat [--tag …] [--pid …]— wrapadb logcatwith sensible MAUI defaults (MauiDevFlow,DOTNET).maui android device screenshot|screenrecord— wrapadb shell screencap/screenrecord.maui port check <port>— wraplsof -i :<port>cross-platform (also useful for broker port conflicts).- Structured JSON for errors — confirm and document that
--jsonwrites a stable{ "error": { "code", "message", "remediation": { "type", "command", "manualSteps" }, "context", "nativeError" } }shape fromMauiToolException. Add it to skills + CLI README. maui devflow diagnose --json— ensure the connectivity diagnostic emits a structured per-check result so agents can branch on it instead of grepping prose.
Out of scope
- The legacy
maui-ai-debuggingskill — it already redirects new clients tomaui-devflow-debug. - The
devflow-automationskill — it's about[DevFlowAction], not device handling. - No new
mauiCLI commands are added in this PR; only skill markdown is changed.
References
- Skills:
plugins/dotnet-maui/skills/maui-devflow-debug/,plugins/dotnet-maui/skills/maui-devflow-onboard/ - CLI command surface:
src/Cli/Microsoft.Maui.Cli/Commands/ - Error taxonomy:
src/Cli/Microsoft.Maui.Cli/Errors/ErrorCodes.cs - Error envelope:
src/Cli/Microsoft.Maui.Cli/Errors/MauiToolException.cs
Activity
rmarinho commentedon Apr 30, 2026
Implementation plan + upstream issues filed
Following up on this audit, I traced the gap list against the actual upstream repos to see what was already there, what was already filed, and what we still needed to file. Three findings of note:
Xamarin.MacDev.SimulatorServicealready shipsCreateandErase— they're just not exposed inmaui apple simulator. So that pair is CLI-only work, no upstream blocker.Xamarin.Android.Tools.AdbRunnerreverse-port API is merged upstream (dotnet/android-tools#305), but not in our currently-consumed1.0.143-preview.10(verified by reflection on the cached package — onlyListDevices/WaitForDevice/StopEmulator/GetShellProperty/RunShellCommandare public there). Somaui android port reverseis gated on a package bump, not on new upstream API work.AdbRunner.RunShellCommandAsyncis already public in preview.10 — we don't need a separate "generic shell" upstream issue.Upstream issues filed today
SimulatorServiceapp lifecycle (install/uninstall/launch/terminate/get_app_container)SimulatorServiceextras (privacy/appearance/status_bar/openurl/push/location/addmedia/screen capture)AdbRunnerapp management (install/uninstall/launch/force-stop/list-packages)AdbRunnerstructured logcat streamingAdbRunnerscreencap and screenrecordAdbRunnerforward port management (mirror of dotnet/android-tools#305 reverse)Already-filed upstream issues we'll consume
android-tools: dotnet/android#12071 (parentAdbRunner), dotnet/android#12069 (AvdManager), dotnet/android#12070 (EmulatorRunner), dotnet/android#12074 (push/pull), dotnet/android-tools#321/#322 (device profiles + skins), dotnet/android#12073/#327/#323 (track-devices), dotnet/android#12083/#340 (emulator launch result), dotnet/android#12080/#331/#332 (SDK channel/version pinning/--all-versions), dotnet/android#12075/#272 (license), dotnet/android#12076 (GPU accel), dotnet/android#12077 (sysimg compat), dotnet/android#12078 (getprop fallback).macios-devtools: dotnet/android-tools#149/#150/#151/#152/#153/#154 (closed — already shipped APIs we're starting to consume).Phases (full plan saved internally)
maui apple simulator create|erase,maui port check <port>, verifymaui devflow diagnose --jsonis structured per-check. Each lands as its own focused PR.XamarinAndroidToolsAndroidSdkVersion/XamarinAppleToolsMaciOSVersionineng/Versions.props(via Maestro/DARC) and expose the correspondingmauisubcommand. RefactorProviders/Android/Adb.csto wrap upstreamAdbRunner. Refactormaui devflow ui permissionto consumeSimulatorService.PrivacyServiceonce macios#175 part 1 ships.mauiCLI" entry inreferences/android.md/references/ios-and-mac.md.ErrorResultenvelope insrc/Cli/README.md, addmaui errors list --jsonto enumerate codes, ensurediagnose --jsonemits structured per-check shape. (The skill-side documentation work landed in Add reference to System.Security.Cryptography.Xml android-tools#198.)This issue stays open as the tracker until all six upstream issues are merged and exposed in the CLI.
rmarinho commentedon Apr 30, 2026
Correction on the upstream filing list: closed android-tools#350 (forward port) as a duplicate. The
AdbPortSpec/AdbPortRuletypes from PR dotnet/android-tools#305 already cover the design surface, so forward is a small 4-method follow-up rather than a separate design issue. Moved the request to a comment on dotnet/android-tools#305 so the design context stays together.rmarinho commentedon Apr 30, 2026
Filed forward-port follow-up upstream as a draft PR: dotnet/android-tools#351 (instead of a separate issue, given the design context already lives on PR dotnet/android-tools#305).
Expose maui apple simulator create|erase
Expose maui apple simulator create|erase
docs: document --json error envelope contract in CLI README
Expose maui apple simulator create|erase (#203)
feat: add maui port check command
docs: document --json error envelope contract in CLI README
rmarinho commentedon May 5, 2026
Upstream update — macios-devtools#176 merged ✅
macios-devtools#176 — Add simulator app lifecycle APIs — was merged at 2026-05-05 11:18 UTC (commit
87eb6ab). This implements the design from macios-devtools#174.SimulatorServicenow ships:Install(udid, appPath)Uninstall(udid, bundleId)Launch(udid, bundleId, args?, env?)(returns PID)Terminate(udid, bundleId)GetAppContainer(udid, bundleId, container?)What unblocks here
Once the next
XamarinAppleToolsMaciOSVersionbump (via Maestro/DARC) reacheseng/Versions.props, we can scope a single follow-up PR to expose:maui apple simulator install <udid> <app>maui apple simulator uninstall <udid> <bundleId>maui apple simulator launch <udid> <bundleId>(emit PID in--json)maui apple simulator stop-app <udid> <bundleId>(terminate; distinct from existingsimulator stopwhich currently means shutdown)Naming caveat: today
maui apple simulator stopshuts down the device. If we surfaceTerminate, we should pick a non-overloaded verb (stop-app,kill, or renamestop→shutdownand free upstopfor the app — would be a small breaking change worth flagging).Still waiting
macios-devtools#177 (privacy/appearance/status_bar/openurl/push/location/addmedia/screenshot/recordvideo, implementing #175) is still draft + review-required. That one also unblocks the
maui devflow ui permissionrefactor away from shelling out toxcrun simctl privacy.[AdbRunner] Add ADB forward port management (follow-up to dotnet#305)
feat: add maui port check command
feat: add maui port check command
docs: document --json error envelope contract in CLI README (#199)
docs: document --json error envelope contract in CLI README (#199)
rmarinho commentedon May 13, 2026
Status update — 2026-05-13
PR dotnet/android-tools#198 status
PR dotnet/android-tools#198 is being rebased and updated to address all 4 code review findings:
"error": {}wrapper doesn't match CLI output){ "code": ... }AutoFixable→autofixable)manualSteps→manual_steps)[JsonPropertyName]sdk info/jdk info)sdk check/jdk checkCross-repo upstream tracker
dotnet/macios-devtoolsOpen issue: #175 — tracking issue for simulator extras
dotnet/android-toolsadb reverse/forward)Open issues (no PR yet):
Gap closure progress (from original follow-up backlog)
simctl create/erase/install/launchsimctl privacy grant/revoke/resetsimctl appearance light/darkadb reverse/forwardadb install/uninstall/launch/stopadb logcatadb screencap/screenrecordport check <port>maui devflow diagnose --jsonSummary: 5/10 gaps have active upstream PRs (2 already merged). The critical path is merging android-tools dotnet/android-tools#351 and macios-devtools dotnet/android-tools#177 then consuming them in maui-labs.
Skills: retarget DevFlow skills to the unified `maui` CLI
feat: add maui port check command
Skills: retarget DevFlow skills to the unified `maui` CLI
[AdbRunner] Add ADB forward port management (#351)
feat: add maui port check command (#200)
Refactor AndroidDevFlowPortForwarder to use AdbRunner
Refactor AndroidDevFlowPortForwarder to use AdbRunner (#363)
[AdbRunner] Add ADB forward port management (#351)