chore(copilot): update instruction files for copilot#7971
Conversation
There was a problem hiding this comment.
Pull request overview
This PR splits Copilot guidance into separate instruction files for VS Code coding assistance vs. GitHub Copilot review, while keeping a smaller shared set of repo conventions.
Changes:
- Adds a VS Code-specific Copilot instruction file and wires it up via workspace settings.
- Introduces a dedicated GitHub Copilot code review instruction file.
- Refactors the existing shared Copilot instructions into a shorter, surface-agnostic document.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
.vscode/settings.json |
Configures VS Code Copilot Chat code generation to load instructions from .vscode/copilot.md. |
.vscode/copilot.md |
Adds VS Code-focused coding workflow/testing/preferences guidance (intended to be lighter-weight). |
.github/copilot-review-instructions.md |
Adds GitHub Copilot review-only checks (breaking changes, skills sync, commit type mismatch, etc.). |
.github/copilot-instructions.md |
Replaces the prior long-form agent instructions with a condensed shared set of repo/environment/convention notes and references. |
Comments suppressed due to low confidence (4)
.vscode/copilot.md:8
- suggestion: align the setup command here with the repo’s stated required environment (shared instructions recommend updating npm to 11.11.1 before running
npm run setup) to avoid toolchain mismatches.
1. Setup: `nvm use && npm run setup`
2. Edit `src/`. API/props/behaviour/docs change → `npm run build:skills` + commit result
.github/copilot-instructions.md:40
- issue: the documented
npm run buildpipeline order is inaccurate (perpackage.json, the sequence isclean-lib → generate-tokens → type-check → rollup → build:generate-package-json-files → build:move-svg → build:types). Please correct this so contributors follow the real build chain.
| PW CT | `npm run test:ct` (`*.pw.tsx`) |
| Build | `npm run build` (clean→tokens→types→rollup→pkg-jsons→svg→d.ts) |
| Skills | `npm run build:skills -- --check` |
.vscode/copilot.md:10
- issue: this suggests tests live in
<name>.test.tsx, but Jest matches both*.spec.*and*.test.*(seejest.config.ts). Document both patterns to avoid contributors creating tests that don’t run.
3. Tests: `<name>.test.tsx` (jsdom, 100% coverage new code). Browser behaviour → `<name>.pw.tsx`
4. Validate (in order): `npm run format` → `npm run lint` → `npm run type-check` → `npm test -- <spec>` → `npm test` → `npm run build:skills -- --check` → `npm run build` (if needed) → `npm run test:ct -- <pw>` (if needed)
.vscode/copilot.md:16
- issue: the example command
npm test -- path/to/file.test.tsxis too specific; the repo also uses*.spec.*tests. Consider using a neutral placeholder (e.g.path/to/file.(spec|test).tsx) so the guidance matches the configuredtestMatch.
- Fast loop: `npm test -- path/to/file.test.tsx`
- Full: `npm test`
|
|
||
| ### 1. Undeclared breaking changes | ||
|
|
||
| Block if PR lacks `!` or `BREAKING CHANGE:` footer AND does any of: |
There was a problem hiding this comment.
suggestion: I think we should tweak this a little bit, the removal of a storybook story shouldn't be considered a breaking change, also removing data- tags or class names is not breaking if they're not exported to consumers.
It may also be worth clarifying that changes to an index.ts is only breaking when it does not sit within an /__internal__/ file path
There was a problem hiding this comment.
Made changes as requested
f8cfb19 to
2d94d62
Compare
split out the copilot files so that we have instructions for vscode and seperate instructions for github copilot
2d94d62 to
c82bda0
Compare
|
|
||
| Run these locally before pushing — CI runs the exact same commands and a PR will fail if any of them fail: | ||
| - "Cannot find module .../static-tokens" → run `generate-tokens:dev` | ||
| - `nwsapi` SyntaxError → `:has()` in styled-components + jsdom. Avoid or use role queries |
There was a problem hiding this comment.
comment: support for :has() was added in nwsapi 2.3.0 and it looks liek we use 2.3.9
| - Add unused `eslint-disable` | ||
| - Raise `--max-warnings` ceiling | ||
| - Use `:has()` in styles tested by jsdom | ||
| - Broad snapshot tests |
There was a problem hiding this comment.
question: will this flag the ones we've used in the tokens (old and new) tests? I agree with this beyond them just not sure if they'll be flagged etc
|
|
||
| ### 3. Commit type mismatch | ||
|
|
||
| `chore:`/`docs:`/`style:`/`refactor:`/`test:`/`build:`/`ci:` = no version bump. Flag user-visible behaviour/API/runtime-dep changes in these → needs `feat:`/`fix:` (+ `!` if breaking). |
There was a problem hiding this comment.
comment: we don't support using ! as a breaking change marker
| ## Preferences | ||
|
|
||
| - Minimal focused edits, not broad rewrites | ||
| - RTL: `getByRole`/`getByLabelText` over `getByTestId` |
There was a problem hiding this comment.
question: will this flag findByTestId as well or do we need to explicitly define that?
Proposed behaviour
Split out the copilot files so that we have instructions for vscode and separate instructions for github copilot
Current behaviour
Currently the instructions are being loaded into context for copilot in vscode and this means there's a lot of information in there that isn't required for it as much of it was for github copilot only. We can separate out the concerns to reduce the context payload and therefore reduce the amount of tokens we use
Checklist
d.tsfile added or updated if requiredQA
Additional context
Testing instructions