agentinit 1.8.0 → 1.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/CHANGELOG.md +7 -0
- package/dist/agents/Agent.d.ts +12 -0
- package/dist/agents/Agent.d.ts.map +1 -1
- package/dist/agents/Agent.js +22 -0
- package/dist/agents/Agent.js.map +1 -1
- package/dist/agents/AiderAgent.d.ts.map +1 -1
- package/dist/agents/AiderAgent.js +3 -0
- package/dist/agents/AiderAgent.js.map +1 -1
- package/dist/agents/ClaudeAgent.d.ts.map +1 -1
- package/dist/agents/ClaudeAgent.js +5 -1
- package/dist/agents/ClaudeAgent.js.map +1 -1
- package/dist/agents/ClaudeDesktopAgent.d.ts.map +1 -1
- package/dist/agents/ClaudeDesktopAgent.js +5 -1
- package/dist/agents/ClaudeDesktopAgent.js.map +1 -1
- package/dist/agents/CodexCliAgent.d.ts.map +1 -1
- package/dist/agents/CodexCliAgent.js +6 -2
- package/dist/agents/CodexCliAgent.js.map +1 -1
- package/dist/agents/CopilotAgent.d.ts.map +1 -1
- package/dist/agents/CopilotAgent.js +6 -2
- package/dist/agents/CopilotAgent.js.map +1 -1
- package/dist/agents/CursorAgent.d.ts.map +1 -1
- package/dist/agents/CursorAgent.js +6 -2
- package/dist/agents/CursorAgent.js.map +1 -1
- package/dist/agents/DroidAgent.d.ts.map +1 -1
- package/dist/agents/DroidAgent.js +7 -2
- package/dist/agents/DroidAgent.js.map +1 -1
- package/dist/agents/GeminiCliAgent.d.ts.map +1 -1
- package/dist/agents/GeminiCliAgent.js +5 -2
- package/dist/agents/GeminiCliAgent.js.map +1 -1
- package/dist/agents/RooCodeAgent.d.ts.map +1 -1
- package/dist/agents/RooCodeAgent.js +5 -1
- package/dist/agents/RooCodeAgent.js.map +1 -1
- package/dist/agents/ZedAgent.d.ts.map +1 -1
- package/dist/agents/ZedAgent.js +3 -0
- package/dist/agents/ZedAgent.js.map +1 -1
- package/dist/cli.js +303 -134
- package/dist/commands/apply.d.ts.map +1 -1
- package/dist/commands/apply.js +22 -4
- package/dist/commands/apply.js.map +1 -1
- package/dist/commands/mcp.d.ts.map +1 -1
- package/dist/commands/mcp.js +97 -39
- package/dist/commands/mcp.js.map +1 -1
- package/dist/commands/skills.d.ts.map +1 -1
- package/dist/commands/skills.js +17 -6
- package/dist/commands/skills.js.map +1 -1
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +8 -1
- package/dist/commands/sync.js.map +1 -1
- package/dist/core/projectStandards.d.ts +18 -0
- package/dist/core/projectStandards.d.ts.map +1 -0
- package/dist/core/projectStandards.js +50 -0
- package/dist/core/projectStandards.js.map +1 -0
- package/dist/core/propagator.d.ts +1 -0
- package/dist/core/propagator.d.ts.map +1 -1
- package/dist/core/propagator.js +20 -2
- package/dist/core/propagator.js.map +1 -1
- package/dist/core/skillsManager.d.ts.map +1 -1
- package/dist/core/skillsManager.js +20 -8
- package/dist/core/skillsManager.js.map +1 -1
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -14840,51 +14840,51 @@ var require_uri_all = __commonJS((exports, module) => {
|
|
|
14840
14840
|
}
|
|
14841
14841
|
return uriTokens.join("");
|
|
14842
14842
|
}
|
|
14843
|
-
function resolveComponents(base2,
|
|
14843
|
+
function resolveComponents(base2, relative4) {
|
|
14844
14844
|
var options2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
14845
14845
|
var skipNormalization = arguments[3];
|
|
14846
14846
|
var target = {};
|
|
14847
14847
|
if (!skipNormalization) {
|
|
14848
14848
|
base2 = parse4(serialize(base2, options2), options2);
|
|
14849
|
-
|
|
14849
|
+
relative4 = parse4(serialize(relative4, options2), options2);
|
|
14850
14850
|
}
|
|
14851
14851
|
options2 = options2 || {};
|
|
14852
|
-
if (!options2.tolerant &&
|
|
14853
|
-
target.scheme =
|
|
14854
|
-
target.userinfo =
|
|
14855
|
-
target.host =
|
|
14856
|
-
target.port =
|
|
14857
|
-
target.path = removeDotSegments(
|
|
14858
|
-
target.query =
|
|
14852
|
+
if (!options2.tolerant && relative4.scheme) {
|
|
14853
|
+
target.scheme = relative4.scheme;
|
|
14854
|
+
target.userinfo = relative4.userinfo;
|
|
14855
|
+
target.host = relative4.host;
|
|
14856
|
+
target.port = relative4.port;
|
|
14857
|
+
target.path = removeDotSegments(relative4.path || "");
|
|
14858
|
+
target.query = relative4.query;
|
|
14859
14859
|
} else {
|
|
14860
|
-
if (
|
|
14861
|
-
target.userinfo =
|
|
14862
|
-
target.host =
|
|
14863
|
-
target.port =
|
|
14864
|
-
target.path = removeDotSegments(
|
|
14865
|
-
target.query =
|
|
14860
|
+
if (relative4.userinfo !== undefined || relative4.host !== undefined || relative4.port !== undefined) {
|
|
14861
|
+
target.userinfo = relative4.userinfo;
|
|
14862
|
+
target.host = relative4.host;
|
|
14863
|
+
target.port = relative4.port;
|
|
14864
|
+
target.path = removeDotSegments(relative4.path || "");
|
|
14865
|
+
target.query = relative4.query;
|
|
14866
14866
|
} else {
|
|
14867
|
-
if (!
|
|
14867
|
+
if (!relative4.path) {
|
|
14868
14868
|
target.path = base2.path;
|
|
14869
|
-
if (
|
|
14870
|
-
target.query =
|
|
14869
|
+
if (relative4.query !== undefined) {
|
|
14870
|
+
target.query = relative4.query;
|
|
14871
14871
|
} else {
|
|
14872
14872
|
target.query = base2.query;
|
|
14873
14873
|
}
|
|
14874
14874
|
} else {
|
|
14875
|
-
if (
|
|
14876
|
-
target.path = removeDotSegments(
|
|
14875
|
+
if (relative4.path.charAt(0) === "/") {
|
|
14876
|
+
target.path = removeDotSegments(relative4.path);
|
|
14877
14877
|
} else {
|
|
14878
14878
|
if ((base2.userinfo !== undefined || base2.host !== undefined || base2.port !== undefined) && !base2.path) {
|
|
14879
|
-
target.path = "/" +
|
|
14879
|
+
target.path = "/" + relative4.path;
|
|
14880
14880
|
} else if (!base2.path) {
|
|
14881
|
-
target.path =
|
|
14881
|
+
target.path = relative4.path;
|
|
14882
14882
|
} else {
|
|
14883
|
-
target.path = base2.path.slice(0, base2.path.lastIndexOf("/") + 1) +
|
|
14883
|
+
target.path = base2.path.slice(0, base2.path.lastIndexOf("/") + 1) + relative4.path;
|
|
14884
14884
|
}
|
|
14885
14885
|
target.path = removeDotSegments(target.path);
|
|
14886
14886
|
}
|
|
14887
|
-
target.query =
|
|
14887
|
+
target.query = relative4.query;
|
|
14888
14888
|
}
|
|
14889
14889
|
target.userinfo = base2.userinfo;
|
|
14890
14890
|
target.host = base2.host;
|
|
@@ -14892,7 +14892,7 @@ var require_uri_all = __commonJS((exports, module) => {
|
|
|
14892
14892
|
}
|
|
14893
14893
|
target.scheme = base2.scheme;
|
|
14894
14894
|
}
|
|
14895
|
-
target.fragment =
|
|
14895
|
+
target.fragment = relative4.fragment;
|
|
14896
14896
|
return target;
|
|
14897
14897
|
}
|
|
14898
14898
|
function resolve10(baseURI, relativeURI, options2) {
|
|
@@ -35280,6 +35280,19 @@ class Agent {
|
|
|
35280
35280
|
}
|
|
35281
35281
|
return resolve5(projectPath, this.definition.skillPaths.project);
|
|
35282
35282
|
}
|
|
35283
|
+
getProjectRulesStandard() {
|
|
35284
|
+
return this.definition.projectStandards?.rules || null;
|
|
35285
|
+
}
|
|
35286
|
+
getProjectSkillsStandard() {
|
|
35287
|
+
return this.definition.projectStandards?.skills || null;
|
|
35288
|
+
}
|
|
35289
|
+
supportsProjectMcpConfig() {
|
|
35290
|
+
const supportsAnyMcp = Object.values(this.capabilities.mcp).some(Boolean);
|
|
35291
|
+
if (!supportsAnyMcp) {
|
|
35292
|
+
return false;
|
|
35293
|
+
}
|
|
35294
|
+
return this.definition.mcpConfigScope !== "global-only";
|
|
35295
|
+
}
|
|
35283
35296
|
supportsGlobalRules() {
|
|
35284
35297
|
return this.getGlobalRulesPath() !== null;
|
|
35285
35298
|
}
|
|
@@ -35383,6 +35396,10 @@ class ClaudeAgent extends Agent {
|
|
|
35383
35396
|
skillPaths: {
|
|
35384
35397
|
project: ".claude/skills/",
|
|
35385
35398
|
global: "~/.claude/skills/"
|
|
35399
|
+
},
|
|
35400
|
+
projectStandards: {
|
|
35401
|
+
rules: "claude",
|
|
35402
|
+
skills: "claude"
|
|
35386
35403
|
}
|
|
35387
35404
|
};
|
|
35388
35405
|
super(definition);
|
|
@@ -35578,7 +35595,11 @@ class ClaudeDesktopAgent extends Agent {
|
|
|
35578
35595
|
skillPaths: {
|
|
35579
35596
|
project: ".claude/skills/",
|
|
35580
35597
|
global: "~/.claude/skills/"
|
|
35581
|
-
}
|
|
35598
|
+
},
|
|
35599
|
+
projectStandards: {
|
|
35600
|
+
skills: "claude"
|
|
35601
|
+
},
|
|
35602
|
+
mcpConfigScope: "global-only"
|
|
35582
35603
|
};
|
|
35583
35604
|
super(definition);
|
|
35584
35605
|
}
|
|
@@ -35712,8 +35733,12 @@ class CodexCliAgent extends Agent {
|
|
|
35712
35733
|
rulesPath: ".codex/config.toml",
|
|
35713
35734
|
globalRulesPath: "~/.codex/config.toml",
|
|
35714
35735
|
skillPaths: {
|
|
35715
|
-
project: ".
|
|
35736
|
+
project: ".agents/skills/",
|
|
35716
35737
|
global: "~/.codex/skills/"
|
|
35738
|
+
},
|
|
35739
|
+
projectStandards: {
|
|
35740
|
+
rules: "agents",
|
|
35741
|
+
skills: "agents"
|
|
35717
35742
|
}
|
|
35718
35743
|
};
|
|
35719
35744
|
super(definition);
|
|
@@ -35945,8 +35970,11 @@ class GeminiCliAgent extends Agent {
|
|
|
35945
35970
|
rulesPath: ".gemini/settings.json",
|
|
35946
35971
|
globalRulesPath: "~/.gemini/settings.json",
|
|
35947
35972
|
skillPaths: {
|
|
35948
|
-
project: ".
|
|
35973
|
+
project: ".agents/skills/",
|
|
35949
35974
|
global: "~/.gemini/skills/"
|
|
35975
|
+
},
|
|
35976
|
+
projectStandards: {
|
|
35977
|
+
skills: "agents"
|
|
35950
35978
|
}
|
|
35951
35979
|
};
|
|
35952
35980
|
super(definition);
|
|
@@ -36150,8 +36178,12 @@ class CursorAgent extends Agent {
|
|
|
36150
36178
|
globalConfigPath: "~/.cursor/mcp.json",
|
|
36151
36179
|
rulesPath: ".cursorrules",
|
|
36152
36180
|
skillPaths: {
|
|
36153
|
-
project: ".
|
|
36181
|
+
project: ".agents/skills/",
|
|
36154
36182
|
global: "~/.cursor/skills/"
|
|
36183
|
+
},
|
|
36184
|
+
projectStandards: {
|
|
36185
|
+
rules: "agents",
|
|
36186
|
+
skills: "agents"
|
|
36155
36187
|
}
|
|
36156
36188
|
};
|
|
36157
36189
|
super(definition);
|
|
@@ -36303,9 +36335,14 @@ class DroidAgent extends Agent {
|
|
|
36303
36335
|
globalConfigPath: "~/.factory/mcp.json",
|
|
36304
36336
|
rulesPath: "AGENTS.md",
|
|
36305
36337
|
skillPaths: {
|
|
36306
|
-
project: ".
|
|
36338
|
+
project: ".agents/skills/",
|
|
36307
36339
|
global: "~/.factory/skills/"
|
|
36308
|
-
}
|
|
36340
|
+
},
|
|
36341
|
+
projectStandards: {
|
|
36342
|
+
rules: "agents",
|
|
36343
|
+
skills: "agents"
|
|
36344
|
+
},
|
|
36345
|
+
mcpConfigScope: "global-only"
|
|
36309
36346
|
};
|
|
36310
36347
|
super(definition);
|
|
36311
36348
|
}
|
|
@@ -36547,8 +36584,12 @@ class CopilotAgent extends MarkdownRulesAgent {
|
|
|
36547
36584
|
nativeConfigPath: ".vscode/mcp.json",
|
|
36548
36585
|
rulesPath: "AGENTS.md",
|
|
36549
36586
|
skillPaths: {
|
|
36550
|
-
project: ".
|
|
36551
|
-
global: "~/.
|
|
36587
|
+
project: ".agents/skills/",
|
|
36588
|
+
global: "~/.copilot/skills/"
|
|
36589
|
+
},
|
|
36590
|
+
projectStandards: {
|
|
36591
|
+
rules: "agents",
|
|
36592
|
+
skills: "agents"
|
|
36552
36593
|
}
|
|
36553
36594
|
};
|
|
36554
36595
|
super(definition);
|
|
@@ -36680,7 +36721,10 @@ class AiderAgent extends MarkdownRulesAgent {
|
|
|
36680
36721
|
}
|
|
36681
36722
|
],
|
|
36682
36723
|
nativeConfigPath: ".mcp.json",
|
|
36683
|
-
rulesPath: "AGENTS.md"
|
|
36724
|
+
rulesPath: "AGENTS.md",
|
|
36725
|
+
projectStandards: {
|
|
36726
|
+
rules: "agents"
|
|
36727
|
+
}
|
|
36684
36728
|
};
|
|
36685
36729
|
super(definition);
|
|
36686
36730
|
}
|
|
@@ -36970,8 +37014,12 @@ class RooCodeAgent extends MarkdownRulesAgent {
|
|
|
36970
37014
|
nativeConfigPath: ".roo/mcp.json",
|
|
36971
37015
|
rulesPath: "AGENTS.md",
|
|
36972
37016
|
skillPaths: {
|
|
36973
|
-
project: ".
|
|
37017
|
+
project: ".agents/skills/",
|
|
36974
37018
|
global: "~/.roo/skills/"
|
|
37019
|
+
},
|
|
37020
|
+
projectStandards: {
|
|
37021
|
+
rules: "agents",
|
|
37022
|
+
skills: "agents"
|
|
36975
37023
|
}
|
|
36976
37024
|
};
|
|
36977
37025
|
super(definition);
|
|
@@ -37095,7 +37143,10 @@ class ZedAgent extends MarkdownRulesAgent {
|
|
|
37095
37143
|
}
|
|
37096
37144
|
],
|
|
37097
37145
|
nativeConfigPath: ".zed/settings.json",
|
|
37098
|
-
rulesPath: "AGENTS.md"
|
|
37146
|
+
rulesPath: "AGENTS.md",
|
|
37147
|
+
projectStandards: {
|
|
37148
|
+
rules: "agents"
|
|
37149
|
+
}
|
|
37099
37150
|
};
|
|
37100
37151
|
super(definition);
|
|
37101
37152
|
}
|
|
@@ -37478,21 +37529,33 @@ class SkillsManager {
|
|
|
37478
37529
|
};
|
|
37479
37530
|
}
|
|
37480
37531
|
const result = { installed: [], skipped: [] };
|
|
37481
|
-
|
|
37482
|
-
|
|
37483
|
-
|
|
37532
|
+
const dirToAgents = new Map;
|
|
37533
|
+
for (const agent of agents) {
|
|
37534
|
+
if (!agent.supportsSkills()) {
|
|
37535
|
+
for (const skill of skills) {
|
|
37484
37536
|
result.skipped.push({ skill, reason: `${agent.name} does not support skills` });
|
|
37485
|
-
continue;
|
|
37486
37537
|
}
|
|
37487
|
-
|
|
37488
|
-
|
|
37538
|
+
continue;
|
|
37539
|
+
}
|
|
37540
|
+
const skillsDir = agent.getSkillsDir(projectPath, options2.global);
|
|
37541
|
+
if (!skillsDir) {
|
|
37542
|
+
for (const skill of skills) {
|
|
37489
37543
|
result.skipped.push({ skill, reason: `No skills directory for ${agent.name}` });
|
|
37490
|
-
continue;
|
|
37491
37544
|
}
|
|
37545
|
+
continue;
|
|
37546
|
+
}
|
|
37547
|
+
const existing = dirToAgents.get(skillsDir) || [];
|
|
37548
|
+
existing.push(agent);
|
|
37549
|
+
dirToAgents.set(skillsDir, existing);
|
|
37550
|
+
}
|
|
37551
|
+
for (const skill of skills) {
|
|
37552
|
+
for (const [skillsDir, dirAgents] of dirToAgents) {
|
|
37492
37553
|
try {
|
|
37493
37554
|
const shouldCopy = options2.copy || resolved.type === "github";
|
|
37494
37555
|
const installedPath = await this.installSkill(skill.path, skill.name, skillsDir, shouldCopy);
|
|
37495
|
-
|
|
37556
|
+
for (const agent of dirAgents) {
|
|
37557
|
+
result.installed.push({ skill, agent: agent.id, path: installedPath });
|
|
37558
|
+
}
|
|
37496
37559
|
} catch (error) {
|
|
37497
37560
|
result.skipped.push({ skill, reason: error.message });
|
|
37498
37561
|
}
|
|
@@ -37659,6 +37722,9 @@ async function detectCommand(options2) {
|
|
|
37659
37722
|
}
|
|
37660
37723
|
}
|
|
37661
37724
|
|
|
37725
|
+
// dist/commands/sync.js
|
|
37726
|
+
import {relative as relative3} from "path";
|
|
37727
|
+
|
|
37662
37728
|
// dist/core/propagator.js
|
|
37663
37729
|
var import_gray_matter2 = __toESM(require_gray_matter(), 1);
|
|
37664
37730
|
import {resolve as resolve7} from "path";
|
|
@@ -40409,6 +40475,7 @@ class Propagator {
|
|
|
40409
40475
|
}
|
|
40410
40476
|
result.changes.push({
|
|
40411
40477
|
agent: generatedFile.agents.join(", "),
|
|
40478
|
+
agents: [...generatedFile.agents],
|
|
40412
40479
|
action: "backed_up",
|
|
40413
40480
|
file: backupPath
|
|
40414
40481
|
});
|
|
@@ -40418,6 +40485,7 @@ class Propagator {
|
|
|
40418
40485
|
}
|
|
40419
40486
|
result.changes.push({
|
|
40420
40487
|
agent: generatedFile.agents.join(", "),
|
|
40488
|
+
agents: [...generatedFile.agents],
|
|
40421
40489
|
action: exists ? "updated" : "created",
|
|
40422
40490
|
file: generatedFile.path
|
|
40423
40491
|
});
|
|
@@ -40438,8 +40506,8 @@ class Propagator {
|
|
|
40438
40506
|
this.agentAdapters.set("cursor", {
|
|
40439
40507
|
buildOutputs: async (_projectPath, content) => [
|
|
40440
40508
|
{
|
|
40441
|
-
path: ".
|
|
40442
|
-
content
|
|
40509
|
+
path: "AGENTS.md",
|
|
40510
|
+
content
|
|
40443
40511
|
}
|
|
40444
40512
|
]
|
|
40445
40513
|
});
|
|
@@ -40475,6 +40543,14 @@ class Propagator {
|
|
|
40475
40543
|
}
|
|
40476
40544
|
]
|
|
40477
40545
|
});
|
|
40546
|
+
this.agentAdapters.set("codex", {
|
|
40547
|
+
buildOutputs: async (_projectPath, content) => [
|
|
40548
|
+
{
|
|
40549
|
+
path: "AGENTS.md",
|
|
40550
|
+
content
|
|
40551
|
+
}
|
|
40552
|
+
]
|
|
40553
|
+
});
|
|
40478
40554
|
this.agentAdapters.set("zed", {
|
|
40479
40555
|
buildOutputs: async (_projectPath, content) => [
|
|
40480
40556
|
{
|
|
@@ -40483,6 +40559,14 @@ class Propagator {
|
|
|
40483
40559
|
}
|
|
40484
40560
|
]
|
|
40485
40561
|
});
|
|
40562
|
+
this.agentAdapters.set("droid", {
|
|
40563
|
+
buildOutputs: async (_projectPath, content) => [
|
|
40564
|
+
{
|
|
40565
|
+
path: "AGENTS.md",
|
|
40566
|
+
content
|
|
40567
|
+
}
|
|
40568
|
+
]
|
|
40569
|
+
});
|
|
40486
40570
|
this.agentAdapters.set("aider", {
|
|
40487
40571
|
buildOutputs: async (projectPath, content) => [
|
|
40488
40572
|
{
|
|
@@ -40758,6 +40842,7 @@ class ManagedStateStore {
|
|
|
40758
40842
|
// dist/commands/sync.js
|
|
40759
40843
|
async function syncCommand(options2) {
|
|
40760
40844
|
const cwd = process.cwd();
|
|
40845
|
+
const agentManager4 = new AgentManager;
|
|
40761
40846
|
logger.title("\uD83D\uDD04 AgentInit - Sync Configuration");
|
|
40762
40847
|
if (options2.dryRun) {
|
|
40763
40848
|
logger.info("Running in dry-run mode - no files will be modified");
|
|
@@ -40790,7 +40875,9 @@ async function syncCommand(options2) {
|
|
|
40790
40875
|
logger.success(`Applied ${result.changes.length} changes:`);
|
|
40791
40876
|
for (const change of result.changes) {
|
|
40792
40877
|
const action = change.action === "created" ? "\u2795" : change.action === "updated" ? "\uD83D\uDCDD" : "\uD83D\uDCBE";
|
|
40793
|
-
|
|
40878
|
+
const names = change.agents.map((id) => agentManager4.getAgentById(id)?.name || id).join(", ");
|
|
40879
|
+
logger.info(` ${action} ${relative3(cwd, change.file) || change.file}`);
|
|
40880
|
+
logger.info(` Agents: ${names}`);
|
|
40794
40881
|
}
|
|
40795
40882
|
if (options2.backup && result.changes.some((c) => c.action === "backed_up")) {
|
|
40796
40883
|
logger.info("\uD83D\uDCBE Backup files created with .agentinit.backup extension");
|
|
@@ -40814,6 +40901,9 @@ async function syncCommand(options2) {
|
|
|
40814
40901
|
}
|
|
40815
40902
|
}
|
|
40816
40903
|
|
|
40904
|
+
// dist/commands/apply.js
|
|
40905
|
+
import {relative as relative4} from "path";
|
|
40906
|
+
|
|
40817
40907
|
// dist/types/index.js
|
|
40818
40908
|
var MCPServerType;
|
|
40819
40909
|
(function(MCPServerType2) {
|
|
@@ -49440,8 +49530,8 @@ class MCPVerifier {
|
|
|
49440
49530
|
import {promises as fs24} from "fs";
|
|
49441
49531
|
import {dirname as dirname5, join as join6} from "path";
|
|
49442
49532
|
var normalizeIgnorePath = function(projectPath, value) {
|
|
49443
|
-
const
|
|
49444
|
-
const normalized =
|
|
49533
|
+
const relative4 = value.startsWith(projectPath) ? value.slice(projectPath.length + 1) : value;
|
|
49534
|
+
const normalized = relative4.replace(/\\/g, "/").replace(/^\/+/, "");
|
|
49445
49535
|
if (!normalized) {
|
|
49446
49536
|
return normalized;
|
|
49447
49537
|
}
|
|
@@ -49569,8 +49659,8 @@ async function discoverProjectSkills(projectPath, skillsManager3) {
|
|
|
49569
49659
|
};
|
|
49570
49660
|
}
|
|
49571
49661
|
async function applyProjectSkills(projectPath, targetAgentIds, managedState2, options2 = {}) {
|
|
49572
|
-
const
|
|
49573
|
-
const skillsManager3 = new SkillsManager(
|
|
49662
|
+
const agentManager5 = new AgentManager;
|
|
49663
|
+
const skillsManager3 = new SkillsManager(agentManager5);
|
|
49574
49664
|
const { sources, skills } = await discoverProjectSkills(projectPath, skillsManager3);
|
|
49575
49665
|
const installed = [];
|
|
49576
49666
|
const skipped = [];
|
|
@@ -49582,7 +49672,7 @@ async function applyProjectSkills(projectPath, targetAgentIds, managedState2, op
|
|
|
49582
49672
|
skipped
|
|
49583
49673
|
};
|
|
49584
49674
|
}
|
|
49585
|
-
const targetAgents = targetAgentIds.map((id) =>
|
|
49675
|
+
const targetAgents = targetAgentIds.map((id) => agentManager5.getAgentById(id)).filter((agent) => !!agent);
|
|
49586
49676
|
if (targetAgents.length === 0) {
|
|
49587
49677
|
return {
|
|
49588
49678
|
discovered: skills.length,
|
|
@@ -49662,6 +49752,7 @@ function hasLegacyApplyArgs(args) {
|
|
|
49662
49752
|
}
|
|
49663
49753
|
async function applyProjectCommand(options2) {
|
|
49664
49754
|
const cwd = process.cwd();
|
|
49755
|
+
const agentManager6 = new AgentManager;
|
|
49665
49756
|
let managedState3 = null;
|
|
49666
49757
|
logger.title("\uD83D\uDD27 AgentInit - Apply");
|
|
49667
49758
|
if (options2.dryRun) {
|
|
@@ -49721,15 +49812,29 @@ async function applyProjectCommand(options2) {
|
|
|
49721
49812
|
syncResult.changes.forEach((change) => {
|
|
49722
49813
|
if (change.action === "backed_up")
|
|
49723
49814
|
return;
|
|
49724
|
-
|
|
49815
|
+
const names = change.agents.map((id) => agentManager6.getAgentById(id)?.name || id).join(", ");
|
|
49816
|
+
logger.info(` ${relative4(cwd, change.file) || change.file}`);
|
|
49817
|
+
logger.info(` Agents: ${names}`);
|
|
49725
49818
|
});
|
|
49726
49819
|
}
|
|
49727
49820
|
if (projectSkills2.installed.length > 0) {
|
|
49728
49821
|
logger.info("");
|
|
49729
49822
|
logger.info(`Installed ${green(String(projectSkills2.installed.length))} project skill target(s):`);
|
|
49730
|
-
|
|
49731
|
-
|
|
49732
|
-
|
|
49823
|
+
const installsByPath = new Map;
|
|
49824
|
+
for (const item of projectSkills2.installed) {
|
|
49825
|
+
const existing = installsByPath.get(item.path) || {
|
|
49826
|
+
agents: new Set,
|
|
49827
|
+
skills: new Set
|
|
49828
|
+
};
|
|
49829
|
+
existing.agents.add(agentManager6.getAgentById(item.agent)?.name || item.agent);
|
|
49830
|
+
existing.skills.add(item.skill.name);
|
|
49831
|
+
installsByPath.set(item.path, existing);
|
|
49832
|
+
}
|
|
49833
|
+
for (const [path, details] of installsByPath) {
|
|
49834
|
+
logger.info(` ${relative4(cwd, path) || path}`);
|
|
49835
|
+
logger.info(` Agents: ${[...details.agents].join(", ")}`);
|
|
49836
|
+
logger.info(` Skills: ${[...details.skills].join(", ")}`);
|
|
49837
|
+
}
|
|
49733
49838
|
}
|
|
49734
49839
|
}
|
|
49735
49840
|
if (projectSkills2.discovered > 0) {
|
|
@@ -49879,13 +49984,13 @@ async function applyCommand(args) {
|
|
|
49879
49984
|
process.exit(1);
|
|
49880
49985
|
}
|
|
49881
49986
|
spinner.text = isGlobal ? "Preparing global configuration..." : "Detecting agents...";
|
|
49882
|
-
const
|
|
49987
|
+
const agentManager6 = new AgentManager;
|
|
49883
49988
|
let targetAgents;
|
|
49884
49989
|
if (specifiedClient) {
|
|
49885
|
-
const agent =
|
|
49990
|
+
const agent = agentManager6.getAgentById(specifiedClient);
|
|
49886
49991
|
if (!agent) {
|
|
49887
49992
|
spinner.fail(`Unknown agent: ${specifiedClient}`);
|
|
49888
|
-
logger.error(`Supported agents: ${
|
|
49993
|
+
logger.error(`Supported agents: ${agentManager6.getSupportedAgentIds().join(", ")}`);
|
|
49889
49994
|
process.exit(1);
|
|
49890
49995
|
}
|
|
49891
49996
|
if (isGlobal) {
|
|
@@ -49918,11 +50023,11 @@ async function applyCommand(args) {
|
|
|
49918
50023
|
spinner.fail("Global configuration requires specifying an agent with --agent");
|
|
49919
50024
|
process.exit(1);
|
|
49920
50025
|
}
|
|
49921
|
-
const detectedAgents = await
|
|
50026
|
+
const detectedAgents = await agentManager6.detectAgents(cwd);
|
|
49922
50027
|
if (detectedAgents.length === 0) {
|
|
49923
50028
|
spinner.warn("No AI coding agents detected in this project");
|
|
49924
50029
|
logger.info("Supported agents:");
|
|
49925
|
-
|
|
50030
|
+
agentManager6.getAllAgents().forEach((agent) => {
|
|
49926
50031
|
logger.info(` \u2022 ${agent.name} (${agent.id})`);
|
|
49927
50032
|
logger.info(` Files: ${agent.configFiles.map((c) => c.path).join(", ")}`);
|
|
49928
50033
|
});
|
|
@@ -50247,8 +50352,8 @@ async function verifyMcpCommand(args) {
|
|
|
50247
50352
|
spinner.text = `Verifying ${serversToVerify.length} MCP server(s) from arguments...`;
|
|
50248
50353
|
} else {
|
|
50249
50354
|
spinner = ora("Detecting agents and MCP configurations...").start();
|
|
50250
|
-
const
|
|
50251
|
-
const detectedAgents = await
|
|
50355
|
+
const agentManager7 = new AgentManager;
|
|
50356
|
+
const detectedAgents = await agentManager7.detectAgents(cwd);
|
|
50252
50357
|
if (detectedAgents.length === 0) {
|
|
50253
50358
|
spinner.warn("No AI coding agents detected in this project");
|
|
50254
50359
|
logger.info("Run `agentinit detect` to see which agents are supported");
|
|
@@ -50416,12 +50521,13 @@ async function revertCommand(options2) {
|
|
|
50416
50521
|
}
|
|
50417
50522
|
|
|
50418
50523
|
// dist/commands/skills.js
|
|
50524
|
+
import {relative as relative5} from "path";
|
|
50419
50525
|
function registerSkillsCommand(program2) {
|
|
50420
50526
|
const skills = program2.command("skills").description("Manage agent skills");
|
|
50421
50527
|
skills.command("add <source>").description("Add skills from a GitHub repo or local path").option("-g, --global", "Install skills globally").option("-a, --agent <agents...>", "Target specific agent(s)").option("-s, --skill <names...>", "Install only specific skills by name").option("-l, --list", "List available skills from the source without installing").option("--copy", "Copy skill files instead of symlinking").option("-y, --yes", "Skip confirmation prompts").action(async (source, options2) => {
|
|
50422
50528
|
logger.title("\uD83D\uDCE6 AgentInit - Skills");
|
|
50423
|
-
const
|
|
50424
|
-
const skillsManager4 = new SkillsManager(
|
|
50529
|
+
const agentManager8 = new AgentManager;
|
|
50530
|
+
const skillsManager4 = new SkillsManager(agentManager8);
|
|
50425
50531
|
if (options2.list) {
|
|
50426
50532
|
const spinner2 = ora("Discovering skills...").start();
|
|
50427
50533
|
try {
|
|
@@ -50476,13 +50582,23 @@ function registerSkillsCommand(program2) {
|
|
|
50476
50582
|
spinner.warn("No skills found in the source.");
|
|
50477
50583
|
return;
|
|
50478
50584
|
}
|
|
50479
|
-
|
|
50480
|
-
|
|
50585
|
+
const uniqueInstallCount = new Set(result.installed.map((item) => `${item.path}:${item.skill.name}`)).size;
|
|
50586
|
+
spinner.succeed(`Installed ${green(String(uniqueInstallCount))} skill(s)`);
|
|
50587
|
+
const byPath = new Map;
|
|
50481
50588
|
for (const item of result.installed) {
|
|
50482
|
-
|
|
50589
|
+
const path = item.path;
|
|
50590
|
+
const existing = byPath.get(path) || {
|
|
50591
|
+
agents: new Set,
|
|
50592
|
+
skills: new Set
|
|
50593
|
+
};
|
|
50594
|
+
existing.agents.add(agentManager8.getAgentById(item.agent)?.name || item.agent);
|
|
50595
|
+
existing.skills.add(item.skill.name);
|
|
50596
|
+
byPath.set(path, existing);
|
|
50483
50597
|
}
|
|
50484
|
-
for (const [
|
|
50485
|
-
logger.info(` ${
|
|
50598
|
+
for (const [path, details] of byPath) {
|
|
50599
|
+
logger.info(` ${relative5(process.cwd(), path) || path}`);
|
|
50600
|
+
logger.info(` Agents: ${[...details.agents].join(", ")}`);
|
|
50601
|
+
logger.info(` Skills: ${green(String(details.skills.size))} installed (${[...details.skills].join(", ")})`);
|
|
50486
50602
|
}
|
|
50487
50603
|
if (result.skipped.length > 0) {
|
|
50488
50604
|
logger.info("");
|
|
@@ -50499,8 +50615,8 @@ function registerSkillsCommand(program2) {
|
|
|
50499
50615
|
});
|
|
50500
50616
|
skills.command("list").alias("ls").description("List installed skills").option("-g, --global", "List only global skills").option("-a, --agent <agents...>", "Filter by specific agent(s)").action(async (options2) => {
|
|
50501
50617
|
logger.title("\uD83D\uDCE6 AgentInit - Skills");
|
|
50502
|
-
const
|
|
50503
|
-
const skillsManager4 = new SkillsManager(
|
|
50618
|
+
const agentManager8 = new AgentManager;
|
|
50619
|
+
const skillsManager4 = new SkillsManager(agentManager8);
|
|
50504
50620
|
const installed = await skillsManager4.listInstalled(process.cwd(), {
|
|
50505
50621
|
global: options2.global,
|
|
50506
50622
|
agents: options2.agent
|
|
@@ -50533,8 +50649,8 @@ function registerSkillsCommand(program2) {
|
|
|
50533
50649
|
return;
|
|
50534
50650
|
}
|
|
50535
50651
|
}
|
|
50536
|
-
const
|
|
50537
|
-
const skillsManager4 = new SkillsManager(
|
|
50652
|
+
const agentManager8 = new AgentManager;
|
|
50653
|
+
const skillsManager4 = new SkillsManager(agentManager8);
|
|
50538
50654
|
const result = await skillsManager4.remove(names, process.cwd(), {
|
|
50539
50655
|
global: options2.global,
|
|
50540
50656
|
agents: options2.agent,
|
|
@@ -50574,26 +50690,23 @@ var filterMcpArgs = function(args) {
|
|
|
50574
50690
|
}
|
|
50575
50691
|
return filtered;
|
|
50576
50692
|
};
|
|
50577
|
-
async function resolveAgents(
|
|
50693
|
+
async function resolveAgents(agentManager9, agentIds, isGlobal, cwd) {
|
|
50578
50694
|
if (agentIds && agentIds.length > 0) {
|
|
50579
50695
|
const results = [];
|
|
50580
50696
|
for (const id of agentIds) {
|
|
50581
|
-
const agent =
|
|
50697
|
+
const agent = agentManager9.getAgentById(id);
|
|
50582
50698
|
if (!agent) {
|
|
50583
50699
|
logger.error(`Unknown agent: ${id}`);
|
|
50584
|
-
logger.info(`Supported agents: ${
|
|
50700
|
+
logger.info(`Supported agents: ${agentManager9.getSupportedAgentIds().join(", ")}`);
|
|
50585
50701
|
process.exit(1);
|
|
50586
50702
|
}
|
|
50587
50703
|
if (isGlobal && !agent.supportsGlobalConfig()) {
|
|
50588
50704
|
logger.error(`Agent ${agent.name} does not support global configuration`);
|
|
50589
50705
|
process.exit(1);
|
|
50590
50706
|
}
|
|
50591
|
-
if (!isGlobal) {
|
|
50592
|
-
|
|
50593
|
-
|
|
50594
|
-
logger.warning(`Agent ${id} not detected in project, skipping`);
|
|
50595
|
-
continue;
|
|
50596
|
-
}
|
|
50707
|
+
if (!isGlobal && !agent.supportsProjectMcpConfig()) {
|
|
50708
|
+
logger.error(`Agent ${agent.name} only supports global MCP configuration. Use --global.`);
|
|
50709
|
+
process.exit(1);
|
|
50597
50710
|
}
|
|
50598
50711
|
results.push({ agent, isGlobal });
|
|
50599
50712
|
}
|
|
@@ -50603,19 +50716,61 @@ async function resolveAgents(agentManager8, agentIds, isGlobal, cwd) {
|
|
|
50603
50716
|
logger.error("--global requires --agent to specify target agent(s)");
|
|
50604
50717
|
process.exit(1);
|
|
50605
50718
|
}
|
|
50606
|
-
const
|
|
50719
|
+
const detector = new AgentDetector;
|
|
50720
|
+
const detectedConfigs = await detector.detectAgents(cwd);
|
|
50721
|
+
const detected = detectedConfigs.filter((config) => config.detected).map((config) => agentManager9.getAgentById(config.name)).filter((agent) => !!agent).filter((agent) => agent.supportsProjectMcpConfig());
|
|
50607
50722
|
if (detected.length === 0) {
|
|
50608
50723
|
logger.warning("No AI coding agents detected in this project");
|
|
50609
50724
|
logger.info("Supported agents:");
|
|
50610
|
-
|
|
50725
|
+
agentManager9.getAllAgents().filter((a) => a.supportsProjectMcpConfig()).forEach((a) => {
|
|
50611
50726
|
logger.info(` - ${a.name} (${a.id})`);
|
|
50612
50727
|
});
|
|
50613
50728
|
logger.info("");
|
|
50614
50729
|
logger.info("To target a specific agent, use: --agent <agent-id>");
|
|
50615
50730
|
return [];
|
|
50616
50731
|
}
|
|
50617
|
-
return detected.map((
|
|
50732
|
+
return detected.map((agent) => ({ agent, isGlobal: false }));
|
|
50618
50733
|
}
|
|
50734
|
+
var buildPlannedTargets = function(targets, servers, cwd) {
|
|
50735
|
+
const plans = [];
|
|
50736
|
+
for (const { agent, isGlobal } of targets) {
|
|
50737
|
+
const filtered = MCPFilter.filterForAgent(agent, servers);
|
|
50738
|
+
if (filtered.servers.length === 0) {
|
|
50739
|
+
continue;
|
|
50740
|
+
}
|
|
50741
|
+
const configPath = isGlobal ? agent.getGlobalMcpPath() : agent.getNativeMcpPath(cwd);
|
|
50742
|
+
if (!configPath) {
|
|
50743
|
+
continue;
|
|
50744
|
+
}
|
|
50745
|
+
plans.push({
|
|
50746
|
+
agent,
|
|
50747
|
+
isGlobal,
|
|
50748
|
+
configPath,
|
|
50749
|
+
servers: filtered.servers,
|
|
50750
|
+
transformations: filtered.transformations
|
|
50751
|
+
});
|
|
50752
|
+
}
|
|
50753
|
+
return plans;
|
|
50754
|
+
};
|
|
50755
|
+
var logPlannedTargets = function(plans) {
|
|
50756
|
+
if (plans.length === 0) {
|
|
50757
|
+
return;
|
|
50758
|
+
}
|
|
50759
|
+
const grouped = new Map;
|
|
50760
|
+
for (const plan of plans) {
|
|
50761
|
+
const existing = grouped.get(plan.configPath) || [];
|
|
50762
|
+
existing.push(plan.agent.name);
|
|
50763
|
+
grouped.set(plan.configPath, existing);
|
|
50764
|
+
}
|
|
50765
|
+
logger.info("Planned targets:");
|
|
50766
|
+
for (const [configPath, agentNames] of grouped) {
|
|
50767
|
+
logger.info(` - ${configPath}`);
|
|
50768
|
+
for (const agentName of agentNames) {
|
|
50769
|
+
logger.info(` ${agentName}`);
|
|
50770
|
+
}
|
|
50771
|
+
}
|
|
50772
|
+
logger.info("");
|
|
50773
|
+
};
|
|
50619
50774
|
var registerAddCommand = function(mcp) {
|
|
50620
50775
|
mcp.command("add").description("Add MCP server(s) to agent configurations").allowUnknownOption(true).option("--agent <agents...>", "Target specific agent(s)").option("-g, --global", "Apply to global configuration").option("--verify", "Verify MCP servers after adding").option("--timeout <ms>", "Connection timeout for verification (ms)").action(async (options2, command) => {
|
|
50621
50776
|
const cwd = process.cwd();
|
|
@@ -50650,42 +50805,56 @@ var registerAddCommand = function(mcp) {
|
|
|
50650
50805
|
return;
|
|
50651
50806
|
}
|
|
50652
50807
|
spinner.text = "Resolving target agents...";
|
|
50653
|
-
const
|
|
50808
|
+
const agentManager9 = new AgentManager;
|
|
50654
50809
|
const isGlobal = !!options2.global;
|
|
50655
|
-
const targets = await resolveAgents(
|
|
50810
|
+
const targets = await resolveAgents(agentManager9, options2.agent, isGlobal, cwd);
|
|
50656
50811
|
if (targets.length === 0) {
|
|
50657
50812
|
spinner.warn("No target agents resolved");
|
|
50658
50813
|
return;
|
|
50659
50814
|
}
|
|
50660
|
-
|
|
50661
|
-
|
|
50662
|
-
spinner.
|
|
50663
|
-
|
|
50664
|
-
|
|
50665
|
-
|
|
50666
|
-
|
|
50815
|
+
const plans = buildPlannedTargets(targets, parsed.servers, cwd);
|
|
50816
|
+
if (plans.length === 0) {
|
|
50817
|
+
spinner.warn("No servers were applied (all filtered out)");
|
|
50818
|
+
return;
|
|
50819
|
+
}
|
|
50820
|
+
spinner.stop();
|
|
50821
|
+
logPlannedTargets(plans);
|
|
50822
|
+
if (options2.verify) {
|
|
50823
|
+
const timeout = options2.timeout ? parseInt(options2.timeout, 10) : undefined;
|
|
50824
|
+
const verificationSources = plans.flatMap((plan) => plan.servers.map((server) => ({
|
|
50825
|
+
server,
|
|
50826
|
+
agentName: plan.agent.name,
|
|
50827
|
+
configPath: plan.configPath
|
|
50828
|
+
})));
|
|
50829
|
+
const verificationResult = await runVerification(plans.flatMap((plan) => plan.servers), timeout, undefined, verificationSources);
|
|
50830
|
+
if (!verificationResult.allSucceeded) {
|
|
50831
|
+
logger.error("Verification failed. No MCP configuration changes were applied.");
|
|
50832
|
+
process.exit(1);
|
|
50667
50833
|
}
|
|
50668
|
-
|
|
50669
|
-
|
|
50834
|
+
logger.info("");
|
|
50835
|
+
}
|
|
50836
|
+
const spinnerApply = ora("Applying MCP configuration...").start();
|
|
50837
|
+
let totalApplied = 0;
|
|
50838
|
+
for (const plan of plans) {
|
|
50839
|
+
spinnerApply.text = `Applying to ${plan.agent.name}...`;
|
|
50840
|
+
if (plan.isGlobal) {
|
|
50841
|
+
await plan.agent.applyGlobalMCPConfig(plan.servers);
|
|
50670
50842
|
} else {
|
|
50671
|
-
await agent.applyMCPConfig(cwd,
|
|
50672
|
-
}
|
|
50673
|
-
totalApplied += filtered.servers.length;
|
|
50674
|
-
const configPath = global3 ? agent.getGlobalMcpPath() : agent.getNativeMcpPath(cwd);
|
|
50675
|
-
logger.info(` ${green("+")} ${agent.name}: ${filtered.servers.length} server(s) added`);
|
|
50676
|
-
if (configPath) {
|
|
50677
|
-
logger.info(` Config: ${configPath}`);
|
|
50843
|
+
await plan.agent.applyMCPConfig(cwd, plan.servers);
|
|
50678
50844
|
}
|
|
50679
|
-
|
|
50680
|
-
|
|
50845
|
+
totalApplied += plan.servers.length;
|
|
50846
|
+
logger.info(` ${green("+")} ${plan.agent.name}: ${plan.servers.length} server(s) added`);
|
|
50847
|
+
logger.info(` Config: ${plan.configPath}`);
|
|
50848
|
+
if (plan.transformations.length > 0) {
|
|
50849
|
+
plan.transformations.forEach((t) => {
|
|
50681
50850
|
logger.info(` ${yellow("~")} ${t.original.name}: ${t.reason}`);
|
|
50682
50851
|
});
|
|
50683
50852
|
}
|
|
50684
50853
|
}
|
|
50685
50854
|
if (totalApplied === 0) {
|
|
50686
|
-
|
|
50855
|
+
spinnerApply.warn("No servers were applied (all filtered out)");
|
|
50687
50856
|
} else {
|
|
50688
|
-
|
|
50857
|
+
spinnerApply.succeed(`Added ${totalApplied} MCP server(s)`);
|
|
50689
50858
|
parsed.servers.forEach((server) => {
|
|
50690
50859
|
const typeLabel = server.type.toUpperCase();
|
|
50691
50860
|
if (server.type === "stdio" && server.command) {
|
|
@@ -50695,11 +50864,6 @@ var registerAddCommand = function(mcp) {
|
|
|
50695
50864
|
}
|
|
50696
50865
|
});
|
|
50697
50866
|
}
|
|
50698
|
-
if (options2.verify && parsed.servers.length > 0) {
|
|
50699
|
-
logger.info("");
|
|
50700
|
-
const timeout = options2.timeout ? parseInt(options2.timeout, 10) : undefined;
|
|
50701
|
-
await runVerification(parsed.servers, timeout);
|
|
50702
|
-
}
|
|
50703
50867
|
} catch (error) {
|
|
50704
50868
|
spinner.fail("Failed to add MCP servers");
|
|
50705
50869
|
if (error instanceof MCPParseError) {
|
|
@@ -50714,11 +50878,11 @@ var registerAddCommand = function(mcp) {
|
|
|
50714
50878
|
var registerListCommand = function(mcp) {
|
|
50715
50879
|
mcp.command("list").alias("ls").description("List configured MCP servers").option("--agent <agents...>", "Target specific agent(s)").option("-g, --global", "List global configuration").action(async (options2) => {
|
|
50716
50880
|
const cwd = process.cwd();
|
|
50717
|
-
const
|
|
50881
|
+
const agentManager9 = new AgentManager;
|
|
50718
50882
|
const isGlobal = !!options2.global;
|
|
50719
50883
|
const spinner = ora("Reading MCP configurations...").start();
|
|
50720
50884
|
try {
|
|
50721
|
-
const targets = await resolveAgents(
|
|
50885
|
+
const targets = await resolveAgents(agentManager9, options2.agent, isGlobal, cwd);
|
|
50722
50886
|
if (targets.length === 0) {
|
|
50723
50887
|
spinner.warn("No target agents resolved");
|
|
50724
50888
|
return;
|
|
@@ -50781,11 +50945,11 @@ var registerListCommand = function(mcp) {
|
|
|
50781
50945
|
var registerRemoveCommand = function(mcp) {
|
|
50782
50946
|
mcp.command("remove <name>").description("Remove an MCP server by name").option("--agent <agents...>", "Target specific agent(s)").option("-g, --global", "Remove from global configuration").action(async (name, options2) => {
|
|
50783
50947
|
const cwd = process.cwd();
|
|
50784
|
-
const
|
|
50948
|
+
const agentManager9 = new AgentManager;
|
|
50785
50949
|
const isGlobal = !!options2.global;
|
|
50786
50950
|
const spinner = ora(`Removing MCP server "${name}"...`).start();
|
|
50787
50951
|
try {
|
|
50788
|
-
const targets = await resolveAgents(
|
|
50952
|
+
const targets = await resolveAgents(agentManager9, options2.agent, isGlobal, cwd);
|
|
50789
50953
|
if (targets.length === 0) {
|
|
50790
50954
|
spinner.warn("No target agents resolved");
|
|
50791
50955
|
return;
|
|
@@ -50875,8 +51039,8 @@ var registerVerifyCommand = function(mcp) {
|
|
|
50875
51039
|
spinner.text = `Verifying ${serversToVerify.length} MCP server(s) from arguments...`;
|
|
50876
51040
|
} else {
|
|
50877
51041
|
spinner.text = "Detecting agents and MCP configurations...";
|
|
50878
|
-
const
|
|
50879
|
-
const detectedAgents = await
|
|
51042
|
+
const agentManager9 = new AgentManager;
|
|
51043
|
+
const detectedAgents = await resolveAgents(agentManager9, undefined, false, cwd);
|
|
50880
51044
|
if (detectedAgents.length === 0) {
|
|
50881
51045
|
spinner.warn("No AI coding agents detected in this project");
|
|
50882
51046
|
logger.info("Run `agentinit detect` to see which agents are supported");
|
|
@@ -50980,6 +51144,11 @@ async function runVerification(servers, timeout, spinner, serverSources) {
|
|
|
50980
51144
|
logger.info(" 3. Verify network connectivity for HTTP/SSE servers");
|
|
50981
51145
|
logger.info(" 4. Try increasing timeout with --timeout <ms>");
|
|
50982
51146
|
}
|
|
51147
|
+
return {
|
|
51148
|
+
results,
|
|
51149
|
+
successCount,
|
|
51150
|
+
allSucceeded: successCount === results.length
|
|
51151
|
+
};
|
|
50983
51152
|
}
|
|
50984
51153
|
function registerMcpCommand(program2) {
|
|
50985
51154
|
const mcp = program2.command("mcp").description("Manage MCP server configurations");
|
|
@@ -51010,7 +51179,7 @@ var colorizeTokenDiff2 = function(diff) {
|
|
|
51010
51179
|
return green(`+${diff}`);
|
|
51011
51180
|
return red(`${diff}`);
|
|
51012
51181
|
};
|
|
51013
|
-
async function resolveTargetAgents(
|
|
51182
|
+
async function resolveTargetAgents(agentManager10, options2, cwd) {
|
|
51014
51183
|
if (options2.global && !options2.agent?.length) {
|
|
51015
51184
|
logger.error("--global flag requires --agent to specify target agent(s)");
|
|
51016
51185
|
logger.info("Example: agentinit rules add --global --agent claude --template git");
|
|
@@ -51019,10 +51188,10 @@ async function resolveTargetAgents(agentManager9, options2, cwd) {
|
|
|
51019
51188
|
if (options2.agent?.length) {
|
|
51020
51189
|
const agents = [];
|
|
51021
51190
|
for (const id of options2.agent) {
|
|
51022
|
-
const agent =
|
|
51191
|
+
const agent = agentManager10.getAgentById(id);
|
|
51023
51192
|
if (!agent) {
|
|
51024
51193
|
logger.error(`Unknown agent: ${id}`);
|
|
51025
|
-
logger.info(`Supported agents: ${
|
|
51194
|
+
logger.info(`Supported agents: ${agentManager10.getSupportedAgentIds().join(", ")}`);
|
|
51026
51195
|
process.exit(1);
|
|
51027
51196
|
}
|
|
51028
51197
|
if (options2.global && !agent.supportsGlobalRules()) {
|
|
@@ -51033,11 +51202,11 @@ async function resolveTargetAgents(agentManager9, options2, cwd) {
|
|
|
51033
51202
|
}
|
|
51034
51203
|
return agents;
|
|
51035
51204
|
}
|
|
51036
|
-
const detected = await
|
|
51205
|
+
const detected = await agentManager10.detectAgents(cwd);
|
|
51037
51206
|
if (detected.length === 0) {
|
|
51038
51207
|
logger.warning("No AI coding agents detected in this project");
|
|
51039
51208
|
logger.info("Supported agents:");
|
|
51040
|
-
|
|
51209
|
+
agentManager10.getAllAgents().forEach((a) => {
|
|
51041
51210
|
logger.info(` - ${a.name} (${a.id})`);
|
|
51042
51211
|
});
|
|
51043
51212
|
logger.info("");
|
|
@@ -51112,8 +51281,8 @@ function registerRulesCommand(program2) {
|
|
|
51112
51281
|
return;
|
|
51113
51282
|
}
|
|
51114
51283
|
spinner.text = "Resolving agents...";
|
|
51115
|
-
const
|
|
51116
|
-
const agents = await resolveTargetAgents(
|
|
51284
|
+
const agentManager10 = new AgentManager;
|
|
51285
|
+
const agents = await resolveTargetAgents(agentManager10, options2, cwd);
|
|
51117
51286
|
const results = [];
|
|
51118
51287
|
for (const agent of agents) {
|
|
51119
51288
|
if (!agent.capabilities.rules) {
|
|
@@ -51194,8 +51363,8 @@ function registerRulesCommand(program2) {
|
|
|
51194
51363
|
logger.title("\uD83D\uDCCF AgentInit - Rules");
|
|
51195
51364
|
const cwd = process.cwd();
|
|
51196
51365
|
const isGlobal = !!options2.global;
|
|
51197
|
-
const
|
|
51198
|
-
const agents = await resolveTargetAgents(
|
|
51366
|
+
const agentManager10 = new AgentManager;
|
|
51367
|
+
const agents = await resolveTargetAgents(agentManager10, options2, cwd);
|
|
51199
51368
|
let foundAny = false;
|
|
51200
51369
|
for (const agent of agents) {
|
|
51201
51370
|
if (!agent.capabilities.rules) {
|
|
@@ -51242,8 +51411,8 @@ function registerRulesCommand(program2) {
|
|
|
51242
51411
|
}
|
|
51243
51412
|
const cwd = process.cwd();
|
|
51244
51413
|
const isGlobal = !!options2.global;
|
|
51245
|
-
const
|
|
51246
|
-
const agents = await resolveTargetAgents(
|
|
51414
|
+
const agentManager10 = new AgentManager;
|
|
51415
|
+
const agents = await resolveTargetAgents(agentManager10, options2, cwd);
|
|
51247
51416
|
const spinner = ora("Removing rules...").start();
|
|
51248
51417
|
let totalRemoved = 0;
|
|
51249
51418
|
try {
|
|
@@ -51314,8 +51483,8 @@ var MARKETPLACES = [
|
|
|
51314
51483
|
class PluginManager {
|
|
51315
51484
|
agentManager;
|
|
51316
51485
|
skillsManager;
|
|
51317
|
-
constructor(
|
|
51318
|
-
this.agentManager =
|
|
51486
|
+
constructor(agentManager11) {
|
|
51487
|
+
this.agentManager = agentManager11 || new AgentManager;
|
|
51319
51488
|
this.skillsManager = new SkillsManager(this.agentManager);
|
|
51320
51489
|
}
|
|
51321
51490
|
resolveSource(source, options2) {
|
|
@@ -51971,8 +52140,8 @@ function registerPluginsCommand(program2) {
|
|
|
51971
52140
|
const plugins = program2.command("plugins").description("Install agent-agnostic plugins from any marketplace or source");
|
|
51972
52141
|
plugins.command("install <source>").description("Install a plugin from <marketplace>/<name>, a GitHub repo, or a local path").option("--from <marketplace>", `Marketplace source override (available: ${marketplaceHelp})`).option("-a, --agent <agents...>", "Target specific agent(s)").option("-g, --global", "Install globally").option("-l, --list", "Preview plugin contents without installing").option("-y, --yes", "Skip confirmation prompts, auto-detect all agents").action(async (source, options2) => {
|
|
51973
52142
|
logger.title("\uD83D\uDD0C AgentInit - Plugins");
|
|
51974
|
-
const
|
|
51975
|
-
const pluginManager2 = new PluginManager(
|
|
52143
|
+
const agentManager12 = new AgentManager;
|
|
52144
|
+
const pluginManager2 = new PluginManager(agentManager12);
|
|
51976
52145
|
if (options2.list) {
|
|
51977
52146
|
const spinner2 = ora("Fetching plugin...").start();
|
|
51978
52147
|
try {
|