Files
PowerToys/.github/copilot-instructions.md
Gordon Lam cb79a00aeb Add the first copilot-instructions.md (#41518)
This pull request introduces concise, area-specific contributor guides
for the PowerToys repository. Each major code area now has its own
instructions file, clarifying scope, coding guidelines, and acceptance
criteria. This helps ensure consistency, reduces onboarding friction,
and sets clear expectations for contributors.
Reference doc:
https://docs.github.com/en/copilot/how-tos/configure-custom-instructions/add-repository-instructions

New contributor guides added:

**General/Top-level guidance**
- Added `.github/copilot-instructions.md` as a concise, top-level guide
for AI-driven changes, including a repo map, build/test workflow, PR
expectations, and quick reference checklists.

**Area-specific instructions**
- Added `src/common/common.instructions.md` for shared libraries,
covering ABI stability, logging, performance, and dependency policies.
- Added `src/runner/runner.instructions.md` for the Runner/tray host,
detailing module management, IPC contract alignment, startup
performance, and elevation/update logic.
- Added `src/settings-ui/settings-ui.instructions.md` for the Settings
UI, with guidance on schema changes, IPC contract sync, UI
responsiveness, and style reuse.
2025-09-09 16:48:43 +08:00

2.6 KiB
Raw Blame History

PowerToys Copilot guide (concise)

This is the top-level guide for AI changes. Keep edits small, follow existing patterns, and cite exact paths in PRs.

Repo map (1line per area)

  • Core apps: src/runner/** (tray/loader), src/settings-ui/** (Settings app)
  • Shared libs: src/common/**
  • Modules: src/modules/* (one per utility; Command Palette in src/modules/cmdpal/**)
  • Build tools/docs: tools/**, doc/devdocs/**

Build and test (defaults)

  • Prerequisites: Visual Studio 2022 17.4+, minimal Windows 10 1803+.
  • Build discipline:
    • One terminal per operation (build → test). Dont switch/open new ones mid-flow.
    • After making changes, cd to the project folder that changed (.csproj/.vcxproj).
    • Use script(s) to build, synchronously block and wait in foreground for it to finish: tools/build/build.ps1|.cmd (current folder), build-essentials.* (once per brand new build for missing nuget packages)
    • Treat build exit code 0 as success; any non-zero exit code is a failure, have Copilot read the errors log in the build folder (e.g., build.*.*.errors.log) and surface problems.
    • Dont start tests or launch Runner until the previous step succeeded.
  • Tests (fast + targeted):
    • Find the test project by product code prefix (e.g., FancyZones, AdvancedPaste). Look for a sibling folder or 12 levels up named like <Product>*UnitTests or <Product>*UITests.
    • Build the test project, wait for exit, then run only those tests via VS Test Explorer or vstest.console.exe with filters. Avoid dotnet test in this repo.
    • Add/adjust tests when changing behavior; if skipped, state why (e.g., comment-only, string rename).

Pull requests (expectations)

  • Atomic: one logical change; no driveby refactors.
  • Describe: problem / approach / risk / test evidence.
  • List: touched paths if not obvious.

When to ask for clarification

  • Ambiguous spec after scanning relevant docs (see below).
  • Cross-module impact (shared enum/struct) not clear.
  • Security / elevation / installer changes.

Logging (use existing stacks)

  • C++: src/common/logger/** (Logger::info|warn|error|debug). Keep hot paths quiet (hooks, tight loops).
  • C#: ManagedCommon.Logger (LogInfo|LogWarning|LogError|LogDebug|LogTrace). Some UIs use injected ILogger via LoggerInstance.Logger.

Docs to consult

  • tools/build/BUILD-GUIDELINES.md
  • doc/devdocs/core/architecture.md, doc/devdocs/core/runner.md, doc/devdocs/core/settings/readme.md, doc/devdocs/modules/readme.md

Done checklist (self review before finishing)

  • Build clean? Tests updated/passed? No unintended formatting? Any new dependency? Documented skips?