Skip to content

feat(hooks): robust git-hook registration + lefthook support (2.3.0)#56

Closed
jurby wants to merge 1 commit into
mainfrom
feat/robust-hooks-lefthook
Closed

feat(hooks): robust git-hook registration + lefthook support (2.3.0)#56
jurby wants to merge 1 commit into
mainfrom
feat/robust-hooks-lefthook

Conversation

@jurby
Copy link
Copy Markdown
Contributor

@jurby jurby commented Jun 3, 2026

Problem

Git hooks could silently stop firing — most visibly the post-commit local_evidence.py emitter, so contribution evidence stopped landing on items (the reported bug). Two root causes:

  1. install_hooks used a blunt not dst.exists() guard — if a slot was already occupied (typically by lefthook, which owns .git/hooks/), EDPA silently skipped its hook.
  2. After a plugin update, update_engine.sh re-vendored the engine but never re-registered hooks; the copies in .git/hooks/ went stale / missing.

Fix

  • Robust install_hooks — hooks carry an EDPA-MANAGED-HOOK sentinel; per slot: install when missing, refresh when EDPA-owned, never clobber a foreign hook (warns + prints the exact chain-in line).
  • lefthook support — detects lefthook.yml and prints a paste-ready snippet (with use_stdin: true on pre-push, or lefthook hangs) instead of touching .git/hooks/. EDPA never edits the user's lefthook config.
  • Self-healupdate_engine.sh re-registers EDPA hooks after a version bump when the project already uses them (opt-out repos untouched).
  • New --check-hooks (read-only doctor) and --refresh-hooks (register-only) flags.
  • scripts/hooks/install.sh → thin delegator (drops the conflicting core.hooksPath); removed dead generic pre-commit; ANSI now TTY-aware.

Docs / web

RUNBOOK §1+§6, quick-start, skills/setup/SKILL.md, playbook.md, README ×2, E2E-TEST-PLAN, plus website setup/guide/playbook/methodology (CZ + EN). Documents the lefthook snippet, foreign-hook behavior, and --check-hooks verification.

Tests

New tests/test_project_setup_hooks.py (fresh install, refresh, foreign-skip, lefthook snippet validity) + self-heal cases in tests/test_update_engine_hook.py. Full suite: 618 passed.

Release

Version bumped to 2.3.0 (plugin.json + web/package.json + CHANGELOG). Web deploy + gh release to follow after merge.

🤖 Generated with Claude Code

Git hooks could silently stop firing after a plugin update or under lefthook — most visibly the post-commit local_evidence.py emitter, so contribution evidence stopped landing on items. install_hooks now marks hooks with an EDPA-MANAGED-HOOK sentinel and decides per slot (install / refresh / never-clobber-foreign), detects lefthook and prints a paste-ready snippet (use_stdin:true on pre-push), and update_engine.sh self-heals registration after a version bump. Adds --check-hooks and --refresh-hooks, reconciles the stale core.hooksPath installer into a thin delegator, removes the dead generic pre-commit, and makes ANSI TTY-aware. Docs + web (CZ/EN) updated; new test_project_setup_hooks.py + self-heal tests (618 passed).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jurby
Copy link
Copy Markdown
Contributor Author

jurby commented Jun 3, 2026

Superseded by #57 — same work, branch renamed to defect/D-1-hook-registration so it satisfies the EDPA branch-naming convention (dogfooding the very convention this PR strengthens).

@jurby jurby closed this Jun 3, 2026
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