From 3a3adb70937f8e0a0bc547b28be871cc5f743268 Mon Sep 17 00:00:00 2001 From: Taki Date: Wed, 18 Nov 2026 17:42:21 +0700 Subject: [PATCH 1/2] feat(build): configure dual-target build scripts and lean vsix packaging --- .vscodeignore | 6 ++++++ package.json | 12 +++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.vscodeignore b/.vscodeignore index 61d33c3..5a1f41a 100644 --- a/.vscodeignore +++ b/.vscodeignore @@ -6,7 +6,13 @@ test/** tasks/** resource/** .agents/** +plugin/** +scripts/** +sample-book/** +dist/sidecar-server.cjs +dist/mcp-server.cjs WORKSPACE.md tsconfig.json +tsconfig.core.json .gitignore *.vsix diff --git a/package.json b/package.json index 6c890b0..7c3dcfb 100644 --- a/package.json +++ b/package.json @@ -98,14 +98,20 @@ ] }, "scripts": { - "build": "esbuild src/vscode/extension.ts --bundle --platform=node --format=cjs --external:vscode --outfile=dist/extension.js && esbuild src/core/xhtml.ts --bundle --platform=node --format=cjs --outfile=dist/xhtml.js && esbuild src/core/epub.ts --bundle --platform=node --format=cjs --external:vscode --outfile=dist/epub.js && esbuild src/core/state-manager.ts --bundle --platform=node --format=cjs --outfile=dist/state-manager.js && esbuild src/core/archive.ts --bundle --platform=node --format=cjs --outfile=dist/archive.js && npm run build:sidecar && npm run build:mcp", + "build": "npm run build:all", + "build:core": "tsc -p tsconfig.core.json --noEmit", + "build:vscode": "esbuild src/vscode/extension.ts --bundle --platform=node --format=cjs --external:vscode --outfile=dist/extension.js && esbuild src/core/xhtml.ts --bundle --platform=node --format=cjs --outfile=dist/xhtml.js && esbuild src/core/epub.ts --bundle --platform=node --format=cjs --external:vscode --outfile=dist/epub.js && esbuild src/core/state-manager.ts --bundle --platform=node --format=cjs --outfile=dist/state-manager.js && esbuild src/core/archive.ts --bundle --platform=node --format=cjs --outfile=dist/archive.js", "build:sidecar": "esbuild src/antigravity/sidecar-server.ts --bundle --platform=node --format=cjs --outfile=dist/sidecar-server.cjs", "build:mcp": "esbuild src/antigravity/mcp-server.ts --bundle --platform=node --format=cjs --outfile=dist/mcp-server.cjs", + "build:plugin": "npm run build:sidecar && npm run build:mcp", + "build:all": "npm run build:vscode && npm run build:plugin", + "package:vsix": "npx @vscode/vsce package --no-dependencies", "install:plugin": "node scripts/install-plugin.js", + "deploy:local-plugin": "node scripts/install-plugin.js", "check": "tsc --noEmit", - "check:core": "tsc -p tsconfig.core.json --noEmit", + "check:core": "npm run build:core", "test": "npm run build && node --test test/*.test.mjs", - "watch": "npm run build -- --watch" + "watch": "npm run build:vscode -- --watch" }, "devDependencies": { "@types/node": "^22.13.0", From e9346c5f381b8226ca70da4e5a80136341b12ca4 Mon Sep 17 00:00:00 2001 From: Taki Date: Wed, 18 Nov 2026 17:43:11 +0700 Subject: [PATCH 2/2] docs: document dual-target architecture and build workflows in README and WORKSPACE --- README.md | 30 ++++++++++++++++++++++++------ WORKSPACE.md | 14 +++++++++++--- 2 files changed, 35 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 3b29d7b..2d50d91 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,16 @@ code --install-extension xhtml-reader-previewer-0.1.0.vsix ``` *Or via VS Code UI: Extensions View ➔ Click `...` (More Actions) ➔ **Install from VSIX...** ➔ Select the downloaded file.* +### Option 3: Google Antigravity 2.0 Plugin (Autonomous Auxiliary Pane & MCP) +Install and activate directly as a native Antigravity 2.0 plugin: +```bash +npm run deploy:local-plugin +``` +Once deployed to `~/.gemini/config/plugins/xhtml-reader-plugin`, Antigravity exposes: +- **Auxiliary Pane Sidecar**: Interactive reading panel accessible via pill links `[Buka XHTML Reader](sidecar://xhtml-reader-plugin/xhtml-previewer/)`. +- **MCP Server Tools (`xhtml_reader_mcp`)**: Autonomous inspection tools for agents (`xhtml_open_preview`, `xhtml_get_toc`, `xhtml_get_metadata`). +- **Autonomous Reading Rules**: Dedicated agent rule guiding AI assistants to preview publications interactively. + --- ## ✨ Key Features @@ -130,21 +140,29 @@ Double-click any `.epub` file in your workspace to open it immediately in the de ## 🛠️ Development & Building +The repository features a unified **Dual-Target Build Pipeline** that generates both the VS Code extension and the Antigravity 2.0 plugin from a shared core: + ```bash # Install dependencies npm install # Type check -npm run check +npm run check # Full check +npm run check:core # Pure core check (verifies zero vscode dependency) -# Run unit tests +# Run test suite (all 67 unit and integration tests) npm test -# Build extension bundles -npm run build +# Build all targets (VS Code extension + Antigravity sidecar & MCP) +npm run build:all + +# Target 1: VS Code Extension +npm run build:vscode +npm run package:vsix # Outputs standalone lean .vsix package -# Package local VSIX -npx @vscode/vsce package +# Target 2: Antigravity 2.0 Plugin +npm run build:plugin # Builds sidecar-server.cjs & mcp-server.cjs +npm run deploy:local-plugin # Deploys bundle to ~/.gemini/config/plugins/xhtml-reader-plugin ``` --- diff --git a/WORKSPACE.md b/WORKSPACE.md index 1c04022..70c296a 100644 --- a/WORKSPACE.md +++ b/WORKSPACE.md @@ -4,9 +4,17 @@ Workspace untuk pengembangan **XHTML Reader Previewer** (Mode: **Mode 1: Native / Lead (Root Git Repo)**). ## Projects -| Project | Stack | Repo | Status | -|---------|-------|------|--------| -| Root (Direct) | TypeScript, VS Code Extension API, esbuild | TBD | Active | +| Project | Stack | Repo | Status | Target | +|---------|-------|------|--------|--------| +| Root (Direct) | TypeScript, esbuild | https://github.com/intxdv/XHTML-Reader-Previewer | Active | Dual-Target (VS Code VSIX + Antigravity 2.0 Plugin) | + +### Dual-Target Architecture +- **Pure Core (`src/core/`)**: Mesin parsing EPUB & XHTML, state manager, dan UI reader-shell terisolasi tanpa dependensi vendor. +- **VS Code Extension (`src/vscode/`)**: Adapter VS Code Webview Panel & CustomEditor (`dist/extension.js` -> `.vsix`). +- **Antigravity 2.0 Plugin (`src/antigravity/` & `plugin/`)**: + - Sidecar HTTP Server (`dist/sidecar-server.cjs`) untuk Auxiliary Pane. + - Model Context Protocol (MCP) Server (`dist/mcp-server.cjs`) untuk Autonomous Agent (`xhtml_open_preview`, `xhtml_get_toc`, `xhtml_get_metadata`). + - Declarative Plugin Manifests (`plugin/plugin.json`, `mcp_config.json`, `sidecars/`, `skills/`, `rules/`). ## Team & Stakeholders - **Developer**: Developer