Skip to content

feat(check): detect changes at local install sources - #334

Merged
runkids merged 3 commits into
mainfrom
feat/check-local-source-drift
Oct 2, 2026
Merged

runkids merged 3 commits into
mainfrom
feat/check-local-source-drift

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

Closes #206

Supersedes the --link proposal 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. But check always reported them as local source, so after an app update users had no signal that anything changed.

check now re-hashes the files at the recorded source path and compares them with the hashes stored at install/update time:

Source path Status
Files match up_to_date
A file was changed, added, or removed update_available
Path no longer exists error, message: "local source not found: <path>"
No metadata, not a local install, or no recorded hashes local (unchanged)

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 (handler_check.go, handler_check_stream.go) share the comparison in internal/check/local_check.go.

$ skillshare install /Applications/Surge.app/Contents/Resources/Skills/surge
# after Surge updates:
$ skillshare check surge
└─ → INFO  Update available — run 'skillshare update' to update
$ skillshare update surge && skillshare sync

Behavior change

In check --json, local-path installs with recorded hashes now report up_to_date / update_available instead of local. error skill results gain an optional message field.

Docs

check.md (new "Local-Path Installs" section, JSON message, status table) and update.md (local-path installs are re-copied), plus the ja / ko / zh-Hans / zh-Hant translations.

Verification

  • Unit tests: internal/check/local_check_test.go (unchanged, changed, added file, missing source, no hashes, non-local type)
  • Integration tests: TestCheck_LocalSource_DetectsChangeUntilUpdated (install → change → check → update → check), TestCheck_LocalSource_Missing; both failed before the change
  • make check passes in the devcontainer
  • Website build passes for all five locales

Not 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

  • 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

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
@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-02T11:12:51.110939Z 23d936c 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: 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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

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 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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

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: 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).

Comment on lines +38 to +40
func localCheckResult(name string, entry *install.MetadataEntry) skillCheckResult {
status, message := check.LocalSourceStatus(entry)
return skillCheckResult{Name: name, Status: status, Message: message}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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

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.

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.
@runkids
runkids merged commit 9847f59 into main Oct 2, 2026
7 checks passed
@runkids
runkids deleted the feat/check-local-source-drift branch October 2, 2026 11:51
runkids added a commit that referenced this pull request Oct 2, 2026
… 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.
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.

Feature: install local path as symlink so app-bundled skills stay in sync automatically

1 participant