Files
socraticode/extension/esbuild.config.mjs
Giancarlo Erra bbc68199c3 feat(extension): add VS Code and Open VSX extension
A new top-level `extension/` package containing the SocratiCode VS Code
extension. The same `.vsix` artefact ships to both VS Code Marketplace
and Open VSX, which means it installs cleanly in Cursor, VSCodium,
Gitpod, code-server, Eclipse Theia editors, Google Antigravity, and
Particle Workbench in addition to stock VS Code.

What it does:

- Auto-registers the SocratiCode MCP server in VS Code's MCP host via
  `vscode.lm.registerMcpServerDefinitionProvider` (VS Code 1.99+).
  Copilot agent mode, Cline, Continue, Roo Code and any other
  MCP-aware client see SocratiCode's tools without the user editing
  any `.vscode/mcp.json`.
- Forwards the user's `socraticode.env` setting to the engine
  subprocess unchanged. Power users point at an external Qdrant
  (`QDRANT_MODE=external` + `QDRANT_URL` + `QDRANT_API_KEY`), pick an
  embedding provider, or set any other engine knob exactly as
  documented in the engine README.
- Activity Bar sidebar with "Indexed projects" tree view and welcome
  content. Discovers projects by listing graph artefacts the engine
  writes to `os.tmpdir()/socraticode-graph/`.
- Webview panel for the interactive graph (`graphPanel.ts`). Reads
  the engine's self-contained HTML, wraps it with a tight CSP, injects
  a bridge script so node-clicks can `postMessage` back to the
  extension and open files in the editor.
- Status-bar item showing "SocratiCode" with click-to-open-sidebar.
  Honours the `socraticode.statusBar` setting.
- Two-step getting-started walkthrough (index your project, try
  search and the interactive graph). Shown automatically on first
  install; re-openable via the command palette.
- Command palette commands: index workspace, open graph, refresh
  projects, open walkthrough, show output.
- Output channel for engine logs.

Build: esbuild bundles `src/extension.ts` to `dist/extension.js` (CJS,
node18, sourcemap), `vscode` external. Biome lint and `tsc` strict
mode both clean. Manifest smoke tests via Node's built-in test runner
catch package.json regressions before activation. Packaged size:
~215 KB `.vsix`.

Versioning: extension version tracks the engine version (currently
`1.7.2`). Patch drift is allowed for extension-only hotfixes. The
`scripts/bump-plugin-versions.mjs` hook from the previous commit
already includes `extension/package.json` in its bump list, so future
engine releases keep the extension in lockstep automatically.
2026-05-02 18:31:22 +01:00

34 lines
938 B
JavaScript

// SPDX-License-Identifier: AGPL-3.0-only
// Copyright (C) 2026 Giancarlo Erra - Altaire Limited
//
// esbuild bundle for the VS Code / Open VSX extension. The extension is
// shipped as a single CommonJS bundle (VS Code's runtime requirement),
// with `vscode` marked external. We avoid `node_modules` in the .vsix
// because everything we need either resolves at runtime via VS Code's
// host (`vscode`) or is part of the Node 18+ stdlib.
import { build, context } from "esbuild";
const watch = process.argv.includes("--watch");
const options = {
entryPoints: ["src/extension.ts"],
bundle: true,
outfile: "dist/extension.js",
external: ["vscode"],
format: "cjs",
platform: "node",
target: "node18",
sourcemap: true,
minify: !watch,
logLevel: "info",
};
if (watch) {
const ctx = await context(options);
await ctx.watch();
console.log("[esbuild] watching for changes...");
} else {
await build(options);
}