@koinzhang/paseo-plugin-customize 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/LICENSE +21 -0
- package/README.md +58 -0
- package/client/category-visibility.test.ts +26 -0
- package/client/design-tokens.test.ts +39 -0
- package/client/design-tokens.ts +104 -0
- package/client/dropdown.tsx +139 -0
- package/client/entries.test.ts +50 -0
- package/client/entries.ts +47 -0
- package/client/entry-row.tsx +89 -0
- package/client/mechanism-card.tsx +75 -0
- package/client/preview-pane.tsx +101 -0
- package/client/provider-options.test.ts +31 -0
- package/client/provider-options.ts +37 -0
- package/client/query-policy.test.ts +57 -0
- package/client/query-policy.ts +20 -0
- package/client/route.ts +29 -0
- package/client/selection-settings.test.ts +16 -0
- package/client/slash-command.test.ts +94 -0
- package/client/slash-command.ts +36 -0
- package/client/surface.tsx +332 -0
- package/client/ui.tsx +265 -0
- package/client/use-app-language.ts +28 -0
- package/client/web.ts +111 -0
- package/index.client.tsx +57 -0
- package/index.server.ts +13 -0
- package/package.json +37 -0
- package/paseo-plugin.json +6 -0
- package/server/agent-plugins.ts +41 -0
- package/server/compatibility.test.ts +104 -0
- package/server/compatibility.ts +46 -0
- package/server/frontmatter.ts +49 -0
- package/server/glob.ts +46 -0
- package/server/handlers.ts +193 -0
- package/server/jsonc.ts +40 -0
- package/server/mcp.ts +87 -0
- package/server/parsers.test.ts +92 -0
- package/server/providers/acp.ts +186 -0
- package/server/providers/claude.ts +284 -0
- package/server/providers/codex.ts +219 -0
- package/server/providers/copilot.ts +116 -0
- package/server/providers/cursor.ts +194 -0
- package/server/providers/omp.ts +263 -0
- package/server/providers/opencode.ts +215 -0
- package/server/providers/pi.ts +102 -0
- package/server/providers.test.ts +306 -0
- package/server/scan-kit.ts +368 -0
- package/server/scan-snapshot.test.ts +56 -0
- package/server/scan-snapshot.ts +58 -0
- package/server/skill-aliases.ts +60 -0
- package/server/toml.ts +240 -0
- package/server/yaml-lite.ts +172 -0
- package/shared/acp-configs.ts +107 -0
- package/shared/category-visibility.ts +26 -0
- package/shared/compatibility.ts +6 -0
- package/shared/contracts.ts +116 -0
- package/shared/i18n.ts +293 -0
- package/shared/mechanisms.ts +380 -0
- package/shared/providers.ts +27 -0
- package/shared/selection-settings.ts +14 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import {
|
|
3
|
+
EntrySink,
|
|
4
|
+
findSkills,
|
|
5
|
+
isFile,
|
|
6
|
+
isRecord,
|
|
7
|
+
parentDirs,
|
|
8
|
+
readJson,
|
|
9
|
+
readMarkdown,
|
|
10
|
+
skillEntry,
|
|
11
|
+
skillInvocation,
|
|
12
|
+
type ScanContext,
|
|
13
|
+
} from "../scan-kit.ts";
|
|
14
|
+
import type { Entry, Scope } from "../../shared/contracts.ts";
|
|
15
|
+
|
|
16
|
+
/** Per-directory context file order; `AGENTS.override.md` replaces the rest in the same directory. */
|
|
17
|
+
const CONTEXT_FILES = ["AGENTS.override.md", "AGENTS.md", "AGENTS.MD", "CLAUDE.md", "CLAUDE.MD"] as const;
|
|
18
|
+
|
|
19
|
+
export function scanPi(ctx: ScanContext): Entry[] {
|
|
20
|
+
const sink = new EntrySink(ctx);
|
|
21
|
+
const agentDir = ctx.env.PI_CODING_AGENT_DIR?.trim() || path.join(ctx.home, ".pi", "agent");
|
|
22
|
+
|
|
23
|
+
// Instructions ------------------------------------------------------------
|
|
24
|
+
const contextDir = (dir: string, scope: Scope, tags: Entry["tags"] = []) => {
|
|
25
|
+
// Case-insensitive filesystems report both spellings; keep one per real file.
|
|
26
|
+
const found: string[] = [];
|
|
27
|
+
for (const name of CONTEXT_FILES) {
|
|
28
|
+
const file = path.join(dir, name);
|
|
29
|
+
if (isFile(file) && !found.some((existing) => existing.toLowerCase() === file.toLowerCase())) found.push(file);
|
|
30
|
+
}
|
|
31
|
+
found.forEach((file, index) => {
|
|
32
|
+
const doc = readMarkdown(file);
|
|
33
|
+
sink.add({
|
|
34
|
+
category: "instructions",
|
|
35
|
+
scope,
|
|
36
|
+
name: path.basename(file),
|
|
37
|
+
path: file,
|
|
38
|
+
...(doc?.description ? { description: doc.description } : {}),
|
|
39
|
+
status: index === 0 ? "auto" : "inactive",
|
|
40
|
+
...(index > 0 ? { reason: { code: "shadowedBy" as const, value: path.basename(found[0]!) } } : {}),
|
|
41
|
+
tags,
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
const systemFiles = (dir: string, scope: Scope) => {
|
|
46
|
+
for (const [name, tag] of [["SYSTEM.md", "systemPrompt"], ["APPEND_SYSTEM.md", "appendPrompt"]] as const) {
|
|
47
|
+
const file = path.join(dir, name);
|
|
48
|
+
if (!isFile(file)) continue;
|
|
49
|
+
const doc = readMarkdown(file);
|
|
50
|
+
sink.add({
|
|
51
|
+
category: "instructions",
|
|
52
|
+
scope,
|
|
53
|
+
name,
|
|
54
|
+
path: file,
|
|
55
|
+
...(doc?.description ? { description: doc.description } : {}),
|
|
56
|
+
status: "auto",
|
|
57
|
+
tags: [tag, ...(scope === "project" ? (["trust"] as Entry["tags"]) : [])],
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
contextDir(agentDir, "user");
|
|
62
|
+
systemFiles(agentDir, "user");
|
|
63
|
+
if (ctx.projectRoot) {
|
|
64
|
+
contextDir(ctx.projectRoot, "project");
|
|
65
|
+
for (const dir of parentDirs(ctx.projectRoot)) contextDir(dir, "project", ["parent"]);
|
|
66
|
+
systemFiles(path.join(ctx.projectRoot, ".pi"), "project");
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Skills ------------------------------------------------------------------
|
|
70
|
+
const skills = (root: string, scope: Scope, loose: boolean, tags: Entry["tags"] = []) => {
|
|
71
|
+
for (const skill of findSkills(root, { recursive: true, maxDepth: 8, looseMarkdown: loose })) {
|
|
72
|
+
const base = skillEntry(skill, root, scope);
|
|
73
|
+
const invocation = skillInvocation(skill.doc);
|
|
74
|
+
sink.add({
|
|
75
|
+
...base,
|
|
76
|
+
tags: [...(base.tags ?? []), ...invocation.tags, ...tags],
|
|
77
|
+
status: invocation.status,
|
|
78
|
+
...(invocation.reason ? { reason: invocation.reason } : {}),
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
skills(path.join(agentDir, "skills"), "user", true);
|
|
83
|
+
skills(path.join(ctx.home, ".agents", "skills"), "user", false);
|
|
84
|
+
const settingsSkills = (file: string, base: string, scope: Scope) => {
|
|
85
|
+
const settings = readJson(file);
|
|
86
|
+
const list = isRecord(settings) && Array.isArray(settings.skills) ? settings.skills : [];
|
|
87
|
+
for (const item of list) {
|
|
88
|
+
if (typeof item !== "string" || item.startsWith("!") || item.startsWith("-")) continue;
|
|
89
|
+
const raw = item.replace(/^\+/, "");
|
|
90
|
+
const resolved = raw.startsWith("~/") ? path.join(ctx.home, raw.slice(2)) : path.resolve(base, raw);
|
|
91
|
+
skills(resolved, scope, true);
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
settingsSkills(path.join(agentDir, "settings.json"), agentDir, "user");
|
|
95
|
+
if (ctx.projectRoot) {
|
|
96
|
+
skills(path.join(ctx.projectRoot, ".pi", "skills"), "project", true, ["trust"]);
|
|
97
|
+
skills(path.join(ctx.projectRoot, ".agents", "skills"), "project", false);
|
|
98
|
+
settingsSkills(path.join(ctx.projectRoot, ".pi", "settings.json"), path.join(ctx.projectRoot, ".pi"), "project");
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return sink.entries;
|
|
102
|
+
}
|
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { mkdirSync, mkdtempSync, realpathSync, rmSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { after, test } from "node:test";
|
|
6
|
+
import type { Entry } from "../shared/contracts.ts";
|
|
7
|
+
import type { ProviderId } from "../shared/providers.ts";
|
|
8
|
+
import { PROVIDER_IDS } from "../shared/providers.ts";
|
|
9
|
+
import { mcpPreview, scanProvider } from "./handlers.ts";
|
|
10
|
+
|
|
11
|
+
const base = realpathSync(mkdtempSync(path.join(tmpdir(), "customize-test-")));
|
|
12
|
+
after(() => rmSync(base, { recursive: true, force: true }));
|
|
13
|
+
|
|
14
|
+
function fixture(name: string, files: Record<string, string>): { home: string; project: string } {
|
|
15
|
+
const root = path.join(base, name);
|
|
16
|
+
for (const [rel, content] of Object.entries(files)) {
|
|
17
|
+
const file = path.join(root, rel);
|
|
18
|
+
mkdirSync(path.dirname(file), { recursive: true });
|
|
19
|
+
writeFileSync(file, content);
|
|
20
|
+
}
|
|
21
|
+
const home = path.join(root, "home");
|
|
22
|
+
const project = path.join(root, "project");
|
|
23
|
+
mkdirSync(home, { recursive: true });
|
|
24
|
+
mkdirSync(project, { recursive: true });
|
|
25
|
+
return { home, project };
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function scan(provider: ProviderId, fx: { home: string; project: string }, env: Record<string, string> = {}): Entry[] {
|
|
29
|
+
return scanProvider(provider, fx.project, { home: fx.home, env, platform: "linux" });
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function find(entries: Entry[], category: Entry["category"], name: string): Entry {
|
|
33
|
+
const hit = entries.find((entry) => entry.category === category && entry.name === name);
|
|
34
|
+
assert.ok(hit, `${category} ${name} missing; got ${entries.filter((e) => e.category === category).map((e) => e.name).join(", ")}`);
|
|
35
|
+
return hit;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const skill = (name: string, extra = "") => `---\nname: ${name}\ndescription: ${name} skill\n${extra}---\nBody\n`;
|
|
39
|
+
const agentPlugin = (name: string, extra: Record<string, unknown> = {}) => JSON.stringify({
|
|
40
|
+
$schema: "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json", name, ...extra,
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
test("claude: CLAUDE.md shadows AGENTS.md, rules paths, one-level skills, .mcp.json approval", () => {
|
|
44
|
+
const fx = fixture("claude", {
|
|
45
|
+
"project/CLAUDE.md": "# Project\n",
|
|
46
|
+
"project/AGENTS.md": "# Agents\n",
|
|
47
|
+
"project/.claude/rules/api/ts.md": "---\npaths:\n - src/**\n---\nRule\n",
|
|
48
|
+
"project/.claude/rules/always.md": "Always\n",
|
|
49
|
+
"project/.claude/skills/deploy/SKILL.md": skill("deploy", "disable-model-invocation: true\n"),
|
|
50
|
+
"project/.claude/skills/group/inner/SKILL.md": skill("inner"),
|
|
51
|
+
"project/.mcp.json": JSON.stringify({ mcpServers: { local: { command: "x" }, ok: { command: "y" } } }),
|
|
52
|
+
"project/.claude/settings.json": JSON.stringify({ enabledMcpjsonServers: ["ok"] }),
|
|
53
|
+
"home/.claude/skills/review/SKILL.md": skill("review"),
|
|
54
|
+
});
|
|
55
|
+
const entries = scan("claude", fx);
|
|
56
|
+
assert.equal(find(entries, "instructions", "CLAUDE.md").status, "auto");
|
|
57
|
+
assert.equal(find(entries, "instructions", "AGENTS.md").status, "inactive");
|
|
58
|
+
assert.equal(find(entries, "rules", path.join("api", "ts.md")).status, "conditional");
|
|
59
|
+
assert.equal(find(entries, "rules", "always.md").status, "auto");
|
|
60
|
+
assert.equal(find(entries, "skills", "deploy").status, "manual");
|
|
61
|
+
assert.equal(find(entries, "skills", "review").scope, "user");
|
|
62
|
+
assert.ok(!entries.some((entry) => entry.name === "inner"), "claude skills are not recursive");
|
|
63
|
+
assert.equal(find(entries, "mcp", "local").status, "pending");
|
|
64
|
+
assert.equal(find(entries, "mcp", "ok").status, "auto");
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
test("codex: override wins, recursive .agents skills, openai.yaml manual, trust gate, enabled=false", () => {
|
|
68
|
+
const fx = fixture("codex", {
|
|
69
|
+
"project/AGENTS.md": "# Agents\n",
|
|
70
|
+
"project/AGENTS.override.md": "# Override\n",
|
|
71
|
+
"project/.agents/skills/team/lint/SKILL.md": skill("lint"),
|
|
72
|
+
"project/.agents/skills/quiet/SKILL.md": skill("quiet"),
|
|
73
|
+
"project/.agents/skills/quiet/agents/openai.yaml": "policy:\n allow_implicit_invocation: false\n",
|
|
74
|
+
"project/.codex/config.toml": '[mcp_servers.proj]\ncommand = "p"\n',
|
|
75
|
+
"home/.codex/config.toml": '[mcp_servers.off]\ncommand = "x"\nenabled = false\n',
|
|
76
|
+
});
|
|
77
|
+
const entries = scan("codex", fx);
|
|
78
|
+
assert.equal(find(entries, "instructions", "AGENTS.override.md").status, "auto");
|
|
79
|
+
assert.equal(find(entries, "instructions", "AGENTS.md").status, "inactive");
|
|
80
|
+
assert.equal(find(entries, "skills", "lint").status, "auto");
|
|
81
|
+
assert.equal(find(entries, "skills", "quiet").status, "manual");
|
|
82
|
+
assert.equal(find(entries, "mcp", "off").status, "disabled");
|
|
83
|
+
assert.equal(find(entries, "mcp", "proj").status, "inactive");
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
test("codex: trusted project activates project config", () => {
|
|
87
|
+
const fx = fixture("codex-trusted", {
|
|
88
|
+
"project/.codex/config.toml": '[mcp_servers.proj]\ncommand = "p"\n',
|
|
89
|
+
});
|
|
90
|
+
mkdirSync(path.join(fx.home, ".codex"), { recursive: true });
|
|
91
|
+
writeFileSync(path.join(fx.home, ".codex", "config.toml"), `[projects."${fx.project}"]\ntrust_level = "trusted"\n`);
|
|
92
|
+
assert.equal(find(scan("codex", fx), "mcp", "proj").status, "auto");
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
test("cursor: mdc rule states, .md ignored, recursive multi-root skills, mcp-disabled.json", () => {
|
|
96
|
+
const fx = fixture("cursor", {
|
|
97
|
+
"project/.cursor/rules/always.mdc": "---\nalwaysApply: true\n---\nx\n",
|
|
98
|
+
"project/.cursor/rules/ts.mdc": "---\nglobs: src/**/*.ts\n---\nx\n",
|
|
99
|
+
"project/.cursor/rules/agent.mdc": "---\ndescription: pick me\n---\nx\n",
|
|
100
|
+
"project/.cursor/rules/manual.mdc": "x\n",
|
|
101
|
+
"project/.cursor/rules/notes.md": "ignored\n",
|
|
102
|
+
"project/.claude/skills/a/b/SKILL.md": skill("deep"),
|
|
103
|
+
"project/.cursor/mcp.json": JSON.stringify({ mcpServers: { on: { command: "a" }, off: { command: "b" } } }),
|
|
104
|
+
});
|
|
105
|
+
const slug = fx.project.replace(/[^a-zA-Z0-9]/g, "-").replace(/-+/g, "-").replace(/^-+|-+$/g, "");
|
|
106
|
+
mkdirSync(path.join(fx.home, ".cursor", "projects", slug), { recursive: true });
|
|
107
|
+
writeFileSync(path.join(fx.home, ".cursor", "projects", slug, "mcp-disabled.json"), JSON.stringify(["off"]));
|
|
108
|
+
const entries = scan("cursor", fx);
|
|
109
|
+
const rule = (name: string) => entries.find((entry) => entry.category === "rules" && entry.name.startsWith(name));
|
|
110
|
+
assert.equal(rule("always")?.status, "auto");
|
|
111
|
+
assert.equal(rule("ts")?.status, "conditional");
|
|
112
|
+
assert.equal(rule("agent")?.reason?.code, "agentDecides");
|
|
113
|
+
assert.equal(rule("manual")?.status, "manual");
|
|
114
|
+
assert.notEqual(rule("notes")?.status, "auto");
|
|
115
|
+
assert.equal(find(entries, "skills", "deep").status, "auto");
|
|
116
|
+
assert.equal(find(entries, "mcp", "on").status, "auto");
|
|
117
|
+
assert.equal(find(entries, "mcp", "off").status, "disabled");
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
test("opencode: discovered skills stay automatic despite foreign manual-only frontmatter", () => {
|
|
121
|
+
const fx = fixture("opencode", {
|
|
122
|
+
"project/AGENTS.md": "# Agents\n",
|
|
123
|
+
"project/CLAUDE.md": "# Claude\n",
|
|
124
|
+
"project/.opencode/skills/secret/SKILL.md": skill("secret"),
|
|
125
|
+
"project/.claude/skills/manual-elsewhere/SKILL.md": skill("manual-elsewhere", "disable-model-invocation: true\n"),
|
|
126
|
+
"project/opencode.json": JSON.stringify({ permission: { skill: { secret: "deny" } }, mcp: { m: { type: "local", command: ["x"], enabled: false } } }),
|
|
127
|
+
});
|
|
128
|
+
const entries = scan("opencode", fx);
|
|
129
|
+
assert.equal(find(entries, "instructions", "AGENTS.md").status, "auto");
|
|
130
|
+
assert.equal(find(entries, "instructions", "CLAUDE.md").status, "inactive");
|
|
131
|
+
assert.equal(find(entries, "skills", "secret").status, "disabled");
|
|
132
|
+
assert.equal(find(entries, "skills", "manual-elsewhere").status, "auto");
|
|
133
|
+
assert.equal(find(entries, "mcp", "m").status, "disabled");
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
test("pi: recursive skills, no rules / mcp", () => {
|
|
137
|
+
const fx = fixture("pi", {
|
|
138
|
+
"project/AGENTS.md": "# Agents\n",
|
|
139
|
+
"project/.pi/skills/group/tool/SKILL.md": skill("tool"),
|
|
140
|
+
});
|
|
141
|
+
const entries = scan("pi", fx);
|
|
142
|
+
assert.equal(find(entries, "instructions", "AGENTS.md").status, "auto");
|
|
143
|
+
assert.equal(find(entries, "skills", "tool").status, "auto");
|
|
144
|
+
assert.ok(!entries.some((entry) => entry.category === "rules" || entry.category === "mcp"));
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
test("omp: claude user skills off by default", () => {
|
|
148
|
+
const fx = fixture("omp", {
|
|
149
|
+
"home/.claude/skills/review/SKILL.md": skill("review"),
|
|
150
|
+
});
|
|
151
|
+
const review = find(scan("omp", fx), "skills", "review");
|
|
152
|
+
assert.equal(review.status, "inactive");
|
|
153
|
+
assert.equal(review.reason?.code, "offByDefault");
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
test("every provider scans an empty home without throwing", () => {
|
|
157
|
+
const fx = fixture("empty", {});
|
|
158
|
+
for (const provider of PROVIDER_IDS) {
|
|
159
|
+
assert.ok(Array.isArray(scan(provider, fx)), provider);
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
test("Cursor discovers commands, subagents and plugin manifest", () => {
|
|
164
|
+
const fx = fixture("cursor-extra", {
|
|
165
|
+
"project/.cursor/commands/review.md": "Review this code\n",
|
|
166
|
+
"project/.cursor/agents/explore.md": "---\ndescription: Explore\n---\nExplore\n",
|
|
167
|
+
"project/agents/plugin-agent.md": "Plugin agent\n",
|
|
168
|
+
"project/.cursor-plugin/plugin.json": "{}",
|
|
169
|
+
"home/.cursor/commands/global.md": "Global command\n",
|
|
170
|
+
"home/.claude/agents/compat.md": "Compatibility agent\n",
|
|
171
|
+
});
|
|
172
|
+
const entries = scan("cursor", fx);
|
|
173
|
+
find(entries, "commands", "review.md");
|
|
174
|
+
find(entries, "subagents", "explore.md");
|
|
175
|
+
find(entries, "subagents", "plugin-agent.md");
|
|
176
|
+
find(entries, "subagents", "compat.md");
|
|
177
|
+
find(entries, "commands", "global.md");
|
|
178
|
+
assert.equal(find(entries, "plugins", "project").status, "conditional");
|
|
179
|
+
assert.equal(find(entries, "plugins", "project").agentPlugin, undefined);
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
test("Cursor discovers portable and native local test plugins", () => {
|
|
183
|
+
const fx = fixture("cursor-local-plugins", {
|
|
184
|
+
"home/.cursor/plugins/local/portable/plugin.json": agentPlugin("portable"),
|
|
185
|
+
"home/.cursor/plugins/local/native/.cursor-plugin/plugin.json": JSON.stringify({ name: "native" }),
|
|
186
|
+
"home/.cursor/plugins/local/invalid/plugin.json": agentPlugin("Invalid"),
|
|
187
|
+
});
|
|
188
|
+
const entries = scan("cursor", fx);
|
|
189
|
+
assert.deepEqual(find(entries, "plugins", "portable").agentPlugin, { version: "1.0.0", validation: "valid" });
|
|
190
|
+
assert.equal(find(entries, "plugins", "portable").scope, "user");
|
|
191
|
+
assert.equal(find(entries, "plugins", "native").agentPlugin, undefined);
|
|
192
|
+
assert.equal(find(entries, "plugins", "invalid").agentPlugin, undefined);
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
test("Agent Plugins badge requires a valid portable root manifest", () => {
|
|
196
|
+
const codex = fixture("codex-agent-plugins", {
|
|
197
|
+
"project/plugin.json": agentPlugin("project-plugin"),
|
|
198
|
+
"home/.codex/plugins/portable/plugin.json": agentPlugin("portable", { version: "5.2.0", description: "Shared plugin", unknownField: true }),
|
|
199
|
+
"home/.codex/plugins/tolerated/plugin.json": agentPlugin("tolerated", { extensions: "ignored by the spec" }),
|
|
200
|
+
"home/.codex/plugins/cache/market/cached/1.2.0/plugin.json": agentPlugin("cached"),
|
|
201
|
+
"home/.codex/plugins/invalid/plugin.json": agentPlugin("Bad--Name"),
|
|
202
|
+
"home/.codex/plugins/legacy/.codex-plugin/plugin.json": JSON.stringify({ name: "legacy" }),
|
|
203
|
+
"home/.codex/plugins/old/plugin.json": JSON.stringify({ $schema: "https://agent-plugins.org/schemas/0.9.0/plugin.schema.json", name: "old" }),
|
|
204
|
+
"home/.codex/plugins/future/plugin.json": JSON.stringify({ $schema: "https://agent-plugins.org/schemas/2.0.0/plugin.schema.json", name: "future" }),
|
|
205
|
+
"home/.codex/plugins/other/plugin.json": JSON.stringify({ $schema: "https://example.com/schemas/2.0.0/plugin.schema.json", name: "other" }),
|
|
206
|
+
"home/.codex/plugins/bad-meta/plugin.json": agentPlugin("bad-meta", { keywords: [1] }),
|
|
207
|
+
});
|
|
208
|
+
const codexEntries = scan("codex", codex);
|
|
209
|
+
for (const name of ["project", "portable", "tolerated", "cached"]) {
|
|
210
|
+
assert.deepEqual(find(codexEntries, "plugins", name).agentPlugin, { version: "1.0.0", validation: "valid" }, name);
|
|
211
|
+
}
|
|
212
|
+
assert.deepEqual(find(codexEntries, "plugins", "future").agentPlugin, { version: "2.0.0", validation: "unsupported" });
|
|
213
|
+
assert.deepEqual(find(codexEntries, "plugins", "old").agentPlugin, { version: "0.9.0", validation: "unsupported" });
|
|
214
|
+
for (const name of ["invalid", "legacy", "bad-meta", "other"]) {
|
|
215
|
+
assert.equal(find(codexEntries, "plugins", name).agentPlugin, undefined, name);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
const cursor = fixture("cursor-agent-plugins", {
|
|
219
|
+
"project/plugin.json": agentPlugin("cursor-portable"),
|
|
220
|
+
"project/.cursor-plugin/plugin.json": JSON.stringify({ name: "cursor-native" }),
|
|
221
|
+
});
|
|
222
|
+
const cursorEntry = find(scan("cursor", cursor), "plugins", "project");
|
|
223
|
+
assert.equal(cursorEntry.path, path.join(cursor.project, "plugin.json"));
|
|
224
|
+
assert.deepEqual(cursorEntry.agentPlugin, { version: "1.0.0", validation: "valid" });
|
|
225
|
+
|
|
226
|
+
const gemini = fixture("gemini-agent-plugins", {
|
|
227
|
+
"project/plugin.json": JSON.stringify({ $schema: "https://agent-plugins.org/schemas/2.0.0/plugin.schema.json", name: "future-gemini" }),
|
|
228
|
+
"home/.gemini/extensions/portable/plugin.json": agentPlugin("gemini-portable"),
|
|
229
|
+
"home/.gemini/extensions/native/gemini-extension.json": JSON.stringify({ name: "gemini-native" }),
|
|
230
|
+
});
|
|
231
|
+
const geminiEntries = scan("gemini", gemini);
|
|
232
|
+
assert.deepEqual(find(geminiEntries, "plugins", "project").agentPlugin, { version: "2.0.0", validation: "unsupported" });
|
|
233
|
+
assert.deepEqual(find(geminiEntries, "plugins", "portable").agentPlugin, { version: "1.0.0", validation: "valid" });
|
|
234
|
+
assert.equal(find(geminiEntries, "plugins", "native").agentPlugin, undefined);
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
test("ACP providers discover official project configuration paths", () => {
|
|
238
|
+
const cases: Array<[ProviderId, string, Entry["category"], string]> = [
|
|
239
|
+
["cline", ".cline/agents.yaml", "subagents", "agents.yaml"],
|
|
240
|
+
["codebuddy-code", ".codebuddy/commands/team/review.md", "commands", "team/review.md"],
|
|
241
|
+
["gemini", ".gemini/commands/review.toml", "commands", "review.toml"],
|
|
242
|
+
["goose", ".agents/agents/reviewer.md", "subagents", "reviewer.md"],
|
|
243
|
+
["grok", ".grok/config.toml", "mcp", "local"],
|
|
244
|
+
["kilo", ".kilo/agents/reviewer.md", "subagents", "reviewer.md"],
|
|
245
|
+
["kiro", ".kiro/steering/style.md", "rules", "style.md"],
|
|
246
|
+
["kimi", ".kimi-code/agents/reviewer.md", "subagents", "reviewer.md"],
|
|
247
|
+
["qwen-code", ".qwen/agents/reviewer.md", "subagents", "reviewer.md"],
|
|
248
|
+
["traecli", ".traecli/agents/reviewer.md", "subagents", "reviewer.md"],
|
|
249
|
+
];
|
|
250
|
+
for (const [provider, file, category, name] of cases) {
|
|
251
|
+
const content = provider === "grok" ? '[mcp_servers.local]\ncommand = "server"\n' : "# Config\n";
|
|
252
|
+
const fx = fixture(`acp-${provider}`, { [`project/${file}`]: content });
|
|
253
|
+
find(scan(provider, fx), category, name);
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
test("Gemini AGENTS.md needs context.fileName; Trae YAML MCP preview redacts secrets", () => {
|
|
258
|
+
const gemini = fixture("gemini-agents", {
|
|
259
|
+
"project/AGENTS.md": "# Rules\n",
|
|
260
|
+
"project/.gemini/settings.json": JSON.stringify({ context: { fileName: ["AGENTS.md", "GEMINI.md"] } }),
|
|
261
|
+
});
|
|
262
|
+
find(scan("gemini", gemini), "instructions", "AGENTS.md");
|
|
263
|
+
const trae = fixture("trae-yaml", {
|
|
264
|
+
"home/.config/trae_cli/trae_cli.yaml": 'mcp_servers:\n - name: secret-server\n type: stdio\n command: npx\n env:\n API_KEY: sensitive\n',
|
|
265
|
+
});
|
|
266
|
+
const entry = find(scan("traecli", trae), "mcp", "secret-server");
|
|
267
|
+
const preview = mcpPreview(entry.path, "secret-server");
|
|
268
|
+
assert.ok(preview?.includes("••••••"));
|
|
269
|
+
assert.ok(!preview?.includes("sensitive"));
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
test("Goose extensions and commands come from YAML; Kimi plugin commands are manifest declared", () => {
|
|
273
|
+
const goose = fixture("goose-config", {
|
|
274
|
+
"home/.config/goose/config.yaml": 'extensions:\n github:\n type: stdio\n cmd: npx\n enabled: false\n envs:\n API_KEY: sensitive\nslash_commands:\n - command: review\n recipe_path: /tmp/review.yaml\n',
|
|
275
|
+
});
|
|
276
|
+
const gooseEntries = scan("goose", goose);
|
|
277
|
+
assert.equal(find(gooseEntries, "mcp", "github").status, "disabled");
|
|
278
|
+
find(gooseEntries, "commands", "review");
|
|
279
|
+
assert.equal(find(gooseEntries, "plugins", "github").status, "disabled");
|
|
280
|
+
const preview = mcpPreview(find(gooseEntries, "mcp", "github").path, "github");
|
|
281
|
+
assert.ok(preview?.includes("••••••"));
|
|
282
|
+
assert.ok(!preview?.includes("sensitive"));
|
|
283
|
+
|
|
284
|
+
const kimi = fixture("kimi-plugin", {
|
|
285
|
+
"home/.kimi-code/plugins/managed/report/kimi.plugin.json": JSON.stringify({ name: "report", commands: "./commands/" }),
|
|
286
|
+
"home/.kimi-code/plugins/managed/report/commands/generate.md": "Generate a report\n",
|
|
287
|
+
"home/.kimi-code/plugins/managed/report/README.md": "This is not a command\n",
|
|
288
|
+
});
|
|
289
|
+
const commands = scan("kimi", kimi).filter((entry) => entry.category === "commands");
|
|
290
|
+
assert.deepEqual(commands.map((entry) => entry.name), ["report:generate"]);
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
test("CodeBuddy marketplace cache, Kilo MCP and Qwen TOML commands", () => {
|
|
294
|
+
const codebuddy = fixture("codebuddy-cache", {
|
|
295
|
+
"home/.codebuddy/plugins/cache/market/reviewer/1.0.0/.codebuddy-plugin/plugin.json": '{"name":"reviewer"}',
|
|
296
|
+
});
|
|
297
|
+
find(scan("codebuddy-code", codebuddy), "plugins", "reviewer");
|
|
298
|
+
const kilo = fixture("kilo-mcp", {
|
|
299
|
+
"project/kilo.jsonc": '{"mcp":{"docs":{"command":"npx"}}}',
|
|
300
|
+
});
|
|
301
|
+
find(scan("kilo", kilo), "mcp", "docs");
|
|
302
|
+
const qwen = fixture("qwen-command", {
|
|
303
|
+
"project/.qwen/commands/review.toml": 'prompt = "Review"\n',
|
|
304
|
+
});
|
|
305
|
+
find(scan("qwen-code", qwen), "commands", "review.toml");
|
|
306
|
+
});
|