Add diff command to show unstaged changes in a session's worktree

This commit is contained in:
Chris Wanstrath 2026-02-19 09:46:09 -08:00
parent 37136f5e04
commit 3c77c43999

View File

@ -225,6 +225,27 @@ program
spin.succeed(`Saved: ${msg}`)
})
// ── sandlot diff <branch> ───────────────────────────────────────────
program
.command("diff")
.argument("<branch>", "branch name")
.description("Show unstaged changes in a session's worktree")
.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)
}
const result = await $`git -C ${session.worktree} diff`.nothrow()
if (result.exitCode !== 0) {
console.error("git diff failed")
process.exit(1)
}
})
// ── sandlot vm ───────────────────────────────────────────────────────
const vmCmd = program.command("vm").description("Manage the sandlot VM")