Repository navigation
feat: replace for skills; fix sync for subfolder projects and built docs - #63
Merged
Merged
Conversation
replace now works on skills. A skill ID maps to a folder with its own SKILL.md, which keeps the skill's name, ID and place, so a package that passes on another package's harness can adapt an upstream skill. The folder is not a skill of its own. A replaced skill gets the trust of the package that replaced it, so an untrusted package cannot add allowed-tools through a trusted package's skill. For other units, replace warns and check fails, and the spec now says rules and skills. A project below the git root, such as docs-site/, wrote its .git/info/exclude entries as if it were the root, so its links and settings showed up in git status. Entries now start at the git root, in a section named after the project's folder, and each project keeps its own state file, so two projects in one repository never touch each other's entries. A sync moves the entries an older version wrote into the root's section. A hook already in a settings file is not added twice, so a missing state file cannot double hooks. doctor names the ! pattern that brings a file back, and asks for a sync when no pattern matches. A docs folder of the project layer that a build writes and git ignores made the lock and the blocks depend on whether a build ran. sync now leaves it out, built or not, and an exclude of it no longer warns. check still reads the built pages. Closes #54 Closes #56 Closes #62 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Gr8S7GHqRx5sRwf2HJbJ8W
Contributor
📦 Snapshot releasePublished |
Merged
This branch was previously deployed
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.
In short
replacenow works on skills (minor). Other unit kinds warn and point toexclude, and the spec now says "rules and skills".#62: a project below the git root
Cause:
.git/info/excludepatterns start at the git root, butsyncwrote them relative to the project folder (/.claude/…instead of/docs-site/.claude/…).Fix:
/.claude/skills/x/docs-site/.claude/skills/x# BEGIN harnesspm# BEGIN harnesspm in docs-site/(the root keeps the old name).git/harnesspm/state.json, shared.git/harnesspm/docs-site/state.jsonper projectadd --local, telemetry fileaddExclude()doctormessage!pattern … brings it back", always!pattern and its file, or asks for a sync when no pattern matchesharnesspm.json, its unkeyed team section can only come from an older sync of a subfolder project. The next sync reads it as the project's last entries (so stale links are removed), then drops it.mergeHooksno longer adds a hook entry that's already in the file. So a project's first own state file (or any lost state) cannot double its hooks.#56:
replacefor skillsSKILL.md. It keeps the skill's name, ID and place: links, lock hash,helpandwhyall follow it.whyshowsreplacedandoriginal.rules/), so there's no "two skills with one name" warning.harnesspm.json. Without this, an untrusted package could addallowed-toolsthrough a trusted package's skill. This applies to both the narrowed copy and theSkill(<name>)allow rule.checkvalidates a replacement folder: it needs aSKILL.md, and itsnamemust be the replaced skill's name.replaceof any other kind failscheckand warns insync, with a pointer toexclude.#54: built docs in the project layer
sync. A missing folder isn't one either. So the lock and the blocks are the same before and after a build.excludeof such a unit is silent, so Cookbook's current workaround keeps working without warnings and can be dropped later.checkis unchanged and still reads the built pages (check: docs built at prepack go unchecked, and links to files the tarball leaves out pass #52).Spec and docs
schema/harnesspm.schema.json, the guides, and the shipped harness rule and skills that said "whole unit".motivating-case.md, and the git behaviors this relies on inpackage-managers.md(🔍, git 2.43).minorfor skill replace,patchfor the two sync fixes.Tests
10 new tests, all 133 pass. I checked that each new test fails without its fix:
sync.test.ts: the subfolder project end to end (anchored entries, keyed section, migration from 0.9's section, stale link removed,git statusclean, a second project at the root, its own state file). Also a middle package replacing an upstream skill, the project replacing it again, and the warnings for non-replaceable kinds.exec.test.ts: a replaced skill takes the replacer's trust, both ways. A deleted state file doesn't double hooks.doctor.test.ts: legacy entries ask for a sync. The subfolder-correct.git/info/excludehint. The named!pattern.added.test.ts:add --localin a subfolder.check.test.ts: replacement skill validation.monorepo.test.ts: a built, git-ignored workspace docs folder gives the same lock and blocks before and after a build.Also ran
npm run typecheck,npm run check,npm run sync,npm run buildplus the built CLI,build:docs+docs:check, and the issue's owninitreproduction indocs-site/.Generated by Claude Code