Merge branch 'auto-branch'

# Conflicts:
#	src/cli.ts
This commit is contained in:
Chris Wanstrath 2026-02-19 09:50:55 -08:00
commit dddd4259f0

View File

@ -20,11 +20,22 @@ program.name("sandlot").description("Branch-based development with git worktrees
program
.command("new")
.argument("<branch>", "branch name")
.argument("<branch>", "branch name or prompt (if it contains spaces)")
.argument("[prompt]", "initial prompt for Claude")
.option("-p, --print <prompt>", "run Claude in non-interactive mode with -p")
.description("Create a new session and launch Claude")
.action(async (branch: string, prompt: string | undefined, opts: { print?: 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)