Skip to content

fix(install): keep local installs updatable from any directory and in shape - #336

Merged
runkids merged 2 commits into
mainfrom
fix/local-source-update
Oct 2, 2026
Merged

runkids merged 2 commits into
mainfrom
fix/local-source-update

Conversation

@runkids

@runkids runkids commented Oct 2, 2026

Copy link
Copy Markdown
Owner

Type

  • Bug fix
  • Small improvement (docs, typo, minor refactor)
  • Feature proposal (proposals/ only — see CONTRIBUTING.md)

Linked Issue

Follow-ups to #334, from its review (#334 (comment)).

Summary

Two existing update bugs with local-path installs, both made more visible now that check reports local source changes.

1. Relative local paths in global mode

skillshare install ./my-skill recorded "source": "./my-skill", so update and check resolved it against whatever directory they ran in:

$ cd /tmp/apps && skillshare install ./gskill
$ cd / && skillshare update gskill
✗ update failed: source path does not exist: /gskill

Global CLI and dashboard installs now record the absolute path. Project mode is unchanged: ./vendor/my-skill stays relative in .skillshare/config.yaml, which is committed and replayed on other machines.

2. update changed the shape of a collection root installed from the dashboard

The dashboard (DiscoverLocal + InstallFromDiscovery) installs the root of a directory that also holds child skills as its SKILL.md alone. update re-copied the whole directory, pulling in child skills and unrelated files:

updated files = [README.md SKILL.md skills/child/SKILL.md], want only SKILL.md

update now keeps that shape. The detection (install.IsSkillFileOnlyInstall: the source holds child skills, and none of them appear in the recorded hashes) is shared with check, so the two agree on which files belong to the install. CLI install <path> still copies the whole directory, child skills included.

Verification

  • New tests, each failing before the change:
    • TestInstall_RelativeLocalPath_RecordsAbsoluteSource (integration: install from one dir, update from another)
    • TestHandleInstall_GlobalRelativeLocalPathRecordsAbsoluteSource (dashboard, global mode)
    • TestUpdate_LocalCollectionRoot_KeepsSkillFileOnly (real discovery install, then update)
  • Guard test: TestInstallProject_RelativeLocalPath_StaysRelative (project config keeps ./vendor/team-skill)
  • make check passes in a clean clone in the devcontainer
  • Website build passes for all five locales

Docs

install.md (how relative local paths are recorded per mode) and check.md (only project-mode relative installs are not compared), plus ja / ko / zh-Hans / zh-Hant.

Not covered

  • Global entries already recorded with a relative path stay as they are: the base directory was never recorded. Reinstalling with --force from the original directory fixes one.
  • check still skips relative sources in project mode.

Checklist

  • I've read CONTRIBUTING.md
  • Tests included and passing (make check) — for code changes
  • No unrelated changes in the diff
  • Scope is focused — one concern per PR

… 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.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-02T12:08:17.534035Z abeb169 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread internal/install/local_shape.go Outdated
Comment on lines +17 to +20
if _, ok := recorded[rel]; ok {
return false
}
hasChildSkill = true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@runkids
runkids merged commit f28e5e2 into main Oct 2, 2026
7 checks passed
@runkids
runkids deleted the fix/local-source-update branch October 3, 2026 04:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant