@baton-dx/cli 0.1.0 → 0.1.2

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.
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import { n as detectInstalledAgents, t as clearAgentCache } from "./agent-detection-C5gaTtah.mjs";
3
+
4
+ export { detectInstalledAgents };
@@ -0,0 +1,501 @@
1
+ #!/usr/bin/env node
2
+ import { access, constants } from "node:fs/promises";
3
+ import { join } from "node:path";
4
+ import { homedir } from "node:os";
5
+
6
+ //#region ../agent-paths/src/registry.ts
7
+ /**
8
+ * Registry of all supported AI agents and their path configurations.
9
+ * Each agent defines where it expects skills, rules, agents, memory, settings, and commands.
10
+ */
11
+ const AGENT_PATHS = [
12
+ {
13
+ key: "claude-code",
14
+ name: "Claude Code",
15
+ skills: {
16
+ project: ".claude/skills/{name}",
17
+ global: "~/.claude/skills/{name}"
18
+ },
19
+ rules: {
20
+ project: ".claude/rules/{name}.md",
21
+ global: "~/.claude/rules/{name}.md"
22
+ },
23
+ agents: {
24
+ project: ".claude/agents/{name}.md",
25
+ global: "~/.claude/agents/{name}.md"
26
+ },
27
+ memory: {
28
+ project: "CLAUDE.md",
29
+ global: "~/.claude/CLAUDE.md"
30
+ },
31
+ settings: {
32
+ project: ".claude/settings.json",
33
+ global: "~/.claude/settings.json"
34
+ },
35
+ commands: {
36
+ project: ".claude/commands/{name}.md",
37
+ global: "~/.claude/commands/{name}.md"
38
+ },
39
+ detection: ["claude", "~/.claude/"],
40
+ legacy: {}
41
+ },
42
+ {
43
+ key: "cursor",
44
+ name: "Cursor",
45
+ skills: {
46
+ project: ".cursor/skills/{name}",
47
+ global: "~/.cursor/skills/{name}"
48
+ },
49
+ rules: {
50
+ project: ".cursor/rules/{name}.mdc",
51
+ global: "~/.cursor/rules/{name}.mdc"
52
+ },
53
+ agents: {
54
+ project: ".cursor/agents/{name}.md",
55
+ global: "~/.cursor/agents/{name}.md"
56
+ },
57
+ memory: {
58
+ project: "AGENTS.md",
59
+ global: "~/.cursor/AGENTS.md"
60
+ },
61
+ settings: {
62
+ project: ".cursor/settings.json",
63
+ global: "~/.cursor/settings.json"
64
+ },
65
+ commands: {
66
+ project: ".cursor/commands/{name}.md",
67
+ global: "~/.cursor/commands/{name}.md"
68
+ },
69
+ detection: ["cursor", "~/.cursor/"],
70
+ legacy: { rules: [".cursorrules"] }
71
+ },
72
+ {
73
+ key: "windsurf",
74
+ name: "Windsurf",
75
+ skills: {
76
+ project: ".windsurf/skills/{name}",
77
+ global: "~/.codeium/windsurf/skills/{name}"
78
+ },
79
+ rules: {
80
+ project: ".windsurf/rules/{name}.md",
81
+ global: "~/.codeium/windsurf/rules/{name}.md"
82
+ },
83
+ agents: {
84
+ project: ".windsurf/agents/{name}.md",
85
+ global: "~/.codeium/windsurf/agents/{name}.md"
86
+ },
87
+ memory: {
88
+ project: "AGENTS.md",
89
+ global: "~/.codeium/windsurf/AGENTS.md"
90
+ },
91
+ settings: {
92
+ project: ".windsurf/settings.json",
93
+ global: "~/.codeium/windsurf/settings.json"
94
+ },
95
+ commands: {
96
+ project: ".windsurf/workflows/{name}.md",
97
+ global: "~/.codeium/windsurf/workflows/{name}.md"
98
+ },
99
+ detection: ["windsurf", "~/.codeium/windsurf/"],
100
+ legacy: { rules: [".windsurfrules"] }
101
+ },
102
+ {
103
+ key: "antigravity",
104
+ name: "Antigravity",
105
+ skills: {
106
+ project: ".agent/skills/{name}",
107
+ global: "~/.gemini/antigravity/skills/{name}"
108
+ },
109
+ rules: {
110
+ project: ".agent/rules/{name}.md",
111
+ global: "~/.gemini/antigravity/rules/{name}.md"
112
+ },
113
+ agents: {
114
+ project: ".agent/agents/{name}.md",
115
+ global: "~/.gemini/antigravity/agents/{name}.md"
116
+ },
117
+ memory: {
118
+ project: "GEMINI.md",
119
+ global: "~/.gemini/antigravity/GEMINI.md"
120
+ },
121
+ settings: {
122
+ project: ".agent/settings.json",
123
+ global: "~/.gemini/antigravity/settings.json"
124
+ },
125
+ commands: {
126
+ project: ".agent/workflows/{name}.md",
127
+ global: "~/.gemini/antigravity/workflows/{name}.md"
128
+ },
129
+ detection: ["antigravity", "~/.gemini/antigravity/"],
130
+ legacy: {}
131
+ },
132
+ {
133
+ key: "codex",
134
+ name: "Codex CLI",
135
+ skills: {
136
+ project: ".codex/skills/{name}",
137
+ global: "~/.codex/skills/{name}"
138
+ },
139
+ rules: {
140
+ project: ".codex/rules/{name}.md",
141
+ global: "~/.codex/rules/{name}.md"
142
+ },
143
+ agents: {
144
+ project: ".codex/agents/{name}.md",
145
+ global: "~/.codex/agents/{name}.md"
146
+ },
147
+ memory: {
148
+ project: "AGENTS.md",
149
+ global: "~/.codex/AGENTS.md"
150
+ },
151
+ settings: {
152
+ project: ".codex/config.toml",
153
+ global: "~/.codex/config.toml"
154
+ },
155
+ commands: {
156
+ project: ".codex/commands/{name}.md",
157
+ global: "~/.codex/commands/{name}.md"
158
+ },
159
+ detection: ["codex", "~/.codex/"],
160
+ legacy: {}
161
+ },
162
+ {
163
+ key: "github-copilot",
164
+ name: "GitHub Copilot",
165
+ skills: {
166
+ project: ".github/skills/{name}",
167
+ global: "~/.github/skills/{name}"
168
+ },
169
+ rules: {
170
+ project: ".github/copilot-instructions.md",
171
+ global: "~/.github/copilot-instructions.md"
172
+ },
173
+ agents: {
174
+ project: ".github/agents/{name}.md",
175
+ global: "~/.github/agents/{name}.md"
176
+ },
177
+ memory: {
178
+ project: ".github/copilot-instructions.md",
179
+ global: "~/.github/copilot-instructions.md"
180
+ },
181
+ settings: {
182
+ project: ".github/copilot/settings.json",
183
+ global: "~/.github/copilot/settings.json"
184
+ },
185
+ commands: {
186
+ project: ".github/copilot/commands/{name}.md",
187
+ global: "~/.github/copilot/commands/{name}.md"
188
+ },
189
+ detection: ["gh", "~/.github/"],
190
+ legacy: {}
191
+ },
192
+ {
193
+ key: "opencode",
194
+ name: "OpenCode",
195
+ skills: {
196
+ project: ".opencode/skills/{name}",
197
+ global: "~/.config/opencode/skills/{name}"
198
+ },
199
+ rules: {
200
+ project: ".opencode/rules/{name}.md",
201
+ global: "~/.config/opencode/rules/{name}.md"
202
+ },
203
+ agents: {
204
+ project: ".opencode/agents/{name}.md",
205
+ global: "~/.config/opencode/agents/{name}.md"
206
+ },
207
+ memory: {
208
+ project: "AGENTS.md",
209
+ global: "~/.config/opencode/AGENTS.md"
210
+ },
211
+ settings: {
212
+ project: ".opencode/settings.json",
213
+ global: "~/.config/opencode/settings.json"
214
+ },
215
+ commands: {
216
+ project: ".opencode/commands/{name}.md",
217
+ global: "~/.config/opencode/commands/{name}.md"
218
+ },
219
+ detection: ["opencode", "~/.config/opencode/"],
220
+ legacy: {}
221
+ },
222
+ {
223
+ key: "amp",
224
+ name: "Amp",
225
+ skills: {
226
+ project: ".agents/skills/{name}",
227
+ global: "~/.config/agents/skills/{name}"
228
+ },
229
+ rules: {
230
+ project: ".agents/rules/{name}.md",
231
+ global: "~/.config/agents/rules/{name}.md"
232
+ },
233
+ agents: {
234
+ project: ".agents/agents/{name}.md",
235
+ global: "~/.config/agents/agents/{name}.md"
236
+ },
237
+ memory: {
238
+ project: "AGENTS.md",
239
+ global: "~/.config/agents/AGENTS.md"
240
+ },
241
+ settings: {
242
+ project: ".agents/settings.json",
243
+ global: "~/.config/agents/settings.json"
244
+ },
245
+ commands: {
246
+ project: ".agents/commands/{name}.md",
247
+ global: "~/.config/agents/commands/{name}.md"
248
+ },
249
+ detection: ["amp", "~/.config/agents/"],
250
+ legacy: {}
251
+ },
252
+ {
253
+ key: "kiro",
254
+ name: "Kiro",
255
+ skills: {
256
+ project: ".kiro/skills/{name}",
257
+ global: "~/.kiro/skills/{name}"
258
+ },
259
+ rules: {
260
+ project: ".kiro/rules/{name}.md",
261
+ global: "~/.kiro/rules/{name}.md"
262
+ },
263
+ agents: {
264
+ project: ".kiro/agents/{name}.md",
265
+ global: "~/.kiro/agents/{name}.md"
266
+ },
267
+ memory: {
268
+ project: "AGENTS.md",
269
+ global: "~/.kiro/AGENTS.md"
270
+ },
271
+ settings: {
272
+ project: ".kiro/settings.json",
273
+ global: "~/.kiro/settings.json"
274
+ },
275
+ commands: {
276
+ project: ".kiro/commands/{name}.md",
277
+ global: "~/.kiro/commands/{name}.md"
278
+ },
279
+ detection: ["kiro", "~/.kiro/"],
280
+ legacy: {}
281
+ },
282
+ {
283
+ key: "zed",
284
+ name: "Zed",
285
+ skills: {
286
+ project: ".zed/skills/{name}",
287
+ global: "~/.zed/skills/{name}"
288
+ },
289
+ rules: {
290
+ project: ".zed/rules/{name}.md",
291
+ global: "~/.zed/rules/{name}.md"
292
+ },
293
+ agents: {
294
+ project: ".zed/agents/{name}.md",
295
+ global: "~/.zed/agents/{name}.md"
296
+ },
297
+ memory: {
298
+ project: "AGENTS.md",
299
+ global: "~/.zed/AGENTS.md"
300
+ },
301
+ settings: {
302
+ project: ".zed/settings.json",
303
+ global: "~/.zed/settings.json"
304
+ },
305
+ commands: {
306
+ project: ".zed/commands/{name}.md",
307
+ global: "~/.zed/commands/{name}.md"
308
+ },
309
+ detection: ["zed", "~/.zed/"],
310
+ legacy: {}
311
+ },
312
+ {
313
+ key: "cline",
314
+ name: "Cline",
315
+ skills: {
316
+ project: ".cline/skills/{name}",
317
+ global: "~/.cline/skills/{name}"
318
+ },
319
+ rules: {
320
+ project: ".cline/rules/{name}.md",
321
+ global: "~/.cline/rules/{name}.md"
322
+ },
323
+ agents: {
324
+ project: ".cline/agents/{name}.md",
325
+ global: "~/.cline/agents/{name}.md"
326
+ },
327
+ memory: {
328
+ project: "AGENTS.md",
329
+ global: "~/.cline/AGENTS.md"
330
+ },
331
+ settings: {
332
+ project: ".cline/settings.json",
333
+ global: "~/.cline/settings.json"
334
+ },
335
+ commands: {
336
+ project: ".cline/commands/{name}.md",
337
+ global: "~/.cline/commands/{name}.md"
338
+ },
339
+ detection: ["cline", "~/.cline/"],
340
+ legacy: {}
341
+ },
342
+ {
343
+ key: "roo",
344
+ name: "Roo",
345
+ skills: {
346
+ project: ".roo/skills/{name}",
347
+ global: "~/.roo/skills/{name}"
348
+ },
349
+ rules: {
350
+ project: ".roo/rules/{name}.md",
351
+ global: "~/.roo/rules/{name}.md"
352
+ },
353
+ agents: {
354
+ project: ".roo/agents/{name}.md",
355
+ global: "~/.roo/agents/{name}.md"
356
+ },
357
+ memory: {
358
+ project: "AGENTS.md",
359
+ global: "~/.roo/AGENTS.md"
360
+ },
361
+ settings: {
362
+ project: ".roo/settings.json",
363
+ global: "~/.roo/settings.json"
364
+ },
365
+ commands: {
366
+ project: ".roo/commands/{name}.md",
367
+ global: "~/.roo/commands/{name}.md"
368
+ },
369
+ detection: ["roo", "~/.roo/"],
370
+ legacy: {}
371
+ },
372
+ {
373
+ key: "junie",
374
+ name: "Junie",
375
+ skills: {
376
+ project: ".junie/skills/{name}",
377
+ global: "~/.junie/skills/{name}"
378
+ },
379
+ rules: {
380
+ project: ".junie/rules/{name}.md",
381
+ global: "~/.junie/rules/{name}.md"
382
+ },
383
+ agents: {
384
+ project: ".junie/agents/{name}.md",
385
+ global: "~/.junie/agents/{name}.md"
386
+ },
387
+ memory: {
388
+ project: "AGENTS.md",
389
+ global: "~/.junie/AGENTS.md"
390
+ },
391
+ settings: {
392
+ project: ".junie/settings.json",
393
+ global: "~/.junie/settings.json"
394
+ },
395
+ commands: {
396
+ project: ".junie/commands/{name}.md",
397
+ global: "~/.junie/commands/{name}.md"
398
+ },
399
+ detection: ["junie", "~/.junie/"],
400
+ legacy: {}
401
+ },
402
+ {
403
+ key: "trae",
404
+ name: "Trae",
405
+ skills: {
406
+ project: ".trae/skills/{name}",
407
+ global: "~/.trae/skills/{name}"
408
+ },
409
+ rules: {
410
+ project: ".trae/rules/{name}.md",
411
+ global: "~/.trae/rules/{name}.md"
412
+ },
413
+ agents: {
414
+ project: ".trae/agents/{name}.md",
415
+ global: "~/.trae/agents/{name}.md"
416
+ },
417
+ memory: {
418
+ project: "AGENTS.md",
419
+ global: "~/.trae/AGENTS.md"
420
+ },
421
+ settings: {
422
+ project: ".trae/settings.json",
423
+ global: "~/.trae/settings.json"
424
+ },
425
+ commands: {
426
+ project: ".trae/commands/{name}.md",
427
+ global: "~/.trae/commands/{name}.md"
428
+ },
429
+ detection: ["trae", "~/.trae/"],
430
+ legacy: {}
431
+ }
432
+ ];
433
+
434
+ //#endregion
435
+ //#region ../core/src/detection/agent-detection.ts
436
+ /**
437
+ * Cache for detected agents (valid for process lifetime)
438
+ */
439
+ let cachedAgents = null;
440
+ /**
441
+ * Check if a command exists in PATH
442
+ */
443
+ async function commandExists(command) {
444
+ try {
445
+ const { execa } = await import("./execa-RdtdAT4S.mjs");
446
+ await execa("which", [command]);
447
+ return true;
448
+ } catch {
449
+ return false;
450
+ }
451
+ }
452
+ /**
453
+ * Check if a directory exists
454
+ */
455
+ async function directoryExists(path) {
456
+ try {
457
+ await access(path, constants.R_OK);
458
+ return true;
459
+ } catch {
460
+ return false;
461
+ }
462
+ }
463
+ /**
464
+ * Detect if a specific agent is installed
465
+ */
466
+ async function isAgentInstalled(agentKey) {
467
+ const agentConfig = AGENT_PATHS.find((agent) => agent.key === agentKey);
468
+ if (!agentConfig) return false;
469
+ for (const detection of agentConfig.detection) if (detection.startsWith("~/")) {
470
+ if (await directoryExists(join(homedir(), detection.slice(2)))) return true;
471
+ } else if (detection.startsWith(".")) {
472
+ if (await directoryExists(join(homedir(), detection))) return true;
473
+ } else if (await commandExists(detection)) return true;
474
+ return false;
475
+ }
476
+ /**
477
+ * Detect all installed AI agents
478
+ * Results are cached for the duration of the process
479
+ */
480
+ async function detectInstalledAgents() {
481
+ if (cachedAgents !== null) return cachedAgents;
482
+ const installedAgents = [];
483
+ const detectionPromises = AGENT_PATHS.map(async (agent) => {
484
+ return await isAgentInstalled(agent.key) ? agent.key : null;
485
+ });
486
+ const results = await Promise.all(detectionPromises);
487
+ for (const result of results) if (result !== null) installedAgents.push(result);
488
+ cachedAgents = installedAgents;
489
+ return installedAgents;
490
+ }
491
+ /**
492
+ * Clear the agent detection cache
493
+ * Useful for testing or when agent installation state may have changed
494
+ */
495
+ function clearAgentCache() {
496
+ cachedAgents = null;
497
+ }
498
+
499
+ //#endregion
500
+ export { detectInstalledAgents as n, AGENT_PATHS as r, clearAgentCache as t };
501
+ //# sourceMappingURL=agent-detection-C5gaTtah.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-detection-C5gaTtah.mjs","names":[],"sources":["../../agent-paths/src/registry.ts","../../core/src/detection/agent-detection.ts"],"sourcesContent":["import type { AgentPathConfig } from \"./types.js\";\n\n/**\n * Registry of all supported AI agents and their path configurations.\n * Each agent defines where it expects skills, rules, agents, memory, settings, and commands.\n */\nexport const AGENT_PATHS: readonly AgentPathConfig[] = [\n {\n key: \"claude-code\",\n name: \"Claude Code\",\n skills: {\n project: \".claude/skills/{name}\",\n global: \"~/.claude/skills/{name}\",\n },\n rules: {\n project: \".claude/rules/{name}.md\",\n global: \"~/.claude/rules/{name}.md\",\n },\n agents: {\n project: \".claude/agents/{name}.md\",\n global: \"~/.claude/agents/{name}.md\",\n },\n memory: {\n project: \"CLAUDE.md\",\n global: \"~/.claude/CLAUDE.md\",\n },\n settings: {\n project: \".claude/settings.json\",\n global: \"~/.claude/settings.json\",\n },\n commands: {\n project: \".claude/commands/{name}.md\",\n global: \"~/.claude/commands/{name}.md\",\n },\n detection: [\"claude\", \"~/.claude/\"],\n legacy: {},\n },\n {\n key: \"cursor\",\n name: \"Cursor\",\n skills: {\n project: \".cursor/skills/{name}\",\n global: \"~/.cursor/skills/{name}\",\n },\n rules: {\n project: \".cursor/rules/{name}.mdc\",\n global: \"~/.cursor/rules/{name}.mdc\",\n },\n agents: {\n project: \".cursor/agents/{name}.md\",\n global: \"~/.cursor/agents/{name}.md\",\n },\n memory: {\n project: \"AGENTS.md\",\n global: \"~/.cursor/AGENTS.md\",\n },\n settings: {\n project: \".cursor/settings.json\",\n global: \"~/.cursor/settings.json\",\n },\n commands: {\n project: \".cursor/commands/{name}.md\",\n global: \"~/.cursor/commands/{name}.md\",\n },\n detection: [\"cursor\", \"~/.cursor/\"],\n legacy: {\n rules: [\".cursorrules\"],\n },\n },\n {\n key: \"windsurf\",\n name: \"Windsurf\",\n skills: {\n project: \".windsurf/skills/{name}\",\n global: \"~/.codeium/windsurf/skills/{name}\",\n },\n rules: {\n project: \".windsurf/rules/{name}.md\",\n global: \"~/.codeium/windsurf/rules/{name}.md\",\n },\n agents: {\n project: \".windsurf/agents/{name}.md\",\n global: \"~/.codeium/windsurf/agents/{name}.md\",\n },\n memory: {\n project: \"AGENTS.md\",\n global: \"~/.codeium/windsurf/AGENTS.md\",\n },\n settings: {\n project: \".windsurf/settings.json\",\n global: \"~/.codeium/windsurf/settings.json\",\n },\n commands: {\n project: \".windsurf/workflows/{name}.md\",\n global: \"~/.codeium/windsurf/workflows/{name}.md\",\n },\n detection: [\"windsurf\", \"~/.codeium/windsurf/\"],\n legacy: {\n rules: [\".windsurfrules\"],\n },\n },\n {\n key: \"antigravity\",\n name: \"Antigravity\",\n skills: {\n project: \".agent/skills/{name}\",\n global: \"~/.gemini/antigravity/skills/{name}\",\n },\n rules: {\n project: \".agent/rules/{name}.md\",\n global: \"~/.gemini/antigravity/rules/{name}.md\",\n },\n agents: {\n project: \".agent/agents/{name}.md\",\n global: \"~/.gemini/antigravity/agents/{name}.md\",\n },\n memory: {\n project: \"GEMINI.md\",\n global: \"~/.gemini/antigravity/GEMINI.md\",\n },\n settings: {\n project: \".agent/settings.json\",\n global: \"~/.gemini/antigravity/settings.json\",\n },\n commands: {\n project: \".agent/workflows/{name}.md\",\n global: \"~/.gemini/antigravity/workflows/{name}.md\",\n },\n detection: [\"antigravity\", \"~/.gemini/antigravity/\"],\n legacy: {},\n },\n {\n key: \"codex\",\n name: \"Codex CLI\",\n skills: {\n project: \".codex/skills/{name}\",\n global: \"~/.codex/skills/{name}\",\n },\n rules: {\n project: \".codex/rules/{name}.md\",\n global: \"~/.codex/rules/{name}.md\",\n },\n agents: {\n project: \".codex/agents/{name}.md\",\n global: \"~/.codex/agents/{name}.md\",\n },\n memory: {\n project: \"AGENTS.md\",\n global: \"~/.codex/AGENTS.md\",\n },\n settings: {\n project: \".codex/config.toml\",\n global: \"~/.codex/config.toml\",\n },\n commands: {\n project: \".codex/commands/{name}.md\",\n global: \"~/.codex/commands/{name}.md\",\n },\n detection: [\"codex\", \"~/.codex/\"],\n legacy: {},\n },\n {\n key: \"github-copilot\",\n name: \"GitHub Copilot\",\n skills: {\n project: \".github/skills/{name}\",\n global: \"~/.github/skills/{name}\",\n },\n rules: {\n project: \".github/copilot-instructions.md\",\n global: \"~/.github/copilot-instructions.md\",\n },\n agents: {\n project: \".github/agents/{name}.md\",\n global: \"~/.github/agents/{name}.md\",\n },\n memory: {\n project: \".github/copilot-instructions.md\",\n global: \"~/.github/copilot-instructions.md\",\n },\n settings: {\n project: \".github/copilot/settings.json\",\n global: \"~/.github/copilot/settings.json\",\n },\n commands: {\n project: \".github/copilot/commands/{name}.md\",\n global: \"~/.github/copilot/commands/{name}.md\",\n },\n detection: [\"gh\", \"~/.github/\"],\n legacy: {},\n },\n {\n key: \"opencode\",\n name: \"OpenCode\",\n skills: {\n project: \".opencode/skills/{name}\",\n global: \"~/.config/opencode/skills/{name}\",\n },\n rules: {\n project: \".opencode/rules/{name}.md\",\n global: \"~/.config/opencode/rules/{name}.md\",\n },\n agents: {\n project: \".opencode/agents/{name}.md\",\n global: \"~/.config/opencode/agents/{name}.md\",\n },\n memory: {\n project: \"AGENTS.md\",\n global: \"~/.config/opencode/AGENTS.md\",\n },\n settings: {\n project: \".opencode/settings.json\",\n global: \"~/.config/opencode/settings.json\",\n },\n commands: {\n project: \".opencode/commands/{name}.md\",\n global: \"~/.config/opencode/commands/{name}.md\",\n },\n detection: [\"opencode\", \"~/.config/opencode/\"],\n legacy: {},\n },\n {\n key: \"amp\",\n name: \"Amp\",\n skills: {\n project: \".agents/skills/{name}\",\n global: \"~/.config/agents/skills/{name}\",\n },\n rules: {\n project: \".agents/rules/{name}.md\",\n global: \"~/.config/agents/rules/{name}.md\",\n },\n agents: {\n project: \".agents/agents/{name}.md\",\n global: \"~/.config/agents/agents/{name}.md\",\n },\n memory: {\n project: \"AGENTS.md\",\n global: \"~/.config/agents/AGENTS.md\",\n },\n settings: {\n project: \".agents/settings.json\",\n global: \"~/.config/agents/settings.json\",\n },\n commands: {\n project: \".agents/commands/{name}.md\",\n global: \"~/.config/agents/commands/{name}.md\",\n },\n detection: [\"amp\", \"~/.config/agents/\"],\n legacy: {},\n },\n {\n key: \"kiro\",\n name: \"Kiro\",\n skills: {\n project: \".kiro/skills/{name}\",\n global: \"~/.kiro/skills/{name}\",\n },\n rules: {\n project: \".kiro/rules/{name}.md\",\n global: \"~/.kiro/rules/{name}.md\",\n },\n agents: {\n project: \".kiro/agents/{name}.md\",\n global: \"~/.kiro/agents/{name}.md\",\n },\n memory: {\n project: \"AGENTS.md\",\n global: \"~/.kiro/AGENTS.md\",\n },\n settings: {\n project: \".kiro/settings.json\",\n global: \"~/.kiro/settings.json\",\n },\n commands: {\n project: \".kiro/commands/{name}.md\",\n global: \"~/.kiro/commands/{name}.md\",\n },\n detection: [\"kiro\", \"~/.kiro/\"],\n legacy: {},\n },\n {\n key: \"zed\",\n name: \"Zed\",\n skills: {\n project: \".zed/skills/{name}\",\n global: \"~/.zed/skills/{name}\",\n },\n rules: {\n project: \".zed/rules/{name}.md\",\n global: \"~/.zed/rules/{name}.md\",\n },\n agents: {\n project: \".zed/agents/{name}.md\",\n global: \"~/.zed/agents/{name}.md\",\n },\n memory: {\n project: \"AGENTS.md\",\n global: \"~/.zed/AGENTS.md\",\n },\n settings: {\n project: \".zed/settings.json\",\n global: \"~/.zed/settings.json\",\n },\n commands: {\n project: \".zed/commands/{name}.md\",\n global: \"~/.zed/commands/{name}.md\",\n },\n detection: [\"zed\", \"~/.zed/\"],\n legacy: {},\n },\n {\n key: \"cline\",\n name: \"Cline\",\n skills: {\n project: \".cline/skills/{name}\",\n global: \"~/.cline/skills/{name}\",\n },\n rules: {\n project: \".cline/rules/{name}.md\",\n global: \"~/.cline/rules/{name}.md\",\n },\n agents: {\n project: \".cline/agents/{name}.md\",\n global: \"~/.cline/agents/{name}.md\",\n },\n memory: {\n project: \"AGENTS.md\",\n global: \"~/.cline/AGENTS.md\",\n },\n settings: {\n project: \".cline/settings.json\",\n global: \"~/.cline/settings.json\",\n },\n commands: {\n project: \".cline/commands/{name}.md\",\n global: \"~/.cline/commands/{name}.md\",\n },\n detection: [\"cline\", \"~/.cline/\"],\n legacy: {},\n },\n {\n key: \"roo\",\n name: \"Roo\",\n skills: {\n project: \".roo/skills/{name}\",\n global: \"~/.roo/skills/{name}\",\n },\n rules: {\n project: \".roo/rules/{name}.md\",\n global: \"~/.roo/rules/{name}.md\",\n },\n agents: {\n project: \".roo/agents/{name}.md\",\n global: \"~/.roo/agents/{name}.md\",\n },\n memory: {\n project: \"AGENTS.md\",\n global: \"~/.roo/AGENTS.md\",\n },\n settings: {\n project: \".roo/settings.json\",\n global: \"~/.roo/settings.json\",\n },\n commands: {\n project: \".roo/commands/{name}.md\",\n global: \"~/.roo/commands/{name}.md\",\n },\n detection: [\"roo\", \"~/.roo/\"],\n legacy: {},\n },\n {\n key: \"junie\",\n name: \"Junie\",\n skills: {\n project: \".junie/skills/{name}\",\n global: \"~/.junie/skills/{name}\",\n },\n rules: {\n project: \".junie/rules/{name}.md\",\n global: \"~/.junie/rules/{name}.md\",\n },\n agents: {\n project: \".junie/agents/{name}.md\",\n global: \"~/.junie/agents/{name}.md\",\n },\n memory: {\n project: \"AGENTS.md\",\n global: \"~/.junie/AGENTS.md\",\n },\n settings: {\n project: \".junie/settings.json\",\n global: \"~/.junie/settings.json\",\n },\n commands: {\n project: \".junie/commands/{name}.md\",\n global: \"~/.junie/commands/{name}.md\",\n },\n detection: [\"junie\", \"~/.junie/\"],\n legacy: {},\n },\n {\n key: \"trae\",\n name: \"Trae\",\n skills: {\n project: \".trae/skills/{name}\",\n global: \"~/.trae/skills/{name}\",\n },\n rules: {\n project: \".trae/rules/{name}.md\",\n global: \"~/.trae/rules/{name}.md\",\n },\n agents: {\n project: \".trae/agents/{name}.md\",\n global: \"~/.trae/agents/{name}.md\",\n },\n memory: {\n project: \"AGENTS.md\",\n global: \"~/.trae/AGENTS.md\",\n },\n settings: {\n project: \".trae/settings.json\",\n global: \"~/.trae/settings.json\",\n },\n commands: {\n project: \".trae/commands/{name}.md\",\n global: \"~/.trae/commands/{name}.md\",\n },\n detection: [\"trae\", \"~/.trae/\"],\n legacy: {},\n },\n];\n","import { constants, access } from \"node:fs/promises\";\nimport { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport { AGENT_PATHS } from \"@baton-dx/agent-paths\";\n\n/**\n * Cache for detected agents (valid for process lifetime)\n */\nlet cachedAgents: string[] | null = null;\n\n/**\n * Check if a command exists in PATH\n */\nasync function commandExists(command: string): Promise<boolean> {\n try {\n const { execa } = await import(\"execa\");\n await execa(\"which\", [command]);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Check if a directory exists\n */\nasync function directoryExists(path: string): Promise<boolean> {\n try {\n await access(path, constants.R_OK);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Detect if a specific agent is installed\n */\nasync function isAgentInstalled(agentKey: string): Promise<boolean> {\n const agentConfig = AGENT_PATHS.find((agent) => agent.key === agentKey);\n if (!agentConfig) return false;\n\n // Check each detection method\n for (const detection of agentConfig.detection) {\n // If detection string starts with ~/, it's a directory path\n if (detection.startsWith(\"~/\")) {\n const dirPath = join(homedir(), detection.slice(2));\n if (await directoryExists(dirPath)) {\n return true;\n }\n }\n // If detection string starts with ., it's also a directory path relative to home\n else if (detection.startsWith(\".\")) {\n const dirPath = join(homedir(), detection);\n if (await directoryExists(dirPath)) {\n return true;\n }\n }\n // Otherwise, treat it as a CLI binary name\n else {\n if (await commandExists(detection)) {\n return true;\n }\n }\n }\n\n return false;\n}\n\n/**\n * Detect all installed AI agents\n * Results are cached for the duration of the process\n */\nexport async function detectInstalledAgents(): Promise<string[]> {\n // Return cached result if available\n if (cachedAgents !== null) {\n return cachedAgents;\n }\n\n const installedAgents: string[] = [];\n\n // Check each agent in parallel\n const detectionPromises = AGENT_PATHS.map(async (agent) => {\n const isInstalled = await isAgentInstalled(agent.key);\n return isInstalled ? agent.key : null;\n });\n\n const results = await Promise.all(detectionPromises);\n\n // Filter out null results\n for (const result of results) {\n if (result !== null) {\n installedAgents.push(result);\n }\n }\n\n // Cache the result\n cachedAgents = installedAgents;\n\n return installedAgents;\n}\n\n/**\n * Clear the agent detection cache\n * Useful for testing or when agent installation state may have changed\n */\nexport function clearAgentCache(): void {\n cachedAgents = null;\n}\n\n/**\n * Override agent detection with a specific list of agents\n * Used when --agents flag is provided\n */\nexport function setDetectedAgents(agents: string[]): void {\n cachedAgents = [...agents];\n}\n"],"mappings":";;;;;;;;;;AAMA,MAAa,cAA0C;CACrD;EACE,KAAK;EACL,MAAM;EACN,QAAQ;GACN,SAAS;GACT,QAAQ;GACT;EACD,OAAO;GACL,SAAS;GACT,QAAQ;GACT;EACD,QAAQ;GACN,SAAS;GACT,QAAQ;GACT;EACD,QAAQ;GACN,SAAS;GACT,QAAQ;GACT;EACD,UAAU;GACR,SAAS;GACT,QAAQ;GACT;EACD,UAAU;GACR,SAAS;GACT,QAAQ;GACT;EACD,WAAW,CAAC,UAAU,aAAa;EACnC,QAAQ,EAAE;EACX;CACD;EACE,KAAK;EACL,MAAM;EACN,QAAQ;GACN,SAAS;GACT,QAAQ;GACT;EACD,OAAO;GACL,SAAS;GACT,QAAQ;GACT;EACD,QAAQ;GACN,SAAS;GACT,QAAQ;GACT;EACD,QAAQ;GACN,SAAS;GACT,QAAQ;GACT;EACD,UAAU;GACR,SAAS;GACT,QAAQ;GACT;EACD,UAAU;GACR,SAAS;GACT,QAAQ;GACT;EACD,WAAW,CAAC,UAAU,aAAa;EACnC,QAAQ,EACN,OAAO,CAAC,eAAe,EACxB;EACF;CACD;EACE,KAAK;EACL,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node:module";
3
+
4
+ //#region \0rolldown/runtime.js
5
+ var __create = Object.create;
6
+ var __defProp = Object.defineProperty;
7
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
8
+ var __getOwnPropNames = Object.getOwnPropertyNames;
9
+ var __getProtoOf = Object.getPrototypeOf;
10
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
11
+ var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
15
+ key = keys[i];
16
+ if (!__hasOwnProp.call(to, key) && key !== except) {
17
+ __defProp(to, key, {
18
+ get: ((k) => from[k]).bind(null, key),
19
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
20
+ });
21
+ }
22
+ }
23
+ }
24
+ return to;
25
+ };
26
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
27
+ value: mod,
28
+ enumerable: true
29
+ }) : target, mod));
30
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
31
+
32
+ //#endregion
33
+ export { __require as n, __toESM as r, __commonJSMin as t };