Repository navigation
feat(check): detect changes at local install sources - #334
Conversation
Skills installed from a local path (for example a skill shipped inside an app bundle) could already be refreshed with `update`, but `check` always reported them as "local source", so users had no signal that the source had changed after an app update. `check` now re-hashes the files at the recorded source path and compares them with the hashes stored at install/update time. It reports update_available on a difference, up_to_date on a match, and an error naming the path when the source is gone. The path is resolved the same way `update` resolves it before re-copying, so a successful update always brings the status back to up_to_date. The CLI and both Web API check handlers share the comparison in internal/check. Refs #206
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: 23d936cf9f
ℹ️ 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 info, err := os.Stat(source.Path); err != nil || !info.IsDir() { | ||
| return "error", "local source not found: " + source.Path | ||
| } | ||
| hashes, err := install.ComputeFileHashes(source.Path) |
There was a problem hiding this comment.
Hash only the files included in the installed skill
For a local source containing a root skill plus discovered child skills, installation deliberately excludes the children and, for a repo-root orchestrator, copies only SKILL.md (installFromDiscoveryInternal in internal/install/install_apply.go). Hashing the entire recorded source directory here therefore differs from the stored destination hashes immediately after a clean install, so check falsely reports update_available before anything changed. The comparison must apply the same discovery/exclusion projection used during installation.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Confirmed and fixed in 1fb13b7. This only affects installs made through the dashboard (DiscoverLocal + InstallFromDiscovery): the root of a directory with child skills is installed as its SKILL.md alone. CLI install <path> copies the whole directory, and child skills installed from discovery are recorded as local-subdir, which check does not compare. check now compares only SKILL.md when the source holds child skills that none of the recorded hashes include. The tests install through the real DiscoverLocal + InstallFromDiscovery path: unchanged → up_to_date, changes to README.md or a child skill → up_to_date, a change to the root SKILL.md → update_available. Another test keeps whole-directory installs comparing child skills.
| if entry == nil || entry.Type != "local" || len(entry.FileHashes) == 0 { | ||
| return "local", "" | ||
| } | ||
| source, err := install.ParseSource(entry.Source) |
There was a problem hiding this comment.
Resolve relative local sources independently of the check cwd
When a skill was installed using a relative path such as ./skills/foo, metadata preserves Source.Raw, and ParseSource converts it to an absolute path relative to the process's current working directory. Running skillshare check later from another directory consequently inspects a different path and usually reports local source not found even though the original source still exists. Persist an absolute local source at install time or retain enough installation context to resolve the recorded path consistently.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Confirmed: install ./relskill records "source": "./relskill". Fixed in 1fb13b7: relative sources are no longer compared and keep the local status, so check never reports a missing source based on the current cwd. The docs say to install with an absolute path to enable the check. update resolves relative sources against the cwd too; that is pre-existing, and I will track it separately (persisting an absolute path at install time).
| func localCheckResult(name string, entry *install.MetadataEntry) skillCheckResult { | ||
| status, message := check.LocalSourceStatus(entry) | ||
| return skillCheckResult{Name: name, Status: status, Message: message} |
There was a problem hiding this comment.
Forward local check errors into dashboard status
When the local source is missing, this endpoint now returns a useful message, but the dashboard's SkillCheckResult type has no message field and UpdatePage.applyCheckResult stores only status and checkedAt for skills. The error cell then renders its tooltip from an undefined message, leaving dashboard users with only the generic “check failed” state and no indication that the recorded path disappeared. Add the field to the client contract and preserve it in the check status.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 1fb13b7: SkillCheckResult now has message?, and applyCheckResult carries it into the status, so the "Check failed" badge shows the reason as its tooltip. A new UpdatePage test failed without the change and passes with it.
Review follow-ups for local-source change detection: - The dashboard installs the root of a directory that also holds child skills as its SKILL.md alone, so hashing the whole source reported update_available right after a clean install. Compare only the files such an install copies, recognized by recorded hashes that contain none of the child skills present in the source. - A relative source path resolves against the cwd of the install, which is not recorded, so checking from another directory reported a missing source. Relative sources are no longer compared. - The dashboard dropped the new check `message`, so a missing source only showed a generic "Check failed". Carry it into the status tooltip.
The review-fix commit picked up unrelated staged deletions under video/. They belong to separate work and are not part of this change.
… shape (#336) * fix(install): keep local installs updatable from any directory and in 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. * fix(install): never narrow a whole-directory update to SKILL.md alone 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
Closes #206
Supersedes the
--linkproposal in #207 (see #207 (comment)).Summary
Skills installed from a local path, such as a skill shipped inside an app bundle, can already be refreshed with
skillshare update. Butcheckalways reported them aslocal source, so after an app update users had no signal that anything changed.checknow re-hashes the files at the recorded source path and compares them with the hashes stored at install/update time:up_to_dateupdate_availableerror,message: "local source not found: <path>"local(unchanged)The path is resolved the same way
updateresolves it before re-copying, so a successfulupdatealways brings the status back toup_to_date. The CLI and both Web API check handlers (handler_check.go,handler_check_stream.go) share the comparison ininternal/check/local_check.go.Behavior change
In
check --json, local-path installs with recorded hashes now reportup_to_date/update_availableinstead oflocal.errorskill results gain an optionalmessagefield.Docs
check.md(new "Local-Path Installs" section, JSONmessage, status table) andupdate.md(local-path installs are re-copied), plus the ja / ko / zh-Hans / zh-Hant translations.Verification
internal/check/local_check_test.go(unchanged, changed, added file, missing source, no hashes, non-local type)TestCheck_LocalSource_DetectsChangeUntilUpdated(install → change → check → update → check),TestCheck_LocalSource_Missing; both failed before the changemake checkpasses in the devcontainerNot covered: project mode was not run separately (it shares
collectCheckItems), and updating a changed local skill from the dashboard was not exercised end to end.Checklist
make check) — for code changes