From 6bc8d234e3164e4f2be241575d6fa046848a373e Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 29 Mar 2026 12:42:18 -0700 Subject: [PATCH] Read CLI version from package.json instead of hardcoding Prevents version string going out of sync on release. Uses import.meta.url to resolve package.json relative to the CLI script. Co-Authored-By: Claude Opus 4.6 (1M context) --- src/cli.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/cli.ts b/src/cli.ts index 9c19e7d..5209f99 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -1,5 +1,8 @@ #!/usr/bin/env node +import { readFileSync } from "node:fs"; +import { dirname, join } from "node:path"; +import { fileURLToPath } from "node:url"; import { Command } from "commander"; import { apply } from "./commands/apply.js"; import { clean } from "./commands/clean.js"; @@ -14,6 +17,10 @@ import { undo } from "./commands/undo.js"; import { loadConfig } from "./utils/config.js"; import { resolvePrompt } from "./utils/prompt.js"; +// Read version from package.json so it stays in sync automatically +const __dirname = dirname(fileURLToPath(import.meta.url)); +const pkg = JSON.parse(readFileSync(join(__dirname, "..", "package.json"), "utf-8")); + const program = new Command(); program @@ -21,7 +28,7 @@ program .description( "Ensemble AI coding — run N parallel agents on the same task, select the best result", ) - .version("0.1.0"); + .version(pkg.version); const cfg = loadConfig();