Skip to content

hook-manager: register managers that need no install fix (simple-git-hooks, cargo-husky, Maven plugins) #1825

Closed

Description

@potiuk

The hook-manager contract (#1819) defines how the secure agent setup integrates a git-hook manager: where its install puts the hook, how its home is split between sandboxed and host runs, and how the setup detects that a repository uses it.
Several managers already install into the repository's own hooks dir whatever the global core.hooksPath says, so they need no install fix, only a registry entry (install.strategy: none, which the contract lists as planned) and documentation.
This issue covers them.

What the source says

  • simple-git-hooks 2.14.0 (JavaScript). Reads only git config --local core.hooksPath, else <common dir>/hooks, with worktree commondir resolution (simple-git-hooks.js:60-96, 246-266). It ignores the global value, so it already lands where the dispatcher chains.
    Runs from the package postinstall. It overwrites an existing hook without a backup (:292-303). Skip install: SKIP_INSTALL_SIMPLE_GIT_HOOKS; skip hooks: SKIP_SIMPLE_GIT_HOOKS=1. No home. Config: a simple-git-hooks key in package.json, or .simple-git-hooks.{js,cjs,json} / simple-git-hooks.{js,cjs,json} (confirm the list).
  • cargo-husky v1.0.1 (Rust). A build.rs in a dev-dependency walks up from OUT_DIR to .git and writes <gitdir>/hooks (build.rs:49-73, 154-164), ignoring core.hooksPath.
    It does not handle a .git file, so it fails with GitDirNotFound in a linked worktree, and a CARGO_TARGET_DIR outside the repository breaks it too. Never touches a foreign hook. No home of its own.
  • Maven: git-build-hook 3.6.0 and git-code-format-maven-plugin 1.25 (Java). Both write JGit's getGitDir()/hooks and ignore core.hooksPath.
    git-build-hook's configure goal can write any repository config key (GitConfigMojo.java), core.hooksPath included, which bypasses the dispatcher the same way husky does.
    Not yet checked: JGit's behaviour in a linked worktree, and the generated hook scripts.
  • Not yet researched: Gradle hook plugins, and Go hook tools other than lefthook.

What to do

  1. Implement install.strategy: none in tools/dev/sync-hook-managers.py (no shim case; the install skill installs no shim for it).
  2. Add registry entries for simple-git-hooks, cargo-husky and the two Maven plugins, with their detection rules, and run tools/dev/sync-hook-managers.py.
  3. Check the open points above (JGit in a worktree, the Maven hook scripts), and add Gradle plugins and Go tools if any need an adapter.
  4. Document the cargo-husky worktree limitation and the git-build-hook configure caveat in the contract's adapter table and in docs/setup/secure-agent-setup.md.

Acceptance

  • Each manager's behaviour under the whole-user dispatcher is confirmed by running it once (install, then a commit that runs its hook), and recorded in the contract.
  • prek run --all-files --skip workspace-pytest and the dev tests pass.

Activity

  1. added
    good first issue
    family:setup
    contract:hook-manager
    on Oct 25, 2026
  2. added
    family:docs
    family:ci
    capability:platform
    substrate:framework-dev
    on Oct 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    capability:platformcontract:hook-managerfamily:cifamily:docsfamily:setupfamily:toolsgood first issuesubstrate:framework-dev

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions