Terminal-Lens
The AI-powered debugging command center for VS Code.
Capture failures, diagnose root causes, review diffs before applying fixes, verify resolutions, and generate regression tests.
Overview
Terminal-Lens transforms raw terminal failures into an end-to-end, safe debugging workflow directly within VS Code:
- Terminal Intelligence & Error Grouping: Multi-format parser detects errors across Node.js/TypeScript, Python, Rust/Cargo, Go, Java/Kotlin, C/C++, Jest/Vitest, and pytest. Related frames are grouped into unified debugging sessions, highlighting the root cause rather than treating every stack frame as a separate failure.
- Context-Aware AI Diagnostics: Collects surrounding code, file imports, existing diagnostics, and optional Git diffs.
- Enterprise Security & Redaction: Automatically redacts API keys, AWS credentials, tokens, private keys, connection strings, and configured custom patterns before sending context to AI providers. API credentials are stored securely in OS-level SecretStorage, never in plain settings.
- Safe Patch Workflow: AI-generated fixes are presented with side-by-side Diff Previews. Patches are checked against original-text guards to reject stale edits, applied atomically via WorkspaceEdits with full VS Code undo support.
- Interactive Verification: Run verification commands (e.g.
npm test, pytest) directly from the panel or editor, with automated safeguards preventing destructive operations (rm -rf, format, drop table).
- Regression Test Generation: Suggests framework-accurate test skeletons matching your repository (Vitest, Jest, Pytest, Cargo, Go) without inventing nonexistent dependencies.
- Searchable Session History: Preserves local session history bounded to your workspace, allowing you to reopen past analyses, review applied patches, and clear history at any time.
Features
- Multi-Language Terminal Parsing: Strips ANSI/OSC escape sequences and parses stack traces and compiler diagnostics for TypeScript, Node.js, Python, Rust, Go, Java, Kotlin, C/C++, Jest, Vitest, and Pytest.
- Root-Cause Grouping: Distinguishes primary failures from cascading errors and normalizes dynamic values (timestamps, UUIDs, memory addresses, temp paths) for stable fingerprinting and deduplication.
- Inline Code Lenses: Actionable editor Code Lenses:
✨ AI: Analyze Error
🔍 Find Root Cause
🧪 Generate Test
⚡ Verify Fix
- Diff Preview & Safe Patching: Review side-by-side diffs (
vscode.diff) before applying changes. Rejects stale edits if files have changed since analysis.
- Provider Choice & Local-Only Mode: Supports OpenAI (
gpt-4o), Anthropic (claude-3-5-sonnet), Cohere (command-r-08-2024), and Ollama (llama3, mistral, etc.). Enforce a strict localOnly mode to block cloud network requests.
- Line-Buffered Streaming: Fixed split-chunk SSE/NDJSON parsing ensuring zero dropped tokens over TCP frames.
- Strict Webview Security: Full Content Security Policy (CSP), nonces, and typed boundary message validation.
Commands
Access these commands from the Command Palette (Ctrl+Shift+P / Cmd+Shift+P):
| Command |
Identifier |
Description |
| Terminal-Lens: Analyze Terminal Error |
terminalLens.analyzeError |
Opens file, positions cursor, and initiates AI error diagnosis. |
| Terminal-Lens: Find Root Cause |
terminalLens.findRootCause |
Focuses specifically on identifying root causes among grouped traces. |
| Terminal-Lens: Generate Regression Test |
terminalLens.generateTest |
Generates a project-appropriate regression test suggestion. |
| Terminal-Lens: Verify Fix |
terminalLens.verifyFix |
Runs verification commands with safety safeguards. |
| Terminal-Lens: Open Session History |
terminalLens.openSessionHistory |
QuickPick to browse, search, and reopen previous debugging sessions. |
| Terminal-Lens: Clear Session History |
terminalLens.clearHistory |
Clears stored session history from global state. |
| Terminal-Lens: Clear Diagnostics |
terminalLens.clearDiagnostics |
Clears all active Terminal-Lens error squiggles. |
| Terminal-Lens: Configure AI Provider |
terminalLens.configureProvider |
Interactive wizard to select provider, model, and endpoints. |
| Terminal-Lens: Set API Key |
terminalLens.setApiKey |
Stores provider API key in OS keychain via SecretStorage. |
| Terminal-Lens: Remove API Key |
terminalLens.removeApiKey |
Removes stored API key from SecretStorage. |
⚙️ Configuration Settings
| Setting |
Default |
Description |
terminalLens.aiProvider |
"openai" |
Active provider: openai, anthropic, ollama, or cohere. |
terminalLens.openaiModel |
"gpt-4o" |
Model name for OpenAI. |
terminalLens.anthropicModel |
"claude-3-5-sonnet-20241022" |
Model name for Anthropic. |
terminalLens.cohereModel |
"command-r-08-2024" |
Model name for Cohere. |
terminalLens.ollamaEndpoint |
"http://localhost:11434" |
HTTP endpoint for Ollama local service. |
terminalLens.ollamaModel |
"llama3" |
Model name for Ollama. |
terminalLens.localOnly |
false |
When true, blocks all cloud AI network requests for privacy. |
terminalLens.maxContextLines |
15 |
Surrounding code lines included around the error. |
terminalLens.maxContextSize |
10000 |
Maximum character limit for file context. |
terminalLens.includeGitDiff |
false |
Include recent Git diff for the failing file in AI context. |
terminalLens.ignoredPatterns |
["node_modules", "vendor", ".git"] |
Directories/patterns to ignore when scanning output. |
terminalLens.redactionPatterns |
[] |
Custom regex patterns to redact before sending text to AI. |
terminalLens.sessionRetentionMax |
100 |
Max number of debugging sessions to retain in history. |
🔒 Security & Privacy
- OS Keychain Secret Storage: API keys are never stored in plain-text configuration files or committed to Git.
- Context Redaction: Built-in redactors strip standard tokens, AWS keys, passwords, database URLs, and private keys.
- Stale Patch Guards: Edits verify that the current buffer matches the analyzed lines before applying changes.
- Destructive Command Warning: Automatic warning modal for verification commands containing
rm -rf, del /s, format, or DROP TABLE.
- Strict Webview CSP: Enforces script nonces, disallows unsafe external script evaluation, and sanitizes markdown.
Local-First with Ollama
Run 100% locally with zero cloud dependencies:
- Install Ollama and pull a model:
ollama run llama3
- In VS Code, run
Terminal-Lens: Configure AI Provider and select Ollama.
- (Optional) Enable
"terminalLens.localOnly": true in settings to guarantee no outbound cloud AI requests are permitted.
| |