diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index eff19af..0000000 --- a/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -claude/.claude/settings.json filter=claude-settings diff --git a/.gitignore b/.gitignore index 8eecf21..500889e 100644 --- a/.gitignore +++ b/.gitignore @@ -23,6 +23,10 @@ ssh/.ssh/agent/ # Local tool settings (runtime state only — claude/ stow package is tracked) /.claude/ +# Claude Code owns ~/.claude/settings.json and rewrites it on every /model +# switch, so it's installed as a plain file rather than stowed from here. +claude/.claude/settings.json + # Nested git repos (managed as submodules instead) zprezto/.git diff --git a/CLAUDE.md b/CLAUDE.md index 3ebfcb8..1535aea 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -19,18 +19,6 @@ Personal dotfiles managed with GNU stow. Full details: README.md. `doctor.sh` detect it's missing. - The repo must stay cloned at `~/Development/dotfiles`; stow's symlinks are relative to that path. -- `claude/.claude/settings.json` is owned by Claude Code, which rewrites it on - every `/model` switch, so it's handled in two halves. `.gitattributes` runs it - through `claude-settings-clean.py` (drops the volatile keys, sorts the rest) - so commits only ever carry durable config; a new key Claude Code writes back - as state goes in that script's `VOLATILE`. The file is also marked - `skip-worktree`, because a clean filter alone doesn't quiet `git status` — - git's refresh path hashes the file raw. Both halves are per-clone index and - config state: `bootstrap.sh` sets them, `doctor.sh` checks them. -- To commit a deliberate change to that settings file, unhide it first: - `git update-index --no-skip-worktree claude/.claude/settings.json`, commit, - then re-hide with `--skip-worktree`. While it's hidden, git ignores every - local edit to it, including one you meant to keep. - Shell scripts: keep `shellcheck`-clean (`shellcheck bootstrap.sh doctor.sh lib.sh macos/*.sh`). diff --git a/bootstrap.sh b/bootstrap.sh index 5cb65c8..f9fcb63 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -119,14 +119,6 @@ else sudo apt-get install -y git curl stow zsh tmux neovim xclip ripgrep fd-find fi -# ---- Register the Claude settings clean filter ---- -# .gitattributes names the filter; git only ever runs one it has been given a -# command for, so an unregistered clone silently commits the volatile keys. -echo ">>> Registering the Claude settings clean filter..." -cd "$DOTFILES_DIR" -git config "$CLAUDE_SETTINGS_FILTER" "$CLAUDE_SETTINGS_FILTER_CMD" -git update-index --skip-worktree "$CLAUDE_SETTINGS_FILE" - # ---- Init git submodules ---- echo ">>> Initializing git submodules..." cd "$DOTFILES_DIR" diff --git a/claude-settings-clean.py b/claude-settings-clean.py deleted file mode 100755 index 38fb3e6..0000000 --- a/claude-settings-clean.py +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env python3 -"""Git clean filter for claude/.claude/settings.json. - -Claude Code owns that file: it rewrites the whole thing whenever a runtime -option changes (/model, the theme picker, sandbox toggles), so a stowed, -tracked copy is dirty again the moment you switch models. This strips the keys -Claude Code writes back as machine state and sorts what's left, leaving git to -see only the durable config — hooks, permissions, statusLine, plugins. - -Reads the working-tree file on stdin, writes the committed form on stdout. -Wired up by `git config filter.claude-settings.clean` in bootstrap.sh and -pointed at this file by .gitattributes. -""" - -import json -import sys - -# Written back by Claude Code itself; per-machine, never worth a commit. -VOLATILE = ("model", "theme", "sandbox", "modelSettings") - - -def main() -> None: - raw = sys.stdin.read() - try: - settings = json.loads(raw) - except ValueError: - # A half-written or hand-broken file still has to round-trip: a filter - # that errors here wedges every git command touching the file. - sys.stdout.write(raw) - return - - for key in VOLATILE: - settings.pop(key, None) - - # sort_keys because Claude Code's own key order isn't stable across - # versions — without it a rewrite alone shows up as a diff. - json.dump(settings, sys.stdout, indent=2, sort_keys=True) - sys.stdout.write("\n") - - -if __name__ == "__main__": - main() diff --git a/claude/.claude/settings.json b/claude/.claude/settings.json deleted file mode 100644 index 730cd9e..0000000 --- a/claude/.claude/settings.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "enabledPlugins": { - "claude-md-management@claude-plugins-official": true, - "code-review@claude-plugins-official": true, - "code-simplifier@claude-plugins-official": true, - "frontend-design@claude-plugins-official": true, - "ponytail@ponytail": true, - "security-guidance@claude-plugins-official": true, - "superpowers@claude-plugins-official": false, - "swift-lsp@claude-plugins-official": true - }, - "extraKnownMarketplaces": { - "ponytail": { - "source": { - "repo": "DietrichGebert/ponytail", - "source": "github" - } - } - }, - "hooks": { - "Notification": [ - { - "hooks": [ - { - "command": "command -v afplay >/dev/null && afplay /System/Library/Sounds/Glass.aiff || true", - "type": "command" - } - ], - "matcher": "permission_prompt|agent_needs_input" - }, - { - "hooks": [ - { - "command": "command -v afplay >/dev/null && afplay /System/Library/Sounds/Pop.aiff || true", - "type": "command" - } - ], - "matcher": "idle_prompt|agent_completed" - } - ] - }, - "permissions": { - "deny": [ - "Bash(rm -rf /)", - "Bash(rm -rf /*)", - "Bash(rm -rf ~)", - "Bash(rm -rf ~/*)", - "Bash(git push --force *)", - "Bash(git push * --force *)", - "Bash(git push -f *)", - "Bash(git push * -f *)", - "Bash(sh)", - "Bash(bash)", - "Bash(zsh)" - ] - }, - "statusLine": { - "command": "~/.claude/statusline.sh", - "type": "command" - } -} diff --git a/doctor.sh b/doctor.sh index 4c5159c..0c7f768 100755 --- a/doctor.sh +++ b/doctor.sh @@ -134,21 +134,6 @@ else ok "submodules at recorded commits" fi -configured_filter="$(cd "$DOTFILES_DIR" && git config --get "$CLAUDE_SETTINGS_FILTER" 2>/dev/null)" -if [[ "$configured_filter" == "$CLAUDE_SETTINGS_FILTER_CMD" ]]; then - ok "Claude settings clean filter registered" -else - bad "Claude settings clean filter not registered" - hint "git -C $DOTFILES_DIR config $CLAUDE_SETTINGS_FILTER $CLAUDE_SETTINGS_FILTER_CMD" -fi - -if [[ "$(cd "$DOTFILES_DIR" && git ls-files -v "$CLAUDE_SETTINGS_FILE" 2>/dev/null)" == S* ]]; then - ok "Claude settings marked skip-worktree" -else - bad "Claude settings not marked skip-worktree" - hint "git -C $DOTFILES_DIR update-index --skip-worktree $CLAUDE_SETTINGS_FILE" -fi - if [[ -n "$(cd "$DOTFILES_DIR" && git status --porcelain 2>/dev/null)" ]]; then bad "working tree is dirty" hint "git -C $DOTFILES_DIR status" diff --git a/lib.sh b/lib.sh index 9ea9cb8..2fc1798 100644 --- a/lib.sh +++ b/lib.sh @@ -15,18 +15,6 @@ MACHINE_FILE="$DOTFILES_DIR/.machine" # Stow packages carrying no special options. STOW_PACKAGES=(zsh git tmux ghostty nvim base16 claude) -# Claude Code rewrites ~/.claude/settings.json whenever a runtime option -# changes, which dirties the stowed copy on every /model switch. .gitattributes -# routes the file through this clean filter so git only sees the durable config; -# the filter command itself lives in each clone's git config, set by bootstrap. -# The filter keeps volatile keys out of commits; git still reports the file as -# modified though, because its refresh path hashes the file raw and only the -# diff machinery applies the filter. skip-worktree is what actually silences -# that — see CLAUDE.md for how to commit a deliberate change to the file. -CLAUDE_SETTINGS_FILE="claude/.claude/settings.json" -CLAUDE_SETTINGS_FILTER="filter.claude-settings.clean" -CLAUDE_SETTINGS_FILTER_CMD="$DOTFILES_DIR/claude-settings-clean.py" - # ssh is stowed on its own: --no-folding keeps ~/.ssh a real directory holding a # symlinked config. Folded, ~/.ssh would itself be a symlink into this repo, and # every key or known_hosts file written there would land in the working tree.