Skip to content

Add external git hooks backend (#1250)#1265

Open
SnowingFox wants to merge 1 commit into
entireio:mainfrom
SnowingFox:feat/external-git-hooks
Open

Add external git hooks backend (#1250)#1265
SnowingFox wants to merge 1 commit into
entireio:mainfrom
SnowingFox:feat/external-git-hooks

Conversation

@SnowingFox
Copy link
Copy Markdown

close #1250

New git_hooks.backend = "external" setting redirects Entire's hook detection from .git/hooks/ to a user-managed external_dir (e.g. .husky, common/git-hooks). In external mode Entire never writes to the user's hook directory or to .git/hooks/ — it only checks for the marker "Entire CLI hooks" in scripts the user maintains.

  • settings: GitHooksSettings (backend + external_dir) with whole-block merge, repo-relative + no-".." validation, strict enum on backend
  • strategy: GetGitHookDetectionDir branches detection by backend; InstallGitHook / RemoveGitHook / CheckAndWarnHookManagers short-circuit in external mode via shared externalGitHooksDir helper
  • setup: verifyExternalGitHooksPrecondition gates every enable variant on external_dir existence and surfaces a 5-script instructional help message (FormatExternalDirMissingHelp, shared with doctor); status line uses PrintExternalHookStatusIfActive
  • doctor: new checkExternalGitHooks surfaces ✓/✗ for external_dir, contributes to overall doctor exit code, stays silent in direct mode
  • tests: settings (7) + hooks (6) + hook_managers (1) + doctor (3) + integration end-to-end Husky-shape (2)
  • docs: new docs/architecture/external-git-hooks.md covering rationale, user contract, all 5 hook script templates, migration paths

New git_hooks.backend = "external" setting redirects Entire's hook
detection from .git/hooks/ to a user-managed external_dir (e.g. .husky,
common/git-hooks). In external mode Entire never writes to the user's
hook directory or to .git/hooks/ — it only checks for the marker
"Entire CLI hooks" in scripts the user maintains.

- settings: GitHooksSettings (backend + external_dir) with whole-block
  merge, repo-relative + no-".." validation, strict enum on backend
- strategy: GetGitHookDetectionDir branches detection by backend;
  InstallGitHook / RemoveGitHook / CheckAndWarnHookManagers short-circuit
  in external mode via shared externalGitHooksDir helper
- setup: verifyExternalGitHooksPrecondition gates every enable variant
  on external_dir existence and surfaces a 5-script instructional help
  message (FormatExternalDirMissingHelp, shared with doctor); status
  line uses PrintExternalHookStatusIfActive
- doctor: new checkExternalGitHooks surfaces ✓/✗ for external_dir,
  contributes to overall doctor exit code, stays silent in direct mode
- tests: settings (7) + hooks (6) + hook_managers (1) + doctor (3) +
  integration end-to-end Husky-shape (2)
- docs: new docs/architecture/external-git-hooks.md covering rationale,
  user contract, all 5 hook script templates, migration paths

Co-authored-by: Cursor <cursoragent@cursor.com>
Entire-Checkpoint: f184ee6ced2f
@SnowingFox SnowingFox requested a review from a team as a code owner May 26, 2026 08:10
Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Add an external Git hooks backend for Rush, Husky, and other hook managers

1 participant