Files
claude-config/bin/settings_filter.py
T

21 lines
558 B
Python
Executable File

#!/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()