Code Helper Agent
Code Helper Agent is a VS Code extension that provides quick analysis and plain-language explanations for selected code.
Current Capability (v1)
- Analyze selected code from the active editor.
- Explain selected code with actionable guidance.
- Generate markdown reports in a side editor and preview pane.
- Offer in-product quick actions (switch report type, open settings, copy report).
- Flag common quality issues using lightweight heuristics:
TODO / FIXME markers
console.log usage
any type usage
- Lines exceeding a configured maximum length
Command
- Code Helper: Analyze Selected Code
- Command ID:
code-helper-agent.analyzeSelection
- Generates a metrics/findings report for selected code.
- Code Helper: Explain Selected Code
- Command ID:
code-helper-agent.explainSelection
- Generates a plain-language explanation and prioritized next steps.
Both commands are available from the Command Palette and editor context menu when text is selected.
Configuration
codeHelperAgent.maxLineLength (number, default 100)
- Controls when the long-line heuristic is reported.
codeHelperAgent.explanationStyle (concise | detailed, default concise)
- Controls explanation report detail level.
codeHelperAgent.rules.todoMarkers (boolean, default true)
codeHelperAgent.rules.consoleLog (boolean, default true)
codeHelperAgent.rules.anyType (boolean, default true)
codeHelperAgent.rules.longLine (boolean, default true)
- Enable/disable individual analysis heuristics.
codeHelperAgent.ai.enabled (boolean, default false)
codeHelperAgent.ai.model (string, default gpt-4.1-mini)
codeHelperAgent.ai.baseUrl (string, default https://api.openai.com/v1)
codeHelperAgent.ai.apiKey (string, default empty)
codeHelperAgent.ai.temperature (number, default 0.2)
- Enables AI-powered analysis/explanations with OpenAI-compatible APIs.
AI Setup (Recommended)
Set API key in your shell:
export OPENAI_API_KEY="your_api_key_here"
In VS Code settings, enable codeHelperAgent.ai.enabled.
Run Analyze/Explain commands on selected code. If AI fails, extension falls back to local heuristics automatically.
Project Structure
.
├── .github/
│ └── workflows/
│ └── ci.yml
├── .vscode/
│ ├── launch.json
│ └── tasks.json
├── assets/
│ └── icon.png
├── src/
│ ├── commands/
│ │ └── analyzeSelectionCommand.ts
│ │ └── explainSelectionCommand.ts
│ ├── config/
│ │ └── settings.ts
│ ├── constants/
│ │ └── commands.ts
│ ├── services/
│ │ └── aiAssistant.ts
│ │ └── selectionAnalyzer.ts
│ ├── types/
│ │ └── analysis.ts
│ ├── utils/
│ │ ├── explanationFormatter.ts
│ │ ├── logger.ts
│ │ ├── reportFormatter.ts
│ │ ├── reportView.ts
│ │ └── selectionContext.ts
│ └── extension.ts
├── test/
│ ├── e2e/
│ │ ├── runTest.js
│ │ └── suite/
│ │ ├── commands.e2e.js
│ │ └── index.js
│ ├── aiAssistant.test.ts
│ ├── explanationFormatter.test.ts
│ ├── reportFormatter.test.ts
│ └── selectionAnalyzer.test.ts
├── CHANGELOG.md
├── CONTRIBUTING.md
├── LICENSE
├── package.json
├── tsconfig.json
└── vitest.config.ts
Development
Install dependencies:
npm install
Start the bundler in watch mode:
npm run esbuild-watch
Press F5 in VS Code to launch an Extension Development Host.
Scripts
npm run esbuild - Build extension with source maps
npm run esbuild-watch - Rebuild on file changes
npm run vscode:prepublish - Build a minified production bundle
npm run lint - Lint source and tests
npm run compile - Type-check with TypeScript (--noEmit)
npm run test - Run unit tests (Vitest)
npm run test:coverage - Run tests with coverage reports
npm run test:e2e - Run extension host end-to-end tests
npm run check - Run lint, compile, and tests in sequence
npm run check:all - Run quality checks plus end-to-end tests
npm run package:extension - Build a .vsix package using vsce
npm run package:verify - Run checks, then package extension
CI
GitHub Actions runs quality checks on push and pull requests:
Release Validation
To validate a publishable build locally:
npm run package:verify
This produces a .vsix file in the project root that can be installed with:
code --install-extension <path-to-vsix>
v1 Release Checklist
Verify metadata in package.json (publisher, repository, homepage, bugs).
Run full quality suite:
npm run check:all
Build publishable package:
npm run package:verify
Push to GitHub and create tag v0.1.0.
Publish to VS Code Marketplace with vsce publish.
Contributing
See CONTRIBUTING.md for development and quality expectations.
Changelog
See CHANGELOG.md for release history.
License
MIT
| |