Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ void WorkflowTask(Execution::Context& context)

- Review `CONTRIBUTING.md` for workflow
- File/discuss issues before starting work
- Specs required for features (stored in `doc/specs/`)
- Specs required for features (stored in `doc/specs/`); see `.github/instructions/specs.instructions.md` for detailed guidance
- Follow existing code style (see `stylecop.json`)
- CI runs on Azure Pipelines (`azure-pipelines.yml`)

Expand Down
144 changes: 144 additions & 0 deletions .github/instructions/specs.instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
---
applyTo: "doc/specs/*"
---

# Writing WinGet Specifications

## Template

All specifications must follow the template at `doc/specs/spec-template.md`. Use the YAML front matter and all required sections. Do not omit sections β€” if a section is not applicable, include it with a brief explanation of why.

## File Naming

Specs are named `#<issue-id> - <Short Description>.md`. The issue ID must correspond to an existing GitHub issue in this repository.

Example: `#3483 - UserMessages.md`

## Front Matter

Every spec must include YAML front matter with:

```yaml
---
author: <name> <github-id>
created on: <yyyy-mm-dd>
last updated: <yyyy-mm-dd>
issue id: <github issue id>
---
```

If an AI agent (e.g., GitHub Copilot) assisted in authoring the spec, include it in the author field:

```yaml
---
author: <name> <github-id>, GitHub Copilot <Copilot>
created on: <yyyy-mm-dd>
last updated: <yyyy-mm-dd>
issue id: <github issue id>
---
```

Update `last updated` to the current date (format: `yyyy-mm-dd`) whenever the spec is modified. Do not append notes or descriptions β€” the value must be a plain date only.

## Required Sections

Follow the template structure in order:

1. **Title** β€” `# Spec Title` followed by a link to the issue: `For [#1234](https://github.com/microsoft/winget-cli/issues/1234)`
2. **Abstract** β€” Brief summary of what the spec proposes. 2-3 sentences.
3. **Inspiration** β€” Why this change is needed. Reference community feedback, issues, or limitations.
4. **Solution Design** β€” The detailed technical design. This is the largest section. Include:
- Schema changes (JSON schema snippets for manifest fields)
- Client behavior (CLI commands affected and how they behave)
- COM API surface changes (IDL definitions)
- PowerShell cmdlet changes (affected cmdlets, interactive vs. pipeline behavior, output objects)
- Settings changes (new or modified settings with JSON examples and interaction tables)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about group policies?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect most specs wouldn't have them.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a TODO with my robot

- Validation pipeline impact (winget-pkgs automated validation, non-interactive behavior)
- Manifest examples (YAML snippets showing real-world usage)
- Flow behavior matrix (table covering all commands, interactivity modes, and edge cases)
5. **UI/UX Design** β€” What the user sees. Include terminal output examples showing exact formatting.
6. **Capabilities** β€” Subsections for Accessibility, Security, Reliability, Compatibility, and Performance/Power/Efficiency.
7. **Potential Issues** β€” Known risks, trade-offs, and concerns.
8. **Deprecation Path** (when applicable) β€” If the spec replaces an existing field or feature, include a phased deprecation table.
9. **Future Considerations** β€” What this enables for later. Use this for ideas that are explicitly out of scope.
10. **Resources** β€” Links to related issues, documentation, schema files, and external references.

## Content Guidelines

### Areas of Impact

A complete specification should address all areas the feature touches. For WinGet, this typically includes:

