From 48afb27b0fb4a92dc3232bb2c01246d041573dd4 Mon Sep 17 00:00:00 2001 From: yetone Date: Fri, 13 Nov 2026 11:25:17 +0800 Subject: [PATCH] library: Claude plugin rows show counts, the dialog keeps its width and folds the parts (jinpwng on X, #6309) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The plugin dialog's description, part lists and source line sat in the editor grid's 132px label column, so even Plannotator (3 hooks) read as a narrow column: the Hooks heading landed in the right column, the names under it on the left and the GitHub line in the middle. Description, parts and hints now span the grid. The list row showed every skill name (PStack lists a hundred); it shows "Skills 12 · Hooks 3", and the dialog lists each part's names in a fold, closed by default. Run at this head (rebased on 610ae1f54), on mica, Chromium and WebKit, en, zh, zh-TW, ja, de, 420 and 1100: library-plugins, library-subagents, library-all, library-row-open-scroll, library-open-again, i18n-keys, i18n-en-no-cjk: 82 of 82 pass. gui-zh-tw passes; gui-de and gui-ja's "has every zh string" are red on main already ({agent} placeholder, #6234). Broken by hand: with the span rule cut back to the

only, the test fails with "a part or the source is squeezed" (parts 116/433 of 600px, source 116px), the reporter's alternating layout. With the old CSS it fails "the description is squeezed: {p:132,d:600}". No Go files changed, so no gofmt/vet. Not tried: the real app with a real PStack or Plannotator. --- internal/gui/assets/plugins/library/client.js | 11 +++++++++-- internal/gui/assets/plugins/library/library.css | 4 ++++ internal/gui/tests/library-plugins.test.cjs | 15 ++++++++++++++- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/internal/gui/assets/plugins/library/client.js b/internal/gui/assets/plugins/library/client.js index 5f122c0e8..6a1a630a0 100644 --- a/internal/gui/assets/plugins/library/client.js +++ b/internal/gui/assets/plugins/library/client.js @@ -4895,7 +4895,10 @@ magpie.plugin("library", (ctx) => { const who = el("div", "who"); who.append(el("div", "name mono", p.name + (p.version ? " " + p.version : ""))); if (p.description) who.append(el("div", "lib-subagentdesc", p.description)); - const line = pluginParts(p); + // counts, not every name: PStack has a hundred (jinpwng on X); the + // names are in the dialog, folded + const line = [[t("Skills"), p.skills], [t("MCP servers"), p.mcp], [t("Hooks"), p.hooks], [t("Subagents"), p.subagents]] + .filter(([, v]) => v?.length).map(([k, v]) => k + " " + v.length).join(" · "); if (line) who.append(el("div", "sub lib-plparts", line)); row.append(glyph(GLYPH.folder), who, agentChips(all, p.agents, chipsChange("plugins/agents", p.name, "plugins", (x) => pluginRow(x, all)), { all: true }), @@ -4913,7 +4916,11 @@ magpie.plugin("library", (ctx) => { ed.append(head); if (p.description) ed.append(el("p", "lib-subagentdesc", p.description)); const rows = [[t("Skills"), p.skills], [t("MCP servers"), p.mcp], [t("Hooks"), p.hooks], [t("Subagents"), p.subagents]].filter(([, v]) => v?.length); - for (const [label, names] of rows) ed.append(...field(label, el("div", "mono lib-plnames", names.join(", ")))); + for (const [label, names] of rows) { + const d = el("details", "lib-plgroup"); + d.append(el("summary", "", label + " " + names.length), el("div", "mono lib-plnames", names.join(", "))); + ed.append(d); + } if (p.missing?.length) ed.append(el("div", "hint lib-plmissing", t("Taken out by hand: {names}", { names: p.missing.join(", ") }))); if (p.left?.length) { const left = el("div", "lib-plleft"); diff --git a/internal/gui/assets/plugins/library/library.css b/internal/gui/assets/plugins/library/library.css index 5e3f526e8..954c87d7a 100644 --- a/internal/gui/assets/plugins/library/library.css +++ b/internal/gui/assets/plugins/library/library.css @@ -796,6 +796,10 @@ input.lib-setname:focus { border-color: var(--accent); box-shadow: 0 0 0 3px col .lib-plugin > .who { flex-basis: 240px; } .lib-plugin.off .name, .lib-plugin.off .lib-subagentdesc { opacity: .55; } .lib-plugin .lib-plparts, .lib-plpick .lib-plparts { white-space: normal; overflow-wrap: anywhere; } +.lib-pldetail > :is(p, details, .hint), .lib-pldetail .ebody > :is(p, details, .hint) { grid-column: 1 / -1; margin: 0; } +.lib-pldetail p { font-size: 12.5px; line-height: 1.5; } +.lib-pldetail .lib-plgroup > summary { cursor: pointer; font-size: 12.5px; color: var(--fg-2); } +.lib-pldetail .lib-plgroup .lib-plnames { margin-top: 4px; font-size: 12px; } .lib-pldetail .lib-plnames, .lib-pldetail .lib-plsource { white-space: normal; overflow-wrap: anywhere; } .lib-subagentedit .lib-menu { max-width: 100%; height: 28px; color: var(--fg); } .lib-subagentedit .lib-menu > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } diff --git a/internal/gui/tests/library-plugins.test.cjs b/internal/gui/tests/library-plugins.test.cjs index 0d6e067da..e0ac6c274 100644 --- a/internal/gui/tests/library-plugins.test.cjs +++ b/internal/gui/tests/library-plugins.test.cjs @@ -139,6 +139,19 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", await page.locator("#modal .lib-pldetail").waitFor(); await settled(page); assert.deepEqual(await sideways(page), [], "sideways scroll in the dialog at 1100"); + // the description keeps the dialog's width, and the parts are folded (jinpwng on X) + const m = await page.evaluate(() => { + const d = document.querySelector("#modal .lib-pldetail"); + const p = d.querySelector("p").getBoundingClientRect(); + const w = (x) => x.getBoundingClientRect().width; + return { p: p.width, d: d.getBoundingClientRect().width, open: [...d.querySelectorAll("details")].filter((x) => x.open).length, n: d.querySelectorAll("details").length, + parts: [...d.querySelectorAll("details")].map(w), src: w(d.querySelector(".lib-plsource")) }; + }); + assert(m.p > m.d * 0.8, "the description is squeezed: " + JSON.stringify(m)); + // #6309: Plannotator's Hooks heading sat far right and the GitHub line in the middle + for (const x of [...m.parts, m.src]) assert(x > m.d * 0.8, "a part or the source is squeezed: " + JSON.stringify(m)); + assert.equal(m.open, 0, "parts open by default"); + assert.equal(m.n, 4); await ctx.close(); } @@ -149,7 +162,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", const tabs = (await v.locator(".lib-tabs button").allTextContents()).map((x) => x.trim()); assert(tabs.includes(w("Claude plugins") + " · 1"), tabs.join("|")); assert.equal((await row("code-kit").locator(".lib-plparts").textContent()).trim(), - [w("Skills: {names}", { names: "code-kit-tdd" }), w("MCP servers: {names}", { names: "code-kit-docs" }), w("Hooks: {names}", { names: "code-kit-lint" }), w("Subagents: {names}", { names: "code-kit-reviewer" })].join(" · ")); + [w("Skills") + " 1", w("MCP servers") + " 1", w("Hooks") + " 1", w("Subagents") + " 1"].join(" · ")); assert.deepEqual(await sideways(page), [], "sideways scroll at 420"); assert.equal(await page.locator("select").count(), 0, "a native