Skip to content

chore: guard generated trees against drift with a wrapper and a commit hook - #254

Merged
st0nefish-ci[bot] merged 1 commit into
masterfrom
worktree-chore-generated-drift-guard
Nov 23, 2026
Merged

st0nefish-ci[bot] merged 1 commit into
masterfrom
worktree-chore-generated-drift-guard

Conversation

@St0nefish

Copy link
Copy Markdown
Owner

Summary

  • skills-catalog/ drifted on fix(session): run inbox triage as its own step before the ship prompt in session-end #252 and was only caught by CI. .githooks/pre-commit never runs on a clone with a global core.hooksPath, so a git hook alone would not have helped.
  • Add utils/regen-generated.sh: runs sync.sh -> port-session-skills.py -> skills-catalog.py in dependency order. --check reports drift in all three without writing.
  • Add --check to port-session-skills.py.
  • Add .claude/hooks/check-generated-drift.sh (PreToolUse on Bash), which blocks git commit while a generated tree is stale. It needs no per-clone setup.
  • Point .githooks/pre-commit at the wrapper and document it in CLAUDE.md (new Generated trees section).

Test plan

  • tests/ci/test-generated-drift.sh: 25 cases, using stub generators in a sandbox repo
  • tests/opencode/test-session-port.sh: 74/74 (the porter's --check parsing runs only when executed as a script)
  • utils/regen-generated.sh --check: clean
  • bash test.sh: all pass except 2 unrelated permission-hook cases that also failed on master

Known limits: the hook is a text match, so a quoted git commit is a false positive while drift exists; port --check does not flag orphaned files.

🤖 Generated with Claude Code

https://claude.ai/code/session_018KC1pVf43ZKMjSfWwkMMnx

…t hook

skills-catalog/ drifted on #252 and was only caught by CI. The repo's
.githooks/pre-commit never runs here because a global core.hooksPath
overrides it, so a git hook alone would not have helped.

- add utils/regen-generated.sh: sync -> port -> catalog in dependency
  order, with --check that reports every stage
- add --check to port-session-skills.py
- add a Claude PreToolUse hook that blocks `git commit` while a generated
  tree is stale
- point .githooks/pre-commit at the wrapper
- add tests/ci/test-generated-drift.sh and document it in CLAUDE.md

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018KC1pVf43ZKMjSfWwkMMnx
@st0nefish-ci
st0nefish-ci Bot enabled auto-merge November 23, 2026 16:39
@st0nefish-ci
st0nefish-ci Bot merged commit 5df3d34 into master Nov 23, 2026
8 checks passed
@st0nefish-ci
st0nefish-ci Bot deleted the worktree-chore-generated-drift-guard branch November 23, 2026 16:45
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