add dir command to print worktree path for a session

This commit is contained in:
Chris Wanstrath 2026-02-19 11:21:03 -08:00
parent 38c767ef29
commit d5bab69367

View File

@ -399,6 +399,23 @@ program
} }
}) })
// ── sandlot dir <branch> ────────────────────────────────────────────
program
.command("dir")
.argument("<branch>", "branch name")
.description("Print the worktree path for a session")
.action(async (branch: string) => {
const root = await git.repoRoot()
const session = await state.getSession(root, branch)
if (!session) {
console.error(`No session found for branch "${branch}".`)
process.exit(1)
}
process.stdout.write(session.worktree + "\n")
})
// ── sandlot vm ─────────────────────────────────────────────────────── // ── sandlot vm ───────────────────────────────────────────────────────
const vmCmd = program.command("vm").description("Manage the sandlot VM") const vmCmd = program.command("vm").description("Manage the sandlot VM")