A VS Code extension that integrates GitHub issues with an AI-assisted code-fixer workflow. Automatically generate, preview, and apply code patches to fix GitHub issues with LLM assistance.
No manual configuration needed! The extension now automatically detects your repository from Git. Just open any GitHub repo in VS Code and start working with issues immediately.
Learn more about Auto-Detection →
- 🎯 Auto-Detect Repository: Automatically detects GitHub repo from your git remote
- 🐛 GitHub Issues Integration: View and manage open issues directly in VS Code sidebar
- 🤖 AI-Powered Code Fixes: Send issue context to an LLM and receive automated code patches
- 👀 Patch Preview: Review generated patches with syntax-highlighted diff view before applying
- 🔧 Smart Application: Apply patches as unstaged changes for manual review
- 🌿 Git Workflow: Automatically create branches, commit changes, and open PRs
- ✅ Test Integration: Detect and run tests to verify fixes
- 🔒 Privacy-First: Requires explicit user consent before sending code to external APIs
- 💾 Secure Storage: API keys stored in VS Code SecretStorage
- 📊 Status Bar: Shows current repository, click to change
- VS Code: Version 1.75.0 or higher
- Node.js: Version 18+ recommended
- Git: Installed and configured in your workspace
- GitHub Personal Access Token: For accessing GitHub API
- LLM API Key: OpenAI API key or compatible LLM service
- Clone this repository:
git clone <repository-url>
cd vscode-extension- Install dependencies:
npm install- Build the extension:
npm run build- Run in development mode:
code --extensionDevelopmentPath=$PWDOr press F5 in VS Code to launch Extension Development Host.
npm run package
code --install-extension issue-agent-0.1.0.vsix-
Open a GitHub repository:
git clone https://github.com/microsoft/vscode.git cd vscode code .
-
Press
F5to launch the Extension Development Host -
Configure your GitHub token (one-time setup):
- Press
Cmd+Shift+P(Mac) orCtrl+Shift+P(Windows/Linux) - Run:
Issue Agent: Configure GitHub Settings - Paste your GitHub token
- Repository auto-detected! ✨
- Press
-
Start working with issues:
- Click the GitHub icon in the Activity Bar
- Issues load automatically!
- Click any issue to open the AI composer
That's it! No manual repo configuration needed.
See detailed auto-detection docs →
If you're not in a git repository or want to use a different repo:
-
Generate a GitHub Personal Access Token:
- Go to GitHub Settings → Developer Settings → Personal Access Tokens
- Create a token with
reposcope - Copy the token
-
In VS Code, run the command:
Issue Agent: Configure GitHub Settings -
Enter your:
- GitHub token
- Choose "Enter manually" if not auto-detected
- Repository owner (e.g.,
microsoft) - Repository name (e.g.,
vscode)
-
Get an API key from your LLM provider (OpenAI, etc.)
-
Run the command:
Issue Agent: Configure LLM Settings -
Enter your:
- LLM API key
- API endpoint (default: OpenAI)
- Model name (default:
gpt-4)
-
View Issues: Open the "Issue Agent" sidebar to see open GitHub issues
-
Check Status Bar: See current repo in status bar (bottom-left)
-
Open Issue Composer: Click on any issue to open the composer
-
Select Files: Choose relevant files to provide as context
-
Add Context: Provide additional instructions or constraints
-
Consent: Check the consent box to allow sending code to LLM
-
Run Agent: Click "Run Agent" to generate a patch
-
Review & Apply: Preview the patch and apply it to your workspace
-
Create PR: Optionally create a branch and pull request
1. Select Issue #123 from sidebar
2. Composer opens showing issue details
3. Select relevant files (auto-suggested based on issue)
4. Add context: "Maintain backward compatibility"
5. Check consent and click "Run Agent"
6. LLM generates a patch
7. Review the diff preview
8. Click "Apply Patch" → Changes appear as unstaged
9. Click "Run Tests" → Verify the fix works
10. Click "Create Branch" → Creates `issue-123-fix` branch
11. Click "Create PR" → Opens draft PR on GitHub
Configure via VS Code settings (Cmd/Ctrl + ,):
{
"issue-agent.repo.owner": "your-org",
"issue-agent.repo.name": "your-repo",
"issue-agent.test.command": "npm test",
"issue-agent.llm.endpoint": "https://api.openai.com/v1/chat/completions",
"issue-agent.llm.model": "gpt-4"
}API keys are stored securely in VS Code SecretStorage:
github-token: GitHub Personal Access Tokenllm-api-key: LLM API key
npm run build# Unit tests
npm test
# Integration tests
npm run test:integrationnpm run watchnpm run packageThe extension includes comprehensive tests:
- PromptBuilder: Tests prompt generation with correct format, metadata, and size limits
- PatchApplier: Tests patch validation and application to files
Run unit tests:
npm testFull workflow test including:
- Git repository initialization
- File creation and modification
- Patch application
- Branch creation and commits
- Prompt building
Run integration tests:
npm run test:integrationsrc/
├── extension.ts # Extension activation and configuration
├── issueProvider.ts # GitHub issues tree view provider
├── agentRunner.ts # Orchestrates LLM workflow and webview
├── promptBuilder.ts # Builds structured prompts for LLM
├── patchApplier.ts # Applies unified diff patches
├── gitUtils.ts # Git operations wrapper
└── test/
├── promptBuilder.test.ts
├── patchApplier.test.ts
├── integration.test.js
└── fixtures/
└── llm_response_example.txt
webview/
└── composer.html # Issue composer UI
The extension sends structured prompts to the LLM:
--METADATA-BEGIN--
repo: owner/repo
issue: #123
files: src/file1.ts, src/file2.ts
test-command: npm test
--METADATA-END--
--INPUT-BEGIN--
# Issue #123: Fix bug in greet function
Author: @username
## Description
[Issue body]
## Additional Context from User
[User-provided context]
## Repository Files
### File: src/hello.ts
[File contents]
--INPUT-END--
--INSTRUCTIONS-BEGIN--
1) Analyze the issue and the provided code.
2) Generate a fix as a unified diff patch.
3) Put the patch between --PATCH-BEGIN-- and --PATCH-END-- markers.
...
--INSTRUCTIONS-END--
--PATCH-BEGIN--
*** Begin Patch
*** Update File: src/hello.ts
@@
-export function greet() {
- return "hello";
-}
+export function greet(name: string = "world") {
+ return `hello ${name}`;
+}
*** End Patch
--PATCH-END--
--PR-BODY-BEGIN--
Title: Fix greeting to accept a name
Body:
This change updates greet() to accept an optional name parameter.
Fixes #123
--PR-BODY-END--
- ❌ Never auto-uploads code - Requires explicit user consent
- ✅ Consent checkbox - Must be checked before each LLM call
- 🔒 Secure storage - API keys stored in VS Code SecretStorage
- 👁️ Transparency - Clear warnings before external API calls
- Review patches before applying
- Run tests after applying patches
- Only send necessary files to LLM
- Use draft PRs for review before merging
- Never commit API keys to version control
- Verify GitHub token has
reposcope - Check repository owner/name are correct
- Ensure you have internet connection
- The LLM response may not match the expected format
- Try running the agent again with more specific context
- Manually review and apply the patch from the preview
- Check that test command is configured correctly
- Ensure dependencies are installed (
npm install) - Verify workspace has a package.json with test script
- Verify API key is configured correctly
- Check API endpoint is accessible
- Review VS Code Developer Console for errors
Contributions are welcome! Please follow these guidelines:
- Fork the repository
- Create a feature branch
- Make your changes with tests
- Run
npm testandnpm run test:integration - Submit a pull request
MIT
Built with:
- Octokit - GitHub REST API client
- diff - JavaScript diff implementation
- VS Code Extension API
- GitHub issues sidebar view
- Issue composer with file selection
- LLM integration for patch generation
- Patch preview and application
- Git workflow automation
- Test runner integration
- PR creation support