Describe the bug
A package hook on UserPromptSubmit (or userPromptSubmit) installed for the
copilot target is written to .github/hooks/*.json under the key
"userPromptSubmit". Copilot CLI has no event by that name, so the hook never
runs and nothing is logged.
Copilot's hooks reference
(https://docs.github.com/en/copilot/reference/hooks-configuration) names the
camelCase event userPromptSubmitted. Its PascalCase UserPromptSubmit is the
VS Code-compatible variant, which switches the payload to snake_case.
Cause: _HOOK_EVENT_MAP["copilot"] in
src/apm_cli/integration/hook_integrator.py:
"UserPromptSubmit": "userPromptSubmit",
"userPromptSubmit": "userPromptSubmit",
tests/integration/test_hook_integrator_copilot_casing_e2e.py asserts the
same wrong name.
To Reproduce
- A package
pkg with apm.yml (target: [copilot]) and .apm/hooks/x.json:
{"hooks":{"UserPromptSubmit":[{"hooks":[{"type":"command","command":"echo hit >> hook.log"}]}]}}
- A project that depends on
pkg, with target: [copilot]. Run apm install.
.github/hooks/pkg-x.json holds "userPromptSubmit".
- Start
copilot in the project and send a prompt. No hook.log is written.
- Change the key to
"userPromptSubmitted" in the deployed file, restart
copilot and send a prompt. hook.log contains hit.
Expected behavior
apm writes userPromptSubmitted for the copilot target, and the hook runs on
every prompt.
Environment
- OS: Windows 11 (pwsh 7)
- APM Version: 0.31.0. The same map is on
main at 98616b9.
- GitHub Copilot CLI 1.0.86
Additional context
Related: #2111 (hook semantics), whose comment table already lists
userPromptSubmitted for Copilot. The reverse direction is not covered here:
a Copilot-authored userPromptSubmitted package installed for claude, codex
or kiro passes through unrenamed. That can be a separate issue if wanted.
Sending fix in a PR: map the three spellings to userPromptSubmitted for
copilot target, correct the tests and add a CHANGELOG entry.
I checked two points before you post:
- The file name in step 2 is unverified. I read the deployed file with a wildcard (.github/hooks/.json), so I never saw its actual name. pkg-x.json follows the pattern from the earlier probe, where the file was pkg-herdr-tab-label.json. Either write .github/hooks/.json in step 2, or let me rerun the install and get the real name.
- The template's "Python Version" field is left out. apm here is the installed binary, not something I ran through a Python interpreter.
Describe the bug
A package hook on
UserPromptSubmit(oruserPromptSubmit) installed for thecopilottarget is written to.github/hooks/*.jsonunder the key"userPromptSubmit". Copilot CLI has no event by that name, so the hook neverruns and nothing is logged.
Copilot's hooks reference
(https://docs.github.com/en/copilot/reference/hooks-configuration) names the
camelCase event
userPromptSubmitted. Its PascalCaseUserPromptSubmitis theVS Code-compatible variant, which switches the payload to snake_case.
Cause:
_HOOK_EVENT_MAP["copilot"]insrc/apm_cli/integration/hook_integrator.py:tests/integration/test_hook_integrator_copilot_casing_e2e.pyasserts thesame wrong name.
To Reproduce
pkgwithapm.yml(target: [copilot]) and.apm/hooks/x.json:{"hooks":{"UserPromptSubmit":[{"hooks":[{"type":"command","command":"echo hit >> hook.log"}]}]}}pkg, withtarget: [copilot]. Runapm install..github/hooks/pkg-x.jsonholds"userPromptSubmit".copilotin the project and send a prompt. Nohook.logis written."userPromptSubmitted"in the deployed file, restartcopilotand send a prompt.hook.logcontainshit.Expected behavior
apm writes
userPromptSubmittedfor the copilot target, and the hook runs onevery prompt.
Environment
mainat 98616b9.Additional context
Related: #2111 (hook semantics), whose comment table already lists
userPromptSubmittedfor Copilot. The reverse direction is not covered here:a Copilot-authored
userPromptSubmittedpackage installed for claude, codexor kiro passes through unrenamed. That can be a separate issue if wanted.
Sending fix in a PR: map the three spellings to
userPromptSubmittedforcopilot target, correct the tests and add a CHANGELOG entry.
I checked two points before you post: