ReviewOS

also looking at this

stacks/buddy

feat(touch): post the checkboxes the finishing-touch flow waits on

#1424
Merged glennmichael123 wants to merge fix/touch-offer into main
7 files +149 -5
bin/cli.tsmodified+27-1
Changes to bin/cli.ts
@@ -2749,13 +2749,16 @@ cli
27492749cli
27502750 .command('touch <pr-number>', 'Run a finishing touch ticked on a pull request, as a stacked PR')
27512751 .option('--name <touch>', 'Run a specific touch rather than reading the checkboxes')
2752 .option('--offer', 'Post the checkboxes on the pull request rather than running one')
27522753 .option('--test-command <command>', 'Command that verifies the change')
27532754 .option('--dry-run', 'Report what would run without acting')
27542755 .option('--verbose, -v', 'Enable verbose logging')
27552756 .example('buddy touch 42')
2757 .example('buddy touch 42 --offer')
27562758 .example('buddy touch 42 --name unit-tests')
27572759 .action(async (prNumber: string, options: CLIOptions & {
27582760 name?: string
2761 offer?: boolean
27592762 testCommand?: string
27602763 dryRun?: boolean
27612764 }) => {
@@ -2773,7 +2776,30 @@ cli
27732776 process.exit(1)
27742777 }
27752778
2776 const { FINISHING_TOUCHES, getFinishingTouch, parseTouchSelections } = await import('../src/agent/tasks')
2779 const { FINISHING_TOUCHES, getFinishingTouch, hasTouchOffer, parseTouchSelections, withTouchOffer }
2780 = await import('../src/agent/tasks')
2781
2782 // Posting the offer is what makes the checkboxes exist. `renderTouchOffer`
2783 // had no production caller, so `buddy touch` read ticks from a body that
2784 // nothing ever wrote them into — the documented "tick a box" flow could
2785 // not start.
2786 if (options.offer) {
2787 if (hasTouchOffer(pullRequest.body)) {
2788 logger.info(`ℹ️ PR #${pullRequest.number} already carries the finishing-touch offer`)
2789 return
2790 }
2791
2792 const body = withTouchOffer(pullRequest.body)
2793
2794 if (options.dryRun) {
2795 logger.info(`🔍 [DRY RUN] Would offer finishing touches on PR #${pullRequest.number}`)
2796 return
2797 }
2798
2799 await provider.updatePullRequest(pullRequest.number, { body })
2800 logger.success(`✅ Offered finishing touches on PR #${pullRequest.number}`)
2801 return
2802 }
27772803
27782804 // The checkboxes are the request. A touch named on the command line is
27792805 // the manual path, for a maintainer who did not want to tick a box.