Repository navigation
fix(install): keep local installs updatable from any directory and in shape - #336
Conversation
… shape Follow-ups to local-source change detection (#334): - Global installs recorded a relative local path as typed, so `update` and `check` resolved it against whatever directory they ran in and failed with "source path does not exist". Global CLI and dashboard installs now record the absolute path. Project mode keeps the path as written, because .skillshare/config.yaml is shared across machines. - The dashboard installs the root of a directory that also holds child skills as its SKILL.md alone, but `update` re-copied the whole directory, pulling in child skills and unrelated files. Updates now keep that shape. The detection is shared with `check` so both agree on which files belong to the install.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: abeb169f86
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if _, ok := recorded[rel]; ok { | ||
| return false | ||
| } | ||
| hasChildSkill = true |
There was a problem hiding this comment.
Verify recorded files before forcing SKILL-only updates
When a normal full-directory local install originally has no descendants and its source later adds child/SKILL.md, that new child is absent from the recorded hashes, so this function returns true even though those hashes may include README files, assets, or scripts. handleUpdate consequently enables skillFileOnly, replaces the existing installation with only SKILL.md, and silently removes the other installed files; identify this shape from the recorded files themselves (or explicit metadata) rather than from an unrecorded child in the current source.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Confirmed, and it was destructive: a whole-directory install (SKILL.md + README.md) whose source later gained child/SKILL.md was updated as SKILL.md alone, deleting README.md. Reproduced in TestUpdate_LocalWholeDirectory_ChildAddedLater_KeepsOtherFiles, which failed before the fix.
Fixed in f87bc27: the recorded files decide now. Only an install whose recorded hashes are exactly SKILL.md keeps the SKILL.md-only shape; anything else is updated as a whole directory, so an update never drops a file it installed. check uses the same function, so it does full-directory comparison in this case too (TestLocalSourceStatus_WholeDirectoryInstall_ChildAddedLater).
Remaining ambiguity, non-destructive: a CLI install of a directory that held only SKILL.md, whose source later gains a child skill and other files, keeps updating SKILL.md alone. Nothing installed is lost; the new files are just not picked up. Telling those apart fully would need the install shape recorded in metadata.
The SKILL.md-only shape was inferred from a child skill in the source that the recorded hashes lack. A whole-directory install whose source gained a child skill later matched that too, so `update` replaced it with SKILL.md alone and deleted its other files. Decide from the recorded files instead: only an install that recorded SKILL.md alone keeps that shape.
Type
proposals/only — see CONTRIBUTING.md)Linked Issue
Follow-ups to #334, from its review (#334 (comment)).
Summary
Two existing
updatebugs with local-path installs, both made more visible now thatcheckreports local source changes.1. Relative local paths in global mode
skillshare install ./my-skillrecorded"source": "./my-skill", soupdateandcheckresolved it against whatever directory they ran in:Global CLI and dashboard installs now record the absolute path. Project mode is unchanged:
./vendor/my-skillstays relative in.skillshare/config.yaml, which is committed and replayed on other machines.2.
updatechanged the shape of a collection root installed from the dashboardThe dashboard (
DiscoverLocal+InstallFromDiscovery) installs the root of a directory that also holds child skills as itsSKILL.mdalone.updatere-copied the whole directory, pulling in child skills and unrelated files:updatenow keeps that shape. The detection (install.IsSkillFileOnlyInstall: the source holds child skills, and none of them appear in the recorded hashes) is shared withcheck, so the two agree on which files belong to the install. CLIinstall <path>still copies the whole directory, child skills included.Verification
TestInstall_RelativeLocalPath_RecordsAbsoluteSource(integration: install from one dir, update from another)TestHandleInstall_GlobalRelativeLocalPathRecordsAbsoluteSource(dashboard, global mode)TestUpdate_LocalCollectionRoot_KeepsSkillFileOnly(real discovery install, then update)TestInstallProject_RelativeLocalPath_StaysRelative(project config keeps./vendor/team-skill)make checkpasses in a clean clone in the devcontainerDocs
install.md(how relative local paths are recorded per mode) andcheck.md(only project-mode relative installs are not compared), plus ja / ko / zh-Hans / zh-Hant.Not covered
--forcefrom the original directory fixes one.checkstill skips relative sources in project mode.Checklist
make check) — for code changes