Skip to content

Commit 2042d4e

Browse files
Add Copilot instructions, skills, and simplify developer docs
- Rewrite .github/copilot-instructions.md with build commands, architecture overview, PSES/cross-repo context, and key conventions - Add .github/skills/release/SKILL.md for on-demand release guidance - Add .github/skills/update-npm-packages/SKILL.md for on-demand NPM update guidance - Simplify docs/development.md: tighten prose, fix ADO push target (HEAD:upstream), add version prefix rules (v in tags/changelog, not in package.json) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 01e8ef8 commit 2042d4e

File tree

4 files changed

+179
-141
lines changed

4 files changed

+179
-141
lines changed

.github/copilot-instructions.md

Lines changed: 55 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,57 @@
11
# Copilot Instructions for vscode-powershell
22

3-
## Updating NPM Packages
4-
5-
- Read [docs/development.md](../docs/development.md) "Tracking Upstream Dependencies" first
6-
- Dependencies are split: `dependencies` + `devDependencies` for build, `optionalDependencies` for lint/test
7-
- Remember to use `npm install --include=optional` since we also need to update lint and test dependencies
8-
- The `.npmrc` uses an Azure Artifacts mirror; read its comments for authentication instructions
9-
- After updating, verify: `npm run compile` (build), `npm run lint` (lint), `npm audit` (security)
10-
- The ESLint packages (`eslint`, `@eslint/js`, `typescript-eslint`, `eslint-config-prettier`) should be updated together
11-
- Fix any new lint warnings from updates to ESLint
12-
- Use `npm audit` to identify vulnerabilities
13-
- Do not use `npm audit fix --force` when a vulnerability is in a transitive dependency, instead add an `overrides` entry
3+
This is the VS Code extension for PowerShell — an LSP client that communicates with
4+
[PowerShellEditorServices][] (PSES), the LSP server. The extension manages the PSES process
5+
lifecycle, provides UI features, and handles debugging.
6+
7+
[PowerShellEditorServices]: https://github.com/PowerShell/PowerShellEditorServices
8+
9+
## Build, Lint, and Test
10+
11+
```sh
12+
npm install --include=optional # Install all deps (lint/test tools are in optionalDependencies)
13+
npm run compile # Build with esbuild (outputs to dist/)
14+
npm run lint # ESLint (strict TypeScript-aware rules)
15+
npm run format # Prettier check (with organize-imports plugin)
16+
npm test # Integration tests via @vscode/test-cli
17+
```
18+
19+
After any code change, always run `npm run compile`, `npm run lint`, and `npm run format`. Tests run inside a VS Code Insiders instance — there is no way to run a
20+
single test from the command line. Tests live in `test/` mirroring `src/` structure and use
21+
Mocha BDD (`describe`/`it`).
22+
23+
## Architecture
24+
25+
`activate()` in `src/extension.ts` creates the `Logger`, `SessionManager`, and two groups of
26+
features:
27+
28+
1. **Standalone features** — commands that don't need the LSP client (e.g. `PesterTestsFeature`)
29+
2. **LanguageClientConsumers** — features extending `LanguageClientConsumer` that depend on the
30+
LSP client and override `onLanguageClientSet()` to register their handlers
31+
32+
`SessionManager` (`src/session.ts`) owns the full lifecycle: finding a PowerShell executable
33+
(`src/platform.ts`), spawning PSES (`src/process.ts`), connecting the `LanguageClient`, and
34+
restarting on critical setting changes.
35+
36+
Each feature in `src/features/` exports one `vscode.Disposable` class. Custom LSP message
37+
types are defined as `RequestType`/`NotificationType` constants in the same file.
38+
`IPowerShellExtensionClient` in `src/features/ExternalApi.ts` is the public API for other
39+
extensions.
40+
41+
### PSES and Cross-Repo Work
42+
43+
The `modules/` folder contains the PSES, PSReadLine, and PSScriptAnalyzer PowerShell modules. In development it is a
44+
symlink to `../PowerShellEditorServices/module`[PowerShellEditorServices][] must be
45+
cloned as a sibling and built before `npm run compile` will succeed. For cross-repo work, use `pwsh-extension-dev.code-workspace`.
46+
47+
## Key Conventions
48+
49+
- **VS Code best practices**: Follow the [Extension Guidelines](https://code.visualstudio.com/api/references/extension-guidelines) and [UX Guidelines](https://code.visualstudio.com/api/ux-guidelines/overview). Use VS Code's APIs idiomatically and prefer disposable patterns for lifecycle management.
50+
- **Logging**: Use `ILogger` (not `console.log`). Tests use `TestLogger` from `test/utils.ts`.
51+
- **Settings**: Defined in `package.json` under `contributes.configuration`, read via
52+
`vscode.workspace.getConfiguration("powershell")` at point of use. Helpers in `src/settings.ts`.
53+
- **TypeScript**: Strict mode, ESNext, `verbatimModuleSyntax`. `explicit-function-return-type`
54+
enforced. Unused vars prefixed `_`. Formatting via Prettier with the `organize-imports`
55+
plugin. Use `import x = require("x")` for Node/VS Code built-ins.
56+
- **File headers**: Every source file starts with `// Copyright (c) Microsoft Corporation.`
57+
and `// Licensed under the MIT License.`

.github/skills/release/SKILL.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
name: release
3+
description: >
4+
Guide for preparing a release of the PowerShell VS Code extension. Use when
5+
asked to prepare a release, update the version, or create a release PR.
6+
---
7+
8+
# Release Process
9+
10+
Read [docs/development.md](../../../docs/development.md) "Creating a Release" and "Versioning" sections first.
11+
12+
## Agent-Actionable Steps (1–2)
13+
14+
1. Use `./tools/updateVersion.ps1 -Version "<version>" -Changes "<summary>"` in both repos
15+
(PSES first, then vscode-powershell). The script validates even/odd rules, updates
16+
`package.json` version, prepends a changelog entry (auto-including the PSES version from
17+
`../PowerShellEditorServices`), and creates a commit.
18+
2. Push to an ephemeral `release` branch and open a PR to `main` on GitHub.
19+
20+
## Manual Steps (3–4)
21+
22+
These require Azure DevOps access and cannot be performed by an agent:
23+
24+
3. After merge, push `main` to the Azure DevOps remote (`ado HEAD:upstream`) to trigger signing pipelines.
25+
4. Download and test assets from draft GitHub Releases, then publish.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
name: update-npm-packages
3+
description: >
4+
Guide for updating NPM dependencies in vscode-powershell. Use when asked to
5+
update packages, fix vulnerabilities, or bump dependency versions.
6+
---
7+
8+
# Updating NPM Packages
9+
10+
Read [docs/development.md](../../../docs/development.md) "Tracking Upstream Dependencies"
11+
section for full context.
12+
13+
## Rules
14+
15+
- Dependencies are split into three groups:
16+
- `dependencies` — runtime packages bundled into the extension
17+
- `devDependencies` — build tools only (minimum for Azure DevOps pipeline)
18+
- `optionalDependencies` — lint, type-checking, and test tools (for development and GitHub Actions)
19+
- Always use `npm install --include=optional` to get all three groups.
20+
- The `.npmrc` uses an Azure Artifacts mirror; read its comments for authentication instructions.
21+
- When updating `engines.vscode` follow the "Tracking Upstream Dependencies" section of `docs/development.md`.
22+
- Update the ESLint packages (`eslint`, `@eslint/js`, `typescript-eslint`,
23+
`eslint-config-prettier`) together and fix any new lint warnings.
24+
- After updating, verify: `npm run compile`, `npm run lint`, `npm audit`.
25+
- For vulnerabilities in transitive dependencies identified by `npm audit`, add an `overrides` entry in `package.json`
26+
rather than using `npm audit fix --force` which may downgrade our packages.
27+
- Check that each `overrides` entry is still necessary.

0 commit comments

Comments
 (0)