From 9616bdac47505e4a14c36d667fcffc9ae97e1f2a Mon Sep 17 00:00:00 2001 From: Ben Brandt Date: Thu, 25 Jun 2026 14:37:02 +0200 Subject: [PATCH] feat: Add version flag handling (#813) Closes #809 --- src/index.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index ed674303..6b60e3ad 100644 --- a/src/index.ts +++ b/src/index.ts @@ -2,8 +2,12 @@ import { resolveSettings } from "@anthropic-ai/claude-agent-sdk"; import { claudeCliPath, runAcp } from "./acp-agent.js"; +import packageJson from "../package.json" with { type: "json" }; -if (process.argv.includes("--cli")) { +if (process.argv.includes("--version") || process.argv.includes("-v")) { + console.log(packageJson.version); + process.exit(0); +} else if (process.argv.includes("--cli")) { const { spawn } = await import("node:child_process"); const args = process.argv.slice(2).filter((arg) => arg !== "--cli"); const child = spawn(await claudeCliPath(), args, { stdio: "inherit" });