feat(init): sync installed skills with the manifest - #8556
Open
domitriusclark wants to merge 3 commits into
Open
domitriusclark wants to merge 3 commits into
domitriusclark wants to merge 3 commits into
Conversation
Removes unedited deprecated skills, migrates unedited copies under a prior name to the current name, and cleans up staging and backup directories left by an interrupted install. Edited copies are kept and reported; --reset-context replaces, migrates or deletes them. A directory that stops early still reports what it finished. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The occupant check now scans the directory itself, so a case twin without SKILL.md can no longer be migrated over on reset, and the renamed path never forces. Staging directories younger than ten minutes are left to the run that owns them, and the assembled tree must match the manifest tree_hash before it is swapped in. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Drops the duplicate classification (an unknown directory is left alone either way), the restore-a-backup branch (a missing skill is reinstalled and the backup then removed as an unedited release), and scopes the --reset-context hint to copies reset would act on. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Contributor
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
commit: |
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.
Summary
EX-3055. Stacked on #8555, so review that first.
#8555 makes
netlify initinstall the Netlify skills and refresh outdated copies, but it leaves copies under deprecated or prior names in place and gives the user no way to put an edited skill back to the shipped release. This PR adds the rest of the sync: re-runninginitdeletes an unedited deprecated skill, migrates an unedited copy under a prior name to its current name, and cleans up what an interrupted run left behind. Anything the user edited is kept and listed, and--reset-contextreplaces, migrates or deletes it.This is the first path that deletes directories in a user's repo. A directory is removed only when its tree hash matches a release we shipped, re-hashed right before the
rm, or under--reset-contextwhen it sits at a manifest name. Nothing else is touched: unknown directories, symlinks, and a directory that differs from a skill name only by case on macOS are all left alone, with or without the flag.Changes
src/utils/init/agent-skills.ts:syncSkillstakesreset. New rules per directory:--reset-context.--reset-context.--reset-context. A symlink or file at the skill's own name is replaced too; only the link is removed, never its target..netlify-skill-<name>-*staging directories older than ten minutes and<name>.old-*backups that hash to a shipped release are removed when<name>is in the manifest. Younger staging directories belong to a run that may still be writing them.Netlify-Deploynext tonetlify-deploy) is never renamed away. The assembled staging tree must hash to the manifesttree_hashbefore it is swapped in. A directory withoutSKILL.mdunder a prior or deprecated name is ignored.reset,renamedandremovedalongsideaddedandupdated. Kept copies are listed, with a--reset-contexthint only when reset would act on one of them. A directory that fails part way (SkillsSyncInterrupted) still prints what it finished before the warning.src/commands/init/index.ts,init.ts: the--reset-contextflag, passed throughInitExtraOptions;resetContextis added to the analytics payload and thesites_agentSkillsSetupevent.devandwatchare unchanged.docs/commands/init.md: the new flag.Testing
tests/unit/utils/init/agent-skills.test.ts(46 tests,fetchstubbed): deprecated removed by exact and by prior name, edited deprecated kept then removed on reset; prior name migrated, removed as superseded, kept when either copy is edited, two prior names in one run; modified kept then reset, symlink reset without touching its target; leftover cleanup incl. a fresh staging directory left alone and an edited backup kept; staged tree-hash mismatch refused; case twin with and withoutSKILL.mdnever replaced (asserts branch on whether the tmp filesystem is case-insensitive); partial result carried on failure; summary and hint lines.tests/integration/commands/init/init.test.ts: the mock skills host now takes a manifest spec; shared init helpers hoisted. New test runsinitagainst a stale, an edited and a deprecated copy (1 updated, 1 removed, 1 kept), theninit --reset-context(1 reset). 9 tests pass.npm run typecheck,npm run lintandnpm run format:checkare clean.Known gaps
netlify initruns in the same repo at once are not serialized. The age guard and the staged hash check turn that race into a failed install rather than a corrupt one; the next run completes it.🤖 Generated with Claude Code