From ba513c5457d6ed1cc19ddd2b845ebd357a08bfea Mon Sep 17 00:00:00 2001 From: James Nicholls Date: Sun, 2 Aug 2026 06:30:39 +0800 Subject: [PATCH 1/2] fix: expose the CLI package version --- src/cli.ts | 14 +++++++++++++- tests/install-script.test.ts | 6 ++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/cli.ts b/src/cli.ts index 16d6258..fe21369 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -39,11 +39,22 @@ import { type SetupInput, type SetupPathRuleInput } from "./types.js"; -import { applyUpdate, maybePrintUpdateNotice, planUpdate, type UpdatePlan } from "./update.js"; +import { + applyUpdate, + maybePrintUpdateNotice, + planUpdate, + readCurrentVersion, + type UpdatePlan +} from "./update.js"; async function main(argv: string[]) { const [area, command, ...rest] = argv; + if (area === "version" || area === "--version" || area === "-V") { + console.log(await readCurrentVersion()); + return; + } + if (area === "init") { await initOpenBrain(); console.log("OpenBrain initialized."); @@ -628,6 +639,7 @@ function printDreamResult(result: Awaited>) { function usage() { console.log(`Usage: + openbrain version openbrain init openbrain update [--yes] openbrain setup [--brain-scope default|paths] [--path-rule ] [--codex yes|no] [--claude yes|no] [--disable-claude-auto-memory yes|no] diff --git a/tests/install-script.test.ts b/tests/install-script.test.ts index 5b185ab..30a22af 100644 --- a/tests/install-script.test.ts +++ b/tests/install-script.test.ts @@ -84,6 +84,12 @@ describe("install script", () => { }); expect(stdout).toContain("openbrain init"); expect(stdout).toContain("openbrain setup"); + + const packageJson = JSON.parse(await readFile(path.join(installDir, "package.json"), "utf8")); + for (const argument of ["version", "--version", "-V"]) { + const result = await execFileAsync(path.join(binDir, "openbrain"), [argument]); + expect(result.stdout.trim()).toBe(packageJson.version); + } }, 90_000); test("can preserve an existing executable wrapper during an update", async () => { From 60a23ee55e2d0b9627ee02324566feb5455f02eb Mon Sep 17 00:00:00 2001 From: James Nicholls Date: Sun, 2 Aug 2026 06:35:29 +0800 Subject: [PATCH 2/2] docs: list CLI version aliases --- src/cli.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/cli.ts b/src/cli.ts index fe21369..435743d 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -640,6 +640,8 @@ function printDreamResult(result: Awaited>) { function usage() { console.log(`Usage: openbrain version + openbrain --version + openbrain -V openbrain init openbrain update [--yes] openbrain setup [--brain-scope default|paths] [--path-rule ] [--codex yes|no] [--claude yes|no] [--disable-claude-auto-memory yes|no]