From 13af4a2485b4d7a62030586b83b148818ac1573d Mon Sep 17 00:00:00 2001 From: Mathias Elle Date: Wed, 12 Aug 2026 15:02:09 +0200 Subject: [PATCH 1/3] docs: add guidelines for writing effective commit messages --- .github/copilot-instructions.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .github/copilot-instructions.md diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 0000000..7b84a37 --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,15 @@ +# Copilot Instructions for mageforge-vscode + +## Commit Messages + +- Use Conventional Commits (e.g. `feat:`, `fix:`, `docs:`, `refactor:`, `test:`, `chore:`). +- Write end-user-friendly commit messages. +- Avoid overly technical or implementation-detail-heavy wording. +- Focus on describing what users gain from the change and the benefit it provides. + +## Examples + +- Instead of: `refactor: move theme provider to async/await` + Use: `refactor: load themes faster and more reliably in the background` +- Instead of: `fix: handle null in getThemePath` + Use: `fix: prevent crashes when no Magento theme is selected` From 0f3b311125f2fc608ee5e650a20ce762609276b8 Mon Sep 17 00:00:00 2001 From: Mathias Elle Date: Wed, 12 Aug 2026 15:05:57 +0200 Subject: [PATCH 2/3] docs: expand guidelines on code quality and testing practices --- .github/copilot-instructions.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 7b84a37..3b2302f 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -13,3 +13,19 @@ Use: `refactor: load themes faster and more reliably in the background` - Instead of: `fix: handle null in getThemePath` Use: `fix: prevent crashes when no Magento theme is selected` + +## Code Quality + +- Run the full verification command before committing: + `npm run format:check && npm run check-types && npm run lint && npm run test:unit:coverage && npm test` +- Prefer the VS Code task `watch` (`Tasks: Run Build Task`) during development. +- Never commit without running at least `npm run format:check && npm run test:unit`. + +## Testing + +- Add unit tests in `src/test/unit/` for pure business logic and helper functions. +- Use `src/test/unit/setup.ts` for vscode API mocks; reset shared mock state via `mochaHooks` if needed. +- Add VS Code integration tests in `src/test/extension.test.ts` for activation, commands, and views. +- Keep unit tests fast: mock `vscode` and MageForge CLI calls; avoid launching VS Code. +- Validate URLs passed to `vscode.env.openExternal` with `isAllowedExternalUrl()` and add corresponding tests. +- Run `npm run test:unit:coverage` before pushing to ensure coverage stays above 80%. From 14614918e4cfd549ae954da16c5c4aa822abbce5 Mon Sep 17 00:00:00 2001 From: Mathias Elle Date: Wed, 12 Aug 2026 15:13:06 +0200 Subject: [PATCH 3/3] ci: enhance pre-commit hook to include formatting and unit tests --- .husky/pre-commit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.husky/pre-commit b/.husky/pre-commit index 2312dc5..0dadfcb 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1 +1 @@ -npx lint-staged +npx lint-staged && npm run format:check && npm run test:unit