plugin: an author's own listing is kept, for a search to find (plugins#479)
On magpie-community/plugins#479 the owner ruled that registry.json
entries for packages published from their author's own repository
rightly leave out "community": true, and are shown under the
publisher's name, to a search alone. parseMarket dropped every entry
without the flag, so PinK (YuchenWell, plugins#617), and WispTerm,
CiteBox and Wisp Science (hoptoper) couldn't be found in magpie at
all.
What changed:
- parseMarket keeps a listing without the flag; Listing.Community
says which it is. The new plugin.Community(l) picks the community's.
- Every reader of the market was re-derived:
- plugins.js already browses community listings alone, matches a
search over every listing (name, package, summary, providers, npm
publisher), and shows a non-community card and page under its npm
publisher, without the magpie community badge. Unchanged.
- plugin.resolve (a short name like "river") reads the community's
alone: an author's "pink" stays npm's own name "pink".
- pluginAgents (/api/plugins/agents, the Agents page's suggestions)
reads the community's alone, as Discover's Agents section does.
- plugin.Icon's fallback by provider id reads the community's alone;
its exact-package match reads all, so PinK's own icon shows.
- pluginListings and pluginMarketState pass every listing on.
- Docs (en, zh, ja plugins.html) say such a package isn't browsed and
is found by a search, under its publisher.
Tests:
- TestMarketKeepsAuthorsOwnListings parses registry.json's River and
PinK entries as they are at plugins 486a68a5 (#617's base, lines
126-130, PinK without the flag; testdata/registry-pink.json). PinK is
kept, not community, with its kind, summary and icon; resolve("pink")
is "pink" and resolve("river") the community's package.
- TestMarketSources now expects the non-community entry kept.
- plugin-authors-listing.test.cjs: PinK isn't browsed (Agents shows
Kilo, no PinK anywhere), a search by name or publisher shows one PinK
card under "zhouzhenzhou" with no badge, its page reads
"zhouzhenzhou · magpie-plugin-pink" with no badge, River keeps its
badge. en, zh, zh-TW, ja, de; 980 and 420 wide; chromium and webkit.
Broken by hand, each red, then put back:
- parseMarket's `&& l.Community` restored: TestMarketSources and
TestMarketKeepsAuthorsOwnListings red.
- resolve without Community(): TestMarketKeepsAuthorsOwnListings red
(pink resolved to magpie-plugin-pink).
- pluginAgents without Community(): TestPluginAgentsNotInstalled red.
- plugins.js Agents without the l.community filter, and the badge shown
for every agent: plugin-authors-listing 0/22 each.
Run on mote at this head (rebased on a4916aec1; i18n-keys and plugin-authors-listing ran again there, both engines):
- gofmt -l: clean. GOOS=linux go vet -tags nogui and GOOS=windows go
vet of internal/plugin and internal/gui: ok.
- go test -timeout 45m internal/plugin, internal/provider: ok.
internal/gui: ok but TestMainWindowCorners/macOS_26_SDK (#3949,
mote's macOS 27, nothing here touches it).
- At 3086c650b (rebased on 541102eba; the rebase since touched
host.js, a gateway test and a provider test only): agent, agentplug,
backup, davsync, library, middleware, usage and plugins/...: ok.
cli: TestEveryRouteHasACommandOrIsNamed (#4826); gateway:
TestCodexPoolSaysTheClientsVersion (#4807). Both filed, untouched
here.
- node --test site/*.test.mjs: 80/80.
- GUI, every file that reaches the Plugins page (agent-plugin-agents,
i18n-keys, market-*, plugin*; 1078 tests, both engines): 1074 pass,
plugin-authors-listing 22/22. The 4 reds are plugin-move-unserved's
"Try again takes the models unticked" (#4410, models folded behind
"Show the other"), not reached here. The whole GUI suite wasn't run:
mote held two other sessions' full suites for over an hour, and this
changes no app.js, plugins.js, layout or API call. That run was at
f5c956b84; after the rebase on a1f56720c (i18n.js and caller keys
moved), plugin-authors-listing, i18n-keys, plugin-market and
plugin-registry ran again: webkit's plugin-authors-listing and
plugin-market timed out at mote load ~250 from other sessions' suites
(#4125), and both passed 14/14 alone right after.
Not tried: a real magpie window against the live registry.json (the
listings come from a fixture and a faked API); the Icon fallback's
community-only rule has no test that goes red without it.
This commit is contained in:
@@ -466,7 +466,9 @@ func pluginAgents(ctx context.Context) []string {
|
||||
have[plugin.Name(e.Spec)] = true
|
||||
}
|
||||
out := []string{}
|
||||
for _, l := range plugin.Market(ctx) {
|
||||
// the community's alone, as Discover's Agents: an author's own is
|
||||
// found by a search
|
||||
for _, l := range plugin.Community(plugin.Market(ctx)) {
|
||||
if l.Kind == "agent" && !have[l.Package] {
|
||||
out = append(out, l.Name)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
// Run with Node's test runner and Playwright on the module path; see README.md.
|
||||
// A plugin its author publishes from their own repository is listed in
|
||||
// registry.json without "community": true (the owner on
|
||||
// magpie-community/plugins#479). Discover doesn't browse it: not in
|
||||
// Agents, nor any section. A search finds it, by its name or its
|
||||
// publisher, under its publisher's name and never with the magpie
|
||||
// community badge, on its card and on its page. PinK's listing is
|
||||
// registry.json's before plugins#617. Every language, both engines, at a
|
||||
// narrow width too; the API is faked here.
|
||||
const assert = require("node:assert/strict");
|
||||
const fs = require("node:fs/promises");
|
||||
const path = require("node:path");
|
||||
const { test } = require("node:test");
|
||||
const { chromium, webkit } = require("playwright");
|
||||
|
||||
const assets = path.resolve(__dirname, "../assets");
|
||||
|
||||
const PINK = "magpie-plugin-pink";
|
||||
const RIVER = "@magpie-community/opencode-river-auth";
|
||||
const KILO = "@magpie-community/agent-kilo";
|
||||
// as /api/plugins/listings gives them: Listing's fields, community left out
|
||||
// when false (omitempty), and no npm yet
|
||||
const listings = () => [
|
||||
{ package: RIVER, name: "River", providers: ["river"], community: true,
|
||||
summary: { en: "River (river.ai) pay-as-you-go inference with your API key: per-account models from /v1/models, documented reasoning efforts and live prices from River's public pricing endpoint.", zh: "用你的 API key 接入 River (river.ai) 按量计费推理:按账号从 /v1/models 列出模型,带官方推理档位与实时价格。" } },
|
||||
{ package: KILO, name: "Kilo Code", kind: "agent", community: true, summary: { en: "Kilo Code on magpie's Agents page.", zh: "把 Kilo Code 加到 Agent 页。" } },
|
||||
{ package: PINK, name: "PinK", kind: "agent", icon: "https://raw.githubusercontent.com/YuchenWell/magpie-plugin-pink/main/assets/pink.png",
|
||||
summary: { en: "Connect PinK to Magpie's models from the Agents page and track gateway usage and cost. Disconnecting restores the managed configuration.", zh: "在 Agent 页面连接 PinK,使用 Magpie 中配置的模型并查看调用用量与费用;断开时恢复插件管理的配置。" } },
|
||||
];
|
||||
const npm = {
|
||||
[PINK]: { version: "0.1.1", publisher: "zhouzhenzhou", license: "MIT", weekly: 12 },
|
||||
[RIVER]: { version: "0.1.3", publisher: "GitHub Actions", weekly: 40 },
|
||||
[KILO]: { version: "0.1.0", weekly: 3 },
|
||||
};
|
||||
const state = { bun: true, bunVersion: "1.3.0", plugins: [] };
|
||||
|
||||
function server(lang) {
|
||||
return async (route) => {
|
||||
const url = new URL(route.request().url());
|
||||
const json = (data) => route.fulfill({ json: data });
|
||||
if (url.pathname === "/boot.js") return route.fulfill({ contentType: "text/javascript", body: `window.bootPrefs = {lang:"${lang}",theme:"light",web:false};` });
|
||||
if (url.pathname === "/wails/runtime.js") return route.fulfill({ contentType: "text/javascript", body: "export const Window = {};" });
|
||||
if (url.pathname === "/api/state") return json({ agents: [], profiles: [], settings: { lang, theme: "light" } });
|
||||
if (url.pathname === "/api/providers") return json({ providers: [], presets: [], excluded: [], gateway: { running: true, window: true }, plugins: [] });
|
||||
if (url.pathname === "/api/groups") return json({ groups: [], pools: [] });
|
||||
if (url.pathname === "/api/gateway/trace") return json({ routes: [] });
|
||||
if (url.pathname === "/api/plugins") return json(state);
|
||||
if (url.pathname === "/api/plugins/listings") return json({ listings: listings() });
|
||||
if (url.pathname === "/api/plugins/market") return json({ listings: listings(), state });
|
||||
if (url.pathname === "/api/plugins/npm") {
|
||||
const out = {};
|
||||
for (const n of (url.searchParams.get("names") || "").split(",")) if (npm[n]) out[n] = npm[n];
|
||||
return json({ npm: out });
|
||||
}
|
||||
// npm's own search has it too: still one card
|
||||
if (url.pathname === "/api/plugins/search") return json({ hits: [{ package: PINK, version: "0.1.1", publisher: "zhouzhenzhou" }] });
|
||||
if (url.pathname === "/api/plugins/github") return json({ repos: [] });
|
||||
if (url.pathname === "/api/plugins/page") return json({ readme: "# PinK", updated: "2026-10-30T00:00:00Z" });
|
||||
if (url.pathname.startsWith("/api/")) return json({});
|
||||
if (url.hostname !== "magpie.test") return route.fulfill({ status: 404, body: "" });
|
||||
const file = path.join(assets, url.pathname === "/" ? "index.html" : url.pathname);
|
||||
const contentType = { ".html": "text/html", ".js": "text/javascript", ".css": "text/css", ".svg": "image/svg+xml", ".png": "image/png" }[path.extname(file)];
|
||||
try { await route.fulfill({ body: await fs.readFile(file), contentType }); } catch { await route.fulfill({ status: 404, body: "" }); }
|
||||
};
|
||||
}
|
||||
|
||||
const L = {
|
||||
en: { agents: "Agents", community: "magpie community" },
|
||||
zh: { agents: "Agent", community: "magpie 社区" },
|
||||
"zh-TW": { agents: "Agent", community: "magpie 社群" },
|
||||
ja: { agents: "エージェント", community: "magpie コミュニティ" },
|
||||
de: { agents: "Agenten", community: "magpie-Community" },
|
||||
};
|
||||
|
||||
for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) {
|
||||
test(engine + ": an author's own listing is found by a search, under its publisher", async (t) => {
|
||||
const browser = await (engine === "webkit" ? webkit.launch() : chromium.launch({ channel: "chromium" }));
|
||||
t.after(() => browser.close());
|
||||
for (const lang of Object.keys(L)) for (const width of [980, 420]) {
|
||||
await t.test(lang + " " + width, async () => {
|
||||
const w = L[lang];
|
||||
const page = await (await browser.newContext({ viewport: { width, height: 820 } })).newPage();
|
||||
page.setDefaultTimeout(5000);
|
||||
page.setDefaultNavigationTimeout(60000);
|
||||
const errors = [];
|
||||
page.on("pageerror", (e) => errors.push(e.message));
|
||||
await page.route("**/*", server(lang));
|
||||
await page.goto("http://magpie.test/?view=plugins");
|
||||
const view = page.locator("#view-plugins");
|
||||
const card = (pkg) => view.locator(`.pm-card[data-pkg="${pkg}"]`);
|
||||
const shot = (name) => process.env.ARTIFACT_DIR && view.screenshot({ path: path.join(process.env.ARTIFACT_DIR, `plugin-authors-${name}-${engine}-${lang}-${width}.png`) });
|
||||
|
||||
// browsed: the community's agent in Agents, PinK nowhere, after
|
||||
// npm has answered too (a redraw)
|
||||
const agents = view.locator(".pm-sec.pm-agents");
|
||||
await agents.locator(".pm-sechead h3", { hasText: new RegExp("^" + w.agents + "$") }).waitFor();
|
||||
await card(KILO).locator(".pm-ver").waitFor();
|
||||
await card(RIVER).waitFor();
|
||||
assert.equal(await card(PINK).count(), 0, "PinK is browsed");
|
||||
assert.doesNotMatch(await view.innerText(), /PinK/);
|
||||
assert.equal(await card(RIVER).locator(".pm-verified").count(), 1);
|
||||
assert.equal((await card(RIVER).locator(".pm-verified").innerText()).trim(), w.community);
|
||||
await shot("browse");
|
||||
|
||||
// searched by its name: its card once, by its publisher, no badge
|
||||
const q = view.locator(".pm-find input");
|
||||
await q.fill("pink");
|
||||
await card(PINK).waitFor();
|
||||
await card(PINK).locator(".pm-ver").waitFor();
|
||||
assert.equal(await card(PINK).count(), 1, "the listing and npm's hit are one card");
|
||||
assert.equal(await card(PINK).locator(".pm-verified").count(), 0);
|
||||
assert.equal((await card(PINK).locator(".pm-by").innerText()).trim(), "zhouzhenzhou");
|
||||
assert.doesNotMatch(await card(PINK).innerText(), new RegExp(w.community));
|
||||
assert.equal(await card(RIVER).count(), 0);
|
||||
await shot("search");
|
||||
|
||||
// the search cleared: browsed again, PinK gone
|
||||
await q.fill("");
|
||||
await card(KILO).waitFor();
|
||||
assert.equal(await card(PINK).count(), 0);
|
||||
|
||||
// found by its publisher's name too
|
||||
await q.fill("zhouzhen");
|
||||
await card(PINK).waitFor();
|
||||
|
||||
// its page says the same: publisher · package, never the badge
|
||||
await card(PINK).locator(".pm-sum").click();
|
||||
const dlg = page.locator("#modal .pm-detail");
|
||||
await dlg.waitFor();
|
||||
assert.equal((await dlg.locator(".pm-dhead .pm-by").innerText()).trim(), "zhouzhenzhou · " + PINK);
|
||||
assert.doesNotMatch(await dlg.locator(".pm-dhead").innerText(), new RegExp(w.community));
|
||||
const over = await page.evaluate(() => document.scrollingElement.scrollWidth - document.scrollingElement.clientWidth);
|
||||
assert.ok(over <= 0, "page scrolls sideways by " + over);
|
||||
assert.deepEqual(errors, []);
|
||||
await page.context().close();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -43,13 +43,17 @@ var builtinParsed = sync.OnceValue(func() []Listing {
|
||||
// "off" keeps to the built-in copy.
|
||||
const MarketURL = "https://raw.githubusercontent.com/magpie-community/plugins/main/registry.json"
|
||||
|
||||
// Listing is a plugin the market suggests.
|
||||
// Listing is a plugin the market suggests. One not Community is an
|
||||
// author's own package the list names, published from their repository
|
||||
// (the owner on magpie-community/plugins#479: PinK, WispTerm): the page
|
||||
// shows it to a search alone, under its publisher; it is never browsed,
|
||||
// suggested as an agent or called by a short name.
|
||||
type Listing struct {
|
||||
Package string `json:"package"`
|
||||
Name string `json:"name"`
|
||||
Icon string `json:"icon,omitempty"`
|
||||
Providers []string `json:"providers,omitempty"` // OpenCode's ids of those it signs in to
|
||||
Community bool `json:"community,omitempty"` // written by magpie's community
|
||||
Community bool `json:"community,omitempty"` // written by magpie's community; see Listing
|
||||
Replaces string `json:"replaces,omitempty"` // the built-in subscription it does the work of
|
||||
Kind string `json:"kind,omitempty"` // "middleware" for gateway middleware, "agent" for an agent, "tools" for tools alone, "page" for a page alone; none for a provider
|
||||
Summary map[string]string `json:"summary,omitempty"` // by language: en, zh
|
||||
@@ -183,9 +187,11 @@ func parseMarket(b []byte) ([]Listing, error) {
|
||||
}
|
||||
out := r.Plugins[:0]
|
||||
for _, l := range r.Plugins {
|
||||
// magpie's community's alone: others' OpenCode plugins weren't
|
||||
// written against magpie's sign-ins, and are found by a search
|
||||
if l.Package != "" && pkgName.MatchString(l.Package) && l.Community {
|
||||
// an author's own package is kept too, marked as not the
|
||||
// community's (Community false): the page shows it to a search
|
||||
// alone, and only the community's are browsed, suggested as
|
||||
// agents or called by a short name (Community)
|
||||
if l.Package != "" && pkgName.MatchString(l.Package) {
|
||||
if l.Name == "" {
|
||||
l.Name = l.Package
|
||||
}
|
||||
@@ -198,6 +204,17 @@ func parseMarket(b []byte) ([]Listing, error) {
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// Community is the listings of l magpie's community wrote, in l's order.
|
||||
func Community(l []Listing) []Listing {
|
||||
out := []Listing{}
|
||||
for _, x := range l {
|
||||
if x.Community {
|
||||
out = append(out, x)
|
||||
}
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// Market is the list of plugins magpie suggests: fetched at most every six
|
||||
// hours, else the copy fetched last, else the one built in.
|
||||
func Market(ctx context.Context) []Listing {
|
||||
@@ -836,7 +853,7 @@ func Icon(spec, id string) string {
|
||||
if ic, ok := otherIcons[pkg]; ok {
|
||||
return ic
|
||||
}
|
||||
for _, x := range l {
|
||||
for _, x := range Community(l) {
|
||||
for _, p := range x.Providers {
|
||||
if p == id && x.Icon != "" {
|
||||
return x.Icon
|
||||
|
||||
@@ -64,12 +64,12 @@ func TestMarketSources(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
|
||||
reset()
|
||||
if l := Market(ctx); len(l) != 1 || l[0].Name != "X" {
|
||||
if l := Market(ctx); len(l) != 2 || l[0].Name != "X" || l[1].Package != "opencode-other-auth" || l[1].Community {
|
||||
t.Fatalf("fetched: %+v", l)
|
||||
}
|
||||
up = false
|
||||
reset()
|
||||
if l := Market(ctx); len(l) != 1 || l[0].Package != "opencode-x-auth" {
|
||||
if l := Market(ctx); len(l) != 2 || l[0].Package != "opencode-x-auth" {
|
||||
t.Fatalf("down, the copy kept: %+v", l)
|
||||
}
|
||||
t.Setenv("XDG_CACHE_HOME", t.TempDir())
|
||||
@@ -87,6 +87,58 @@ func TestMarketSources(t *testing.T) {
|
||||
reset()
|
||||
}
|
||||
|
||||
// An author's own package the list names, without "community": true, is
|
||||
// kept, marked as not the community's (the owner on
|
||||
// magpie-community/plugins#479: such a listing is right to leave the flag
|
||||
// out, and is shown under its publisher when someone searches). PinK as
|
||||
// registry.json had it before plugins#617, beside a community plugin:
|
||||
// it was dropped, so no search in magpie found it. Only the community's
|
||||
// are called by a short name.
|
||||
func TestMarketKeepsAuthorsOwnListings(t *testing.T) {
|
||||
b, err := os.ReadFile(filepath.Join("testdata", "registry-pink.json"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
l, err := parseMarket(b)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if len(l) != 2 {
|
||||
t.Fatalf("%d listed, want River and PinK: %+v", len(l), l)
|
||||
}
|
||||
pink := l[1]
|
||||
if pink.Package != "magpie-plugin-pink" || pink.Name != "PinK" || pink.Kind != "agent" || pink.Community {
|
||||
t.Errorf("PinK: %+v", pink)
|
||||
}
|
||||
if pink.Summary["en"] == "" || !strings.HasPrefix(pink.Icon, "https://") {
|
||||
t.Errorf("PinK lost its summary or icon: %+v", pink)
|
||||
}
|
||||
if c := Community(l); len(c) != 1 || c[0].Package != "@magpie-community/opencode-river-auth" {
|
||||
t.Errorf("the community's: %+v", c)
|
||||
}
|
||||
|
||||
t.Setenv("XDG_CACHE_HOME", t.TempDir())
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.Write(b) }))
|
||||
defer srv.Close()
|
||||
t.Setenv("MAGPIE_PLUGIN_MARKET", srv.URL)
|
||||
RefreshMarket()
|
||||
marketMu.Lock()
|
||||
marketList = nil
|
||||
marketMu.Unlock()
|
||||
t.Cleanup(func() { marketMu.Lock(); marketList = nil; marketMu.Unlock() })
|
||||
ctx := context.Background()
|
||||
if got, err := resolve(ctx, "river"); err != nil || got != "@magpie-community/opencode-river-auth" {
|
||||
t.Errorf("river: %q %v", got, err)
|
||||
}
|
||||
// PinK's names aren't the community's: npm's package of that name
|
||||
if got, err := resolve(ctx, "pink"); err != nil || got != "pink" {
|
||||
t.Errorf("pink: %q %v", got, err)
|
||||
}
|
||||
if got, _ := resolve(ctx, "magpie-plugin-pink"); got != "magpie-plugin-pink" {
|
||||
t.Errorf("magpie-plugin-pink: %q", got)
|
||||
}
|
||||
}
|
||||
|
||||
// A plugin's provider shows its vendor's icon: the one its package is
|
||||
// listed with, else that of a listed plugin for the same provider.
|
||||
func TestMarketIcon(t *testing.T) {
|
||||
|
||||
@@ -60,7 +60,10 @@ func resolve(ctx context.Context, spec string) (string, error) {
|
||||
if key == "" {
|
||||
return spec, nil
|
||||
}
|
||||
// the community's alone: an author's own listing is npm's name, as
|
||||
// written
|
||||
list, lerr := market(ctx)
|
||||
list = Community(list)
|
||||
var found []string
|
||||
for _, l := range list {
|
||||
if slices.Contains(callNames(l), key) && !slices.Contains(found, l.Package) {
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"version": 1,
|
||||
"plugins": [
|
||||
{ "package": "@magpie-community/opencode-river-auth", "name": "River", "providers": ["river"], "community": true,
|
||||
"summary": { "en": "River (river.ai) pay-as-you-go inference with your API key: per-account models from /v1/models, documented reasoning efforts and live prices from River's public pricing endpoint.", "zh": "用你的 API key 接入 River (river.ai) 按量计费推理:按账号从 /v1/models 列出模型,带官方推理档位与实时价格。" } },
|
||||
{ "package": "magpie-plugin-pink", "name": "PinK", "kind": "agent",
|
||||
"icon": "https://raw.githubusercontent.com/YuchenWell/magpie-plugin-pink/main/assets/pink.png",
|
||||
"summary": { "en": "Connect PinK to Magpie's models from the Agents page and track gateway usage and cost. Disconnecting restores the managed configuration.", "zh": "在 Agent 页面连接 PinK,使用 Magpie 中配置的模型并查看调用用量与费用;断开时恢复插件管理的配置。" } }
|
||||
]
|
||||
}
|
||||
@@ -662,7 +662,7 @@ m plugin logout acme</pre>
|
||||
<span class="s">"providers"</span>: [<span class="s">"acme"</span>],
|
||||
<span class="s">"summary"</span>: { <span class="s">"en"</span>: <span class="s">"Your Acme Coding Plan."</span>, <span class="s">"zh"</span>: <span class="s">"使用你的 Acme Coding Plan。"</span> } }</pre>
|
||||
</div>
|
||||
ミドルウェアのエントリには <code>"kind": "middleware"</code> を書き、<code>providers</code> は書きません。<span class="ui">ゲートウェイミドルウェア</span> の下に表示されます。ほかの種類も同じで、<code>"kind": "tools"</code> は <span class="ui">エージェント向けツール</span>、<code>"kind": "page"</code> は <span class="ui">ページ</span>、<code>"kind": "agent"</code> は <span class="ui">エージェント</span> の下に表示されます。<code>MAGPIE_PLUGIN_MARKET=<url></code> は magpie に別の一覧を参照させます(自分の一覧の確認に便利です)。<code>off</code> にすると内蔵のコピーだけを使います。</li>
|
||||
ミドルウェアのエントリには <code>"kind": "middleware"</code> を書き、<code>providers</code> は書きません。<span class="ui">ゲートウェイミドルウェア</span> の下に表示されます。ほかの種類も同じで、<code>"kind": "tools"</code> は <span class="ui">エージェント向けツール</span>、<code>"kind": "page"</code> は <span class="ui">ページ</span>、<code>"kind": "agent"</code> は <span class="ui">エージェント</span> の下に表示されます。これらのセクションに並ぶのはコミュニティ自身のパッケージで、エントリに <code>"community": true</code> があります。自分のリポジトリから公開したパッケージはこれを書きません。セクションには出ませんが、<span class="ui">プラグイン</span> の検索で名前・説明・公開者から見つかり、カードには magpie コミュニティのバッジではなく npm の公開者が表示されます。<code>MAGPIE_PLUGIN_MARKET=<url></code> は magpie に別の一覧を参照させます(自分の一覧の確認に便利です)。<code>off</code> にすると内蔵のコピーだけを使います。</li>
|
||||
<li><b>GitHub のトピック。</b>GitHub で <code>magpie-plugin</code> トピックを付けたリポジトリは、<span class="ui">プラグイン → 発見 → 非公式 · GitHub</span> に、スターの多い順に、誰もレビューしていないものとして表示されます。<code>package.json</code> はリポジトリのルートに置いてください。<code>repository</code> がそのリポジトリを指す形で npm に公開されていれば npm からインストールされ、そうでなければリポジトリの現在のコードがインストールされます。そのため読み込むファイルはコミットしておく必要があり、<code>dist</code> を公開時にしかビルドしないリポジトリは表示されません。フォーク、アーカイブ済みのリポジトリ、magpie-community 自身のものも表示されません。magpie が GitHub に問い合わせるのは最大で 10 分に 1 回なので、トピックを付けたリポジトリは数分で表示されます。カードには <code>package.json</code> の <code>"magpie": { "icon": "…" }</code> で指定したアイコンが表示され、ない場合はパズルのアイコンになります。ライセンスは GitHub がリポジトリの <code>LICENSE</code> ファイルから読み取ったものです。GitHub がどのライセンスか判定できない場合(<code>NOASSERTION</code>。MIT の本文に 1 行加えた場合など)やファイルがない場合は、<code>package.json</code> の <code>license</code> を表示します。npm からインストールされるプラグインは <code>package.json</code> のものを表示します。</li>
|
||||
<li><b>コミュニティのパッケージ。</b><a href="https://github.com/magpie-community/plugins">magpie-community/plugins</a> に貢献するには:
|
||||
<ul>
|
||||
|
||||
@@ -662,7 +662,7 @@ m plugin logout acme</pre>
|
||||
<span class="s">"providers"</span>: [<span class="s">"acme"</span>],
|
||||
<span class="s">"summary"</span>: { <span class="s">"en"</span>: <span class="s">"Your Acme Coding Plan."</span>, <span class="s">"zh"</span>: <span class="s">"使用你的 Acme Coding Plan。"</span> } }</pre>
|
||||
</div>
|
||||
A middleware’s entry has <code>"kind": "middleware"</code> and no <code>providers</code>; it is listed under <span class="ui">Gateway middleware</span>. The other kinds are listed the same way: <code>"kind": "tools"</code> under <span class="ui">Tools for agents</span>, <code>"kind": "page"</code> under <span class="ui">Pages</span> and <code>"kind": "agent"</code> under <span class="ui">Agents</span>. <code>MAGPIE_PLUGIN_MARKET=<url></code> points magpie at another list, which is useful to check yours, and <code>off</code> keeps to the built-in copy.</li>
|
||||
A middleware’s entry has <code>"kind": "middleware"</code> and no <code>providers</code>; it is listed under <span class="ui">Gateway middleware</span>. The other kinds are listed the same way: <code>"kind": "tools"</code> under <span class="ui">Tools for agents</span>, <code>"kind": "page"</code> under <span class="ui">Pages</span> and <code>"kind": "agent"</code> under <span class="ui">Agents</span>. Those sections hold the community’s own packages, whose entries have <code>"community": true</code>. A package published from your own repository leaves that out: it isn’t in the sections, the search on <span class="ui">Plugins</span> finds it by its name, summary or publisher, and its card shows its npm publisher, not the magpie community badge. <code>MAGPIE_PLUGIN_MARKET=<url></code> points magpie at another list, which is useful to check yours, and <code>off</code> keeps to the built-in copy.</li>
|
||||
<li><b>A GitHub topic.</b> A repository tagged <code>magpie-plugin</code> on GitHub is shown under <span class="ui">Plugins → Discover → Unofficial, on GitHub</span>, the most starred first, marked as reviewed by no one. Keep <code>package.json</code> at the repository’s root. Published to npm with <code>repository</code> naming the repository, it is installed from npm; otherwise from the repository as it stands, so the file it loads must be committed: one whose <code>dist</code> is built only to publish is left out. Forks, archived repositories and magpie-community’s own are left out too. magpie asks GitHub at most every ten minutes, so a repository shows within minutes of being tagged. Its card shows the icon <code>"magpie": { "icon": "…" }</code> in its <code>package.json</code> gives, else a puzzle piece. Its licence is the one GitHub reads from the repository’s <code>LICENSE</code> file; when GitHub can’t match the file to a licence (it says <code>NOASSERTION</code>, as for MIT’s text with a line added) or there is none, the card shows <code>package.json</code>’s <code>license</code>. A plugin installed from npm shows <code>package.json</code>’s.</li>
|
||||
<li><b>The community packages.</b> To contribute one to <a href="https://github.com/magpie-community/plugins">magpie-community/plugins</a>:
|
||||
<ul>
|
||||
|
||||
@@ -662,7 +662,7 @@ m plugin logout acme</pre>
|
||||
<span class="s">"providers"</span>: [<span class="s">"acme"</span>],
|
||||
<span class="s">"summary"</span>: { <span class="s">"en"</span>: <span class="s">"Your Acme Coding Plan."</span>, <span class="s">"zh"</span>: <span class="s">"使用你的 Acme Coding Plan。"</span> } }</pre>
|
||||
</div>
|
||||
中间件的条目写 <code>"kind": "middleware"</code>,不写 <code>providers</code>,列在<span class="ui">网关中间件</span>下。其他类型也一样:<code>"kind": "tools"</code> 列在<span class="ui">给 Agent 的工具</span>下,<code>"kind": "page"</code> 列在<span class="ui">页面</span>下,<code>"kind": "agent"</code> 列在 <span class="ui">Agent</span> 下。<code>MAGPIE_PLUGIN_MARKET=<url></code> 让 magpie 改用另一份列表,可以用来检查你的条目;设为 <code>off</code> 则只用内置副本。</li>
|
||||
中间件的条目写 <code>"kind": "middleware"</code>,不写 <code>providers</code>,列在<span class="ui">网关中间件</span>下。其他类型也一样:<code>"kind": "tools"</code> 列在<span class="ui">给 Agent 的工具</span>下,<code>"kind": "page"</code> 列在<span class="ui">页面</span>下,<code>"kind": "agent"</code> 列在 <span class="ui">Agent</span> 下。这些分组里是社区自己的包,条目写着 <code>"community": true</code>。从你自己的仓库发布的包不写这一项:它不在这些分组里,<span class="ui">插件</span>页的搜索按名字、简介或发布者能找到它,卡片显示它在 npm 上的发布者,不带 magpie 社区标记。<code>MAGPIE_PLUGIN_MARKET=<url></code> 让 magpie 改用另一份列表,可以用来检查你的条目;设为 <code>off</code> 则只用内置副本。</li>
|
||||
<li><b>GitHub 标签。</b>在 GitHub 上打了 <code>magpie-plugin</code> topic 的仓库,会显示在 <span class="ui">插件 → 发现 → 非官方插件 · GitHub</span> 里,Star 多的在前,并标明没有人审阅过。<code>package.json</code> 要放在仓库根目录。发布到 npm 且 <code>repository</code> 指向这个仓库的,从 npm 安装;否则按仓库当前的代码安装,所以它加载的文件必须提交进仓库:<code>dist</code> 只在发布时才构建的仓库不会显示。fork、已归档的仓库和 magpie-community 自己的仓库也不显示。magpie 最多每十分钟问一次 GitHub,仓库打上标签后几分钟内就会出现。卡片显示 <code>package.json</code> 里 <code>"magpie": { "icon": "…" }</code> 给的图标,没有就显示拼图图标。许可证取 GitHub 从仓库 <code>LICENSE</code> 文件识别出的那个;GitHub 认不出是哪种许可证(显示 <code>NOASSERTION</code>,比如 MIT 正文多加了一行)或者没有这个文件时,卡片显示 <code>package.json</code> 的 <code>license</code>。从 npm 安装的插件显示 <code>package.json</code> 里的。</li>
|
||||
<li><b>社区包。</b>想把插件贡献到 <a href="https://github.com/magpie-community/plugins">magpie-community/plugins</a>:
|
||||
<ul>
|
||||
|
||||
Reference in New Issue
Block a user