Skip to content

feat(update): flag and protect skills edited since install - #622

Merged
runkids merged 3 commits into
mainfrom
runkids/skill-local-changes
Oct 24, 2026
Merged

runkids merged 3 commits into
mainfrom
runkids/skill-local-changes

Conversation

@runkids

@runkids runkids commented Oct 24, 2026

Copy link
Copy Markdown
Owner

Type

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

None ticked: this is a maintainer-authored feature from issue #621, not a proposal.

Linked Issue

Closes #621 (phase 1: indicator and revert via update; the diff view is left for a follow-up)

Summary

 check
   remote skill
     compare HEAD / tree hash          → up_to_date | update_available | stale
+    files ≠ recorded file_hashes       → modified ("local changes since install")

 update <name> | --all | --group | dashboard
+  modified && !force                   → skip ("local changes since install")
+    named skill                        → exit 1 + `update <name> --force` hint
+    --all / --group / batch            → counted skipped, "Modified locally" section
+    --dry-run                          → "would skip"
   reinstall from source
  • MetadataEntry.LocallyModified (internal/install) is the one check, used by check, the CLI and the server. Tracked repos, local-path installs and entries without recorded hashes are never flagged; a skill that cannot be hashed is, so update does not overwrite it.
  • Dashboard: Updates tab shows Modified locally, a skipped row offers Force Retry, the skill page asks before discarding the edit, and Needs attention lists modified skills.
  • The folder-wide target edit (POST /api/resources/batch/targets) refreshed hashes by basename, so nested skills would have shown as modified after skillshare's own edit; it now uses the relative path.

Evidence

  • Before: edit an installed remote skill → skillshare check reports it up to date, and skillshare update <name> reinstalls over the edit without a word.
    After:
    $ skillshare check
    ! alpha     local changes since install
    ! 1 skill up to date, 1 modified locally
    Next
      skillshare update <name> --force  discard local changes and reinstall
    
    $ skillshare update alpha
    ✗ Update    alpha · local changes since install
    Next
      skillshare update alpha --force  discard them and reinstall
    ✗ local changes in skill            (exit 1)
    
    $ skillshare update alpha --force   → reinstalled; check: ✓ alpha up to date
    
  • Dashboard checked in a browser: Updates tab row → Skipped → Force Retry restores the file; skill page Update → confirmation → restores the file; Dashboard check → "Modified locally: 1".
  • New tests: TestMetadataEntry_LocallyModified, TestResolution_EditedRemoteSkillIsModified, TestUpdateRegularSkill_LocallyModifiedIsSkippedWithoutForce, TestHandleBatchSetTargets_RefreshesNestedSkillHashes, and integration tests in tests/integration/update_local_changes_test.go (check/update/--force, fetch failure counts, dry-run, single-target --all).

Merge Danger

Door: two-way

Blast Radius: update

update <name> used to reinstall unconditionally; for an edited remote skill it now needs --force. Scripts that relied on update overwriting local edits must add --force. check --json gains a modified status that takes precedence over update_available and stale for edited skills.

Checks run

  • make check in the devcontainer (docs-check, fmt-check, lint, unit + integration tests): pass
  • UI: tsc --noEmit, vitest run (782 tests), pnpm run build: pass
  • python3 scripts/ai-context.py check: ok
  • Not run: website build, Windows/UTM, E2E runbooks

Not covered

  • Diff view of local vs upstream (issue's "view differences") — follow-up.
  • No modified marker in the skills list, list, status or doctor; the Updates tab hero still says all current when the only finding is a modified skill (same as dirty tracked repos today).
  • A failed remote check keeps error rather than modified.
  • Dashboard force also overrides the audit gate (existing semantics); the new confirmation says so.

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

A skill installed from a repository and then edited by hand looked
exactly like an untouched one: check said up to date, and update either
reported it current or silently reinstalled it over the edit (#621).

Install already records each file's hash, so check now compares a
remote skill's files with those hashes and reports "modified", and
update skips such a skill until --force (CLI single, --all/--group,
dashboard). --force, the dashboard's Force Retry on the skipped row, or
the confirmation on the skill page discards the edit and reinstalls.

Two hash paths had to be made reliable for this to be trusted: the
dashboard's folder-wide target edit refreshed hashes by basename, so a
nested skill looked edited after skillshare's own change, and a skill
whose files cannot be hashed now counts as modified instead of being
overwritten.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 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-24T08:19:56.890508Z 9f4cdfd Manual request
ℹ️ 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: 17724eadf2

ℹ️ 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/server/handler_skills_batch.go Resolved
…KILL.md

Changing a skill's targets in the dashboard rewrites its SKILL.md, and
both the folder-wide and the single-skill handler then re-hashed the
whole directory as the new baseline. An edit the user had already made
to any file in the skill was absorbed into that baseline, so the skill
stopped counting as modified and the next update overwrote the edit
without --force.

Both handlers now move only SKILL.md's recorded hash, and only when the
file still matched it before the rewrite. skillshare's own target edit
no longer reads as a local change, and an earlier edit still does. The
whole-directory refresh helpers lost their last callers and are removed.
@runkids

runkids commented Oct 24, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: 9f4cdfd383

ℹ️ 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".

…hanges

# Conflicts:
#	ui/src/pages/DashboardPage.tsx
@runkids
runkids merged commit 7a7ccee into main Oct 24, 2026
8 checks passed
@runkids
runkids deleted the runkids/skill-local-changes branch October 24, 2026 08:33
runkids added a commit that referenced this pull request Oct 24, 2026
* feat(check): show what changed in a skill since install

#622 made a hand-edited skill visible as modified and kept update from
overwriting it, but there was still no way to see the edits before
deciding to keep or discard them (#621).

LocalChanges compares the skill's files with the hashes recorded at
install, fetches the source at the recorded commit only when a recorded
file changed, and diffs each file against it, so the diff shows the
user's edits even after upstream moves on. A skill without a recorded
commit is refused rather than diffed against HEAD, which would show
upstream changes as the user's.

It backs `check <name> --diff`, GET /api/resources/{name}/local-changes,
and the dashboard: the Modified locally dialog on the skill page lists
the diffs, and the Updates tab links a modified skill to it. update's
skip hints now point at --diff. The route looks up the exact record and
refuses non-local names, so a nested or ../ path cannot borrow a
top-level skill's record or read outside the source. The file diff
helper moved to textdiff so the CLI and server share it.

* fix(install): diff local changes against the full installed commit

entry.Version holds the short SHA from `rev-parse --short`. A targeted
fetch needs the full SHA, so checkoutCommit fell back to fetching every
branch and tag with --unshallow: viewing one edited skill could download
the repository's whole history, and fail when the commit is only
reachable by its full SHA.

Use entry.Commit, the full SHA install records, when it is the same
commit as Version; a Commit left from an older install, or a legacy
record without one, falls back to Version.

* test(install): keep checkout line endings when editing in LocalChanges test

On Windows git checks the installed copy out with CRLF, so overwriting
SKILL.md with LF content made every line differ and the expected diff
failed. Edit the installed file in place, as an editor would, and compare
the diff without carriage returns.
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.

There are no prompts or indicators after manually editing the skill retrieved from GitHub.

1 participant