From 10ebfcf754885cc158115d7ad443939bfd6ee8e6 Mon Sep 17 00:00:00 2001 From: Chris Wanstrath Date: Sun, 22 Feb 2026 07:17:03 -0800 Subject: [PATCH] Update CLI description, help/version options, and add version command --- src/cli.ts | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/cli.ts b/src/cli.ts index 73a5a38..68dfd78 100755 --- a/src/cli.ts +++ b/src/cli.ts @@ -1,6 +1,7 @@ #!/usr/bin/env bun -import { Command } from "commander" +import { Command, Option } from "commander" +import { yellow, reset } from "./fmt.ts" import * as git from "./git.ts" import * as state from "./state.ts" import { action as newAction } from "./commands/new.ts" @@ -25,7 +26,18 @@ const pkg = await Bun.file(new URL("../package.json", import.meta.url)).json() const program = new Command() -program.name("sandlot").description("Branch-based development with git worktrees and Apple Container").version(pkg.version) +program + .name("sandlot") + .description("Sandboxed development with Claude.") + .configureHelp({ styleTitle: (str) => `${yellow}${str}${reset}` }) + .helpOption(false) + .addOption(new Option("-h, --help").hideHelp()) + .on("option:help", () => program.help()) + .addOption(new Option("-V, --version").hideHelp()) + .on("option:version", () => { + console.log(pkg.version) + process.exit(0) + }) // ── Sessions ──────────────────────────────────────────────────────── @@ -50,7 +62,7 @@ program .argument("[prompt]", "initial prompt for Claude") .option("-p, --print ", "run Claude in non-interactive mode with -p") .option("-n, --no-save", "skip auto-save after Claude exits") - .description("Re-enter an existing session") + .description("Open an existing Claude session") .action(openAction) program @@ -144,6 +156,13 @@ program registerVmCommands(program) +program + .command("version") + .description("Print the version number") + .action(() => { + console.log(pkg.version) + }) + program .command("completions") .option("--install", "Output a shell script that installs the completions file")