diff --git a/INSTALL.md b/INSTALL.md index 8aad9cf..96a86fc 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -60,4 +60,14 @@ cd ~/dev/skills && git pull Symlinks pick up the changes automatically. If new skills or agents have been added, re-run `install.sh` to add the new symlinks (it is idempotent and will not overwrite existing -ones). +ones — pass `--force` to repoint a symlink that points at a +different checkout). + +## Worktrees + +The symlinks target the absolute path of the clone `install.sh` was +run from. Develop this plugin only in that primary clone, never from a +git worktree: a running session loads skills, agents, and workflows +through the symlinks regardless of cwd, so worktree edits are not what +it executes (see `CLAUDE.md`). To take the live set over from a +different checkout, run `./install.sh --force` from it. diff --git a/install.sh b/install.sh index 1eeb8cc..82c5362 100755 --- a/install.sh +++ b/install.sh @@ -12,10 +12,19 @@ # # Idempotent — existing symlinks pointing to this repo are left # alone; existing entries that point elsewhere are reported and -# skipped. +# skipped. Pass --force to repoint such divergent symlinks at this +# clone (used to take the live set over from another checkout). set -euo pipefail +FORCE=0 +for arg in "$@"; do + case "$arg" in + --force) FORCE=1 ;; + *) echo "unknown argument: $arg (only --force is accepted)" >&2; exit 2 ;; + esac +done + REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" CLAUDE_SKILLS="$HOME/.claude/skills" @@ -34,7 +43,12 @@ link_one() { echo "ok $dst -> $src" return 0 fi - echo "skip $dst already symlinked to $existing" + if [ "$FORCE" -eq 1 ]; then + ln -sfn "$src" "$dst" + echo "relink $dst -> $src (was $existing)" + return 0 + fi + echo "skip $dst already symlinked to $existing (use --force to repoint)" return 0 fi if [ -e "$dst" ]; then