Commit Graph
4 Commits
Author SHA1 Message Date
yetone 97dfed0f3e library: a site's well-known kit of skills is one group, by the lock's sourceBaseUrl (#1862)
WardLu (#1862): skills that `npx skills add` got from a site's
/.well-known/agent-skills/ index were one group per skill. That was
Feishu's lark-base, lark-doc and lark-sheets, and Fish Audio's
fish-audio-api and fish-audio-sdk. readSkillLock grouped them by each
skill's own sourceUrl (".../lark-base.tar.gz", ".../fish-audio-api/skill.md").

Now a lock entry with sourceType "well-known" is grouped by its
sourceBaseUrl, read as host/path (wellKnownBase/siteOf):
- the user, query and trailing slash are dropped, and the host is
  lower-cased without "www.";
- so Feishu's three are open.feishu.cn/lark-cli/skills/regular and Fish
  Audio's two are docs.fish.audio;
- a kit on the same host with a different base URL stays apart. Hosts are
  not merged.

Fallbacks:
- an older lock with no sourceBaseUrl takes the part of its sourceUrl
  before /.well-known/;
- an entry with neither is grouped by its sourceUrl, as before.

Two things this new key would otherwise get wrong:
- Group again (RegroupSkills) tried every owner/repo-shaped key on GitHub.
  A kit one folder down a site (docs.example.com/kit) has that shape, so a
  key whose owner has a dot is skipped now. GitHub owners have no dot.
- the heading's link sent a key with no path ("docs.fish.audio") to
  github.com. repoURL now opens it at https://docs.fish.audio.

Run:
- go test ./internal/library (all pass). New TestWellKnownKitGrouped uses
  the issue's base and source URLs for 3 Feishu + 2 Fish Audio skills, plus
  another kit on open.feishu.cn, an entry with no base, and a
  docs.example.com/kit kit that Group again must not fetch.
  - With the well-known branch disabled it fails, with the reporter's five
    one-skill groups.
  - With the dot check removed it fails on a GitHub fetch.
- new TestWellKnownBase: a table of base and source forms.
- skill-repo-groups.test.cjs now has a docs.fish.audio group that opens the
  site. It fails with origin/main's assets, which say "on GitHub". It and
  skill-regroup/skill-groups pass in chromium and webkit.
- gofmt -l; go vet for darwin, linux -tags nogui and windows on
  internal/library.

Not run: the reporter's real ~/.agents/.skill-lock.json. The issue quotes
only these three fields of it. A row's own link still isn't its sourceUrl.
2026-10-13 04:32:20 +08:00
yetone d7a1fcd41a library, gui: a skill pack added a while ago is grouped whole, and the Skills head has Group again (White Immortal on Discord)
Of mattpocock/skills' 38 skills only 20 were grouped with the repository on
the Library page; the rest sat under On this computer, and nothing could
trace them again. Cause: installing from a repository again (noteFrom)
grouped a library skill with it only when its SKILL.md was byte for byte
the repository's. A pack added a while ago is mostly older copies: of the
copies at mattpocock/skills 3cca18b3 (2026-09-04), 18 of 37 match HEAD; at
8b78b531 (2026-08-13) 2 of 35. The GUI's parts draw all 38 when the data
has them (checked with a Playwright run against 38 skills in the repo's
real folder layout, github, lock-traced and mixed paths, both engines).

noteFrom now also notes a skill traced to nowhere by a name the repository
has, when the library has others from that repository (same file, or
traced there already). A skill traced to another repository, and a
same-named skill when the library has nothing from there, are left alone.
RegroupSkills (POST /api/library/skills/regroup) fetches each GitHub
repository the skills are traced to and runs the same; it fails only when
no repository could be fetched. The Skills head has Group again (busy while
it runs, status says how many joined), en/zh/zh-TW/ja/de.

Run: TestRegroupOlderCopies (fails with the name match off: edited and
later stay ungrouped), TestInstallAgainNotesFrom, TestSkillRepoTraced;
skill-regroup.test.cjs in chromium and webkit, en/zh/zh-TW/ja/de at 1100
and 440 wide (red on the old assets: no Group again); skill-parts and
i18n-keys pass; go test -tags nogui ./internal/library ./internal/gui ok;
gofmt, go vet. Not tried against the reporter's library or real GitHub.
2026-10-12 22:08:58 +08:00
yetone ce9fc6758a library: on Windows without the right to make symlinks, skills are linked with junctions (#973) — with Developer Mode off and magpie not elevated, os.Symlink fails with "A required privilege is not held by the client": a skill installed from a folder became a detached copy, and bringing in a skill from ~/.agents/skills failed outright. The library's folder links (an agent's link to the library's skill, a folder source, a skill brought in from a link or the shared folder, a carried skill's folder, relink) now go through dirLink, which on that error makes a directory junction instead: one every user may make, followed by every program as a symlink to a folder is, made natively (FSCTL_SET_REPARSE_POINT, no mklink). A target a junction can't reach (a network share) still gets the old copy. Go reports a junction as irregular, not a symlink, so ours, unlink, carry's clearing of the library, a project's place and the CC Switch update now tell a link by linkEntry (symlink or junction) and take it away with os.Remove, leaving what it points at, even when where it points can't be read. On the Windows box with every privilege stripped from the token (CreateRestrictedToken DISABLE_MAX_PRIVILEGE, whoami /priv shows SeChangeNotify only) and an explicit sandbox environment, the library's tests went from 16 failures to none (TestSkillHow, TestProjectSkillsLinked, TestCarry, TestSkillCopyEditReachesTheOthers, TestImportSharedSkillForKimi …); with the privilege they pass too. TestJunctionIsALink (Windows: magpie's own, read through, unlinked without its target, none to a share) is new; the folder fixtures that ignored a failed os.Symlink now use dirLink, and the tests' link checks accept a junction. go test -race ./internal/library/ on the Mac, go vet, windows/linux(nogui) builds pass. 2026-10-06 13:32:03 +08:00
yetone 6d198f7f23 library, gui: a repository's skills are one group on the Library page however each came in — the skills CLI's lock, a git clone, or installed from it again (White Immortal on Discord)
White Immortal asked for the skills of github.com/mattpocock/skills to be one group, the ones installed before too. Skills installed from GitHub in magpie were already grouped by repository, but one installed another way sat under On this computer. Each skill on the Library page now carries the repository it came from (repo). A skill installed from GitHub, or by CC Switch from there, says so as before. For the others it is traced:

- npx skills add (the skills CLI) writes ~/.agents/.skill-lock.json, with each skill's repository by name. A skill in ~/.agents/skills, or moved into the library from there, gets its repository from it.
- A skill linked from a git clone gets the remote "origin" of the clone it is in (up to four folders up). The URL can be https, ssh or scp-style, and a user or token in it is never kept. A checkout that is the home folder, or an app folder in it such as ~/.claude kept in git, is the user's dotfiles, and its skills are not grouped by it.
- When a skill is brought in from an agent's folder, its repository is traced first and kept as From, since a copy leaves its .git behind.
- Typing a repository in Install (or opening it from the market) notes it as From on the skills the library has already whose SKILL.md is that repository's very own. Installing from github.com/mattpocock/skills again then groups the ones installed before. A skill of the same name whose file differs is someone else's, and stays where it was.

From and a traced repository only group. Such a skill is still not updated from GitHub. A repository on another git host (gitlab.com/…) is a group of its own, and its icon opens it at that host. A repository group with skills that only were traced there goes by name, not by a folder in it. TestSkillRepoTraced, TestRemoteRepo and TestInstallAgainNotesFrom are new, along with skill-repo-groups.test.cjs (Chromium and WebKit, English and Chinese). The GUI test fails against the old library.js. go vet, go build (GOOS=linux and windows, nogui) and go test -tags nogui ./... under a temp HOME pass. TestProvidersAnswerWhileListsComeIn and TestUserPath failed once under load and pass on their own. The library's GUI tests pass on WebKit. On Chromium, import-all-skills, library-own-folder and shared-skills fail the same way at HEAD without this change.
2026-10-06 00:36:31 +08:00