ReviewOS

also looking at this

stacks/buddy

fix(review): honour the ai.review settings that nothing read

#1406
Merged glennmichael123 wants to merge fix/honour-review-filters into main
7 files +282 -8
bin/cli.tsmodified+16-1
Changes to bin/cli.ts
@@ -291,6 +291,8 @@ interface CLIOptions {
291291 respectLatest?: boolean
292292 /** Which settings pages `open-settings` should open: repo, org or both. */
293293 type?: string
294 /** Set by the generated workflow: honour the `ai.review` filters. */
295 auto?: boolean
294296}
295297
296298cli
@@ -1558,6 +1560,7 @@ cli
15581560 .option('--fail-on <severity>', 'Exit non-zero when a finding at or above this severity is found')
15591561 .option('--profile <name>', 'Review profile: chill|assertive')
15601562 .option('--summary-only', 'Post only the summary, without inline findings')
1563 .option('--auto', 'Treat this as an automatic trigger, honouring the ai.review filters')
15611564 .option('--dry-run', 'Print the review instead of posting it')
15621565 .example('buddy review 42')
15631566 .example('buddy review --staged --light')
@@ -1621,12 +1624,24 @@ cli
16211624 gitProvider = await providerFor(config, 'reviewing a pull request', log)
16221625
16231626 const number = Number.parseInt(prNumber, 10)
1624 diff = await gitProvider.getPullRequestDiff(number)
16251627
16261628 // Carry forward what earlier reviews already said, so a re-review
16271629 // reports only what is new rather than repeating itself.
16281630 const prs = await gitProvider.getPullRequests('open')
16291631 const pr = prs.find(candidate => candidate.number === number)
1632
1633 // `--auto` is what the generated workflow passes. Without it this is
1634 // someone at a terminal, who has already decided they want a review.
1635 if (pr) {
1636 const { reviewSkipReason } = await import('../src/review/filters')
1637 const skip = reviewSkipReason(config, pr, options.auto ? 'automatic' : 'requested')
1638 if (skip) {
1639 log.info(`🔍 Skipping PR #${number}: ${skip}`)
1640 return
1641 }
1642 }
1643
1644 diff = await gitProvider.getPullRequestDiff(number)
16301645 const state = parseReviewState(pr?.body)
16311646 seenFingerprints = state?.fingerprints ?? []
16321647 prBody = pr?.body ?? null