From b67f1c82ed43e74633a0c06d633bf914a226341d Mon Sep 17 00:00:00 2001 From: Chris Wanstrath Date: Thu, 19 Feb 2026 09:46:54 -0800 Subject: [PATCH] feat: auto-derive branch name from prompt when spaces detected --- src/cli.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/cli.ts b/src/cli.ts index 6879d4b..db9763f 100755 --- a/src/cli.ts +++ b/src/cli.ts @@ -20,10 +20,21 @@ program.name("sandlot").description("Branch-based development with git worktrees program .command("new") - .argument("", "branch name") + .argument("", "branch name or prompt (if it contains spaces)") .argument("[prompt]", "initial prompt for Claude") .description("Create a new session and launch Claude") .action(async (branch: string, prompt?: string) => { + // If the "branch" contains spaces, it's actually a prompt — derive the branch name + if (branch.includes(" ")) { + prompt = branch + branch = branch + .toLowerCase() + .replace(/[^a-z0-9\s-]/g, "") + .trim() + .replace(/\s+/g, "-") + .slice(0, 20) + .replace(/-$/, "") + } const root = await git.repoRoot() const worktreeAbs = join(homedir(), '.sandlot', basename(root), branch)