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