- **CLI commands** β€” `install`, `upgrade`, `uninstall`, `show`, `validate`, `import`, `export`
- **COM API** β€” `Microsoft.Management.Deployment` interfaces and WinRT projections
- **PowerShell cmdlets** β€” `Install-WinGetPackage`, `Update-WinGetPackage`, `Uninstall-WinGetPackage`, `Repair-WinGetPackage`, `Find-WinGetPackage`, `Show-WinGetPackage`
- **Settings** β€” User settings in `settings.json` (see `doc/Settings.md`)
- **CLI arguments** β€” When adding a new setting, also consider a corresponding CLI argument (and vice versa). Settings define defaults; arguments provide per-invocation overrides.
- **Manifest schema** β€” JSON schema files in `schemas/JSON/manifests/`
- **Validation** β€” The winget-pkgs community repository validation pipeline
- **WinGet Configuration / DSC** β€” Declarative configuration flows
- **Group Policy** β€” Admin policy controls if applicable
Comment thread
denelon marked this conversation as resolved.

### Schema and Versioning

- Manifest schema changes require a new minor version (e.g., 1.28.0 β†’ 1.29.0).
- WinGet does not make breaking changes in 1.X releases. New fields must be additive and optional.
- Older clients silently ignore unknown fields. Do not rely on older clients reading new fields.
- The winget-pkgs community repository enforces schema version n or n-1 for new submissions. This is the practical mechanism that drives publisher adoption of new fields.

### Cross-Repository Impact

Schema changes in `winget-cli` have downstream impact across several repositories. A complete specification should address:

- **winget-cli** β€” Client implementation, schema files, settings, and CLI arguments.
- **winget-create** β€” The manifest creation tool must be updated to support new schema fields so publishers can author manifests with the new data.
- **winget-cli-restsource** β€” The REST source reference implementation must be updated to support new schema fields so enterprise REST sources can serve the new data. Enterprise scenarios do not carry the same deprecation concerns as the community repository since organizations control their own source update cadence.
Comment thread
denelon marked this conversation as resolved.
- **winget-pkgs** β€” The community repository's validation pipeline must be updated to accept (and validate) new fields. The n/n-1 schema version acceptance policy at winget-pkgs is the practical driver for publisher adoption and eventual deprecation of replaced fields.

When writing the spec, describe the end-to-end customer impact across these repositories so reviewers understand the full scope of work required.

### Interactivity

WinGet has multiple interactivity modes that specifications must account for:

- **Interactive** (default) β€” Prompts are shown and user input is accepted.
- **`--no-vt`** β€” I/O stream is available but VT (virtual terminal) escape sequences are not processed. This is a layer between fully interactive and non-interactive β€” specs should consider whether features need special handling when VT is unavailable.
- **`--disable-interactivity`** β€” No prompts; operations proceed automatically.
Comment thread
denelon marked this conversation as resolved.
- **`--silent`** β€” Implies non-interactive.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this one about the installer, not about winget?

- **COM API** β€” Never prompts; returns data for the consumer to handle.
- **PowerShell `-Force`** β€” Suppresses confirmation prompts.
- **WinGet Configuration** β€” Inherently non-interactive.

### GitHub Markdown Features

Use GitHub alert syntax for important callouts:

```markdown
> [!NOTE]
> Supplementary information.

> [!IMPORTANT]
> Critical information users need to know.

> [!WARNING]
> Potential risks or dangerous actions.
```

### Deprecation

When proposing a replacement for an existing field or feature:

- Define a phased deprecation path (Introduction β†’ Transition β†’ Deprecation β†’ Removal).
- Make timelines conditional on adoption telemetry, not fixed dates.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The timeline should also depend on the version of winget that ships out of the box with Windows.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call out. Another TODO

- Clearly state that WinGet 1.X will not make breaking changes.
- Explain that the community repository schema version policy (n/n-1) is the practical driver for adoption.

## Spelling

The repository uses `check-spelling`. If your spec introduces uncommon words (proper names, technical terms), add them to `.github/actions/spelling/expect.txt` in alphabetical order.

## Pull Request

- Spec PRs should be created as **draft** PRs.
- The PR body should include a "Related Issues" section with an unordered list of related issues (do not use "Closes" or "Fixes" β€” a spec does not close an issue).
- Specs require review and approval before implementation begins.