Give settings.json's model one writer per machine, and sort its keys

This commit is contained in:
2026-10-21 21:26:40 +02:00
parent 4fbe529cfe
commit 7c3800337a
11 changed files with 127 additions and 40 deletions
+20
View File
@@ -0,0 +1,20 @@
#!/usr/bin/env python3
"""Git's clean filter for settings.json: drop "model" and sort every key.
Claude Code rewrites settings.json, in its own key order, whenever a model is
picked or a plugin installed. Each machine owns its model, so git stores the
file without it, and neither write shows as a change.
"""
import json
import sys
def main() -> None:
settings = json.load(sys.stdin)
settings.pop("model", None)
json.dump(settings, sys.stdout, ensure_ascii=False, indent=2, sort_keys=True)
sys.stdout.write("\n")
if __name__ == "__main__":
main()