Skip to content
Jacob Sampson edited this page Mar 23, 2026 · 1 revision

Module: VS Code Extension

Generated by Cicadas Bootstrap on 2026-03-22.

Purpose

The VS Code extension (@aprovan/patchwork-vscode) integrates the entire Patchwork platform into Visual Studio Code. It provides a project file explorer (tree view), a widget preview panel (webview), an embedded Stitchery server for service dispatch, and AI-driven editing via Copilot proxy integration.

Interfaces

Exports:

  • activate(context) — Extension activation: registers providers, commands, and starts embedded Stitchery
  • VS Code contribution points: views, commands, file system provider, webview

Providers:

  • PatchworkTreeProviderTreeDataProvider for project file listing in the sidebar
  • PatchworkFileSystemProviderFileSystemProvider for virtual file system integration
  • PreviewPanelProviderWebviewViewProvider for the widget preview panel

Dependencies:

  • vscode — VS Code Extension API
  • @aprovan/patchwork-compiler — Compilation and VFS
  • @aprovan/stitchery — Embedded server for services

Subsystems

Providers

  • providers/PatchworkTreeProvider.ts — Reads project structure, presents as explorable tree in sidebar with file icons and grouping
  • providers/PatchworkFileSystemProvider.ts — Bridges VFS to VS Code's file system API, enabling standard file operations (open, save, rename, delete) on virtual project files
  • providers/PreviewPanelProvider.ts — Manages a webview panel that compiles and renders widgets live; handles hot-reload on file changes

Services

  • services/EditService.ts — Handles AI-driven edit requests: receives edit instructions, sends to LLM via Copilot proxy, applies resulting code changes
  • services/EmbeddedStitchery.ts — Starts a Stitchery server instance in-process within the extension, providing MCP/UTCP service access without a separate terminal

Extension Entry

  • extension.ts — Activation logic: registers all providers, sets up commands, initializes embedded Stitchery, configures Copilot proxy URL from settings

Key Decisions

  • Embedded Stitchery over external server: Running Stitchery in-process eliminates the need for developers to manually start a backend server, providing a zero-config experience.
  • FileSystemProvider for VFS bridging: Using VS Code's native file system API means standard editor features (file tabs, save, diff) work with virtual project files seamlessly.
  • Copilot proxy for AI edits: Rather than integrating an LLM directly, the extension proxies edit requests through a configurable Copilot proxy endpoint, keeping AI provider choice flexible.

Clone this wiki locally