feat: fold in the portable Claude Code, zsh and git config; add a drift check
Added (all now linked from their live locations): - home_root/.claude/settings.json. The statusLine command now uses $HOME instead of a Linux-only absolute path. - home_root/.claude/bin/ratecheck and home_root/.claude/skills/australis-design. - home_config/zsh/claude-config-dir.zsh and home_root/.local/bin/claude-config-dir-init, the per-repo Claude Code login helper and its seeding script. - home_root/.gitconfig and home_config/git/ignore. - home_root/.zshenv, with the cargo env line guarded so boxes without rust start clean. link-dotfiles --check reports drift without changing anything: tracked files whose live copy is no longer a link (stow dry-run conflicts) and links into this repo that dangle. Exits 1 on drift. Verified against a clean baseline and two planted drifts, a detached .nanorc and a dangling link. .mailmap maps every earlier identity to Vuong Hoang: the repo-local 'Your Name' placeholder config (now removed), host-generated emails, and aider suffixes. CLAUDE.md: the symlink warning now lists every linked file and points at --check. README: documents what is and isn't tracked under .claude, the edit rule, and --check.
This commit is contained in:
@@ -10,11 +10,41 @@
|
||||
#
|
||||
# Windows / PowerShell: run ./link-dotfiles.ps1 instead (stow has no native
|
||||
# Windows port; the .ps1 mirrors this with junctions + symlinks).
|
||||
#
|
||||
# `--check`: report drift and change nothing. Two kinds are caught. (1) A tracked
|
||||
# file whose live copy is no longer a link into this repo: stow would refuse to
|
||||
# stow over it, so the repo copy has silently gone stale. `sed -i` and any other
|
||||
# write-temp-then-rename editor does this, and so can an app that rewrites its
|
||||
# own config atomically. (2) A link into this repo whose target has been removed.
|
||||
# Exits 1 on drift.
|
||||
set -euo pipefail
|
||||
|
||||
repo="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
cd "$repo"
|
||||
|
||||
if [ "${1:-}" = "--check" ]; then
|
||||
command -v stow >/dev/null 2>&1 || { echo "error: GNU stow not installed; run ./link-dotfiles once first." >&2; exit 2; }
|
||||
drift=0
|
||||
for spec in "home_root:$HOME" "home_config:$HOME/.config"; do
|
||||
pkg="${spec%%:*}"; target="${spec#*:}"
|
||||
out="$(stow -n -v --target="$target" "$pkg" 2>&1 | grep -v 'simulation mode' || true)"
|
||||
if [ -n "$out" ]; then
|
||||
drift=1
|
||||
echo "✗ $pkg -> $target is not fully linked:"
|
||||
printf '%s\n' "$out" | sed 's/^/ /'
|
||||
fi
|
||||
done
|
||||
dangling="$(find "$HOME" "$HOME/.config" "$HOME/.claude" "$HOME/.claude/bin" "$HOME/.claude/skills" "$HOME/.local/bin" \
|
||||
-maxdepth 1 -xtype l -lname "*dotfiles/*" 2>/dev/null || true)"
|
||||
if [ -n "$dangling" ]; then
|
||||
drift=1
|
||||
echo "✗ links into dotfiles whose target is gone:"
|
||||
printf '%s\n' "$dangling" | sed 's/^/ /'
|
||||
fi
|
||||
[ "$drift" -eq 0 ] && echo "✓ no drift: every tracked file is linked, and no dotfiles link dangles."
|
||||
exit "$drift"
|
||||
fi
|
||||
|
||||
# `--apps`: install all host CLI tools first, then link. Without it, this only
|
||||
# links (fast + idempotent). App install is delegated to the host-aware
|
||||
# lk-installers/install-apps.
|
||||
|
||||
Reference in New Issue
Block a user