Skip to content

chore: scrub /pr-status references + fix hook regex false-positive#18

Merged
tombakerjr merged 2 commits into
mainfrom
feature/drop-pr-status-from-hook-and-readme
May 23, 2026
Merged

chore: scrub /pr-status references + fix hook regex false-positive#18
tombakerjr merged 2 commits into
mainfrom
feature/drop-pr-status-from-hook-and-readme

Conversation

@tombakerjr
Copy link
Copy Markdown
Owner

Summary

Follow-up cleanup to #16. Two surfaces still referenced /pr-status, plus a regex bug in the hook itself surfaced during the cleanup commit.

Changes

1. hooks/git-guard.py — warning text

The hook globally warned on PR-merge invocations, telling Claude to run /pr-status first — but that command no longer exists. Rewritten to describe the SHA-anchored verification protocol inline (CI watch, sticky-comment SHA match against headRefOid, blocker scan) and point at project CLAUDE.md / memory for full details.

2. hooks/git-guard.py — anchor the warning regex

Discovered the hard way: the prior regex matched the literal command substring anywhere in the command, including inside HEREDOC bodies. A git commit -m "$(cat <<EOF ... gh pr merge ... EOF)" would falsely trigger the merge warning. Mirror the anchor pattern already used by the on-main commit-block check ((?:^|&&|;|\|) before the match) so only real invocations trigger.

3. README.md — broad cleanup

  • Drop /pr-status from the Slash Commands table (only /context-recovery remains).
  • Feature Development Path + Bug Fix Path tables now reference native gh ops instead of /pr-status.
  • Mermaid flowchart's merge subgraph updated.
  • Git Guards table updated to reflect the new warning text.
  • "The PR Readiness Check" section rewritten into "PR Review Verification" with the SHA-anchored protocol (matching CLAUDE.md and plan-execution SKILL).
  • Usage Examples describe the inline flow.
  • Installation Options use the new canonical repo name claude-code-workflows (was claude-code-pr-workflow; GitHub redirects, but the canonical URL is the rename).

Why this isn't in #16

The hook fired during this session as I was merging #16, surfacing the stale warning. The README staleness was noted as out of scope at the time. The regex false-positive only became visible when this commit's message body (which references the merge command verbatim) triggered the hook on an unrelated git commit — caught and fixed in the same PR.

Test plan

  • CI passes (no claude-review feedback expected — this is the workflow-file repo, but no workflow YAML changes here)
  • After merge: next gh pr merge ... invocation surfaces the new warning text
  • After merge: git commit -m "...mentions gh pr merge..." does NOT trigger the warning
  • After merge + claude plugin update: warning behavior takes effect locally

🤖 Generated with Claude Code

tombakerjr and others added 2 commits May 23, 2026 16:59
Follow-up to PR #16 (which dropped /pr-status). Two surfaces still referenced
the removed command: the git-guard.py PreToolUse hook (which warned globally
on every `gh pr merge`, telling Claude to run /pr-status first — a command
that no longer exists) and the README (workflow tables, command list,
"The PR Readiness Check" section).

git-guard.py:
- Rewrite the `gh pr merge` warning text to point at the SHA-anchored
  verification protocol instead of /pr-status. New message lists the inline
  steps (gh pr checks --watch, parse Reviewed commit sha, compare to
  headRefOid) and refers to project CLAUDE.md / memory for the full protocol
- Update module docstring to match

README.md:
- Drop /pr-status from the Slash Commands table (only context-recovery remains)
- Update Feature Development Path and Bug Fix Path tables to reference native
  gh ops instead of /pr-status
- Update mermaid flowchart's merge subgraph
- Update Git Guards table for the new `gh pr merge` warning text
- Rewrite "The PR Readiness Check" section into "PR Review Verification"
  with the SHA-anchored protocol (matching CLAUDE.md and plan-execution SKILL)
- Update Usage Examples to describe the inline flow
- Fix Installation Options to use the new repo name `claude-code-workflows`
  (was `claude-code-pr-workflow`; GitHub redirects but canonical URL is the
  rename)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The git-guard hook's warning trigger was matching the literal substring
anywhere in the command, including inside HEREDOC bodies of unrelated
commands (e.g., a git-commit whose message body happens to mention the
merge command verbatim). False warnings on `git commit` are noisy and
misleading.

Mirror the anchor pattern already used by the on-main commit-block check:
require start-of-command or a shell-operator boundary (&&, ;, |) before
the match. Common invocations still warn; commit messages and other
quoted strings don't trigger.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@claude
Copy link
Copy Markdown

claude Bot commented May 23, 2026

Claude finished @tombakerjr's task in 1m 44s —— View job


Reviewed commit: 90aa847

CONSIDER: .claude-plugin/plugin.json:9-10homepage and repository fields still point to claude-code-pr-workflow. The PR correctly updates the README install URLs and git-guard warning, but these two fields were missed. GitHub redirects so it's not broken, but it's inconsistent with the stated goal of canonicalising to claude-code-workflows. Fix this →

The regex anchor fix is correct and consistent with the existing git commit guard pattern (line 70). Warning text and README rewrites look accurate.

@tombakerjr tombakerjr merged commit 2493a1d into main May 23, 2026
2 checks passed
@tombakerjr tombakerjr deleted the feature/drop-pr-status-from-hook-and-readme branch May 23, 2026 21:02
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