@baton-dx/cli 0.3.2 → 0.4.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/dist/ai-tool-detection-BFep6YS9.mjs +4 -0
- package/dist/{agent-detection-DTiVeO5W.mjs → ai-tool-detection-CMsBNa9e.mjs} +26 -82
- package/dist/ai-tool-detection-CMsBNa9e.mjs.map +1 -0
- package/dist/{create-BkpEXaht.mjs → create-SYKl8g0B.mjs} +3 -3
- package/dist/{create-BkpEXaht.mjs.map → create-SYKl8g0B.mjs.map} +1 -1
- package/dist/index.mjs +111 -59
- package/dist/index.mjs.map +1 -1
- package/dist/{list-DSLwzhBG.mjs → list-UzuMEqbc.mjs} +3 -3
- package/dist/{list-DSLwzhBG.mjs.map → list-UzuMEqbc.mjs.map} +1 -1
- package/dist/{src-BCGnnv5D.mjs → src-D41VR6ro.mjs} +140 -70
- package/dist/src-D41VR6ro.mjs.map +1 -0
- package/package.json +2 -2
- package/dist/agent-detection-DTiVeO5W.mjs.map +0 -1
- package/dist/agent-detection-l61K-AbU.mjs +0 -4
- package/dist/src-BCGnnv5D.mjs.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { c as Ve, h as defineCommand, i as Le, l as We, n as isInSourceRepo } from "./context-detection-DqOTnD6_.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import "./
|
|
3
|
+
import { N as discoverProfilesInSourceRepo } from "./src-D41VR6ro.mjs";
|
|
4
|
+
import "./ai-tool-detection-CMsBNa9e.mjs";
|
|
5
5
|
import "./esm-BagM-kVd.mjs";
|
|
6
6
|
|
|
7
7
|
//#region src/commands/profile/list.ts
|
|
@@ -53,4 +53,4 @@ Note: Must be run from a source repository (directory with baton.source.yaml)`
|
|
|
53
53
|
|
|
54
54
|
//#endregion
|
|
55
55
|
export { profileListCommand };
|
|
56
|
-
//# sourceMappingURL=list-
|
|
56
|
+
//# sourceMappingURL=list-UzuMEqbc.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list-
|
|
1
|
+
{"version":3,"file":"list-UzuMEqbc.mjs","names":[],"sources":["../src/commands/profile/list.ts"],"sourcesContent":["import { discoverProfilesInSourceRepo } from \"@baton-dx/core\";\nimport * as p from \"@clack/prompts\";\nimport { defineCommand } from \"citty\";\nimport { isInSourceRepo } from \"../../utils/context-detection.js\";\n\nexport const profileListCommand = defineCommand({\n meta: {\n name: \"profile list\",\n description: `List all profiles in the current source repository\n\nShows a table of all profiles with:\n - Profile name (root profile marked with \"(root)\")\n - Version from baton.profile.yaml\n - Description from profile manifest\n\nExamples:\n baton profile list\n\nNote: Must be run from a source repository (directory with baton.source.yaml)`,\n },\n run: async () => {\n p.intro(\"List Profiles\");\n\n // Check if we're in a source repo\n const inSourceRepo = await isInSourceRepo();\n if (!inSourceRepo) {\n p.outro(\n \"Error: Not in a source repository. Run this command from a directory containing baton.source.yaml\",\n );\n process.exit(1);\n }\n\n const cwd = process.cwd();\n\n // Discover all profiles in the profiles/ directory\n const profiles = await discoverProfilesInSourceRepo(cwd);\n\n if (profiles.length === 0) {\n p.outro(\"No profiles found.\");\n process.exit(0);\n }\n\n // Build table output\n const lines: string[] = [];\n lines.push(\"┌─────────────────────┬─────────┬────────────────────────────────────┐\");\n lines.push(\"│ Name │ Version │ Description │\");\n lines.push(\"├─────────────────────┼─────────┼────────────────────────────────────┤\");\n\n for (const profile of profiles) {\n const name = profile.name;\n const version = profile.version || \"-\";\n const description = profile.description || \"-\";\n\n // Pad columns to fixed width\n const namePadded = name.padEnd(19);\n const versionPadded = version.padEnd(7);\n const descPadded = description.padEnd(34);\n\n lines.push(`│ ${namePadded} │ ${versionPadded} │ ${descPadded} │`);\n }\n\n lines.push(\"└─────────────────────┴─────────┴────────────────────────────────────┘\");\n\n p.note(lines.join(\"\\n\"), \"Profiles\");\n p.outro(`Found ${profiles.length} profile${profiles.length === 1 ? \"\" : \"s\"}`);\n process.exit(0);\n },\n});\n"],"mappings":";;;;;;;AAKA,MAAa,qBAAqB,cAAc;CAC9C,MAAM;EACJ,MAAM;EACN,aAAa;;;;;;;;;;;EAWd;CACD,KAAK,YAAY;AACf,KAAQ,gBAAgB;AAIxB,MAAI,CADiB,MAAM,gBAAgB,EACxB;AACjB,MACE,oGACD;AACD,WAAQ,KAAK,EAAE;;EAMjB,MAAM,WAAW,MAAM,6BAHX,QAAQ,KAAK,CAG+B;AAExD,MAAI,SAAS,WAAW,GAAG;AACzB,MAAQ,qBAAqB;AAC7B,WAAQ,KAAK,EAAE;;EAIjB,MAAM,QAAkB,EAAE;AAC1B,QAAM,KAAK,yEAAyE;AACpF,QAAM,KAAK,yEAAyE;AACpF,QAAM,KAAK,yEAAyE;AAEpF,OAAK,MAAM,WAAW,UAAU;GAC9B,MAAM,OAAO,QAAQ;GACrB,MAAM,UAAU,QAAQ,WAAW;GACnC,MAAM,cAAc,QAAQ,eAAe;GAG3C,MAAM,aAAa,KAAK,OAAO,GAAG;GAClC,MAAM,gBAAgB,QAAQ,OAAO,EAAE;GACvC,MAAM,aAAa,YAAY,OAAO,GAAG;AAEzC,SAAM,KAAK,KAAK,WAAW,KAAK,cAAc,KAAK,WAAW,IAAI;;AAGpE,QAAM,KAAK,yEAAyE;AAEpF,KAAO,MAAM,KAAK,KAAK,EAAE,WAAW;AACpC,KAAQ,SAAS,SAAS,OAAO,UAAU,SAAS,WAAW,IAAI,KAAK,MAAM;AAC9E,UAAQ,KAAK,EAAE;;CAElB,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { n as __require, r as __toESM, t as __commonJSMin } from "./chunk-BbwQpWto.mjs";
|
|
3
3
|
import { m as require_dist } from "./context-detection-DqOTnD6_.mjs";
|
|
4
|
-
import { i as
|
|
4
|
+
import { i as AI_TOOL_PATHS, r as evaluateDetection } from "./ai-tool-detection-CMsBNa9e.mjs";
|
|
5
5
|
import { d as esm_default, m as simpleGit } from "./esm-BagM-kVd.mjs";
|
|
6
6
|
import { access, mkdir, readFile, readdir, rm, rmdir, stat, symlink, unlink, writeFile } from "node:fs/promises";
|
|
7
7
|
import { dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
@@ -10,29 +10,29 @@ import { homedir } from "node:os";
|
|
|
10
10
|
import { createHash } from "node:crypto";
|
|
11
11
|
import { execFile } from "node:child_process";
|
|
12
12
|
|
|
13
|
-
//#region ../
|
|
13
|
+
//#region ../ai-tool-paths/src/types.ts
|
|
14
14
|
/**
|
|
15
15
|
* Error thrown when an agent is not found in the registry
|
|
16
16
|
*/
|
|
17
|
-
var
|
|
17
|
+
var AIToolNotFoundError = class extends Error {
|
|
18
18
|
constructor(message) {
|
|
19
19
|
super(message);
|
|
20
|
-
this.name = "
|
|
20
|
+
this.name = "AIToolNotFoundError";
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
//#endregion
|
|
25
|
-
//#region ../
|
|
25
|
+
//#region ../ai-tool-paths/src/helpers.ts
|
|
26
26
|
/**
|
|
27
27
|
* Retrieves the full agent configuration for a given agent key.
|
|
28
28
|
*
|
|
29
29
|
* @param agentKey - The unique key of the agent (e.g., 'claude-code', 'cursor')
|
|
30
|
-
* @returns The full
|
|
31
|
-
* @throws
|
|
30
|
+
* @returns The full AIToolPathConfig for the agent
|
|
31
|
+
* @throws AIToolNotFoundError if the agent key is not found in the registry
|
|
32
32
|
*/
|
|
33
|
-
function
|
|
34
|
-
const config =
|
|
35
|
-
if (!config) throw new
|
|
33
|
+
function getAIToolConfig(agentKey) {
|
|
34
|
+
const config = AI_TOOL_PATHS.find((agent) => agent.key === agentKey);
|
|
35
|
+
if (!config) throw new AIToolNotFoundError(`Agent with key '${agentKey}' not found in registry`);
|
|
36
36
|
return config;
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
@@ -40,8 +40,8 @@ function getAgentConfig(agentKey) {
|
|
|
40
40
|
*
|
|
41
41
|
* @returns Array of all agent keys
|
|
42
42
|
*/
|
|
43
|
-
function
|
|
44
|
-
return
|
|
43
|
+
function getAllAIToolKeys() {
|
|
44
|
+
return AI_TOOL_PATHS.map((agent) => agent.key);
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
47
|
* Resolves a path template with tilde expansion and name placeholder replacement.
|
|
@@ -60,14 +60,14 @@ function resolvePath(template, name) {
|
|
|
60
60
|
* Retrieves the resolved path for a given agent, config type, scope, and optional name.
|
|
61
61
|
*
|
|
62
62
|
* @param agentKey - The unique key of the agent
|
|
63
|
-
* @param configType - The type of configuration (skills, rules, agents, memory,
|
|
63
|
+
* @param configType - The type of configuration (skills, rules, agents, memory, commands)
|
|
64
64
|
* @param scope - The scope (project or global)
|
|
65
65
|
* @param name - Optional name to replace {name} placeholder
|
|
66
66
|
* @returns Resolved path string
|
|
67
|
-
* @throws
|
|
67
|
+
* @throws AIToolNotFoundError if the agent key is not found
|
|
68
68
|
*/
|
|
69
|
-
function
|
|
70
|
-
const pathTemplate =
|
|
69
|
+
function getAIToolPath(agentKey, configType, scope, name) {
|
|
70
|
+
const pathTemplate = getAIToolConfig(agentKey)[configType][scope];
|
|
71
71
|
return resolvePath(pathTemplate, name);
|
|
72
72
|
}
|
|
73
73
|
|
|
@@ -114,7 +114,7 @@ var VersionNotFoundError = class extends BatonError {
|
|
|
114
114
|
/**
|
|
115
115
|
* Thrown when an adapter is not found for a given agent key
|
|
116
116
|
*/
|
|
117
|
-
var
|
|
117
|
+
var AIToolAdapterNotFoundError = class extends BatonError {
|
|
118
118
|
constructor(message, cause) {
|
|
119
119
|
super("ADAPTER_NOT_FOUND_ERROR", message, cause);
|
|
120
120
|
}
|
|
@@ -3783,6 +3783,10 @@ const skillItemSchema = objectType({
|
|
|
3783
3783
|
*/
|
|
3784
3784
|
const rulesSchema = unionType([arrayType(stringType()), recordType(stringType(), arrayType(stringType()).optional())]);
|
|
3785
3785
|
/**
|
|
3786
|
+
* Agents in profile manifest - can be either an array or an object
|
|
3787
|
+
*/
|
|
3788
|
+
const agentsSchema = unionType([arrayType(stringType()), recordType(stringType(), arrayType(stringType()).optional())]);
|
|
3789
|
+
/**
|
|
3786
3790
|
* Memory file configuration item
|
|
3787
3791
|
*
|
|
3788
3792
|
* Convention: Use "MEMORY.md" as source for generic memory that will be
|
|
@@ -3799,18 +3803,14 @@ const memoryItemSchema = objectType({
|
|
|
3799
3803
|
*/
|
|
3800
3804
|
const memorySectionSchema = arrayType(memoryItemSchema).optional();
|
|
3801
3805
|
/**
|
|
3802
|
-
* Settings configuration mapping agent key to settings filename
|
|
3803
|
-
*/
|
|
3804
|
-
const settingsSchema = recordType(stringType(), stringType());
|
|
3805
|
-
/**
|
|
3806
3806
|
* AI section in profile manifest
|
|
3807
3807
|
*/
|
|
3808
3808
|
const aiSectionSchema = objectType({
|
|
3809
3809
|
tools: arrayType(stringType()).optional(),
|
|
3810
3810
|
skills: arrayType(skillItemSchema).optional(),
|
|
3811
3811
|
rules: rulesSchema.optional(),
|
|
3812
|
+
agents: agentsSchema.optional(),
|
|
3812
3813
|
memory: memorySectionSchema.optional(),
|
|
3813
|
-
settings: settingsSchema.optional(),
|
|
3814
3814
|
commands: arrayType(stringType()).optional()
|
|
3815
3815
|
}).optional();
|
|
3816
3816
|
/**
|
|
@@ -4089,11 +4089,11 @@ function parseFrontmatter(raw) {
|
|
|
4089
4089
|
//#endregion
|
|
4090
4090
|
//#region ../core/src/adapters/base-adapter.ts
|
|
4091
4091
|
/**
|
|
4092
|
-
* Base adapter with default implementations for the
|
|
4092
|
+
* Base adapter with default implementations for the AIToolAdapter interface.
|
|
4093
4093
|
*
|
|
4094
4094
|
* Provides:
|
|
4095
|
-
* - isInstalled() via
|
|
4096
|
-
* - getPath() via
|
|
4095
|
+
* - isInstalled() via detectInstalledAITools()
|
|
4096
|
+
* - getPath() via getAIToolPath()
|
|
4097
4097
|
* - getLegacyPaths() returns []
|
|
4098
4098
|
* - transform*() passthrough (return input unchanged)
|
|
4099
4099
|
* - transformMemory() converts MEMORY.md to this.memoryFilename
|
|
@@ -4102,19 +4102,19 @@ function parseFrontmatter(raw) {
|
|
|
4102
4102
|
* Subclasses only need to define `key` and `name`.
|
|
4103
4103
|
* Override `memoryFilename` for tools that don't use AGENTS.md.
|
|
4104
4104
|
*/
|
|
4105
|
-
var
|
|
4105
|
+
var BaseAIToolAdapter = class {
|
|
4106
4106
|
/** Memory filename this tool uses. Override for non-AGENTS.md tools. */
|
|
4107
4107
|
memoryFilename = "AGENTS.md";
|
|
4108
4108
|
async isInstalled() {
|
|
4109
4109
|
try {
|
|
4110
|
-
const {
|
|
4111
|
-
return (await
|
|
4110
|
+
const { detectInstalledAITools } = await import("./ai-tool-detection-BFep6YS9.mjs");
|
|
4111
|
+
return (await detectInstalledAITools()).includes(this.key);
|
|
4112
4112
|
} catch {
|
|
4113
4113
|
return false;
|
|
4114
4114
|
}
|
|
4115
4115
|
}
|
|
4116
4116
|
getPath(type, scope, name) {
|
|
4117
|
-
return
|
|
4117
|
+
return getAIToolPath(this.key, type, scope, name);
|
|
4118
4118
|
}
|
|
4119
4119
|
getLegacyPaths(_type) {
|
|
4120
4120
|
return [];
|
|
@@ -4148,8 +4148,7 @@ var BaseAdapter = class {
|
|
|
4148
4148
|
validateCommon(type, file) {
|
|
4149
4149
|
const errors = [];
|
|
4150
4150
|
if (typeof file !== "object" || file === null) {
|
|
4151
|
-
|
|
4152
|
-
else errors.push(`${type} must be a valid object`);
|
|
4151
|
+
errors.push(`${type} must be a valid object`);
|
|
4153
4152
|
return {
|
|
4154
4153
|
valid: false,
|
|
4155
4154
|
errors
|
|
@@ -4177,7 +4176,6 @@ var BaseAdapter = class {
|
|
|
4177
4176
|
if (!record.name) errors.push("Command must have a name");
|
|
4178
4177
|
if (!record.content) errors.push("Command must have content");
|
|
4179
4178
|
break;
|
|
4180
|
-
case "settings": break;
|
|
4181
4179
|
}
|
|
4182
4180
|
return {
|
|
4183
4181
|
valid: errors.length === 0,
|
|
@@ -4192,7 +4190,7 @@ var BaseAdapter = class {
|
|
|
4192
4190
|
* Amp adapter — uses canonical formats with AGENTS.md for memory.
|
|
4193
4191
|
* Project paths: .agents/ | Global paths: ~/.config/agents/
|
|
4194
4192
|
*/
|
|
4195
|
-
var AmpAdapter = class extends
|
|
4193
|
+
var AmpAdapter = class extends BaseAIToolAdapter {
|
|
4196
4194
|
key = "amp";
|
|
4197
4195
|
name = "Amp";
|
|
4198
4196
|
};
|
|
@@ -4205,7 +4203,7 @@ var AmpAdapter = class extends BaseAdapter {
|
|
|
4205
4203
|
* Uses GEMINI.md for memory. Custom validate() adds memory filename check.
|
|
4206
4204
|
* Paths: .agent/skills/, .agent/rules/, .agent/agents/, .agent/workflows/
|
|
4207
4205
|
*/
|
|
4208
|
-
var AntigravityAdapter = class extends
|
|
4206
|
+
var AntigravityAdapter = class extends BaseAIToolAdapter {
|
|
4209
4207
|
key = "antigravity";
|
|
4210
4208
|
name = "Antigravity";
|
|
4211
4209
|
memoryFilename = "GEMINI.md";
|
|
@@ -4225,7 +4223,7 @@ var AntigravityAdapter = class extends BaseAdapter {
|
|
|
4225
4223
|
//#endregion
|
|
4226
4224
|
//#region ../core/src/adapters/claude-code.ts
|
|
4227
4225
|
/**
|
|
4228
|
-
* Claude Code adapter — reference implementation for
|
|
4226
|
+
* Claude Code adapter — reference implementation for AIToolAdapter interface.
|
|
4229
4227
|
*
|
|
4230
4228
|
* Uses canonical formats:
|
|
4231
4229
|
* - Skills: 1:1 copy (SKILL.md with optional scripts/)
|
|
@@ -4234,7 +4232,7 @@ var AntigravityAdapter = class extends BaseAdapter {
|
|
|
4234
4232
|
* - Memory: CLAUDE.md or .claude/CLAUDE.md
|
|
4235
4233
|
* - Commands: .claude/commands/{name}.md
|
|
4236
4234
|
*/
|
|
4237
|
-
var ClaudeCodeAdapter = class extends
|
|
4235
|
+
var ClaudeCodeAdapter = class extends BaseAIToolAdapter {
|
|
4238
4236
|
key = "claude-code";
|
|
4239
4237
|
name = "Claude Code";
|
|
4240
4238
|
memoryFilename = "CLAUDE.md";
|
|
@@ -4246,7 +4244,7 @@ var ClaudeCodeAdapter = class extends BaseAdapter {
|
|
|
4246
4244
|
* Cline adapter — uses canonical formats with AGENTS.md for memory.
|
|
4247
4245
|
* Project paths: .cline/ | Global paths: ~/.cline/
|
|
4248
4246
|
*/
|
|
4249
|
-
var ClineAdapter = class extends
|
|
4247
|
+
var ClineAdapter = class extends BaseAIToolAdapter {
|
|
4250
4248
|
key = "cline";
|
|
4251
4249
|
name = "Cline";
|
|
4252
4250
|
};
|
|
@@ -4259,7 +4257,7 @@ var ClineAdapter = class extends BaseAdapter {
|
|
|
4259
4257
|
* Uses AGENTS.md for memory. Custom validate() adds memory filename check.
|
|
4260
4258
|
* Settings use TOML format (config.toml), not JSON.
|
|
4261
4259
|
*/
|
|
4262
|
-
var CodexAdapter = class extends
|
|
4260
|
+
var CodexAdapter = class extends BaseAIToolAdapter {
|
|
4263
4261
|
key = "codex";
|
|
4264
4262
|
name = "Codex CLI";
|
|
4265
4263
|
validate(type, file) {
|
|
@@ -4285,7 +4283,7 @@ var CodexAdapter = class extends BaseAdapter {
|
|
|
4285
4283
|
* - transformRule(): converts to .mdc with description, globs, alwaysApply
|
|
4286
4284
|
* - validate(): adds Cursor-specific rules + memory checks
|
|
4287
4285
|
*/
|
|
4288
|
-
var CursorAdapter = class extends
|
|
4286
|
+
var CursorAdapter = class extends BaseAIToolAdapter {
|
|
4289
4287
|
key = "cursor";
|
|
4290
4288
|
name = "Cursor";
|
|
4291
4289
|
getLegacyPaths(type) {
|
|
@@ -4350,7 +4348,7 @@ var CursorAdapter = class extends BaseAdapter {
|
|
|
4350
4348
|
* GitHub Copilot adapter — uses copilot-instructions.md for memory.
|
|
4351
4349
|
* Memory path: .github/copilot-instructions.md
|
|
4352
4350
|
*/
|
|
4353
|
-
var GitHubCopilotAdapter = class extends
|
|
4351
|
+
var GitHubCopilotAdapter = class extends BaseAIToolAdapter {
|
|
4354
4352
|
key = "github-copilot";
|
|
4355
4353
|
name = "GitHub Copilot";
|
|
4356
4354
|
memoryFilename = "copilot-instructions.md";
|
|
@@ -4362,7 +4360,7 @@ var GitHubCopilotAdapter = class extends BaseAdapter {
|
|
|
4362
4360
|
* Junie adapter — uses canonical formats with AGENTS.md for memory.
|
|
4363
4361
|
* Project paths: .junie/ | Global paths: ~/.junie/
|
|
4364
4362
|
*/
|
|
4365
|
-
var JunieAdapter = class extends
|
|
4363
|
+
var JunieAdapter = class extends BaseAIToolAdapter {
|
|
4366
4364
|
key = "junie";
|
|
4367
4365
|
name = "Junie";
|
|
4368
4366
|
};
|
|
@@ -4373,7 +4371,7 @@ var JunieAdapter = class extends BaseAdapter {
|
|
|
4373
4371
|
* Kiro adapter — uses canonical formats with AGENTS.md for memory.
|
|
4374
4372
|
* Project paths: .kiro/ | Global paths: ~/.kiro/
|
|
4375
4373
|
*/
|
|
4376
|
-
var KiroAdapter = class extends
|
|
4374
|
+
var KiroAdapter = class extends BaseAIToolAdapter {
|
|
4377
4375
|
key = "kiro";
|
|
4378
4376
|
name = "Kiro";
|
|
4379
4377
|
};
|
|
@@ -4384,7 +4382,7 @@ var KiroAdapter = class extends BaseAdapter {
|
|
|
4384
4382
|
* OpenCode adapter — uses canonical formats with AGENTS.md for memory.
|
|
4385
4383
|
* Global paths: ~/.config/opencode/ (XDG Base Directory)
|
|
4386
4384
|
*/
|
|
4387
|
-
var OpenCodeAdapter = class extends
|
|
4385
|
+
var OpenCodeAdapter = class extends BaseAIToolAdapter {
|
|
4388
4386
|
key = "opencode";
|
|
4389
4387
|
name = "OpenCode";
|
|
4390
4388
|
};
|
|
@@ -4395,7 +4393,7 @@ var OpenCodeAdapter = class extends BaseAdapter {
|
|
|
4395
4393
|
* Roo adapter — uses canonical formats with AGENTS.md for memory.
|
|
4396
4394
|
* Project paths: .roo/ | Global paths: ~/.roo/
|
|
4397
4395
|
*/
|
|
4398
|
-
var RooAdapter = class extends
|
|
4396
|
+
var RooAdapter = class extends BaseAIToolAdapter {
|
|
4399
4397
|
key = "roo";
|
|
4400
4398
|
name = "Roo";
|
|
4401
4399
|
};
|
|
@@ -4406,7 +4404,7 @@ var RooAdapter = class extends BaseAdapter {
|
|
|
4406
4404
|
* Trae adapter — uses canonical formats with AGENTS.md for memory.
|
|
4407
4405
|
* Project paths: .trae/ | Global paths: ~/.trae/
|
|
4408
4406
|
*/
|
|
4409
|
-
var TraeAdapter = class extends
|
|
4407
|
+
var TraeAdapter = class extends BaseAIToolAdapter {
|
|
4410
4408
|
key = "trae";
|
|
4411
4409
|
name = "Trae";
|
|
4412
4410
|
};
|
|
@@ -4421,7 +4419,7 @@ var TraeAdapter = class extends BaseAdapter {
|
|
|
4421
4419
|
* - transformRule(): removes all YAML frontmatter
|
|
4422
4420
|
* - validate(): adds Windsurf-specific rules + memory checks
|
|
4423
4421
|
*/
|
|
4424
|
-
var WindsurfAdapter = class extends
|
|
4422
|
+
var WindsurfAdapter = class extends BaseAIToolAdapter {
|
|
4425
4423
|
key = "windsurf";
|
|
4426
4424
|
name = "Windsurf";
|
|
4427
4425
|
getLegacyPaths(type) {
|
|
@@ -4461,7 +4459,7 @@ var WindsurfAdapter = class extends BaseAdapter {
|
|
|
4461
4459
|
* Zed adapter — uses canonical formats with AGENTS.md for memory.
|
|
4462
4460
|
* Project paths: .zed/ | Global paths: ~/.zed/
|
|
4463
4461
|
*/
|
|
4464
|
-
var ZedAdapter = class extends
|
|
4462
|
+
var ZedAdapter = class extends BaseAIToolAdapter {
|
|
4465
4463
|
key = "zed";
|
|
4466
4464
|
name = "Zed";
|
|
4467
4465
|
};
|
|
@@ -4472,12 +4470,12 @@ var ZedAdapter = class extends BaseAdapter {
|
|
|
4472
4470
|
* Registry of all tool adapters
|
|
4473
4471
|
* Singleton instances are created lazily on first access
|
|
4474
4472
|
*/
|
|
4475
|
-
const
|
|
4473
|
+
const aiToolAdapterInstances = /* @__PURE__ */ new Map();
|
|
4476
4474
|
/**
|
|
4477
4475
|
* Initialize all adapters
|
|
4478
4476
|
*/
|
|
4479
|
-
function
|
|
4480
|
-
if (
|
|
4477
|
+
function initializeAIToolAdapters() {
|
|
4478
|
+
if (aiToolAdapterInstances.size > 0) return;
|
|
4481
4479
|
const adapters = [
|
|
4482
4480
|
new ClaudeCodeAdapter(),
|
|
4483
4481
|
new CursorAdapter(),
|
|
@@ -4494,35 +4492,35 @@ function initializeAdapters() {
|
|
|
4494
4492
|
new JunieAdapter(),
|
|
4495
4493
|
new TraeAdapter()
|
|
4496
4494
|
];
|
|
4497
|
-
for (const adapter of adapters)
|
|
4495
|
+
for (const adapter of adapters) aiToolAdapterInstances.set(adapter.key, adapter);
|
|
4498
4496
|
}
|
|
4499
4497
|
/**
|
|
4500
4498
|
* Get adapter instance by tool key
|
|
4501
|
-
* @param
|
|
4499
|
+
* @param toolKey - Tool key (e.g., 'claude-code', 'cursor')
|
|
4502
4500
|
* @returns Adapter instance
|
|
4503
|
-
* @throws
|
|
4501
|
+
* @throws AIToolAdapterNotFoundError if adapter is not registered
|
|
4504
4502
|
*/
|
|
4505
|
-
function
|
|
4506
|
-
|
|
4507
|
-
const adapter =
|
|
4508
|
-
if (!adapter) throw new
|
|
4503
|
+
function getAIToolAdapter(toolKey) {
|
|
4504
|
+
initializeAIToolAdapters();
|
|
4505
|
+
const adapter = aiToolAdapterInstances.get(toolKey);
|
|
4506
|
+
if (!adapter) throw new AIToolAdapterNotFoundError(`Adapter not found for tool: ${toolKey}. Available adapters: ${Array.from(aiToolAdapterInstances.keys()).join(", ")}`);
|
|
4509
4507
|
return adapter;
|
|
4510
4508
|
}
|
|
4511
4509
|
/**
|
|
4512
4510
|
* Get all registered adapters
|
|
4513
4511
|
* @returns Array of all adapter instances
|
|
4514
4512
|
*/
|
|
4515
|
-
function
|
|
4516
|
-
|
|
4517
|
-
return Array.from(
|
|
4513
|
+
function getAllAIToolAdapters() {
|
|
4514
|
+
initializeAIToolAdapters();
|
|
4515
|
+
return Array.from(aiToolAdapterInstances.values());
|
|
4518
4516
|
}
|
|
4519
4517
|
/**
|
|
4520
4518
|
* Get adapters for the given tool keys
|
|
4521
4519
|
* @param keys - Array of tool keys
|
|
4522
4520
|
* @returns Array of adapter instances
|
|
4523
4521
|
*/
|
|
4524
|
-
function
|
|
4525
|
-
return keys.map((key) =>
|
|
4522
|
+
function getAIToolAdaptersForKeys(keys) {
|
|
4523
|
+
return keys.map((key) => getAIToolAdapter(key));
|
|
4526
4524
|
}
|
|
4527
4525
|
|
|
4528
4526
|
//#endregion
|
|
@@ -4767,7 +4765,7 @@ async function removeGitignoreManagedSection(projectRoot) {
|
|
|
4767
4765
|
function collectComprehensivePatterns(options) {
|
|
4768
4766
|
const patterns = /* @__PURE__ */ new Set();
|
|
4769
4767
|
const { fileTargets } = options;
|
|
4770
|
-
const allAdapters =
|
|
4768
|
+
const allAdapters = getAllAIToolAdapters();
|
|
4771
4769
|
for (const adapter of allAdapters) {
|
|
4772
4770
|
addDirPattern(patterns, adapter.getPath("commands", "project", "_probe"));
|
|
4773
4771
|
addDirPattern(patterns, adapter.getPath("skills", "project", "_probe"));
|
|
@@ -6572,10 +6570,10 @@ async function discoverProfilesInSourceRepo(sourceRoot) {
|
|
|
6572
6570
|
*/
|
|
6573
6571
|
const canonicalFiles = /* @__PURE__ */ new Map();
|
|
6574
6572
|
/**
|
|
6575
|
-
* Place a file for a specific
|
|
6573
|
+
* Place a file for a specific AI tool adapter
|
|
6576
6574
|
*
|
|
6577
6575
|
* @param content - File content to write
|
|
6578
|
-
* @param adapter -
|
|
6576
|
+
* @param adapter - AI tool adapter
|
|
6579
6577
|
* @param type - Config type
|
|
6580
6578
|
* @param scope - Scope (project or global)
|
|
6581
6579
|
* @param name - File/directory name
|
|
@@ -6668,13 +6666,12 @@ async function readFileIfExists(path) {
|
|
|
6668
6666
|
*/
|
|
6669
6667
|
async function detectLegacyPaths(projectRoot) {
|
|
6670
6668
|
const legacyFiles = [];
|
|
6671
|
-
const adapters =
|
|
6669
|
+
const adapters = getAllAIToolAdapters();
|
|
6672
6670
|
for (const adapter of adapters) for (const configType of [
|
|
6673
6671
|
"skills",
|
|
6674
6672
|
"rules",
|
|
6675
6673
|
"agents",
|
|
6676
6674
|
"memory",
|
|
6677
|
-
"settings",
|
|
6678
6675
|
"commands"
|
|
6679
6676
|
]) {
|
|
6680
6677
|
const legacyPaths = adapter.getLegacyPaths(configType);
|
|
@@ -6688,7 +6685,7 @@ async function detectLegacyPaths(projectRoot) {
|
|
|
6688
6685
|
legacyPath: absoluteLegacyPath,
|
|
6689
6686
|
newPath: resolve(projectRoot, newPath),
|
|
6690
6687
|
configType,
|
|
6691
|
-
|
|
6688
|
+
toolKey: adapter.key
|
|
6692
6689
|
});
|
|
6693
6690
|
} catch {}
|
|
6694
6691
|
}
|
|
@@ -7037,6 +7034,79 @@ function mergeRulesWithWarnings(profiles) {
|
|
|
7037
7034
|
};
|
|
7038
7035
|
}
|
|
7039
7036
|
|
|
7037
|
+
//#endregion
|
|
7038
|
+
//#region ../core/src/merge/agents.ts
|
|
7039
|
+
/**
|
|
7040
|
+
* Merge agents with detailed conflict warnings.
|
|
7041
|
+
*
|
|
7042
|
+
* @param profiles - Array of resolved profiles in merge order (base first, overrides last)
|
|
7043
|
+
* @returns Agents and any same-weight conflict warnings
|
|
7044
|
+
*/
|
|
7045
|
+
function mergeAgentsWithWarnings(profiles) {
|
|
7046
|
+
const agentMap = /* @__PURE__ */ new Map();
|
|
7047
|
+
const lockedKeys = /* @__PURE__ */ new Set();
|
|
7048
|
+
const warnings = [];
|
|
7049
|
+
const keyOwner = /* @__PURE__ */ new Map();
|
|
7050
|
+
for (const profile of profiles) {
|
|
7051
|
+
const agents = profile.manifest.ai?.agents;
|
|
7052
|
+
if (!agents) continue;
|
|
7053
|
+
const weight = getProfileWeight(profile);
|
|
7054
|
+
const locked = isLockedProfile(profile);
|
|
7055
|
+
if (Array.isArray(agents)) for (const agentName of agents) {
|
|
7056
|
+
const key = `universal:${agentName}`;
|
|
7057
|
+
if (lockedKeys.has(key)) continue;
|
|
7058
|
+
const existing = keyOwner.get(key);
|
|
7059
|
+
if (existing && existing.weight === weight && existing.profileName !== profile.name) warnings.push({
|
|
7060
|
+
key: agentName,
|
|
7061
|
+
category: "agent",
|
|
7062
|
+
profileA: existing.profileName,
|
|
7063
|
+
profileB: profile.name,
|
|
7064
|
+
weight
|
|
7065
|
+
});
|
|
7066
|
+
agentMap.set(key, {
|
|
7067
|
+
name: agentName,
|
|
7068
|
+
agents: [],
|
|
7069
|
+
profileName: profile.name
|
|
7070
|
+
});
|
|
7071
|
+
keyOwner.set(key, {
|
|
7072
|
+
profileName: profile.name,
|
|
7073
|
+
weight
|
|
7074
|
+
});
|
|
7075
|
+
if (locked) lockedKeys.add(key);
|
|
7076
|
+
}
|
|
7077
|
+
else for (const [agentKey, agentNames] of Object.entries(agents)) {
|
|
7078
|
+
if (!agentNames) continue;
|
|
7079
|
+
for (const agentName of agentNames) {
|
|
7080
|
+
const isUniversal = agentKey === "universal";
|
|
7081
|
+
const key = `${agentKey}:${agentName}`;
|
|
7082
|
+
if (lockedKeys.has(key)) continue;
|
|
7083
|
+
const existing = keyOwner.get(key);
|
|
7084
|
+
if (existing && existing.weight === weight && existing.profileName !== profile.name) warnings.push({
|
|
7085
|
+
key: `${agentKey}:${agentName}`,
|
|
7086
|
+
category: "agent",
|
|
7087
|
+
profileA: existing.profileName,
|
|
7088
|
+
profileB: profile.name,
|
|
7089
|
+
weight
|
|
7090
|
+
});
|
|
7091
|
+
agentMap.set(key, {
|
|
7092
|
+
name: agentName,
|
|
7093
|
+
agents: isUniversal ? [] : [agentKey],
|
|
7094
|
+
profileName: profile.name
|
|
7095
|
+
});
|
|
7096
|
+
keyOwner.set(key, {
|
|
7097
|
+
profileName: profile.name,
|
|
7098
|
+
weight
|
|
7099
|
+
});
|
|
7100
|
+
if (locked) lockedKeys.add(key);
|
|
7101
|
+
}
|
|
7102
|
+
}
|
|
7103
|
+
}
|
|
7104
|
+
return {
|
|
7105
|
+
agents: Array.from(agentMap.values()),
|
|
7106
|
+
warnings
|
|
7107
|
+
};
|
|
7108
|
+
}
|
|
7109
|
+
|
|
7040
7110
|
//#endregion
|
|
7041
7111
|
//#region ../core/src/merge/memory.ts
|
|
7042
7112
|
/**
|
|
@@ -14722,5 +14792,5 @@ async function resolvePreferences(projectRoot) {
|
|
|
14722
14792
|
}
|
|
14723
14793
|
|
|
14724
14794
|
//#endregion
|
|
14725
|
-
export {
|
|
14726
|
-
//# sourceMappingURL=src-
|
|
14795
|
+
export { loadLockfile as $, resolveProfileChain as A, cloneGitSource as B, mergeSkills as C, sortProfilesByWeight as D, isLockedProfile as E, removePlacedFiles as F, getIdePlatformTargetDir as G, ensureBatonDirGitignored as H, generateLock as I, isKnownIdePlatform as J, getRegisteredIdePlatforms as K, readLock as L, placeFile as M, discoverProfilesInSourceRepo as N, mergeContentParts as O, findSourceManifest as P, parseSource as Q, writeLock as R, mergeRulesWithWarnings as S, getProfileWeight as T, removeGitignoreManagedSection as U, collectComprehensivePatterns as V, updateGitignore as W, getAllAIToolAdapters as X, getAIToolAdaptersForKeys as Y, parseFrontmatter as Z, require_lib as _, clearIdeCache as a, getAIToolConfig as at, mergeAgentsWithWarnings as b, getBatonHome as c, getGlobalConfigPath as d, loadProfileManifest as et, getGlobalIdePlatforms as f, setGlobalIdePlatforms as g, setGlobalAiTools as h, computeIntersection as i, SourceParseError as it, detectLegacyPaths as j, resolveProfileSupport as k, getDefaultGlobalSource as l, removeGlobalSource as m, readProjectPreferences as n, KEBAB_CASE_REGEX as nt, detectInstalledIdes as o, getAIToolPath as ot, getGlobalSources as p, idePlatformRegistry as q, writeProjectPreferences as r, FileNotFoundError as rt, addGlobalSource as s, getAllAIToolKeys as st, resolvePreferences as t, loadProjectManifest as tt, getGlobalAiTools as u, mergeMemory as v, mergeSkillsWithWarnings as w, mergeRules as x, mergeMemoryWithWarnings as y, resolveVersion as z };
|
|
14796
|
+
//# sourceMappingURL=src-D41VR6ro.mjs.map
|