ci: add aireceipts auto-attach hook (two-file kit)#994
Conversation
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.
Tip: disable this comment in your organization's Code Review settings.
📝 WalkthroughWalkthroughAdds a new ChangesClaude settings hook
Estimated code review effort: 1 (Trivial) | ~2 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Incremental Review — timeout
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
.claude/settings.json (1)
9-10: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winPin the CLI and revisit the 10s timeout.
npx -y aireceipts-cli@latestmakes the hook non-deterministic, and the same cold-start path is the most likely place to exceed 10s. Please verify the worst-case startup time; if it can miss that window, receipt attachment will become flaky. A pinned, locally available CLI would be much safer.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.claude/settings.json around lines 9 - 10, The pre-push hook command is non-deterministic because it uses aireceipts-cli@latest, and the 10-second timeout may be too tight for cold starts. Update the hook configuration in settings.json to use a pinned, locally available aireceipts-cli version instead of latest, then verify the startup path through the hook command and adjust the timeout only if the worst-case execution can still complete reliably within the window. Refer to the hook command entry that runs hook pre-push so it stays stable and predictable.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In @.claude/settings.json:
- Around line 9-10: The pre-push hook command is non-deterministic because it
uses aireceipts-cli@latest, and the 10-second timeout may be too tight for cold
starts. Update the hook configuration in settings.json to use a pinned, locally
available aireceipts-cli version instead of latest, then verify the startup path
through the hook command and adjust the timeout only if the worst-case execution
can still complete reliably within the window. Refer to the hook command entry
that runs hook pre-push so it stays stable and predictable.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 7265b9a5-b11c-426e-8da9-b5930bb224bc
📒 Files selected for processing (1)
.claude/settings.json
There was a problem hiding this comment.
1 issue found across 1 file
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name=".claude/settings.json">
<violation number="1" location=".claude/settings.json:5">
P3: PreToolUse hook fires on every Bash invocation, not just git pushes — the command runs `npx -y` resolution on every shell command, adding latency to all Bash operations. Consider pre-installing `aireceipts-cli` as a project dependency and running `npx aireceipts-cli hook pre-push` (or a direct path) to eliminate the resolution overhead on non-push Bash calls.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| "hooks": { | ||
| "PreToolUse": [ | ||
| { | ||
| "matcher": "Bash", |
There was a problem hiding this comment.
P3: PreToolUse hook fires on every Bash invocation, not just git pushes — the command runs npx -y resolution on every shell command, adding latency to all Bash operations. Consider pre-installing aireceipts-cli as a project dependency and running npx aireceipts-cli hook pre-push (or a direct path) to eliminate the resolution overhead on non-push Bash calls.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .claude/settings.json, line 5:
<comment>PreToolUse hook fires on every Bash invocation, not just git pushes — the command runs `npx -y` resolution on every shell command, adding latency to all Bash operations. Consider pre-installing `aireceipts-cli` as a project dependency and running `npx aireceipts-cli hook pre-push` (or a direct path) to eliminate the resolution overhead on non-push Bash calls.</comment>
<file context>
@@ -0,0 +1,16 @@
+ "hooks": {
+ "PreToolUse": [
+ {
+ "matcher": "Bash",
+ "hooks": [
+ {
</file context>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0753d53871
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "hooks": [ | ||
| { | ||
| "type": "command", | ||
| "command": "npx -y aireceipts-cli@latest hook pre-push", |
There was a problem hiding this comment.
Guard the receipt hook to only run on pushes
In any Claude Code session for this repo, this PreToolUse group matches every Bash tool call, and because the handler has no if filter, the docs' behavior is that “every handler in the matched group runs.” That means npx -y aireceipts-cli@latest is spawned before unrelated commands like rg, npm test, or git status, adding up to the 10s timeout and npm/network error noise even though the receipt CLI can only do useful work for git push; add an if guard for push commands or a small wrapper that exits before invoking npx for non-push Bash inputs.
Useful? React with 👍 / 👎.
| "hooks": [ | ||
| { | ||
| "type": "command", | ||
| "command": "npx -y aireceipts-cli@latest hook pre-push", |
There was a problem hiding this comment.
Pin the auto-run receipt CLI version
Because this project-level hook is committed and Claude Code executes command hooks automatically for matching Bash calls, @latest lets a future aireceipts-cli release change the code running in contributors' sessions without any repo change; it also conflicts with the commit text calling this dogfood for v0.6.0. Pin the package to the known compatible version so receipt generation remains reproducible and reviewable.
Useful? React with 👍 / 👎.
| { | ||
| "type": "command", | ||
| "command": "npx -y aireceipts-cli@latest hook pre-push", | ||
| "timeout": 10 |
There was a problem hiding this comment.
Allow enough time for first-run npx installs
On a first push from a clean npm cache or a slower/private registry, npx -y aireceipts-cli@latest has to resolve and download the CLI before it can attach the receipt ref, but this hook is cancelled after only 10 seconds. Since hook failures are non-blocking, that scenario silently lets the push continue without producing the receipt that the PR workflow expects; use a longer timeout or a checked-in wrapper/preinstalled dependency so the first real push can complete reliably.
Useful? React with 👍 / 👎.
🤖 Code Review — OpenCodeReview (Gemini) — No Issues FoundNo comments generated. Looks good to me. |
Adds the second file of the aireceipts two-file kit: the
.claude/settings.jsonPreToolUsehook that auto-attaches a receipt ref on push, so receipts generate automatically (no manual command) and the existingpr-checkworkflow has something to post.npx -y aireceipts-cli@latest hook pre-push; it never blocks your push (exits 0 on every path, no output) and only acts on a real branch push toorigin.refs/receipts/*producer, so there is no collision.Part of the org-wide aireceipts dogfood (v0.6.0).
Summary by cubic
Adds a
.claude/settings.jsonPreToolUse hook that auto-attaches an aireceipts receipt on push. Receipts generate automatically so thepr-checkworkflow has data to post.npx -y aireceipts-cli@latest hook pre-pushwith a 60s timeout (cold-cache headroom).origin.Written for commit 4320808. Summary will update on new commits.
Summary by CodeRabbit
aireceipts-clipre-push check before changes are sent.