Repository navigation
Add winapp ask for WinUI samples and Microsoft Learn docs - #1187
Jaylyn Barbee (Jaylyn-Barbee) wants to merge 18 commits into
Conversation
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 76449390-12a0-49ec-b0e6-73542745f293
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 76449390-12a0-49ec-b0e6-73542745f293
Co-authored-by: Copilot App <[email protected]> Copilot-Session: 76449390-12a0-49ec-b0e6-73542745f293
There was a problem hiding this comment.
🔵 Needs a closer look
The new network transport and NativeAOT dependency need final human review, with current-head packaging and required CI results still unverified here.
No open issues 🎉
What changed in this PR
Adds winapp ask "<question>" to search WinUI samples and Microsoft Learn documentation together, addressing the broader Windows development questions in #1070. Results remain separate from generated answers, and find-ui stays sample-only.
Changes:
- Adds text and JSON output with separate sample matches, documentation links, and source errors.
- Adds a Learn client with a three-second deadline, bounded responses, and sample preservation when documentation search fails.
- Adds command, transport, and npm tests, plus usage documentation and agent guidance covering privacy and partial results.
| File | Description |
|---|---|
src/winapp-npm/test/winapp-commands-run.test.ts |
Tests question forwarding and preservation of JSON results. |
src/winapp-CLI/WinApp.Cli/WinApp.Cli.csproj |
References the MCP protocol package. |
src/winapp-CLI/WinApp.Cli/Services/Learn/LearnSearchClient.cs |
Implements Learn requests, timeout handling, filtering, and result limits. |
src/winapp-CLI/WinApp.Cli/Services/Controls/ScenarioSanitizer.cs |
Makes text sanitization available to Learn results. |
src/winapp-CLI/WinApp.Cli/Program.cs |
Routes ask parser errors through the flat JSON contract. |
src/winapp-CLI/WinApp.Cli/Models/JsonOutputModels.cs |
Adds source-generated JSON models for combined results. |
src/winapp-CLI/WinApp.Cli/Helpers/HostBuilderExtensions.cs |
Registers the Learn client and command handler. |
src/winapp-CLI/WinApp.Cli/Commands/WinAppRootCommand.cs |
Registers ask and includes it in grouped help. |
src/winapp-CLI/WinApp.Cli/Commands/FindUiCommand.cs |
Shares existing sample formatting and JSON conversion. |
src/winapp-CLI/WinApp.Cli/Commands/AskCommand.cs |
Coordinates both searches and presents results or source errors. |
src/winapp-CLI/WinApp.Cli.Tests/ProgramJsonBridgeTests.cs |
Tests JSON parser errors for ask. |
src/winapp-CLI/WinApp.Cli.Tests/LearnSearchClientTests.cs |
Tests protocol handling, limits, cancellation, and malformed responses. |
src/winapp-CLI/WinApp.Cli.Tests/AskCommandTests.cs |
Tests combined output, partial failures, privacy help, and command separation. |
src/winapp-CLI/Directory.Packages.props |
Pins the MCP protocol dependency version. |
README.md |
Adds ask to discovery commands with a privacy note. |
plugins/winapp/skills/winapp-find-ui/SKILL.md |
Links to the broader documentation-search skill. |
plugins/winapp/skills/winapp-ask/SKILL.md |
Guides research, privacy, evidence checking, and partial-result handling. |
plugins/winapp/com.github.copilot/agents/winapp.agent.md |
Routes documentation questions to the new skill. |
docs/usage.md |
Documents usage, privacy, result limits, JSON fields, and exit codes. |
docs/npm-usage.md |
Adds the npm wrapper example and links to privacy guidance. |
Review effort: Balanced
Build Metrics ReportValidation passed. All required build and validation jobs succeeded. Binary Sizes
.NET Test Results (TRX reports)Other suites are reflected in the overall validation status above. ✅ 11135 passed, 44 skipped out of 11179 tests in 1636.7s (+116 tests, -482.0s vs. baseline) Test Coverage✅ 87.6% line coverage, 81.8% branch coverage · ✅ no change vs. baseline CLI Startup Time65ms median (x64, Try This BuildInstalls the MSIX for your architecture, replacing any previously installed build. Needs the GitHub CLI — the command offers to install it and sign you in if it is missing. & ([scriptblock]::Create((irm https://raw.githubusercontent.com/microsoft/winappCli/main/scripts/winapp-pr.ps1))) 1187Switching between builds often?Put the tool on your PATH once: & ([scriptblock]::Create((irm https://raw.githubusercontent.com/microsoft/winappCli/main/scripts/winapp-pr.ps1))) -AddToPathThen this build is just: winapp-pr 1187Run Updated 2026-11-05 14:53:47 UTC · commit |
Zach Teutsch (zateutsch)
left a comment
There was a problem hiding this comment.
🤖 AI-generated review (winappcli pr-review skill) — verify before acting.
No blocking defects found in the review of commit 2390b06. The optional quiet-mode note is inline. The PR has since advanced to ad68955; I verified that the commented code is unchanged, but have not reviewed the other changes in that newer head.
At the reviewed commit, x64 and ARM64 native publishes passed, all 222 targeted tests passed, and published CLI checks covered live Learn results, unavailable Learn with preserved samples, JSON parser errors, and empty-result exit codes. Plugin validation against the published schema also passed. Full test and packaging suites were not rerun locally; the GitHub checks inspected during the review passed.
The winui-design skill and winui-dev agent sent agents only to find-ui. They now suggest winapp ask when samples don't explain a feature, with a privacy reminder and a find-ui fallback for CLIs without ask. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 76449390-12a0-49ec-b0e6-73542745f293
find-ui already skipped this informational line in quiet mode; ask now does the same. Search results and source errors still print. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 76449390-12a0-49ec-b0e6-73542745f293
Doc excerpts arrived as raw Markdown, so about a quarter of each 400-character excerpt was headings, link URLs and code fences. They are now converted to plain text before shortening, and the repeated page title is dropped. Learn takes longer to search long questions, so a pasted task description always timed out at 3 seconds and the message said to retry. The timeout is now 5 seconds and the message says to ask about one feature in a few words. The winapp-ask skill now explains how to write short, one-feature queries, with examples, and its paragraphs are no longer hard-wrapped. The ask docs section is reflowed the same way. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 76449390-12a0-49ec-b0e6-73542745f293
Excerpts are now converted from Markdown before shortening, so the conversion saw the whole Learn content, up to 1 MiB. Some patterns slow down quadratically on unusual input, and an excerpt of repeated unclosed '**' made ask hang for minutes after the network work finished. The raw content is now capped at 4,000 characters before conversion; real excerpts are about 2,000. Co-authored-by: Copilot App <[email protected]> Copilot-Session: 76449390-12a0-49ec-b0e6-73542745f293
What and why
winapp ask "how do I add a jump list?"searches WinUI samples and Microsoft Learn together. It shows sample IDs first, then up to three documentation links, each with a short plain-text excerpt (up to 400 characters). It returns search results, not a generated answer.find-uistays a separate, sample-only command. It is not an alias forask, and does not send questions to Learn. Everyaskquestion is sent to the public Learn service; do not include secrets or private project text. If Learn fails, is offline, or exceeds its five-second timeout, sample results remain available and the source error is reported, including in--json. Learn takes longer to search long questions, so the timeout message tells you to ask about one feature in a few words.Agents learn when to use it: a new
winapp-askskill, a routing row in the winapp agent, and a pointer from thewinui-designskill andwinui-devagent for features samples don't explain. The skill shows how to write short, one-feature queries, with examples.Related to #1070. This PR is for testing the combined search workflow.
Before / after
Command on both builds:
winapp ask "how do I add a jump list?".Before —
mainat444d93cedoes not recognizeask. The help text that follows the error is cut withSelect-Object -First 2.After — this branch at
17c00ac5shows WinUI samples, then Learn docs as plain-text excerpts.Not tested / risks
MSIX and NuGet package creation, the full managed suite, and sample/UI end-to-end suites have not been run locally. Runtime checks were on ARM64; x64 was built but not exercised. Learn's search time grows with question length (about 1.3s at 36 characters, 2.3s at 432, and over 5s at 1,700), so a pasted task description still returns samples without docs. Offline,
askkeeps samples and reports that Learn could not be reached.Local validation
pwsh -NoProfile -File .\scripts\build-cli.ps1 -SkipTests -SkipMsix -SkipNuGet— passed on the final head, including native x64 and ARM64 publishes with the normal trim/NativeAOT warning gates, DevTools engine checks, npm packaging, formatting, lint and compilation. The process-local PATH included the Visual Studio Installer directory. No audit or AOT warning suppression was needed.dotnet test --project src\winapp-CLI\WinApp.Cli.Tests\WinApp.Cli.Tests.csproj -c Release -- --filter 'FullyQualifiedName~AskCommandTests|FullyQualifiedName~LearnSearchClientTests|FullyQualifiedName~FindUiCommandTests|FullyQualifiedName~ProgramJsonBridgeTests|FullyQualifiedName~ScenarioSanitizerTests'— passed, 240 tests.npm run build-copy-onlythennpm testinsrc\winapp-npm— passed, 347 tests, including the generatedaskwrapper and guide examples.pwsh -NoProfile -File .\scripts\validate-plugin-package.ps1— passed, including after the WinUI skill update.pwsh -NoProfile -File .\scripts\validate-llm-docs.ps1— passed against the current CLI schema.npm install --global --prefix .\artifacts\ask-installed .\artifacts\microsoft-winappcli-0.7.2-jaylyn-barbee-winapp-ask-starter.107.tgzthen.\artifacts\ask-installed\winapp.cmd ask "how do I add a jump list?" --json— passed; the isolated installation returned one sample group and three docs, exit 0.ask "azure storage blob upload" --jsonreturned three docs after fixing mixed-source results;ask --jsonreturned a flat parser error and exit 1;find-ui "jump list" --jsonreturned sample matches without docs.Checklist
plugins/winapp/skills/updated if user-facing behavior changedNotes for reviewers
Uses the public Learn MCP endpoint over HTTPS with
ModelContextProtocol.Coreprotocol types. The transport uses source-generated JSON so the CLI keeps its NativeAOT build gates. There is no CLI batch syntax.No corpus re-bake is needed: the only sanitizer change makes its existing terminal-control filter accessible to the Learn client; the filter and baked sample output are unchanged.