|
| 1 | +# Contributing |
| 2 | + |
| 3 | +Thanks for taking the time to contribute! |
| 4 | + |
| 5 | +This project follows an **issues-first** workflow: |
| 6 | + |
| 7 | +- Please **create an issue first** for any change. |
| 8 | +- Please **only work on existing issues** (including documentation changes). |
| 9 | +- Contributions must come from a **fork** and be submitted as a **pull request** (merge request). |
| 10 | + |
| 11 | +## Prerequisites |
| 12 | + |
| 13 | +- VS Code |
| 14 | +- Node.js `24` (matches CI in [build workflow](.github/workflows/build.yml)) |
| 15 | +- npm |
| 16 | +- Git |
| 17 | + |
| 18 | +## Development setup |
| 19 | + |
| 20 | +1. Fork the repository on GitHub. |
| 21 | +2. Clone your fork. |
| 22 | +3. Install dependencies: |
| 23 | + |
| 24 | + - `npm ci` |
| 25 | + |
| 26 | +4. Open the project in VS Code: |
| 27 | + |
| 28 | + - `code .` |
| 29 | + |
| 30 | +## Running the extension (local dev) |
| 31 | + |
| 32 | +This repository is set up for the standard VS Code extension development workflow. |
| 33 | + |
| 34 | +1. In VS Code, open the **Run and Debug** view. |
| 35 | +2. Select **Run Extension**. |
| 36 | +3. Press `F5`. |
| 37 | + |
| 38 | +This launches an **Extension Development Host** window. |
| 39 | + |
| 40 | +### Build/watch pipeline (what `F5` uses) |
| 41 | + |
| 42 | +The debug launch uses the default VS Code task `watch` (see [.vscode/tasks.json](.vscode/tasks.json)). It runs: |
| 43 | + |
| 44 | +- `npm run watch:esbuild` — bundles the extension entrypoint and the React webview bundle. |
| 45 | +- `npm run watch:tsc` — TypeScript type-check in watch mode (no emit). |
| 46 | + |
| 47 | +If you prefer the command line, you can run those scripts directly in separate terminals. |
| 48 | + |
| 49 | +## Tests |
| 50 | + |
| 51 | +- Run tests once: |
| 52 | + - `npm test` |
| 53 | + |
| 54 | +This compiles with `tsc` and runs extension tests via `@vscode/test-cli`/`@vscode/test-electron`. |
| 55 | + |
| 56 | +- Run tests with coverage: |
| 57 | + - `npm run test:coverage` |
| 58 | + |
| 59 | +This instruments the compiled output with `nyc`, runs the test runner, then produces reports. |
| 60 | + |
| 61 | +## Linting & type checking |
| 62 | + |
| 63 | +- Type-check: |
| 64 | + - `npm run check-types` |
| 65 | + |
| 66 | +- Lint: |
| 67 | + - `npm run lint` |
| 68 | + |
| 69 | +## Packaging (VSIX) |
| 70 | + |
| 71 | +- Create a VSIX locally: |
| 72 | + - `npm run package` |
| 73 | + |
| 74 | +This runs the production build and then packages via `vsce`. |
| 75 | + |
| 76 | +## Script reference |
| 77 | + |
| 78 | +These are the most useful scripts from [package.json](package.json): |
| 79 | + |
| 80 | +- `npm run compile` |
| 81 | + - Cleans `dist/`, builds Tailwind CSS, and bundles the extension + webview via `esbuild`. |
| 82 | + |
| 83 | +- `npm run build` |
| 84 | + - Production build: clean + Tailwind + typecheck + lint + minified bundle. |
| 85 | + |
| 86 | +- `npm run watch:esbuild` |
| 87 | + - Watch-mode bundling for the extension and webview. |
| 88 | + |
| 89 | +- `npm run watch:tsc` |
| 90 | + - Watch-mode typecheck (no output files are written). |
| 91 | + |
| 92 | +- `npm test` |
| 93 | + - Compiles with `tsc` and runs the VS Code integration test runner. |
| 94 | + |
| 95 | +- `npm run test:coverage` |
| 96 | + - Runs tests with `nyc` coverage. |
| 97 | + |
| 98 | +- `npm run lint` |
| 99 | + - Lints `src/` using ESLint. |
| 100 | + |
| 101 | +- `npm run check-types` |
| 102 | + - Runs `tsc --noEmit`. |
| 103 | + |
| 104 | +- `npm run tailwind` |
| 105 | + - Builds the webview CSS from [src/views/style/main.css](src/views/style/main.css) into `dist/style/main.css`. |
| 106 | + |
| 107 | +- `npm run clean` |
| 108 | + - Removes build/test artifacts (`dist`, `dist-cov`, `.nyc_output`). |
| 109 | + |
| 110 | +- `npm run changelog` |
| 111 | + - Regenerates [CHANGELOG.md](CHANGELOG.md) via `git-cliff`. |
| 112 | + |
| 113 | +## Workflow: issues first |
| 114 | + |
| 115 | +1. **Open an issue** |
| 116 | + - Bug: include repro steps, expected vs actual behavior, and logs if possible. |
| 117 | + - Feature: explain the problem, the proposed change, and any privacy implications. |
| 118 | + |
| 119 | +2. **Wait for confirmation** |
| 120 | + - A maintainer should confirm the issue is valid / wanted before you start work. |
| 121 | + |
| 122 | +3. **Implement the change in your fork** |
| 123 | + - Create a topic branch from your fork’s `main`. |
| 124 | + - Keep PRs focused to the issue. |
| 125 | + |
| 126 | +4. **Open a pull request (merge request)** |
| 127 | + - Reference the issue number (e.g. `Fixes #123`). |
| 128 | + - Describe what changed and how it was tested. |
| 129 | + |
| 130 | +## Coding guidelines |
| 131 | + |
| 132 | +- Keep changes scoped to the issue. |
| 133 | +- Avoid refactors in the same PR unless the issue explicitly calls for it. |
| 134 | +- Prefer maintaining existing style and patterns. |
| 135 | +- If you touch user-facing behavior, update docs if needed. |
| 136 | + |
| 137 | +## Reporting bugs / requesting features |
| 138 | + |
| 139 | +Please use the GitHub issue templates: |
| 140 | + |
| 141 | +- Bug reports: [.github/ISSUE_TEMPLATE/bug_report.md](.github/ISSUE_TEMPLATE/bug_report.md) |
| 142 | +- Feature requests: [.github/ISSUE_TEMPLATE/feature_request.md](.github/ISSUE_TEMPLATE/feature_request.md) |
0 commit comments