diff --git a/src/cli.ts b/src/cli.ts index cecc4f5..6c39087 100755 --- a/src/cli.ts +++ b/src/cli.ts @@ -323,6 +323,38 @@ program if (opts.save !== false) await saveChanges(session.worktree) }) +// ── sandlot review ────────────────────────────────────────── + +program + .command("review") + .argument("", "branch name") + .option("-p, --print", "print the review to stdout instead of launching interactive mode") + .description("Launch an interactive grumpy code review for a branch") + .action(async (branch: string, opts: { print?: boolean }) => { + 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 spin = spinner("Starting container") + await vm.ensure((msg) => { spin.text = msg }) + + const prompt = "You're a grumpy old senior software engineer. Take a look at the diff between this branch and main, then let me know your thoughts. My co-worker made these changes." + + if (opts.print) { + spin.text = "Running review…" + const output = await vm.claude(session.worktree, { print: prompt }) + spin.stop() + if (output) process.stdout.write(output + "\n") + } else { + spin.succeed("Session ready") + await vm.claude(session.worktree, { prompt }) + } + }) + // ── sandlot close ─────────────────────────────────────────── const closeAction = async (branch: string) => {