mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-13 00:01:03 +08:00
## Summary of the Pull Request Adds Copilot instructions and skills to the CmdPal extension template so that when developers create a new extension via "Create a new extension", the generated project includes AI-assisted development guidance out of the box. I verified the skills on my own extension: <img src="https://github.com/user-attachments/assets/24bddefd-f38a-4faa-aaf0-686bcb891241"> ## PR Checklist - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx ## Detailed Description of the Pull Request / Additional comments ### Problem When developers create a new Command Palette extension, the generated project contains only source code and build configuration — no AI-assisted development guidance. This means Copilot and other AI tools have no context about CmdPal extension APIs, patterns, or publishing workflows. ### Solution Added **2 instruction files** and **5 skills** (11 markdown files total) to the extension template at `src/modules/cmdpal/ExtensionTemplate/TemplateCmdPalExtension/.github/`: **Instructions:** | File | Purpose | |------|---------| | `copilot-instructions.md` | Top-level project overview: structure, conventions, build/deploy workflow, skill inventory | | `instructions/cmdpal-extension.instructions.md` | Comprehensive 353-line API reference covering extension architecture, all page types, content types, commands/results, items, icons, dynamic updates, and debugging | **Skills:** | Skill | Description | Why | |-------|-------------|-----| | `publish-extension` | Microsoft Store (MSIX) + WinGet (EXE) + GitHub Actions automation | Every extension eventually needs distribution | | `add-adaptive-card-form` | Adaptive Cards Designer workflow + template JSON patterns | Forms are the primary way to collect user input | | `add-extension-settings` | ToggleSetting / TextSetting / ChoiceSetSetting + persistence | 12 of 20 built-in extensions use settings | | `add-dock-band` | Single/multi-button bands, WrappedDockItem, live-updating | Enables persistent toolbar widgets | | `add-fallback-commands` | FallbackCommands() + DynamicListPage + CancellationToken | 14 of 20 built-in extensions use fallback commands | ### Code changes - **`ExtensionTemplateService.cs`** — Added `.md` to `_copyAsIsTemplateExtensions` so markdown files are properly handled during template extraction - **`template.zip`** — Regenerated to include the new `.github/` directory (19KB → 44KB) - **`.github/actions/spell-check/expect.txt`** — Added 17 Inno Setup constants/flags, placeholder identifiers, and technical tokens from the new skill files to the spell-check allowlist ### Content sources - Instructions derived from the **SamplePagesExtension** (all 20+ sample pages), the **CmdPal extension SDK** (IDL + toolkit base classes), and **official MS Learn documentation** - Publishing skill based on the [Publish Command Palette extensions](https://learn.microsoft.com/windows/powertoys/command-palette/publishing-your-extension) docs - Patterns verified against all 20 real CmdPal extensions in the repo ## Validation Steps Performed 1. ✅ All 7 `ExtensionTemplateServiceTests` pass: - `CreateExtension_BuildsExtensionFromTemplateArchive` - `CopyTemplateFile_RewritesTextFiles` - `CopyTemplateFile_CopiesUnchangedTextFilesVerbatim` - `CopyTemplateFile_CopiesBinaryFilesWithoutRewritingContents` - `TemplateFileHandling_ThrowsForUnknownExtension` - `TemplateExtensionCategories_AreDisjointAndCoverTemplateZip` — validates `.md` is in the extension lists - `TemplateZipFiles_AllUseKnownHandling` — validates all zip entries have known handling 2. ✅ Verified `template.zip` contains all 31 entries (20 original + 11 new `.md` files) 3. ✅ Verified directory structure is preserved correctly in the zip 4. ✅ Added 17 flagged tokens to `expect.txt` to resolve `check-spelling` CI failures — all are valid technical terms (Inno Setup constants/flags, domain names, Windows environment variables, code example placeholders) that appear inside code blocks in the skill documentation 5. ✅ `check-spelling` CI passes with 0 new misspelled words found on the latest commit --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: niels9001 <9866362+niels9001@users.noreply.github.com>