From 3c77c439990cdf12c966fe88b15a544d08541c14 Mon Sep 17 00:00:00 2001 From: Chris Wanstrath Date: Thu, 19 Feb 2026 09:46:09 -0800 Subject: [PATCH] Add `diff` command to show unstaged changes in a session's worktree --- src/cli.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/cli.ts b/src/cli.ts index 6946c54..60e53ad 100755 --- a/src/cli.ts +++ b/src/cli.ts @@ -225,6 +225,27 @@ program spin.succeed(`Saved: ${msg}`) }) +// ── sandlot diff ─────────────────────────────────────────── + +program + .command("diff") + .argument("", "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")