Skip to content

ci: add aireceipts auto-attach hook (two-file kit)#994

Merged
anandgupta42 merged 2 commits into
mainfrom
dogfood/aireceipts-auto-attach
Jul 8, 2026
Merged

ci: add aireceipts auto-attach hook (two-file kit)#994
anandgupta42 merged 2 commits into
mainfrom
dogfood/aireceipts-auto-attach

Conversation

@anandgupta42

@anandgupta42 anandgupta42 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Adds the second file of the aireceipts two-file kit: the .claude/settings.json PreToolUse hook that auto-attaches a receipt ref on push, so receipts generate automatically (no manual command) and the existing pr-check workflow has something to post.

  • The hook runs 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 to origin.
  • This repo runs no other refs/receipts/* producer, so there is no collision.
  • Remove anytime by deleting/reverting the file.

Part of the org-wide aireceipts dogfood (v0.6.0).


Summary by cubic

Adds a .claude/settings.json PreToolUse hook that auto-attaches an aireceipts receipt on push. Receipts generate automatically so the pr-check workflow has data to post.

  • New Features
    • Runs npx -y aireceipts-cli@latest hook pre-push with a 60s timeout (cold-cache headroom).
    • Never blocks pushes (always exits 0, no output).
    • Only runs on real branch pushes to origin.

Written for commit 4320808. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Chores
    • Added an automated pre-push hook to run an aireceipts-cli pre-push check before changes are sent.
    • The hook includes a timeout to keep the pre-push step responsive.
    • Helps catch issues earlier and improves consistency in the local development workflow.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adds a new .claude/settings.json file defining a PreToolUse hook that matches Bash tool usage and runs npx -y aireceipts-cli@latest hook pre-push with a 60-second timeout.

Changes

Claude settings hook

Layer / File(s) Summary
Add PreToolUse hook config
.claude/settings.json
Configures a PreToolUse hook that executes aireceipts-cli pre-push via npx -y with a 60-second timeout.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Possibly related PRs

Poem

A hook before the push, so neat,
npx scurries on tiny feet,
Sixty seconds tick, receipts in tow,
Bash commands now know where to go,
Hop hop hooray, the config's complete! 🐇

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers the summary but misses the required PINEAPPLE header, Test Plan, and Checklist sections. Add PINEAPPLE at the very top, then include the required Test Plan and Checklist sections from the template.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title is concise and accurately summarizes the main change: adding an aireceipts auto-attach hook.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dogfood/aireceipts-auto-attach

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@kilo-code-bot

kilo-code-bot Bot commented Jul 8, 2026

Copy link
Copy Markdown

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Incremental Review — timeout 10s60s

The new commit is a single-line change bumping the hook timeout from 10 to 60 in .claude/settings.json. The JSON remains well-formed and matches the Claude Code hooks schema. The increase directly resolves a prior reviewer concern that 10s was too short for a cold-cache first-run npx resolution, while hook failures stay non-blocking.

No shipped-surface code, Effect flows, storage, auth, or build paths are touched, so there is no runtime-correctness, security, or packaging risk to the altimate binary.

Files Reviewed (1 file)
  • .claude/settings.json
Previous Review Summary (commit 0753d53)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 0753d53)

Status: No Issues Found | Recommendation: Merge

This PR adds a single new .claude/settings.json file registering a Claude Code PreToolUse hook that runs npx -y aireceipts-cli@latest hook pre-push on Bash tool use (timeout 10s). The settings structure matches the standard Claude Code hooks schema (PreToolUsematcherhooks[] with type: command/command/timeout), and JSON is well-formed.

No shipped-surface code, Effect flows, storage, auth, or build paths are touched, so there is no runtime-correctness, security, or packaging risk to the altimate binary.

Files Reviewed (1 file)
  • .claude/settings.json

Reviewed by glm-5.2 · Input: 21.8K · Output: 4.2K · Cached: 131.1K

Review guidance: REVIEW.md from base branch main

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
.claude/settings.json (1)

9-10: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Pin the CLI and revisit the 10s timeout.

npx -y aireceipts-cli@latest makes 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

📥 Commits

Reviewing files that changed from the base of the PR and between a7fb223 and 0753d53.

📒 Files selected for processing (1)
  • .claude/settings.json

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Comment thread .claude/settings.json
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread .claude/settings.json
"hooks": [
{
"type": "command",
"command": "npx -y aireceipts-cli@latest hook pre-push",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment thread .claude/settings.json
"hooks": [
{
"type": "command",
"command": "npx -y aireceipts-cli@latest hook pre-push",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment thread .claude/settings.json Outdated
{
"type": "command",
"command": "npx -y aireceipts-cli@latest hook pre-push",
"timeout": 10

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@dev-punia-altimate

Copy link
Copy Markdown
Contributor

🤖 Code Review — OpenCodeReview (Gemini) — No Issues Found

No comments generated. Looks good to me.

@anandgupta42 anandgupta42 merged commit ddc8864 into main Jul 8, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants