Skip to content

Non-invasive MCP accelerator plugin for Google Antigravity (CLI/Desktop/IDE): cuts LLM turns (-34%), token quota (-31%), and upload traffic (-40%) without affecting native UI or diffs.

1.7 KB
Raw Blame
import { build } from "esbuild";
import { promises as fs } from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";

const __dirname = path.dirname(fileURLToPath(import.meta.url));
const rootDir = path.resolve(__dirname, "..");
const distDir = path.join(rootDir, "dist");

const entrypoints = [
  {
    in: path.join(rootDir, "src", "mcp-server.ts"),
    out: path.join(distDir, "mcp-server.mjs"),
    banner: "#!/usr/bin/env node\n// agy-fast MCP Stdio Server (bundled zero-dependency ESM)\n",
    executable: true,
  },
  {
    in: path.join(rootDir, "src", "session-start.ts"),
    out: path.join(distDir, "session-start.mjs"),
    banner: "// agy-fast SessionStart Hook (bundled zero-dependency ESM)\n",
  },
  {
    in: path.join(rootDir, "src", "benchmark.ts"),
    out: path.join(distDir, "benchmark.mjs"),
    banner: "#!/usr/bin/env node\n// agy-fast Offline Transcript Benchmark CLI\n",
    executable: true,
  },
  {
    in: path.join(rootDir, "src", "updater.ts"),
    out: path.join(distDir, "updater.mjs"),
    banner: "#!/usr/bin/env node\n// agy-fast Background & CLI Auto-Updater (zero-dependency ESM)\n",
    executable: true,
  },
];

await fs.mkdir(distDir, { recursive: true });

for (const entry of entrypoints) {
  await build({
    entryPoints: [entry.in],
    outfile: entry.out,
    bundle: true,
    platform: "node",
    target: "node20",
    format: "esm",
    minify: false,
    sourcemap: false,
    legalComments: "none",
    banner: { js: entry.banner },
  });
  if (entry.executable && process.platform !== "win32") {
    await fs.chmod(entry.out, 0o755);
  }
  const stat = await fs.stat(entry.out);
  const rel = path.relative(rootDir, entry.out);
  console.log(`Built ${rel} (${(stat.size / 1024).toFixed(1)} KB)`);
}