Skip to content

chore(git-hooks): run the guardrails git hooks from the claude-code-plugins lefthook remote - #870

Merged
kyle-sexton merged 3 commits into
mainfrom
chore/guardrails-shared-git-hooks
Oct 24, 2026
Merged

kyle-sexton merged 3 commits into
mainfrom
chore/guardrails-shared-git-hooks

Conversation

@kyle-sexton

@kyle-sexton kyle-sexton commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

No related issue: rolls out the guardrails lefthook remote (claude-code-plugins#9504)

Summary

Runs the guardrails plugin's three git hooks in this repository from one lefthook remotes: entry, so every clone gets the same hooks from committed config and picks up upstream changes within 24 h:

  • commit-msg-convention (commit-msg): the subject against the repository's commit convention (docs/conventions/source-control/commit-convention.yml).
  • pre-commit-content (pre-commit): secrets and machine-specific paths on added lines.
  • reference-verify (pre-push): CLI flags, /plugin:skill references and deleted paths on pushed lines.

Fix

  • lefthook.yml (new; the repository had no hook manager): only a remotes: entry for https://github.com/melodic-software/claude-code-plugins, ref: main, refetch_frequency: 24h, config plugins/guardrails/git-hooks/lefthook-remote.yml.
  • Compared with the earlier revision of this PR, removed: the vendored .githooks/guardrails/ copies, the three local guardrails-* jobs, the shellcheck exclude: and the machine-specific-paths-exclude addition in .github/workflows/pr-require-checks.yml, and the ## subject_pattern section in .claude/source-control.md (main now carries commit-convention.yml). The ShellCheck exclude issue ci-workflows#871 is moot.
  • No other change.

Verification

install.mjs verify --repo <worktree> (rc 0):

ok	commit-msg-convention
ok	pre-commit-content
ok	reference-verify

install.mjs plan --scope remote afterwards: no decisions left. This PR's commit and push ran the remote jobs (guardrails-remote-reference-verify passed on push).

Observation runs from the earlier revision still hold, since the remote runs the same hook scripts:

Hook Observation Findings Classification
reference-verify pre-push replay of origin/main~200..origin/main (86 changed .md/.sh/.ps1 files), 28 s 0 findings; 1 file not checked tool noise / known upstream defect: .github/actions/pr-require-checks/aggregate-results/run.test.sh (138,358 bytes) exceeds the 128 KiB per-argument limit, so jq fails with Argument list too long and the file is skipped without a finding. Item 4 of claude-code-plugins#9426
pre-commit-content each of the last 100 non-merge commits replayed into the index (update-ref HEAD c~1 && read-tree c; 424 staged files in all), 20 s total 0 none. A positive control (a staged /home/<name>/ path) blocks with rc 1
commit-msg-convention subject_pattern tested against the last 500 subjects on main 0 non-matching none

Related

🤖 Generated with Claude Code

… jobs

Commit the guardrails plugin's commit-msg-convention, pre-commit-content
and reference-verify entries as shared lefthook jobs, so every clone gets
them from `lefthook install`, and record the subject_pattern they enforce
in .claude/source-control.md.

The copies under .githooks/guardrails/ are plugin-owned (guardrails
0.55.4). CI's ShellCheck job and machine-specific path scan skip them:
ShellCheck flags 13 findings in the copies, and the path scan self-matches
the pattern sources.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kyle-sexton
kyle-sexton marked this pull request as ready for review October 23, 2026 16:53
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-24T04:02:45.963583Z c5fd691 Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: 73f50948bc

ℹ️ 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 .githooks/guardrails/reference-verify.sh Outdated
kyle-sexton and others added 2 commits October 24, 2026 00:00
…lugins lefthook remote

Replace the vendored .githooks/guardrails copies and their lint and
machine-path exclusions with one lefthook remotes entry pointing at
claude-code-plugins main (plugins/guardrails/git-hooks/lefthook-remote.yml).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kyle-sexton kyle-sexton changed the title chore(git-hooks): install the guardrails git hooks as shared lefthook jobs chore(git-hooks): run the guardrails git hooks from the claude-code-plugins lefthook remote Oct 24, 2026
@kyle-sexton
kyle-sexton marked this pull request as ready for review October 24, 2026 04:01
@claude

claude Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Claude finished @kyle-sexton's task in 2m 52s —— View job


Security review complete

  • Gather context (PR diff, changed files)
  • Run /review:security-review criteria against the diff
  • Post findings / summary

Scope: the only changed file is lefthook.yml (new, 6 lines), which replaces the PR's earlier vendored-hook-scripts revision with a single lefthook remotes: entry that pulls the guardrails git hooks (commit-msg-convention, pre-commit-content, reference-verify) from melodic-software/claude-code-plugins at runtime. Not eligible for the cheap skip gate — adding an auto-fetched, auto-executed remote config is security-relevant surface.

1 finding (inline comment on lefthook.yml, IMPORTANT): ref: main is a mutable branch pointer rather than a pinned commit SHA, and refetch_frequency: 24h makes lefthook periodically re-fetch it, so the hook scripts that run on every contributor's git commit/git push are whatever is currently on that branch, re-synced roughly daily, with no corresponding commit in this repo to review when they change. The PR's earlier revision vendored these scripts in-repo (each carrying a sha256 tracking header), which gave this repo a reviewable diff on any hook-code change; this revision removes that review surface in favor of trusting the remote's main branch directly. This is a logic/trust-boundary observation this lane is scoped to surface — it's local lefthook.yml config, not a GitHub Actions workflow, so it isn't zizmor's unpinned-action-pin lane. The PR body does link the design discussion (claude-code-plugins#9426), so this may be a knowingly accepted trade-off; flagging it so that acceptance is explicit. Suggested mitigation: pin ref to a specific commit SHA or signed tag and bump it deliberately.

Verified by an independent adversarial pass before posting (confirmed lefthook's remotes:/refetch_frequency semantics and that the carve-out for Actions-pin findings doesn't apply here).

No Actions-workflow files, secrets handling, injection surfaces, or access-control code were touched by this PR, so no findings beyond the one above.

critical-findings: 0

claude-lane-summary: lane=claude-security-review sha=c5fd691999f07494e3bcfce48315ece7a9a15f17 run=40060694646

@claude

claude Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Claude finished @kyle-sexton's task in 1m 43s —— View job


Code review — PR #870

  • Gather context (diff, PR body, .claude/rules/, REVIEW.md, prior review threads)
  • Apply code-review-lane criteria
  • Report findings

Scope. The diff is a single 6-line addition, lefthook.yml, adding a remotes: entry that points at plugins/guardrails/git-hooks/lefthook-remote.yml in melodic-software/claude-code-plugins (ref: main, refetch_frequency: 24h). Per the PR description, the earlier revision's vendored .githooks/guardrails/ scripts and local jobs were removed in favor of this remote config.

Findings: none. The change is declarative CI/dev-tooling config with no logic to break:

  • remotes:/configs: keys match lefthook's documented remote-config schema.
  • The pinned-branch + 24h refetch design is the PR's own stated intent (shared hooks, bounded staleness), not an oversight.
  • The earlier Codex finding on .githooks/guardrails/reference-verify.sh (jq argument-size limit) no longer applies to this revision's diff — that file is removed here and is tracked upstream in claude-code-plugins#9426 per the author's reply on that thread.
  • Trust/execution implications of pulling hook code from a remote repo are a security-lane concern; pr-review-security.yml runs on this repo, so that's out of scope here per REVIEW.md.

Other checks.

  • manifest: N/A — no .claude-plugin/plugin.json or marketplace.json changed.
  • Paved paths: no resolvable standards index found locally; nothing to report.
  • Closing issue: no PR-context file was supplied to this lane, so closing-issue criteria are unread, not verified met.
  • PR body contract (.claude/rules/pr-body-contract.md): body opens with No related issue: <reason> and includes ## Summary, ## Fix, ## Verification, ## Related — compliant.

No holds (cost, trust-gate, critical-security) apply.

claude-lane-summary: lane=claude-review sha=c5fd691999f07494e3bcfce48315ece7a9a15f17 run=40060694646

@github-actions

Copy link
Copy Markdown

claude-review has reviewed this pull request through c5fd691; a later push is reviewed from there.

Comment thread lefthook.yml
@github-actions

Copy link
Copy Markdown

claude-security-review has reviewed this pull request through c5fd691; a later push is reviewed from there.

@kyle-sexton
kyle-sexton added this pull request to the merge queue Oct 24, 2026
Merged via the queue into main with commit c604693 Oct 24, 2026
102 of 106 checks passed
@kyle-sexton
kyle-sexton deleted the chore/guardrails-shared-git-hooks branch October 24, 2026 04:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant