Is this a reproducible bug?
Current behavior
herdr integration install claude gets the semantic change exactly right — one SessionStart hook added, every other subtree preserved — but it rewrites the whole ~/.claude/settings.json in the process: every key at every level is reordered alphabetically and the trailing newline is dropped. (The file is parsed into a serde_json::Value and re-serialized with to_string_pretty — src/integration/targets.rs:98-151 at v0.7.5, with serde_json's default non-order-preserving map.) For a hand-maintained, version-controlled settings file the textual diff is the entire file instead of the one hook entry.
Expected behavior
Adding the hook changes only the hook entry: surrounding key order, formatting, and the trailing newline survive the edit, so the diff shows just the added hook.
Reproduction
- Have a
~/.claude/settings.json with keys in non-alphabetical order and a trailing newline; keep a copy.
herdr integration install claude.
diff the copy against the file: every key is reordered and the final newline is gone; the only semantic change is the added SessionStart hook.
Impact
My settings.json is version-controlled and contains several hooks, so a one-hook install produces a whole-file diff. Since hooks execute commands, being able to review that install diff at a glance matters; today it takes a semantic JSON comparison to confirm only one hook was added.
Environment
- Herdr version: 0.7.5 (official
herdr-macos-aarch64 release binary)
- Update channel (stable or preview): stable
- Operating system: macOS 26.2 (25C56), Apple Silicon
- Terminal: n/a — plain CLI invocation (reproduced from a zsh in a macOS terminal)
- Shell, if relevant: zsh
- Relevant config, if any: existing
~/.claude/settings.json with several hooks and non-alphabetical key order
Is this a reproducible bug?
Current behavior
herdr integration install claudegets the semantic change exactly right — one SessionStart hook added, every other subtree preserved — but it rewrites the whole~/.claude/settings.jsonin the process: every key at every level is reordered alphabetically and the trailing newline is dropped. (The file is parsed into aserde_json::Valueand re-serialized withto_string_pretty—src/integration/targets.rs:98-151at v0.7.5, with serde_json's default non-order-preserving map.) For a hand-maintained, version-controlled settings file the textual diff is the entire file instead of the one hook entry.Expected behavior
Adding the hook changes only the hook entry: surrounding key order, formatting, and the trailing newline survive the edit, so the diff shows just the added hook.
Reproduction
~/.claude/settings.jsonwith keys in non-alphabetical order and a trailing newline; keep a copy.herdr integration install claude.diffthe copy against the file: every key is reordered and the final newline is gone; the only semantic change is the added SessionStart hook.Impact
My settings.json is version-controlled and contains several hooks, so a one-hook install produces a whole-file diff. Since hooks execute commands, being able to review that install diff at a glance matters; today it takes a semantic JSON comparison to confirm only one hook was added.
Environment
herdr-macos-aarch64release binary)~/.claude/settings.jsonwith several hooks and non-alphabetical key order