Skip to content

[BUG] Global hook deployment writes to ~/.github/hooks/ instead of ~/.copilot/hooks/ #565

@sergio-sisternes-epam

Description

@sergio-sisternes-epam

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

  1. Have a package with .apm/hooks/ containing a hook JSON file
  2. Run apm install --global <owner>/<repo> --force --verbose
  3. Log says: |-- 1 hook(s) integrated -> .copilot/hooks/
  4. Check ~/.copilot/hooks/ -- does not exist
  5. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds-triageNew issue, not yet reviewed by maintainers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions