agentleFS
MicrosoftKnown publishermicrosoft/winappCli/AGENTS.md

winappCli

AGENTS.md1.3k starsChanged 2 months agoMITView on GitHub

This file provides focused, actionable information to help an AI coding agent be immediately productive in this repo. Write for someone using winapp. Lead with the smallest command or input that demonstrates the behavior, then answer: what can I do, what do I type, what happens, and what action should I take if it fails. Describe observable behavior, not implementation machinery. Keep internal deliberation, review provenance, rejected alternatives, review rounds/IDs, resolved blockers, and defenses of the implementation out of user…

  • Installs packages

Trending

More talk lately.about the whole repository

Dec 2025: 0 mentionsJan 2026: 0 mentionsFeb 2026: 1 mentionMar 2026: 0 mentionsApr 2026: 0 mentionsMay 2026: 1 mentionJun 2026: 0 mentionsJul 2026: 1 mentionAug 2026: 8 mentionsSep 2026: 12 mentionsOct 2026: 13 mentionsNov 2026: 0 mentions
Dec 2025Jun 2026Nov 2026
Mentions a month of the microsoft/winappCli repository that our weekly crawl found. There is no adoption data for this file yet.

Who's talking about microsoft/winappCli

The biggest 5 of 36 mentions linking to the repository that our crawl found. Each line is their own headline.

See all 36

Talked about on GitHub and Bluesky (36 times).

On GitHub · 35

30 more on GitHub

On Bluesky · 1

The file

Show its rules and text

We split this AGENTS.md into the rules it gives an agent

23 rules. About 0 are common, 7 are distinctive, and 16 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 16

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Write for someone using winapp.

    line 9
  2. Distinctive:

    Keep internal deliberation, review provenance, rejected alternatives, review rounds/IDs, resolved blockers, and defenses of the …

    line 14
  3. Distinctive:

    If any cannot be named, replace the unreleased behavior cleanly instead of preserving it with a shim.

    line 57
  4. Very specific:

    If you need the pde-oss_Internal feed itself (the one CI restores from), it requires a token:

    line 140
  5. Very specific:

    Do not fix this by adding a global package source — these tests run in %TEMP%, outside the repo, so a repo-local nuget.config never applies …

    line 153
  6. Distinctive:

    When observable behavior changes, update only the surfaces that teach or expose that behavior.

    line 190
  7. Very specific:

    Add a page under docs\ only when users need a new workflow or reference that does not fit an existing canonical page.

    line 203
  8. Very specific:

    Create test.Tests.ps1 in the sample directory (Pester naming convention)

    line 228
  9. Very specific:

    Use BeforeDiscovery for skip logic (prerequisite checks run at discovery time)

    line 229
  10. Very specific:

    Import shared helpers in BeforeAll: Import-Module "$PSScriptRoot\..\SampleTestHelpers.psm1" -Force

    line 230
  11. Very specific:

    Add the sample name to the matrix in .github/workflows/test-samples.yml

    line 234
  12. Very specific:

    BeforeAll: Import SampleTestHelpers.psm1, install winapp, create temp directories.

    line 239
  13. Very specific:

    It blocks: Use -Skip:$script:skip for prerequisite gating.

    line 241
  14. Very specific:

    Keep build-and-package and test-samples-result as top-level aggregate check names for branch protection.

    line 272
  15. Very specific:

    Look at the docs\cli-schema.json for the full schema to know what the cli can do

    line 319
  16. Very specific:

    Changing CLI commands/workflows: Update the relevant hand-written skill in plugins/winapp/skills/ if its workflow, examples, or …

    line 325
  17. Very specific:

    After C# CLI changes: Run cd src/winapp-npm && npm run build to update npm package binaries.

    line 326
  18. Very specific:

    Do not edit it directly; run scripts/build-cli.ps1 to regenerate it.

    line 338
  19. Distinctive:

    Use the appropriate pattern for new code:

    line 394
  20. Distinctive:

    Prefer one cohesive implementation over several wrappers that only forward to one another.

    line 407
  21. Distinctive:

    Do not extract a method group merely because it uses only a few of a service's dependencies.

    line 411
  22. Very specific:

    Use AppxManifestDocument for AppxManifest.xml operations — it provides typed access and namespace-aware queries

    line 417
  23. Very specific:

    When adding new manifest manipulation, add methods to AppxManifestDocument rather than writing regex in consuming code

    line 418

≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

Agent instructions for winapp

This file provides focused, actionable information to help an AI coding agent be immediately productive in this repo.

Audience contracts

User documentation

Write for someone using winapp. Lead with the smallest command or input that demonstrates the behavior, then answer: what can I do, what do I type, what happens, and what action should I take if it fails. Describe observable behavior, not implementation machinery.

Keep internal deliberation, review provenance, rejected alternatives, review rounds/IDs, resolved blockers, and defenses of the implementation out of user documentation. State each user-facing fact once on its canonical surface and link to it elsewhere instead of copying it.

Example: "After cloning a project with winapp.yaml, run winapp restore to reinstall its pinned SDK packages and projections without changing versions. For a .NET project without winapp.yaml, run dotnet restore instead."

Reviews and author communication

Assume the reader has no prior codebase or conversation context. A junior developer should understand each finding after one read. Use a plain title, then:

  • What is wrong: the behavior or design defect.
  • Show me: the smallest concrete command, input, tree, or code path, preferably as input -> actual result -> expected result.
  • Why it matters: the user, build, or maintenance consequence.
  • Smallest fix: the least-complex change that resolves it.

Define unavoidable jargon at first use. Put paths and lines in supporting detail, not in a title the reader must decode. If the issue cannot be demonstrated concretely, lower its confidence or drop it.

Example:

  • What is wrong: --setup-sdks none fails instead of skipping SDK updates.
  • Show me: winapp init --setup-sdks none -> exits nonzero in the package update loop; expected: succeeds without updating SDKs.
  • Why it matters: documented automation stops before initialization.
  • Smallest fix: skip the package-update loop when the value is none.

Compatibility boundary

Backward compatibility starts at the latest supported published release, not an earlier commit, review round, current PR implementation, or unreleased release work. Before adding or requesting an alias, fallback, migration path, legacy branch, or compatibility abstraction, name all three:

  1. The supported published version that contains the behavior.
  2. The public contract or persisted user data that depends on it.
  3. A real external consumer that would break.

If any cannot be named, replace the unreleased behavior cleanly instead of preserving it with a shim. The only exception is a preview contract the project has publicly committed to support.

Big picture

Two main components:

  • src/winapp-CLI (C#/.NET): The native CLI implemented with System.CommandLine. Key files: Program.cs, Commands/*.cs (e.g., InitCommand.cs, PackageCommand.cs). Build with scripts/build-cli.ps1.
  • src/winapp-npm (Node): A thin Node wrapper/SDK and CLI (cli.js) that forwards most commands to the native CLI. Key helpers: winapp-cli-utils.js, msix-utils.js, cpp-addon-utils.js. Install with npm install inside src/winapp-npm.

Developer workflows

# Build everything and generate autogenerated files
# You can pass -SkipTests, -SkipMsix, and/or -SkipNpm to speed up the build when those pieces are not needed
.\scripts\build-cli.ps1

# Or build directly with dotnet
dotnet build src/winapp-CLI/winapp.sln -c Debug

# Run native CLI in-tree
dotnet run --project src/winapp-CLI/WinApp.Cli/WinApp.Cli.csproj -- <args>

# Build the NuGet packages. -SkipCliPackage builds only the UI Automation libraries, which need
# no published CLI and so pack in seconds; without it the CLI tools package is built too and
# artifacts/cli must already hold an x64 + arm64 publish.
.\scripts\package-nuget.ps1 -SkipCliPackage

# Update npm package after CLI changes
cd src/winapp-npm && npm run build              # builds C# CLI + copies to npm bin
cd src/winapp-npm && npm run build-copy-only    # copies already-built Release binaries

# Node package development
cd src/winapp-npm && npm install
node cli.js help

# Always call the build script at the end to ensure everything builds and all autogenerated docs are generated
.\scripts\build-cli.ps1

# Produce packages first, then validate them without republishing or deleting artifacts.
# Keep artifacts\cli and artifacts\nuget from the same build and source revision.
.\scripts\build-cli.ps1 -SkipTests -SkipDocs
.\scripts\build-cli.ps1 -OnlyTests -UseExistingArtifacts

Running tests on a Microsoft corporate machine

api.nuget.org is not reachable from corp machines. Any test that downloads a package (anything touching Microsoft.Windows.SDK.BuildTools, so most of PackageCommand, SignCommand and MsixService coverage) fails with:

Failed to install Microsoft.Windows.SDK.BuildTools: The SSL connection could not be established

This is a known limitation, not a flaky test and not a transient outage. Do not dismiss a failure on these grounds and do not re-run hoping it passes.

NugetService resolves its package sources from the standard nuget.config hierarchy (rooted at the working directory), so pointing it at a reachable mirror is a config change, not an environment-variable override. Add a mirror of nuget.org to your user-level %APPDATA%\NuGet\NuGet.Config — the corporate proxy works and needs no token:

<add key="azure-default" value="https://packagefeedproxy.microsoft.io/nuget/v3/index.json" protocolVersion="3" />

The repo-root nuget.config deliberately declares no <packageSources>, so that user-level source is inherited by both dotnet restore and the CLI's own package downloads.

The live-feed integration tests in NugetServiceTests pin themselves to an isolated config so they can't inherit a machine that has nuget.org disabled. Point them at the same mirror:

$env:WINAPP_TEST_NUGET_SOURCE = 'https://packagefeedproxy.microsoft.io/nuget/v3/index.json'

Confirm the mirror answers before spending time on a long run:

Invoke-RestMethod 'https://packagefeedproxy.microsoft.io/nuget/v3/index.json'

If you need the pde-oss_Internal feed itself (the one CI restores from), it requires a token:

$t = azureauth aad --resource 499b84ac-1321-427f-aa17-267ca6975798 `
    --client 872cd9fa-d31f-45e0-9eab-6e460a02d1f1 `
    --tenant 72f988bf-86f1-41af-91ab-2d7cd011db47 --output token
$env:VSS_NUGET_ACCESSTOKEN = ($t | Select-Object -Last 1).Trim()

End-to-end tests that shell out to dotnet add package Microsoft.WindowsAppSDK need that feed to be a registered source. If nuget.org is disabled and no internal feed is registered, they fail with [ERROR] - Failed to add Microsoft.WindowsAppSDK package reference.

Do not fix this by adding a global package source — these tests run in %TEMP%, outside the repo, so a repo-local nuget.config never applies to them, and a machine-wide registration is a persistent change to a shared dev box. Instead point APPDATA at a throwaway directory holding the repo's own feed config, which scopes the whole thing to the session:

$feed = 'https://pkgs.dev.azure.com/microsoft/pde-oss/_packaging/pde-oss_Internal/nuget/v3/index.json'

# NuGet resolves its user-level config from %APPDATA%\NuGet\NuGet.Config, so redirecting APPDATA
# swaps in the repo's feed list without touching the real one.
$cfg = Join-Path $env:TEMP "winapp-nuget-$PID"
New-Item -ItemType Directory -Path "$cfg\NuGet" -Force | Out-Null
Copy-Item .pipelines\release-nuget.config "$cfg\NuGet\NuGet.Config"
$env:APPDATA = $cfg

# The Azure Artifacts credential provider needs the endpoint spelled out.
# VSS_NUGET_ACCESSTOKEN alone is NOT enough here - the service index returns 401 without this.
$env:VSS_NUGET_EXTERNAL_FEED_ENDPOINTS = @{
    endpointCredentials = @(@{ endpoint = $feed; username = 'docker'; password = $env:VSS_NUGET_ACCESSTOKEN })
} | ConvertTo-Json -Compress -Depth 5

.pipelines/release-nuget.config is the single source of truth for the feed URL — do not hardcode it somewhere else. CI does the same thing less surgically, by copying that file over %APPDATA%\NuGet\NuGet.Config on a throwaway agent.

Because APPDATA is redirected, run this in a dedicated shell and let it end with the run.

Note that the CLI's own package downloads read this same nuget.config hierarchy, so redirecting APPDATA covers both them and anything that shells out to dotnet.

More generally: if something fails locally but passes in CI, the difference is configuration, not luck. Check .pipelines/templates/build.yaml for the environment CI provides before concluding a failure is environmental.

Update affected user-facing documentation

When observable behavior changes, update only the surfaces that teach or expose that behavior. Internal refactors do not require user documentation. Never use documentation to explain internal implementation details or review history. Choose affected surfaces from:

  • docs\usage.md
  • docs\guides\
  • samples\
  • plugins\winapp\skills\
  • README.md
  • .github\plugin\marketplace.json (and .claude-plugin\marketplace.json)
  • plugins\winapp\com.github.copilot\agents\

Add a page under docs\ only when users need a new workflow or reference that does not fit an existing canonical page.

Sample & guide testing

Each sample under samples/ has a self-contained Pester 5.x test file (test.Tests.ps1) that validates the corresponding guide workflow from scratch (Phase 1) and verifies the existing sample code still builds (Phase 2). Tests share infrastructure via samples/SampleTestHelpers.psm1.

Running sample & guide tests locally

# Run all sample tests
.\scripts\test-samples.ps1

# Run a specific sample
.\scripts\test-samples.ps1 -Samples dotnet-app

# Run with a locally built winapp npm tarball (package-npm.ps1 outputs to .\artifacts\)
.\scripts\test-samples.ps1 -WinappPath .\artifacts -Verbose

# Or pass a specific .tgz / a directory containing one (e.g., a CI artifact download)
.\scripts\test-samples.ps1 -WinappPath .\artifacts\npm -Verbose

Writing a new sample & guide test

  1. Create test.Tests.ps1 in the sample directory (Pester naming convention)
  2. Use BeforeDiscovery for skip logic (prerequisite checks run at discovery time)
  3. Import shared helpers in BeforeAll: Import-Module "$PSScriptRoot\..\SampleTestHelpers.psm1" -Force
  4. Accept $WinappPath and $SkipCleanup parameters via param() block
  5. Phase 1 (Context): from-scratch guide workflow in a temp directory (scaffold, winapp init, build, cert, pack)
  6. Phase 2 (Context): quick build of existing sample code to verify freshness
  7. Add the sample name to the matrix in .github/workflows/test-samples.yml

Pester conventions for sample tests

  • BeforeDiscovery: Set $script:skip using inline Get-Command checks (no module import). Pester evaluates -Skip:$variable during discovery, before BeforeAll runs.
  • BeforeAll: Import SampleTestHelpers.psm1, install winapp, create temp directories. Guard with if ($script:skip) { return }.
  • AfterAll: Clean up temp directories using Remove-TempTestDirectory.
  • It blocks: Use -Skip:$script:skip for prerequisite gating. Use Pester Should assertions (Should -Be 0, Should -Exist, Should -Not -BeNullOrEmpty). When all setup happens in BeforeAll and depends on the prerequisite, you may apply -Skip:$script:skip to the enclosing Context instead.
  • Shared helpers: Invoke-WinappCommand (throws on failure), Test-Prerequisite (returns bool), New-TempTestDirectory, Remove-TempTestDirectory, Install-WinappGlobal.

CI integration

Build and Package builds both CLI architectures and all packages together with -SkipTests -SkipDocs. Keep full git history in build-artifacts so the build number is calculated correctly. It uploads packages, then starts the full test suite, documentation validation, UI E2E, and (on PRs) sample tests as independent jobs. The test suite uses -OnlyTests -UseExistingArtifacts; it must not republish or delete the downloaded CLI and NuGet packages. CI runs -TestSuite Cli -CliShard 1, -TestSuite Cli -CliShard 2, -TestSuite Auxiliary, and -TestSuite UIAutomation on separate runners, never concurrently in one workspace. Together they cover the default All suite. Auxiliary owns Node unit tests, analyzer tests/stand-down, and both Pester suites. Both CLI shards prepare the Node CLI needed by integration tests, but do not rerun Node unit tests.

scripts\test-cli-shard.ps1 partitions the CLI suite using a class predicate and its exact complement: package-command tests versus all remaining tests. New tests always enter one shard. Each invocation requires at least one executed test, accounts for every discovered case in TRX (including intentional skips), and checks its unique TRX/coverage outputs. Keep the combined test-results artifact and union source-line coverage across reports; do not average shard percentages or double-count shared source lines.

Sample & guide tests use the reusable .github/workflows/test-samples.yml matrix with npm-package and nuget-packages from the same run. Manual sample runs still build their own packages and support selecting one sample. Sample results are uploaded as JUnit XML via Pester's TestResult configuration.

Keep build-and-package and test-samples-result as top-level aggregate check names for branch protection. They must fail on failures, cancellations, and unexpected skips, not just test failures. Metrics join package artifacts with the validation job's TRX and coverage reports; never report zero tests just because the packages were uploaded first. Publish combined test results even when validation fails on main, but promote metrics to the main baseline only after successful validation. Each job owns a distinct artifact name and overwrites only that artifact on rerun; preserve other jobs' artifacts for partial reruns. Fork PR code runs only with the PR's token; the privileged comment workflow reads metrics as data, never executes it.

Where to look first

AreaKey files
CLI commandssrc/winapp-CLI/WinApp.Cli/Commands/*.cs
Servicessrc/winapp-CLI/WinApp.Cli/Services/*.cs
Node CLIsrc/winapp-npm/cli.js, winapp-cli-utils.js
Config examplewinapp.example.yaml
CLI schemadocs/cli-schema.json
Shipped agent skillsplugins/winapp/skills/
Plugin (Copilot + Claude)plugins/winapp/
Copilot-specific plugin componentsplugins/winapp/com.github.copilot/
Plugin marketplaces.github/plugin/marketplace.json, .claude-plugin/marketplace.json
Samplessamples/ (electron, cpp-app, dotnet-app, etc.)
ADO pipelines.pipelines/ — see .pipelines/README.md

Editing the ADO pipelines

Agent setup (.NET, Node, internal feeds and their auth) is shared via .pipelines/templates/build-env.yaml. Change it there, not in each pipeline.

1ES release jobs cannot check out the repo, so any step inside a templateContext.type: releaseJob job cannot call a .ps1 from the working tree. It can still share logic via a YAML - template: reference, because templates are expanded at compile time — that is how release.yml's Build-stage preflight and its Release_GitHub job share templates/release-assets.yaml. Prefer that over duplicating inline script between the two.

.pipelines/release.yml both ships releases (from rel/v*) and rehearses one weekly (from main). Every publishing action is gated on startsWith(variables['Build.SourceBranch'], 'refs/heads/rel/v') — derived from the branch, not a parameter, because Azure DevOps compiles scheduled and triggered runs with parameter defaults. If you add a publishing step, gate it the same way, and write the condition as a positive test for rel/v* so it fails closed.

CLI command semantics

Look at the docs\cli-schema.json for the full schema to know what the cli can do

Quick change checklist

  • Adding a new CLI command: Implement in C# under Commands/, register in HostBuilderExtensions.cs, inject into WinAppRootCommand, update src/winapp-npm/cli.js if needed.
  • Changing command descriptions: Edit the description string in the command's constructor.
  • Changing CLI commands/workflows: Update the relevant hand-written skill in plugins/winapp/skills/ if its workflow, examples, or troubleshooting changed.
  • After C# CLI changes: Run cd src/winapp-npm && npm run build to update npm package binaries.
  • Updating package versions: Edit winapp.example.yaml.

Integration points

  • NuGet: Packages downloaded to NuGet global cache. Local .winapp folder contains generated headers and libs only.
  • Build Tools: makeappx.exe, signtool.exe, makepri.exe, etc. Auto-downloaded by the tool command or when commands that need them are invoked.
  • CppWinRT: Generated headers in .winapp/generated/include. Response file at .cppwinrt.rsp.

Documentation and skill maintenance

docs/cli-schema.json is generated from the CLI by scripts/generate-llm-docs.ps1. Do not edit it directly; run scripts/build-cli.ps1 to regenerate it.

The files under plugins/winapp/skills/ are the hand-authored, shipped plugin skills shared by GitHub Copilot and Claude Code. Edit these files directly.

The single plugin under plugins/winapp/ conforms to the Agent Plugins 1.0 specification:

plugins/winapp/
├── plugin.json                 # portable Agent Plugins 1.0 manifest ($schema + metadata only)
├── skills/<skill>/SKILL.md     # portable Agent Skills (fixed location)
├── com.github.copilot/
│   └── agents/winapp.agent.md  # Copilot-specific component
└── .claude-plugin/plugin.json  # Claude Code manifest (Claude is not an Agent Plugins client)

plugin.json uses the closed Agent Plugins schema, so it must contain only $schema, name, version, description, author, homepage, repository, license, keywords, and extensions. Component paths are auto-discovered and must not be declared there — adding fields like agents or skills back to it breaks schema conformance. Claude Code has no com.github.copilot/ awareness, so .claude-plugin/plugin.json points its agents field at the same file rather than duplicating it.

Both hosts are listed through their marketplaces (.github/plugin/marketplace.json, .claude-plugin/marketplace.json). The repo-root plugin.json is deliberately kept in the legacy Copilot manifest format (no $schema) so that copilot plugin install microsoft/WinAppCli and the awesome-copilot listing keep resolving the repo as a plugin; adding $schema there would make its nested skills/agents paths unknown fields that clients must ignore. generate-llm-docs.ps1 keeps every manifest's version field in sync with the CLI version.

scripts/validate-plugin-package.ps1 enforces all of the above: the closed manifest schema, the plugin name constraints, SKILL.md presence and frontmatter for every immediate child of skills/, the Copilot agent's location, the Claude agents pointer resolving to a real file, and the repo-root shim staying legacy. It needs no build output, so run it directly while editing plugin files:

.\scripts\validate-plugin-package.ps1

validate-llm-docs.ps1 also invokes it, so CI fails on any conformance regression.

C# service architecture guidelines

File size limits

Line counts are signals to inspect cohesion, not extraction requirements. Around 500 lines is a useful prompt to check readability; around 800-1,000 lines deserves an explicit cohesion review. Never extract solely to hit a line target. Keep one cohesive implementation together when splitting it would create wrappers, indirection, or scattered state.

Service patterns

Use the appropriate pattern for new code:

PatternWhen to useExample
DI serviceStateful logic or logic with dependencies; a concrete class can be registered directlyPriService
InterfaceMultiple implementations, an established contract, or a necessary substitution/test boundaryIPriService
Static helperPure functions, no DI neededPeHelper, MrtAssetHelper
Data documentWraps a file/data format with typed accessAppxManifestDocument
Partial classSplitting a large service with tight internal couplingMsixService.Runtime.cs

Separation of concerns

  • Organize around cohesive responsibilities, not one-caller layers.
  • Prefer one cohesive implementation over several wrappers that only forward to one another.
  • Extract shared logic when it creates a real reusable boundary or prevents meaningful duplication.
  • Do not extract a method group merely because it uses only a few of a service's dependencies.

XML handling

  • Use XDocument / XElement (System.Xml.Linq) for structured XML manipulation — never regex
  • Regex is acceptable ONLY for: pre-parse placeholder replacement ($targetnametoken$), raw text scanning before XML is valid
  • Use AppxManifestDocument for AppxManifest.xml operations — it provides typed access and namespace-aware queries
  • When adding new manifest manipulation, add methods to AppxManifestDocument rather than writing regex in consuming code

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.