clud-bug 0.6.34 → 0.7.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/clud-bug.js +10 -1353
- package/dist/cli/agents-md.d.ts +16 -0
- package/dist/cli/agents-md.d.ts.map +1 -0
- package/dist/cli/agents-md.js +226 -0
- package/dist/cli/agents-md.js.map +1 -0
- package/dist/cli/audit.d.ts +13 -0
- package/dist/cli/audit.d.ts.map +1 -0
- package/dist/cli/audit.js +90 -0
- package/dist/cli/audit.js.map +1 -0
- package/dist/cli/branch-protection.d.ts +57 -0
- package/dist/cli/branch-protection.d.ts.map +1 -0
- package/dist/cli/branch-protection.js +118 -0
- package/dist/cli/branch-protection.js.map +1 -0
- package/dist/cli/edit-workflow.d.ts +18 -0
- package/dist/cli/edit-workflow.d.ts.map +1 -0
- package/dist/cli/edit-workflow.js +43 -0
- package/dist/cli/edit-workflow.js.map +1 -0
- package/dist/cli/index.d.ts +8 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +18 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/main.d.ts +3 -0
- package/dist/cli/main.d.ts.map +1 -0
- package/dist/cli/main.js +1336 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/cli/skill-usage.d.ts +109 -0
- package/dist/cli/skill-usage.d.ts.map +1 -0
- package/dist/cli/skill-usage.js +380 -0
- package/dist/cli/skill-usage.js.map +1 -0
- package/dist/cli/skills.d.ts +56 -0
- package/dist/cli/skills.d.ts.map +1 -0
- package/dist/cli/skills.js +292 -0
- package/dist/cli/skills.js.map +1 -0
- package/dist/cli/update.d.ts +29 -0
- package/dist/cli/update.d.ts.map +1 -0
- package/dist/cli/update.js +186 -0
- package/dist/cli/update.js.map +1 -0
- package/dist/cli/usage.d.ts +142 -0
- package/dist/cli/usage.d.ts.map +1 -0
- package/dist/cli/usage.js +348 -0
- package/dist/cli/usage.js.map +1 -0
- package/dist/core/audit.d.ts +8 -0
- package/dist/core/audit.d.ts.map +1 -0
- package/dist/core/audit.js +47 -0
- package/dist/core/audit.js.map +1 -0
- package/dist/core/detect.d.ts +77 -0
- package/dist/core/detect.d.ts.map +1 -0
- package/dist/core/detect.js +262 -0
- package/dist/core/detect.js.map +1 -0
- package/dist/core/index.d.ts +11 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +31 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/prompt-builder.d.ts +164 -0
- package/dist/core/prompt-builder.d.ts.map +1 -0
- package/dist/core/prompt-builder.js +419 -0
- package/dist/core/prompt-builder.js.map +1 -0
- package/dist/core/prompts.d.ts +9 -0
- package/dist/core/prompts.d.ts.map +1 -0
- package/dist/core/prompts.js +401 -0
- package/dist/core/prompts.js.map +1 -0
- package/dist/core/render-review.d.ts +6 -0
- package/dist/core/render-review.d.ts.map +1 -0
- package/dist/core/render-review.js +219 -0
- package/dist/core/render-review.js.map +1 -0
- package/dist/core/render.d.ts +13 -0
- package/dist/core/render.d.ts.map +1 -0
- package/dist/core/render.js +80 -0
- package/dist/core/render.js.map +1 -0
- package/dist/core/review-schema-zod.d.ts +240 -0
- package/dist/core/review-schema-zod.d.ts.map +1 -0
- package/dist/core/review-schema-zod.js +218 -0
- package/dist/core/review-schema-zod.js.map +1 -0
- package/dist/core/review-schema.d.ts +42 -0
- package/dist/core/review-schema.d.ts.map +1 -0
- package/dist/core/review-schema.js +156 -0
- package/dist/core/review-schema.js.map +1 -0
- package/dist/core/review-writeback.d.ts +139 -0
- package/dist/core/review-writeback.d.ts.map +1 -0
- package/dist/core/review-writeback.js +313 -0
- package/dist/core/review-writeback.js.map +1 -0
- package/dist/core/skills.d.ts +122 -0
- package/dist/core/skills.d.ts.map +1 -0
- package/dist/core/skills.js +636 -0
- package/dist/core/skills.js.map +1 -0
- package/package.json +30 -4
- package/{lib/agents-md.js → src/cli/agents-md.ts} +25 -14
- package/{lib/audit.js → src/cli/audit.ts} +37 -44
- package/{lib/branch-protection.js → src/cli/branch-protection.ts} +75 -11
- package/{lib/edit-workflow.js → src/cli/edit-workflow.ts} +32 -11
- package/src/cli/index.ts +101 -0
- package/src/cli/main.ts +1376 -0
- package/{lib/skill-usage.js → src/cli/skill-usage.ts} +168 -94
- package/src/cli/skills.ts +386 -0
- package/{lib/update.js → src/cli/update.ts} +68 -27
- package/{lib/usage.js → src/cli/usage.ts} +167 -76
- package/src/core/audit.ts +53 -0
- package/{lib/detect.js → src/core/detect.ts} +100 -47
- package/src/core/index.ts +155 -0
- package/src/core/prompt-builder.ts +561 -0
- package/{lib/prompts.js → src/core/prompts.ts} +16 -2
- package/{lib/render-review.js → src/core/render-review.ts} +57 -25
- package/{lib/render.js → src/core/render.ts} +36 -10
- package/src/core/review-schema-zod.ts +262 -0
- package/{lib/review-schema.js → src/core/review-schema.ts} +68 -5
- package/src/core/review-writeback.ts +446 -0
- package/{lib/skills.js → src/core/skills.ts} +339 -342
- package/templates/workflow-py.yml.tmpl +2 -2
- package/templates/workflow-ts.yml.tmpl +2 -2
- package/templates/workflow.yml.tmpl +17 -8
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
// AI-Gateway prompt builder for the App (clud-bug-app) review pass.
|
|
2
|
+
//
|
|
3
|
+
// This module ports `clud-bug-app/lib/prompt-builder.ts` into core so the
|
|
4
|
+
// App can `import { buildReviewPrompt } from 'clud-bug/core'` and delete
|
|
5
|
+
// its local copy. The CLI runtime in `./prompts.ts` (single workflow-string
|
|
6
|
+
// `reviewPrompt`) stays — it's a different output contract (the YAML
|
|
7
|
+
// `prompt: |` field on the Action runner). The two coexist; the App picks
|
|
8
|
+
// `buildReviewPrompt`, the CLI picks `reviewPrompt`.
|
|
9
|
+
//
|
|
10
|
+
// Layout (composed in `buildReviewPrompt`):
|
|
11
|
+
//
|
|
12
|
+
// system:
|
|
13
|
+
// - Bot identity + role
|
|
14
|
+
// - Output-format contract (echoed from SPEC §1.8.1)
|
|
15
|
+
// - Severity taxonomy (red/yellow/purple) — semantic, not the emoji
|
|
16
|
+
//
|
|
17
|
+
// user:
|
|
18
|
+
// - PR metadata (owner/repo/PR#/base/head)
|
|
19
|
+
// - Skills section: for each loaded skill, the body + slug + applies_to
|
|
20
|
+
// - Diff section: one block per file with header + patch
|
|
21
|
+
//
|
|
22
|
+
// The model returns JSON conformant to `reviewSchema` (the Zod export in
|
|
23
|
+
// `./review-schema-zod.ts`). We do NOT ask the model to render markdown —
|
|
24
|
+
// that's the renderer's job, so the Action runner and the App produce
|
|
25
|
+
// byte-identical files (SPEC §6.2).
|
|
26
|
+
//
|
|
27
|
+
// Token discipline:
|
|
28
|
+
// - The App orchestrator already enforces a 100KB diff cap upstream.
|
|
29
|
+
// - We further truncate each file's patch at `MAX_PATCH_BYTES_PER_FILE`
|
|
30
|
+
// to spread budget across large PRs (vs one giant file eating it).
|
|
31
|
+
// - We strip applies_to-non-matching skills' bodies — they get a
|
|
32
|
+
// "(skipped: no matching files)" line so the model knows they exist
|
|
33
|
+
// but doesn't pay context for their content.
|
|
34
|
+
//
|
|
35
|
+
// Skill-body byte cap:
|
|
36
|
+
// The App reads `MAX_SKILL_BYTES` from its env schema (which sources from
|
|
37
|
+
// the workflow template's matching env var). When core runs outside the
|
|
38
|
+
// App (e.g. in a future CLI port), the env var won't exist. Callers may
|
|
39
|
+
// supply `maxSkillBytes` explicitly via the `BuildReviewPromptInput`;
|
|
40
|
+
// the default falls back to 8192 (SPEC §1.10 recommended ceiling).
|
|
41
|
+
/** Max bytes of patch per file to include in the prompt. Beyond this we
|
|
42
|
+
* truncate with a `... (N bytes omitted)` marker so the model knows the
|
|
43
|
+
* file kept going.
|
|
44
|
+
*/
|
|
45
|
+
export const MAX_PATCH_BYTES_PER_FILE = 16 * 1024; // 16 KiB
|
|
46
|
+
/** Default skill-body byte cap when the caller doesn't supply one.
|
|
47
|
+
* Matches SPEC §1.10 ceiling + the App's `MAX_SKILL_BYTES` env default
|
|
48
|
+
* (see clud-bug-app/lib/env.ts).
|
|
49
|
+
*/
|
|
50
|
+
export const DEFAULT_MAX_SKILL_BYTES = 8192;
|
|
51
|
+
/**
|
|
52
|
+
* System prompt — the bot's role and the output contract.
|
|
53
|
+
*
|
|
54
|
+
* We embed the SPEC §1.8 severity taxonomy verbatim so the model's
|
|
55
|
+
* categorization matches the writeback file's bucket names.
|
|
56
|
+
*/
|
|
57
|
+
const SYSTEM_PROMPT = `You are clud-bug, an automated pull request reviewer.
|
|
58
|
+
|
|
59
|
+
Your job: review the diff against the loaded skills. For each issue you find, cite the specific skill (by slug) that triggered it. Skip nits and style preferences — the loaded skills define what counts.
|
|
60
|
+
|
|
61
|
+
Output a single JSON object conforming to the provided schema. Do NOT output markdown, prose, or explanation outside the JSON.
|
|
62
|
+
|
|
63
|
+
Severity taxonomy:
|
|
64
|
+
- critical: correctness bugs, security issues, performance regressions that must be fixed before merge.
|
|
65
|
+
- minor: actionable issues that should be fixed but don't block merge.
|
|
66
|
+
- preexisting: issues already on the base branch (not introduced by this PR). Surface as informational only.
|
|
67
|
+
|
|
68
|
+
Rules:
|
|
69
|
+
1. Every finding MUST cite a skill slug from the loaded skill list.
|
|
70
|
+
2. Every finding MUST name a file and (when known) a line number from the diff.
|
|
71
|
+
3. Keep summaries one line. Keep reasoning one line.
|
|
72
|
+
4. If no skills are loaded, return findings: [] with status_header: "bare".
|
|
73
|
+
5. If skills are loaded but the diff is clean, return findings: [] with status_header: "clean".
|
|
74
|
+
6. Otherwise status_header is "critical findings" if there are any critical findings, else "clean".
|
|
75
|
+
`;
|
|
76
|
+
/**
|
|
77
|
+
* Builds the system + user prompt pair for the review call.
|
|
78
|
+
*/
|
|
79
|
+
export function buildReviewPrompt(input) {
|
|
80
|
+
const { repo, pr, diff, skills, maxSkillBytes } = input;
|
|
81
|
+
const skillCap = maxSkillBytes ?? DEFAULT_MAX_SKILL_BYTES;
|
|
82
|
+
const includedSkillSlugs = [];
|
|
83
|
+
const skippedFiles = [];
|
|
84
|
+
// ---- Skills section -----------------------------------------------------
|
|
85
|
+
const skillsBlock = renderSkillsBlock(skills, diff.files, skillCap, (slug) => {
|
|
86
|
+
includedSkillSlugs.push(slug);
|
|
87
|
+
});
|
|
88
|
+
// ---- Diff section -------------------------------------------------------
|
|
89
|
+
const diffBlock = renderDiffBlock(diff.files, (path) => {
|
|
90
|
+
skippedFiles.push(path);
|
|
91
|
+
});
|
|
92
|
+
// ---- User prompt assembly ----------------------------------------------
|
|
93
|
+
const prompt = [
|
|
94
|
+
`# Pull request: ${repo.owner}/${repo.name}#${pr.number}`,
|
|
95
|
+
pr.title ? `**Title:** ${pr.title}` : '',
|
|
96
|
+
`**Base:** \`${pr.baseRef}\` @ ${diff.baseSha.slice(0, 12)}`,
|
|
97
|
+
`**Head:** \`${pr.headRef}\` @ ${diff.headSha.slice(0, 12)}`,
|
|
98
|
+
`**Files changed:** ${diff.files.length} · **Lines:** +${countAdditions(diff.files)} −${countDeletions(diff.files)}`,
|
|
99
|
+
'',
|
|
100
|
+
'## Loaded skills',
|
|
101
|
+
'',
|
|
102
|
+
skillsBlock,
|
|
103
|
+
'',
|
|
104
|
+
'## Diff',
|
|
105
|
+
'',
|
|
106
|
+
diffBlock,
|
|
107
|
+
'',
|
|
108
|
+
'## Task',
|
|
109
|
+
'',
|
|
110
|
+
'Produce the JSON review object. Cite skills by slug. Empty findings list is acceptable; status_header reflects that.',
|
|
111
|
+
]
|
|
112
|
+
.filter((line) => line !== '') // collapse intentional blanks back later
|
|
113
|
+
.join('\n');
|
|
114
|
+
return {
|
|
115
|
+
system: SYSTEM_PROMPT,
|
|
116
|
+
prompt,
|
|
117
|
+
includedSkillSlugs,
|
|
118
|
+
skippedFiles,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
function renderSkillsBlock(skills, changedFiles, maxSkillBytes, noteIncluded) {
|
|
122
|
+
if (skills.length === 0) {
|
|
123
|
+
return 'No skills are installed at the PR base ref. The repository has not been initialized for clud-bug review yet. Return `findings: []` with `status_header: "bare"`.';
|
|
124
|
+
}
|
|
125
|
+
const changedPaths = changedFiles.map((f) => f.path);
|
|
126
|
+
const blocks = [];
|
|
127
|
+
for (const skill of skills) {
|
|
128
|
+
const { slug, frontmatter, body } = skill;
|
|
129
|
+
const matchesDiff = skillMatchesDiff(frontmatter.applies_to, changedPaths);
|
|
130
|
+
if (!matchesDiff) {
|
|
131
|
+
// Tell the model the skill exists but its applies_to didn't fire on
|
|
132
|
+
// this diff — keeps it from inventing findings against an irrelevant
|
|
133
|
+
// skill but signals that the skill is present in the catalog.
|
|
134
|
+
blocks.push(`### ${slug}\n_(skipped: applies_to didn't match any changed file)_`);
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
noteIncluded(slug);
|
|
138
|
+
const header = [
|
|
139
|
+
`### ${slug}`,
|
|
140
|
+
`_${frontmatter.description}_`,
|
|
141
|
+
frontmatter.applies_to
|
|
142
|
+
? `applies_to: ${JSON.stringify(frontmatter.applies_to)}`
|
|
143
|
+
: '',
|
|
144
|
+
]
|
|
145
|
+
.filter(Boolean)
|
|
146
|
+
.join('\n');
|
|
147
|
+
// Bug 8 (2026-06-08): cap each skill body at maxSkillBytes. SPEC
|
|
148
|
+
// §1.10 recommends 8192 byte ceiling; the App's env-default and the
|
|
149
|
+
// CLI's MAX_SKILL_BYTES env both wire to the same number.
|
|
150
|
+
// Truncated bodies still let the model use the skill but with bounded
|
|
151
|
+
// input cost. Append a marker so the model knows the cut happened.
|
|
152
|
+
//
|
|
153
|
+
// NB: cut via UTF-8 byte buffer, not String.slice. String.slice walks
|
|
154
|
+
// UTF-16 code units; for multi-byte content (CJK, emoji) the result
|
|
155
|
+
// can exceed the byte budget by up to 4×, defeating the cap. clud-bug-
|
|
156
|
+
// review #158 flagged the original code-unit slice as a bug.
|
|
157
|
+
const trimmedBody = body.trim();
|
|
158
|
+
const cappedBody = Buffer.byteLength(trimmedBody, 'utf8') > maxSkillBytes
|
|
159
|
+
? `${sliceUtf8Bytes(trimmedBody, maxSkillBytes)}\n\n_(truncated at ${maxSkillBytes} bytes — see SKILL.md for full body)_`
|
|
160
|
+
: trimmedBody;
|
|
161
|
+
blocks.push(`${header}\n\n${cappedBody}`);
|
|
162
|
+
}
|
|
163
|
+
return blocks.join('\n\n---\n\n');
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Returns true when the diff includes at least one file matching the
|
|
167
|
+
* applies_to clause. Absent applies_to → matches everything.
|
|
168
|
+
*/
|
|
169
|
+
export function skillMatchesDiff(appliesTo, changedPaths) {
|
|
170
|
+
if (!appliesTo)
|
|
171
|
+
return true;
|
|
172
|
+
const { paths, extensions } = appliesTo;
|
|
173
|
+
// If neither paths nor extensions are set, fall through to "matches all".
|
|
174
|
+
if (!paths?.length && !extensions?.length)
|
|
175
|
+
return true;
|
|
176
|
+
return changedPaths.some((path) => {
|
|
177
|
+
if (extensions?.some((ext) => path.endsWith(ext)))
|
|
178
|
+
return true;
|
|
179
|
+
if (paths?.some((pattern) => globMatch(pattern, path)))
|
|
180
|
+
return true;
|
|
181
|
+
return false;
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Very small glob matcher supporting `**` (any path segment) and `*`
|
|
186
|
+
* (any chars within a segment). Sufficient for the SPEC §1.10 examples
|
|
187
|
+
* (`src/**`, `*.ts`). Not a drop-in replacement for `minimatch`; if we
|
|
188
|
+
* need negation / brace expansion later, swap to minimatch — but adding
|
|
189
|
+
* a dependency for two characters of syntax isn't worth it yet.
|
|
190
|
+
*
|
|
191
|
+
* Exported because the App's skill-routing code reuses it for an
|
|
192
|
+
* orchestrator-side pre-filter that runs before prompt construction.
|
|
193
|
+
*/
|
|
194
|
+
export function globMatch(pattern, path) {
|
|
195
|
+
// Escape regex specials, then expand `**` → `.*` and `*` → `[^/]*`.
|
|
196
|
+
// Order matters: `**` must be replaced before `*`.
|
|
197
|
+
const escaped = pattern
|
|
198
|
+
.replace(/[.+^${}()|[\]\\]/g, '\\$&')
|
|
199
|
+
.replace(/\*\*/g, ' ') // sentinel so the next replace doesn't double-process
|
|
200
|
+
.replace(/\*/g, '[^/]*')
|
|
201
|
+
.replace(/ /g, '.*');
|
|
202
|
+
const re = new RegExp(`^${escaped}$`);
|
|
203
|
+
return re.test(path);
|
|
204
|
+
}
|
|
205
|
+
function renderDiffBlock(files, noteSkipped) {
|
|
206
|
+
if (files.length === 0) {
|
|
207
|
+
return '_(empty diff)_';
|
|
208
|
+
}
|
|
209
|
+
const blocks = [];
|
|
210
|
+
for (const file of files) {
|
|
211
|
+
if (!file.patch) {
|
|
212
|
+
noteSkipped(file.path);
|
|
213
|
+
blocks.push(`### ${file.path}\n_(no patch — likely binary, too large, or removed)_\nstatus: ${file.status} · +${file.additions} / −${file.deletions}`);
|
|
214
|
+
continue;
|
|
215
|
+
}
|
|
216
|
+
const truncated = truncatePatch(file.patch);
|
|
217
|
+
blocks.push(`### ${file.path}\nstatus: ${file.status} · +${file.additions} / −${file.deletions}\n\n\`\`\`diff\n${truncated}\n\`\`\``);
|
|
218
|
+
}
|
|
219
|
+
return blocks.join('\n\n');
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Truncates a patch to `MAX_PATCH_BYTES_PER_FILE`, appending a marker so
|
|
223
|
+
* the model knows it didn't see the whole file.
|
|
224
|
+
*
|
|
225
|
+
* Cut via UTF-8 byte buffer (see sliceUtf8Bytes) so multi-byte content
|
|
226
|
+
* — emoji in commit-author lines, CJK identifiers — doesn't blow past
|
|
227
|
+
* the byte cap. clud-bug-review #158 flagged the original code-unit
|
|
228
|
+
* slice as a contract violation when content went non-ASCII.
|
|
229
|
+
*/
|
|
230
|
+
export function truncatePatch(patch) {
|
|
231
|
+
const size = Buffer.byteLength(patch, 'utf8');
|
|
232
|
+
if (size <= MAX_PATCH_BYTES_PER_FILE)
|
|
233
|
+
return patch;
|
|
234
|
+
const sliced = sliceUtf8Bytes(patch, MAX_PATCH_BYTES_PER_FILE);
|
|
235
|
+
const omitted = size - Buffer.byteLength(sliced, 'utf8');
|
|
236
|
+
return `${sliced}\n... (${omitted} bytes omitted)`;
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Slice a string to at most `maxBytes` UTF-8 bytes, trimming any trailing
|
|
240
|
+
* partial codepoint (so the output is always a valid UTF-8 string).
|
|
241
|
+
*
|
|
242
|
+
* Why we need this: `String.prototype.slice(0, N)` keeps N UTF-16 code
|
|
243
|
+
* units, not N bytes. A skill body of CJK characters at maxSkillBytes=8192
|
|
244
|
+
* would actually carry 3*8192 ≈ 24KiB of UTF-8 bytes — silently busting
|
|
245
|
+
* the cap the call site exists to enforce. Buffer-based slicing is
|
|
246
|
+
* authoritative; we then decode back as UTF-8 with `fatal: false` so a
|
|
247
|
+
* trailing partial codepoint becomes a single replacement character that
|
|
248
|
+
* we strip below.
|
|
249
|
+
*
|
|
250
|
+
* For pure-ASCII content (the dominant case for skill files + diffs), this
|
|
251
|
+
* is bit-equivalent to String.slice. The fix only kicks in on multibyte.
|
|
252
|
+
*/
|
|
253
|
+
export function sliceUtf8Bytes(input, maxBytes) {
|
|
254
|
+
if (maxBytes <= 0)
|
|
255
|
+
return '';
|
|
256
|
+
if (Buffer.byteLength(input, 'utf8') <= maxBytes)
|
|
257
|
+
return input;
|
|
258
|
+
const buf = Buffer.from(input, 'utf8').subarray(0, maxBytes);
|
|
259
|
+
// Strict decode would fail on a partial codepoint at the tail; lenient
|
|
260
|
+
// decode produces a U+FFFD replacement character. Strip any trailing
|
|
261
|
+
// U+FFFD so we don't leak it into the prompt / writeback file.
|
|
262
|
+
const decoder = new TextDecoder('utf-8', { fatal: false });
|
|
263
|
+
return decoder.decode(buf).replace(/�+$/, '');
|
|
264
|
+
}
|
|
265
|
+
function countAdditions(files) {
|
|
266
|
+
return files.reduce((a, f) => a + f.additions, 0);
|
|
267
|
+
}
|
|
268
|
+
function countDeletions(files) {
|
|
269
|
+
return files.reduce((a, f) => a + f.deletions, 0);
|
|
270
|
+
}
|
|
271
|
+
// ---------------------------------------------------------------------------
|
|
272
|
+
// D.2.5 multi-pass prompt builders
|
|
273
|
+
// ---------------------------------------------------------------------------
|
|
274
|
+
/**
|
|
275
|
+
* Cross-check Pass-2 system prompt.
|
|
276
|
+
*
|
|
277
|
+
* Pass 2 sees Pass 1's findings + the diff and produces a structured
|
|
278
|
+
* judgement: per-finding `agreed`/`disagreed` + a list of independently
|
|
279
|
+
* discovered findings. The App aggregator turns that into the per-finding
|
|
280
|
+
* attribution lines the renderer shows inline.
|
|
281
|
+
*
|
|
282
|
+
* The schema for this output lives in `./review-schema-zod.ts` (see
|
|
283
|
+
* `crossCheckSchema`). We keep the prompt embed minimal — the AI SDK
|
|
284
|
+
* derives the JSON-Schema input from the Zod schema, so listing the field
|
|
285
|
+
* names again here would just drift.
|
|
286
|
+
*/
|
|
287
|
+
const CROSS_CHECK_SYSTEM_PROMPT = `You are clud-bug, an automated PR reviewer running a cross-check pass.
|
|
288
|
+
|
|
289
|
+
A first review pass produced a list of findings. Your job:
|
|
290
|
+
1. For EACH Pass 1 finding (referenced by its 0-indexed number), decide whether you agree it is a real issue. Cite specific evidence from the diff.
|
|
291
|
+
2. Find issues the first pass missed. Cite skills by slug, the same way the first pass did.
|
|
292
|
+
|
|
293
|
+
Output a single JSON object conforming to the provided schema. Do NOT output markdown, prose, or explanation outside the JSON.
|
|
294
|
+
|
|
295
|
+
Severity taxonomy (for independent findings) is identical to Pass 1:
|
|
296
|
+
- critical: correctness, security, performance — must fix before merge.
|
|
297
|
+
- minor: actionable but non-blocking.
|
|
298
|
+
- preexisting: already on base branch.
|
|
299
|
+
|
|
300
|
+
Verdict rules:
|
|
301
|
+
- "agreed": you confirm the finding is real and is correctly characterized.
|
|
302
|
+
- "disagreed": the finding is wrong (false positive, off-by-one anchor, misread of the diff, or not actually a bug). Include a one-sentence rationale.
|
|
303
|
+
|
|
304
|
+
You are encouraged to disagree when the first pass got it wrong. False positives waste reviewer time; the cross-check exists to catch them.
|
|
305
|
+
`;
|
|
306
|
+
/**
|
|
307
|
+
* Consensus Pass-N system prompt.
|
|
308
|
+
*
|
|
309
|
+
* In consensus mode, the second-and-later passes do NOT see Pass 1. Each
|
|
310
|
+
* pass runs in isolation; the aggregator diffs their outputs and keeps the
|
|
311
|
+
* intersection. This system prompt is intentionally a near-twin of the
|
|
312
|
+
* standard review prompt — the only differences are (a) instructing the
|
|
313
|
+
* model to be conservative since its output will be intersected with
|
|
314
|
+
* others, and (b) reminding it that being right matters more than being
|
|
315
|
+
* comprehensive (since intersection is the gate).
|
|
316
|
+
*/
|
|
317
|
+
const CONSENSUS_SYSTEM_PROMPT = `You are clud-bug, an automated PR reviewer running an independent review pass for consensus.
|
|
318
|
+
|
|
319
|
+
Your job: review the diff against the loaded skills, exactly as a fresh reviewer would. Other passes are running independently; the orchestrator will merge their outputs.
|
|
320
|
+
|
|
321
|
+
Be CONSERVATIVE: only raise findings you are confident about. The orchestrator will intersect findings across passes — false positives only fire when multiple passes raise the same false positive, but missed issues (false negatives) are corrected by other passes finding them.
|
|
322
|
+
|
|
323
|
+
Output a single JSON object conforming to the provided schema. Do NOT output markdown, prose, or explanation outside the JSON.
|
|
324
|
+
|
|
325
|
+
Severity taxonomy:
|
|
326
|
+
- critical: correctness bugs, security issues, performance regressions that must be fixed before merge.
|
|
327
|
+
- minor: actionable issues that should be fixed but don't block merge.
|
|
328
|
+
- preexisting: issues already on the base branch.
|
|
329
|
+
|
|
330
|
+
Rules:
|
|
331
|
+
1. Every finding MUST cite a skill slug from the loaded skill list.
|
|
332
|
+
2. Every finding MUST name a file and (when known) a line number from the diff.
|
|
333
|
+
3. Keep summaries one line. Keep reasoning one line.
|
|
334
|
+
4. Empty findings list is acceptable — only flag what you would flag if you were the only reviewer.
|
|
335
|
+
`;
|
|
336
|
+
/**
|
|
337
|
+
* Builds a cross-check prompt: Pass 2 sees Pass 1's findings as a numbered
|
|
338
|
+
* list + the same skills + the same diff.
|
|
339
|
+
*
|
|
340
|
+
* The prompt asks Pass 2 to:
|
|
341
|
+
* - emit a verdict per Pass-1 finding (referenced by 0-indexed number)
|
|
342
|
+
* - emit an independent findings list (issues Pass 1 missed)
|
|
343
|
+
*
|
|
344
|
+
* The aggregator turns the verdicts into per-finding attribution lines.
|
|
345
|
+
*/
|
|
346
|
+
export function buildCrossCheckPrompt(input) {
|
|
347
|
+
const { repo, pr, diff, skills, pass1Findings, maxSkillBytes } = input;
|
|
348
|
+
const skillCap = maxSkillBytes ?? DEFAULT_MAX_SKILL_BYTES;
|
|
349
|
+
const includedSkillSlugs = [];
|
|
350
|
+
const skippedFiles = [];
|
|
351
|
+
const skillsBlock = renderSkillsBlock(skills, diff.files, skillCap, (slug) => {
|
|
352
|
+
includedSkillSlugs.push(slug);
|
|
353
|
+
});
|
|
354
|
+
const diffBlock = renderDiffBlock(diff.files, (path) => {
|
|
355
|
+
skippedFiles.push(path);
|
|
356
|
+
});
|
|
357
|
+
const pass1Block = renderPass1FindingsBlock(pass1Findings);
|
|
358
|
+
const prompt = [
|
|
359
|
+
`# Cross-check pass — ${repo.owner}/${repo.name}#${pr.number}`,
|
|
360
|
+
pr.title ? `**Title:** ${pr.title}` : '',
|
|
361
|
+
`**Base:** \`${pr.baseRef}\` @ ${diff.baseSha.slice(0, 12)}`,
|
|
362
|
+
`**Head:** \`${pr.headRef}\` @ ${diff.headSha.slice(0, 12)}`,
|
|
363
|
+
'',
|
|
364
|
+
'## Pass 1 findings',
|
|
365
|
+
'',
|
|
366
|
+
pass1Block,
|
|
367
|
+
'',
|
|
368
|
+
'## Loaded skills',
|
|
369
|
+
'',
|
|
370
|
+
skillsBlock,
|
|
371
|
+
'',
|
|
372
|
+
'## Diff',
|
|
373
|
+
'',
|
|
374
|
+
diffBlock,
|
|
375
|
+
'',
|
|
376
|
+
'## Task',
|
|
377
|
+
'',
|
|
378
|
+
'Produce the JSON cross-check object. For EACH Pass-1 finding above (referenced by its `pass1Index` 0-indexed number), include a verdict in the `verdicts` array. Append your independently-discovered findings in `independentFindings`. Empty `independentFindings` is acceptable.',
|
|
379
|
+
]
|
|
380
|
+
.filter((line) => line !== '')
|
|
381
|
+
.join('\n');
|
|
382
|
+
return {
|
|
383
|
+
system: CROSS_CHECK_SYSTEM_PROMPT,
|
|
384
|
+
prompt,
|
|
385
|
+
includedSkillSlugs,
|
|
386
|
+
skippedFiles,
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Builds a consensus prompt: Pass N runs fully independent of Pass 1. The
|
|
391
|
+
* orchestrator diffs their outputs and keeps the intersection.
|
|
392
|
+
*
|
|
393
|
+
* This is essentially `buildReviewPrompt` with a tweaked system prompt
|
|
394
|
+
* — the user message is identical so the model can't tell which pass it is.
|
|
395
|
+
*/
|
|
396
|
+
export function buildConsensusPrompt(input) {
|
|
397
|
+
const built = buildReviewPrompt(input);
|
|
398
|
+
return {
|
|
399
|
+
...built,
|
|
400
|
+
system: CONSENSUS_SYSTEM_PROMPT,
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
function renderPass1FindingsBlock(findings) {
|
|
404
|
+
if (findings.length === 0) {
|
|
405
|
+
return '_(Pass 1 produced no findings.)_';
|
|
406
|
+
}
|
|
407
|
+
return findings
|
|
408
|
+
.map((f, i) => {
|
|
409
|
+
// Same f.file guard as renderFinding in ./review-writeback.ts —
|
|
410
|
+
// findingItemSchema.file is optional and an absent value would
|
|
411
|
+
// otherwise emit literal "undefined" into the Pass-2 prompt.
|
|
412
|
+
const fileLabel = f.file ?? '(unknown file)';
|
|
413
|
+
const loc = f.line ? `${fileLabel}:${f.line}` : fileLabel;
|
|
414
|
+
const reason = f.reasoning ? `\n Reasoning: ${f.reasoning}` : '';
|
|
415
|
+
return `${i}. [${f.severity}] **${loc}** — ${f.skill}: ${f.summary}${reason}`;
|
|
416
|
+
})
|
|
417
|
+
.join('\n');
|
|
418
|
+
}
|
|
419
|
+
//# sourceMappingURL=prompt-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt-builder.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CAAC;IAChF,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type ReviewPromptLanguage = 'generic' | 'ts' | 'py';
|
|
2
|
+
export interface ReviewPromptOptions {
|
|
3
|
+
projectDescription: string;
|
|
4
|
+
language?: ReviewPromptLanguage;
|
|
5
|
+
}
|
|
6
|
+
type ReviewPromptInput = Partial<ReviewPromptOptions>;
|
|
7
|
+
export declare function reviewPrompt(options?: ReviewPromptInput): string;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=prompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/core/prompts.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,oBAAoB,GAAG,SAAS,GAAG,IAAI,GAAG,IAAI,CAAC;AAE3D,MAAM,WAAW,mBAAmB;IAClC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,EAAE,oBAAoB,CAAC;CACjC;AAMD,KAAK,iBAAiB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AA6BtD,wBAAgB,YAAY,CAAC,OAAO,GAAE,iBAAsB,GAAG,MAAM,CA+WpE"}
|