-
Notifications
You must be signed in to change notification settings - Fork 88
[BUG] Global hook deployment writes to ~/.github/hooks/ instead of ~/.copilot/hooks/ #565
Description
Describe the bug
apm install --global reports "1 hook(s) integrated -> .copilot/hooks/" but the hooks are actually written to ~/.github/hooks/ instead of ~/.copilot/hooks/. The log message reads from the correctly scope-resolved target, but the hook integrator hardcodes .github/hooks and ignores the target's root_dir.
Skills deploy correctly to ~/.copilot/skills/ at user scope; hooks do not.
To Reproduce
- Have a package with
.apm/hooks/containing a hook JSON file - Run
apm install --global <owner>/<repo> --force --verbose - Log says:
|-- 1 hook(s) integrated -> .copilot/hooks/ - Check
~/.copilot/hooks/-- does not exist - Check
~/.github/hooks/-- hook was written here instead
Expected behavior
Hooks should be deployed to ~/.copilot/hooks/ when installing at user scope with the Copilot target, matching the behavior of skills and agents which correctly use the scope-resolved root_dir.
Environment (please complete the following information):
- OS: macOS (Darwin)
- Python Version: 3.12
- APM Version: 0.8.9+
Logs
|-- 1 hook(s) integrated -> .copilot/hooks/ <-- log says .copilot
ls -la ~/.copilot/hooks/ <-- does not exist
ls -la ~/.github/hooks/ <-- hook is here instead
Additional context
Root cause: hook_integrator.py line ~334 hardcodes project_root / ".github" / "hooks" instead of using the target's root_dir. The integrate_hooks_for_target() method receives the scope-resolved target but does not pass it to integrate_package_hooks().
Same class of bug previously fixed for other integrators in PRs #536 and #537. The hook integrator was missed in that sweep.
Copilot CLI supports ~/.copilot/hooks/ for user-level hooks since v0.0.422.