fix(scripts): remove only diffity-dev skills, never the whole global dir - #1
Merged
Conversation
build:skills called cleanDir on ~/.claude/skills, deleting the entire directory before reinstalling diffity's dev skills. That destroys any other skills the user keeps there — their own skills, or skills from other tools — which is especially harmful when ~/.claude/skills is a symlink into a version-controlled dotfiles repo. Replace the blanket cleanDir with cleanManagedSkills, which removes only the directories diffity manages (those named `diffity-dev-*`) and leaves everything else in place. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
build-skills.ts cleaned ~/.claude/skills with a recursive rmSync before writing the dev skills, and dev.ts did the same on SIGINT/SIGTERM and on dev exit. Both deleted every unrelated Claude Code skill the user had installed there. Both now remove only the immediate diffity-dev-* subdirectories, and the sync can be skipped entirely with DIFFITY_SKIP_DEV_SKILLS=1. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018PkYQzbsnMihHesafWvXKs
Upstream nilbuild#30 by @kleinjm fixes the same destructive rmSync in build-skills.ts. Adopt its cleanManagedSkills name and dash-anchored prefix match so this fork does not carry a competing implementation, and keep what nilbuild#30 does not cover: the identical wipe in dev.ts's SIGINT/SIGTERM cleanup, the DIFFITY_SKIP_DEV_SKILLS opt-out, a shared DEV_SKILL_PREFIX, and a regression test. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018PkYQzbsnMihHesafWvXKs
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.
scripts/build-skills.tsrancleanDir(~/.claude/skills)— a recursivermSyncof the wholedirectory — before writing its
diffity-dev-*skills, andscripts/dev.tsdid the same onSIGINT/SIGTERM and on dev exit. Anyone running
npm run buildornpm run devlost every otherClaude Code skill installed globally. It happened here: two unrelated skills, one of them
multi-file, were deleted with no backup.
Upstream #30 by @kleinjm fixes the
build-skills.tshalf. This branch merges it and adopts its
cleanManagedSkillsname and dash-anchored prefix matchrather than carrying a competing implementation, then adds what nilbuild#30 does not cover:
dev.ts's SIGINT/SIGTERM and exit cleanupDIFFITY_SKIP_DEV_SKILLS=1to skip the global sync entirely (CI, or anyone who doesn't want a build writing to$HOME)DEV_SKILL_PREFIXshared between the writer and the cleanup paths so the name and the cleanup can't driftvitestwired at root astest:scriptsVerified by planting an unrelated skill, running
npm run build, and confirming it survived whilethe seven dev skills still synced.
The
dev.tsfix and the test are worth sending upstream as a follow-up to nilbuild#30.🤖 Generated with Claude Code
https://claude.ai/code/session_018PkYQzbsnMihHesafWvXKs