Skip to content

Use forked apm to stop settings.json hook duplication#508

Merged
srid merged 2 commits intomasterfrom
apm-fork-hook-dedup
Apr 14, 2026
Merged

Use forked apm to stop settings.json hook duplication#508
srid merged 2 commits intomasterfrom
apm-fork-hook-dedup

Conversation

@srid
Copy link
Copy Markdown
Member

@srid srid commented Apr 14, 2026

Bare apm install duplicates hook entries in .claude/settings.json on every re-run, so kolu's apm recipe papers over it by wiping .claude/ before each install and apm-update does rm -f settings.json for the same reason. The real bug is microsoft/apm#708 — the merge integrator .extend()s the per-event hook list unconditionally instead of upserting by _apm_source.

Pin apm_cmd to microsoft/apm#709, which filters existing entries owned by the package before appending fresh ones. Fix is eight lines in hook_integrator.py plus two regression tests covering idempotent re-integration and healing of pre-existing duplicates. Both workarounds in ai.just — the wholesale .claude/ wipe and the settings.json rm -f — are dropped; apm install is now safe to run over a live tree.

The workflow instructions also pick up a small fix: /do now knows to invoke the /test and /ci skills for the test and CI pipeline steps (previously only just check / just fmt were documented, leaving those steps without a verified execution path).

Revert apm_cmd back to microsoft/apm once #708 lands upstream. Branch comment in ai.just flags this.

srid added 2 commits April 14, 2026 09:18
srid/agency delegates the test and CI steps to project-local skills,
but kolu's workflow instructions only described `just check` and
`just fmt` — so `/do` had no documented way to invoke `/test` or
`/ci`. Point the test and CI steps at the colocated skills so the
pipeline knows what to run.
Bare `apm install` duplicates a package's hook entries in
.claude/settings.json on every re-run because the merge integrator
extends the per-event list unconditionally (microsoft/apm#708).

The kolu workaround — wiping .claude/ inside the `apm` recipe and
`rm -f .claude/settings.json` inside `apm-update` — works but masks
the upstream bug and leaks destructive behaviour into every install.

Switch `apm_cmd` to juspay/apm#fix/hook-idempotent-install, which
upserts by `_apm_source` before appending, and drop both
workarounds. Revert to `microsoft/apm` once the fix lands upstream.
@srid srid merged commit eb604a9 into master Apr 14, 2026
6 of 10 checks passed
@srid srid deleted the apm-fork-hook-dedup branch April 14, 2026 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant