clud-bug 0.6.34 → 0.7.0-rc.11
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/README.md +20 -0
- package/bin/clud-bug.js +10 -1353
- package/data/canonical-v1.json +37 -0
- 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/configure-github.d.ts +58 -0
- package/dist/cli/configure-github.d.ts.map +1 -0
- package/dist/cli/configure-github.js +242 -0
- package/dist/cli/configure-github.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 +9 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +19 -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 +2067 -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 +205 -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/auto-resolve.d.ts +235 -0
- package/dist/core/auto-resolve.d.ts.map +1 -0
- package/dist/core/auto-resolve.js +293 -0
- package/dist/core/auto-resolve.js.map +1 -0
- package/dist/core/configure-github.d.ts +179 -0
- package/dist/core/configure-github.d.ts.map +1 -0
- package/dist/core/configure-github.js +289 -0
- package/dist/core/configure-github.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/diff-findings.d.ts +96 -0
- package/dist/core/diff-findings.d.ts.map +1 -0
- package/dist/core/diff-findings.js +261 -0
- package/dist/core/diff-findings.js.map +1 -0
- package/dist/core/formal-review.d.ts +79 -0
- package/dist/core/formal-review.d.ts.map +1 -0
- package/dist/core/formal-review.js +71 -0
- package/dist/core/formal-review.js.map +1 -0
- package/dist/core/index.d.ts +17 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +66 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/inline-threads.d.ts +160 -0
- package/dist/core/inline-threads.d.ts.map +1 -0
- package/dist/core/inline-threads.js +369 -0
- package/dist/core/inline-threads.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 +62 -0
- package/dist/core/render.js.map +1 -0
- package/dist/core/resolve-verifier.d.ts +46 -0
- package/dist/core/resolve-verifier.d.ts.map +1 -0
- package/dist/core/resolve-verifier.js +187 -0
- package/dist/core/resolve-verifier.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 +193 -0
- package/dist/core/review-writeback.d.ts.map +1 -0
- package/dist/core/review-writeback.js +364 -0
- package/dist/core/review-writeback.js.map +1 -0
- package/dist/core/skills.d.ts +147 -0
- package/dist/core/skills.d.ts.map +1 -0
- package/dist/core/skills.js +726 -0
- package/dist/core/skills.js.map +1 -0
- package/dist/core/version.d.ts +2 -0
- package/dist/core/version.d.ts.map +1 -0
- package/dist/core/version.js +4 -0
- package/dist/core/version.js.map +1 -0
- package/package.json +37 -5
- 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/src/cli/configure-github.ts +329 -0
- package/{lib/edit-workflow.js → src/cli/edit-workflow.ts} +32 -11
- package/src/cli/index.ts +107 -0
- package/src/cli/main.ts +2204 -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} +87 -27
- package/{lib/usage.js → src/cli/usage.ts} +167 -76
- package/src/core/audit.ts +53 -0
- package/src/core/auto-resolve.ts +488 -0
- package/src/core/configure-github.ts +497 -0
- package/{lib/detect.js → src/core/detect.ts} +100 -47
- package/src/core/diff-findings.ts +323 -0
- package/src/core/formal-review.ts +168 -0
- package/src/core/index.ts +250 -0
- package/src/core/inline-threads.ts +471 -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} +37 -17
- package/src/core/resolve-verifier.ts +228 -0
- 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 +565 -0
- package/{lib/skills.js → src/core/skills.ts} +456 -342
- package/src/core/version.ts +3 -0
- package/templates/clud-bug-review.md.tmpl +115 -0
- package/templates/workflow-py.yml.tmpl +80 -3
- package/templates/workflow-ts.yml.tmpl +80 -3
- package/templates/workflow.yml.tmpl +175 -8
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
// SPEC §7.2.1 formal-review event selector.
|
|
2
|
+
//
|
|
3
|
+
// This is the PURE half of clud-bug-app's `lib/formal-review.ts` (the
|
|
4
|
+
// Octokit-side `postFormalReview` IO wrapper stays App-side — it depends
|
|
5
|
+
// on `getInstallationOctokit` + `@octokit/rest` which we don't want to
|
|
6
|
+
// pull into core). The pure rule-table lives here so:
|
|
7
|
+
//
|
|
8
|
+
// 1. The npm workflow template's new post-step (added in v0.7.0-rc.3)
|
|
9
|
+
// can `import { selectReviewEvent } from 'clud-bug/core'` and post
|
|
10
|
+
// formal `pulls.createReview` calls under the workflow path — until
|
|
11
|
+
// this PR shipped, the workflow path NEVER satisfied the canonical
|
|
12
|
+
// ruleset's `required_approving_review_count: 1` floor because no
|
|
13
|
+
// APPROVE review was ever posted.
|
|
14
|
+
//
|
|
15
|
+
// 2. clud-bug-app (Phase 7 PR B) deletes its local copy and imports
|
|
16
|
+
// this version, gaining the §7.2.1 author_association extension
|
|
17
|
+
// (clud-bug-app's PR #40 shipped APPROVE without it, so the App
|
|
18
|
+
// currently auto-approves drive-by external-contributor PRs — a
|
|
19
|
+
// security bug closed by Phase 7 PR B's dep bump).
|
|
20
|
+
//
|
|
21
|
+
// Ported from clud-bug-app/lib/formal-review.ts (PR #40, MERGED 2026-06-10)
|
|
22
|
+
// with the §7.2.1 `authorAssociation` extension new in Phase 7 PR A.
|
|
23
|
+
|
|
24
|
+
/** GitHub's `pulls.createReview` `event` enum, narrowed to the three we use. */
|
|
25
|
+
export type FormalReviewEvent = 'APPROVE' | 'REQUEST_CHANGES' | 'COMMENT';
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* GitHub `author_association` on a PR. Verbatim union from the REST API
|
|
29
|
+
* (per https://docs.github.com/en/rest/pulls/pulls — `author_association`).
|
|
30
|
+
*
|
|
31
|
+
* The "external" tier for §7.2.1 auto-approve gating is:
|
|
32
|
+
*
|
|
33
|
+
* { 'NONE', 'FIRST_TIME_CONTRIBUTOR', 'FIRST_TIMER', 'MANNEQUIN' }
|
|
34
|
+
*
|
|
35
|
+
* Everything else (OWNER, MEMBER, COLLABORATOR, CONTRIBUTOR) is the
|
|
36
|
+
* "org-trusted" tier and eligible for auto-approve on a clean review.
|
|
37
|
+
*
|
|
38
|
+
* `FIRST_TIMER` is the legacy spelling (October 2018 era); GitHub
|
|
39
|
+
* currently emits `FIRST_TIME_CONTRIBUTOR` but some PR fixtures in
|
|
40
|
+
* downstream tests still carry the old token. We keep both so the
|
|
41
|
+
* external-contributor gate doesn't silently regress on the next
|
|
42
|
+
* REST-API rename.
|
|
43
|
+
*/
|
|
44
|
+
export type AuthorAssociation =
|
|
45
|
+
| 'OWNER'
|
|
46
|
+
| 'MEMBER'
|
|
47
|
+
| 'COLLABORATOR'
|
|
48
|
+
| 'CONTRIBUTOR'
|
|
49
|
+
| 'FIRST_TIME_CONTRIBUTOR'
|
|
50
|
+
| 'FIRST_TIMER'
|
|
51
|
+
| 'NONE'
|
|
52
|
+
| 'MANNEQUIN';
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Author-association values that route a clean-review APPROVE *down* to
|
|
56
|
+
* COMMENT per SPEC §7.2.1 precondition #3 ("PR author is an org member —
|
|
57
|
+
* NOT a first-time external contributor"). These authors still get a
|
|
58
|
+
* COMMENT review (so they SEE the bot's verdict) but the formal APPROVE
|
|
59
|
+
* vote stays withheld — a human reviewer must click Approve before the
|
|
60
|
+
* PR can merge under the canonical ruleset.
|
|
61
|
+
*
|
|
62
|
+
* Drive-by exploitation prevention: a malicious external contributor
|
|
63
|
+
* who opens a clean-looking PR cannot leverage clud-bug[bot]'s APPROVE
|
|
64
|
+
* vote to auto-merge.
|
|
65
|
+
*/
|
|
66
|
+
const EXTERNAL_ASSOCIATIONS: ReadonlySet<AuthorAssociation> = new Set<
|
|
67
|
+
AuthorAssociation
|
|
68
|
+
>(['NONE', 'FIRST_TIME_CONTRIBUTOR', 'FIRST_TIMER', 'MANNEQUIN']);
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* SPEC §7.2.1 + §7.2 rule table.
|
|
72
|
+
*
|
|
73
|
+
* Order matters — earlier rows short-circuit later ones:
|
|
74
|
+
*
|
|
75
|
+
* | Priority | Condition | Event |
|
|
76
|
+
* |----------|--------------------------------------------------------|-----------------|
|
|
77
|
+
* | 1 | PR author === clud-bug[bot] | 'skip' |
|
|
78
|
+
* | 2 | authorAssociation ∈ EXTERNAL | 'COMMENT' |
|
|
79
|
+
* | 3 | criticalCount > 0 AND strictMode=true | REQUEST_CHANGES |
|
|
80
|
+
* | 4 | criticalCount > 0 AND strictMode=false | COMMENT |
|
|
81
|
+
* | 5 | minorCount > 0 (no critical) | COMMENT |
|
|
82
|
+
* | 6 | 0 critical + 0 minor | APPROVE |
|
|
83
|
+
*
|
|
84
|
+
* The external-contributor row (Priority 2) sits BETWEEN self-PR-skip
|
|
85
|
+
* and the severity-driven rules: external contributors who open a
|
|
86
|
+
* critical-finding PR still get COMMENT (NOT REQUEST_CHANGES — we don't
|
|
87
|
+
* block their PR on a bot review; that's a human reviewer's call to
|
|
88
|
+
* make). External contributors who open a clean PR also get COMMENT
|
|
89
|
+
* (NOT APPROVE — the §7.2.1 precondition #3 gate).
|
|
90
|
+
*
|
|
91
|
+
* The 'skip' verdict tells the caller NOT to invoke `pulls.createReview`
|
|
92
|
+
* — GitHub returns 422 when a user reviews their own PR, so we
|
|
93
|
+
* short-circuit before the network round-trip. Self-PRs land during D.7
|
|
94
|
+
* migration fan-out (the App opens cross-repo update PRs under its own
|
|
95
|
+
* identity).
|
|
96
|
+
*/
|
|
97
|
+
export interface SelectReviewEventInput {
|
|
98
|
+
/** Count of `severity: critical` findings on the review. */
|
|
99
|
+
criticalCount: number;
|
|
100
|
+
/** Count of `severity: minor` findings on the review. */
|
|
101
|
+
minorCount: number;
|
|
102
|
+
/**
|
|
103
|
+
* `strictMode` flag read from `.clud-bug.json` at the PR's BASE ref.
|
|
104
|
+
* Older manifests may not carry this field — callers MUST pass
|
|
105
|
+
* `undefined` in that case so this function applies the safe default
|
|
106
|
+
* (false) rather than surprising users with REQUEST_CHANGES.
|
|
107
|
+
*/
|
|
108
|
+
strictMode?: boolean;
|
|
109
|
+
/**
|
|
110
|
+
* GitHub login of the PR author. When it equals 'clud-bug[bot]' we
|
|
111
|
+
* skip the formal review entirely (GitHub disallows self-review with
|
|
112
|
+
* 422). This is the structural guard for D.7 migration fan-out PRs.
|
|
113
|
+
*/
|
|
114
|
+
prAuthorLogin: string;
|
|
115
|
+
/**
|
|
116
|
+
* GitHub `author_association` on the PR. NEW in v0.7.0-rc.3 / SPEC
|
|
117
|
+
* §7.2.1: when this is in EXTERNAL_ASSOCIATIONS, a clean review gets
|
|
118
|
+
* COMMENT (not APPROVE) so external-contributor PRs require a human
|
|
119
|
+
* reviewer to satisfy the `required_approving_review_count: 1` floor.
|
|
120
|
+
*
|
|
121
|
+
* Callers that don't have this metadata (older webhook payloads,
|
|
122
|
+
* tests, etc.) should pass `'CONTRIBUTOR'` as the safe default — that
|
|
123
|
+
* tier is org-trusted and preserves pre-§7.2.1 behaviour.
|
|
124
|
+
*/
|
|
125
|
+
authorAssociation: AuthorAssociation;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export function selectReviewEvent(
|
|
129
|
+
input: SelectReviewEventInput,
|
|
130
|
+
): FormalReviewEvent | 'skip' {
|
|
131
|
+
// Priority 1: self-PR guard. GitHub returns 422 on a self-review;
|
|
132
|
+
// we short-circuit before the network round-trip. Self-PRs land
|
|
133
|
+
// during D.7 migration fan-out (the App opens cross-repo update PRs
|
|
134
|
+
// under its own identity).
|
|
135
|
+
if (input.prAuthorLogin === 'clud-bug[bot]') {
|
|
136
|
+
return 'skip';
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// Priority 2: external-contributor gate (SPEC §7.2.1 precondition #3).
|
|
140
|
+
// External contributors NEVER get APPROVE (no auto-merge bypass via
|
|
141
|
+
// drive-by) and NEVER get REQUEST_CHANGES (we don't block their PR on
|
|
142
|
+
// a bot review — that escalation is a human reviewer's call). They
|
|
143
|
+
// always get an advisory COMMENT so they see the bot's verdict.
|
|
144
|
+
if (EXTERNAL_ASSOCIATIONS.has(input.authorAssociation)) {
|
|
145
|
+
return 'COMMENT';
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// Priority 6 (note: priorities 3-5 fall through to here when there
|
|
149
|
+
// are no findings): clean review on an org-trusted author → APPROVE.
|
|
150
|
+
// APPROVE flips the `required_approving_review_count: 1` ruleset and
|
|
151
|
+
// lets auto-merge fire under the canonical SPEC §7.2 ruleset.
|
|
152
|
+
if (input.criticalCount === 0 && input.minorCount === 0) {
|
|
153
|
+
return 'APPROVE';
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// Priority 3 + 4: critical finding → gate on strictMode. Default
|
|
157
|
+
// `strictMode === undefined` → false (advisory-only). REQUEST_CHANGES
|
|
158
|
+
// blocks the PR until the author dismisses or fixes; we only honor
|
|
159
|
+
// it when the repo opted in.
|
|
160
|
+
if (input.criticalCount > 0) {
|
|
161
|
+
return input.strictMode === true ? 'REQUEST_CHANGES' : 'COMMENT';
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// Priority 5: minor-only or preexisting-only finding → advisory
|
|
165
|
+
// COMMENT. We never REQUEST_CHANGES on a minor — those are noted,
|
|
166
|
+
// not blocking.
|
|
167
|
+
return 'COMMENT';
|
|
168
|
+
}
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
// Public API surface for `clud-bug/core` (consumed via the package's
|
|
2
|
+
// `./core` exports map → `dist/core/index.js`).
|
|
3
|
+
//
|
|
4
|
+
// Each line re-exports one core module's public symbols. Modules are
|
|
5
|
+
// added incrementally as the v0.7.0 TypeScript migration converts each
|
|
6
|
+
// lib/* JS file.
|
|
7
|
+
|
|
8
|
+
export { reviewPrompt, type ReviewPromptOptions, type ReviewPromptLanguage } from './prompts.js';
|
|
9
|
+
export {
|
|
10
|
+
REVIEW_SCHEMA,
|
|
11
|
+
serializedReviewSchema,
|
|
12
|
+
type ReviewData,
|
|
13
|
+
type ReviewFinding,
|
|
14
|
+
type ReviewSummaryCounts,
|
|
15
|
+
type ReviewStatusHeader,
|
|
16
|
+
type FindingSeverity,
|
|
17
|
+
type PerSkillScanItem,
|
|
18
|
+
type DedicatedSection,
|
|
19
|
+
} from './review-schema.js';
|
|
20
|
+
export { renderReview, SEVERITY_LABEL } from './render-review.js';
|
|
21
|
+
export {
|
|
22
|
+
detect,
|
|
23
|
+
buildDescriptionLine,
|
|
24
|
+
EXT_TO_LANG,
|
|
25
|
+
DEP_TO_TERM,
|
|
26
|
+
PY_DEP_TO_TERM,
|
|
27
|
+
fileHistogram,
|
|
28
|
+
firstParagraph,
|
|
29
|
+
type DetectedSignals,
|
|
30
|
+
type DescriptionLineSignals,
|
|
31
|
+
} from './detect.js';
|
|
32
|
+
export {
|
|
33
|
+
render,
|
|
34
|
+
renderFile,
|
|
35
|
+
pickTemplate,
|
|
36
|
+
templateLanguage,
|
|
37
|
+
DEFAULTS,
|
|
38
|
+
type RenderDefaults,
|
|
39
|
+
type RenderVars,
|
|
40
|
+
type TemplateLanguage,
|
|
41
|
+
} from './render.js';
|
|
42
|
+
export {
|
|
43
|
+
durationToGitSince,
|
|
44
|
+
renderAuditHeader,
|
|
45
|
+
type AuditHeaderInput,
|
|
46
|
+
} from './audit.js';
|
|
47
|
+
// Zod-typed wire-shape review + internal-shape helpers for the
|
|
48
|
+
// AI-Gateway consumer (clud-bug-app). The CLI-shape JSON Schema +
|
|
49
|
+
// CLI summary-comment renderer above stay first-class; the Zod port
|
|
50
|
+
// below is additive.
|
|
51
|
+
//
|
|
52
|
+
// Naming: the wire-shape `FindingItem` collides with neither CLI nor
|
|
53
|
+
// App existing exports. The internal-shape `Finding` (FindingItem +
|
|
54
|
+
// severity) is re-exported as `ZodFinding` to disambiguate from the
|
|
55
|
+
// CLI's `ReviewFinding`.
|
|
56
|
+
export {
|
|
57
|
+
reviewSchema,
|
|
58
|
+
crossCheckSchema,
|
|
59
|
+
findingItemSchema,
|
|
60
|
+
findingSchema,
|
|
61
|
+
perSkillScanItemSchema,
|
|
62
|
+
dedicatedSectionSchema,
|
|
63
|
+
summaryCountsSchema,
|
|
64
|
+
severitySchema,
|
|
65
|
+
statusHeaderSchema,
|
|
66
|
+
crossCheckVerdictSchema,
|
|
67
|
+
severityValues,
|
|
68
|
+
statusHeaderValues,
|
|
69
|
+
flattenFindings,
|
|
70
|
+
unflattenFindings,
|
|
71
|
+
deriveSummaryCounts,
|
|
72
|
+
deriveSkillsReferenced,
|
|
73
|
+
buildReviewFromFindings,
|
|
74
|
+
type Review,
|
|
75
|
+
type CrossCheck,
|
|
76
|
+
type CrossCheckVerdictSchema,
|
|
77
|
+
type Severity,
|
|
78
|
+
type StatusHeader,
|
|
79
|
+
type SummaryCounts,
|
|
80
|
+
type FindingItem,
|
|
81
|
+
type PerSkillScanItem as ZodPerSkillScanItem,
|
|
82
|
+
type DedicatedSection as ZodDedicatedSection,
|
|
83
|
+
type Finding as ZodFinding,
|
|
84
|
+
} from './review-schema-zod.js';
|
|
85
|
+
// AI-Gateway prompt builder (App's review pass). The CLI-shape
|
|
86
|
+
// `reviewPrompt` workflow-string above stays; this is additive.
|
|
87
|
+
export {
|
|
88
|
+
buildReviewPrompt,
|
|
89
|
+
buildCrossCheckPrompt,
|
|
90
|
+
buildConsensusPrompt,
|
|
91
|
+
skillMatchesDiff,
|
|
92
|
+
globMatch,
|
|
93
|
+
truncatePatch,
|
|
94
|
+
sliceUtf8Bytes,
|
|
95
|
+
MAX_PATCH_BYTES_PER_FILE,
|
|
96
|
+
DEFAULT_MAX_SKILL_BYTES,
|
|
97
|
+
type BuildReviewPromptInput,
|
|
98
|
+
type BuildCrossCheckPromptInput,
|
|
99
|
+
type BuiltPrompt,
|
|
100
|
+
type ChangedFile,
|
|
101
|
+
type ChangedFileStatus,
|
|
102
|
+
type PullRequestDiff,
|
|
103
|
+
type PromptAppliesToRule,
|
|
104
|
+
type PromptSkillFrontmatter,
|
|
105
|
+
type PromptLoadedSkill,
|
|
106
|
+
} from './prompt-builder.js';
|
|
107
|
+
// SPEC §1.8.1 doc-file renderer (`docs/reviews/PR-<n>.md`). Renamed
|
|
108
|
+
// from the App's `renderReview` to `renderReviewFile` to disambiguate
|
|
109
|
+
// from the CLI's `renderReview` (summary PR-comment shape) above.
|
|
110
|
+
export {
|
|
111
|
+
renderReviewFile,
|
|
112
|
+
renderMultiPassMarkdown,
|
|
113
|
+
reviewFilePath,
|
|
114
|
+
reviewCommitMessage,
|
|
115
|
+
PROTOCOL_VERSION,
|
|
116
|
+
WRITTEN_BY,
|
|
117
|
+
SEVERITY_EMOJI as REVIEW_FILE_SEVERITY_EMOJI,
|
|
118
|
+
type RenderReviewFileInput,
|
|
119
|
+
type RenderedFindingRef,
|
|
120
|
+
type CacheStats,
|
|
121
|
+
type RenderMultiPassMarkdownInput,
|
|
122
|
+
type MultiPassReview,
|
|
123
|
+
type UnifiedFinding,
|
|
124
|
+
type PassAttribution,
|
|
125
|
+
type PassSource,
|
|
126
|
+
type ReviewPassMode,
|
|
127
|
+
type MultiPassVerdict,
|
|
128
|
+
} from './review-writeback.js';
|
|
129
|
+
// SPEC §7.2.1 formal-review event selector. Pure rule-table half of
|
|
130
|
+
// clud-bug-app's `lib/formal-review.ts`; the Octokit-side IO wrapper
|
|
131
|
+
// (`postFormalReview`) stays App-side. v0.7.0-rc.3 adds the
|
|
132
|
+
// `authorAssociation` extension so a clean review on an external
|
|
133
|
+
// contributor's PR routes to COMMENT (not APPROVE) — the canonical
|
|
134
|
+
// ruleset's `required_approving_review_count: 1` floor then requires
|
|
135
|
+
// a human reviewer.
|
|
136
|
+
export {
|
|
137
|
+
selectReviewEvent,
|
|
138
|
+
type FormalReviewEvent,
|
|
139
|
+
type AuthorAssociation,
|
|
140
|
+
type SelectReviewEventInput,
|
|
141
|
+
} from './formal-review.js';
|
|
142
|
+
// SPEC §1.8.1 Resolved / Still-open block helpers. `parsePriorReviewFile`
|
|
143
|
+
// reads a prior `docs/reviews/PR-<n>.md`; `diffFindings` splits prior vs
|
|
144
|
+
// current into resolved + still-open lists that `renderReviewFile`
|
|
145
|
+
// emits as the §1.8.1 blocks. Identity scheme is shareable with future
|
|
146
|
+
// inline-thread anchoring in clud-bug-app.
|
|
147
|
+
export {
|
|
148
|
+
parsePriorReviewFile,
|
|
149
|
+
diffFindings,
|
|
150
|
+
findingIdentity,
|
|
151
|
+
type ParsedFinding,
|
|
152
|
+
type ParsedReview,
|
|
153
|
+
} from './diff-findings.js';
|
|
154
|
+
// Wave 5a — D.2.X per-finding inline review threads. Pure helpers
|
|
155
|
+
// (anchor detection, comment rendering, plan partitioning) + the GraphQL
|
|
156
|
+
// constants the CLI's `post-inline-threads` verb invokes via `gh api`.
|
|
157
|
+
// `findingId` returns the SHA-256[:16] hash and is distinct from the
|
|
158
|
+
// plain-string `findingIdentity` above (both serve different matchers).
|
|
159
|
+
//
|
|
160
|
+
// Wave 5b additions: `parseThreadBody` (inverts renderThreadBody) +
|
|
161
|
+
// `ADD_REPLY_MUTATION` (for posting the auto-resolve marker reply
|
|
162
|
+
// before resolving a thread).
|
|
163
|
+
export {
|
|
164
|
+
findingId,
|
|
165
|
+
parseHeadLines,
|
|
166
|
+
findingAnchorable,
|
|
167
|
+
extractAnchorContext,
|
|
168
|
+
renderThreadBody,
|
|
169
|
+
extractFindingIdFromBody,
|
|
170
|
+
parseThreadBody,
|
|
171
|
+
planInlineThreads,
|
|
172
|
+
REVIEW_THREADS_QUERY,
|
|
173
|
+
REVIEW_THREADS_STATE_QUERY,
|
|
174
|
+
RESOLVE_THREAD_MUTATION,
|
|
175
|
+
ADD_REPLY_MUTATION,
|
|
176
|
+
type Severity as InlineThreadSeverity,
|
|
177
|
+
type FindingForThread,
|
|
178
|
+
type DiffFile,
|
|
179
|
+
type InlineCommentPlan,
|
|
180
|
+
type PlanInlineThreadsResult,
|
|
181
|
+
} from './inline-threads.js';
|
|
182
|
+
// Wave 5b — D.2.6 auto-resolve on fix-push. Pure rule tables + config
|
|
183
|
+
// merge + marker rendering. The CLI's `resolve-threads` verb owns the
|
|
184
|
+
// Anthropic Messages call + GraphQL mutations; `runAutoResolve` is
|
|
185
|
+
// pure modulo the injected verifier callback.
|
|
186
|
+
export {
|
|
187
|
+
resolveAutoResolveConfig,
|
|
188
|
+
readAutoResolveConfigFromCludBug,
|
|
189
|
+
runAutoResolve,
|
|
190
|
+
applyResolutionRules,
|
|
191
|
+
renderAutoResolveMarker,
|
|
192
|
+
DEFAULT_AUTO_RESOLVE_CONFIG,
|
|
193
|
+
type AutoResolveConfig,
|
|
194
|
+
type PriorThread,
|
|
195
|
+
type PriorFinding,
|
|
196
|
+
type ThreadAction,
|
|
197
|
+
type AutoResolveInput,
|
|
198
|
+
type AutoResolveResult,
|
|
199
|
+
type VerifyOutcome,
|
|
200
|
+
} from './auto-resolve.js';
|
|
201
|
+
export {
|
|
202
|
+
VERIFIER_SYSTEM,
|
|
203
|
+
buildVerifierPrompt,
|
|
204
|
+
parseVerifierResponse,
|
|
205
|
+
type VerifySingleFindingInput,
|
|
206
|
+
} from './resolve-verifier.js';
|
|
207
|
+
// SPEC §7 canonical-ruleset applier. Pure diff + idempotent-PATCH logic;
|
|
208
|
+
// CLI side wraps `gh api` in an Octokit-like adapter and the App passes
|
|
209
|
+
// its real Octokit instance. Shipped in v0.7.0-rc.4 for Marketplace prep
|
|
210
|
+
// (Phase 6 task #227).
|
|
211
|
+
export {
|
|
212
|
+
applyCanonicalRuleset,
|
|
213
|
+
loadCanonicalV1,
|
|
214
|
+
type CanonicalRuleset,
|
|
215
|
+
type OctokitLike,
|
|
216
|
+
type ApplyCanonicalRulesetParams,
|
|
217
|
+
type ApplyResult,
|
|
218
|
+
} from './configure-github.js';
|
|
219
|
+
export {
|
|
220
|
+
API_BASE,
|
|
221
|
+
MAX_SKILLS,
|
|
222
|
+
SkillsClient,
|
|
223
|
+
normalizeList,
|
|
224
|
+
rankAndCap,
|
|
225
|
+
readReviewMode,
|
|
226
|
+
readAppliesTo,
|
|
227
|
+
appliesToPr,
|
|
228
|
+
appliesToAuthor,
|
|
229
|
+
partitionByReviewMode,
|
|
230
|
+
extractPerSkillLine,
|
|
231
|
+
selectReviewHeader,
|
|
232
|
+
extractFirstReviewHeaderLine,
|
|
233
|
+
selectReviewBody,
|
|
234
|
+
extractStatsHeader,
|
|
235
|
+
isCriticalReviewHeader,
|
|
236
|
+
classifyPerSkillOutcome,
|
|
237
|
+
parseFrontmatter,
|
|
238
|
+
stripFrontmatter,
|
|
239
|
+
type SkillDescriptor,
|
|
240
|
+
type RankableSkill,
|
|
241
|
+
type AppliesToRule,
|
|
242
|
+
type SkillWithOptionalContent,
|
|
243
|
+
type PrComment,
|
|
244
|
+
type ReviewStatsHeader,
|
|
245
|
+
type SkillFrontmatter,
|
|
246
|
+
type SkillSource,
|
|
247
|
+
type SkillReviewMode,
|
|
248
|
+
type SkillKind,
|
|
249
|
+
type VoiceScope,
|
|
250
|
+
} from './skills.js';
|