library: magpie-setup is first in the market's skills, so an agent can set magpie up as asked

Leyuu_5 on X: "功能越来越多,感觉可以来个skill让AI来帮设置需求了". The skill
lives in magpie-community/plugins (skills/magpie-setup, e513644) and
teaches an agent to turn a request into magpie's own commands. Listing
it in featuredSkills puts it first under Library › Market › Skills,
official, one click to add, with no setup.

What was run at this head:
- go test ./internal/library ./internal/cli: ok (library's first run
  failed only with "no space left on device" while writing testlog.txt;
  run again on its own: ok 193.7s)
- TestFeaturedSkills extended: magpie-setup first, quota second, both
  Official/Featured with a description; "setup", "routing" and
  "gateway key" find magpie-setup first, "quota" finds magpie-quota
  and not setup. Red with magpie-setup taken out of the list.
- gofmt -l internal/: empty; go vet (darwin), GOOS=linux go vet -tags
  nogui, GOOS=windows go vet on internal/library and internal/cli; go build
- library.InstallMarketSkill("magpie-community/plugins", "magpie-setup")
  in a sandbox HOME against the pushed plugins repo: Installed
  [magpie-setup], SKILL.md in library/skills/magpie-setup.
Not run: the full ./... suite (the disk had under 1GB free), the GUI
suite (no GUI asset changed; market-featured-skill.test.cjs fakes the
list).
This commit is contained in:
yetone
2026-10-25 19:34:55 +08:00
parent fba554c7f8
commit 758be6d14e
3 changed files with 21 additions and 6 deletions
File diff suppressed because one or more lines are too long
+7 -2
View File
@@ -784,9 +784,14 @@ type MarketSkill struct {
}
// featuredSkills are magpie's own skills, first in the market: in
// magpie-community/plugins, beside its plugins (ttmouse on X: an official
// skill for an agent to read what magpie quota tells).
// magpie-community/plugins, beside its plugins. magpie-setup has an agent
// set magpie up as the user asks, through its commands (Leyuu_5 on X: so
// many features that an AI could do the setting up); magpie-quota reads
// what magpie quota tells (ttmouse on X).
var featuredSkills = []MarketSkill{{
Source: "magpie-community/plugins", SkillID: "magpie-setup", Name: "magpie-setup", Official: true, Featured: true,
Description: "Set magpie up as you ask, through its own commands: add keys and subscriptions, point agents at models, build routing groups with fallbacks and time-of-day rules, give devices gateway keys with budgets, and share MCP servers and instructions with every agent.",
}, {
Source: "magpie-community/plugins", SkillID: "magpie-quota", Name: "magpie-quota", Official: true, Featured: true,
Description: "Check how much is left of the user's AI subscriptions, coding plans and API key balances through magpie: each usage window's percent used and when it resets, each key's balance, and wait until a subscription has allowance again.",
}}
+13 -3
View File
@@ -233,13 +233,23 @@ func TestFeaturedSkills(t *testing.T) {
t.Cleanup(func() { popular.Lock(); popular.list = nil; popular.Unlock() })
list, _ := MarketSkills("")
if len(list) != 2 || list[0].ID != "magpie-community/plugins/magpie-quota" || !list[0].Official || !list[0].Featured ||
list[0].Description == "" || list[0].Icon != gh("magpie-community") || !offered(list[0].Icon) || list[1].ID != "o/r/pdf" {
if len(list) != 3 || list[0].ID != "magpie-community/plugins/magpie-setup" || list[1].ID != "magpie-community/plugins/magpie-quota" || list[2].ID != "o/r/pdf" {
t.Fatalf("market: %+v", list)
}
if list, _ := MarketSkills("quota"); len(list) == 0 || list[0].SkillID != "magpie-quota" {
for _, m := range list[:2] {
if !m.Official || !m.Featured || m.Description == "" || m.Icon != gh("magpie-community") || !offered(m.Icon) {
t.Fatalf("magpie's own: %+v", m)
}
}
if list, _ := MarketSkills("quota"); len(list) == 0 || list[0].SkillID != "magpie-quota" || slices.ContainsFunc(list, func(m MarketSkill) bool { return m.SkillID == "magpie-setup" }) {
t.Fatalf("quota: %+v", list)
}
// Leyuu_5 on X: an agent sets magpie up; found by what a user searches
for _, q := range []string{"setup", "routing", "gateway key"} {
if list, _ := MarketSkills(q); len(list) == 0 || list[0].SkillID != "magpie-setup" {
t.Fatalf("%s: %+v", q, list)
}
}
if list, _ := MarketSkills("pdf"); slices.ContainsFunc(list, func(m MarketSkill) bool { return m.Featured }) {
t.Fatalf("pdf: %+v", list)
}