|
1 | | -# CtxEng AI VSCode Extension |
2 | | - |
3 | | -Production-ready VS Code sidebar for building high-quality `ctxeng` context and asking AI providers with secure key storage, live streaming output, and actionable code workflows. |
4 | | - |
5 | | -## Installation |
6 | | - |
7 | | -1. Install the Python package: |
8 | | - - `pip install ctxeng` |
9 | | -2. Install this extension (`vscode-ctxeng`) in VSCode. |
10 | | -3. Open a project folder. |
11 | | - |
12 | | -## Features |
13 | | - |
14 | | -- **CtxEng AI Sidebar** |
15 | | - - Dedicated "CtxEng AI" activity bar view with provider/model selection, query input, context preview, and AI response panels. |
16 | | -- **Context Build + Explain** |
17 | | - - `Build Context` runs `ctxeng build --fmt markdown`. |
18 | | - - `Explain Current File` scopes context to the active file. |
19 | | -- **Live Loading States** |
20 | | - - Shows `⏳ Building context...` and `⏳ Asking AI...`. |
21 | | - - Disables actions while tasks are running and restores controls on success/error. |
22 | | -- **Streaming AI Responses** |
23 | | - - Streams tokens/chunks in real time for providers with streaming APIs. |
24 | | - - Gracefully falls back to non-streaming providers. |
25 | | -- **Clickable File Navigation** |
26 | | - - Selected files in the sidebar open directly in editor and are revealed in Explorer. |
27 | | -- **Diff View for AI Suggestions** |
28 | | - - `Show Diff` compares original selected code (or full file) with AI-generated suggestion using VS Code diff. |
29 | | -- **Metrics Dashboard** |
30 | | - - Live Tokens / Estimated Cost / Files count from parsed `ctxeng` output. |
31 | | -- **Secure API Keys** |
32 | | - - Keys are stored in VS Code `SecretStorage` (never in settings). |
33 | | -- **Provider Support** |
34 | | - - OpenAI, Anthropic, Gemini, Mistral, Groq, Cohere, Together, DeepSeek, Ollama, xAI, OpenRouter. |
35 | | - |
36 | | -## Commands |
37 | | - |
38 | | -- `ctxeng.buildContext` |
39 | | -- `ctxeng.buildContextCurrentFile` |
40 | | -- `ctxeng.watchContext` |
41 | | -- `ctxeng.showSummary` |
42 | | -- `ctxeng.setApiKey` |
43 | | -- `ctxeng.clearApiKey` |
44 | | -- `ctxeng.listConfiguredProviders` |
45 | | - |
46 | | -## Configuration |
47 | | - |
48 | | -- `ctxeng.aiProvider` (default: `openai`) |
49 | | -- `ctxeng.aiModel` (default: `gpt-4o-mini`) |
50 | | -- `ctxeng.ollamaBaseUrl` (default: `http://localhost:11434`) |
51 | | -- `ctxeng.ollamaModels` (default: `["llama3","mistral","codellama","phi3"]`) |
52 | | -- `ctxeng.openrouterModel` (default: `anthropic/claude-3.5-sonnet`) |
53 | | -- `ctxeng.openrouterSiteName` (default: `CtxEng VS Code`) |
54 | | -- `ctxeng.model` (default: `claude-sonnet-4`) |
55 | | -- `ctxeng.format` (default: `markdown`) |
56 | | -- `ctxeng.autowatch` (default: `false`) |
| 1 | +# CtxEng AI - Intelligent Context Engineering for VSCode |
| 2 | + |
| 3 | +> **Note:** The VSCode extension is **disabled in this version** because it is still **under development**.\n+> Please use the `ctxeng` CLI / Python package instead for now. |
| 4 | +<p align="center"> |
| 5 | + <img src="https://raw.githubusercontent.com/Sayeem3051/python-context-engineer/main/vscode-ctxeng/media/ctxeng.png" alt="CtxEng AI Logo" width="128" height="128"> |
| 6 | +</p> |
| 7 | +
|
| 8 | +<p align="center"> |
| 9 | + <strong>Stop copy-pasting files into ChatGPT.<br> |
| 10 | + Build perfect LLM context from your codebase, automatically.</strong> |
| 11 | +</p> |
| 12 | + |
| 13 | +<p align="center"> |
| 14 | + <a href="https://marketplace.visualstudio.com/items?itemName=saeemabkari6.ctxeng-ai"> |
| 15 | + <img src="https://img.shields.io/visual-studio-marketplace/v/saeemabkari6.ctxeng-ai?color=blue&label=VS%20Code%20Marketplace" alt="VS Code Marketplace"> |
| 16 | + </a> |
| 17 | + <a href="https://marketplace.visualstudio.com/items?itemName=saeemabkari6.ctxeng-ai"> |
| 18 | + <img src="https://img.shields.io/visual-studio-marketplace/d/saeemabkari6.ctxeng-ai?color=green" alt="Downloads"> |
| 19 | + </a> |
| 20 | + <a href="https://marketplace.visualstudio.com/items?itemName=saeemabkari6.ctxeng-ai"> |
| 21 | + <img src="https://img.shields.io/visual-studio-marketplace/r/saeemabkari6.ctxeng-ai?color=yellow" alt="Rating"> |
| 22 | + </a> |
| 23 | +</p> |
| 24 | + |
| 25 | +Transform your development workflow with AI-powered context engineering. CtxEng AI automatically analyzes your codebase, selects the most relevant files for your query, and provides intelligent responses from 11+ AI providers including Claude, GPT-4o, Gemini, and more. |
| 26 | + |
| 27 | +## ✨ Features at a Glance |
| 28 | + |
| 29 | +- 🧠 **Smart Context Building** - Automatically scores and ranks files by relevance |
| 30 | +- 🤖 **11+ AI Providers** - OpenAI, Anthropic, Google, Mistral, Groq, and more |
| 31 | +- 🔒 **Secure API Keys** - Encrypted storage in VSCode SecretStorage |
| 32 | +- ⚡ **Real-time Streaming** - Live AI responses with token-by-token updates |
| 33 | +- 📊 **Cost Estimation** - Track token usage and estimated costs |
| 34 | +- 🔍 **Diff Viewer** - Compare AI suggestions with your code |
| 35 | +- 📁 **Smart File Selection** - Click to open files directly in editor |
| 36 | +- ⚙️ **Flexible Configuration** - Customize models, formats, and behavior |
| 37 | + |
| 38 | +## 📸 Screenshots |
| 39 | + |
| 40 | +### Main Sidebar Interface |
| 41 | + |
| 42 | + |
| 43 | +### AI Chat Interface |
| 44 | + |
| 45 | + |
| 46 | +## 🚀 Quick Start |
| 47 | + |
| 48 | +### Prerequisites |
| 49 | +1. **Install Python Package** |
| 50 | + ```bash |
| 51 | + pip install ctxeng |
| 52 | + ``` |
| 53 | + |
| 54 | +2. **Install Extension** |
| 55 | + - Open VSCode |
| 56 | + - Go to Extensions (Ctrl+Shift+X) |
| 57 | + - Search for "CtxEng AI" |
| 58 | + - Click Install |
| 59 | + |
| 60 | +3. **Verify Installation** |
| 61 | + - Press `Ctrl+Shift+P` |
| 62 | + - Run `CtxEng: Verify Installation` |
| 63 | + - If successful, proceed to setup API key |
| 64 | + |
| 65 | +4. **Setup API Key** |
| 66 | + - Open Command Palette (Ctrl+Shift+P) |
| 67 | + - Run `CtxEng: Set API Key` |
| 68 | + - Choose your preferred AI provider |
| 69 | + - Enter your API key (stored securely) |
| 70 | + |
| 71 | +### First Use |
| 72 | +1. Open any project folder in VSCode |
| 73 | +2. Click the CtxEng AI icon in the Activity Bar |
| 74 | +3. Enter your query (e.g., "Explain the authentication flow") |
| 75 | +4. Watch as CtxEng builds context and provides AI insights! |
| 76 | + |
| 77 | +### 🔧 Troubleshooting |
| 78 | +If you encounter issues, see our [Setup Guide](SETUP_GUIDE.md) for detailed troubleshooting steps. |
| 79 | + |
| 80 | +**Common Issues:** |
| 81 | +- **"ctxeng CLI not found"**: Run the diagnostic script or check PATH configuration |
| 82 | +- **Permission errors**: Try `pip install --user ctxeng` |
| 83 | +- **Network issues**: Check internet connection and API key validity |
| 84 | + |
| 85 | +**Quick Fixes:** |
| 86 | +```bash |
| 87 | +# Windows: Add to PATH |
| 88 | +%APPDATA%\Python\Python314\Scripts |
| 89 | + |
| 90 | +# macOS/Linux: Add to PATH |
| 91 | +export PATH="$HOME/.local/bin:$PATH" |
| 92 | + |
| 93 | +# Verify installation |
| 94 | +ctxeng info |
| 95 | +``` |
| 96 | + |
| 97 | +## 🎯 Core Features |
| 98 | + |
| 99 | +### Intelligent Context Building |
| 100 | +CtxEng uses advanced scoring algorithms to automatically select the most relevant files: |
| 101 | +- **Keyword Matching** - Finds files containing query-related terms |
| 102 | +- **AST Analysis** - Analyzes code structure and symbols (Python) |
| 103 | +- **Path Relevance** - Considers file naming and location |
| 104 | +- **Git Recency** - Prioritizes recently modified files |
| 105 | +- **Import Graph** - Includes related dependencies |
| 106 | +- **Semantic Similarity** - Optional embedding-based matching |
| 107 | + |
| 108 | +### Multi-Provider AI Support |
| 109 | +Choose from 11+ leading AI providers: |
| 110 | + |
| 111 | +| Provider | Models | Strengths | |
| 112 | +|----------|--------|-----------| |
| 113 | +| **OpenAI** | GPT-4o, GPT-4-turbo, GPT-3.5-turbo | General purpose, coding | |
| 114 | +| **Anthropic** | Claude Opus/Sonnet/Haiku 4 | Reasoning, analysis | |
| 115 | +| **Google** | Gemini 1.5 Pro/Flash, 2.0 Flash | Multimodal, large context | |
| 116 | +| **Mistral** | Large/Medium/Small, Codestral | European, coding-focused | |
| 117 | +| **Groq** | Llama 3.3, Mixtral, Gemma2 | Ultra-fast inference | |
| 118 | +| **Cohere** | Command R+/R/Light | Enterprise, RAG | |
| 119 | +| **Together** | Llama 3, Mixtral, Qwen | Open source models | |
| 120 | +| **DeepSeek** | DeepSeek Chat/Reasoner | Reasoning, math | |
| 121 | +| **xAI** | Grok 2/2-mini | Real-time, conversational | |
| 122 | +| **OpenRouter** | 100+ models | Model aggregator | |
| 123 | +| **Ollama** | Local models | Privacy, offline | |
| 124 | + |
| 125 | +### Advanced Workflow Features |
| 126 | + |
| 127 | +#### 🔄 **Real-time Streaming** |
| 128 | +- Token-by-token response streaming |
| 129 | +- Live progress indicators |
| 130 | +- Graceful fallback for non-streaming providers |
| 131 | + |
| 132 | +#### 📊 **Smart Metrics Dashboard** |
| 133 | +- Live token count tracking |
| 134 | +- Cost estimation per query |
| 135 | +- File inclusion statistics |
| 136 | +- Budget optimization insights |
| 137 | + |
| 138 | +#### 🔍 **Interactive Diff Viewer** |
| 139 | +- Compare AI suggestions with original code |
| 140 | +- Side-by-side diff visualization |
| 141 | +- One-click code application |
| 142 | + |
| 143 | +#### 📁 **Seamless File Navigation** |
| 144 | +- Click any file in context to open in editor |
| 145 | +- Automatic Explorer reveal |
| 146 | +- Smart file filtering and selection |
| 147 | + |
| 148 | +## ⌨️ Commands & Shortcuts |
| 149 | + |
| 150 | +| Command | Shortcut | Description | |
| 151 | +|---------|----------|-------------| |
| 152 | +| `CtxEng: Build Context for Query` | `Ctrl+Shift+C` | Build context for custom query | |
| 153 | +| `CtxEng: Build Context for Current File` | - | Focus context on active file | |
| 154 | +| `CtxEng: Watch and Auto-rebuild Context` | - | Auto-rebuild on file changes | |
| 155 | +| `CtxEng: Show Context Summary` | - | Display context statistics | |
| 156 | +| `CtxEng: Set API Key` | - | Configure provider API key | |
| 157 | +| `CtxEng: Clear API Key` | - | Remove stored API key | |
| 158 | +| `CtxEng: List Configured Providers` | - | Show available providers | |
| 159 | + |
| 160 | +## ⚙️ Configuration |
| 161 | + |
| 162 | +Customize CtxEng AI behavior through VSCode settings: |
| 163 | + |
| 164 | +### AI Provider Settings |
| 165 | +```json |
| 166 | +{ |
| 167 | + "ctxeng.aiProvider": "openai", // Default AI provider |
| 168 | + "ctxeng.aiModel": "gpt-4o-mini", // Default model |
| 169 | + "ctxeng.model": "claude-sonnet-4", // CtxEng context model |
| 170 | + "ctxeng.format": "markdown" // Output format (xml/markdown/plain) |
| 171 | +} |
| 172 | +``` |
| 173 | + |
| 174 | +### Provider-Specific Settings |
| 175 | +```json |
| 176 | +{ |
| 177 | + // Ollama (Local) |
| 178 | + "ctxeng.ollamaBaseUrl": "http://localhost:11434", |
| 179 | + "ctxeng.ollamaModels": ["llama3", "mistral", "codellama", "phi3"], |
| 180 | + |
| 181 | + // OpenRouter |
| 182 | + "ctxeng.openrouterModel": "anthropic/claude-3.5-sonnet", |
| 183 | + "ctxeng.openrouterSiteName": "CtxEng VS Code", |
| 184 | + |
| 185 | + // Auto-watch |
| 186 | + "ctxeng.autowatch": false // Auto-rebuild on file changes |
| 187 | +} |
| 188 | +``` |
| 189 | + |
| 190 | +## 🔧 Advanced Usage |
| 191 | + |
| 192 | +### Custom Context Patterns |
| 193 | +Use `.ctxengignore` files to control which files are included: |
| 194 | +```gitignore |
| 195 | +# Exclude test files |
| 196 | +tests/ |
| 197 | +**/*test*.py |
| 198 | +
|
| 199 | +# Exclude build artifacts |
| 200 | +dist/ |
| 201 | +build/ |
| 202 | +node_modules/ |
| 203 | +
|
| 204 | +# Include specific patterns |
| 205 | +!important-config.json |
| 206 | +``` |
| 207 | + |
| 208 | +### Semantic Similarity (Optional) |
| 209 | +Enable semantic scoring for better relevance: |
| 210 | +```bash |
| 211 | +pip install "ctxeng[semantic]" |
| 212 | +``` |
| 213 | + |
| 214 | +### Watch Mode |
| 215 | +Auto-rebuild context when files change: |
| 216 | +```bash |
| 217 | +pip install "ctxeng[watch]" |
| 218 | +``` |
| 219 | + |
| 220 | +## 🛠️ Troubleshooting |
| 221 | + |
| 222 | +### Common Issues |
| 223 | + |
| 224 | +**❌ "ctxeng not installed"** |
| 225 | +```bash |
| 226 | +pip install ctxeng |
| 227 | +# Restart VSCode after installation |
| 228 | +``` |
| 229 | + |
| 230 | +**❌ "No API key configured"** |
| 231 | +- Run `CtxEng: Set API Key` command |
| 232 | +- Ensure you have a valid API key for your chosen provider |
| 233 | + |
| 234 | +**❌ "Network error"** |
| 235 | +- Check internet connection |
| 236 | +- Verify API key is valid and has sufficient credits |
| 237 | +- For Ollama: ensure local server is running |
| 238 | + |
| 239 | +**❌ "Model not found"** |
| 240 | +- Check if model name is correct in settings |
| 241 | +- Verify your API key has access to the specified model |
| 242 | + |
| 243 | +### Performance Tips |
| 244 | +- Use `.ctxengignore` to exclude large/irrelevant files |
| 245 | +- Choose appropriate models based on context size |
| 246 | +- Enable semantic scoring only for complex queries |
| 247 | + |
| 248 | +## 🤝 Contributing |
| 249 | + |
| 250 | +We welcome contributions! Please see our [Contributing Guide](https://github.com/Sayeem3051/python-context-engineer/blob/main/CONTRIBUTING.md) for details. |
| 251 | + |
| 252 | +### Development Setup |
| 253 | +```bash |
| 254 | +git clone https://github.com/Sayeem3051/python-context-engineer.git |
| 255 | +cd python-context-engineer/vscode-ctxeng |
| 256 | +npm install |
| 257 | +npm run compile |
| 258 | +``` |
| 259 | + |
| 260 | +## 📄 License |
| 261 | + |
| 262 | +MIT License - see [LICENSE](LICENSE) for details. |
| 263 | + |
| 264 | +## 🔗 Links |
| 265 | + |
| 266 | +- **GitHub Repository**: [python-context-engineer](https://github.com/Sayeem3051/python-context-engineer) |
| 267 | +- **Python Package**: [ctxeng on PyPI](https://pypi.org/project/ctxeng/) |
| 268 | +- **Issues & Support**: [GitHub Issues](https://github.com/Sayeem3051/python-context-engineer/issues) |
| 269 | +- **Documentation**: [Full Documentation](https://github.com/Sayeem3051/python-context-engineer#readme) |
| 270 | + |
| 271 | +--- |
| 272 | + |
| 273 | +<p align="center"> |
| 274 | + <strong>Transform your coding workflow with intelligent context engineering!</strong><br> |
| 275 | + Made with ❤️ by <a href="https://github.com/Sayeem3051">Abkari Mohammed Sayeem</a> |
| 276 | +</p> |
0 commit comments