Open History to see the last commit
1import type { PRTriage } from './types'
2
3/**
4 * HTML markers embedded in bot comments so sweeps stay idempotent: before
5 * posting, the sweep checks the item's timeline for the marker.
6 */
7export const ACK_MARKER = '<!-- tanstack-ai-maintainer-bot:ack -->'
8export const REPRO_MARKER = '<!-- tanstack-ai-maintainer-bot:repro -->'
9
10function checklistLine(ok: boolean, okText: string, warnText: string): string {
11 return ok ? `- ✅ ${okText}` : `- ⚠️ ${warnText}`
12}
13
14export function buildAckComment(triage: PRTriage, assignee: string): string {
15 const pr = triage.item
16 const author = pr.author ? `@${pr.author}` : 'there'
17 const lines = [
18 `Thanks for the PR, ${author}! 🙌 @${assignee} will take a look.`,
19 '',
20 '**Automated pre-review checks**',
21 checklistLine(
22 !triage.ciFailing,
23 pr.ciState === 'success' ? 'CI passing' : 'CI pending',
24 'CI failing — worth a look before review',
25 ),
26 checklistLine(
27 !triage.hasConflicts,
28 'No merge conflicts',
29 'Merge conflicts with `main` — please rebase',
30 ),
31 checklistLine(
32 !triage.missingChangeset,
33 'Changeset present',
34 'No changeset found — run `pnpm changeset` if this changes published packages',
35 ),
36 checklistLine(
37 !triage.missingE2E,
38 'E2E test changes included',
39 'No E2E test changes detected — behavior changes need coverage under `testing/e2e/` (see CONTRIBUTING)',
40 ),
41 '',
42 '<sub>Automated triage — a human review follows.</sub>',
43 ACK_MARKER,
44 ]
45 return lines.join('\n')
46}
47
48export function buildReproComment(author: string | null): string {
49 const mention = author ? `@${author}` : 'there'
50 return [
51 `Thanks for the report, ${mention}! To help us reproduce this, could you add a minimal reproduction?`,
52 '',
53 'A runnable example makes fixes dramatically faster — you can fork one of the [official examples](https://github.com/TanStack/ai/tree/main/examples/), or use [StackBlitz](https://stackblitz.com/) / [CodeSandbox](https://codesandbox.io/). For TypeScript-only issues, a [TS Playground](https://www.typescriptlang.org/play) link works too.',
54 '',
55 '<sub>Automated triage — a maintainer will follow up.</sub>',
56 REPRO_MARKER,
57 ].join('\n')
58}