Skip to content

integration install claude rewrites all of ~/.claude/settings.json (reorders every key, drops the trailing newline) to add one hook #2066

Description

@willprout

Is this a reproducible bug?

  • I confirm this is a reproducible bug, not a feature request, idea, question, contribution proposal, or direction check.
  • I reproduced this bug on the version and environment reported below using the exact steps provided.

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_prettysrc/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

  1. Have a ~/.claude/settings.json with keys in non-alphabetical order and a trailing newline; keep a copy.
  2. herdr integration install claude.
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    akbash-workingAkbash is actively working on this issuebugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions