also looking at this
feat(touch): post the checkboxes the finishing-touch flow waits on
#1424
7 files
+149
-5
| @@ -2749,13 +2749,16 @@ cli | ||
| 2749 | 2749 | cli |
| 2750 | 2750 | .command('touch <pr-number>', 'Run a finishing touch ticked on a pull request, as a stacked PR') |
| 2751 | 2751 | .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') | |
| 2752 | 2753 | .option('--test-command <command>', 'Command that verifies the change') |
| 2753 | 2754 | .option('--dry-run', 'Report what would run without acting') |
| 2754 | 2755 | .option('--verbose, -v', 'Enable verbose logging') |
| 2755 | 2756 | .example('buddy touch 42') |
| 2757 | .example('buddy touch 42 --offer') | |
| 2756 | 2758 | .example('buddy touch 42 --name unit-tests') |
| 2757 | 2759 | .action(async (prNumber: string, options: CLIOptions & { |
| 2758 | 2760 | name?: string |
| 2761 | offer?: boolean | |
| 2759 | 2762 | testCommand?: string |
| 2760 | 2763 | dryRun?: boolean |
| 2761 | 2764 | }) => { |
| @@ -2773,7 +2776,30 @@ cli | ||
| 2773 | 2776 | process.exit(1) |
| 2774 | 2777 | } |
| 2775 | 2778 | |
| 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 | } | |
| 2777 | 2803 | |
| 2778 | 2804 | // The checkboxes are the request. A touch named on the command line is |
| 2779 | 2805 | // the manual path, for a maintainer who did not want to tick a box. |