fix(cli): preserve existing SKILL.md by default, add skill --force - #618
Open
Adkr1989 wants to merge 2 commits into
Open
fix(cli): preserve existing SKILL.md by default, add skill --force#618Adkr1989 wants to merge 2 commits into
Adkr1989 wants to merge 2 commits into
Conversation
Preserving the whole skill directory froze the packaged reference docs alongside the user file, so a customized SKILL.md left references/ stuck at whatever version first installed it. Split the copy so the user owns SKILL.md and the reference docs still track the installed version: extract _resolve_skill_pkg() and _write_references(), and call the latter on the preserve path. references/ is rebuilt from scratch so docs dropped upstream do not linger. The preserve message named neither half of that behaviour nor --force, leaving users with no way to learn how to take the packaged file back. Also set installed=True on the fallback preserve branch, matching the loop above it.
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.
Problem
_install_skill()defaults toforce=True, and both callers (theinstallflow and
agent-reach skill --install) call it bare. Every install runtherefore silently overwrites
~/.claude/skills/agent-reach/SKILL.md(and theother agent skill roots), destroying any user customization — scoped
descriptions, trimmed tool lists, local routing notes.
The preserve path already exists:
_copy_skill_dirreturns"preserved"whennot forceand a SKILL.md is present, and both callers already print a"preserving existing files" message for it — it's just unreachable from the CLI.
Fix
force=False: installs preserve an existing SKILL.md andsay so.
agent-reach skill --install --forceopts into overwrite (e.g. to pickup a new packaged skill after upgrading).
Tests
Two new tests: re-install preserves a customized SKILL.md;
--forcerestoresthe packaged one. Full suite passes with no new failures (Windows 11,
Python 3.11); manually verified that
skill --installnow prints"preserving existing files" and leaves a customized SKILL.md byte-identical.