clud-bug 0.5.10 → 0.5.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/bin/clud-bug.js CHANGED
@@ -183,7 +183,9 @@ async function runInit(args) {
183
183
 
184
184
  // Install the audit workflow alongside the per-PR review one.
185
185
  // Manual-trigger by default; users opt into the cron by uncommenting.
186
- const auditTmpl = await readFile(join(TEMPLATES, 'audit.yml.tmpl'), 'utf8');
186
+ // Routed through renderFile so {{CCA_VERSION}} substitution pins
187
+ // claude-code-action consistently with the review workflow.
188
+ const auditTmpl = await renderFile(join(TEMPLATES, 'audit.yml.tmpl'), {});
187
189
  const auditPath = join(cwd, '.github', 'workflows', 'clud-bug-audit.yml');
188
190
  await writeFile(auditPath, auditTmpl);
189
191
  log(` wrote ${rel(cwd, auditPath)}`);
@@ -191,7 +193,9 @@ async function runInit(args) {
191
193
  // Install the self-update workflow. Cron weekly Mondays 12:00 UTC; opens
192
194
  // a PR if a newer clud-bug version is published. Disable by deleting the
193
195
  // file or pinning via .claude/skills/.clud-bug.json.
194
- const selfUpdateTmpl = await readFile(join(TEMPLATES, 'self-update.yml.tmpl'), 'utf8');
196
+ // Routed through renderFile for parity (no CCA ref today but future
197
+ // tokens should propagate uniformly).
198
+ const selfUpdateTmpl = await renderFile(join(TEMPLATES, 'self-update.yml.tmpl'), {});
195
199
  const selfUpdatePath = join(cwd, '.github', 'workflows', 'clud-bug-self-update.yml');
196
200
  await writeFile(selfUpdatePath, selfUpdateTmpl);
197
201
  log(` wrote ${rel(cwd, selfUpdatePath)}`);
package/lib/render.js CHANGED
@@ -2,12 +2,26 @@ import { readFile } from 'node:fs/promises';
2
2
 
3
3
  const PLACEHOLDER_RE = /\{\{([A-Z_]+)\}\}/g;
4
4
 
5
+ // Default values for substitution tokens that every template uses.
6
+ // Callers can override per-render by passing the same key in `vars`.
7
+ //
8
+ // CCA_VERSION pins `anthropics/claude-code-action` to a specific tag in
9
+ // every shipped workflow. Without this, templates resolved `@v1` (the
10
+ // floating major), so upstream changes could silently land in installed
11
+ // workflows mid-cycle. Bumping the pin requires a clud-bug release, which
12
+ // makes the upgrade visible + lets users opt out by pinning a different
13
+ // version in their own forked workflow.
14
+ export const DEFAULTS = {
15
+ CCA_VERSION: 'v1.0.133',
16
+ };
17
+
5
18
  export function render(template, vars) {
19
+ const merged = { ...DEFAULTS, ...vars };
6
20
  return template.replace(PLACEHOLDER_RE, (match, key) => {
7
- if (!(key in vars)) {
21
+ if (!(key in merged)) {
8
22
  throw new Error(`Missing template variable: ${key}`);
9
23
  }
10
- return vars[key];
24
+ return merged[key];
11
25
  });
12
26
  }
13
27
 
package/lib/update.js CHANGED
@@ -51,16 +51,20 @@ export async function runUpdate({
51
51
  await maybeRefreshVersioned(join(cwd, '.github/workflows/clud-bug-review.yml'), newReview, changed, unchanged, skipped, 'review workflow');
52
52
 
53
53
  // 2. Re-render audit workflow if it's installed (init from v0.3+ ships it).
54
+ // Routed through renderFile (was raw readFile pre-v0.5.11) so
55
+ // {{CCA_VERSION}} substitution lands in audit alongside review.
54
56
  const auditPath = join(cwd, '.github/workflows/clud-bug-audit.yml');
55
57
  if (await pathExists(auditPath)) {
56
- const newAudit = await readFile(join(templatesDir, 'audit.yml.tmpl'), 'utf8');
58
+ const newAudit = await renderFile(join(templatesDir, 'audit.yml.tmpl'), {});
57
59
  await maybeRefreshVersioned(auditPath, newAudit, changed, unchanged, skipped, 'audit workflow');
58
60
  }
59
61
 
60
62
  // 2b. Re-render self-update workflow if installed (init from v0.4+ ships it).
63
+ // Routed through renderFile for parity — no CCA ref in self-update today
64
+ // but future tokens should propagate uniformly without another refactor.
61
65
  const selfUpdatePath = join(cwd, '.github/workflows/clud-bug-self-update.yml');
62
66
  if (await pathExists(selfUpdatePath)) {
63
- const newSelfUpdate = await readFile(join(templatesDir, 'self-update.yml.tmpl'), 'utf8');
67
+ const newSelfUpdate = await renderFile(join(templatesDir, 'self-update.yml.tmpl'), {});
64
68
  await maybeRefreshVersioned(selfUpdatePath, newSelfUpdate, changed, unchanged, skipped, 'self-update workflow');
65
69
  }
66
70
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clud-bug",
3
- "version": "0.5.10",
3
+ "version": "0.5.11",
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: v1
1
+ # clud-bug-template-version: v2
2
2
  name: Clud Bug 🐛 Audit
3
3
 
4
4
  # A scheduled / on-demand walk through the whole habitat (or a recent slice).
@@ -89,7 +89,7 @@ jobs:
89
89
  git push -u origin "$BRANCH"
90
90
  echo "stub_written=true" >> "$GITHUB_OUTPUT"
91
91
 
92
- - uses: anthropics/claude-code-action@v1
92
+ - uses: anthropics/claude-code-action@{{CCA_VERSION}}
93
93
  if: steps.prep.outputs.stub_written == 'true'
94
94
  env:
95
95
  AUDIT_DATE: ${{ steps.prep.outputs.date }}
@@ -1,4 +1,4 @@
1
- # clud-bug-template-version: v4
1
+ # clud-bug-template-version: v5
2
2
  name: Clud Bug 🐛 Crawls Your Code
3
3
 
4
4
  on:
@@ -50,7 +50,7 @@ jobs:
50
50
  echo "::error::Set it: Settings → Secrets and variables → Actions → New repository secret."
51
51
  exit 1
52
52
 
53
- - uses: anthropics/claude-code-action@v1
53
+ - uses: anthropics/claude-code-action@{{CCA_VERSION}}
54
54
  if: steps.guard.outputs.skip != 'true'
55
55
  env:
56
56
  PR_NUMBER: ${{ github.event.pull_request.number }}
@@ -1,4 +1,4 @@
1
- # clud-bug-template-version: v4
1
+ # clud-bug-template-version: v5
2
2
  name: Clud Bug 🐛 Crawls Your Code
3
3
 
4
4
  on:
@@ -50,7 +50,7 @@ jobs:
50
50
  echo "::error::Set it: Settings → Secrets and variables → Actions → New repository secret."
51
51
  exit 1
52
52
 
53
- - uses: anthropics/claude-code-action@v1
53
+ - uses: anthropics/claude-code-action@{{CCA_VERSION}}
54
54
  if: steps.guard.outputs.skip != 'true'
55
55
  env:
56
56
  PR_NUMBER: ${{ github.event.pull_request.number }}
@@ -1,4 +1,4 @@
1
- # clud-bug-template-version: v4
1
+ # clud-bug-template-version: v5
2
2
  name: Clud Bug 🐛 Crawls Your Code
3
3
 
4
4
  on:
@@ -75,7 +75,7 @@ jobs:
75
75
  echo "::error::Without it, Clud Bug review is a silent no-op."
76
76
  exit 1
77
77
 
78
- - uses: anthropics/claude-code-action@v1
78
+ - uses: anthropics/claude-code-action@{{CCA_VERSION}}
79
79
  # Skip the action when guard already posted the bot/fork advisory.
80
80
  if: steps.guard.outputs.skip != 'true'
81
81
  env: