дзеркало
https://github.com/l0ng-ai/openidea.git
синхронізовано 2026-12-04 01:01:17 +02:00
Reorganize Settings > Agents into General, Coding Agents, Permissions, Rules & Memory, Skills, MCP (External Servers, IDE Server), Agent Plugins and Automations, with redirects from the old MCP page ids. List pages share a master-detail layout and form pages align their fields. The IDE Server options stay in the settings search, and the docs use the new page names.
234 рядки
9.0 KiB
TypeScript
234 рядки
9.0 KiB
TypeScript
import type { AgentMarketplaceBrowseResult, AgentPluginCatalog, AgentPluginState } from "../src/bindings";
|
|
import { expect, stubDesktop, test } from "./fixtures";
|
|
|
|
const svgDataIcon = (bg: string, label: string) =>
|
|
`data:image/svg+xml,${encodeURIComponent(
|
|
`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><rect width="32" height="32" rx="6" fill="${bg}"/><text x="16" y="21" text-anchor="middle" fill="#fff" font-family="system-ui,sans-serif" font-size="13" font-weight="700">${label}</text></svg>`,
|
|
)}`;
|
|
|
|
const makePlugin = (name: string, consentRequired: boolean): AgentPluginState => ({
|
|
plugin: {
|
|
id: name,
|
|
name,
|
|
displayName: name,
|
|
version: "26.1021.31345",
|
|
description: "A plugin with a long description explaining what it can do for the agent in this workspace.",
|
|
marketplace: "context-engineering-marketplace-with-a-long-name",
|
|
source: "claudeUser",
|
|
scope: "user",
|
|
formats: ["claude", "codex", "copilot"],
|
|
rootPath: "/Users/dev/.claude/plugins/cache/context-engineering-marketplace/agent-plugin",
|
|
defaultEnabled: false,
|
|
approxTokens: 2550,
|
|
capabilities: {
|
|
skillCount: 17,
|
|
mcpCount: 1,
|
|
ruleCount: 2,
|
|
subagentCount: 3,
|
|
commandCount: 0,
|
|
hookFiles: consentRequired ? ["hooks/a-very-long-lifecycle-hook-file-name.json"] : [],
|
|
requiresConsent: consentRequired,
|
|
},
|
|
valid: true,
|
|
},
|
|
enabled: !consentRequired,
|
|
origin: consentRequired ? "consent" : "none",
|
|
consentRequired,
|
|
});
|
|
|
|
test("agent plugin metadata stays clear of enable and review controls at narrow widths", async ({
|
|
workbench: page,
|
|
}) => {
|
|
const longName = "Context Engineering with an exceptionally long plugin display name";
|
|
const catalog: AgentPluginCatalog = {
|
|
plugins: [makePlugin(longName, true), makePlugin("Frontend Design", false)],
|
|
marketplaces: [
|
|
{
|
|
id: "official",
|
|
name: "claude-plugins-official",
|
|
source: "example/official",
|
|
scope: "user",
|
|
discovered: true,
|
|
},
|
|
{
|
|
id: "community",
|
|
name: "context-engineering-marketplace-with-a-long-name",
|
|
source: "example/community",
|
|
scope: "user",
|
|
discovered: true,
|
|
},
|
|
],
|
|
projectedSkills: 17,
|
|
projectedMcpServers: 1,
|
|
projectedRules: 2,
|
|
};
|
|
await stubDesktop(page);
|
|
await page.evaluate(async (catalog) => {
|
|
window.__ipc.handlers.agent_plugins_list = () => structuredClone(catalog);
|
|
window.__ipc.handlers.window_open_settings = () => {
|
|
throw { kind: "unavailable", message: "separate settings window disabled in browser test", detail: null };
|
|
};
|
|
const actionsModule = "/src/platform/actions.ts";
|
|
const { executeAction } = await import(/* @vite-ignore */ actionsModule);
|
|
await executeAction("file.settings", "agents.plugins");
|
|
}, catalog);
|
|
const dialog = page.getByRole("dialog", { name: "Settings", exact: true });
|
|
await expect(dialog).toBeVisible();
|
|
const group = dialog.getByRole("region", { name: "Claude Code · User" });
|
|
const rows = group.getByRole("listitem");
|
|
await expect(rows).toHaveCount(2);
|
|
const review = dialog.getByRole("button", { name: "Review & Enable…" });
|
|
await expect(review).toBeVisible();
|
|
for (const width of [1120, 780, 580, 520]) {
|
|
await page.setViewportSize({ width, height: 760 });
|
|
await expect(async () => {
|
|
const fit = await rows.evaluateAll((items) =>
|
|
items.every((row) => {
|
|
const btn = row.querySelector("button")!;
|
|
const bounds = row.getBoundingClientRect();
|
|
const a = btn.getBoundingClientRect();
|
|
const title = btn.querySelector("[title]")!.getBoundingClientRect();
|
|
return title.width > 0 && a.right <= bounds.right + 1 && btn.scrollWidth <= btn.clientWidth + 1;
|
|
}),
|
|
);
|
|
expect(fit).toBe(true);
|
|
}).toPass();
|
|
if (process.env.SETTINGS_EVIDENCE)
|
|
await dialog.screenshot({
|
|
path: `${process.env.SETTINGS_EVIDENCE}/plugins-${width}.png`,
|
|
animations: "disabled",
|
|
});
|
|
}
|
|
|
|
await rows
|
|
.first()
|
|
.getByRole("button", { name: new RegExp(longName) })
|
|
.click();
|
|
await expect(dialog.getByText(catalog.plugins[0]!.plugin.marketplace!)).toBeVisible();
|
|
await expect(dialog.getByText(".claude-plugin · .codex-plugin · .plugin")).toBeVisible();
|
|
await expect(dialog.getByText(catalog.plugins[0]!.plugin.description, { exact: true })).toBeVisible();
|
|
if (process.env.SETTINGS_EVIDENCE) {
|
|
await page.setViewportSize({ width: 1120, height: 760 });
|
|
await page.evaluate(async () => {
|
|
const themePath = "/src/workbench/theme.ts";
|
|
const { setTheme } = await import(/* @vite-ignore */ themePath);
|
|
await setTheme("dark");
|
|
});
|
|
await dialog.screenshot({
|
|
path: `${process.env.SETTINGS_EVIDENCE}/plugins-expanded-dark.png`,
|
|
animations: "disabled",
|
|
});
|
|
}
|
|
await review.click();
|
|
await expect(page.getByRole("dialog", { name: /Approve Plugin Capabilities/ })).toBeVisible();
|
|
});
|
|
|
|
test("displays plugin icons when browsing a marketplace in Install Agent Plugin", async ({ workbench: page }) => {
|
|
const catalog: AgentPluginCatalog = {
|
|
plugins: [],
|
|
marketplaces: [
|
|
{
|
|
id: "anthropics/claude-plugins-official",
|
|
name: "claude-plugins-official",
|
|
source: "anthropics/claude-plugins-official",
|
|
scope: "user",
|
|
discovered: false,
|
|
},
|
|
],
|
|
projectedSkills: 0,
|
|
projectedMcpServers: 0,
|
|
projectedRules: 0,
|
|
};
|
|
const browseResult: AgentMarketplaceBrowseResult = {
|
|
source: "anthropics/claude-plugins-official",
|
|
marketplaceName: "claude-plugins-official",
|
|
owner: "anthropics",
|
|
repo: "claude-plugins-official",
|
|
gitRef: "main",
|
|
treeSha: "1111111111111111111111111111111111111111",
|
|
candidates: [
|
|
{
|
|
name: "42crunch-api-security-testing",
|
|
displayName: "42crunch-api-security-testing",
|
|
version: "1.5.5",
|
|
description: "Automate API security directly in Claude Code with 42Crunch.",
|
|
marketplace: "claude-plugins-official",
|
|
iconUrl: svgDataIcon("#1B73E8", "42"),
|
|
iconDarkUrl: null,
|
|
sourceSpec: "42Crunch-AI/claude-plugins#v1.5.5",
|
|
subpath: "plugins/api-security-testing",
|
|
alreadyInstalledUser: false,
|
|
alreadyInstalledWorkspace: false,
|
|
},
|
|
{
|
|
name: "adobe-for-creativity",
|
|
displayName: "adobe-for-creativity",
|
|
version: "3.4.0",
|
|
description: "Harness Adobe's creative AI-powered tools to edit images and automate design workflows.",
|
|
marketplace: "claude-plugins-official",
|
|
iconUrl: svgDataIcon("#FA0F00", "Ad"),
|
|
iconDarkUrl: null,
|
|
sourceSpec: "adobe/skills#main",
|
|
subpath: "plugins/creative-cloud/adobe-for-creativity",
|
|
alreadyInstalledUser: false,
|
|
alreadyInstalledWorkspace: false,
|
|
},
|
|
{
|
|
name: "local-fallback",
|
|
displayName: "local-fallback",
|
|
version: "1.0.0",
|
|
description: "Local plugin without a custom icon shows the monochrome fallback glyph.",
|
|
marketplace: "claude-plugins-official",
|
|
iconUrl: null,
|
|
iconDarkUrl: null,
|
|
sourceSpec: "/tmp/local-fallback",
|
|
subpath: "",
|
|
alreadyInstalledUser: false,
|
|
alreadyInstalledWorkspace: false,
|
|
},
|
|
],
|
|
};
|
|
|
|
await page.setViewportSize({ width: 1120, height: 760 });
|
|
await stubDesktop(page);
|
|
await page.evaluate(
|
|
async ({ catalog, browseResult }) => {
|
|
window.__ipc.handlers.agent_plugins_list = () => structuredClone(catalog);
|
|
window.__ipc.handlers.agent_plugins_browse_marketplace = () => structuredClone(browseResult);
|
|
window.__ipc.handlers.window_open_settings = () => {
|
|
throw { kind: "unavailable", message: "separate settings window disabled in browser test", detail: null };
|
|
};
|
|
const actionsModule = "/src/platform/actions.ts";
|
|
const { executeAction } = await import(/* @vite-ignore */ actionsModule);
|
|
await executeAction("file.settings", "agents.plugins");
|
|
},
|
|
{ catalog, browseResult },
|
|
);
|
|
|
|
const settingsDialog = page.getByRole("dialog", { name: "Settings", exact: true });
|
|
await expect(settingsDialog).toBeVisible();
|
|
await settingsDialog.getByRole("tab", { name: "Marketplace" }).click();
|
|
|
|
const marketList = settingsDialog.getByRole("list");
|
|
await expect(marketList.getByText("42crunch-api-security-testing")).toBeVisible();
|
|
await expect(marketList.getByText("adobe-for-creativity")).toBeVisible();
|
|
await expect(marketList.getByText("local-fallback")).toBeVisible();
|
|
await expect(marketList.locator("img")).toHaveCount(2);
|
|
|
|
if (process.env.SETTINGS_EVIDENCE) {
|
|
await settingsDialog.screenshot({
|
|
path: `${process.env.SETTINGS_EVIDENCE}/plugin-browse-icons-light.png`,
|
|
animations: "disabled",
|
|
});
|
|
await page.evaluate(async () => {
|
|
const themePath = "/src/workbench/theme.ts";
|
|
const { setTheme } = await import(/* @vite-ignore */ themePath);
|
|
await setTheme("dark");
|
|
});
|
|
await settingsDialog.screenshot({
|
|
path: `${process.env.SETTINGS_EVIDENCE}/plugin-browse-icons-dark.png`,
|
|
animations: "disabled",
|
|
});
|
|
}
|
|
});
|