fix(pre-commit): keep key order in pretty-format-json so apm-owned JSON survives #146

Merged
Defame1297 merged 2 commits from fix/pretty-json-no-sort-keys-102 into main 2026-09-30 16:47:30 +00:00
2 Commits
Author SHA1 Message Date
Defame1297andClaude Code 18fbdbc8e4 refactor(pre-commit): drop the tool-owned round-trip test for #102
The apm-audit-ci pre-push hook already fails when pretty-format-json sorts
apm-owned JSON, so a dedicated test only improved the diagnosis while adding
~100 lines of bash and a pre-commit cache dependency. Remove the test and the
comment, gates.md and LESSONS.md text that pointed at it; the --no-sort-keys
fix itself is unchanged.

Refs: #102

Co-Authored-By: Claude Code <[email protected]>
Claude-Session: https://claude.ai/code/session_01KkT7RSDwDbmrM9T34b6sTi
2026-09-30 16:37:25 +00:00
Defame1297andClaude Code c2c56ff948 fix(pre-commit): keep key order in pretty-format-json so apm-owned JSON survives
pretty-format-json sorts object keys by default, but apm emits insertion
order and `apm audit --ci` diffs its output byte-for-byte. A file in the
formatter's scope therefore drifts on every commit with an empty git diff.

Pass --no-sort-keys so `.claude/settings.json` and `.claude/apm-hooks.json`
round-trip untouched and drop them from the exclude. marketplace.json stays
excluded: it carries literal em dashes the formatter re-escapes to —.

tests/test-pretty-json-tool-owned.sh runs the repo's real autofix hooks over
copies of the four tracked apm-owned files and fails if any is rewritten, so
losing the flag fails a test instead of surfacing as drift.

Refs: #102

Co-Authored-By: Claude Code <[email protected]>
Claude-Session: https://claude.ai/code/session_01KkT7RSDwDbmrM9T34b6sTi
2026-09-30 16:02:21 +00:00