agentseal 0.6.1 → 0.8.1
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/dist/agentseal.js +2954 -2367
- package/dist/chunk-23GC7G5P.js +635 -0
- package/dist/chunk-ZLRN7Q7C.js +27 -0
- package/dist/index.cjs +131 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +40 -1
- package/dist/index.d.ts +40 -1
- package/dist/index.js +121 -4
- package/dist/index.js.map +1 -1
- package/dist/llm-judge-T6LDAZRQ.js +241 -0
- package/dist/machine-discovery-XIJE7CFD.js +22 -0
- package/package.json +1 -1
|
@@ -0,0 +1,635 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
__esm,
|
|
4
|
+
__export
|
|
5
|
+
} from "./chunk-ZLRN7Q7C.js";
|
|
6
|
+
|
|
7
|
+
// src/machine-discovery.ts
|
|
8
|
+
var machine_discovery_exports = {};
|
|
9
|
+
__export(machine_discovery_exports, {
|
|
10
|
+
PROJECT_MCP_CONFIGS: () => PROJECT_MCP_CONFIGS,
|
|
11
|
+
PROJECT_SKILL_DIRS: () => PROJECT_SKILL_DIRS,
|
|
12
|
+
PROJECT_SKILL_FILES: () => PROJECT_SKILL_FILES,
|
|
13
|
+
getWellKnownConfigs: () => getWellKnownConfigs,
|
|
14
|
+
scanDirectory: () => scanDirectory,
|
|
15
|
+
scanMachine: () => scanMachine,
|
|
16
|
+
stripJsonComments: () => stripJsonComments
|
|
17
|
+
});
|
|
18
|
+
import { readdirSync, readFileSync, statSync } from "fs";
|
|
19
|
+
import { homedir } from "os";
|
|
20
|
+
import { dirname, join, resolve } from "path";
|
|
21
|
+
function getWellKnownConfigs() {
|
|
22
|
+
const home = homedir();
|
|
23
|
+
const appdata = process.platform === "win32" ? process.env.APPDATA ?? "" : null;
|
|
24
|
+
const p = (...parts) => join(home, ...parts);
|
|
25
|
+
const ap = (...parts) => appdata ? join(appdata, ...parts) : null;
|
|
26
|
+
const sys = process.platform === "darwin" ? "Darwin" : process.platform === "win32" ? "Windows" : "Linux";
|
|
27
|
+
const configs = [
|
|
28
|
+
{
|
|
29
|
+
name: "Claude Desktop",
|
|
30
|
+
agent_type: "claude-desktop",
|
|
31
|
+
paths: {
|
|
32
|
+
Darwin: p("Library", "Application Support", "Claude", "claude_desktop_config.json"),
|
|
33
|
+
Windows: ap("Claude", "claude_desktop_config.json"),
|
|
34
|
+
Linux: p(".config", "Claude", "claude_desktop_config.json")
|
|
35
|
+
},
|
|
36
|
+
mcp_key: "mcpServers"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: "Claude Code",
|
|
40
|
+
agent_type: "claude-code",
|
|
41
|
+
paths: { all: p(".claude.json") },
|
|
42
|
+
mcp_key: "mcpServers"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: "Cursor",
|
|
46
|
+
agent_type: "cursor",
|
|
47
|
+
paths: { all: p(".cursor", "mcp.json") },
|
|
48
|
+
mcp_key: "mcpServers"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: "Windsurf",
|
|
52
|
+
agent_type: "windsurf",
|
|
53
|
+
paths: {
|
|
54
|
+
Darwin: p(".codeium", "windsurf", "mcp_config.json"),
|
|
55
|
+
Windows: p(".codeium", "windsurf", "mcp_config.json"),
|
|
56
|
+
Linux: p(".codeium", "windsurf", "mcp_config.json")
|
|
57
|
+
},
|
|
58
|
+
mcp_key: "mcpServers"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: "VS Code",
|
|
62
|
+
agent_type: "vscode",
|
|
63
|
+
paths: {
|
|
64
|
+
Darwin: p("Library", "Application Support", "Code", "User", "mcp.json"),
|
|
65
|
+
Windows: ap("Code", "User", "mcp.json"),
|
|
66
|
+
Linux: p(".config", "Code", "User", "mcp.json")
|
|
67
|
+
},
|
|
68
|
+
mcp_key: "servers",
|
|
69
|
+
format: "jsonc"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: "Gemini CLI",
|
|
73
|
+
agent_type: "gemini-cli",
|
|
74
|
+
paths: { all: p(".gemini", "settings.json") },
|
|
75
|
+
mcp_key: "mcpServers"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: "Codex CLI",
|
|
79
|
+
agent_type: "codex",
|
|
80
|
+
paths: { all: p(".codex", "config.toml") },
|
|
81
|
+
mcp_key: "mcp_servers",
|
|
82
|
+
format: "toml"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
name: "OpenClaw",
|
|
86
|
+
agent_type: "openclaw",
|
|
87
|
+
paths: { all: p(".openclaw", "openclaw.json") },
|
|
88
|
+
mcp_key: "mcpServers",
|
|
89
|
+
format: "jsonc"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
name: "Kiro",
|
|
93
|
+
agent_type: "kiro",
|
|
94
|
+
paths: { all: p(".kiro", "settings", "mcp.json") },
|
|
95
|
+
mcp_key: "mcpServers"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
name: "OpenCode",
|
|
99
|
+
agent_type: "opencode",
|
|
100
|
+
paths: {
|
|
101
|
+
Darwin: p(".config", "opencode", "opencode.json"),
|
|
102
|
+
Linux: p(".config", "opencode", "opencode.json"),
|
|
103
|
+
Windows: ap("opencode", "opencode.json")
|
|
104
|
+
},
|
|
105
|
+
mcp_key: "mcp"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
name: "Continue",
|
|
109
|
+
agent_type: "continue",
|
|
110
|
+
paths: { all: p(".continue", "config.yaml") },
|
|
111
|
+
mcp_key: "mcpServers",
|
|
112
|
+
format: "yaml"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
name: "Cline",
|
|
116
|
+
agent_type: "cline",
|
|
117
|
+
paths: {
|
|
118
|
+
Darwin: p("Library", "Application Support", "Code", "User", "globalStorage", "saoudrizwan.claude-dev", "settings", "cline_mcp_settings.json"),
|
|
119
|
+
Windows: ap("Code", "User", "globalStorage", "saoudrizwan.claude-dev", "settings", "cline_mcp_settings.json"),
|
|
120
|
+
Linux: p(".config", "Code", "User", "globalStorage", "saoudrizwan.claude-dev", "settings", "cline_mcp_settings.json")
|
|
121
|
+
},
|
|
122
|
+
mcp_key: "mcpServers"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
name: "Roo Code",
|
|
126
|
+
agent_type: "roo-code",
|
|
127
|
+
paths: {
|
|
128
|
+
Darwin: p("Library", "Application Support", "Code", "User", "globalStorage", "rooveterinaryinc.roo-cline", "settings", "mcp_settings.json"),
|
|
129
|
+
Windows: ap("Code", "User", "globalStorage", "rooveterinaryinc.roo-cline", "settings", "mcp_settings.json"),
|
|
130
|
+
Linux: p(".config", "Code", "User", "globalStorage", "rooveterinaryinc.roo-cline", "settings", "mcp_settings.json")
|
|
131
|
+
},
|
|
132
|
+
mcp_key: "mcpServers"
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
name: "Kilo Code",
|
|
136
|
+
agent_type: "kilo-code",
|
|
137
|
+
paths: {
|
|
138
|
+
Darwin: p("Library", "Application Support", "Code", "User", "globalStorage", "kilocode.kilo", "mcp_settings.json"),
|
|
139
|
+
Windows: ap("Code", "User", "globalStorage", "kilocode.kilo", "mcp_settings.json"),
|
|
140
|
+
Linux: p(".config", "Code", "User", "globalStorage", "kilocode.kilo", "mcp_settings.json")
|
|
141
|
+
},
|
|
142
|
+
mcp_key: "mcpServers"
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
name: "Zed",
|
|
146
|
+
agent_type: "zed",
|
|
147
|
+
paths: {
|
|
148
|
+
Darwin: p(".zed", "settings.json"),
|
|
149
|
+
Linux: p(".config", "zed", "settings.json"),
|
|
150
|
+
Windows: ap("Zed", "settings.json")
|
|
151
|
+
},
|
|
152
|
+
mcp_key: "context_servers",
|
|
153
|
+
format: "jsonc"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
name: "Amp",
|
|
157
|
+
agent_type: "amp",
|
|
158
|
+
paths: {
|
|
159
|
+
Darwin: p(".config", "amp", "settings.json"),
|
|
160
|
+
Linux: p(".config", "amp", "settings.json"),
|
|
161
|
+
Windows: ap("amp", "settings.json")
|
|
162
|
+
},
|
|
163
|
+
mcp_key: "amp.mcpServers"
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
name: "Aider",
|
|
167
|
+
agent_type: "aider",
|
|
168
|
+
paths: { all: p(".aider.conf.yml") },
|
|
169
|
+
mcp_key: null
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
name: "Amazon Q",
|
|
173
|
+
agent_type: "amazon-q",
|
|
174
|
+
paths: { all: p(".aws", "amazonq", "mcp.json") },
|
|
175
|
+
mcp_key: "mcpServers"
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
name: "Copilot CLI",
|
|
179
|
+
agent_type: "copilot-cli",
|
|
180
|
+
paths: { all: p(".copilot", "mcp-config.json") },
|
|
181
|
+
mcp_key: "mcpServers"
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
name: "Junie",
|
|
185
|
+
agent_type: "junie",
|
|
186
|
+
paths: { all: p(".junie", "mcp", "mcp.json") },
|
|
187
|
+
mcp_key: "mcpServers"
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
name: "Goose",
|
|
191
|
+
agent_type: "goose",
|
|
192
|
+
paths: {
|
|
193
|
+
Darwin: p(".config", "goose", "config.yaml"),
|
|
194
|
+
Linux: p(".config", "goose", "config.yaml")
|
|
195
|
+
},
|
|
196
|
+
mcp_key: "extensions",
|
|
197
|
+
format: "yaml"
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
name: "Crush",
|
|
201
|
+
agent_type: "crush",
|
|
202
|
+
paths: { all: p(".config", "crush", "crush.json") },
|
|
203
|
+
mcp_key: "mcp"
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
name: "Qwen Code",
|
|
207
|
+
agent_type: "qwen-code",
|
|
208
|
+
paths: { all: p(".qwen", "settings.json") },
|
|
209
|
+
mcp_key: "mcpServers"
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
name: "Grok CLI",
|
|
213
|
+
agent_type: "grok-cli",
|
|
214
|
+
paths: { all: p(".grok", "user-settings.json") },
|
|
215
|
+
mcp_key: "mcpServers"
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
name: "Visual Studio",
|
|
219
|
+
agent_type: "visual-studio",
|
|
220
|
+
paths: { Windows: p(".mcp.json") },
|
|
221
|
+
mcp_key: "servers"
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
name: "Kimi CLI",
|
|
225
|
+
agent_type: "kimi-cli",
|
|
226
|
+
paths: { all: p(".kimi", "mcp.json") },
|
|
227
|
+
mcp_key: "mcpServers"
|
|
228
|
+
},
|
|
229
|
+
{
|
|
230
|
+
name: "Trae",
|
|
231
|
+
agent_type: "trae",
|
|
232
|
+
paths: {
|
|
233
|
+
Darwin: p("Library", "Application Support", "Trae", "mcp_config.json"),
|
|
234
|
+
Linux: p(".config", "Trae", "mcp_config.json")
|
|
235
|
+
},
|
|
236
|
+
mcp_key: "mcpServers"
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
name: "MaxClaw",
|
|
240
|
+
agent_type: "maxclaw",
|
|
241
|
+
paths: { all: p(".maxclaw", "config.json") },
|
|
242
|
+
mcp_key: "mcpServers"
|
|
243
|
+
}
|
|
244
|
+
];
|
|
245
|
+
return configs.map((cfg) => ({
|
|
246
|
+
...cfg,
|
|
247
|
+
paths: Object.fromEntries(
|
|
248
|
+
Object.entries(cfg.paths).filter(([, v]) => v !== null)
|
|
249
|
+
)
|
|
250
|
+
}));
|
|
251
|
+
}
|
|
252
|
+
function stripJsonComments(text) {
|
|
253
|
+
const result = [];
|
|
254
|
+
let i = 0;
|
|
255
|
+
const n = text.length;
|
|
256
|
+
while (i < n) {
|
|
257
|
+
if (text[i] === '"') {
|
|
258
|
+
let j = i + 1;
|
|
259
|
+
while (j < n) {
|
|
260
|
+
if (text[j] === "\\") {
|
|
261
|
+
j += 2;
|
|
262
|
+
} else if (text[j] === '"') {
|
|
263
|
+
j += 1;
|
|
264
|
+
break;
|
|
265
|
+
} else {
|
|
266
|
+
j += 1;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
result.push(text.slice(i, j));
|
|
270
|
+
i = j;
|
|
271
|
+
} else if (text.slice(i, i + 2) === "//") {
|
|
272
|
+
while (i < n && text[i] !== "\n") i++;
|
|
273
|
+
} else if (text.slice(i, i + 2) === "/*") {
|
|
274
|
+
i += 2;
|
|
275
|
+
while (i < n - 1 && text.slice(i, i + 2) !== "*/") i++;
|
|
276
|
+
if (i < n - 1) i += 2;
|
|
277
|
+
} else {
|
|
278
|
+
result.push(text[i]);
|
|
279
|
+
i += 1;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
return result.join("");
|
|
283
|
+
}
|
|
284
|
+
function isFile(p) {
|
|
285
|
+
try {
|
|
286
|
+
return statSync(p).isFile();
|
|
287
|
+
} catch {
|
|
288
|
+
return false;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
function isDir(p) {
|
|
292
|
+
try {
|
|
293
|
+
return statSync(p).isDirectory();
|
|
294
|
+
} catch {
|
|
295
|
+
return false;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
function rglob(dir, patterns) {
|
|
299
|
+
const results = [];
|
|
300
|
+
const _walk = (d) => {
|
|
301
|
+
let entries;
|
|
302
|
+
try {
|
|
303
|
+
entries = readdirSync(d);
|
|
304
|
+
} catch {
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
for (const entry of entries) {
|
|
308
|
+
const full = join(d, entry);
|
|
309
|
+
try {
|
|
310
|
+
const st = statSync(full);
|
|
311
|
+
if (st.isDirectory()) {
|
|
312
|
+
_walk(full);
|
|
313
|
+
} else if (st.isFile()) {
|
|
314
|
+
for (const pat of patterns) {
|
|
315
|
+
if (pat === "*.md" && entry.endsWith(".md")) {
|
|
316
|
+
results.push(full);
|
|
317
|
+
break;
|
|
318
|
+
} else if (pat === "SKILL.md" && entry === "SKILL.md") {
|
|
319
|
+
results.push(full);
|
|
320
|
+
break;
|
|
321
|
+
} else if (entry === pat) {
|
|
322
|
+
results.push(full);
|
|
323
|
+
break;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
} catch {
|
|
328
|
+
continue;
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
};
|
|
332
|
+
_walk(dir);
|
|
333
|
+
return results;
|
|
334
|
+
}
|
|
335
|
+
function globPrefix(dir, prefix) {
|
|
336
|
+
try {
|
|
337
|
+
return readdirSync(dir).filter((f) => f.startsWith(prefix)).map((f) => join(dir, f)).filter((f) => isFile(f));
|
|
338
|
+
} catch {
|
|
339
|
+
return [];
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
function readJsonSafe(path, format) {
|
|
343
|
+
try {
|
|
344
|
+
let raw = readFileSync(path, "utf-8");
|
|
345
|
+
if (format === "jsonc") {
|
|
346
|
+
raw = stripJsonComments(raw);
|
|
347
|
+
}
|
|
348
|
+
return JSON.parse(raw);
|
|
349
|
+
} catch {
|
|
350
|
+
return null;
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
function extractMCPServers(data, mcpKey, sourceFile, agentType) {
|
|
354
|
+
if (mcpKey === null) return [];
|
|
355
|
+
let servers;
|
|
356
|
+
if (mcpKey.includes(".")) {
|
|
357
|
+
const parts = mcpKey.split(".");
|
|
358
|
+
let node = data;
|
|
359
|
+
for (const part of parts) {
|
|
360
|
+
node = node && typeof node === "object" ? node[part] : void 0;
|
|
361
|
+
}
|
|
362
|
+
servers = node ?? {};
|
|
363
|
+
} else {
|
|
364
|
+
servers = data[mcpKey] ?? {};
|
|
365
|
+
}
|
|
366
|
+
const results = [];
|
|
367
|
+
if (typeof servers === "object" && servers !== null && !Array.isArray(servers)) {
|
|
368
|
+
for (const [srvName, srvCfg] of Object.entries(servers)) {
|
|
369
|
+
if (typeof srvCfg !== "object" || srvCfg === null) continue;
|
|
370
|
+
const normalized = { ...srvCfg };
|
|
371
|
+
if ("cmd" in normalized && !("command" in normalized)) {
|
|
372
|
+
normalized.command = normalized.cmd;
|
|
373
|
+
delete normalized.cmd;
|
|
374
|
+
}
|
|
375
|
+
if ("envs" in normalized && !("env" in normalized)) {
|
|
376
|
+
normalized.env = normalized.envs;
|
|
377
|
+
delete normalized.envs;
|
|
378
|
+
}
|
|
379
|
+
results.push({
|
|
380
|
+
name: srvName,
|
|
381
|
+
source_file: sourceFile,
|
|
382
|
+
agent_type: agentType,
|
|
383
|
+
...normalized
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
return results;
|
|
388
|
+
}
|
|
389
|
+
function scanMachine() {
|
|
390
|
+
const sys = process.platform === "darwin" ? "Darwin" : process.platform === "win32" ? "Windows" : "Linux";
|
|
391
|
+
const home = homedir();
|
|
392
|
+
const configs = getWellKnownConfigs();
|
|
393
|
+
const agents = [];
|
|
394
|
+
const allMCPServers = [];
|
|
395
|
+
const allSkillPaths = [];
|
|
396
|
+
const seenSkillPaths = /* @__PURE__ */ new Set();
|
|
397
|
+
for (const cfg of configs) {
|
|
398
|
+
const path = cfg.paths[sys] ?? cfg.paths["all"] ?? null;
|
|
399
|
+
if (path === null) continue;
|
|
400
|
+
if (!isFile(path)) {
|
|
401
|
+
const dir = dirname(path);
|
|
402
|
+
if (isDir(dir)) {
|
|
403
|
+
agents.push({
|
|
404
|
+
name: cfg.name,
|
|
405
|
+
config_path: dir,
|
|
406
|
+
agent_type: cfg.agent_type,
|
|
407
|
+
mcp_servers: 0,
|
|
408
|
+
skills_count: 0,
|
|
409
|
+
status: "installed_no_config"
|
|
410
|
+
});
|
|
411
|
+
} else {
|
|
412
|
+
agents.push({
|
|
413
|
+
name: cfg.name,
|
|
414
|
+
config_path: path,
|
|
415
|
+
agent_type: cfg.agent_type,
|
|
416
|
+
mcp_servers: 0,
|
|
417
|
+
skills_count: 0,
|
|
418
|
+
status: "not_installed"
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
continue;
|
|
422
|
+
}
|
|
423
|
+
if (cfg.format === "yaml" || cfg.format === "toml") {
|
|
424
|
+
agents.push({
|
|
425
|
+
name: cfg.name,
|
|
426
|
+
config_path: path,
|
|
427
|
+
agent_type: cfg.agent_type,
|
|
428
|
+
mcp_servers: 0,
|
|
429
|
+
skills_count: 0,
|
|
430
|
+
status: "found"
|
|
431
|
+
});
|
|
432
|
+
continue;
|
|
433
|
+
}
|
|
434
|
+
const data = readJsonSafe(path, cfg.format);
|
|
435
|
+
if (data === null) {
|
|
436
|
+
agents.push({
|
|
437
|
+
name: cfg.name,
|
|
438
|
+
config_path: path,
|
|
439
|
+
agent_type: cfg.agent_type,
|
|
440
|
+
mcp_servers: 0,
|
|
441
|
+
skills_count: 0,
|
|
442
|
+
status: "error"
|
|
443
|
+
});
|
|
444
|
+
continue;
|
|
445
|
+
}
|
|
446
|
+
const servers = extractMCPServers(data, cfg.mcp_key, path, cfg.agent_type);
|
|
447
|
+
allMCPServers.push(...servers);
|
|
448
|
+
agents.push({
|
|
449
|
+
name: cfg.name,
|
|
450
|
+
config_path: path,
|
|
451
|
+
agent_type: cfg.agent_type,
|
|
452
|
+
mcp_servers: servers.length,
|
|
453
|
+
skills_count: 0,
|
|
454
|
+
status: "found"
|
|
455
|
+
});
|
|
456
|
+
}
|
|
457
|
+
for (const skillDirRel of SKILL_DIRS) {
|
|
458
|
+
const skillDir = join(home, skillDirRel);
|
|
459
|
+
if (isDir(skillDir)) {
|
|
460
|
+
for (const f of rglob(skillDir, ["SKILL.md", "*.md"])) {
|
|
461
|
+
try {
|
|
462
|
+
if (statSync(f).size > MAX_SKILL_SIZE) continue;
|
|
463
|
+
} catch {
|
|
464
|
+
continue;
|
|
465
|
+
}
|
|
466
|
+
const resolved = resolve(f);
|
|
467
|
+
if (!seenSkillPaths.has(resolved)) {
|
|
468
|
+
seenSkillPaths.add(resolved);
|
|
469
|
+
allSkillPaths.push(f);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
for (const skillFileRel of SKILL_FILES) {
|
|
475
|
+
const skillFile = join(home, skillFileRel);
|
|
476
|
+
if (isFile(skillFile)) {
|
|
477
|
+
const resolved = resolve(skillFile);
|
|
478
|
+
if (!seenSkillPaths.has(resolved)) {
|
|
479
|
+
seenSkillPaths.add(resolved);
|
|
480
|
+
allSkillPaths.push(skillFile);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
let cwd;
|
|
485
|
+
try {
|
|
486
|
+
cwd = process.cwd();
|
|
487
|
+
} catch {
|
|
488
|
+
cwd = null;
|
|
489
|
+
}
|
|
490
|
+
if (cwd) {
|
|
491
|
+
_scanProjectDir(cwd, allMCPServers, allSkillPaths, seenSkillPaths);
|
|
492
|
+
}
|
|
493
|
+
const seenServers = /* @__PURE__ */ new Set();
|
|
494
|
+
const uniqueServers = [];
|
|
495
|
+
for (const srv of allMCPServers) {
|
|
496
|
+
const cmd = srv.command ?? srv.url ?? "";
|
|
497
|
+
const id = Array.isArray(cmd) ? cmd.join(" ") : String(cmd);
|
|
498
|
+
const key = `${srv.name}::${id}`;
|
|
499
|
+
if (!seenServers.has(key)) {
|
|
500
|
+
seenServers.add(key);
|
|
501
|
+
uniqueServers.push(srv);
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
return { agents, mcpServers: uniqueServers, skillPaths: allSkillPaths };
|
|
505
|
+
}
|
|
506
|
+
function scanDirectory(directory) {
|
|
507
|
+
const dir = resolve(directory);
|
|
508
|
+
if (!isDir(dir)) return { agents: [], mcpServers: [], skillPaths: [] };
|
|
509
|
+
const mcpServers = [];
|
|
510
|
+
const skillPaths = [];
|
|
511
|
+
const seenSkillPaths = /* @__PURE__ */ new Set();
|
|
512
|
+
_scanProjectDir(dir, mcpServers, skillPaths, seenSkillPaths);
|
|
513
|
+
return { agents: [], mcpServers, skillPaths };
|
|
514
|
+
}
|
|
515
|
+
function _scanProjectDir(dir, mcpServers, skillPaths, seenSkillPaths) {
|
|
516
|
+
for (const [relPath, mcpKey, fmt] of PROJECT_MCP_CONFIGS) {
|
|
517
|
+
const mcpFile = join(dir, relPath);
|
|
518
|
+
if (!isFile(mcpFile)) continue;
|
|
519
|
+
const data = readJsonSafe(mcpFile, fmt);
|
|
520
|
+
if (data === null) continue;
|
|
521
|
+
const servers = data[mcpKey];
|
|
522
|
+
if (typeof servers === "object" && servers !== null && !Array.isArray(servers)) {
|
|
523
|
+
for (const [srvName, srvCfg] of Object.entries(servers)) {
|
|
524
|
+
if (typeof srvCfg !== "object" || srvCfg === null) continue;
|
|
525
|
+
mcpServers.push({
|
|
526
|
+
name: srvName,
|
|
527
|
+
source_file: mcpFile,
|
|
528
|
+
agent_type: "project",
|
|
529
|
+
...srvCfg
|
|
530
|
+
});
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
for (const skillFileRel of PROJECT_SKILL_FILES) {
|
|
535
|
+
const candidate = join(dir, skillFileRel);
|
|
536
|
+
if (isFile(candidate)) {
|
|
537
|
+
const resolved = resolve(candidate);
|
|
538
|
+
if (!seenSkillPaths.has(resolved)) {
|
|
539
|
+
seenSkillPaths.add(resolved);
|
|
540
|
+
skillPaths.push(candidate);
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
for (const f of globPrefix(dir, ".clinerules-")) {
|
|
545
|
+
const resolved = resolve(f);
|
|
546
|
+
if (!seenSkillPaths.has(resolved)) {
|
|
547
|
+
seenSkillPaths.add(resolved);
|
|
548
|
+
skillPaths.push(f);
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
for (const skillDirRel of PROJECT_SKILL_DIRS) {
|
|
552
|
+
const skillDir = join(dir, skillDirRel);
|
|
553
|
+
if (isDir(skillDir)) {
|
|
554
|
+
for (const f of rglob(skillDir, ["*.md"])) {
|
|
555
|
+
const resolved = resolve(f);
|
|
556
|
+
if (!seenSkillPaths.has(resolved)) {
|
|
557
|
+
seenSkillPaths.add(resolved);
|
|
558
|
+
skillPaths.push(f);
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
var MAX_SKILL_SIZE, PROJECT_MCP_CONFIGS, PROJECT_SKILL_FILES, PROJECT_SKILL_DIRS, SKILL_DIRS, SKILL_FILES;
|
|
565
|
+
var init_machine_discovery = __esm({
|
|
566
|
+
"src/machine-discovery.ts"() {
|
|
567
|
+
MAX_SKILL_SIZE = 10 * 1024 * 1024;
|
|
568
|
+
PROJECT_MCP_CONFIGS = [
|
|
569
|
+
[".mcp.json", "mcpServers", null],
|
|
570
|
+
[".cursor/mcp.json", "mcpServers", null],
|
|
571
|
+
[".vscode/mcp.json", "servers", "jsonc"],
|
|
572
|
+
["mcp_config.json", "servers", null],
|
|
573
|
+
["mcp.json", "mcpServers", null],
|
|
574
|
+
[".kiro/settings/mcp.json", "mcpServers", null],
|
|
575
|
+
[".kilocode/mcp.json", "mcpServers", null],
|
|
576
|
+
[".roo/mcp.json", "mcpServers", null],
|
|
577
|
+
[".trae/mcp.json", "mcpServers", null],
|
|
578
|
+
[".amazonq/mcp.json", "mcpServers", null],
|
|
579
|
+
[".copilot/mcp-config.json", "mcpServers", null],
|
|
580
|
+
[".junie/mcp/mcp.json", "mcpServers", null],
|
|
581
|
+
[".grok/settings.json", "mcpServers", null]
|
|
582
|
+
];
|
|
583
|
+
PROJECT_SKILL_FILES = [
|
|
584
|
+
".cursorrules",
|
|
585
|
+
".windsurfrules",
|
|
586
|
+
"CLAUDE.md",
|
|
587
|
+
".claude/CLAUDE.md",
|
|
588
|
+
"AGENTS.md",
|
|
589
|
+
".github/copilot-instructions.md",
|
|
590
|
+
"GEMINI.md",
|
|
591
|
+
".junie/guidelines.md",
|
|
592
|
+
".roomodes"
|
|
593
|
+
];
|
|
594
|
+
PROJECT_SKILL_DIRS = [
|
|
595
|
+
".cursor/rules",
|
|
596
|
+
".roo/rules",
|
|
597
|
+
".kiro/rules",
|
|
598
|
+
".trae/rules",
|
|
599
|
+
".junie/rules",
|
|
600
|
+
".qwen/skills",
|
|
601
|
+
".windsurf/rules"
|
|
602
|
+
];
|
|
603
|
+
SKILL_DIRS = [
|
|
604
|
+
".openclaw/skills",
|
|
605
|
+
".openclaw/workspace/skills",
|
|
606
|
+
".cursor/rules",
|
|
607
|
+
".roo/rules",
|
|
608
|
+
".continue/rules",
|
|
609
|
+
".trae/rules",
|
|
610
|
+
".kiro/rules",
|
|
611
|
+
".qwen/skills"
|
|
612
|
+
];
|
|
613
|
+
SKILL_FILES = [
|
|
614
|
+
".cursorrules",
|
|
615
|
+
".claude/CLAUDE.md",
|
|
616
|
+
".github/copilot-instructions.md",
|
|
617
|
+
".windsurfrules",
|
|
618
|
+
"AGENTS.md",
|
|
619
|
+
"CLAUDE.md",
|
|
620
|
+
"GEMINI.md"
|
|
621
|
+
];
|
|
622
|
+
}
|
|
623
|
+
});
|
|
624
|
+
|
|
625
|
+
export {
|
|
626
|
+
PROJECT_MCP_CONFIGS,
|
|
627
|
+
PROJECT_SKILL_FILES,
|
|
628
|
+
PROJECT_SKILL_DIRS,
|
|
629
|
+
getWellKnownConfigs,
|
|
630
|
+
stripJsonComments,
|
|
631
|
+
scanMachine,
|
|
632
|
+
scanDirectory,
|
|
633
|
+
machine_discovery_exports,
|
|
634
|
+
init_machine_discovery
|
|
635
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __esm = (fn, res) => function __init() {
|
|
7
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
8
|
+
};
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
|
+
|
|
23
|
+
export {
|
|
24
|
+
__esm,
|
|
25
|
+
__export,
|
|
26
|
+
__toCommonJS
|
|
27
|
+
};
|