Skip to content

Commit 415ab1d

Browse files
that-github-userunknownclaude
authored
Read CLI version from package.json instead of hardcoding (#157)
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: unknown <that-github-user@github.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 857545e commit 415ab1d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/cli.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#!/usr/bin/env node
22

3+
import { readFileSync } from "node:fs";
4+
import { dirname, join } from "node:path";
5+
import { fileURLToPath } from "node:url";
36
import { Command } from "commander";
47
import { apply } from "./commands/apply.js";
58
import { clean } from "./commands/clean.js";
@@ -14,14 +17,18 @@ import { undo } from "./commands/undo.js";
1417
import { loadConfig } from "./utils/config.js";
1518
import { resolvePrompt } from "./utils/prompt.js";
1619

20+
// Read version from package.json so it stays in sync automatically
21+
const __dirname = dirname(fileURLToPath(import.meta.url));
22+
const pkg = JSON.parse(readFileSync(join(__dirname, "..", "package.json"), "utf-8"));
23+
1724
const program = new Command();
1825

1926
program
2027
.name("thinktank")
2128
.description(
2229
"Ensemble AI coding — run N parallel agents on the same task, select the best result",
2330
)
24-
.version("0.1.0");
31+
.version(pkg.version);
2532

2633
const cfg = loadConfig();
2734

0 commit comments

Comments
 (0)