AI Code Bridge - VSCode Extension
A VSCode extension that helps you work with AI assistants like Claude and ChatGPT. Export your code, get AI suggestions, and import changes safely with visual preview.
🎯 What Does It Do?
Export → Send code to AI → Get improvements back → Import with preview → Accept/Reject changes
📦 Installation
- Download the
.vsix file
- In VSCode:
Ctrl+Shift+P → "Extensions: Install from VSIX"
- Select the file and reload VSCode
🚀 How to Use
Step 1: Export Your Code
Right-click any file/folder → Choose export option:
Option A: "Export to AI Snapshot" (Full Export)
- Exports file contents with a prompt template
- Select a prompt or choose "Without Prompt" for snapshot only
- A
.md file is created in .agent/ folder
- Content is automatically copied to clipboard
Option B: "Export Structure Only" (New!)
- Exports only folder/file tree structure (no file contents)
- Perfect for large projects - let AI decide which files it needs
- AI returns a JSON array of file paths it wants to see
- Use the Export Tab to get contents of those specific files
Step 2: Send to AI
Paste the content into:
- Claude (claude.ai)
- ChatGPT (chat.openai.com)
- Any AI assistant
Tell the AI what you want:
- "Refactor this code"
- "Add error handling"
- "Fix security issues"
- "Add documentation"
Step 3: Import AI Changes
Click the AI Code Bridge icon in the left sidebar
Import Tab:
- Paste the AI's JSON response
- Click "Import from Text"
- Preview each change side-by-side
- Click Accept ✓ or Reject ✗ for each file
- Use Stage Block to git stage approved changes
Export Tab (New!):
- Paste the AI's JSON array of file paths (from Structure Export)
- Select a prompt or choose "Without Prompt"
- Click "Export File Contents"
- Get a snapshot with only the requested files
- Content is automatically copied to clipboard
Buttons available:
- Previous/Next Change (navigate)
- Stage Block (stage in git)
- Accept Change (apply this file)
- Reject Change (skip this file)
- Accept All (apply all changes)
- Reject All (cancel everything)
Step 4: Manage Prompts
Prompts Tab:
- View all prompt templates
- Create new prompts for your needs
- Edit existing ones
- Delete unused prompts
🔄 New Workflow: Structure-First Export
For large projects, use this efficient workflow:
1. Right-click on project folder → "Export Structure Only"
2. Select a prompt describing your task (or "Without Prompt")
3. Paste structure in AI assistant
4. AI analyzes structure and returns: ["src/app.js", "src/utils/helper.ts"]
5. Open AI Code Bridge sidebar → Export tab
6. Paste the JSON array of file paths
7. Select a prompt (or "Without Prompt")
8. Click "Export File Contents"
9. Content is copied - paste back to AI
10. AI now has only the files it needs!
Benefits:
- ✅ Don't overwhelm AI with unnecessary files
- ✅ AI chooses what it needs to see
- ✅ Faster and more focused responses
- ✅ Works great for large codebases
For Code Changes (Import)
Your AI must return JSON in this format:
[
{
"type": "file",
"path": "src/app.js",
"lang": "javascript",
"content": "console.log('new code');"
}
]
For File Requests (Export Tab)
When using Structure Export, AI returns file paths:
["src/app.js", "src/utils/helper.ts", "package.json"]
Important: Each file should be on one line in the JSON array to keep files compact.
🎨 Built-in Prompt Templates
- default - General code improvements
- refactor - Clean code, SOLID principles
- feature - Add new functionality
- bugfix - Fix bugs with minimal changes
- documentation - Add comments and docs
- security - Security audit and fixes
⚙️ Settings
Ctrl+, → Search "AI Code Bridge":
agentDirectory: Where snapshots are saved (default: .agent)
excludeFolders: Folders to skip (node_modules, .git, etc.)
excludeFileExtensions: File types to skip (.zip, .mp4, etc.)
injectOutputFormat: Auto-add JSON format instructions to prompts
outputFormatTemplate: Custom output format template for AI responses
💡 Quick Tips
Export:
- Select multiple files with
Ctrl+Click
- Use "Export Structure Only" for large projects
- Use "Without Prompt" when you just need a snapshot
- Export only relevant files, not entire project
- Snapshots include: prompt name, date, hour, and minute
Import:
- Always preview before accepting
- Changes are copied to clipboard automatically
- Test after importing
- Commit to git before importing large changes
Export Tab:
- Supports JSON with or without markdown code blocks
- Validates file paths before exporting
- Shows warnings for invalid paths
Prompts:
- Create custom prompts for your project
- Include your coding standards
- Reuse across all projects
🔒 Safety
✅ Preview every change before applying
✅ Accept/reject individually
✅ Side-by-side diff view
✅ Stage changes in git directly
✅ No automatic changes
🐛 Troubleshooting
JSON Import Fails:
- Make sure AI returned only JSON array
- Check JSON syntax at jsonlint.com
- Remove any text before
[ or after ]
Export Tab - Invalid Paths:
- Check file paths are relative to project root
- Use forward slashes in paths
- Make sure files exist in your project
Sidebar Not Showing:
- Click the AI Code Bridge icon in activity bar (left side)
- Reload VSCode:
Ctrl+Shift+P → "Reload Window"
Stage Block Not Working:
- Ensure git extension is active
- Check if you're in a git repository
📊 System Requirements
- VSCode 1.80.0 or higher
- Works with any programming language
- Windows, macOS, Linux
🎓 Example Workflows
Standard Workflow
1. Right-click on src/ folder → Export to AI Snapshot
2. Select a prompt (or "Without Prompt")
3. Content is copied to clipboard automatically
4. Paste in Claude/ChatGPT
5. Ask: "Add error handling to all functions"
6. Copy AI's JSON response
7. Open AI Code Bridge sidebar → Import tab
8. Paste JSON → Click "Import from Text"
9. Preview each change
10. Click "Accept" or "Stage Block" for good changes
11. Click "Reject" for unwanted changes
12. Done!
Structure-First Workflow (Large Projects)
1. Right-click on project → "Export Structure Only"
2. Select prompt describing your task
3. Paste in AI assistant
4. AI returns: ["path/to/file1.js", "path/to/file2.ts"]
5. Open sidebar → Export tab
6. Paste the JSON array
7. Select a prompt (or "Without Prompt")
8. Click "Export File Contents"
9. Paste the new snapshot back to AI
10. AI provides focused improvements
11. Import changes as usual
12. Done!
📄 License
MIT License - Free for personal and commercial use
Made for developers who use AI assistants 💙
Version 2.15.0 | 2025