A Playwright-based tool for interacting with desktop VS Code and analyzing its DOM structure.
- Launch desktop VS Code with remote debugging enabled
- Connect Playwright to the running VS Code instance
- Dump the complete DOM structure to an HTML file
- Take screenshots of VS Code
- Analyze VS Code workbench components
- Wait for specific elements to load
- Open specific workspaces or files
- Python 3.10+
- Playwright for Python
Install via pip (from the project root):
pip install .
playwright installImport and use the AutoVSCodeCopilot class:
import asyncio
from auto_vscode_copilot import AutoVSCodeCopilot
async def main():
tool = await AutoVSCodeCopilot.create(workspace_path='/path/to/workspace', trace_file='/path/to/trace.zip')
# ... use other async methods ...
await tool.close()
# Run the async function
asyncio.run(main())Run the example script directly:
python src/example.py --output output.json --model GPT-4.1 --mode Agent --prompt "Your prompt here" --trace-file output/trace.zippytest tests/The tool creates an output directory containing:
- DOM dumps as HTML files (timestamped)
- Screenshots of VS Code (timestamped)
- Playwright trace files (.zip) at the specified path when trace_file is provided
The AutoVSCodeCopilot class provides the following methods:
create(workspace_path=None, trace_file=None)- Create and initialize an instance. Settrace_fileto a file path (e.g., 'output/trace.zip') to enable Playwright tracing.dumpDOM()- Extract and save the complete DOMtakeScreenshot(filename=None)- Capture a screenshotsendChatMessage(message, modelLabel='GPT-4.1', modeLabel='Agent')- Send a chat messageextractAllChatMessages()- Extract all chat messagesclose()- Close the browser connection and VS Code process
- Launches VS Code automatically with
--remote-debugging-portand--user-data-dirfor isolation when you instantiate the class - Waits for the debugging port to become available
- Connects Playwright to the VS Code Electron process via CDP (Chrome DevTools Protocol)
- Interacts with VS Code as if it were a web page
- The tool assumes
codeis available in your PATH - VS Code runs with remote debugging enabled on port 9222 (configurable)
- Uses a temporary user data directory to avoid conflicts with existing VS Code instances
- DOM dumps and screenshots are saved with timestamps to avoid conflicts
- By default, VS Code remains open after the tool finishes for manual inspection
- Temporary directories are automatically cleaned up when the tool closes