Hook execution engine rebuilt with a clearer core/managed split and unified result merging
The internal system that runs hooks has been reorganized. It now clearly separates "core" hook handling from "managed" hook handling, and adds a merge step that combines results from multiple hooks - things like permission decisions, extra context to inject, and file paths to watch - using a priority order where a deny always beats an ask, and an ask always beats an allow. Classic shell-based hooks and newer function-based hooks are now handled through the same unified path, including tracking blocked commands and results tied to WorktreeCreate events (which fire when a worktree, an isolated copy of a repository, is being created).
This is an internal restructuring that makes hook behavior more consistent regardless of whether a hook is a shell script or a function, and ensures that when multiple hooks weigh in on the same action, the strictest decision wins.