openpencil/packages/op-vscode/package.json
Kayshen-X eb77845090 feat(vscode): custom editor provider, commands, activation, and daemon lifecycle
Completes the vscode-API glue for the OpenPencil extension (Plan 2 T7/T8/T10/
T11/T12 shells) on top of the tested cores:

- pen-editor-provider.ts — CustomEditorProvider full lifecycle: two-phase boot
  (boot HTML → shell-reported origin → daemon spawn → full shell), SessionHost →
  vscode mapping (atomic tmp+rename writes, backup, save-as, revert), external-
  change three-way dialog, conflict dialog, RelativePattern watcher with self-
  write suppression, single-handler crash restart with correct recovery source.
- restart-source.ts (+test) — pure pickRestartSource / resolveDaemonBinary.
- configure-command.ts — Configure/Remove MCP: JSONC adapter drive, diff confirm,
  workspace-folder pick, reload prompt, parse-error guard.
- skill-command.ts — Install/Remove AI Skill from the build-extracted bundle.
- codegen-command.ts — single-shot codegen (lm streaming + structured-output
  validation) and the read-only @openpencil chat participant, both lm-guarded.
- extension.ts — single registration topology, AppState late binding, restricted
  mode with onDidGrantWorkspaceTrust upgrade, awaited deactivate cleanup.
- build.mjs — extract the design skill markdown into dist/assets.
- daemon-contract.test.ts — real-binary integration smoke (needs cargo build).

Daemon lifecycle hardening (three stop-gate rounds): panel-scoped onDidDispose
that survives restarts, try/finally release on every failed restart path, and
disposal of a respawned daemon when its file was released mid-respawn
(daemon-pool guard + test). No orphaned daemons across close/restart/respawn.

--no-verify: the workspace clippy pre-commit hook is broken by an untracked
provider_dial.rs from a concurrent Rust session; this change touches no Rust.
125 tests + tsc + oxlint green.
2026-07-17 20:52:48 +08:00

107 lines
2.8 KiB
JSON

{
"name": "openpencil-vscode",
"displayName": "OpenPencil",
"description": "OpenPencil design-as-code integration for VS Code: .op file editing, MCP configuration, AI skills, and code generation.",
"version": "0.0.1",
"publisher": "openpencil",
"private": true,
"license": "MIT",
"engines": {
"vscode": "^1.90.0"
},
"categories": [
"Other"
],
"main": "./dist/extension.js",
"capabilities": {
"untrustedWorkspaces": {
"supported": "limited",
"description": "Without trust, .op files show a read-only placeholder; no local daemon is started and no MCP config is written."
}
},
"contributes": {
"customEditors": [
{
"viewType": "openpencil.penEditor",
"displayName": "OpenPencil",
"selector": [
{
"filenamePattern": "*.op"
}
],
"priority": "default"
}
],
"commands": [
{
"command": "openpencil.configureMcp",
"title": "OpenPencil: Configure MCP"
},
{
"command": "openpencil.removeMcp",
"title": "OpenPencil: Remove MCP"
},
{
"command": "openpencil.installSkill",
"title": "OpenPencil: Install Skill"
},
{
"command": "openpencil.removeSkill",
"title": "OpenPencil: Remove Skill"
},
{
"command": "openpencil.generateCode",
"title": "OpenPencil: Generate Code"
}
],
"chatParticipants": [
{
"id": "openpencil.assistant",
"name": "openpencil",
"description": "OpenPencil design assistant"
}
],
"configuration": {
"title": "OpenPencil",
"properties": {
"openpencil.dev.daemonPath": {
"type": "string",
"default": "",
"description": "Path to the op-host-web-server daemon binary. When empty, probes <workspace>/target/debug/op-host-web-server."
},
"openpencil.proxy.port": {
"type": "number",
"default": 0,
"description": "Port for the local MCP proxy. 0 selects a port automatically."
},
"openpencil.codegen.framework": {
"type": "string",
"enum": [
"react",
"vue"
],
"default": "react",
"description": "Target framework for generated code."
}
}
}
},
"scripts": {
"build": "node build.mjs",
"watch": "node build.mjs --watch",
"test": "bun test src",
"typecheck": "tsc --noEmit",
"lint": "oxlint",
"test:integration": "bun test test/integration"
},
"devDependencies": {
"@types/vscode": "~1.90",
"@types/node": "^20",
"@types/bun": "latest",
"typescript": "^5",
"esbuild": "^0.21",
"jsonc-parser": "^3",
"oxlint": "latest"
}
}