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)) 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 program
.command("rm") .command("close")
.argument("<branch>", "branch name") .argument("<branch>", "branch name")
.description("Remove a worktree and clean up the session") .description("Remove a worktree and clean up the session")
.action(async (branch: string) => { .action(closeAction)
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) program
console.log(`Removed worktree ${worktreeRel}/`) .command("rm", { hidden: true })
.argument("<branch>", "branch name")
await git.deleteLocalBranch(branch, root) .action(closeAction)
console.log(`Deleted local branch ${branch}`)
if (session) {
await state.removeSession(root, branch)
}
})
// ── sandlot vm ─────────────────────────────────────────────────────── // ── sandlot vm ───────────────────────────────────────────────────────