close not rm

This commit is contained in:
Chris Wanstrath 2026-02-17 18:31:43 -08:00
parent f27eccf5b0
commit 19a1d0c563

View File

@ -96,28 +96,35 @@ program
await vm.claude(join(root, session.worktree))
})
// ── sandlot rm <branch> ──────────────────────────────────────────────
// ── sandlot close <branch> ───────────────────────────────────────────
const closeAction = async (branch: string) => {
const root = await git.repoRoot()
const session = await state.getSession(root, branch)
const worktreeRel = session?.worktree ?? `.sandlot/${branch}`
const worktreeAbs = join(root, worktreeRel)
await git.removeWorktree(worktreeAbs, root)
console.log(`Removed worktree ${worktreeRel}/`)
await git.deleteLocalBranch(branch, root)
console.log(`Deleted local branch ${branch}`)
if (session) {
await state.removeSession(root, branch)
}
}
program
.command("rm")
.command("close")
.argument("<branch>", "branch name")
.description("Remove a worktree and clean up the session")
.action(async (branch: string) => {
const root = await git.repoRoot()
const session = await state.getSession(root, branch)
const worktreeRel = session?.worktree ?? `.sandlot/${branch}`
const worktreeAbs = join(root, worktreeRel)
.action(closeAction)
await git.removeWorktree(worktreeAbs, root)
console.log(`Removed worktree ${worktreeRel}/`)
await git.deleteLocalBranch(branch, root)
console.log(`Deleted local branch ${branch}`)
if (session) {
await state.removeSession(root, branch)
}
})
program
.command("rm", { hidden: true })
.argument("<branch>", "branch name")
.action(closeAction)
// ── sandlot vm ───────────────────────────────────────────────────────