Skip to content

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

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 lefthook install and they update from claude-code-plugins main every 24 hours, with no vendored copies:

  • commit-msg-convention (commit-msg): the subject against the synced 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.

These are repository git hooks, not a plugin port or Cursor plugin hooks, so the trust-review rule for ports that add MCP servers or hooks does not apply.

Fix

  • lefthook.yml (new): one remotes: entry, git_url: https://github.com/melodic-software/claude-code-plugins, ref: main, refetch_frequency: 24h, configs: [plugins/guardrails/git-hooks/lefthook-remote.yml], from install.mjs plan --scope remote.
  • Nothing else differs from main: the earlier vendored .githooks/guardrails/ copies, their lefthook jobs, the README layout lines and the new .claude/source-control.md are gone (the synced commit convention supplies the pattern).

Verification

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

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

A second plan --scope remote returns no decisions. This PR's commit ran guardrails-remote-pre-commit-content and guardrails-remote-commit-msg-convention, and its push ran guardrails-remote-reference-verify, all passing.

Observation runs against this repository's history in report-only mode (the remote serves the same hook scripts, so this evidence holds):

Hook Observation Findings Classification
reference-verify pre-push replay of origin/main~121..origin/main (the repo has 122 commits), 52 changed files, 3 s 0 none
pre-commit-content each of the last 100 non-merge commits replayed into the index (every replay staged 1 or more files, only that commit's), 8 s total 1 commit (3ef6f19, #23): 4 lines narrowly justified exception: scripts/sync-local.sh and plugins/plugin-ops/skills/sync-local/SKILL.md name the D:\/C:\ repos\github.com\melodic-software\cursor-plugins checkouts in the deliberate, fixed fallback list sync-local tries when no -Source is given (README, Install / update). Current content still has them, so a future edit of those lines would block. Whether that fallback list fits the plugin design boundary (no machine paths) is a separate question for the owner
commit-msg-convention subject pattern against all 122 subjects on main 2 non-matching pre-convention history: Add Cloud Agent environment for cursor-plugins (#18) and Initial commit

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 the
commit-msg hook enforces in .claude/source-control.md.

The .githooks/guardrails/ files are plugin-owned copies written by
install.mjs copy --scope shared (guardrails 0.55.4), staged 100755 where they
carry a shebang. The installer's .gitattributes line is left out: the managed
`* text=auto eol=lf` already keeps them LF.

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 17:06
@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:04:02.631447Z 94026dd 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 94026dd2ef0cfac34dcf1c709ecf39a10a6312bb: 0 finding(s), 0 as inline comments.

No findings. The PR adds one file, lefthook.yml, with a single remotes: entry, and I found no correctness or maintainability defect in it.

  • Scope: the diff is 6 lines of config. It touches no scripts, manifests, plugins or docs. That leaves no sync-local regression case to add, no Verified date to move, and no commands/ file. The plugin manifest checks don't apply because no plugin.json or marketplace.json changes.
  • Closing issue: the PR uses the "No related issue" escape and gives a reason, so there are no acceptance criteria to check.
  • Embedded text: the PR body contains no instructions aimed at the reviewer.
  • Verification: I read the diff and PR context only. The install.mjs verify output and the hook observation runs in the PR body are author-claimed. I did not run or confirm them, and the remote config the file points at (claude-code-plugins#9504) is outside this diff.
  • Not reviewed here: the remote tracks ref: main with a 24-hour refetch, so every clone runs hook code from that branch. That is a trust and supply-chain question for the security lane, not this one. The PR body also says the 4 lines in scripts/sync-local.sh and plugins/plugin-ops/skills/sync-local/SKILL.md naming machine paths would block a future edit of those lines under pre-commit-content. It already marks that as a separate question for the owner, so I didn't raise it.
  • Hold: none. The change adds no model spend and touches no trust-gate files.

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

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

Security review: PR #126 (head 94026dd)

The PR adds one file, lefthook.yml, with a single remotes: entry. It pulls plugins/guardrails/git-hooks/lefthook-remote.yml from melodic-software/claude-code-plugins at ref: main and refetches it every 24h. It replaces the vendored .githooks/guardrails/ copies. I read the diff with gh pr diff. The wrapper supplied no FULL DIFF: or PR CONTEXT: files. I did not fetch the remote file, so I have not seen the commands it runs.

Findings

  • IMPORTANT: lefthook.yml:3, unpinned mutable-ref remote that runs as git hooks.
    • The remote follows the moving main branch, so its hook definitions execute on every contributor's machine at git commit and git push time.
    • Anyone with push access to claude-code-plugins main can ship a hook change that runs on all consumers of this remote within 24h. It needs no PR and no review in this repo.
    • Those machines hold the contributor's git credentials and tokens. The earlier vendored copies were reviewed in-repo.
    • Recommended fix: pin ref to a tag or commit SHA, bumped through reviewed PRs. If tracking main is intentional, record that and confirm branch protection and required review on the source repo.
    • Posted inline.

Manifest fields

No .cursor-plugin/plugin.json or marketplace.json change in this diff, so no manifest <field> lines apply.

Other notes

  • Skip gate: the PR is open, and a hook-execution source is a security-relevant surface, so I reviewed it.
  • No instruction-surface deletions.
  • The diff does not touch a trust-gate path.

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: fb8dd9584b

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

Replace the vendored hook copies under .githooks/guardrails/ with one
lefthook remotes: entry that fetches plugins/guardrails/git-hooks/lefthook-remote.yml
from melodic-software/claude-code-plugins (ref main, refetched every 24h).

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
@kyle-sexton
kyle-sexton merged commit 4e0e37c into main Oct 24, 2026
27 of 28 checks passed
@kyle-sexton
kyle-sexton deleted the chore/guardrails-shared-git-hooks branch October 24, 2026 04:03
Comment thread lefthook.yml
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