Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Git said the commit succeeded. My hooks never ran.

说明与用途

在新的 git worktree 中,Husky 钩子因缺少可执行 shim 而未运行。通过在 Cursor 会话启动时添加验证和修复脚本,并为云代理设置钩子桥接,消除了静默跳过。

问题

Husky pre‑commit hooks were not executed in a git worktree because the worktree inherited the hooksPath but did not have the executable shims generated by Husky.

结果

Hooks are now reliably detected, repaired, or flagged across worktrees and Cloud Agents, preventing silent skips and ensuring pre‑commit checks run as intended.

工作流

  • Add git worktree; it inherits core.hooksPath but lacks Husky shims.
  • Commit in the worktree; Git accepts it without running hooks.
  • Detect missing shims via verify:git-hooks script during session start.
  • Repair missing shims if possible; warn with "HOOKS NOT RUNNABLE" if not.
  • Use Cursor hook bridge to route Git hook execution to the repository at commit time.
  • Ensure Cloud Agents wait for the bridge before starting work.
  • Package verification, repair, and lifecycle scripts into a marketplace plugin.
  • Wire scripts into each repository’s installation and session‑start lifecycle.
  • Monitor hook availability in each environment.

证据

Husky still has to generate executable shims under .husky/_ in that worktree, and git worktree add does not do that step for you.

来源

I moved hook verification and repair into shared scripts that run when a Cursor session starts.

来源

Cloud Agents need another safeguard. Cursor's hook bridge routes Git hook execution to the current repository at commit time.

来源

  • 记录日期: 2026-10-16T06:41:04.364Z