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")