clud-bug 0.5.11 → 0.5.12
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/skills.js
CHANGED
|
@@ -428,6 +428,98 @@ export function extractPerSkillLine(comment, skillName) {
|
|
|
428
428
|
return m ? m[1] : null;
|
|
429
429
|
}
|
|
430
430
|
|
|
431
|
+
// Find the latest clud-bug review header line from a list of PR comments.
|
|
432
|
+
// Source of truth for the v0.5.x strict-mode-gate header selection — the
|
|
433
|
+
// composite action shells out to node + this helper rather than parsing
|
|
434
|
+
// in bash, so the gate has unit-test coverage and the v0.6 App can reuse
|
|
435
|
+
// the same logic.
|
|
436
|
+
//
|
|
437
|
+
// Contract (called by .github/actions/strict-mode-gate/action.yml):
|
|
438
|
+
// - Walk `comments` (newest-first per gh api ?sort=created&direction=desc).
|
|
439
|
+
// - Skip comments not authored by `botLogin`.
|
|
440
|
+
// - For each remaining comment, find the FIRST line starting with the
|
|
441
|
+
// H2 sentinel `## 🐛 Clud Bug review`. If present, return that line.
|
|
442
|
+
// - Return null if no matching comment exists.
|
|
443
|
+
//
|
|
444
|
+
// Why this isn't `comments.find(c => c.body.startsWith("## 🐛 Clud Bug review"))`:
|
|
445
|
+
// claude-code-action prepends a `**Claude finished @user's task in Nm Ns**`
|
|
446
|
+
// preamble to every bot comment, so the H2 review header never appears at
|
|
447
|
+
// body position 0. The pre-v0.5.12 composite used `.body | startswith(...)`
|
|
448
|
+
// in jq and matched ZERO comments in practice — silently disabling strict
|
|
449
|
+
// mode on every install with strictMode: true. Caught when this repo
|
|
450
|
+
// dogfooded BB.3 on PR #60: bot wrote "— critical findings" header, gate
|
|
451
|
+
// passed anyway.
|
|
452
|
+
//
|
|
453
|
+
// The line-anchored extraction preserves the original "don't trip on
|
|
454
|
+
// quoted sentinels in body text" property: a comment that mentions the
|
|
455
|
+
// strict-mode header in prose (inline-code, blockquote) won't match
|
|
456
|
+
// because the quoted version isn't at start-of-line.
|
|
457
|
+
export function selectReviewHeader(comments, botLogin) {
|
|
458
|
+
if (!Array.isArray(comments)) return null;
|
|
459
|
+
if (typeof botLogin !== 'string' || !botLogin) return null;
|
|
460
|
+
for (const c of comments) {
|
|
461
|
+
if (!c || typeof c !== 'object') continue;
|
|
462
|
+
const author = c.user?.login;
|
|
463
|
+
const body = c.body;
|
|
464
|
+
if (author !== botLogin || typeof body !== 'string') continue;
|
|
465
|
+
const headerLine = extractFirstReviewHeaderLine(body);
|
|
466
|
+
if (headerLine) return headerLine;
|
|
467
|
+
}
|
|
468
|
+
return null;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
// Pull the FIRST line of `body` that starts with the H2 sentinel.
|
|
472
|
+
// Exported separately so callers can extract a header from a known body
|
|
473
|
+
// without re-running the comment filter (useful in tests + the v0.6 App).
|
|
474
|
+
export function extractFirstReviewHeaderLine(body) {
|
|
475
|
+
if (typeof body !== 'string') return null;
|
|
476
|
+
const m = body.match(/^## 🐛 Clud Bug review[^\n]*/m);
|
|
477
|
+
return m ? m[0] : null;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
// Companion to selectReviewHeader: returns the FULL BODY of the latest
|
|
481
|
+
// clud-bug review comment from `botLogin`, not just its header line.
|
|
482
|
+
// Same filter contract (line-anchored H2 sentinel, claude-code-action
|
|
483
|
+
// preamble tolerated). Used by the BB.3 per-skill check-runs step,
|
|
484
|
+
// which needs the body to extract per-skill outcome lines from the
|
|
485
|
+
// "### Per-skill scan" block — the header alone isn't enough.
|
|
486
|
+
//
|
|
487
|
+
// Returns null if no matching comment exists. The composite action
|
|
488
|
+
// treats null as "no review yet; emit no check-runs" (the same posture
|
|
489
|
+
// that pre-v0.5.12 bash code intended via the `[ -z "$LATEST" ]` branch,
|
|
490
|
+
// only now actually reachable instead of always-fires-due-to-bug).
|
|
491
|
+
//
|
|
492
|
+
// Same-bug fix as selectReviewHeader: PR #61 caught that BB.3 step 2
|
|
493
|
+
// of the composite still used the broken `.body | startswith(...)` jq
|
|
494
|
+
// filter even after step 1 was refactored, leaving per-skill check-runs
|
|
495
|
+
// silently disabled on every install with strictSkills since v0.5.10.
|
|
496
|
+
export function selectReviewBody(comments, botLogin) {
|
|
497
|
+
if (!Array.isArray(comments)) return null;
|
|
498
|
+
if (typeof botLogin !== 'string' || !botLogin) return null;
|
|
499
|
+
for (const c of comments) {
|
|
500
|
+
if (!c || typeof c !== 'object') continue;
|
|
501
|
+
const author = c.user?.login;
|
|
502
|
+
const body = c.body;
|
|
503
|
+
if (author !== botLogin || typeof body !== 'string') continue;
|
|
504
|
+
if (extractFirstReviewHeaderLine(body)) return body;
|
|
505
|
+
}
|
|
506
|
+
return null;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
// Decide whether a review-header line is the strict-mode "critical findings"
|
|
510
|
+
// verdict that should fail the gate. Mirrors the v0.5.x bash predicate
|
|
511
|
+
// `grep -q "Clud Bug review — critical findings"`.
|
|
512
|
+
//
|
|
513
|
+
// Returns false for null/non-string input so a "no header found" path
|
|
514
|
+
// (selectReviewHeader returning null) safely falls through to the gate
|
|
515
|
+
// passing — which is the right posture: if the bot didn't post a review
|
|
516
|
+
// with the strict-mode header, there's nothing for the gate to fail on.
|
|
517
|
+
// "Loud failure for missing manifest" is handled upstream in the composite.
|
|
518
|
+
export function isCriticalReviewHeader(headerLine) {
|
|
519
|
+
if (typeof headerLine !== 'string') return false;
|
|
520
|
+
return /Clud Bug review — critical findings/.test(headerLine);
|
|
521
|
+
}
|
|
522
|
+
|
|
431
523
|
// Classify a Per-skill scan outcome line into the check-run conclusion the
|
|
432
524
|
// composite action will emit for that skill. Source of truth for the BB.3
|
|
433
525
|
// gate decision — the v0.5.10 composite shells out to node + this helper
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clud-bug",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.12",
|
|
4
4
|
"description": "Claude PR review with project-aware skills. CLI installs a working GitHub Actions workflow and curates skills from skills.sh.",
|
|
5
5
|
"homepage": "https://cludbug.dev",
|
|
6
6
|
"bugs": "https://github.com/thrillmot/clud-bug/issues",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# clud-bug-template-version:
|
|
1
|
+
# clud-bug-template-version: v6
|
|
2
2
|
name: Clud Bug 🐛 Crawls Your Code
|
|
3
3
|
|
|
4
4
|
on:
|
|
@@ -222,6 +222,6 @@ jobs:
|
|
|
222
222
|
# Strict-mode gate — composite action; see workflow.yml.tmpl for design notes.
|
|
223
223
|
- name: Strict mode — fail check on critical findings
|
|
224
224
|
if: success()
|
|
225
|
-
uses: thrillmot/clud-bug/.github/actions/strict-mode-gate@v0.5.
|
|
225
|
+
uses: thrillmot/clud-bug/.github/actions/strict-mode-gate@v0.5.12
|
|
226
226
|
with:
|
|
227
227
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# clud-bug-template-version:
|
|
1
|
+
# clud-bug-template-version: v6
|
|
2
2
|
name: Clud Bug 🐛 Crawls Your Code
|
|
3
3
|
|
|
4
4
|
on:
|
|
@@ -223,6 +223,6 @@ jobs:
|
|
|
223
223
|
# Strict-mode gate — composite action; see workflow.yml.tmpl for design notes.
|
|
224
224
|
- name: Strict mode — fail check on critical findings
|
|
225
225
|
if: success()
|
|
226
|
-
uses: thrillmot/clud-bug/.github/actions/strict-mode-gate@v0.5.
|
|
226
|
+
uses: thrillmot/clud-bug/.github/actions/strict-mode-gate@v0.5.12
|
|
227
227
|
with:
|
|
228
228
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# clud-bug-template-version:
|
|
1
|
+
# clud-bug-template-version: v6
|
|
2
2
|
name: Clud Bug 🐛 Crawls Your Code
|
|
3
3
|
|
|
4
4
|
on:
|
|
@@ -257,6 +257,6 @@ jobs:
|
|
|
257
257
|
# Letting the action's own failure fail the check is louder and right.
|
|
258
258
|
- name: Strict mode — fail check on critical findings
|
|
259
259
|
if: success()
|
|
260
|
-
uses: thrillmot/clud-bug/.github/actions/strict-mode-gate@v0.5.
|
|
260
|
+
uses: thrillmot/clud-bug/.github/actions/strict-mode-gate@v0.5.12
|
|
261
261
|
with:
|
|
262
262
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|