clud-bug 0.6.4 → 0.6.6

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/lib/agents-md.js CHANGED
@@ -8,7 +8,12 @@ import { join } from 'node:path';
8
8
 
9
9
  const START_MARKER = '<!-- clud-bug-start -->';
10
10
  const END_MARKER = '<!-- clud-bug-end -->';
11
- const BLOCK_VERSION = 'v1';
11
+ // v2 (clud-bug v0.6.6+): trimmed from ~44 lines to ~10. Full collaboration
12
+ // rules moved to the bundled `clud-bug-collaboration` skill (always installed
13
+ // alongside clud-bug), which clud-bug-review loads at review time. AGENTS.md
14
+ // becomes a pointer + the strict-mode toggle (repo-specific, varies per
15
+ // consumer). Compounds across every agent session in every consuming repo.
16
+ const BLOCK_VERSION = 'v2';
12
17
 
13
18
  // Files we'll touch when present, plus files we'll create if missing.
14
19
  // AGENTS.md is the cross-tool canonical (logmind made it canonical too).
@@ -43,49 +48,20 @@ const TOUCH_IF_PRESENT = [
43
48
  export function renderBlock({ version, strictMode } = {}) {
44
49
  const versionLine = version ? `_Installed at clud-bug v${version}._` : '';
45
50
  const strictNote = strictMode === true
46
- ? 'Strict mode is **on** in this repo (workflow check fails on critical findings).'
47
- : 'Strict mode is **off** in this repo (advisory only).';
51
+ ? '**on** in this repo (workflow check fails on critical findings)'
52
+ : '**off** in this repo (advisory only)';
48
53
  return `${START_MARKER}
49
54
  <!-- clud-bug-block-version: ${BLOCK_VERSION} -->
50
55
  ## clud-bug — Claude PR review
51
56
 
52
- This repository uses [clud-bug](https://cludbug.dev) to review pull requests
53
- automatically. Three things matter when other agents (or future-you) work
54
- in this repo:
57
+ This repo uses [clud-bug](https://cludbug.dev) for automatic PR reviews.
58
+ Full collaboration rules fix-push flow, skill structure, comment format,
59
+ strict-mode mechanics, workflow-edit constraint — live in the bundled
60
+ [\`clud-bug-collaboration\` skill](.claude/skills/clud-bug-collaboration/SKILL.md).
61
+ Read that skill before pushing fixes addressing prior review threads.
55
62
 
56
- ### When you push fixes addressing prior Clud Bug review threads
57
-
58
- The bot resolves its own prior review threads on the next pass when it can
59
- verify the fix in the diff. You don't need to manually resolve threads it
60
- opened — push the fix, wait ~2 minutes, and check the PR. If a thread it
61
- left isn't auto-resolved after a fix, the bot judged the issue still open;
62
- read its latest review comment for what it's still flagging.
63
-
64
- ### Strict mode
65
-
66
- ${strictNote} Toggle by editing \`.claude/skills/.clud-bug.json\`:
67
-
68
- \`\`\`json
69
- { "strictMode": true | false, ... }
70
- \`\`\`
71
-
72
- The setting is read from the **base ref** of any open PR, so PRs cannot
73
- disable strict mode on themselves. Changes take effect on PRs opened after
74
- they merge to the base branch.
75
-
76
- ### Where the skills live
77
-
78
- Project-aware review rules live in \`.claude/skills/<name>/SKILL.md\`. A
79
- small baseline kit ships with every install — see
80
- \`.claude/skills/.clud-bug.json\` for the current set. Add more via
81
- \`clud-bug add <source/name>\` (from skills.sh) or by dropping your own
82
- \`.md\` files there. They auto-load into the reviewer.
83
-
84
- ### Editing the workflow
85
-
86
- Anthropic's \`claude-code-action\` refuses to run on PRs that modify its own
87
- workflow file. Use \`clud-bug edit-workflow\` to bundle workflow tweaks into
88
- their own isolated PR — see [README](https://github.com/thrillmade/clud-bug#when-you-edit-the-workflow).
63
+ Strict mode is ${strictNote}. Toggle via \`.claude/skills/.clud-bug.json\`
64
+ (read from PR **base ref**, so PRs can't disable strict-mode on themselves).
89
65
 
90
66
  ${versionLine}
91
67
  ${END_MARKER}`;
package/lib/prompts.js CHANGED
@@ -212,6 +212,42 @@ On a first-time review, "resolved from prior" and "still
212
212
  open" are both 0. On follow-up reviews after a fix-push,
213
213
  "resolved from prior" should typically be positive.
214
214
 
215
+ Stats header (required, immediately under **This round:**):
216
+ Lead with ONE single-line stats header that uses severity emoji
217
+ so agents re-reading this comment on a future review pass can
218
+ triage at a glance (and skip parsing the body on the common
219
+ zero-findings case). Three tiers:
220
+
221
+ 🔴 important — bugs / security / perf / missing test coverage
222
+ 🟡 nit — minor suggestions, style nits, observations
223
+ 🟣 pre-existing — issues that pre-date this PR (not its author's
224
+ fault, but worth surfacing for awareness)
225
+
226
+ Emit exactly this shape on the line immediately after **This round:**:
227
+
228
+ Found: N 🔴 / N 🟡 / N 🟣
229
+
230
+ When all three are 0 the entire substantive body is optional —
231
+ agents reading this header on a future re-review can stop here.
232
+
233
+ Per-finding format (severity emoji + collapsible reasoning):
234
+ Each finding in critical/minor/per-skill sections uses this
235
+ write-time-compressed format. The summary line is the load-bearing
236
+ claim; the long-form reasoning lives in a \`<details>\` block that
237
+ humans expand inline (GitHub renders it natively) but future agent
238
+ re-reads can skip token-cheaply.
239
+
240
+ 🔴 [skill-name]: One-line claim (file:line).
241
+ <details><summary>Reasoning</summary>
242
+
243
+ Longer explanation: evidence anchors, suggested fix, edge cases.
244
+
245
+ </details>
246
+
247
+ Use 🔴 for important findings (the ones strict-mode gates on),
248
+ 🟡 for nits, 🟣 for pre-existing issues. The severity emoji
249
+ makes the finding's tier scannable without parsing prose.
250
+
215
251
  Per-skill scan block (required, immediately under the status line):
216
252
  After the **This round:** counters, emit a "### Per-skill scan"
217
253
  section with ONE line per loaded skill — even silent ones. This
package/lib/skills.js CHANGED
@@ -537,6 +537,29 @@ export function selectReviewBody(comments, botLogin) {
537
537
  // passing — which is the right posture: if the bot didn't post a review
538
538
  // with the strict-mode header, there's nothing for the gate to fail on.
539
539
  // "Loud failure for missing manifest" is handled upstream in the composite.
540
+ // Extract the v0.6.5+ stats header line "Found: N 🔴 / N 🟡 / N 🟣"
541
+ // from a review comment body. Returns {important, nit, preExisting} when
542
+ // found, null otherwise. The header lets agents reading the comment on a
543
+ // re-review triage at a glance — on the common zero-findings case, the
544
+ // header IS the entire substantive payload, so an ingest can short-circuit
545
+ // without parsing the body.
546
+ //
547
+ // The match is intentionally permissive on whitespace around the slashes
548
+ // and tolerates 1+ digits for each count. Severity emoji are matched
549
+ // literally — a future bot revision that changes the emoji would break
550
+ // this parser loudly, which is the intended behavior (catches drift).
551
+ export function extractStatsHeader(comment) {
552
+ if (typeof comment !== 'string' || !comment) return null;
553
+ const re = /Found:\s*(\d+)\s*🔴\s*\/\s*(\d+)\s*🟡\s*\/\s*(\d+)\s*🟣/u;
554
+ const m = comment.match(re);
555
+ if (!m) return null;
556
+ return {
557
+ important: parseInt(m[1], 10),
558
+ nit: parseInt(m[2], 10),
559
+ preExisting: parseInt(m[3], 10),
560
+ };
561
+ }
562
+
540
563
  export function isCriticalReviewHeader(headerLine) {
541
564
  if (typeof headerLine !== 'string') return false;
542
565
  return /Clud Bug review — critical findings/.test(headerLine);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clud-bug",
3
- "version": "0.6.4",
3
+ "version": "0.6.6",
4
4
  "description": "Skill-driven Claude PR review. Ship a brand-voice skill, get brand reviews. Each finding cites the skill that motivated it. CLI installs the workflow + a baseline kit; add more from skills.sh.",
5
5
  "homepage": "https://cludbug.dev",
6
6
  "bugs": "https://github.com/thrillmade/clud-bug/issues",
@@ -79,6 +79,6 @@ jobs:
79
79
  # Strict-mode gate — composite action; see workflow.yml.tmpl for design notes.
80
80
  - name: Strict mode — fail check on critical findings
81
81
  if: success()
82
- uses: thrillmade/clud-bug/.github/actions/strict-mode-gate@v0.6.4
82
+ uses: thrillmade/clud-bug/.github/actions/strict-mode-gate@v0.6.6
83
83
  with:
84
84
  github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -79,6 +79,6 @@ jobs:
79
79
  # Strict-mode gate — composite action; see workflow.yml.tmpl for design notes.
80
80
  - name: Strict mode — fail check on critical findings
81
81
  if: success()
82
- uses: thrillmade/clud-bug/.github/actions/strict-mode-gate@v0.6.4
82
+ uses: thrillmade/clud-bug/.github/actions/strict-mode-gate@v0.6.6
83
83
  with:
84
84
  github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -130,6 +130,6 @@ jobs:
130
130
  # Letting the action's own failure fail the check is louder and right.
131
131
  - name: Strict mode — fail check on critical findings
132
132
  if: success()
133
- uses: thrillmade/clud-bug/.github/actions/strict-mode-gate@v0.6.4
133
+ uses: thrillmade/clud-bug/.github/actions/strict-mode-gate@v0.6.6
134
134
  with:
135
135
  github-token: ${{ secrets.GITHUB_TOKEN }}