Skip to content

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

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-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 exclusions for them in .github/workflows/pr-require-checks.yml and .cursor/check.sh.
    • A README note describing them.
    • A regex 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 configuration decisions left, only the advisory no-ci-rerun: no CI workflow re-runs reference-verify's jq check.
  • lefthook install: sync hooks: ✔️(pre-commit, commit-msg, pre-push). This PR's commit ran the remote pre-commit-content (0.11 s) and commit-msg-convention (0.03 s), 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~182..origin/main (whole history after the root commit; 24 changed .md/.sh/.ps1 files), 2 s 0 none
pre-commit-content each of the last 100 non-merge commits replayed into the index (1 to 18 staged files per commit, none empty), 8 s total 0 none
commit-msg-convention subject rule tested against all 183 subjects on main 1 non-matching: Initial commit (root commit) narrowly justified exception: the repository's creation commit, never re-checked

Related

🤖 Generated with Claude Code

… jobs

Commit the guardrails plugin's commit-msg-convention, pre-commit-content
and reference-verify hooks as lefthook jobs so every clone gets them from
`lefthook install`, with no per-machine hook settings.

- .githooks/guardrails/: plugin-owned copies from install.mjs (0.55.4).
- lefthook.yml: the three installer snippets.
- .claude/source-control.md: subject_pattern is now the explicit regex
  the hook enforces (twelve types, optional scope, Merge and Revert).
- ShellCheck (CI and .cursor/check.sh) skips the vendored copies.
- README inventory lists the new files.

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:46
@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:09:28.456303Z bb87d72 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 bb87d72984f5bfd044c28c6e9a3686084867571e: 0 finding(s), 0 as inline comments.

Code review: no findings

The PR adds one root file, lefthook.yml. It declares a single remotes: entry for the guardrails git-hooks config in claude-code-plugins, at ref: main with a 24h refetch.

What I checked myself:

  • Existing lefthook support. .gitignore already ignores lefthook-local.yml and .lefthook-local/, so the new file fits the repo's existing lefthook handling.
  • Managed-file guard. lefthook.yml is not on the managed-files guard's path list, so the sync-managed-file check should not flag it. The listed .lefthook/* files are not present here and are not touched.
  • Commit-convention source. docs/conventions/source-control/commit-convention.yml exists, which the PR says supplies the commit-msg rule.
  • Diff scope. The diff is the YAML alone and has no logic that could fail on a given input.

Not verified: the PR's install.mjs verify, lefthook install and observation-replay results are author-claimed. I did not run them, and they depend on a remote config I cannot read here.

Notes, none counted as findings:

  • Inventory. The README's "What's here" list does not mention lefthook.yml. CLAUDE.md calls that list the inventory, but it asks only that you read it before editing, and the PR deliberately dropped its earlier README note. At most this is a small docs gap.
  • Floating ref. ref: main with auto-refetch means every clone runs whatever is at the head of the plugins repo within 24h. That is a supply-chain trust question for the security lane (pr-review-security-hosted.yml exists here), not this lane. I did not assess it.
  • Closing issue. There is none ("No related issue" with a stated reason), so there are no acceptance criteria to check.

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

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

Security review: PR #211 (head bb87d72)

I found one IMPORTANT issue, posted inline on lefthook.yml lines 1–6. The PR diff against the base is only that new file. The head commit's --stat lists 51 files, but they are not in the PR diff, so I reviewed only lefthook.yml.

IMPORTANT: unpinned, auto-refreshing remote hook config (lefthook.yml#L1-L6)

  • The remotes: entry points at melodic-software/claude-code-plugins with ref: main and refetch_frequency: 24h.
  • Lefthook runs whatever commands plugins/guardrails/git-hooks/lefthook-remote.yml defines on each contributor's, agent seat's and cloud bootstrap's machine.
  • This replaces vendored hook copies that were reviewed in this repo. The hook code can now change with no PR here.
  • Exploit path: one malicious push to claude-code-plugins main (compromised account or token, or a merged bad change) adds a run: command. Within 24h it runs arbitrary shell, with the committer's credentials, on the next git commit or git push.
  • Fix: pin ref to a commit SHA or immutable tag and bump it by PR (for example via Dependabot).

I did not read the remote file, since it is outside the diff and I could not fetch it.

The PR touches no trust-gate path and no plugin manifests, so the manifest and hold criteria do not apply. I did not run the instruction-surface check or consult the exception register, because the diff removes no rules.

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.

ℹ️ 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:02
…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:08
@kyle-sexton
kyle-sexton enabled auto-merge (squash) October 24, 2026 04:08
@kyle-sexton
kyle-sexton merged commit f71f6d6 into main Oct 24, 2026
39 of 40 checks passed
@kyle-sexton
kyle-sexton deleted the chore/guardrails-shared-git-hooks branch October 24, 2026 04:08

@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: bb87d72984

ℹ️ 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 lefthook.yml
Comment thread lefthook.yml
kyle-sexton added a commit that referenced this pull request Oct 24, 2026
No related issue: follow-up to a review finding on #211
(claude-code-plugins#9504 rollout)

## Summary

Lists `lefthook.yml` in README's "What's here" inventory, which the
tracked-file inventory rule (`AGENTS.md`, Code Review Rules) requires
for every added file.

## Fix

- `README.md`: new **Git hooks** bullet. `lefthook.yml` holds one
`remotes:` entry running the guardrails hooks from
`claude-code-plugins`, and the hook scripts are owned there.

## Verification

- This commit ran the remote `pre-commit-content` and
`commit-msg-convention` hooks (both pass); the push ran
`reference-verify`.
- Addresses the [Codex finding on
#211](#211 (comment)).

## Related

- [#211](#211): added
`lefthook.yml`.
-
[claude-code-plugins#9504](melodic-software/claude-code-plugins#9504):
the remote config.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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