CyPilot is a next-generation hybrid AI assistant designed to bridge the gap between Cypress browser tests and your VS Code editor. It captures runtime errors, DOM tree states, and network traces at the exact moment of failure, providing deep AI-powered analysis and 1-click auto-fixes directly inside your editor.
- ⚡ Real-Time Failure Interception: No more digging through browser logs or terminal stack traces. The moment a test fails in the browser, CyPilot captures the exact state (error message, stack, URL, and DOM snapshot).
- 🧠 Multi-Provider AI Brain (Free & Local):
- Rule Engine (Zero Config): Works instantly out of the box. No API keys required.
- Google Gemini Flash (Cloud / Free): Leverages Google's fast, free-tier Gemini API for deep cloud analysis.
- Ollama (Offline / Private): Run completely offline and privately using models like
qwen3:8b,llama3, orcodellama. - Custom Provider: Connect to any OpenAI-compatible API endpoint (like Groq, DeepSeek, or your custom gateway).
- ✨ 1-Click Auto-Fix: Highlight the failing line, click the Apply AI Fix button in the sidebar, and let CyPilot rewrite the broken Cypress code for you automatically.
- 🎯 DOM-Aware Selector Optimizer: If an element is missing, CyPilot looks at the captured DOM snapshot and suggests multiple stable alternative selectors (data-testid, classes, attributes).
- 🍃 Lightweight & Native: Written with zero external npm dependencies. The local server starts instantly and uses minimal resources.
┌─────────────────────────────────┐ ┌──────────────────────────────────┐
│ Cypress Spy Plugin (Browser) │ HTTP POST (Port 3000)│ VS Code Extension (Brain) │
│ • Intercepts failures ├──────────────────────>│ • Native HTTP Server (Fast) │
│ • Captures URL & Stack Trace │ [Error, Stack, DOM] │ • Webview Chat UI │
│ • Takes DOM-tree snapshots │ │ • AI Provider Orchestrator │
└─────────────────────────────────┘ └────────────────┬─────────────────┘
│ Apply Fix Action
▼
[Your Spec File (.cy.js)]
| Feature | Standard Cypress | With CyPilot |
|---|---|---|
| Error Location | Scrolling through terminal/runner panels | Instantly displayed in the VS Code sidebar |
| Selector Inspection | Manually opening DevTools, copying paths | AI suggests the most stable selectors automatically |
| Locating Code | Finding the spec file and line number manually | Highlighted and focused in the editor automatically |
| Applying Fixes | Manual retyping and editing | ✨ Apply AI Fix — One-click automatic code replacement |
| Data Privacy | Cloud uploads required by other tools | 100% offline and private option using local Ollama |
Install the .vsix package in VS Code:
- Open the Extensions view (
Cmd+Shift+XorCtrl+Shift+X). - Click the
...(Views and More Actions) menu in the top-right corner. - Select Install from VSIX...
- Select the
cypilot-0.0.5.vsixfile.
Add the following listener to your Cypress support file (typically cypress/support/e2e.js or e2e.ts):
// Add to cypress/support/e2e.js
Cypress.on('fail', (error, runnable) => {
let url = 'unknown';
let html = '';
try {
const autWindow = Cypress.state('window');
const autDocument = Cypress.state('document');
url = autWindow ? autWindow.location.href : window.location.href;
html = autDocument ? autDocument.documentElement.outerHTML : '';
} catch (e) {
console.error('CyPilot: Failed to capture DOM or URL', e);
}
const payload = {
type: 'test_failure',
message: error.message,
stack: error.stack,
specName: Cypress.spec ? Cypress.spec.relative : 'unknown',
url: url,
html: html,
timestamp: new Date().toISOString()
};
try {
const xhr = new XMLHttpRequest();
xhr.open('POST', 'http://localhost:3000', false); // Synchronous block
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.send(JSON.stringify(payload));
} catch (e) {
console.error('CyPilot: Connection to VS Code server failed. Make sure CyPilot is running.', e);
}
throw error;
});Open your VS Code Settings (Cmd+, or Ctrl+,), search for CyPilot, and configure your AI engine:
- AI Provider:
none - No API keys required. Analyzes stack traces and DOM using built-in rule heuristics.
- AI Provider:
gemini - Gemini Api Key: Paste your free API key. Get one instantly from Google AI Studio.
- AI Provider:
ollama - Ollama Host:
http://localhost:11434(default) - Ollama Model:
qwen3:8b,llama3, orcodellama(make sure the model is pulled locally viaollama run model_name).
- AI Provider:
custom - Custom Api Url: The endpoint URL (e.g.,
https://api.groq.com/openai/v1/chat/completions). - Custom Api Key: Your provider API key.
- Custom Model: The model name to request.
- Launch: VS Code starts the CyPilot server automatically on port
3000(you can customize this port in settings). - Run Tests: Run your Cypress tests as usual (
npx cypress openornpx cypress run). - Analyze: When a test fails, the CyPilot Chat panel in the VS Code sidebar glows. You see an immediate baseline explanation. If an AI provider is configured, CyPilot streams deep analytical insights and stable alternative selectors.
- Auto-Fix: Hover over the proposed solution, make sure your editor cursor is on the failing line, and click ✨ Apply AI Fix to instantly apply the fix.
This project is licensed under the MIT License - see the LICENSE file for details.