CodePath AI VSCode Extension
The CodePath AI VSCode Extension brings the power of AI-assisted coding directly into Visual Studio Code. Built with a dual-model architecture, it connects to the CodePath backend service to provide intelligent code explanations, generation, debugging, analysis, and refactoring capabilities.
Features
- Code Explanation: Select code and get detailed explanations of what it does
- Code Generation: Describe what you want to build and generate code automatically
- Debugging Assistance: Get help identifying and fixing code issues
- Code Analysis: Analyze code for security vulnerabilities, performance issues, and best practices
- Code Refactoring: Improve existing code structure and readability
- Context-Aware Processing: Leverages surrounding code context for better results
Architecture
The extension follows a dual-model architecture:
- Lightweight Frontend: The VSCode extension only sends structured data (selected code, file context, language, user action, metadata) to the backend
- Centralized Backend: The backend handles all heavy processing including:
- Authentication and authorization
- Model selection and routing
- Prompt construction and optimization
- Cost control and usage tracking
- Response formatting and caching
Installation
Prerequisites
- Visual Studio Code v1.74 or higher
- Access to a running CodePath backend service
Setup
Clone the CodePath repository:
git clone https://github.com/your-org/code-path-ai.git
cd code-path-ai/vscode-extension
Install dependencies:
npm install
Compile the extension:
npm run compile
Package the extension (optional):
npm install -g @vscode/vsce
vsce package
Configuration
The extension can be configured through VSCode settings:
codepath-ai.backendUrl: URL of the CodePath backend service (default: http://localhost:3001)
codepath-ai.apiKey: API key for authenticating with the backend
codepath-ai.userApiKey: Optional provider API key (fallback if Secret Storage isn't available)
codepath-ai.model: Selected AI model ID
codepath-ai.provider: Selected AI model provider
codepath-ai.modelListSource: Model list source (dynamic or static)
codepath-ai.userId: User ID for tracking usage (optional)
To configure these settings:
- Open VSCode Settings (
Ctrl+, or Cmd+,)
- Search for "CodePath AI"
- Enter your backend URL and API key
Alternatively, you can add these to your settings.json:
{
"codepath-ai.backendUrl": "https://your-codepath-backend.com",
"codepath-ai.apiKey": "your-api-key-here",
"codepath-ai.model": "gpt-4o",
"codepath-ai.provider": "openai",
"codepath-ai.userId": "optional-user-id"
}
Usage
Code Explanation
- Select the code you want to understand
- Right-click and choose "CodePath: Explain Selected Code" from the context menu
- Or use the command palette (
Ctrl+Shift+P or Cmd+Shift+P) and run "CodePath: Explain Selected Code"
Code Generation
- Use the command palette (
Ctrl+Shift+P or Cmd+Shift+P)
- Run "CodePath: Generate Code"
- Describe what code you want to generate in the input box
Debugging Assistance
- Select the problematic code (or leave unselected if you have an error message)
- Right-click and choose "CodePath: Debug Code" from the context menu
- Or use the command palette and run "CodePath: Debug Code"
- If no code is selected, you'll be prompted to describe the error
Code Analysis
- Select the code you want to analyze
- Right-click and choose "CodePath: Analyze Code" from the context menu
- Choose the type of analysis (security, performance, best practices, refactoring)
- Or use the command palette and run "CodePath: Analyze Code"
Code Refactoring
- Select the code you want to refactor
- Right-click and choose "CodePath: Refactor Code" from the context menu
- Or use the command palette and run "CodePath: Refactor Code"
Model Selection
- Open the command palette (
Ctrl+Shift+P or Cmd+Shift+P)
- Run "CodePath: Select Model"
- Choose a model from the list (the backend catalog is used when available)
Settings Model Dropdown
You can also pick a model/provider directly in Settings via dropdowns:
codepath-ai.model: choose a model ID (e.g., gpt-4o, claude-3.5-sonnet, mistral-large, gemini-1.5-pro)
codepath-ai.provider: choose a provider (e.g., openai, anthropic, mistral, google)
User API Key
- Open the command palette (
Ctrl+Shift+P or Cmd+Shift+P)
- Run "CodePath: Set User API Key"
- Paste your provider key (stored in VSCode Secret Storage)
API Keys
To use the extension, you need an API key from your CodePath backend. If you're running the backend locally, a default development key is created automatically. For production use, you should generate an API key through the backend's authentication system.
Development
To develop and test the extension:
- Open the
vscode-extension folder in VSCode
- Press
F5 to launch a new Extension Development Host window
- The extension will be loaded and ready for testing
Building for Production
npm run compile
Running Tests
npm test
Security
- API keys are stored securely and never exposed to client-side code
- All AI provider keys are kept server-side
- Requests are authenticated using API key-based authentication
- Sensitive code context is transmitted securely over HTTPS
Troubleshooting
- If you receive authentication errors, verify your API key is correct
- If requests are timing out, check that your backend URL is accessible
- For issues with specific AI features, check the backend logs for detailed error messages
Support
For support, please check the main CodePath repository or contact the development team.
Version: 0.0.1
Last Updated: February 3, 2026