This file provides instructions for AI coding assistants (GitHub Copilot, Claude, etc.) working on the Dev Proxy Toolkit VS Code extension.
src/
├── commands/ # Add new commands here (one file per feature group)
├── services/ # Business logic, API clients
├── data/ # Plugin metadata (plugins.json) - edit JSON, not code
├── utils/ # Pure helper functions + getDiagnosticCode, getSchemaUrl
├── test/ # Tests split by domain (*.test.ts)
├── constants.ts # All IDs, keys, URLs
└── *.ts # Core extension modules
-
Register the command ID in
src/constants.ts:export const Commands = { // ... existing MY_NEW_COMMAND: 'dev-proxy-toolkit.my-new-command', };
-
Add to package.json under
contributes.commands:{ "command": "dev-proxy-toolkit.my-new-command", "title": "My New Command", "category": "Dev Proxy Toolkit" } -
Create/update command file in
src/commands/:import { Commands } from '../constants'; export function registerMyCommands(context: vscode.ExtensionContext) { context.subscriptions.push( vscode.commands.registerCommand(Commands.MY_NEW_COMMAND, async () => { // implementation }) ); }
-
Register in
src/commands/index.tsif creating a new file. -
Add a test in appropriate test file or create new
*.test.ts.
No code changes needed! Edit src/data/plugins.json:
{
"plugins": {
"MyNewPlugin": {
"configRequired": true,
"configSection": "myNewPlugin",
"configSnippet": "devproxy-plugin-my-new-config"
}
},
"docs": {
"MyNewPlugin": "https://..."
}
}- Add diagnostic code to
DiagnosticCodesinsrc/constants.ts - Add diagnostic creation in
src/diagnostics.ts - Add code action (quick fix) in
src/code-actions.ts - Add test in
src/test/schema.test.tsorsrc/test/plugins.test.ts
- Use kebab-case for all files:
my-feature.ts,my-feature.test.ts - Test files:
{feature}.test.tsinsrc/test/
- Use barrel exports from
index.tsfiles:import { Commands, DiagnosticCodes } from '../constants'; import { getDiagnosticCode, getSchemaUrl } from '../utils';
- Use helpers from
src/test/helpers.ts:import { getFixturePath, getExtensionContext, createDevProxyInstall } from './helpers';
- Fixtures go in
src/test/examples/ - Each test file focuses on one domain
- Use
vscode.window.showErrorMessage()for user-facing errors - Log to output channel for debugging
When adding features, updating features, or fixing bugs:
- CHANGELOG.md: Add an entry under the current unreleased version section for user-facing changes only. Do not include internal changes such as test fixes, refactoring, dependency updates, or build/CI changes.
- New features →
### Added: - Updated features →
### Changed: - Bug fixes →
### Fixed: - Follow the formatting conventions already in the file
- New features →
- README.md: Update if adding user-facing features. Do not update for bugs or internal changes.
❌ Don't hardcode command IDs - use Commands.* from constants
❌ Don't inline plugin metadata - edit plugins.json instead
❌ Don't create monolithic files - split by feature/domain
❌ Don't skip tests - at minimum test command registration
❌ Don't use path.resolve(__dirname) in tests - use getFixturePath()
| File | Purpose |
|---|---|
src/extension.ts |
Entry point, activation |
src/constants.ts |
All command IDs, context keys, URLs |
src/data/plugins.json |
Plugin metadata (editable without code) |
src/services/api-client.ts |
All Dev Proxy HTTP API calls |
src/test/helpers.ts |
Test utilities, mock factories |
package.json |
Command/menu contributions |
npm run compile # Build extension
npm run compile-tests # Build tests (required after editing test files)
npm test # Run all tests
npm run lint # Check for issues
npm run fix # Auto-fix lint + formatNote: When editing test files, run
compile-testsbeforenpm test, or use thetasks: watch-testsVS Code task to auto-compile both extension and tests.
- json-to-ast: Parsing JSON for diagnostics (preserves locations)
- semver: Version comparison for upgrade checks
- sinon: Test mocking (devDependency)
The extension uses these VS Code concepts:
- Commands: User actions (start, stop, etc.)
- Diagnostics: Squiggly lines in editor for config issues
- CodeLens: Inline "View docs" links on plugins
- Code Actions: Quick fixes for diagnostics
- Task Provider: Run Dev Proxy as VS Code task
- Status Bar: Shows Dev Proxy state (running, version)
- MCP Server: Model Context Protocol integration
Check ARCHITECTURE.md for detailed design decisions and module responsibilities.