@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.
Files changed (60) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/LICENSE +21 -0
  3. package/README.md +58 -0
  4. package/client/category-visibility.test.ts +26 -0
  5. package/client/design-tokens.test.ts +39 -0
  6. package/client/design-tokens.ts +104 -0
  7. package/client/dropdown.tsx +139 -0
  8. package/client/entries.test.ts +50 -0
  9. package/client/entries.ts +47 -0
  10. package/client/entry-row.tsx +89 -0
  11. package/client/mechanism-card.tsx +75 -0
  12. package/client/preview-pane.tsx +101 -0
  13. package/client/provider-options.test.ts +31 -0
  14. package/client/provider-options.ts +37 -0
  15. package/client/query-policy.test.ts +57 -0
  16. package/client/query-policy.ts +20 -0
  17. package/client/route.ts +29 -0
  18. package/client/selection-settings.test.ts +16 -0
  19. package/client/slash-command.test.ts +94 -0
  20. package/client/slash-command.ts +36 -0
  21. package/client/surface.tsx +332 -0
  22. package/client/ui.tsx +265 -0
  23. package/client/use-app-language.ts +28 -0
  24. package/client/web.ts +111 -0
  25. package/index.client.tsx +57 -0
  26. package/index.server.ts +13 -0
  27. package/package.json +37 -0
  28. package/paseo-plugin.json +6 -0
  29. package/server/agent-plugins.ts +41 -0
  30. package/server/compatibility.test.ts +104 -0
  31. package/server/compatibility.ts +46 -0
  32. package/server/frontmatter.ts +49 -0
  33. package/server/glob.ts +46 -0
  34. package/server/handlers.ts +193 -0
  35. package/server/jsonc.ts +40 -0
  36. package/server/mcp.ts +87 -0
  37. package/server/parsers.test.ts +92 -0
  38. package/server/providers/acp.ts +186 -0
  39. package/server/providers/claude.ts +284 -0
  40. package/server/providers/codex.ts +219 -0
  41. package/server/providers/copilot.ts +116 -0
  42. package/server/providers/cursor.ts +194 -0
  43. package/server/providers/omp.ts +263 -0
  44. package/server/providers/opencode.ts +215 -0
  45. package/server/providers/pi.ts +102 -0
  46. package/server/providers.test.ts +306 -0
  47. package/server/scan-kit.ts +368 -0
  48. package/server/scan-snapshot.test.ts +56 -0
  49. package/server/scan-snapshot.ts +58 -0
  50. package/server/skill-aliases.ts +60 -0
  51. package/server/toml.ts +240 -0
  52. package/server/yaml-lite.ts +172 -0
  53. package/shared/acp-configs.ts +107 -0
  54. package/shared/category-visibility.ts +26 -0
  55. package/shared/compatibility.ts +6 -0
  56. package/shared/contracts.ts +116 -0
  57. package/shared/i18n.ts +293 -0
  58. package/shared/mechanisms.ts +380 -0
  59. package/shared/providers.ts +27 -0
  60. package/shared/selection-settings.ts +14 -0
