Skip to content

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

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

kyle-sexton merged 5 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-hook entries in every clone of this repository from one committed lefthook remotes: entry, so each machine gets the same hooks from lefthook install and picks up upstream fixes automatically:

  • commit-msg-convention (commit-msg): the subject against the rule in 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): one remotes: entry, git_url: https://github.com/melodic-software/claude-code-plugins, ref: main, refetch_frequency: 24h, config plugins/guardrails/git-hooks/lefthook-remote.yml.
  • That is the whole diff against main. The earlier revision of this PR vendored copies under .githooks/guardrails/ and needed ShellCheck, shfmt and machine-path exclusions for them in .github/workflows/pr-require-checks.yml, plus a subject_pattern in .claude/source-control.md; all of that is gone. The subject rule now comes from the standards-synced commit-convention.yml.
  • No other changes kept.

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.
  • lefthook install: sync hooks: ✔️(commit-msg, pre-push, pre-commit). This PR's commits ran the remote pre-commit-content and commit-msg-convention, and its push ran reference-verify.

Observation runs from the earlier revision, still valid because the remote runs the same hook scripts:

Hook Observation Findings Classification
reference-verify pre-push replay of origin/main~200..origin/main, 28 changed .md/.sh/.ps1 files, 6 s 0 none; no file in the range exceeds the argument-size limit (largest README.md, 31,947 bytes)
pre-commit-content each of the last 100 non-merge commits replayed into the index (1 to 65 staged files each; every count matches that commit's own change list, renames counted once), 10 s total 0 none. A planted /home/<name>/... probe was caught (rc 1), so the replay exercises the check
commit-msg-convention subject rule tested against the last 500 subjects on main (all 308) 1 non-matching: Initial commit narrowly justified exception: GitHub's repository-creation commit, never made through a hook

Related

🤖 Generated with Claude Code

… jobs

Commit the guardrails plugin's three git-hook entries (commit-msg-convention,
pre-commit-content, reference-verify) 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 vendored copies under .githooks/guardrails/ are plugin-owned, so the
ShellCheck, shfmt and machine-path lanes skip them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@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 🔄 Running since 2026-10-24T04:02:10.955663Z 997186e 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.

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

claude-review reviewed 997186ed897ad1802ead7ff80f1065c24b7063fd: 0 finding(s), 0 as inline comments.

Code review: no findings.

I read the full diff, which is one new file, lefthook.yml. It declares a single lefthook remotes: entry pointing at claude-code-plugins (ref: main, refetch_frequency: 24h, config plugins/guardrails/git-hooks/lefthook-remote.yml). I also read the PR context and the one path-scoped rule, .claude/rules/pr-body-contract.md.

  • PR body: It opens with No related issue: <reason> and has ## Summary, ## Fix, ## Verification and ## Related, so it meets the PR body contract. There is no closing issue, so no acceptance criteria apply.
  • Commit convention: docs/conventions/source-control/commit-convention.yml, which the PR says the commit-msg hook reads, exists in the repo and is a managed file. I confirmed the file is present; I did not run the hooks.
  • Verification claims: The install.mjs verify, lefthook install and replay results in the PR are author-claimed. I did not run them and don't count them as independently confirmed.
  • Unpinned remote (not reported here): The remote follows the mutable ref: main and refetches every 24h. Hook code from another repo therefore runs in every clone. I left this out of this lane because the repo has a separate security-review workflow (pr-review-security-hosted.yml), which should judge it.
  • Hold classes: None apply. The change adds no model spend, doesn't touch trusted-actors, CODEOWNERS or .gitmodules, and has no critical security finding for this lane.
  • Plugin manifests: The diff changes no manifests, so no manifest <field> lines apply.

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

claude-security-review reviewed 997186ed897ad1802ead7ff80f1065c24b7063fd: 1 finding(s), 1 as inline comments.

Security review: PR 493 (head 997186e)

The diff adds one file, lefthook.yml. It declares a lefthook remotes: entry that pulls the guardrails git-hook config from melodic-software/claude-code-plugins. No Actions workflow, plugin manifest, or instruction-surface file changed, and the change touches no trust-gate path.

Finding (1, SUGGESTION): lefthook.yml lines 2-3. The remote uses the floating ref main and re-fetches every 24h. Lefthook runs whatever hook commands that remote config defines on each contributor's machine. A malicious or mistaken commit to claude-code-plugins main would therefore run on every clone at the next commit or push, with no review in this repository. The PR describes the auto-update as intended, so I raised it as a trade-off. Pinning ref to a tag or SHA and bumping it by PR would narrow it, as would confirming that branch protection and required review on the upstream main is the accepted control. I inspected only this diff and did not read the upstream hook scripts, so I did not assess what they do.

Nothing else turned up. There is no CRITICAL finding, so no hold is needed.

critical-findings: 0

@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: 1479f956f9

ℹ️ 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/pre-commit-content.sh Outdated
Comment thread .githooks/guardrails/reference-verify.sh Outdated
@kyle-sexton
kyle-sexton marked this pull request as draft October 23, 2026 21:34
kyle-sexton and others added 3 commits October 24, 2026 00:00
…lugins lefthook remote

Replace the vendored .githooks/guardrails/ copies, their lefthook jobs and
the lint exclusions they needed with one lefthook remotes: entry pointing at
melodic-software/claude-code-plugins (ref main, refetched every 24h). The
commit subject rule comes from docs/conventions/source-control/commit-convention.yml,
so .claude/source-control.md keeps no subject_pattern.

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:02
@kyle-sexton
kyle-sexton enabled auto-merge (squash) October 24, 2026 04:02
Comment thread lefthook.yml
@kyle-sexton
kyle-sexton merged commit bb2ed15 into main Oct 24, 2026
71 of 72 checks passed
@kyle-sexton
kyle-sexton deleted the chore/guardrails-shared-git-hooks branch October 24, 2026 04:05
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