Skip to content

fix(claude): adopt remoteControlAtStartup, fix settings.json reorder churn - #176

Merged
edge2992 merged 3 commits into
mainfrom
feat/claude-settings-passthrough
Aug 9, 2026
Merged

fix(claude): adopt remoteControlAtStartup, fix settings.json reorder churn#176
edge2992 merged 3 commits into
mainfrom
feat/claude-settings-passthrough

Conversation

@edge2992

@edge2992 edge2992 commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Summary

  • remoteControlAtStartup: trueclaude-settings-base.json に取り込み。Remote Control をローカルで有効化した際 settings.json へ直接書かれ、Write/Edit 経由でない書き込みなので settings-sync.sh フックが拾えていなかった変更。
  • modify_settings.json.tmpl を stdin(現在のターゲット内容)対応にし、再レンダー結果と意味的に同一なら現在の内容をそのまま返すパススルーを追加。Claude Code が設定を書き戻すたびキー順を変える(トグルしたキーを末尾に移動)ため、これまで chezmoi status/diff が内容差ゼロでも永久にキー順ハンクを出し続けていた問題を根治。実際の内容差は引き続き検出される(sorted-key 比較)。
  • scripts/check-json-tmpl.shrender_modify を修正: 従来はレンダーしたスクリプトを sh の stdin にパイプして実行しており、これはスクリプト自身が stdin を読む今回の変更と衝突する。ファイル経由の実行に変更し、任意の stdin を注入できるようにした。あわせてパススルー(キー順のみ変化)/非パススルー(実内容差)の回帰テストを追加。

Test plan

  • make lintlint-json lint-tmpl lint-merge-patch lint-brew-overlay)が全てグリーン
  • chezmoi status --source <worktree> ~/.claude が空になることを確認(従来は MM .claude/settings.json
  • diff <(chezmoi cat --source <worktree> ~/.claude/settings.json | jq -S .) <(jq -S . ~/.claude/settings.json) が空
  • chezmoi cat の出力キー順がライブファイルと一致する(stdin が実際に渡っていることの実証、remoteControlAtStartup が末尾に来る)
  • scripts/check-json-tmpl.sh に追加したパススルー/非パススルーのアサーションがパス

https://claude.ai/code/session_0147ZRxqvMYFFqS3unwTVYZs

Remote Control was toggled locally via Claude Code (writes settings.json
directly, so the PostToolUse settings-sync hook doesn't catch it). Adopt
it into the shared base so every machine starts with it enabled.

Claude-Session: https://claude.ai/code/session_0147ZRxqvMYFFqS3unwTVYZs
Claude Code rewrites ~/.claude/settings.json in place and reorders keys
as it does (e.g. moving a just-toggled key to the end), which made
chezmoi status/diff show reorder-only noise on settings.json forever.

modify_settings.json.tmpl now captures the target's current contents
from stdin and, when the freshly rendered output is semantically equal
(sorted-key comparison), returns the current contents verbatim instead
of the rendered JSON. Real content changes still produce the rendered
output — only key-order-only churn is suppressed.

check-json-tmpl.sh's render_modify helper previously piped the
rendered script into `sh`'s own stdin, which would have collided with
the script now reading its stdin for the passthrough comparison. Fixed
to execute the script from a file with a controllable stdin, and added
regression tests for both the passthrough (reordered, same content)
and non-passthrough (real content diff) cases.

Claude-Session: https://claude.ai/code/session_0147ZRxqvMYFFqS3unwTVYZs
Pre-existing on main since 'update memo template' (ab4fa58) — the file
ended with an extra blank line, which the end-of-file-fixer pre-commit
hook flags on any --all-files run. Unrelated to this PR's settings.json
work, but it made CI red on this branch too; fixing it here so pre-commit
passes.

Claude-Session: https://claude.ai/code/session_0147ZRxqvMYFFqS3unwTVYZs
@edge2992
edge2992 merged commit 3a62f85 into main Aug 9, 2026
9 checks passed
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