package/server/toml.ts ADDED
@@ -0,0 +1,240 @@
1
+ /**
2
+ * TOML subset for Codex `config.toml`: tables, arrays of tables, dotted and
3
+ * quoted keys, basic / literal / multi-line strings, numbers, booleans,
4
+ * (multi-line) arrays, and inline tables. Dates are kept as strings.
5
+ */
6
+
7
+ type Table = Record<string, unknown>;
8
+
9
+ export function parseToml(source: string): Table {
10
+ const root: Table = {};
11
+ let current: Table = root;
12
+ const p = new Parser(source.replace(/\r\n?/g, "\n"));
13
+ for (;;) {
14
+ p.skipWsAndComments(true);
15
+ if (p.done()) break;
16
+ if (p.peek() === "[") {
17
+ const isArray = p.peek(1) === "[";
18
+ p.pos += isArray ? 2 : 1;
19
+ p.skipWs();
20
+ const keys = p.readKeyPath();
21
+ p.skipWs();
22
+ p.expect(isArray ? "]]" : "]");
23
+ current = isArray ? appendArrayTable(root, keys) : ensureTable(root, keys);
24
+ } else {
25
+ const keys = p.readKeyPath();
26
+ p.skipWs();
27
+ p.expect("=");
28
+ p.skipWs();
29
+ const value = p.readValue();
30
+ const parent = ensureTable(current, keys.slice(0, -1));
31
+ parent[keys[keys.length - 1]!] = value;
32
+ }
33
+ p.skipLineRest();
34
+ }
35
+ return root;
36
+ }
37
+
38
+ function ensureTable(root: Table, keys: string[]): Table {
39
+ let node = root;
40
+ for (const key of keys) {
41
+ const existing = node[key];
42
+ if (Array.isArray(existing)) {
43
+ const last = existing[existing.length - 1];
44
+ node = (typeof last === "object" && last !== null ? last : {}) as Table;
45
+ } else if (typeof existing === "object" && existing !== null) {
46
+ node = existing as Table;
47
+ } else {
48
+ const next: Table = {};
49
+ node[key] = next;
50
+ node = next;
51
+ }
52
+ }
53
+ return node;
54
+ }
55
+
56
+ function appendArrayTable(root: Table, keys: string[]): Table {
57
+ const parent = ensureTable(root, keys.slice(0, -1));
58
+ const key = keys[keys.length - 1]!;
59
+ const list = Array.isArray(parent[key]) ? (parent[key] as unknown[]) : [];
60
+ parent[key] = list;
61
+ const table: Table = {};
62
+ list.push(table);
63
+ return table;
64
+ }
65
+
66
+ class Parser {
67
+ pos = 0;
68
+ private readonly src: string;
69
+
70
+ constructor(src: string) {
71
+ this.src = src;
72
+ }
73
+
74
+ done() {
75
+ return this.pos >= this.src.length;
76
+ }
77
+
78
+ peek(offset = 0) {
79
+ return this.src[this.pos + offset];
80
+ }
81
+
82
+ expect(token: string) {
83
+ if (!this.src.startsWith(token, this.pos)) throw new Error(`TOML: expected ${token} at ${this.pos}`);
84
+ this.pos += token.length;
85
+ }
86
+
87
+ skipWs() {
88
+ while (this.peek() === " " || this.peek() === "\t") this.pos++;
89
+ }
90
+
91
+ skipWsAndComments(newlines: boolean) {
92
+ for (;;) {
93
+ const ch = this.peek();
94
+ if (ch === " " || ch === "\t" || (newlines && ch === "\n")) this.pos++;
95
+ else if (ch === "#") while (!this.done() && this.peek() !== "\n") this.pos++;
96
+ else break;
97
+ }
98
+ }
99
+
100
+ skipLineRest() {
101
+ this.skipWsAndComments(false);
102
+ if (this.peek() === "\n") this.pos++;
103
+ else if (!this.done()) while (!this.done() && this.peek() !== "\n") this.pos++;
104
+ }
105
+
106
+ readKeyPath(): string[] {
107
+ const keys = [this.readKey()];
108
+ for (;;) {
109
+ this.skipWs();
110
+ if (this.peek() !== ".") break;
111
+ this.pos++;
112
+ this.skipWs();
113
+ keys.push(this.readKey());
114
+ }
115
+ return keys;
116
+ }
117
+
118
+ readKey(): string {
119
+ const ch = this.peek();
120
+ if (ch === '"') return this.readBasicString();
121
+ if (ch === "'") return this.readLiteralString();
122
+ const start = this.pos;
123
+ while (!this.done() && /[A-Za-z0-9_-]/.test(this.peek()!)) this.pos++;
124
+ if (start === this.pos) throw new Error(`TOML: bad key at ${this.pos}`);
125
+ return this.src.slice(start, this.pos);
126
+ }
127
+
128
+ readValue(): unknown {
129
+ const ch = this.peek();
130
+ if (this.src.startsWith('"""', this.pos)) return this.readMultiline('"""', true);
131
+ if (this.src.startsWith("'''", this.pos)) return this.readMultiline("'''", false);
132
+ if (ch === '"') return this.readBasicString();
133
+ if (ch === "'") return this.readLiteralString();
134
+ if (ch === "[") return this.readArray();
135
+ if (ch === "{") return this.readInlineTable();
136
+ const start = this.pos;
137
+ while (!this.done() && !/[,\]}\n#]/.test(this.peek()!)) this.pos++;
138
+ const raw = this.src.slice(start, this.pos).trim();
139
+ if (raw === "true") return true;
140
+ if (raw === "false") return false;
141
+ const num = Number(raw.replace(/_/g, ""));
142
+ return raw !== "" && Number.isFinite(num) ? num : raw;
143
+ }
144
+
145
+ readBasicString(): string {
146
+ this.pos++;
147
+ let out = "";
148
+ while (!this.done() && this.peek() !== '"') {
149
+ const ch = this.peek()!;
150
+ if (ch === "\\") {
151
+ out += this.readEscape();
152
+ } else {
153
+ out += ch;
154
+ this.pos++;
155
+ }
156
+ }
157
+ this.pos++;
158
+ return out;
159
+ }
160
+
161
+ readEscape(): string {
162
+ this.pos++;
163
+ const ch = this.peek()!;
164
+ this.pos++;
165
+ const map: Record<string, string> = { n: "\n", t: "\t", r: "\r", b: "\b", f: "\f", '"': '"', "\\": "\\" };
166
+ if (ch in map) return map[ch]!;
167
+ if (ch === "u" || ch === "U") {
168
+ const len = ch === "u" ? 4 : 8;
169
+ const hex = this.src.slice(this.pos, this.pos + len);
170
+ this.pos += len;
171
+ return String.fromCodePoint(parseInt(hex, 16));
172
+ }
173
+ return ch;
174
+ }
175
+
176
+ readLiteralString(): string {
177
+ this.pos++;
178
+ const end = this.src.indexOf("'", this.pos);
179
+ const out = this.src.slice(this.pos, end < 0 ? undefined : end);
180
+ this.pos = end < 0 ? this.src.length : end + 1;
181
+ return out;
182
+ }
183
+
184
+ readMultiline(delim: string, escapes: boolean): string {
185
+ this.pos += 3;
186
+ if (this.peek() === "\n") this.pos++;
187
+ let out = "";
188
+ while (!this.done() && !this.src.startsWith(delim, this.pos)) {
189
+ if (escapes && this.peek() === "\\") {
190
+ if (/^\\[ \t]*\n/.test(this.src.slice(this.pos, this.pos + 64))) {
191
+ this.pos++;
192
+ while (/[ \t\n]/.test(this.peek() ?? "")) this.pos++;
193
+ continue;
194
+ }
195
+ out += this.readEscape();
196
+ } else {
197
+ out += this.peek();
198
+ this.pos++;
199
+ }
200
+ }
201
+ this.pos += 3;
202
+ return out;
203
+ }
204
+
205
+ readArray(): unknown[] {
206
+ this.pos++;
207
+ const out: unknown[] = [];
208
+ for (;;) {
209
+ this.skipWsAndComments(true);
210
+ if (this.peek() === "]") {
211
+ this.pos++;
212
+ return out;
213
+ }
214
+ if (this.done()) return out;
215
+ out.push(this.readValue());
216
+ this.skipWsAndComments(true);
217
+ if (this.peek() === ",") this.pos++;
218
+ }
219
+ }
220
+
221
+ readInlineTable(): Table {
222
+ this.pos++;
223
+ const out: Table = {};
224
+ for (;;) {
225
+ this.skipWsAndComments(true);
226
+ if (this.peek() === "}") {
227
+ this.pos++;
228
+ return out;
229
+ }
230
+ if (this.done()) return out;
231
+ const keys = this.readKeyPath();
232
+ this.skipWs();
233
+ this.expect("=");
234
+ this.skipWs();
235
+ ensureTable(out, keys.slice(0, -1))[keys[keys.length - 1]!] = this.readValue();
236
+ this.skipWsAndComments(true);
237
+ if (this.peek() === ",") this.pos++;
238
+ }
239
+ }
240
+ }
@@ -0,0 +1,172 @@
1
+ /**
2
+ * Minimal YAML reader for frontmatter and small config files: block maps,
3
+ * block lists, inline `[a, b]` lists, quoted scalars, and `|` / `>` block
4
+ * scalars. Anchors, tags, and multi-document streams are not supported.
5
+ */
6
+
7
+ type Line = { indent: number; text: string };
8
+
9
+ export function parseYaml(source: string): Record<string, unknown> {
10
+ const lines: Line[] = [];
11
+ for (const raw of source.replace(/\r\n?/g, "\n").split("\n")) {
12
+ if (!raw.trim() || raw.trimStart().startsWith("#")) {
13
+ lines.push({ indent: -1, text: "" });
14
+ continue;
15
+ }
16
+ lines.push({ indent: raw.length - raw.trimStart().length, text: raw.trimEnd() });
17
+ }
18
+ const state = { i: 0 };
19
+ const value = parseBlock(lines, state, 0);
20
+ return isRecord(value) ? value : {};
21
+ }
22
+
23
+ function isRecord(value: unknown): value is Record<string, unknown> {
24
+ return typeof value === "object" && value !== null && !Array.isArray(value);
25
+ }
26
+
27
+ function skipBlank(lines: Line[], state: { i: number }) {
28
+ while (state.i < lines.length && lines[state.i]!.indent < 0) state.i++;
29
+ }
30
+
31
+ function parseBlock(lines: Line[], state: { i: number }, minIndent: number): unknown {
32
+ skipBlank(lines, state);
33
+ const first = lines[state.i];
34
+ if (!first || first.indent < minIndent) return null;
35
+ const indent = first.indent;
36
+ if (first.text.trimStart().startsWith("- ") || first.text.trim() === "-") {
37
+ return parseList(lines, state, indent);
38
+ }
39
+ return parseMap(lines, state, indent);
40
+ }
41
+
42
+ function parseList(lines: Line[], state: { i: number }, indent: number): unknown[] {
43
+ const out: unknown[] = [];
44
+ for (;;) {
45
+ skipBlank(lines, state);
46
+ const line = lines[state.i];
47
+ if (!line || line.indent !== indent) break;
48
+ const body = line.text.trimStart();
49
+ if (!body.startsWith("-")) break;
50
+ const rest = body.slice(1).trimStart();
51
+ state.i++;
52
+ if (!rest) {
53
+ out.push(parseBlock(lines, state, indent + 1));
54
+ } else if (/^[^'"[{][^:]*:(\s|$)/.test(rest)) {
55
+ // `- key: value` starts an inline map; continuation lines are indented past the dash.
56
+ const inner: Line[] = [{ indent: indent + 2, text: " ".repeat(indent + 2) + rest }];
57
+ while (state.i < lines.length && (lines[state.i]!.indent < 0 || lines[state.i]!.indent > indent)) {
58
+ inner.push(lines[state.i]!);
59
+ state.i++;
60
+ }
61
+ out.push(parseMap(inner, { i: 0 }, indent + 2));
62
+ } else {
63
+ out.push(parseScalar(rest));
64
+ }
65
+ }
66
+ return out;
67
+ }
68
+
69
+ function parseMap(lines: Line[], state: { i: number }, indent: number): Record<string, unknown> {
70
+ const out: Record<string, unknown> = {};
71
+ for (;;) {
72
+ skipBlank(lines, state);
73
+ const line = lines[state.i];
74
+ if (!line || line.indent !== indent) break;
75
+ const body = line.text.trimStart();
76
+ const match = /^("(?:[^"\\]|\\.)*"|'(?:[^']|'')*'|[^:#]+?)\s*:(?:\s+(.*))?$/.exec(body);
77
+ if (!match) {
78
+ state.i++;
79
+ continue;
80
+ }
81
+ const key = unquote(match[1]!.trim());
82
+ const rest = stripComment(match[2] ?? "").trim();
83
+ state.i++;
84
+ if (rest === "|" || rest === ">" || /^[|>][+-]?$/.test(rest)) {
85
+ out[key] = parseBlockScalar(lines, state, indent, rest.startsWith(">"));
86
+ } else if (!rest) {
87
+ out[key] = parseBlock(lines, state, indent + 1);
88
+ } else {
89
+ out[key] = parseScalar(rest);
90
+ }
91
+ }
92
+ return out;
93
+ }
94
+
95
+ function parseBlockScalar(lines: Line[], state: { i: number }, indent: number, folded: boolean): string {
96
+ const parts: string[] = [];
97
+ let blockIndent = -1;
98
+ while (state.i < lines.length) {
99
+ const line = lines[state.i]!;
100
+ if (line.indent >= 0 && line.indent <= indent) break;
101
+ if (line.indent >= 0 && blockIndent < 0) blockIndent = line.indent;
102
+ parts.push(line.indent < 0 ? "" : line.text.slice(Math.max(0, blockIndent)));
103
+ state.i++;
104
+ }
105
+ while (parts.length && !parts[parts.length - 1]) parts.pop();
106
+ return folded ? parts.join(" ").replace(/\s+\n/g, "\n") : parts.join("\n");
107
+ }
108
+
109
+ function stripComment(text: string): string {
110
+ let quote: string | null = null;
111
+ for (let i = 0; i < text.length; i++) {
112
+ const ch = text[i]!;
113
+ if (quote) {
114
+ if (ch === quote) quote = null;
115
+ } else if (ch === '"' || ch === "'") {
116
+ quote = ch;
117
+ } else if (ch === "#" && (i === 0 || /\s/.test(text[i - 1]!))) {
118
+ return text.slice(0, i);
119
+ }
120
+ }
121
+ return text;
122
+ }
123
+
124
+ function unquote(text: string): string {
125
+ if (text.length >= 2 && text.startsWith('"') && text.endsWith('"')) {
126
+ try {
127
+ return JSON.parse(text) as string;
128
+ } catch {
129
+ return text.slice(1, -1);
130
+ }
131
+ }
132
+ if (text.length >= 2 && text.startsWith("'") && text.endsWith("'")) return text.slice(1, -1).replace(/''/g, "'");
133
+ return text;
134
+ }
135
+
136
+ function splitInlineList(body: string): string[] {
137
+ const items: string[] = [];
138
+ let depth = 0;
139
+ let quote: string | null = null;
140
+ let current = "";
141
+ for (const ch of body) {
142
+ if (quote) {
143
+ current += ch;
144
+ if (ch === quote) quote = null;
145
+ continue;
146
+ }
147
+ if (ch === '"' || ch === "'") quote = ch;
148
+ if (ch === "[" || ch === "{") depth++;
149
+ if (ch === "]" || ch === "}") depth--;
150
+ if (ch === "," && depth === 0) {
151
+ items.push(current.trim());
152
+ current = "";
153
+ continue;
154
+ }
155
+ current += ch;
156
+ }
157
+ if (current.trim()) items.push(current.trim());
158
+ return items;
159
+ }
160
+
161
+ export function parseScalar(raw: string): unknown {
162
+ const text = stripComment(raw).trim();
163
+ if (text.startsWith("[") && text.endsWith("]")) {
164
+ return splitInlineList(text.slice(1, -1)).map(parseScalar);
165
+ }
166
+ if (text.startsWith('"') || text.startsWith("'")) return unquote(text);
167
+ if (text === "true" || text === "True" || text === "TRUE") return true;
168
+ if (text === "false" || text === "False" || text === "FALSE") return false;
169
+ if (text === "null" || text === "~") return null;
170
+ if (/^-?\d+(\.\d+)?$/.test(text)) return Number(text);
171
+ return text;
172
+ }
@@ -0,0 +1,107 @@
1
+ import type { Category } from "./contracts.ts";
2
+
3
+ type Paths = { project?: readonly string[]; user?: readonly string[] };
4
+ export type AcpConfig = Record<Category, Paths> & { pluginManifests?: readonly string[] };
5
+
6
+ /** Only locations backed by the primary sources in specs/003-acp-configurations/research.md. */
7
+ export const ACP_CONFIGS = {
8
+ cline: {
9
+ instructions: { project: ["AGENTS.md"], user: [".agents/AGENTS.md"] },
10
+ rules: { project: [".clinerules", ".cline/rules"], user: [".cline/data/settings/rules", ".cline/rules", "Documents/Cline/Rules"] },
11
+ skills: { project: [".cline/skills"], user: [".cline/data/settings/skills", ".cline/skills"] },
12
+ mcp: { project: [".cline/mcp.json"], user: [".cline/mcp.json", ".cline/data/settings/cline_mcp_settings.json"] },
13
+ commands: {},
14
+ subagents: { project: [".cline/agents.yaml"] },
15
+ plugins: { project: [".cline/plugins", ".cline/plugins/_installed"], user: [".cline/plugins", ".cline/plugins/_installed"] },
16
+ pluginManifests: ["package.json"],
17
+ },
18
+ "codebuddy-code": {
19
+ instructions: { project: ["CODEBUDDY.md", "CODEBUDDY.local.md", ".codebuddy/CODEBUDDY.md"], user: [".codebuddy/CODEBUDDY.md"] },
20
+ rules: { project: [".codebuddy/rules"], user: [".codebuddy/rules"] },
21
+ skills: { project: [".codebuddy/skills"], user: [".codebuddy/skills"] },
22
+ mcp: { project: [".mcp.json"], user: [".codebuddy/.mcp.json"] },
23
+ commands: { project: [".codebuddy/commands"], user: [".codebuddy/commands"] },
24
+ subagents: { project: [".codebuddy/agents"], user: [".codebuddy/agents"] },
25
+ plugins: { project: [".codebuddy-plugin/plugin.json"], user: [".codebuddy/plugins/cache"] },
26
+ pluginManifests: [".codebuddy-plugin/plugin.json", ".workbuddy-plugin/plugin.json", ".claude-plugin/plugin.json"],
27
+ },
28
+ gemini: {
29
+ instructions: { project: ["GEMINI.md", ".gemini/GEMINI.md"], user: [".gemini/GEMINI.md"] },
30
+ rules: {},
31
+ skills: { project: [".gemini/skills", ".agents/skills"], user: [".gemini/skills", ".agents/skills"] },
32
+ mcp: { project: [".gemini/settings.json"], user: [".gemini/settings.json"] },
33
+ commands: { project: [".gemini/commands"], user: [".gemini/commands"] },
34
+ subagents: { project: [".gemini/agents"], user: [".gemini/agents"] },
35
+ plugins: { user: [".gemini/extensions"] },
36
+ pluginManifests: ["gemini-extension.json", "plugin.json"],
37
+ },
38
+ goose: {
39
+ instructions: { project: ["AGENTS.md", ".goosehints"], user: [".config/goose/.goosehints", ".config/goose/AGENTS.md"] },
40
+ rules: {},
41
+ skills: { project: [".agents/skills", ".goose/skills", ".claude/skills"], user: [".agents/skills", ".claude/skills"] },
42
+ mcp: { user: [".config/goose/config.yaml"] },
43
+ commands: { user: [".config/goose/config.yaml"] },
44
+ subagents: { project: [".agents/agents", ".goose/agents", ".claude/agents"], user: [".agents/agents", ".goose/agents", ".claude/agents"] },
45
+ plugins: { project: [".agents/plugins"], user: [".config/goose/config.yaml", ".agents/plugins"] },
46
+ pluginManifests: ["plugin.json"],
47
+ },
48
+ grok: {
49
+ instructions: { project: ["AGENTS.md", "CLAUDE.md", "CLAUDE.local.md"], user: [".grok/AGENTS.md"] },
50
+ rules: { project: [".grok/rules", ".claude/rules"], user: [".grok/rules", ".claude/rules"] },
51
+ skills: { project: [".grok/skills", ".agents/skills", ".claude/skills"], user: [".grok/skills", ".agents/skills", ".claude/skills"] },
52
+ mcp: { project: [".grok/config.toml", ".mcp.json", ".cursor/mcp.json"], user: [".grok/config.toml", ".claude.json"] },
53
+ commands: { user: [".agents/commands", ".claude/commands"] },
54
+ subagents: { project: [".grok/agents", ".claude/agents"], user: [".grok/agents", ".claude/agents"] },
55
+ plugins: { project: [".grok/plugins"], user: [".grok/plugins", ".claude/plugins"] },
56
+ pluginManifests: [".claude-plugin/plugin.json", "plugin.json"],
57
+ },
58
+ kilo: {
59
+ instructions: { project: ["AGENTS.md", "AGENT.md"], user: [".config/kilo/AGENTS.md"] },
60
+ rules: { project: [".kilo/rules"], user: [".config/kilo/rules"] },
61
+ skills: { project: [".kilo/skills", ".agents/skills", ".claude/skills"], user: [".kilo/skills", ".agents/skills", ".claude/skills"] },
62
+ mcp: { project: ["kilo.jsonc"], user: [".config/kilo/kilo.jsonc"] },
63
+ commands: { project: [".kilo/commands"], user: [".config/kilo/commands"] },
64
+ subagents: { project: [".kilo/agents"], user: [".config/kilo/agents"] },
65
+ plugins: {},
66
+ },
67
+ kiro: {
68
+ instructions: { project: ["AGENTS.md"], user: [".kiro/steering/AGENTS.md"] },
69
+ rules: { project: [".kiro/steering"], user: [".kiro/steering"] },
70
+ skills: { project: [".kiro/skills"], user: [".kiro/skills"] },
71
+ mcp: { project: [".kiro/settings/mcp.json"], user: [".kiro/settings/mcp.json"] },
72
+ commands: {},
73
+ subagents: { project: [".kiro/agents"], user: [".kiro/agents"] },
74
+ plugins: { user: [".kiro/powers"] },
75
+ },
76
+ kimi: {
77
+ instructions: { project: ["AGENTS.md", ".kimi-code/AGENTS.md"], user: [".kimi-code/AGENTS.md", ".agents/AGENTS.md", ".kimi-code/SYSTEM.md"] },
78
+ rules: {},
79
+ skills: { project: [".kimi-code/skills", ".agents/skills"], user: [".kimi-code/skills", ".agents/skills"] },
80
+ mcp: { project: [".kimi-code/mcp.json"], user: [".kimi-code/mcp.json"] },
81
+ commands: { user: [".kimi-code/plugins/managed"] },
82
+ subagents: { project: [".kimi-code/agents", ".agents/agents"], user: [".kimi-code/agents", ".agents/agents"] },
83
+ plugins: { user: [".kimi-code/plugins/managed", ".kimi-code/plugins/installed.json"] },
84
+ pluginManifests: ["kimi.plugin.json"],
85
+ },
86
+ "qwen-code": {
87
+ instructions: { project: ["QWEN.md"], user: [".qwen/QWEN.md"] },
88
+ rules: { project: [".qwen/rules"], user: [".qwen/rules"] },
89
+ skills: { project: [".qwen/skills"], user: [".qwen/skills"] },
90
+ mcp: { project: [".qwen/settings.json"], user: [".qwen/settings.json"] },
91
+ commands: { project: [".qwen/commands"], user: [".qwen/commands"] },
92
+ subagents: { project: [".qwen/agents"], user: [".qwen/agents"] },
93
+ plugins: { user: [".qwen/extensions"] },
94
+ pluginManifests: ["qwen-extension.json"],
95
+ },
96
+ traecli: {
97
+ instructions: { project: ["AGENTS.md"] },
98
+ rules: { project: [".trae/rules"], user: [".trae-cn/rules"] },
99
+ skills: { project: [".traecli/skills", ".trae/skills"], user: [".traecli/skills", ".trae-cn/skills"] },
100
+ mcp: { project: [".trae/mcp.json"], user: ["Library/Application Support/trae_cli/trae_cli.yaml"] },
101
+ commands: { project: [".traecli/commands"] },
102
+ subagents: { project: [".traecli/agents", ".trae/agents"], user: [".trae-cn/agents"] },
103
+ plugins: {},
104
+ },
105
+ } as const satisfies Record<string, AcpConfig>;
106
+
107
+ export type AcpProviderId = keyof typeof ACP_CONFIGS;
@@ -0,0 +1,26 @@
1
+ import { CATEGORIES, type Category } from "./contracts.ts";
2
+ import { MECHANISMS } from "./mechanisms.ts";
3
+ import type { ProviderId } from "./providers.ts";
4
+
5
+ /** Confirmed provider features whose local discovery locations are not yet verified. */
6
+ const CAPABILITIES_WITHOUT_SCAN: Partial<Record<ProviderId, readonly Category[]>> = {
7
+ claude: ["subagents", "plugins"],
8
+ codex: ["subagents", "plugins"],
9
+ copilot: ["subagents", "plugins"],
10
+ opencode: ["commands", "subagents", "plugins"],
11
+ pi: ["commands", "plugins"],
12
+ omp: ["commands", "subagents", "plugins"],
13
+ cline: ["commands"],
14
+ kilo: ["plugins"],
15
+ traecli: ["plugins"],
16
+ };
17
+
18
+ export function visibleCategories(provider: ProviderId): Category[] {
19
+ const unscanned: readonly Category[] = CAPABILITIES_WITHOUT_SCAN[provider] ?? [];
20
+ return CATEGORIES.filter((category) => MECHANISMS[provider][category].supported || unscanned.includes(category));
21
+ }
22
+
23
+ export function resolveCategory(provider: ProviderId, selected: Category): Category {
24
+ const visible = visibleCategories(provider);
25
+ return visible.includes(selected) ? selected : visible[0] ?? "instructions";
26
+ }
@@ -0,0 +1,6 @@
1
+ import type { ProviderId } from "./providers.ts";
2
+
3
+ /** Providers with verified shared or foreign skill search roots. */
4
+ export const COMPATIBLE_PROVIDERS = new Set<ProviderId>([
5
+ "cursor", "copilot", "opencode", "pi", "omp", "gemini", "goose", "grok", "kilo", "kimi",
6
+ ]);
@@ -0,0 +1,116 @@
1
+ import { defineRpc } from "@getpaseo/plugin";
2
+ import { z } from "zod";
3
+ import { PROVIDER_IDS } from "./providers.ts";
4
+
5
+ export const CATEGORIES = ["instructions", "rules", "skills", "mcp", "commands", "subagents", "plugins"] as const;
6
+ export type Category = (typeof CATEGORIES)[number];
7
+
8
+ export const SCOPES = ["project", "user"] as const;
9
+ export type Scope = (typeof SCOPES)[number];
10
+
11
+ export const STATUSES = ["auto", "conditional", "manual", "pending", "disabled", "inactive"] as const;
12
+ export type Status = (typeof STATUSES)[number];
13
+
14
+ export const REASON_CODES = [
15
+ "frontmatter",
16
+ "config",
17
+ "shadowedBy",
18
+ "nestedDir",
19
+ "globs",
20
+ "agentDecides",
21
+ "manualMention",
22
+ "always",
23
+ "untrusted",
24
+ "needsApproval",
25
+ "offByDefault",
26
+ "ignoredExt",
27
+ "env",
28
+ "oversize",
29
+ "onDemand",
30
+ ] as const;
31
+ export type ReasonCode = (typeof REASON_CODES)[number];
32
+
33
+ export const TAGS = [
34
+ "managed",
35
+ "system",
36
+ "builtin",
37
+ "legacy",
38
+ "deprecated",
39
+ "nested",
40
+ "parent",
41
+ "command",
42
+ "symlink",
43
+ "local",
44
+ "trust",
45
+ "systemPrompt",
46
+ "appendPrompt",
47
+ "sticky",
48
+ "userInvocableOff",
49
+ "nameOnly",
50
+ "ask",
51
+ "url",
52
+ "autolearn",
53
+ "synced",
54
+ ] as const;
55
+ export type Tag = (typeof TAGS)[number];
56
+
57
+ export const EntrySchema = z.object({
58
+ id: z.string(),
59
+ category: z.enum(CATEGORIES),
60
+ scope: z.enum(SCOPES),
61
+ name: z.string(),
62
+ description: z.string().optional(),
63
+ path: z.string(),
64
+ dir: z.string(),
65
+ source: z.string(),
66
+ status: z.enum(STATUSES),
67
+ reason: z.object({ code: z.enum(REASON_CODES), value: z.string().optional() }).optional(),
68
+ tags: z.array(z.enum(TAGS)),
69
+ agentPlugin: z.object({ version: z.string(), validation: z.enum(["valid", "unsupported"]) }).optional(),
70
+ mcp: z.object({ name: z.string(), transport: z.string(), target: z.string() }).optional(),
71
+ });
72
+ export type Entry = z.infer<typeof EntrySchema>;
73
+
74
+ const ProviderIdSchema = z.enum(PROVIDER_IDS);
75
+
76
+ export const CompatibilitySchema = z.object({ enabled: z.boolean().nullable(), source: z.string() });
77
+ export type Compatibility = z.infer<typeof CompatibilitySchema>;
78
+
79
+ export const scanRpc = defineRpc({
80
+ name: "customize.scan",
81
+ input: z.object({ provider: ProviderIdSchema, projectRoot: z.string().nullable() }),
82
+ output: z.object({
83
+ provider: ProviderIdSchema,
84
+ projectRoot: z.string().nullable(),
85
+ home: z.string(),
86
+ entries: z.array(EntrySchema),
87
+ compatibility: CompatibilitySchema.nullable(),
88
+ scannedAt: z.string(),
89
+ }),
90
+ });
91
+ export type ScanResult = z.infer<typeof scanRpc.output>;
92
+
93
+ export const cachedScanRpc = defineRpc({
94
+ name: "customize.cached-scan",
95
+ input: scanRpc.input,
96
+ output: z.object({ snapshot: scanRpc.output.nullable(), stale: z.boolean() }),
97
+ });
98
+
99
+ export const previewRpc = defineRpc({
100
+ name: "customize.preview",
101
+ input: z.object({ path: z.string(), mcpName: z.string().optional() }),
102
+ output: z.object({
103
+ path: z.string(),
104
+ kind: z.enum(["text", "mcp", "directory", "missing"]),
105
+ content: z.string(),
106
+ truncated: z.boolean(),
107
+ bytes: z.number(),
108
+ }),
109
+ });
110
+ export type PreviewResult = z.infer<typeof previewRpc.output>;
111
+
112
+ export const openRpc = defineRpc({
113
+ name: "customize.open",
114
+ input: z.object({ path: z.string(), reveal: z.boolean().optional() }),
115
+ output: z.object({ ok: z.literal(true) }),
116
+ });