feat(sync-agents): prune dangling dotfiles symlinks from project repos#19
Merged
Conversation
sync-agents was additive-only: dropping a manifest entry left the old symlink dangling in every downstream repo (docs/gates, ZIG_RULES.md, scripts/audit-*.sh after the dispatch switchover) with no way to clean them up. Add a prune pass — after linking, remove any symlink under a project repo that is dangling AND resolves into $DOTFILES (a provably-broken orphan from a deleted/renamed source). Valid links and links pointing outside $DOTFILES are never touched. Filesystem-only, no git mutation: the removal surfaces as a staged deletion on the repo's next `git add -A`, mirroring how an added link awaits commit. Default on; --no-prune disables. normalize_path collapses ./.. textually (no realpath — the target is gone), string-built to stay safe under macOS bash 3.2 + set -u. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
sync-agentswas additive-only: dropping a manifest entry left the old symlink dangling in every downstream repo, with no way to clean it. After the dispatch switchover (PR #18) deleteddocs/gates/,ZIG_RULES.md,BUN_RULES.md,AGENTS_INVARIANCE.md, and relocatedscripts/audit-*.sh→audits/*.sh, those links went dangling inusezombieandcache-kit.rs.This adds a prune pass that closes the gap permanently — every future ruleset restructure self-heals.
How
prune_orphans <root>— after linking, removes any symlink under a project repo that is dangling AND resolves into$DOTFILES(a provably-broken orphan from a deleted/renamed source). Valid links and links pointing outside$DOTFILESare never touched. Excludes.git/node_modules/.zig-cache.git add -A, exactly mirroring how an added link awaits the user's commit.sync-agentsstays a filesystem tool; you stay the committer.normalize_path— collapses./..textually (norealpath— the target is gone), string-built to stay safe under macOS bash 3.2 +set -u.--no-prunedisables. Newpruned=Nfield in the summary;--listdocuments it.Verification
bash -nclean ·shellcheck -S warningclean · file 336 lines (< 350 gate)linked=20 retargeted=0 pruned=32 skipped=0 failed=0acrossusezombie(13 orphans) +cache-kit.rs(19), zero dangling links remaining in either.Session notes
usezombieis staged-ready for its own cleanup commit (handled separately — its repo, its commit).cache-kit.rswas left untouched (it carries unrelated in-flightM092spec work).🤖 Generated with Claude Code