clud-bug 0.6.7 → 0.6.10

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/prompts.js CHANGED
@@ -65,11 +65,50 @@ the stable system-prompt prefix (you're reading it now) at 10% of
65
65
  standard input cost, but variable per-PR content is NOT cached, so
66
66
  size discipline on those fetches pays back directly.
67
67
 
68
- - PR diff: \`gh pr diff "$PR_NUMBER" | head -c "$MAX_DIFF_BYTES"\`
69
- (default 80,000 bytes covers ~95% of real PRs unbruised). If
70
- the output looks truncated mid-line, note it in your review and
71
- request the omitted hunks via \`gh pr diff "$PR_NUMBER" --name-only\`
72
- + a targeted re-fetch of the specific files that need scrutiny.
68
+ - PR diff (incremental on fix-push v0.6.10+):
69
+ On a re-review (not first pass), fetch only the delta between
70
+ your prior pass and HEAD instead of the full PR. The handshake
71
+ state lives in your PRIOR SUMMARY COMMENT as an HTML marker:
72
+ \`<!-- last-reviewed-sha: <sha> -->\`.
73
+
74
+ CRITICAL — identifying the PRIOR SUMMARY (not the progress comment):
75
+ \`anthropics/claude-code-action\` posts an in-progress
76
+ \`[claude]: Claude Code is working…\` comment BEFORE this prompt
77
+ runs. That comment IS authored by claude[bot] but is NOT your
78
+ prior summary — it has no marker. Walking "the LAST claude[bot]
79
+ comment" would always land on the progress comment and the
80
+ handshake would never fire. Instead, identify the prior summary
81
+ by its HEADER LINE: it begins with \`## 🐛 Clud Bug review\`
82
+ (same anchor the strict-mode gate uses for classification).
83
+
84
+ Detection in three steps:
85
+
86
+ 1. Fetch claude[bot] comments newest-first:
87
+ \`gh api "repos/$REPO_OWNER/$REPO_NAME/issues/$PR_NUMBER/comments?per_page=100&sort=created&direction=desc"\`
88
+ Walk them in order; find the FIRST whose body starts
89
+ (after any \`**Claude finished …**\` preamble the action
90
+ prepends) with \`## 🐛 Clud Bug review\`. THAT is your prior
91
+ summary. In its body, look for \`last-reviewed-sha: <sha>\`.
92
+
93
+ 2. If a SHA was found, verify it's still in HEAD's ancestry:
94
+ \`git merge-base --is-ancestor <prior_sha> $HEAD_SHA\`
95
+ (exit 0 = yes, ancestry intact; non-zero = rebased/force-pushed).
96
+
97
+ 3. Branch:
98
+ - Marker present AND ancestor intact (well-behaved fix-push):
99
+ \`git diff <prior_sha>..$HEAD_SHA | head -c "$MAX_DIFF_BYTES"\`
100
+ - Marker missing OR not an ancestor (first review or rebase):
101
+ \`gh pr diff "$PR_NUMBER" | head -c "$MAX_DIFF_BYTES"\`
102
+
103
+ Default cap is 80,000 bytes — covers ~95% of real PRs unbruised.
104
+ If output looks truncated mid-line, request the omitted hunks via
105
+ \`gh pr diff "$PR_NUMBER" --name-only\` + a targeted re-fetch.
106
+
107
+ Edge case — span check: if a delta-review surfaces a finding that
108
+ might affect unchanged code outside the delta (a fix-push edits a
109
+ function whose callers were fine in the prior pass), do a one-time
110
+ \`gh pr diff "$PR_NUMBER"\` to confirm before flagging. The
111
+ incremental view is for fast re-confirmation, not for blind trust.
73
112
 
74
113
  - Skill files: \`head -c "$MAX_SKILL_BYTES" .claude/skills/<name>/SKILL.md\`
75
114
  per file (default 4,000 bytes). Baseline skills fit easily;
@@ -112,6 +151,20 @@ At the end of every review, append a single-line footer:
112
151
  If you genuinely cited none, list "[none]" and explain why no
113
152
  installed skill applied to this diff.
114
153
 
154
+ Incremental-diff handshake (v0.6.10+) — emit the SHA marker:
155
+ At the very end of the summary comment (after the Skills-referenced
156
+ footer, on its own line), append the HTML marker that the next
157
+ review pass will read to decide between full-diff vs incremental:
158
+
159
+ <!-- last-reviewed-sha: $HEAD_SHA -->
160
+
161
+ (\`$HEAD_SHA\` is provided via the workflow env block; literal value
162
+ goes in the comment, not the variable name.) The marker is silent
163
+ to human readers (HTML comment) but load-bearing for cost: every
164
+ subsequent fix-push review re-fetches only the delta since this
165
+ SHA instead of the full PR. If you omit the marker, the next
166
+ review falls back to a full \`gh pr diff\` — correct but wasteful.
167
+
115
168
  Strict-mode header (opt-in): if .claude/skills/.clud-bug.json
116
169
  contains { "strictMode": true }, the comment header you post
117
170
  MUST signal whether you flagged a critical issue:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clud-bug",
3
- "version": "0.6.7",
3
+ "version": "0.6.10",
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",
@@ -56,10 +56,14 @@ jobs:
56
56
  PR_NUMBER: ${{ github.event.pull_request.number }}
57
57
  REPO_OWNER: ${{ github.repository_owner }}
58
58
  REPO_NAME: ${{ github.event.repository.name }}
59
+ # HEAD_SHA (v0.6.10+) — see workflow.yml.tmpl for design notes.
60
+ HEAD_SHA: ${{ github.event.pull_request.head.sha }}
59
61
  # Per-section byte budgets — see workflow.yml.tmpl for design notes.
60
62
  MAX_DIFF_BYTES: '80000'
61
63
  MAX_COMMENT_BYTES: '20000'
62
64
  MAX_SKILL_BYTES: '4000'
65
+ # Thinking-budget cap (v0.6.8) — see workflow.yml.tmpl for design notes.
66
+ MAX_THINKING_TOKENS: '8000'
63
67
  # Stable prefix → CLI auto-cached system layer (10% cost on hits).
64
68
  # See workflow.yml.tmpl for design notes.
65
69
  APPEND_SYSTEM_PROMPT: |
@@ -69,7 +73,8 @@ jobs:
69
73
  track_progress: true
70
74
  show_full_output: true
71
75
  claude_args: |
72
- --allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh api graphql:*),Bash(gh api repos/:*),Bash(git show:*),Bash(cat .claude/skills/.clud-bug.json),Bash(cat .claude/skills/*/SKILL.md),Bash(head:*)"
76
+ --max-turns 15
77
+ --allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh api graphql:*),Bash(gh api repos/:*),Bash(git show:*),Bash(git diff:*),Bash(git merge-base:*),Bash(cat .claude/skills/.clud-bug.json),Bash(cat .claude/skills/*/SKILL.md),Bash(head:*)"
73
78
  prompt: |
74
79
  Review this pull request following the discipline in your
75
80
  system prompt — every rule about skill routing, comment
@@ -79,6 +84,6 @@ jobs:
79
84
  # Strict-mode gate — composite action; see workflow.yml.tmpl for design notes.
80
85
  - name: Strict mode — fail check on critical findings
81
86
  if: success()
82
- uses: thrillmade/clud-bug/.github/actions/strict-mode-gate@v0.6.7
87
+ uses: thrillmade/clud-bug/.github/actions/strict-mode-gate@v0.6.10
83
88
  with:
84
89
  github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -56,10 +56,14 @@ jobs:
56
56
  PR_NUMBER: ${{ github.event.pull_request.number }}
57
57
  REPO_OWNER: ${{ github.repository_owner }}
58
58
  REPO_NAME: ${{ github.event.repository.name }}
59
+ # HEAD_SHA (v0.6.10+) — see workflow.yml.tmpl for design notes.
60
+ HEAD_SHA: ${{ github.event.pull_request.head.sha }}
59
61
  # Per-section byte budgets — see workflow.yml.tmpl for design notes.
60
62
  MAX_DIFF_BYTES: '80000'
61
63
  MAX_COMMENT_BYTES: '20000'
62
64
  MAX_SKILL_BYTES: '4000'
65
+ # Thinking-budget cap (v0.6.8) — see workflow.yml.tmpl for design notes.
66
+ MAX_THINKING_TOKENS: '8000'
63
67
  # Stable prefix → CLI auto-cached system layer (10% cost on hits).
64
68
  # See workflow.yml.tmpl for design notes.
65
69
  APPEND_SYSTEM_PROMPT: |
@@ -69,7 +73,8 @@ jobs:
69
73
  track_progress: true
70
74
  show_full_output: true
71
75
  claude_args: |
72
- --allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh api graphql:*),Bash(gh api repos/:*),Bash(git show:*),Bash(cat .claude/skills/.clud-bug.json),Bash(cat .claude/skills/*/SKILL.md),Bash(head:*)"
76
+ --max-turns 15
77
+ --allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh api graphql:*),Bash(gh api repos/:*),Bash(git show:*),Bash(git diff:*),Bash(git merge-base:*),Bash(cat .claude/skills/.clud-bug.json),Bash(cat .claude/skills/*/SKILL.md),Bash(head:*)"
73
78
  prompt: |
74
79
  Review this pull request following the discipline in your
75
80
  system prompt — every rule about skill routing, comment
@@ -79,6 +84,6 @@ jobs:
79
84
  # Strict-mode gate — composite action; see workflow.yml.tmpl for design notes.
80
85
  - name: Strict mode — fail check on critical findings
81
86
  if: success()
82
- uses: thrillmade/clud-bug/.github/actions/strict-mode-gate@v0.6.7
87
+ uses: thrillmade/clud-bug/.github/actions/strict-mode-gate@v0.6.10
83
88
  with:
84
89
  github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -82,6 +82,12 @@ jobs:
82
82
  PR_NUMBER: ${{ github.event.pull_request.number }}
83
83
  REPO_OWNER: ${{ github.repository_owner }}
84
84
  REPO_NAME: ${{ github.event.repository.name }}
85
+ # HEAD_SHA (v0.6.10+) — emitted as `<!-- last-reviewed-sha: ... -->`
86
+ # marker at the end of every summary comment. The next review pass
87
+ # reads the marker and switches `gh pr diff` (full) → `git diff
88
+ # <prior_sha>..HEAD` (delta) when the SHA is still in HEAD's
89
+ # ancestry. Fix-push reviews ingest only the new bytes.
90
+ HEAD_SHA: ${{ github.event.pull_request.head.sha }}
85
91
  # Per-section byte budgets (v0.6.4). The system-prompt instructs
86
92
  # Claude to cap each per-PR input fetch with `head -c`. Caching
87
93
  # covers the stable system prefix; capping covers the variable
@@ -90,6 +96,13 @@ jobs:
90
96
  MAX_DIFF_BYTES: '80000'
91
97
  MAX_COMMENT_BYTES: '20000'
92
98
  MAX_SKILL_BYTES: '4000'
99
+ # MAX_THINKING_TOKENS caps Claude Code's extended-thinking budget per
100
+ # turn. Anthropic docs (v0.6.8): "For simpler tasks where deep reasoning
101
+ # isn't needed, you can reduce costs by lowering MAX_THINKING_TOKENS=8000."
102
+ # PR review needs some reasoning but not unbounded; default budget is
103
+ # tens of thousands of tokens. 8000 is the Anthropic-recommended cap
104
+ # for review-shaped tasks.
105
+ MAX_THINKING_TOKENS: '8000'
93
106
  # APPEND_SYSTEM_PROMPT lands inside the Claude Code CLI's auto-cached
94
107
  # system layer (system prompt, tools, conversation history). Anthropic
95
108
  # bills cached input tokens at 10% of standard input — within a 5-min
@@ -108,7 +121,8 @@ jobs:
108
121
  # measure caching effectiveness post-rollout (per v0.6.3 plan).
109
122
  show_full_output: true
110
123
  claude_args: |
111
- --allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh api graphql:*),Bash(gh api repos/:*),Bash(git show:*),Bash(cat .claude/skills/.clud-bug.json),Bash(cat .claude/skills/*/SKILL.md),Bash(head:*)"
124
+ --max-turns 15
125
+ --allowedTools "mcp__github_inline_comment__create_inline_comment,Bash(gh pr comment:*),Bash(gh pr diff:*),Bash(gh pr view:*),Bash(gh api graphql:*),Bash(gh api repos/:*),Bash(git show:*),Bash(git diff:*),Bash(git merge-base:*),Bash(cat .claude/skills/.clud-bug.json),Bash(cat .claude/skills/*/SKILL.md),Bash(head:*)"
112
126
  prompt: |
113
127
  Review this pull request following the discipline in your
114
128
  system prompt — every rule about skill routing, comment
@@ -130,6 +144,6 @@ jobs:
130
144
  # Letting the action's own failure fail the check is louder and right.
131
145
  - name: Strict mode — fail check on critical findings
132
146
  if: success()
133
- uses: thrillmade/clud-bug/.github/actions/strict-mode-gate@v0.6.7
147
+ uses: thrillmade/clud-bug/.github/actions/strict-mode-gate@v0.6.10
134
148
  with:
135
149
  github-token: ${{ secrets.GITHUB_TOKEN }}