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.
This commit is contained in:
yetone
2026-10-13 04:32:20 +08:00
parent 9a34a784dc
commit 97dfed0f3e
5 changed files with 150 additions and 11 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ agents RTK, a CLI that cuts shell output down before the model reads it.
| Skills | A skill is a folder with a `SKILL.md`. It comes from GitHub, from a folder on this machine (linked, so editing the folder edits the skill) or from the market. Each agent gets a link or a marked copy (#896, `SkillHow`). An agent in a WSL distro always gets a copy. A copy's mark keeps the hash of what was copied, so a sync knows a copy unchanged since then is current without reading its files (`copyIsFresh`, #1031); other copies are hashed. A skill an agent has of its own (`foundSkills`, the page's "In your agents") is brought in with `ImportSkill`, or taken out of every agent that has it with `RemoveFoundSkill` (#1303): its folders and copies of the very same files, its shared `~/.agents/skills` entry and a folder of it in the library's own folder go to the backups, its links are taken away, and a folder elsewhere it only links to, or another skill by that name, stays. | [`skills.go`](../../internal/library/skills.go), [`skill_how.go`](../../internal/library/skill_how.go), [`skill_edits.go`](../../internal/library/skill_edits.go), [`skill_from.go`](../../internal/library/skill_from.go) |
| Skills market | `MarketSkills` lists skills.sh's most installed and what its search finds. magpie's own skills (`featuredSkills`) go first, marked official: `magpie-quota`, in [magpie-community/plugins](https://github.com/magpie-community/plugins/tree/main/skills/magpie-quota), lets an agent read `magpie quota --json` and wait with `magpie quota wait`. Until skills.sh lists one it has no count of installs and no skills.sh link (`featured`). `InstallMarketSkill` installs any of them from its repository. | [`market.go`](../../internal/library/market.go) |
| Skills a repository added | A check for updates (`CheckSkills`) also asks, for each GitHub repository and ref the library has skills from, GitHub's list of its files (`repoTree`, one API request, free when the ETag still matches). Only when that list has a skill folder beside the installed ones (under `newBase`, their deepest common folder) that the library doesn't have and hasn't offered does `findNew` fetch the repository for the skills' names and descriptions. `SeenSkills` records per `repo@ref` the paths the install picker showed and the ones set aside, so they aren't offered again. The finds live in memory (`newFound`) and reach the page as `View.NewSkills`; `AddNewSkills` gives each to the agents that have its repository's other skills, and `IgnoreNewSkills` sets it aside (`/api/library/skills/{add-new,ignore-new}`). | [`skillnew.go`](../../internal/library/skillnew.go), [`skillcheck.go`](../../internal/library/skillcheck.go) |
| Skill groups | The page groups skills by `SkillView.Repo`, the repository each came from (`tracer.repoOf`): its GitHub source, CC Switch's `Origin`, `From`, the skills CLI's lock or the git checkout a linked folder is in. `From` is written when a repository is probed (installing from it again, `noteFrom`): for a skill with the very same `SKILL.md`, and for one traced to nowhere by a name the repository has when the library has others from there, since a pack added a while ago is mostly older copies edited there since (White Immortal on Discord: 20 of mattpocock/skills' 38). Group again (`RegroupSkills`, `POST /api/library/skills/regroup`) fetches each GitHub repository the skills are traced to and does the same; it fails only when none could be fetched. A skill traced to another repository is never moved. A group's (or part's, or the Select bar's) agent chips count, give and take only the skills magpie decides for each agent: one kept in `~/.agents/skills` is in `SkillView.Always` for the agents that read that folder themselves, so a chip's `agents-some` for such an agent leaves it out, its tooltip and the status after a click say how many it still reads itself, and an agent that reads every one of them itself has a lit, locked chip as the row's is, which sends nothing (`groupChips` in library.js). The heading says how many of its skills are in `~/.agents/skills`. A row's locked chip is lit with a lock on its corner, not greyed like a chip that can't be given the skill (#1862, `skill-group-shared.test.cjs`). Collapse all / Expand all, beside the sort, folds or opens every group the list shows at once (`foldAllButton`): without a filter it sets each group's kept fold (`magpie.libSkillFolds`), as a click on each heading would; while filtering, only the groups the filter shows, till the filter changes (`unfiltered`), leaving the kept folds alone. It reads Collapse all while any shown group is open, is hidden with fewer than two groups (A→Z, or a filter one group matches), leaves a part's own fold as it is and sends nothing (#1862, `skill-fold-all.test.cjs`). | [`skill_from.go`](../../internal/library/skill_from.go), [`library.js`](../../internal/gui/assets/library.js) |
| Skill groups | The page groups skills by `SkillView.Repo`, the repository each came from (`tracer.repoOf`): its GitHub source, CC Switch's `Origin`, `From`, the skills CLI's lock or the git checkout a linked folder is in. A lock entry of `sourceType: well-known` (a site's kit at its `/.well-known/agent-skills/`) is grouped by its `sourceBaseUrl` as host/path (`wellKnownBase`), not by each skill's own `sourceUrl`: Feishu's lark-* skills are one group and Fish Audio's another, while two kits under one host with different base URLs stay apart. An older entry with no base URL takes the part of its `sourceUrl` before `/.well-known/`, and one with neither is grouped by its `sourceUrl` as before. Such a kit is never fetched from GitHub by Group again, even when it reads like owner/repo (a GitHub owner has no dot), and its heading's link opens the site (#1862, `TestWellKnownKitGrouped`). `From` is written when a repository is probed (installing from it again, `noteFrom`): for a skill with the very same `SKILL.md`, and for one traced to nowhere by a name the repository has when the library has others from there, since a pack added a while ago is mostly older copies edited there since (White Immortal on Discord: 20 of mattpocock/skills' 38). Group again (`RegroupSkills`, `POST /api/library/skills/regroup`) fetches each GitHub repository the skills are traced to and does the same; it fails only when none could be fetched. A skill traced to another repository is never moved. A group's (or part's, or the Select bar's) agent chips count, give and take only the skills magpie decides for each agent: one kept in `~/.agents/skills` is in `SkillView.Always` for the agents that read that folder themselves, so a chip's `agents-some` for such an agent leaves it out, its tooltip and the status after a click say how many it still reads itself, and an agent that reads every one of them itself has a lit, locked chip as the row's is, which sends nothing (`groupChips` in library.js). The heading says how many of its skills are in `~/.agents/skills`. A row's locked chip is lit with a lock on its corner, not greyed like a chip that can't be given the skill (#1862, `skill-group-shared.test.cjs`). Collapse all / Expand all, beside the sort, folds or opens every group the list shows at once (`foldAllButton`): without a filter it sets each group's kept fold (`magpie.libSkillFolds`), as a click on each heading would; while filtering, only the groups the filter shows, till the filter changes (`unfiltered`), leaving the kept folds alone. It reads Collapse all while any shown group is open, is hidden with fewer than two groups (A→Z, or a filter one group matches), leaves a part's own fold as it is and sends nothing (#1862, `skill-fold-all.test.cjs`). | [`skill_from.go`](../../internal/library/skill_from.go), [`library.js`](../../internal/gui/assets/library.js) |
| Skill updates | A skill from GitHub (`kind: github`, a market install among them) keeps the commit it was fetched at and `Hash`, the hash of its files as fetched. `CheckSkills` asks GitHub for each one's last commit and keeps the result in memory; `View.CheckDue` says none was checked since magpie started, or not for `checkEvery` (12 hours), and the page then checks by itself as the skills open (#1449). `editState` says a skill was changed here when the library's folder no longer hashes to `Hash` (`.DS_Store` aside), or an agent's copy was edited since its mark and not yet taken in; the view's `edited` says so. `UpdateSkill` refuses such a skill with `*EditedError` unless told to replace it (the page's own Update asks first; the CLI takes `--replace-edits`), and `UpdateSkills`/`UpdateSomeSkills` leave it as it is, in `Unupdated`. A replaced version that was changed, or that can't be told (no `Hash`), is moved to the backups (`keepReplaced`). Skills the skills CLI manages (`npx skills`, `~/.agents/.skill-lock.json`) are only grouped: the CLI updates them (`npx skills update`). A linked folder, a skill imported from an agent and a `From`-only skill have no remote to check; one CC Switch installed (`Origin`) can be updated by hand but isn't checked. | [`skill_changed.go`](../../internal/library/skill_changed.go), [`skillcheck.go`](../../internal/library/skillcheck.go), [`skills.go`](../../internal/library/skills.go) |
| Hooks | A `Hook` (#1790) is a command, an event, an optional matcher, a timeout and the agents ticked for it. Its event is portable (`HookEvents`: turn-end, after-tool, before-tool, prompt, session-start, each under the agent's own name) or an agent's own (`"codex:PermissionRequest"`), which only that agent is given. A portable tool event can be narrowed to shell or edit tools, each agent's own tool names for them. `syncHooks` writes each into the agent's own file and shape (`hookSpecOf`): Claude Code `<claude dir>/settings.json`, Codex `hooks.json` beside its config.toml, Gemini CLI `~/.gemini/settings.json` (timeout in ms), Cursor `~/.cursor/hooks.json` (flat entries, `version: 1`). Every other agent, and an agent in WSL, is refused with why, and the page greys its chip with that reason. The page also says when an agent has every hook turned off (`hooksOff`: Claude Code's `disableAllHooks`, Gemini's `hooksConfig.enabled`, Codex's `[features] hooks`). | [`hooks.go`](../../internal/library/hooks.go) |
| Backups | Before a change first writes an agent file, `backups` copies it to `BackupDir`, one folder per change. The last `keepBackups` (30) changes are kept. The Backups button at the top of every tab, beside Library folder, opens that folder (`libHead`; Dade on Discord found it at the foot of a long page). | [`backup.go`](../../internal/library/backup.go) |
+2 -1
View File
@@ -2455,7 +2455,8 @@
// checkout it's in), so a repository's skills are one group (White
// Immortal on Discord). owner/repo on GitHub, host/path elsewhere.
const skillRepo = (s) => s.repo || (s.kind === "github" ? repoOf(s.source) : s.origin ? repoOf(s.origin) : "");
const repoURL = (r) => (/^[^/]+\.[^/]+\//.test(r) ? "https://" + r : "https://github.com/" + r);
// a host's (with a path, or a site's kit of skills alone, #1862) or GitHub's
const repoURL = (r) => (/^[^/]+\.[^/]+(\/|$)/.test(r) ? "https://" + r : "https://github.com/" + r);
const MANY = 40; // a group bigger than this starts folded, and so do its parts
const SPLIT = 8; // a group bigger than this is split by folder, or by name
// Heights the rows are held to (library.css): a list's room is known
+13 -5
View File
@@ -4,8 +4,8 @@
// installed from GitHub, one the skills CLI installed and one linked from a
// clone, each with the repository magpie traced (repo), are one group, its
// name's case aside; one from a git host other than GitHub is a group
// opened at that host; the rest are On this computer. English and Chinese;
// the API is faked here.
// opened at that host, as is a site's kit of skills (#1862); the rest are
// On this computer. English and Chinese; the API is faked here.
const assert = require("node:assert/strict");
const fs = require("node:fs/promises");
const path = require("node:path");
@@ -42,9 +42,12 @@ const SKILLS = [
{ name: "write-a-prd", kind: "folder", source: `${HOME}/code/skills/skills/write-a-prd`, repo: "MattPocock/skills", description: "d", agents: [] },
{ name: "review", kind: "", source: "", repo: "gitlab.com/me/review", description: "d", agents: ["claude"] },
{ name: "notes", kind: "", source: "", description: "d", agents: ["claude"] },
// a site's kit, from the skills CLI's lock: by its base URL (#1862)
{ name: "fish-audio-api", kind: "folder", source: `${HOME}/.agents/skills/fish-audio-api`, repo: "docs.fish.audio", description: "d", agents: ["claude"] },
{ name: "fish-audio-sdk", kind: "folder", source: `${HOME}/.agents/skills/fish-audio-sdk`, repo: "docs.fish.audio", description: "d", agents: ["claude"] },
];
const L = { en: { here: "On this computer", open: "Open gitlab.com/me/review", gh: "Open mattpocock/skills on GitHub" },
zh: { here: "本机", open: "打开 gitlab.com/me/review", gh: "在 GitHub 上打开 mattpocock/skills" } };
const L = { en: { here: "On this computer", open: "Open gitlab.com/me/review", gh: "Open mattpocock/skills on GitHub", site: "Open docs.fish.audio" },
zh: { here: "本机", open: "打开 gitlab.com/me/review", gh: "在 GitHub 上打开 mattpocock/skills", site: "打开 docs.fish.audio" } };
for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) {
test(engine + ": a repository's skills are one group however each came in", async (t) => {
@@ -80,7 +83,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
const heads = await v.locator(".lib-grouphead").evaluateAll((hs) => hs.map((h) => [h.querySelector(".name").textContent, h.querySelector(".sub").textContent.replace(/\D+/g, "")]));
// the first spelling met names the group; one only traced to a
// repository is with this computer's, below those from GitHub (#1031)
assert.deepEqual(heads, [["mattpocock/skills", "3"], ["gitlab.com/me/review", "1"], [w.here, "1"]]);
assert.deepEqual(heads, [["mattpocock/skills", "3"], ["docs.fish.audio", "2"], ["gitlab.com/me/review", "1"], [w.here, "1"]]);
const card = (name) => v.locator(".lib-group").filter({ has: page.locator(".lib-grouphead .name", { hasText: name }) });
assert.equal(await card("mattpocock/skills").locator(".lib-grouphead .lib-icon").getAttribute("title"), w.gh);
const gl = card("gitlab.com/me/review").locator(".lib-grouphead .lib-icon");
@@ -88,6 +91,11 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
// the page in a browser opens it in a tab of its own
await gl.click();
assert.deepEqual(await page.evaluate(() => window.__opened), ["https://gitlab.com/me/review"]);
// a site's kit, with no path, opens the site, not GitHub (#1862)
const site = card("docs.fish.audio").locator(".lib-grouphead .lib-icon");
assert.equal(await site.getAttribute("title"), w.site);
await site.click();
assert.deepEqual(await page.evaluate(() => window.__opened), ["https://gitlab.com/me/review", "https://docs.fish.audio"]);
// its three skills under it, none in a part of a folder
const names = await card("mattpocock/skills").locator(".lib-row:not(.lib-grouphead) .name").allTextContents();
assert.deepEqual(names.map((n) => n.trim()).filter((n) => SKILLS.some((s) => s.name === n)).sort(), ["grill-me", "tdd", "write-a-prd"]);
+50 -4
View File
@@ -75,9 +75,10 @@ func readSkillLock(path string) map[string]string {
}
var f struct {
Skills map[string]struct {
Source string `json:"source"`
SourceType string `json:"sourceType"`
SourceURL string `json:"sourceUrl"`
Source string `json:"source"`
SourceType string `json:"sourceType"`
SourceURL string `json:"sourceUrl"`
SourceBaseURL string `json:"sourceBaseUrl"`
} `json:"skills"`
}
if json.Unmarshal(b, &f) != nil {
@@ -88,6 +89,8 @@ func readSkillLock(path string) map[string]string {
r := ""
if e.SourceType == "github" && repoRe.MatchString(e.Source) {
r = strings.TrimSuffix(e.Source, ".git")
} else if e.SourceType == "well-known" {
r = wellKnownBase(e.SourceBaseURL, e.SourceURL)
} else if e.SourceURL != "" {
r = remoteRepo(e.SourceURL)
}
@@ -98,6 +101,47 @@ func readSkillLock(path string) map[string]string {
return out
}
// wellKnownBase is where a kit of skills a site serves at its
// /.well-known/agent-skills/ came from (#1862, WardLu): the lock's
// sourceBaseUrl, as host/path, so Feishu's lark-base, lark-doc and
// lark-sheets are one group and Fish Audio's two another, while two kits
// under one host with different base URLs stay apart. Each skill's
// sourceUrl is its own file there, so it isn't the group. A lock written
// before sourceBaseUrl has the base in the sourceUrl, before its
// /.well-known/; one with neither is grouped by its sourceUrl as before.
func wellKnownBase(base, src string) string {
if b := siteOf(base); b != "" {
return b
}
if i := strings.Index(src, "/.well-known/"); i > 0 {
if b := siteOf(src[:i]); b != "" {
return b
}
}
return remoteRepo(src)
}
// siteOf reads a web address as host/path, or the host alone, with no
// user, query or trailing slash: "" when it isn't an http(s) address.
func siteOf(s string) string {
u, err := url.Parse(strings.TrimSpace(s))
if err != nil || (u.Scheme != "https" && u.Scheme != "http") || u.Hostname() == "" {
return ""
}
host := strings.TrimPrefix(strings.ToLower(u.Hostname()), "www.")
p := strings.Trim(u.Path, "/")
if before, _, ok := strings.Cut("/"+p+"/", "/.well-known/"); ok {
p = strings.Trim(before, "/")
}
if strings.Contains(p, "..") {
return ""
}
if p == "" {
return host
}
return host + "/" + p
}
// gitRepoOf is the repository of the git checkout a skill's folder is, or
// is in a few folders down: its remote origin. A checkout that is the home
// folder, or a folder of an app's own in it (~/.claude kept in git), is
@@ -266,7 +310,9 @@ func RegroupSkills() (int, error) {
seen := map[string]bool{}
for _, s := range l.Skills {
r := tr.repoOf(s)
if !repoRe.MatchString(r) || seen[strings.ToLower(r)] {
// a site's kit (docs.example.com/kit) reads like owner/repo, but
// a GitHub owner has no dot
if !repoRe.MatchString(r) || strings.Contains(strings.Split(r, "/")[0], ".") || seen[strings.ToLower(r)] {
continue
}
seen[strings.ToLower(r)] = true
+84
View File
@@ -73,6 +73,90 @@ func TestSkillRepoTraced(t *testing.T) {
}
}
// A site's kit of skills (npx skills add from a /.well-known/agent-skills/
// index) is one group, by the lock's sourceBaseUrl (#1862, WardLu): the
// reporter's three Feishu skills and two Fish Audio ones, each with a
// sourceUrl of its own, were five groups. Another kit under the same host
// with another base URL stays apart. A lock with no sourceBaseUrl is
// grouped by the base in its sourceUrl, before /.well-known/.
func TestWellKnownKitGrouped(t *testing.T) {
h := sandbox(t)
const feishu = "https://open.feishu.cn/lark-cli/skills/regular"
lock := map[string][2]string{ // name: sourceBaseUrl, sourceUrl
"lark-base": {feishu, feishu + "/.well-known/agent-skills/lark-base.tar.gz"},
"lark-doc": {feishu, feishu + "/.well-known/agent-skills/lark-doc.tar.gz"},
"lark-sheets": {feishu, feishu + "/.well-known/agent-skills/lark-sheets.tar.gz"},
"fish-audio-api": {"https://docs.fish.audio", "https://docs.fish.audio/.well-known/agent-skills/fish-audio-api/skill.md"},
"fish-audio-sdk": {"https://docs.fish.audio/", "https://docs.fish.audio/.well-known/agent-skills/fish-audio-sdk/skill.md"},
// the same host, another kit
"lark-admin": {"https://open.feishu.cn/lark-cli/skills/admin", "https://open.feishu.cn/lark-cli/skills/admin/.well-known/agent-skills/lark-admin.tar.gz"},
// a lock from before sourceBaseUrl
"lark-old": {"", feishu + "/.well-known/agent-skills/lark-old.tar.gz"},
// a kit one folder down a site, which reads like owner/repo
"kit-one": {"https://docs.example.com/kit", "https://docs.example.com/kit/.well-known/agent-skills/kit-one/SKILL.md"},
}
var entries []string
os.MkdirAll(filepath.Join(h, ".claude/skills"), 0o755)
var names []string
for n, u := range lock {
skill(t, filepath.Join(h, ".agents/skills", n), n, "D")
dirLink(filepath.Join(h, ".agents/skills", n), filepath.Join(h, ".claude/skills", n))
base := ""
if u[0] != "" {
base = `,"sourceBaseUrl":"` + u[0] + `"`
}
entries = append(entries, `"`+n+`":{"sourceType":"well-known","sourceUrl":"`+u[1]+`"`+base+`}`)
names = append(names, n)
}
write(t, filepath.Join(h, ".agents/.skill-lock.json"), `{"version":3,"skills":{`+strings.Join(entries, ",")+`}}`)
ok(t)(ImportSkills(names))
got := repoIn(t)
for n, want := range map[string]string{
"lark-base": "open.feishu.cn/lark-cli/skills/regular", "lark-doc": "open.feishu.cn/lark-cli/skills/regular",
"lark-sheets": "open.feishu.cn/lark-cli/skills/regular", "lark-old": "open.feishu.cn/lark-cli/skills/regular",
"fish-audio-api": "docs.fish.audio", "fish-audio-sdk": "docs.fish.audio",
"lark-admin": "open.feishu.cn/lark-cli/skills/admin", "kit-one": "docs.example.com/kit",
} {
if got[n] != want {
t.Errorf("%s: repo %q, want %q", n, got[n], want)
}
}
// Group again fetches GitHub repositories only: none of these is one
var asked []string
oldT := tarballURL
tarballURL = func(repo, ref string) string { asked = append(asked, repo); return "http://127.0.0.1:1/" }
t.Cleanup(func() { tarballURL = oldT })
if _, err := RegroupSkills(); err != nil {
t.Fatal(err)
}
if len(asked) != 0 {
t.Errorf("fetched from GitHub: %v", asked)
}
}
// A well-known kit's base, from the lock's sourceBaseUrl or else its
// sourceUrl; neither an http(s) address, its sourceUrl as a remote.
func TestWellKnownBase(t *testing.T) {
for _, c := range []struct{ base, src, want string }{
{"https://open.feishu.cn/lark-cli/skills/regular", "", "open.feishu.cn/lark-cli/skills/regular"},
{"https://Docs.Fish.Audio/", "", "docs.fish.audio"},
{"https://www.example.com/kit/?v=2", "", "example.com/kit"},
{"https://me:tok@example.com/kit", "", "example.com/kit"},
{"https://example.com/kit/.well-known/agent-skills/index.json", "", "example.com/kit"},
{"", "https://docs.fish.audio/.well-known/agent-skills/fish-audio-api/skill.md", "docs.fish.audio"},
{"not a url", "https://example.com/a/.well-known/agent-skills/x.tar.gz", "example.com/a"},
{"", "https://example.com/team/kit.git", "example.com/team/kit"},
{"file:///etc/kit", "", ""},
{"https://example.com/../etc", "", ""},
} {
if got := wellKnownBase(c.base, c.src); got != c.want {
t.Errorf("%q %q: %q, want %q", c.base, c.src, got, c.want)
}
}
}
// The remote forms git takes, each read as the repository.
func TestRemoteRepo(t *testing.T) {
for in, want := range map[string]string{