Add optional prompt argument to review command
This commit is contained in:
parent
7c9a5a8672
commit
c2a082b780
|
|
@ -148,6 +148,7 @@ program
|
||||||
program
|
program
|
||||||
.command("review")
|
.command("review")
|
||||||
.argument("<branch>", "branch name")
|
.argument("<branch>", "branch name")
|
||||||
|
.argument("[prompt]", "additional instructions to append to the review prompt")
|
||||||
.option("-p, --print", "print the review to stdout instead of launching interactive mode")
|
.option("-p, --print", "print the review to stdout instead of launching interactive mode")
|
||||||
.description("Launch an interactive grumpy code review for a branch")
|
.description("Launch an interactive grumpy code review for a branch")
|
||||||
.action(reviewAction)
|
.action(reviewAction)
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,14 @@ import * as vm from "../vm.ts"
|
||||||
import { spinner } from "../spinner.ts"
|
import { spinner } from "../spinner.ts"
|
||||||
import { requireSession, saveChanges } from "./helpers.ts"
|
import { requireSession, saveChanges } from "./helpers.ts"
|
||||||
|
|
||||||
export async function action(branch: string, opts: { print?: boolean }) {
|
export async function action(branch: string, extra: string | undefined, opts: { print?: boolean }) {
|
||||||
const { session } = await requireSession(branch)
|
const { session } = await requireSession(branch)
|
||||||
|
|
||||||
const spin = spinner("Starting container", branch)
|
const spin = spinner("Starting container", branch)
|
||||||
await vm.ensure((msg) => { spin.text = msg })
|
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."
|
let 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 (extra) prompt += "\n\n" + extra
|
||||||
|
|
||||||
if (opts.print) {
|
if (opts.print) {
|
||||||
spin.text = "Running review…"
|
spin.text = "Running review…"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user