allagents 1.0.15 → 1.2.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/LICENSE +21 -21
- package/README.md +472 -471
- package/dist/index.js +640 -130
- package/dist/templates/default/.allagents/workspace.yaml +15 -15
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6378,7 +6378,7 @@ var require_parse = __commonJS((exports, module) => {
|
|
|
6378
6378
|
var token;
|
|
6379
6379
|
var key;
|
|
6380
6380
|
var root;
|
|
6381
|
-
module.exports = function
|
|
6381
|
+
module.exports = function parse2(text, reviver) {
|
|
6382
6382
|
source = String(text);
|
|
6383
6383
|
parseState = "start";
|
|
6384
6384
|
stack = [];
|
|
@@ -11529,7 +11529,37 @@ var init_workspace_config = __esm(() => {
|
|
|
11529
11529
|
]);
|
|
11530
11530
|
InstallModeSchema = exports_external.enum(["file", "native"]);
|
|
11531
11531
|
ClientEntrySchema = exports_external.union([
|
|
11532
|
-
|
|
11532
|
+
exports_external.string().transform((s, ctx) => {
|
|
11533
|
+
const colonIdx = s.indexOf(":");
|
|
11534
|
+
if (colonIdx === -1) {
|
|
11535
|
+
const result = ClientTypeSchema.safeParse(s);
|
|
11536
|
+
if (!result.success) {
|
|
11537
|
+
for (const issue of result.error.issues)
|
|
11538
|
+
ctx.addIssue(issue);
|
|
11539
|
+
return exports_external.NEVER;
|
|
11540
|
+
}
|
|
11541
|
+
return result.data;
|
|
11542
|
+
}
|
|
11543
|
+
const name = s.slice(0, colonIdx);
|
|
11544
|
+
const mode = s.slice(colonIdx + 1);
|
|
11545
|
+
const nameResult = ClientTypeSchema.safeParse(name);
|
|
11546
|
+
if (!nameResult.success) {
|
|
11547
|
+
ctx.addIssue({
|
|
11548
|
+
code: exports_external.ZodIssueCode.custom,
|
|
11549
|
+
message: `Invalid client type: '${name}'`
|
|
11550
|
+
});
|
|
11551
|
+
return exports_external.NEVER;
|
|
11552
|
+
}
|
|
11553
|
+
const modeResult = InstallModeSchema.safeParse(mode);
|
|
11554
|
+
if (!modeResult.success) {
|
|
11555
|
+
ctx.addIssue({
|
|
11556
|
+
code: exports_external.ZodIssueCode.custom,
|
|
11557
|
+
message: `Invalid install mode: '${mode}'. Valid modes: ${InstallModeSchema.options.join(", ")}`
|
|
11558
|
+
});
|
|
11559
|
+
return exports_external.NEVER;
|
|
11560
|
+
}
|
|
11561
|
+
return { name: nameResult.data, install: modeResult.data };
|
|
11562
|
+
}),
|
|
11533
11563
|
exports_external.object({
|
|
11534
11564
|
name: ClientTypeSchema,
|
|
11535
11565
|
install: InstallModeSchema.default("file")
|
|
@@ -13446,7 +13476,7 @@ function gitInstanceFactory(baseDir, options2) {
|
|
|
13446
13476
|
}
|
|
13447
13477
|
var import_file_exists, import_debug, import_promise_deferred, import_promise_deferred2, __defProp2, __getOwnPropDesc2, __getOwnPropNames2, __hasOwnProp2, __esm2 = (fn, res) => function __init() {
|
|
13448
13478
|
return fn && (res = (0, fn[__getOwnPropNames2(fn)[0]])(fn = 0)), res;
|
|
13449
|
-
}, __commonJS2 = (cb, mod) => function
|
|
13479
|
+
}, __commonJS2 = (cb, mod) => function __require2() {
|
|
13450
13480
|
return mod || (0, cb[__getOwnPropNames2(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
13451
13481
|
}, __export2 = (target, all) => {
|
|
13452
13482
|
for (var name in all)
|
|
@@ -21933,7 +21963,7 @@ var require_is_extendable = __commonJS((exports, module) => {
|
|
|
21933
21963
|
// node_modules/extend-shallow/index.js
|
|
21934
21964
|
var require_extend_shallow = __commonJS((exports, module) => {
|
|
21935
21965
|
var isObject2 = require_is_extendable();
|
|
21936
|
-
module.exports = function
|
|
21966
|
+
module.exports = function extend3(o) {
|
|
21937
21967
|
if (!isObject2(o)) {
|
|
21938
21968
|
o = {};
|
|
21939
21969
|
}
|
|
@@ -22127,7 +22157,7 @@ var require_exception = __commonJS((exports, module) => {
|
|
|
22127
22157
|
}
|
|
22128
22158
|
YAMLException2.prototype = Object.create(Error.prototype);
|
|
22129
22159
|
YAMLException2.prototype.constructor = YAMLException2;
|
|
22130
|
-
YAMLException2.prototype.toString = function
|
|
22160
|
+
YAMLException2.prototype.toString = function toString2(compact) {
|
|
22131
22161
|
var result = this.name + ": ";
|
|
22132
22162
|
result += this.reason || "(unknown reason)";
|
|
22133
22163
|
if (!compact && this.mark) {
|
|
@@ -22180,7 +22210,7 @@ var require_mark = __commonJS((exports, module) => {
|
|
|
22180
22210
|
return common2.repeat(" ", indent) + head + snippet2 + tail + `
|
|
22181
22211
|
` + common2.repeat(" ", indent + this.position - start + head.length) + "^";
|
|
22182
22212
|
};
|
|
22183
|
-
Mark.prototype.toString = function
|
|
22213
|
+
Mark.prototype.toString = function toString2(compact) {
|
|
22184
22214
|
var snippet2, where = "";
|
|
22185
22215
|
if (this.name) {
|
|
22186
22216
|
where += 'in "' + this.name + '" ';
|
|
@@ -23275,7 +23305,7 @@ var require_loader = __commonJS((exports, module) => {
|
|
|
23275
23305
|
}
|
|
23276
23306
|
}
|
|
23277
23307
|
var directiveHandlers2 = {
|
|
23278
|
-
YAML: function
|
|
23308
|
+
YAML: function handleYamlDirective2(state, name, args) {
|
|
23279
23309
|
var match, major, minor;
|
|
23280
23310
|
if (state.version !== null) {
|
|
23281
23311
|
throwError2(state, "duplication of %YAML directive");
|
|
@@ -23298,7 +23328,7 @@ var require_loader = __commonJS((exports, module) => {
|
|
|
23298
23328
|
throwWarning2(state, "unsupported YAML version of the document");
|
|
23299
23329
|
}
|
|
23300
23330
|
},
|
|
23301
|
-
TAG: function
|
|
23331
|
+
TAG: function handleTagDirective2(state, name, args) {
|
|
23302
23332
|
var handle, prefix;
|
|
23303
23333
|
if (args.length !== 2) {
|
|
23304
23334
|
throwError2(state, "TAG directive accepts exactly two arguments");
|
|
@@ -28935,6 +28965,8 @@ function mergeNativeSyncResults(results) {
|
|
|
28935
28965
|
var init_types2 = () => {};
|
|
28936
28966
|
|
|
28937
28967
|
// src/core/codex-mcp.ts
|
|
28968
|
+
import { existsSync as existsSync12, readFileSync as readFileSync2, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "node:fs";
|
|
28969
|
+
import { dirname as dirname8 } from "node:path";
|
|
28938
28970
|
function buildCodexMcpAddArgs(name, config) {
|
|
28939
28971
|
if (typeof config.url === "string") {
|
|
28940
28972
|
return ["mcp", "add", name, "--url", config.url];
|
|
@@ -29036,11 +29068,410 @@ async function syncCodexMcpServers(validatedPlugins, options2) {
|
|
|
29036
29068
|
}
|
|
29037
29069
|
return result;
|
|
29038
29070
|
}
|
|
29071
|
+
function toTomlValue(value) {
|
|
29072
|
+
if (typeof value === "string")
|
|
29073
|
+
return `"${value.replace(/\\/g, "\\\\").replace(/"/g, "\\\"")}"`;
|
|
29074
|
+
if (typeof value === "number" || typeof value === "boolean")
|
|
29075
|
+
return String(value);
|
|
29076
|
+
if (Array.isArray(value))
|
|
29077
|
+
return `[${value.map(toTomlValue).join(", ")}]`;
|
|
29078
|
+
return `"${String(value)}"`;
|
|
29079
|
+
}
|
|
29080
|
+
function serverToToml(name, config) {
|
|
29081
|
+
const lines = [`[mcp_servers.${name}]`];
|
|
29082
|
+
const envEntries = [];
|
|
29083
|
+
for (const [key, value] of Object.entries(config)) {
|
|
29084
|
+
if (key === "type")
|
|
29085
|
+
continue;
|
|
29086
|
+
if (key === "env" && typeof value === "object" && value !== null) {
|
|
29087
|
+
envEntries.push(...Object.entries(value));
|
|
29088
|
+
continue;
|
|
29089
|
+
}
|
|
29090
|
+
lines.push(`${key} = ${toTomlValue(value)}`);
|
|
29091
|
+
}
|
|
29092
|
+
if (envEntries.length > 0) {
|
|
29093
|
+
lines.push("");
|
|
29094
|
+
lines.push(`[mcp_servers.${name}.env]`);
|
|
29095
|
+
for (const [envKey, envValue] of envEntries) {
|
|
29096
|
+
lines.push(`${envKey} = ${toTomlValue(envValue)}`);
|
|
29097
|
+
}
|
|
29098
|
+
}
|
|
29099
|
+
return lines.join(`
|
|
29100
|
+
`);
|
|
29101
|
+
}
|
|
29102
|
+
function parseCodexConfigToml(content) {
|
|
29103
|
+
const serverNames = new Set;
|
|
29104
|
+
const serverSections = new Map;
|
|
29105
|
+
const nonMcpLines = [];
|
|
29106
|
+
const lines = content.split(`
|
|
29107
|
+
`);
|
|
29108
|
+
let currentServer = null;
|
|
29109
|
+
let currentLines = [];
|
|
29110
|
+
for (const line of lines) {
|
|
29111
|
+
const sectionMatch = line.match(/^\[mcp_servers\.([^\].]+?)(?:\.[^\]]+)?\]$/);
|
|
29112
|
+
if (sectionMatch) {
|
|
29113
|
+
if (currentServer) {
|
|
29114
|
+
serverSections.set(currentServer, (serverSections.get(currentServer) ?? "") + (serverSections.has(currentServer) ? `
|
|
29115
|
+
` : "") + currentLines.join(`
|
|
29116
|
+
`));
|
|
29117
|
+
}
|
|
29118
|
+
currentServer = sectionMatch[1] ?? null;
|
|
29119
|
+
if (currentServer)
|
|
29120
|
+
serverNames.add(currentServer);
|
|
29121
|
+
currentLines = [line];
|
|
29122
|
+
continue;
|
|
29123
|
+
}
|
|
29124
|
+
const otherSectionMatch = line.match(/^\[(?!mcp_servers\.)/);
|
|
29125
|
+
if (otherSectionMatch) {
|
|
29126
|
+
if (currentServer) {
|
|
29127
|
+
serverSections.set(currentServer, (serverSections.get(currentServer) ?? "") + (serverSections.has(currentServer) ? `
|
|
29128
|
+
` : "") + currentLines.join(`
|
|
29129
|
+
`));
|
|
29130
|
+
currentServer = null;
|
|
29131
|
+
currentLines = [];
|
|
29132
|
+
}
|
|
29133
|
+
nonMcpLines.push(line);
|
|
29134
|
+
continue;
|
|
29135
|
+
}
|
|
29136
|
+
if (currentServer) {
|
|
29137
|
+
currentLines.push(line);
|
|
29138
|
+
} else {
|
|
29139
|
+
nonMcpLines.push(line);
|
|
29140
|
+
}
|
|
29141
|
+
}
|
|
29142
|
+
if (currentServer) {
|
|
29143
|
+
serverSections.set(currentServer, (serverSections.get(currentServer) ?? "") + (serverSections.has(currentServer) ? `
|
|
29144
|
+
` : "") + currentLines.join(`
|
|
29145
|
+
`));
|
|
29146
|
+
}
|
|
29147
|
+
return {
|
|
29148
|
+
serverNames,
|
|
29149
|
+
nonMcpContent: nonMcpLines.join(`
|
|
29150
|
+
`).replace(/\n{3,}/g, `
|
|
29151
|
+
|
|
29152
|
+
`).trim(),
|
|
29153
|
+
serverSections
|
|
29154
|
+
};
|
|
29155
|
+
}
|
|
29156
|
+
function syncCodexProjectMcpConfig(validatedPlugins, options2) {
|
|
29157
|
+
const dryRun = options2?.dryRun ?? false;
|
|
29158
|
+
const force = options2?.force ?? false;
|
|
29159
|
+
const configPath = options2?.configPath;
|
|
29160
|
+
if (!configPath) {
|
|
29161
|
+
throw new Error("configPath is required for syncCodexProjectMcpConfig");
|
|
29162
|
+
}
|
|
29163
|
+
const previouslyTracked = new Set(options2?.trackedServers ?? []);
|
|
29164
|
+
const hasTracking = options2?.trackedServers !== undefined;
|
|
29165
|
+
const { servers: pluginServers, warnings } = collectMcpServers(validatedPlugins);
|
|
29166
|
+
const result = {
|
|
29167
|
+
added: 0,
|
|
29168
|
+
skipped: 0,
|
|
29169
|
+
overwritten: 0,
|
|
29170
|
+
removed: 0,
|
|
29171
|
+
warnings: [...warnings],
|
|
29172
|
+
addedServers: [],
|
|
29173
|
+
skippedServers: [],
|
|
29174
|
+
overwrittenServers: [],
|
|
29175
|
+
removedServers: [],
|
|
29176
|
+
trackedServers: []
|
|
29177
|
+
};
|
|
29178
|
+
let existingContent = "";
|
|
29179
|
+
if (existsSync12(configPath)) {
|
|
29180
|
+
try {
|
|
29181
|
+
existingContent = readFileSync2(configPath, "utf-8");
|
|
29182
|
+
} catch {
|
|
29183
|
+
result.warnings.push(`Could not read existing ${configPath}, starting fresh`);
|
|
29184
|
+
}
|
|
29185
|
+
}
|
|
29186
|
+
const { serverNames: existingNames, nonMcpContent, serverSections } = parseCodexConfigToml(existingContent);
|
|
29187
|
+
const finalServers = new Map(serverSections);
|
|
29188
|
+
for (const [name, config] of pluginServers) {
|
|
29189
|
+
if (existingNames.has(name)) {
|
|
29190
|
+
if (hasTracking && previouslyTracked.has(name)) {
|
|
29191
|
+
finalServers.set(name, serverToToml(name, config));
|
|
29192
|
+
result.overwritten++;
|
|
29193
|
+
result.overwrittenServers.push(name);
|
|
29194
|
+
result.trackedServers.push(name);
|
|
29195
|
+
} else if (force) {
|
|
29196
|
+
finalServers.set(name, serverToToml(name, config));
|
|
29197
|
+
result.overwritten++;
|
|
29198
|
+
result.overwrittenServers.push(name);
|
|
29199
|
+
result.trackedServers.push(name);
|
|
29200
|
+
} else {
|
|
29201
|
+
result.skipped++;
|
|
29202
|
+
result.skippedServers.push(name);
|
|
29203
|
+
}
|
|
29204
|
+
} else {
|
|
29205
|
+
finalServers.set(name, serverToToml(name, config));
|
|
29206
|
+
result.added++;
|
|
29207
|
+
result.addedServers.push(name);
|
|
29208
|
+
result.trackedServers.push(name);
|
|
29209
|
+
}
|
|
29210
|
+
}
|
|
29211
|
+
if (hasTracking) {
|
|
29212
|
+
const currentServerNames = new Set(pluginServers.keys());
|
|
29213
|
+
for (const trackedName of previouslyTracked) {
|
|
29214
|
+
if (!currentServerNames.has(trackedName) && finalServers.has(trackedName)) {
|
|
29215
|
+
finalServers.delete(trackedName);
|
|
29216
|
+
result.removed++;
|
|
29217
|
+
result.removedServers.push(trackedName);
|
|
29218
|
+
}
|
|
29219
|
+
}
|
|
29220
|
+
}
|
|
29221
|
+
const hasChanges = result.added > 0 || result.overwritten > 0 || result.removed > 0;
|
|
29222
|
+
if (hasChanges && !dryRun) {
|
|
29223
|
+
const parts = [];
|
|
29224
|
+
if (nonMcpContent) {
|
|
29225
|
+
parts.push(nonMcpContent);
|
|
29226
|
+
}
|
|
29227
|
+
for (const toml of finalServers.values()) {
|
|
29228
|
+
parts.push(toml);
|
|
29229
|
+
}
|
|
29230
|
+
const output = `${parts.join(`
|
|
29231
|
+
|
|
29232
|
+
`)}
|
|
29233
|
+
`;
|
|
29234
|
+
const dir = dirname8(configPath);
|
|
29235
|
+
if (!existsSync12(dir)) {
|
|
29236
|
+
mkdirSync2(dir, { recursive: true });
|
|
29237
|
+
}
|
|
29238
|
+
writeFileSync2(configPath, output, "utf-8");
|
|
29239
|
+
result.configPath = configPath;
|
|
29240
|
+
}
|
|
29241
|
+
return result;
|
|
29242
|
+
}
|
|
29039
29243
|
var init_codex_mcp = __esm(() => {
|
|
29040
29244
|
init_types2();
|
|
29041
29245
|
init_vscode_mcp();
|
|
29042
29246
|
});
|
|
29043
29247
|
|
|
29248
|
+
// src/core/claude-mcp.ts
|
|
29249
|
+
import { existsSync as existsSync13, readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "node:fs";
|
|
29250
|
+
function deepEqual2(a, b) {
|
|
29251
|
+
if (a === b)
|
|
29252
|
+
return true;
|
|
29253
|
+
if (typeof a !== typeof b)
|
|
29254
|
+
return false;
|
|
29255
|
+
if (a === null || b === null)
|
|
29256
|
+
return a === b;
|
|
29257
|
+
if (typeof a !== "object")
|
|
29258
|
+
return false;
|
|
29259
|
+
if (Array.isArray(a) !== Array.isArray(b))
|
|
29260
|
+
return false;
|
|
29261
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
29262
|
+
if (a.length !== b.length)
|
|
29263
|
+
return false;
|
|
29264
|
+
return a.every((val, i2) => deepEqual2(val, b[i2]));
|
|
29265
|
+
}
|
|
29266
|
+
const aObj = a;
|
|
29267
|
+
const bObj = b;
|
|
29268
|
+
const aKeys = Object.keys(aObj);
|
|
29269
|
+
const bKeys = Object.keys(bObj);
|
|
29270
|
+
if (aKeys.length !== bKeys.length)
|
|
29271
|
+
return false;
|
|
29272
|
+
return aKeys.every((key) => (key in bObj) && deepEqual2(aObj[key], bObj[key]));
|
|
29273
|
+
}
|
|
29274
|
+
function buildClaudeMcpAddArgs(name, config, scope = "user") {
|
|
29275
|
+
if (typeof config.url === "string") {
|
|
29276
|
+
return ["mcp", "add", "--transport", "http", "--scope", scope, name, config.url];
|
|
29277
|
+
}
|
|
29278
|
+
if (typeof config.command === "string") {
|
|
29279
|
+
const args = ["mcp", "add", "--scope", scope];
|
|
29280
|
+
if (config.env && typeof config.env === "object") {
|
|
29281
|
+
for (const [key, value] of Object.entries(config.env)) {
|
|
29282
|
+
args.push("-e", `${key}=${value}`);
|
|
29283
|
+
}
|
|
29284
|
+
}
|
|
29285
|
+
args.push(name, "--", config.command);
|
|
29286
|
+
if (Array.isArray(config.args)) {
|
|
29287
|
+
args.push(...config.args);
|
|
29288
|
+
}
|
|
29289
|
+
return args;
|
|
29290
|
+
}
|
|
29291
|
+
return null;
|
|
29292
|
+
}
|
|
29293
|
+
function syncClaudeMcpConfig(validatedPlugins, options2) {
|
|
29294
|
+
const dryRun = options2?.dryRun ?? false;
|
|
29295
|
+
const force = options2?.force ?? false;
|
|
29296
|
+
const configPath = options2?.configPath;
|
|
29297
|
+
if (!configPath) {
|
|
29298
|
+
throw new Error("configPath is required for syncClaudeMcpConfig");
|
|
29299
|
+
}
|
|
29300
|
+
const previouslyTracked = new Set(options2?.trackedServers ?? []);
|
|
29301
|
+
const hasTracking = options2?.trackedServers !== undefined;
|
|
29302
|
+
const { servers: pluginServers, warnings } = collectMcpServers(validatedPlugins);
|
|
29303
|
+
const result = {
|
|
29304
|
+
added: 0,
|
|
29305
|
+
skipped: 0,
|
|
29306
|
+
overwritten: 0,
|
|
29307
|
+
removed: 0,
|
|
29308
|
+
warnings: [...warnings],
|
|
29309
|
+
addedServers: [],
|
|
29310
|
+
skippedServers: [],
|
|
29311
|
+
overwrittenServers: [],
|
|
29312
|
+
removedServers: [],
|
|
29313
|
+
trackedServers: []
|
|
29314
|
+
};
|
|
29315
|
+
let existingConfig = {};
|
|
29316
|
+
if (existsSync13(configPath)) {
|
|
29317
|
+
try {
|
|
29318
|
+
const content = readFileSync3(configPath, "utf-8");
|
|
29319
|
+
existingConfig = import_json52.default.parse(content);
|
|
29320
|
+
} catch {
|
|
29321
|
+
result.warnings.push(`Could not parse existing ${configPath}, starting fresh`);
|
|
29322
|
+
existingConfig = {};
|
|
29323
|
+
}
|
|
29324
|
+
}
|
|
29325
|
+
const existingServers = existingConfig.mcpServers ?? {};
|
|
29326
|
+
for (const [name, config] of pluginServers) {
|
|
29327
|
+
if (name in existingServers) {
|
|
29328
|
+
if (!deepEqual2(existingServers[name], config)) {
|
|
29329
|
+
if (hasTracking && previouslyTracked.has(name)) {
|
|
29330
|
+
existingServers[name] = config;
|
|
29331
|
+
result.overwritten++;
|
|
29332
|
+
result.overwrittenServers.push(name);
|
|
29333
|
+
result.trackedServers.push(name);
|
|
29334
|
+
} else if (force) {
|
|
29335
|
+
existingServers[name] = config;
|
|
29336
|
+
result.overwritten++;
|
|
29337
|
+
result.overwrittenServers.push(name);
|
|
29338
|
+
result.trackedServers.push(name);
|
|
29339
|
+
} else {
|
|
29340
|
+
result.skipped++;
|
|
29341
|
+
result.skippedServers.push(name);
|
|
29342
|
+
}
|
|
29343
|
+
} else if (hasTracking && previouslyTracked.has(name)) {
|
|
29344
|
+
result.trackedServers.push(name);
|
|
29345
|
+
}
|
|
29346
|
+
} else {
|
|
29347
|
+
existingServers[name] = config;
|
|
29348
|
+
result.added++;
|
|
29349
|
+
result.addedServers.push(name);
|
|
29350
|
+
result.trackedServers.push(name);
|
|
29351
|
+
}
|
|
29352
|
+
}
|
|
29353
|
+
if (hasTracking) {
|
|
29354
|
+
const currentServerNames = new Set(pluginServers.keys());
|
|
29355
|
+
for (const trackedName of previouslyTracked) {
|
|
29356
|
+
if (!currentServerNames.has(trackedName) && trackedName in existingServers) {
|
|
29357
|
+
delete existingServers[trackedName];
|
|
29358
|
+
result.removed++;
|
|
29359
|
+
result.removedServers.push(trackedName);
|
|
29360
|
+
}
|
|
29361
|
+
}
|
|
29362
|
+
}
|
|
29363
|
+
const hasChanges = result.added > 0 || result.overwritten > 0 || result.removed > 0;
|
|
29364
|
+
if (hasChanges && !dryRun) {
|
|
29365
|
+
existingConfig.mcpServers = existingServers;
|
|
29366
|
+
writeFileSync3(configPath, `${JSON.stringify(existingConfig, null, 2)}
|
|
29367
|
+
`, "utf-8");
|
|
29368
|
+
result.configPath = configPath;
|
|
29369
|
+
}
|
|
29370
|
+
if (pluginServers.size === 0 && hasTracking && previouslyTracked.size > 0) {
|
|
29371
|
+
for (const trackedName of previouslyTracked) {
|
|
29372
|
+
if (trackedName in existingServers) {
|
|
29373
|
+
delete existingServers[trackedName];
|
|
29374
|
+
result.removed++;
|
|
29375
|
+
result.removedServers.push(trackedName);
|
|
29376
|
+
}
|
|
29377
|
+
}
|
|
29378
|
+
if (result.removed > 0 && !dryRun) {
|
|
29379
|
+
existingConfig.mcpServers = existingServers;
|
|
29380
|
+
writeFileSync3(configPath, `${JSON.stringify(existingConfig, null, 2)}
|
|
29381
|
+
`, "utf-8");
|
|
29382
|
+
result.configPath = configPath;
|
|
29383
|
+
}
|
|
29384
|
+
}
|
|
29385
|
+
return result;
|
|
29386
|
+
}
|
|
29387
|
+
async function syncClaudeMcpServersViaCli(validatedPlugins, options2) {
|
|
29388
|
+
const dryRun = options2?.dryRun ?? false;
|
|
29389
|
+
const previouslyTracked = new Set(options2?.trackedServers ?? []);
|
|
29390
|
+
const hasTracking = options2?.trackedServers !== undefined;
|
|
29391
|
+
const exec = options2?._mockExecute ?? ((binary2, args) => executeCommand(binary2, args));
|
|
29392
|
+
const { servers: pluginServers, warnings } = collectMcpServers(validatedPlugins);
|
|
29393
|
+
const result = {
|
|
29394
|
+
added: 0,
|
|
29395
|
+
skipped: 0,
|
|
29396
|
+
overwritten: 0,
|
|
29397
|
+
removed: 0,
|
|
29398
|
+
warnings: [...warnings],
|
|
29399
|
+
addedServers: [],
|
|
29400
|
+
skippedServers: [],
|
|
29401
|
+
overwrittenServers: [],
|
|
29402
|
+
removedServers: [],
|
|
29403
|
+
trackedServers: []
|
|
29404
|
+
};
|
|
29405
|
+
if (pluginServers.size === 0 && previouslyTracked.size === 0) {
|
|
29406
|
+
return result;
|
|
29407
|
+
}
|
|
29408
|
+
const versionResult = await exec("claude", ["--version"]);
|
|
29409
|
+
if (!versionResult.success) {
|
|
29410
|
+
result.warnings.push(`Claude CLI not available: ${versionResult.error ?? "unknown error"}`);
|
|
29411
|
+
return result;
|
|
29412
|
+
}
|
|
29413
|
+
for (const [name, config] of pluginServers) {
|
|
29414
|
+
const getResult = await exec("claude", ["mcp", "get", name]);
|
|
29415
|
+
const exists2 = getResult.success;
|
|
29416
|
+
if (exists2) {
|
|
29417
|
+
if (hasTracking && previouslyTracked.has(name)) {
|
|
29418
|
+
result.trackedServers.push(name);
|
|
29419
|
+
} else {
|
|
29420
|
+
result.skipped++;
|
|
29421
|
+
result.skippedServers.push(name);
|
|
29422
|
+
}
|
|
29423
|
+
} else {
|
|
29424
|
+
const addArgs = buildClaudeMcpAddArgs(name, config, "user");
|
|
29425
|
+
if (!addArgs) {
|
|
29426
|
+
result.warnings.push(`Unsupported MCP server config for '${name}', skipping`);
|
|
29427
|
+
continue;
|
|
29428
|
+
}
|
|
29429
|
+
if (!dryRun) {
|
|
29430
|
+
const addResult = await exec("claude", addArgs);
|
|
29431
|
+
if (!addResult.success) {
|
|
29432
|
+
result.warnings.push(`Failed to add MCP server '${name}': ${addResult.error ?? "unknown error"}`);
|
|
29433
|
+
continue;
|
|
29434
|
+
}
|
|
29435
|
+
}
|
|
29436
|
+
result.added++;
|
|
29437
|
+
result.addedServers.push(name);
|
|
29438
|
+
result.trackedServers.push(name);
|
|
29439
|
+
}
|
|
29440
|
+
}
|
|
29441
|
+
if (hasTracking) {
|
|
29442
|
+
const currentServerNames = new Set(pluginServers.keys());
|
|
29443
|
+
for (const trackedName of previouslyTracked) {
|
|
29444
|
+
if (!currentServerNames.has(trackedName)) {
|
|
29445
|
+
const getResult = await exec("claude", ["mcp", "get", trackedName]);
|
|
29446
|
+
if (getResult.success) {
|
|
29447
|
+
if (!dryRun) {
|
|
29448
|
+
const removeResult = await exec("claude", [
|
|
29449
|
+
"mcp",
|
|
29450
|
+
"remove",
|
|
29451
|
+
trackedName,
|
|
29452
|
+
"--scope",
|
|
29453
|
+
"user"
|
|
29454
|
+
]);
|
|
29455
|
+
if (!removeResult.success) {
|
|
29456
|
+
result.warnings.push(`Failed to remove MCP server '${trackedName}': ${removeResult.error ?? "unknown error"}`);
|
|
29457
|
+
continue;
|
|
29458
|
+
}
|
|
29459
|
+
}
|
|
29460
|
+
result.removed++;
|
|
29461
|
+
result.removedServers.push(trackedName);
|
|
29462
|
+
}
|
|
29463
|
+
}
|
|
29464
|
+
}
|
|
29465
|
+
}
|
|
29466
|
+
return result;
|
|
29467
|
+
}
|
|
29468
|
+
var import_json52;
|
|
29469
|
+
var init_claude_mcp = __esm(() => {
|
|
29470
|
+
init_types2();
|
|
29471
|
+
init_vscode_mcp();
|
|
29472
|
+
import_json52 = __toESM(require_lib(), 1);
|
|
29473
|
+
});
|
|
29474
|
+
|
|
29044
29475
|
// src/core/native/claude.ts
|
|
29045
29476
|
class ClaudeNativeClient {
|
|
29046
29477
|
async isAvailable() {
|
|
@@ -29259,9 +29690,9 @@ var init_native = __esm(() => {
|
|
|
29259
29690
|
});
|
|
29260
29691
|
|
|
29261
29692
|
// src/core/sync.ts
|
|
29262
|
-
import { existsSync as
|
|
29693
|
+
import { existsSync as existsSync14, readFileSync as readFileSync4, writeFileSync as writeFileSync4, lstatSync } from "node:fs";
|
|
29263
29694
|
import { rm as rm4, unlink as unlink2, rmdir, copyFile } from "node:fs/promises";
|
|
29264
|
-
import { join as join15, resolve as resolve9, dirname as
|
|
29695
|
+
import { join as join15, resolve as resolve9, dirname as dirname9, relative as relative4 } from "node:path";
|
|
29265
29696
|
function deduplicateClientsByPath(clients, clientMappings = CLIENT_MAPPINGS) {
|
|
29266
29697
|
const pathToClients = new Map;
|
|
29267
29698
|
for (const client of clients) {
|
|
@@ -29389,16 +29820,16 @@ async function selectivePurgeWorkspace(workspacePath, state, clients) {
|
|
|
29389
29820
|
return result;
|
|
29390
29821
|
}
|
|
29391
29822
|
async function cleanupEmptyParents(workspacePath, filePath) {
|
|
29392
|
-
let parentPath =
|
|
29823
|
+
let parentPath = dirname9(filePath);
|
|
29393
29824
|
while (parentPath && parentPath !== "." && parentPath !== "/") {
|
|
29394
29825
|
const fullParentPath = join15(workspacePath, parentPath);
|
|
29395
|
-
if (!
|
|
29396
|
-
parentPath =
|
|
29826
|
+
if (!existsSync14(fullParentPath)) {
|
|
29827
|
+
parentPath = dirname9(parentPath);
|
|
29397
29828
|
continue;
|
|
29398
29829
|
}
|
|
29399
29830
|
try {
|
|
29400
29831
|
await rmdir(fullParentPath);
|
|
29401
|
-
parentPath =
|
|
29832
|
+
parentPath = dirname9(parentPath);
|
|
29402
29833
|
} catch {
|
|
29403
29834
|
break;
|
|
29404
29835
|
}
|
|
@@ -29478,7 +29909,7 @@ function validateFileSources(files, defaultSourcePath, githubCache) {
|
|
|
29478
29909
|
continue;
|
|
29479
29910
|
}
|
|
29480
29911
|
const fullPath = join15(defaultSourcePath, file);
|
|
29481
|
-
if (!
|
|
29912
|
+
if (!existsSync14(fullPath)) {
|
|
29482
29913
|
errors2.push(`File source not found: ${fullPath}`);
|
|
29483
29914
|
}
|
|
29484
29915
|
continue;
|
|
@@ -29497,7 +29928,7 @@ function validateFileSources(files, defaultSourcePath, githubCache) {
|
|
|
29497
29928
|
continue;
|
|
29498
29929
|
}
|
|
29499
29930
|
const fullPath = join15(cachePath, parsed.filePath);
|
|
29500
|
-
if (!
|
|
29931
|
+
if (!existsSync14(fullPath)) {
|
|
29501
29932
|
errors2.push(`Path not found in repository: ${cacheKey}/${parsed.filePath}`);
|
|
29502
29933
|
}
|
|
29503
29934
|
} else {
|
|
@@ -29511,7 +29942,7 @@ function validateFileSources(files, defaultSourcePath, githubCache) {
|
|
|
29511
29942
|
} else {
|
|
29512
29943
|
fullPath = resolve9(file.source);
|
|
29513
29944
|
}
|
|
29514
|
-
if (!
|
|
29945
|
+
if (!existsSync14(fullPath)) {
|
|
29515
29946
|
errors2.push(`File source not found: ${fullPath}`);
|
|
29516
29947
|
}
|
|
29517
29948
|
}
|
|
@@ -29521,7 +29952,7 @@ function validateFileSources(files, defaultSourcePath, githubCache) {
|
|
|
29521
29952
|
continue;
|
|
29522
29953
|
}
|
|
29523
29954
|
const fullPath = join15(defaultSourcePath, file.dest ?? "");
|
|
29524
|
-
if (!
|
|
29955
|
+
if (!existsSync14(fullPath)) {
|
|
29525
29956
|
errors2.push(`File source not found: ${fullPath}`);
|
|
29526
29957
|
}
|
|
29527
29958
|
}
|
|
@@ -29677,7 +30108,7 @@ async function validatePlugin(pluginSource, workspacePath, offline) {
|
|
|
29677
30108
|
};
|
|
29678
30109
|
}
|
|
29679
30110
|
const resolvedPath = resolve9(workspacePath, pluginSource);
|
|
29680
|
-
if (!
|
|
30111
|
+
if (!existsSync14(resolvedPath)) {
|
|
29681
30112
|
return {
|
|
29682
30113
|
plugin: pluginSource,
|
|
29683
30114
|
resolved: resolvedPath,
|
|
@@ -29841,9 +30272,9 @@ function generateVscodeWorkspaceFile(workspacePath, config) {
|
|
|
29841
30272
|
const configDir = join15(workspacePath, CONFIG_DIR);
|
|
29842
30273
|
const templatePath = join15(configDir, VSCODE_TEMPLATE_FILE);
|
|
29843
30274
|
let template;
|
|
29844
|
-
if (
|
|
30275
|
+
if (existsSync14(templatePath)) {
|
|
29845
30276
|
try {
|
|
29846
|
-
template =
|
|
30277
|
+
template = import_json53.default.parse(readFileSync4(templatePath, "utf-8"));
|
|
29847
30278
|
} catch (error) {
|
|
29848
30279
|
throw new Error(`Failed to parse ${templatePath}: ${error instanceof Error ? error.message : String(error)}`);
|
|
29849
30280
|
}
|
|
@@ -29856,7 +30287,7 @@ function generateVscodeWorkspaceFile(workspacePath, config) {
|
|
|
29856
30287
|
const outputPath = getWorkspaceOutputPath(workspacePath, config.vscode);
|
|
29857
30288
|
const contentStr = `${JSON.stringify(content, null, "\t")}
|
|
29858
30289
|
`;
|
|
29859
|
-
|
|
30290
|
+
writeFileSync4(outputPath, contentStr, "utf-8");
|
|
29860
30291
|
return contentStr;
|
|
29861
30292
|
}
|
|
29862
30293
|
function failedSyncResult(error, overrides) {
|
|
@@ -29988,8 +30419,8 @@ async function syncVscodeWorkspaceFile(workspacePath, config, configPath, previo
|
|
|
29988
30419
|
let updatedConfig = config;
|
|
29989
30420
|
if (previousState?.vscodeWorkspaceHash && previousState?.vscodeWorkspaceRepos) {
|
|
29990
30421
|
const outputPath = getWorkspaceOutputPath(workspacePath, config.vscode);
|
|
29991
|
-
if (
|
|
29992
|
-
const existingContent =
|
|
30422
|
+
if (existsSync14(outputPath)) {
|
|
30423
|
+
const existingContent = readFileSync4(outputPath, "utf-8");
|
|
29993
30424
|
const currentHash = computeWorkspaceHash(existingContent);
|
|
29994
30425
|
if (currentHash !== previousState.vscodeWorkspaceHash) {
|
|
29995
30426
|
try {
|
|
@@ -30047,7 +30478,7 @@ async function syncWorkspace(workspacePath = process.cwd(), options2 = {}) {
|
|
|
30047
30478
|
const { offline = false, dryRun = false, workspaceSourceBase, skipAgentFiles = false } = options2;
|
|
30048
30479
|
const configDir = join15(workspacePath, CONFIG_DIR);
|
|
30049
30480
|
const configPath = join15(configDir, WORKSPACE_CONFIG_FILE);
|
|
30050
|
-
if (!
|
|
30481
|
+
if (!existsSync14(configPath)) {
|
|
30051
30482
|
return failedSyncResult(`${CONFIG_DIR}/${WORKSPACE_CONFIG_FILE} not found in ${workspacePath}
|
|
30052
30483
|
Run 'allagents workspace init <path>' to create a new workspace`);
|
|
30053
30484
|
}
|
|
@@ -30115,9 +30546,10 @@ ${failedValidations.map((v) => ` - ${v.plugin}: ${v.error}`).join(`
|
|
|
30115
30546
|
const allSkills = await collectAllSkills(validPlugins, disabledSkillsSet, enabledSkillsSet);
|
|
30116
30547
|
const pluginSkillMaps = buildPluginSkillNameMaps(allSkills);
|
|
30117
30548
|
const syncMode = config.syncMode ?? "symlink";
|
|
30118
|
-
const pluginResults = await Promise.all(validPlugins.map((validatedPlugin) => {
|
|
30549
|
+
const pluginResults = await Promise.all(validPlugins.map(async (validatedPlugin) => {
|
|
30119
30550
|
const skillNameMap = pluginSkillMaps.get(validatedPlugin.resolved);
|
|
30120
|
-
|
|
30551
|
+
const result = await copyValidatedPlugin(validatedPlugin, workspacePath, validatedPlugin.clients, dryRun, skillNameMap, undefined, syncMode);
|
|
30552
|
+
return { ...result, scope: "project" };
|
|
30121
30553
|
}));
|
|
30122
30554
|
const nativeResult = await syncNativePlugins(validPlugins, previousState, "project", workspacePath, dryRun, warnings, messages);
|
|
30123
30555
|
let workspaceFileResults = [];
|
|
@@ -30127,7 +30559,7 @@ ${failedValidations.map((v) => ` - ${v.plugin}: ${v.error}`).join(`
|
|
|
30127
30559
|
if (hasRepositories && sourcePath) {
|
|
30128
30560
|
for (const agentFile of AGENT_FILES) {
|
|
30129
30561
|
const agentPath = join15(sourcePath, agentFile);
|
|
30130
|
-
if (
|
|
30562
|
+
if (existsSync14(agentPath) && !filesToCopy.includes(agentFile)) {
|
|
30131
30563
|
filesToCopy.push(agentFile);
|
|
30132
30564
|
}
|
|
30133
30565
|
}
|
|
@@ -30153,8 +30585,8 @@ ${fileValidationErrors.map((e) => ` - ${e}`).join(`
|
|
|
30153
30585
|
if (hasRepositories && !dryRun && syncClients.includes("claude") && sourcePath) {
|
|
30154
30586
|
const claudePath = join15(workspacePath, "CLAUDE.md");
|
|
30155
30587
|
const agentsPath = join15(workspacePath, "AGENTS.md");
|
|
30156
|
-
const claudeExistsInSource =
|
|
30157
|
-
if (!claudeExistsInSource &&
|
|
30588
|
+
const claudeExistsInSource = existsSync14(join15(sourcePath, "CLAUDE.md"));
|
|
30589
|
+
if (!claudeExistsInSource && existsSync14(agentsPath) && !existsSync14(claudePath)) {
|
|
30158
30590
|
await copyFile(agentsPath, claudePath);
|
|
30159
30591
|
}
|
|
30160
30592
|
}
|
|
@@ -30170,6 +30602,58 @@ ${fileValidationErrors.map((e) => ` - ${e}`).join(`
|
|
|
30170
30602
|
vscodeState = { hash: result.hash, repos: result.repos };
|
|
30171
30603
|
}
|
|
30172
30604
|
}
|
|
30605
|
+
const mcpResults = {};
|
|
30606
|
+
if (syncClients.includes("vscode")) {
|
|
30607
|
+
const trackedMcpServers = getPreviouslySyncedMcpServers(previousState, "vscode");
|
|
30608
|
+
const projectMcpPath = join15(workspacePath, ".vscode", "mcp.json");
|
|
30609
|
+
const vscodeMcp = syncVscodeMcpConfig(validPlugins, {
|
|
30610
|
+
dryRun,
|
|
30611
|
+
force: false,
|
|
30612
|
+
configPath: projectMcpPath,
|
|
30613
|
+
trackedServers: trackedMcpServers
|
|
30614
|
+
});
|
|
30615
|
+
if (vscodeMcp.warnings.length > 0) {
|
|
30616
|
+
warnings.push(...vscodeMcp.warnings);
|
|
30617
|
+
}
|
|
30618
|
+
mcpResults.vscode = vscodeMcp;
|
|
30619
|
+
}
|
|
30620
|
+
if (syncClients.includes("claude")) {
|
|
30621
|
+
const trackedMcpServers = getPreviouslySyncedMcpServers(previousState, "claude");
|
|
30622
|
+
const projectMcpJsonPath = join15(workspacePath, ".mcp.json");
|
|
30623
|
+
const claudeMcp = syncClaudeMcpConfig(validPlugins, {
|
|
30624
|
+
dryRun,
|
|
30625
|
+
force: false,
|
|
30626
|
+
configPath: projectMcpJsonPath,
|
|
30627
|
+
trackedServers: trackedMcpServers
|
|
30628
|
+
});
|
|
30629
|
+
if (claudeMcp.warnings.length > 0) {
|
|
30630
|
+
warnings.push(...claudeMcp.warnings);
|
|
30631
|
+
}
|
|
30632
|
+
mcpResults.claude = claudeMcp;
|
|
30633
|
+
}
|
|
30634
|
+
if (syncClients.includes("codex")) {
|
|
30635
|
+
const trackedMcpServers = getPreviouslySyncedMcpServers(previousState, "codex");
|
|
30636
|
+
const projectCodexConfigPath = join15(workspacePath, ".codex", "config.toml");
|
|
30637
|
+
const codexMcp = syncCodexProjectMcpConfig(validPlugins, {
|
|
30638
|
+
dryRun,
|
|
30639
|
+
force: false,
|
|
30640
|
+
configPath: projectCodexConfigPath,
|
|
30641
|
+
trackedServers: trackedMcpServers
|
|
30642
|
+
});
|
|
30643
|
+
if (codexMcp.warnings.length > 0) {
|
|
30644
|
+
warnings.push(...codexMcp.warnings);
|
|
30645
|
+
}
|
|
30646
|
+
mcpResults.codex = codexMcp;
|
|
30647
|
+
}
|
|
30648
|
+
const PROJECT_MCP_CLIENTS = new Set(["claude", "codex", "vscode", "universal"]);
|
|
30649
|
+
const { servers: allMcpServers } = collectMcpServers(validPlugins);
|
|
30650
|
+
if (allMcpServers.size > 0) {
|
|
30651
|
+
for (const client of syncClients) {
|
|
30652
|
+
if (!PROJECT_MCP_CLIENTS.has(client)) {
|
|
30653
|
+
warnings.push(`MCP servers not synced for ${client} (not supported at project scope)`);
|
|
30654
|
+
}
|
|
30655
|
+
}
|
|
30656
|
+
}
|
|
30173
30657
|
const { totalCopied, totalFailed, totalSkipped, totalGenerated } = countCopyResults(pluginResults, workspaceFileResults);
|
|
30174
30658
|
const hasFailures = pluginResults.some((r) => !r.success) || totalFailed > 0;
|
|
30175
30659
|
const availableSkillNames = await collectAvailableSkillNames(validPlugins);
|
|
@@ -30179,7 +30663,12 @@ ${fileValidationErrors.map((e) => ` - ${e}`).join(`
|
|
|
30179
30663
|
const deletedArtifacts = computeDeletedArtifacts(previousState, newStatePaths, syncClients, resolvedMappings, availableSkillNames);
|
|
30180
30664
|
const { pluginsByClient: nativePluginsByClient } = collectNativePluginSources(validPlugins);
|
|
30181
30665
|
if (!dryRun) {
|
|
30182
|
-
await persistSyncState(workspacePath, pluginResults, workspaceFileResults, syncClients, nativePluginsByClient, nativeResult,
|
|
30666
|
+
await persistSyncState(workspacePath, pluginResults, workspaceFileResults, syncClients, nativePluginsByClient, nativeResult, {
|
|
30667
|
+
...vscodeState && { vscodeState },
|
|
30668
|
+
...Object.keys(mcpResults).length > 0 && {
|
|
30669
|
+
mcpTrackedServers: Object.fromEntries(Object.entries(mcpResults).map(([scope, r]) => [scope, r.trackedServers]))
|
|
30670
|
+
}
|
|
30671
|
+
});
|
|
30183
30672
|
}
|
|
30184
30673
|
return {
|
|
30185
30674
|
success: !hasFailures,
|
|
@@ -30192,6 +30681,7 @@ ${fileValidationErrors.map((e) => ` - ${e}`).join(`
|
|
|
30192
30681
|
...deletedArtifacts.length > 0 && { deletedArtifacts },
|
|
30193
30682
|
...warnings.length > 0 && { warnings },
|
|
30194
30683
|
...messages.length > 0 && { messages },
|
|
30684
|
+
...Object.keys(mcpResults).length > 0 && { mcpResults },
|
|
30195
30685
|
...nativeResult && { nativeResult }
|
|
30196
30686
|
};
|
|
30197
30687
|
}
|
|
@@ -30238,10 +30728,11 @@ ${failedValidations.map((v) => ` - ${v.plugin}: ${v.error}`).join(`
|
|
|
30238
30728
|
const allSkills = await collectAllSkills(validPlugins, disabledSkillsSet, enabledSkillsSet);
|
|
30239
30729
|
const pluginSkillMaps = buildPluginSkillNameMaps(allSkills);
|
|
30240
30730
|
const syncMode = config.syncMode ?? "symlink";
|
|
30241
|
-
const pluginResults = await Promise.all(validPlugins.map((vp) => {
|
|
30731
|
+
const pluginResults = await Promise.all(validPlugins.map(async (vp) => {
|
|
30242
30732
|
const skillNameMap = pluginSkillMaps.get(vp.resolved);
|
|
30243
30733
|
const resolvedUserMappings2 = resolveClientMappings(vp.clients, USER_CLIENT_MAPPINGS);
|
|
30244
|
-
|
|
30734
|
+
const result = await copyValidatedPlugin(vp, homeDir, vp.clients, dryRun, skillNameMap, resolvedUserMappings2, syncMode);
|
|
30735
|
+
return { ...result, scope: "user" };
|
|
30245
30736
|
}));
|
|
30246
30737
|
const { totalCopied, totalFailed, totalSkipped, totalGenerated } = countCopyResults(pluginResults, []);
|
|
30247
30738
|
const mcpResults = {};
|
|
@@ -30261,6 +30752,23 @@ ${failedValidations.map((v) => ` - ${v.plugin}: ${v.error}`).join(`
|
|
|
30261
30752
|
}
|
|
30262
30753
|
mcpResults.codex = codexMcp;
|
|
30263
30754
|
}
|
|
30755
|
+
if (syncClients.includes("claude")) {
|
|
30756
|
+
const trackedMcpServers = getPreviouslySyncedMcpServers(previousState, "claude");
|
|
30757
|
+
const claudeMcp = await syncClaudeMcpServersViaCli(validPlugins, { dryRun, trackedServers: trackedMcpServers });
|
|
30758
|
+
if (claudeMcp.warnings.length > 0) {
|
|
30759
|
+
warnings.push(...claudeMcp.warnings);
|
|
30760
|
+
}
|
|
30761
|
+
mcpResults.claude = claudeMcp;
|
|
30762
|
+
}
|
|
30763
|
+
const USER_MCP_CLIENTS = new Set(["claude", "codex", "vscode", "universal"]);
|
|
30764
|
+
const { servers: allUserMcpServers } = collectMcpServers(validPlugins);
|
|
30765
|
+
if (allUserMcpServers.size > 0) {
|
|
30766
|
+
for (const client of syncClients) {
|
|
30767
|
+
if (!USER_MCP_CLIENTS.has(client)) {
|
|
30768
|
+
warnings.push(`MCP servers not synced for ${client} (not supported at user scope)`);
|
|
30769
|
+
}
|
|
30770
|
+
}
|
|
30771
|
+
}
|
|
30264
30772
|
const nativeResult = await syncNativePlugins(validPlugins, previousState, "user", homeDir, dryRun, warnings, messages);
|
|
30265
30773
|
const availableUserSkillNames = await collectAvailableSkillNames(validPlugins);
|
|
30266
30774
|
const allCopyResultsForState = pluginResults.flatMap((r) => r.copyResults);
|
|
@@ -30290,7 +30798,7 @@ ${failedValidations.map((v) => ` - ${v.plugin}: ${v.error}`).join(`
|
|
|
30290
30798
|
...nativeResult && { nativeResult }
|
|
30291
30799
|
};
|
|
30292
30800
|
}
|
|
30293
|
-
var
|
|
30801
|
+
var import_json53, VSCODE_TEMPLATE_FILE = "template.code-workspace";
|
|
30294
30802
|
var init_sync = __esm(() => {
|
|
30295
30803
|
init_constants();
|
|
30296
30804
|
init_workspace_parser();
|
|
@@ -30308,17 +30816,18 @@ var init_sync = __esm(() => {
|
|
|
30308
30816
|
init_workspace_modify();
|
|
30309
30817
|
init_vscode_mcp();
|
|
30310
30818
|
init_codex_mcp();
|
|
30819
|
+
init_claude_mcp();
|
|
30311
30820
|
init_native();
|
|
30312
|
-
|
|
30821
|
+
import_json53 = __toESM(require_lib(), 1);
|
|
30313
30822
|
});
|
|
30314
30823
|
|
|
30315
30824
|
// src/core/github-fetch.ts
|
|
30316
|
-
import { existsSync as
|
|
30825
|
+
import { existsSync as existsSync15, readFileSync as readFileSync5 } from "node:fs";
|
|
30317
30826
|
import { join as join16 } from "node:path";
|
|
30318
30827
|
function readFileFromClone(tempDir, filePath) {
|
|
30319
30828
|
const fullPath = join16(tempDir, filePath);
|
|
30320
|
-
if (
|
|
30321
|
-
return
|
|
30829
|
+
if (existsSync15(fullPath)) {
|
|
30830
|
+
return readFileSync5(fullPath, "utf-8");
|
|
30322
30831
|
}
|
|
30323
30832
|
return null;
|
|
30324
30833
|
}
|
|
@@ -30417,14 +30926,14 @@ var init_github_fetch = __esm(() => {
|
|
|
30417
30926
|
|
|
30418
30927
|
// src/core/workspace.ts
|
|
30419
30928
|
import { mkdir as mkdir8, readFile as readFile10, writeFile as writeFile7, copyFile as copyFile2, unlink as unlink3 } from "node:fs/promises";
|
|
30420
|
-
import { existsSync as
|
|
30421
|
-
import { join as join17, resolve as resolve10, dirname as
|
|
30929
|
+
import { existsSync as existsSync16 } from "node:fs";
|
|
30930
|
+
import { join as join17, resolve as resolve10, dirname as dirname10, relative as relative5, sep as sep2, isAbsolute as isAbsolute4 } from "node:path";
|
|
30422
30931
|
import { fileURLToPath } from "node:url";
|
|
30423
30932
|
async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
30424
30933
|
const absoluteTarget = resolve10(targetPath);
|
|
30425
30934
|
const configDir = join17(absoluteTarget, CONFIG_DIR);
|
|
30426
30935
|
const configPath = join17(configDir, WORKSPACE_CONFIG_FILE);
|
|
30427
|
-
if (
|
|
30936
|
+
if (existsSync16(configPath)) {
|
|
30428
30937
|
if (options2.force) {
|
|
30429
30938
|
await unlink3(configPath);
|
|
30430
30939
|
} else {
|
|
@@ -30433,7 +30942,7 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
30433
30942
|
}
|
|
30434
30943
|
}
|
|
30435
30944
|
const currentFilePath = fileURLToPath(import.meta.url);
|
|
30436
|
-
const currentFileDir =
|
|
30945
|
+
const currentFileDir = dirname10(currentFilePath);
|
|
30437
30946
|
const isProduction = currentFilePath.includes(`${sep2}dist${sep2}`);
|
|
30438
30947
|
const defaultTemplatePath = isProduction ? join17(currentFileDir, "templates", "default") : join17(currentFileDir, "..", "templates", "default");
|
|
30439
30948
|
let githubTempDir;
|
|
@@ -30474,7 +30983,7 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
30474
30983
|
console.log(`✓ Using workspace.yaml from: ${options2.from}`);
|
|
30475
30984
|
} else {
|
|
30476
30985
|
const fromPath = resolve10(options2.from);
|
|
30477
|
-
if (!
|
|
30986
|
+
if (!existsSync16(fromPath)) {
|
|
30478
30987
|
throw new Error(`Template not found: ${fromPath}`);
|
|
30479
30988
|
}
|
|
30480
30989
|
const { stat: stat2 } = await import("node:fs/promises");
|
|
@@ -30483,10 +30992,10 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
30483
30992
|
if (fromStat.isDirectory()) {
|
|
30484
30993
|
const nestedPath = join17(fromPath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
30485
30994
|
const rootPath = join17(fromPath, WORKSPACE_CONFIG_FILE);
|
|
30486
|
-
if (
|
|
30995
|
+
if (existsSync16(nestedPath)) {
|
|
30487
30996
|
sourceYamlPath = nestedPath;
|
|
30488
30997
|
sourceDir = fromPath;
|
|
30489
|
-
} else if (
|
|
30998
|
+
} else if (existsSync16(rootPath)) {
|
|
30490
30999
|
sourceYamlPath = rootPath;
|
|
30491
31000
|
sourceDir = fromPath;
|
|
30492
31001
|
} else {
|
|
@@ -30495,9 +31004,9 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
30495
31004
|
}
|
|
30496
31005
|
} else {
|
|
30497
31006
|
sourceYamlPath = fromPath;
|
|
30498
|
-
const parentDir =
|
|
31007
|
+
const parentDir = dirname10(fromPath);
|
|
30499
31008
|
if (parentDir.endsWith(CONFIG_DIR)) {
|
|
30500
|
-
sourceDir =
|
|
31009
|
+
sourceDir = dirname10(parentDir);
|
|
30501
31010
|
} else {
|
|
30502
31011
|
sourceDir = parentDir;
|
|
30503
31012
|
}
|
|
@@ -30518,7 +31027,7 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
30518
31027
|
}
|
|
30519
31028
|
} else {
|
|
30520
31029
|
const defaultYamlPath = join17(defaultTemplatePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
30521
|
-
if (!
|
|
31030
|
+
if (!existsSync16(defaultYamlPath)) {
|
|
30522
31031
|
throw new Error(`Default template not found at: ${defaultTemplatePath}`);
|
|
30523
31032
|
}
|
|
30524
31033
|
workspaceYamlContent = await readFile10(defaultYamlPath, "utf-8");
|
|
@@ -30535,7 +31044,7 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
30535
31044
|
const VSCODE_TEMPLATE_FILE2 = "template.code-workspace";
|
|
30536
31045
|
if (clientNames.includes("vscode") && options2.from) {
|
|
30537
31046
|
const targetTemplatePath = join17(configDir, VSCODE_TEMPLATE_FILE2);
|
|
30538
|
-
if (!
|
|
31047
|
+
if (!existsSync16(targetTemplatePath)) {
|
|
30539
31048
|
if (isGitHubUrl(options2.from) && githubTempDir) {
|
|
30540
31049
|
if (parsedFromUrl) {
|
|
30541
31050
|
const templatePath = githubBasePath ? `${githubBasePath}/${CONFIG_DIR}/${VSCODE_TEMPLATE_FILE2}` : `${CONFIG_DIR}/${VSCODE_TEMPLATE_FILE2}`;
|
|
@@ -30546,7 +31055,7 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
30546
31055
|
}
|
|
30547
31056
|
} else if (sourceDir) {
|
|
30548
31057
|
const sourceTemplatePath = join17(sourceDir, CONFIG_DIR, VSCODE_TEMPLATE_FILE2);
|
|
30549
|
-
if (
|
|
31058
|
+
if (existsSync16(sourceTemplatePath)) {
|
|
30550
31059
|
await copyFile2(sourceTemplatePath, targetTemplatePath);
|
|
30551
31060
|
}
|
|
30552
31061
|
}
|
|
@@ -30560,7 +31069,7 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
30560
31069
|
if (parsedFromUrl) {
|
|
30561
31070
|
for (const agentFile of AGENT_FILES) {
|
|
30562
31071
|
const targetFilePath = join17(absoluteTarget, agentFile);
|
|
30563
|
-
if (
|
|
31072
|
+
if (existsSync16(targetFilePath)) {
|
|
30564
31073
|
copiedAgentFiles.push(agentFile);
|
|
30565
31074
|
continue;
|
|
30566
31075
|
}
|
|
@@ -30576,12 +31085,12 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
30576
31085
|
const effectiveSourceDir = sourceDir ?? defaultTemplatePath;
|
|
30577
31086
|
for (const agentFile of AGENT_FILES) {
|
|
30578
31087
|
const targetFilePath = join17(absoluteTarget, agentFile);
|
|
30579
|
-
if (
|
|
31088
|
+
if (existsSync16(targetFilePath)) {
|
|
30580
31089
|
copiedAgentFiles.push(agentFile);
|
|
30581
31090
|
continue;
|
|
30582
31091
|
}
|
|
30583
31092
|
const sourcePath = join17(effectiveSourceDir, agentFile);
|
|
30584
|
-
if (
|
|
31093
|
+
if (existsSync16(sourcePath)) {
|
|
30585
31094
|
const content = await readFile10(sourcePath, "utf-8");
|
|
30586
31095
|
await writeFile7(targetFilePath, content, "utf-8");
|
|
30587
31096
|
copiedAgentFiles.push(agentFile);
|
|
@@ -30649,11 +31158,11 @@ var init_workspace = __esm(() => {
|
|
|
30649
31158
|
});
|
|
30650
31159
|
|
|
30651
31160
|
// src/core/status.ts
|
|
30652
|
-
import { existsSync as
|
|
31161
|
+
import { existsSync as existsSync17 } from "node:fs";
|
|
30653
31162
|
import { join as join18 } from "node:path";
|
|
30654
31163
|
async function getWorkspaceStatus(workspacePath = process.cwd()) {
|
|
30655
31164
|
const configPath = join18(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
30656
|
-
if (!
|
|
31165
|
+
if (!existsSync17(configPath) || isUserConfigPath(workspacePath)) {
|
|
30657
31166
|
const userPlugins = await getUserPluginStatuses();
|
|
30658
31167
|
return {
|
|
30659
31168
|
success: true,
|
|
@@ -30695,7 +31204,7 @@ async function getWorkspaceStatus(workspacePath = process.cwd()) {
|
|
|
30695
31204
|
function getPluginStatus(parsed) {
|
|
30696
31205
|
if (parsed.type === "github") {
|
|
30697
31206
|
const cachePath = parsed.owner && parsed.repo ? getPluginCachePath(parsed.owner, parsed.repo) : "";
|
|
30698
|
-
const available2 = cachePath ?
|
|
31207
|
+
const available2 = cachePath ? existsSync17(cachePath) : false;
|
|
30699
31208
|
return {
|
|
30700
31209
|
source: parsed.original,
|
|
30701
31210
|
type: "github",
|
|
@@ -30705,7 +31214,7 @@ function getPluginStatus(parsed) {
|
|
|
30705
31214
|
...parsed.repo && { repo: parsed.repo }
|
|
30706
31215
|
};
|
|
30707
31216
|
}
|
|
30708
|
-
const available =
|
|
31217
|
+
const available = existsSync17(parsed.normalized);
|
|
30709
31218
|
return {
|
|
30710
31219
|
source: parsed.original,
|
|
30711
31220
|
type: "local",
|
|
@@ -30866,15 +31375,13 @@ function formatSyncHeader(result) {
|
|
|
30866
31375
|
`✓ Successfully updated ${successCount} plugin(s)`
|
|
30867
31376
|
];
|
|
30868
31377
|
}
|
|
30869
|
-
function
|
|
31378
|
+
function formatPluginHeader(pluginResult) {
|
|
31379
|
+
const status = pluginResult.success ? "✓" : "✗";
|
|
31380
|
+
const scopeSuffix = pluginResult.scope ? ` (scope: ${pluginResult.scope})` : "";
|
|
31381
|
+
return `${status} Plugin: ${pluginResult.plugin}${scopeSuffix}`;
|
|
31382
|
+
}
|
|
31383
|
+
function formatSyncSummary(result) {
|
|
30870
31384
|
const lines = [];
|
|
30871
|
-
const allCopied = result.pluginResults.flatMap((pr) => pr.copyResults.filter((r) => r.action === "copied"));
|
|
30872
|
-
const classified = classifyCopyResults(allCopied);
|
|
30873
|
-
if (classified.size > 0) {
|
|
30874
|
-
lines.push(...formatArtifactLines(classified));
|
|
30875
|
-
} else if (allCopied.length > 0) {
|
|
30876
|
-
lines.push(` Total ${dryRun ? "would copy" : "copied"}: ${result.totalCopied}`);
|
|
30877
|
-
}
|
|
30878
31385
|
if (result.totalGenerated > 0)
|
|
30879
31386
|
lines.push(` Total generated: ${result.totalGenerated}`);
|
|
30880
31387
|
if (result.totalFailed > 0)
|
|
@@ -30914,7 +31421,8 @@ function formatMcpResult(mcpResult, scope) {
|
|
|
30914
31421
|
parts.push(`${removed} removed`);
|
|
30915
31422
|
if (skipped > 0)
|
|
30916
31423
|
parts.push(`${skipped} skipped`);
|
|
30917
|
-
const
|
|
31424
|
+
const displayScope = scope ? getDisplayName(scope) : undefined;
|
|
31425
|
+
const label = displayScope ? `MCP servers (${displayScope})` : "MCP servers";
|
|
30918
31426
|
lines.push(`${label}: ${parts.join(", ")}`);
|
|
30919
31427
|
for (const name of mcpResult.addedServers) {
|
|
30920
31428
|
lines.push(` + ${name}`);
|
|
@@ -32798,7 +33306,7 @@ var init_prompt_clients = __esm(() => {
|
|
|
32798
33306
|
});
|
|
32799
33307
|
|
|
32800
33308
|
// src/core/skills.ts
|
|
32801
|
-
import { existsSync as
|
|
33309
|
+
import { existsSync as existsSync20 } from "node:fs";
|
|
32802
33310
|
import { readFile as readFile12, readdir as readdir4 } from "node:fs/promises";
|
|
32803
33311
|
import { join as join21, basename as basename6, resolve as resolve12 } from "node:path";
|
|
32804
33312
|
async function resolvePluginPath(pluginSource, workspacePath) {
|
|
@@ -32825,11 +33333,11 @@ async function resolvePluginPath(pluginSource, workspacePath) {
|
|
|
32825
33333
|
return { path };
|
|
32826
33334
|
}
|
|
32827
33335
|
const resolved = resolve12(workspacePath, pluginSource);
|
|
32828
|
-
return
|
|
33336
|
+
return existsSync20(resolved) ? { path: resolved } : null;
|
|
32829
33337
|
}
|
|
32830
33338
|
async function getAllSkillsFromPlugins(workspacePath = process.cwd()) {
|
|
32831
33339
|
const configPath = join21(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
32832
|
-
if (!
|
|
33340
|
+
if (!existsSync20(configPath)) {
|
|
32833
33341
|
return [];
|
|
32834
33342
|
}
|
|
32835
33343
|
const content = await readFile12(configPath, "utf-8");
|
|
@@ -32849,7 +33357,7 @@ async function getAllSkillsFromPlugins(workspacePath = process.cwd()) {
|
|
|
32849
33357
|
const pluginSkillsConfig = typeof pluginEntry === "string" ? undefined : pluginEntry.skills;
|
|
32850
33358
|
const hasEnabledEntries = !pluginSkillsConfig && enabledSkills && [...enabledSkills].some((s) => s.startsWith(`${pluginName}`));
|
|
32851
33359
|
let skillEntries;
|
|
32852
|
-
if (
|
|
33360
|
+
if (existsSync20(skillsDir)) {
|
|
32853
33361
|
const entries = await readdir4(skillsDir, { withFileTypes: true });
|
|
32854
33362
|
skillEntries = entries.filter((e) => e.isDirectory()).map((e) => ({ name: e.name, skillPath: join21(skillsDir, e.name) }));
|
|
32855
33363
|
} else {
|
|
@@ -32859,7 +33367,7 @@ async function getAllSkillsFromPlugins(workspacePath = process.cwd()) {
|
|
|
32859
33367
|
if (!entry.isDirectory())
|
|
32860
33368
|
continue;
|
|
32861
33369
|
const skillMdPath = join21(pluginPath, entry.name, "SKILL.md");
|
|
32862
|
-
if (
|
|
33370
|
+
if (existsSync20(skillMdPath)) {
|
|
32863
33371
|
flatSkills.push({ name: entry.name, skillPath: join21(pluginPath, entry.name) });
|
|
32864
33372
|
}
|
|
32865
33373
|
}
|
|
@@ -32867,7 +33375,7 @@ async function getAllSkillsFromPlugins(workspacePath = process.cwd()) {
|
|
|
32867
33375
|
skillEntries = flatSkills;
|
|
32868
33376
|
} else {
|
|
32869
33377
|
const rootSkillMd = join21(pluginPath, "SKILL.md");
|
|
32870
|
-
if (
|
|
33378
|
+
if (existsSync20(rootSkillMd)) {
|
|
32871
33379
|
const skillContent = await readFile12(rootSkillMd, "utf-8");
|
|
32872
33380
|
const metadata = parseSkillMetadata(skillContent);
|
|
32873
33381
|
const skillName = metadata?.name ?? basename6(pluginPath);
|
|
@@ -32909,10 +33417,10 @@ async function findSkillByName(skillName, workspacePath = process.cwd()) {
|
|
|
32909
33417
|
return allSkills.filter((s) => s.name === skillName);
|
|
32910
33418
|
}
|
|
32911
33419
|
async function discoverSkillNames(pluginPath) {
|
|
32912
|
-
if (!
|
|
33420
|
+
if (!existsSync20(pluginPath))
|
|
32913
33421
|
return [];
|
|
32914
33422
|
const skillsDir = join21(pluginPath, "skills");
|
|
32915
|
-
if (
|
|
33423
|
+
if (existsSync20(skillsDir)) {
|
|
32916
33424
|
const entries2 = await readdir4(skillsDir, { withFileTypes: true });
|
|
32917
33425
|
return entries2.filter((e) => e.isDirectory()).map((e) => e.name);
|
|
32918
33426
|
}
|
|
@@ -32921,14 +33429,14 @@ async function discoverSkillNames(pluginPath) {
|
|
|
32921
33429
|
for (const entry of entries) {
|
|
32922
33430
|
if (!entry.isDirectory())
|
|
32923
33431
|
continue;
|
|
32924
|
-
if (
|
|
33432
|
+
if (existsSync20(join21(pluginPath, entry.name, "SKILL.md"))) {
|
|
32925
33433
|
flatSkills.push(entry.name);
|
|
32926
33434
|
}
|
|
32927
33435
|
}
|
|
32928
33436
|
if (flatSkills.length > 0)
|
|
32929
33437
|
return flatSkills;
|
|
32930
33438
|
const rootSkillMd = join21(pluginPath, "SKILL.md");
|
|
32931
|
-
if (
|
|
33439
|
+
if (existsSync20(rootSkillMd)) {
|
|
32932
33440
|
try {
|
|
32933
33441
|
const content = await readFile12(rootSkillMd, "utf-8");
|
|
32934
33442
|
const { parseSkillMetadata: parseSkillMetadata2 } = await Promise.resolve().then(() => (init_skill(), exports_skill));
|
|
@@ -33448,7 +33956,7 @@ var package_default;
|
|
|
33448
33956
|
var init_package = __esm(() => {
|
|
33449
33957
|
package_default = {
|
|
33450
33958
|
name: "allagents",
|
|
33451
|
-
version: "1.0
|
|
33959
|
+
version: "1.2.0",
|
|
33452
33960
|
description: "CLI tool for managing multi-repo AI agent workspaces with plugin synchronization",
|
|
33453
33961
|
type: "module",
|
|
33454
33962
|
bin: {
|
|
@@ -33652,7 +34160,7 @@ class TuiCache {
|
|
|
33652
34160
|
}
|
|
33653
34161
|
|
|
33654
34162
|
// src/cli/tui/context.ts
|
|
33655
|
-
import { existsSync as
|
|
34163
|
+
import { existsSync as existsSync23 } from "node:fs";
|
|
33656
34164
|
import { join as join25 } from "node:path";
|
|
33657
34165
|
async function getTuiContext(cwd = process.cwd(), cache2) {
|
|
33658
34166
|
const cachedContext = cache2?.getContext();
|
|
@@ -33660,7 +34168,7 @@ async function getTuiContext(cwd = process.cwd(), cache2) {
|
|
|
33660
34168
|
return cachedContext;
|
|
33661
34169
|
}
|
|
33662
34170
|
const configPath = join25(cwd, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
33663
|
-
const hasWorkspace =
|
|
34171
|
+
const hasWorkspace = existsSync23(configPath) && !isUserConfigPath(cwd);
|
|
33664
34172
|
let projectPluginCount = 0;
|
|
33665
34173
|
if (hasWorkspace) {
|
|
33666
34174
|
try {
|
|
@@ -33736,7 +34244,7 @@ async function runSync(context) {
|
|
|
33736
34244
|
if (result.error) {
|
|
33737
34245
|
kt2(result.error, "Sync Error");
|
|
33738
34246
|
} else {
|
|
33739
|
-
const lines = result.pluginResults.map((pr) =>
|
|
34247
|
+
const lines = result.pluginResults.map((pr) => formatPluginHeader(pr));
|
|
33740
34248
|
lines.push("");
|
|
33741
34249
|
lines.push(...formatSyncSummary(result));
|
|
33742
34250
|
if (result.nativeResult) {
|
|
@@ -33753,7 +34261,7 @@ async function runSync(context) {
|
|
|
33753
34261
|
if (userResult.error) {
|
|
33754
34262
|
kt2(userResult.error, "User Sync Error");
|
|
33755
34263
|
} else {
|
|
33756
|
-
const lines = userResult.pluginResults.map((pr) =>
|
|
34264
|
+
const lines = userResult.pluginResults.map((pr) => formatPluginHeader(pr));
|
|
33757
34265
|
lines.push("");
|
|
33758
34266
|
lines.push(...formatSyncSummary(userResult));
|
|
33759
34267
|
if (userResult.mcpResults) {
|
|
@@ -35048,7 +35556,7 @@ init_workspace();
|
|
|
35048
35556
|
init_sync();
|
|
35049
35557
|
init_status2();
|
|
35050
35558
|
var import_cmd_ts2 = __toESM(require_cjs(), 1);
|
|
35051
|
-
import { existsSync as
|
|
35559
|
+
import { existsSync as existsSync19 } from "node:fs";
|
|
35052
35560
|
import { join as join20, resolve as resolve11 } from "node:path";
|
|
35053
35561
|
|
|
35054
35562
|
// src/core/prune.ts
|
|
@@ -35058,7 +35566,7 @@ init_marketplace();
|
|
|
35058
35566
|
init_user_workspace();
|
|
35059
35567
|
init_workspace_config();
|
|
35060
35568
|
import { readFile as readFile11, writeFile as writeFile8 } from "node:fs/promises";
|
|
35061
|
-
import { existsSync as
|
|
35569
|
+
import { existsSync as existsSync18 } from "node:fs";
|
|
35062
35570
|
import { join as join19 } from "node:path";
|
|
35063
35571
|
async function isOrphanedPlugin(pluginSpec) {
|
|
35064
35572
|
if (!isPluginSpec(pluginSpec))
|
|
@@ -35087,7 +35595,7 @@ async function prunePlugins(plugins) {
|
|
|
35087
35595
|
async function pruneOrphanedPlugins(workspacePath) {
|
|
35088
35596
|
let projectResult = { removed: [], kept: [], keptEntries: [] };
|
|
35089
35597
|
const projectConfigPath = join19(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
35090
|
-
if (
|
|
35598
|
+
if (existsSync18(projectConfigPath) && !isUserConfigPath(workspacePath)) {
|
|
35091
35599
|
const content = await readFile11(projectConfigPath, "utf-8");
|
|
35092
35600
|
const config = load(content);
|
|
35093
35601
|
projectResult = await prunePlugins(config.plugins);
|
|
@@ -35273,29 +35781,24 @@ var repoListMeta = {
|
|
|
35273
35781
|
// src/cli/commands/workspace.ts
|
|
35274
35782
|
init_format_sync();
|
|
35275
35783
|
function parseClientEntries(input) {
|
|
35276
|
-
const validClients = ClientTypeSchema.options;
|
|
35277
|
-
const validModes = InstallModeSchema.options;
|
|
35278
35784
|
const entries = [];
|
|
35279
35785
|
for (const part of input.split(",").map((s) => s.trim()).filter(Boolean)) {
|
|
35280
|
-
const
|
|
35281
|
-
if (
|
|
35282
|
-
|
|
35786
|
+
const result = ClientEntrySchema.safeParse(part);
|
|
35787
|
+
if (!result.success) {
|
|
35788
|
+
const colonIdx = part.indexOf(":");
|
|
35789
|
+
if (colonIdx === -1) {
|
|
35283
35790
|
throw new Error(`Invalid client(s): ${part}
|
|
35284
|
-
Valid clients: ${
|
|
35791
|
+
Valid clients: ${ClientTypeSchema.options.join(", ")}`);
|
|
35285
35792
|
}
|
|
35286
|
-
entries.push(part);
|
|
35287
|
-
} else {
|
|
35288
35793
|
const name = part.slice(0, colonIdx);
|
|
35289
35794
|
const mode = part.slice(colonIdx + 1);
|
|
35290
|
-
if (!
|
|
35795
|
+
if (!ClientTypeSchema.options.includes(name)) {
|
|
35291
35796
|
throw new Error(`Invalid client(s): ${name}
|
|
35292
|
-
Valid clients: ${
|
|
35797
|
+
Valid clients: ${ClientTypeSchema.options.join(", ")}`);
|
|
35293
35798
|
}
|
|
35294
|
-
|
|
35295
|
-
throw new Error(`Invalid install mode '${mode}' for client '${name}'. Valid modes: ${validModes.join(", ")}`);
|
|
35296
|
-
}
|
|
35297
|
-
entries.push({ name, install: mode });
|
|
35799
|
+
throw new Error(`Invalid install mode '${mode}' for client '${name}'. Valid modes: ${InstallModeSchema.options.join(", ")}`);
|
|
35298
35800
|
}
|
|
35801
|
+
entries.push(result.data);
|
|
35299
35802
|
}
|
|
35300
35803
|
return entries;
|
|
35301
35804
|
}
|
|
@@ -35343,8 +35846,7 @@ var initCmd = import_cmd_ts2.command({
|
|
|
35343
35846
|
console.log(`
|
|
35344
35847
|
Plugin sync results:`);
|
|
35345
35848
|
for (const pluginResult of syncResult.pluginResults) {
|
|
35346
|
-
|
|
35347
|
-
console.log(` ${status} ${pluginResult.plugin}`);
|
|
35849
|
+
console.log(` ${formatPluginHeader(pluginResult)}`);
|
|
35348
35850
|
if (pluginResult.error) {
|
|
35349
35851
|
console.log(` Error: ${pluginResult.error}`);
|
|
35350
35852
|
}
|
|
@@ -35385,7 +35887,7 @@ var syncCmd = import_cmd_ts2.command({
|
|
|
35385
35887
|
}
|
|
35386
35888
|
const userConfigExists = !!await getUserWorkspaceConfig();
|
|
35387
35889
|
const projectConfigPath = join20(process.cwd(), ".allagents", "workspace.yaml");
|
|
35388
|
-
const projectConfigExists =
|
|
35890
|
+
const projectConfigExists = existsSync19(projectConfigPath);
|
|
35389
35891
|
if (!userConfigExists && !projectConfigExists) {
|
|
35390
35892
|
await ensureUserWorkspace();
|
|
35391
35893
|
if (isJsonMode()) {
|
|
@@ -35437,8 +35939,7 @@ var syncCmd = import_cmd_ts2.command({
|
|
|
35437
35939
|
}
|
|
35438
35940
|
console.log("");
|
|
35439
35941
|
for (const pluginResult of result.pluginResults) {
|
|
35440
|
-
|
|
35441
|
-
console.log(`${status} Plugin: ${pluginResult.plugin}`);
|
|
35942
|
+
console.log(formatPluginHeader(pluginResult));
|
|
35442
35943
|
if (pluginResult.error) {
|
|
35443
35944
|
console.log(` Error: ${pluginResult.error}`);
|
|
35444
35945
|
}
|
|
@@ -35492,9 +35993,12 @@ native:`);
|
|
|
35492
35993
|
}
|
|
35493
35994
|
}
|
|
35494
35995
|
}
|
|
35495
|
-
|
|
35496
|
-
|
|
35497
|
-
console.log(
|
|
35996
|
+
const summaryLines = formatSyncSummary(result);
|
|
35997
|
+
if (summaryLines.length > 0) {
|
|
35998
|
+
console.log("");
|
|
35999
|
+
for (const line of summaryLines) {
|
|
36000
|
+
console.log(line);
|
|
36001
|
+
}
|
|
35498
36002
|
}
|
|
35499
36003
|
if (!result.success || result.totalFailed > 0) {
|
|
35500
36004
|
process.exit(1);
|
|
@@ -36030,7 +36534,7 @@ init_workspace_modify();
|
|
|
36030
36534
|
init_user_workspace();
|
|
36031
36535
|
init_skills();
|
|
36032
36536
|
var import_cmd_ts3 = __toESM(require_cjs(), 1);
|
|
36033
|
-
import { existsSync as
|
|
36537
|
+
import { existsSync as existsSync21 } from "node:fs";
|
|
36034
36538
|
import { readFile as readFile13 } from "node:fs/promises";
|
|
36035
36539
|
import { join as join22 } from "node:path";
|
|
36036
36540
|
|
|
@@ -36123,7 +36627,7 @@ init_skill();
|
|
|
36123
36627
|
init_marketplace();
|
|
36124
36628
|
init_marketplace_manifest_parser();
|
|
36125
36629
|
function hasProjectConfig(dir) {
|
|
36126
|
-
return
|
|
36630
|
+
return existsSync21(join22(dir, CONFIG_DIR, WORKSPACE_CONFIG_FILE));
|
|
36127
36631
|
}
|
|
36128
36632
|
function resolveScope(cwd) {
|
|
36129
36633
|
if (isUserConfigPath(cwd))
|
|
@@ -36712,12 +37216,12 @@ init_workspace_config();
|
|
|
36712
37216
|
init_constants();
|
|
36713
37217
|
init_js_yaml();
|
|
36714
37218
|
import { readFile as readFile14 } from "node:fs/promises";
|
|
36715
|
-
import { existsSync as
|
|
37219
|
+
import { existsSync as existsSync22 } from "node:fs";
|
|
36716
37220
|
import { join as join23 } from "node:path";
|
|
36717
37221
|
async function runSyncAndPrint(options2) {
|
|
36718
37222
|
if (!isJsonMode()) {
|
|
36719
37223
|
console.log(`
|
|
36720
|
-
|
|
37224
|
+
Updating workspace...
|
|
36721
37225
|
`);
|
|
36722
37226
|
}
|
|
36723
37227
|
const result = await syncWorkspace(process.cwd(), options2);
|
|
@@ -36730,8 +37234,7 @@ Syncing workspace...
|
|
|
36730
37234
|
const syncData = buildSyncData(result);
|
|
36731
37235
|
if (!isJsonMode()) {
|
|
36732
37236
|
for (const pluginResult of result.pluginResults) {
|
|
36733
|
-
|
|
36734
|
-
console.log(`${status} Plugin: ${pluginResult.plugin}`);
|
|
37237
|
+
console.log(formatPluginHeader(pluginResult));
|
|
36735
37238
|
if (pluginResult.error) {
|
|
36736
37239
|
console.log(` Error: ${pluginResult.error}`);
|
|
36737
37240
|
}
|
|
@@ -36749,6 +37252,19 @@ Syncing workspace...
|
|
|
36749
37252
|
}
|
|
36750
37253
|
}
|
|
36751
37254
|
}
|
|
37255
|
+
if (result.mcpResults) {
|
|
37256
|
+
for (const [scope, mcpResult] of Object.entries(result.mcpResults)) {
|
|
37257
|
+
if (!mcpResult)
|
|
37258
|
+
continue;
|
|
37259
|
+
const mcpLines = formatMcpResult(mcpResult, scope);
|
|
37260
|
+
if (mcpLines.length > 0) {
|
|
37261
|
+
console.log("");
|
|
37262
|
+
for (const line of mcpLines) {
|
|
37263
|
+
console.log(line);
|
|
37264
|
+
}
|
|
37265
|
+
}
|
|
37266
|
+
}
|
|
37267
|
+
}
|
|
36752
37268
|
if (result.nativeResult) {
|
|
36753
37269
|
const nativeLines = formatNativeResult(result.nativeResult);
|
|
36754
37270
|
if (nativeLines.length > 0) {
|
|
@@ -36766,10 +37282,6 @@ Warnings:`);
|
|
|
36766
37282
|
console.log(` ⚠ ${warning}`);
|
|
36767
37283
|
}
|
|
36768
37284
|
}
|
|
36769
|
-
console.log("");
|
|
36770
|
-
for (const line of formatSyncSummary(result)) {
|
|
36771
|
-
console.log(line);
|
|
36772
|
-
}
|
|
36773
37285
|
}
|
|
36774
37286
|
return { ok: result.success && result.totalFailed === 0, syncData };
|
|
36775
37287
|
}
|
|
@@ -36784,8 +37296,7 @@ async function runUserSyncAndPrint() {
|
|
|
36784
37296
|
const syncData = buildSyncData(result);
|
|
36785
37297
|
if (!isJsonMode()) {
|
|
36786
37298
|
for (const pluginResult of result.pluginResults) {
|
|
36787
|
-
|
|
36788
|
-
console.log(`${status} Plugin: ${pluginResult.plugin}`);
|
|
37299
|
+
console.log(formatPluginHeader(pluginResult));
|
|
36789
37300
|
if (pluginResult.error) {
|
|
36790
37301
|
console.log(` Error: ${pluginResult.error}`);
|
|
36791
37302
|
}
|
|
@@ -36826,10 +37337,6 @@ native:`);
|
|
|
36826
37337
|
}
|
|
36827
37338
|
}
|
|
36828
37339
|
}
|
|
36829
|
-
console.log("");
|
|
36830
|
-
for (const line of formatSyncSummary(result)) {
|
|
36831
|
-
console.log(line);
|
|
36832
|
-
}
|
|
36833
37340
|
}
|
|
36834
37341
|
return { ok: result.success && result.totalFailed === 0, syncData };
|
|
36835
37342
|
}
|
|
@@ -36955,7 +37462,7 @@ var marketplaceAddCmd = import_cmd_ts4.command({
|
|
|
36955
37462
|
process.exit(1);
|
|
36956
37463
|
}
|
|
36957
37464
|
if (effectiveScope === "project") {
|
|
36958
|
-
if (!
|
|
37465
|
+
if (!existsSync22(join23(process.cwd(), CONFIG_DIR, WORKSPACE_CONFIG_FILE))) {
|
|
36959
37466
|
const msg = 'No workspace found in current directory. Run "allagents workspace init" first.';
|
|
36960
37467
|
if (isJsonMode()) {
|
|
36961
37468
|
jsonOutput({ success: false, command: "plugin marketplace add", error: msg });
|
|
@@ -37262,7 +37769,7 @@ var pluginListCmd = import_cmd_ts4.command({
|
|
|
37262
37769
|
};
|
|
37263
37770
|
const pluginClients = new Map;
|
|
37264
37771
|
async function loadConfigClients(configPath, scope) {
|
|
37265
|
-
if (!
|
|
37772
|
+
if (!existsSync22(configPath))
|
|
37266
37773
|
return;
|
|
37267
37774
|
try {
|
|
37268
37775
|
const content = await readFile14(configPath, "utf-8");
|
|
@@ -37418,7 +37925,7 @@ var pluginInstallCmd = import_cmd_ts4.command({
|
|
|
37418
37925
|
const isUser = scope === "user" || !scope && isUserConfigPath(process.cwd());
|
|
37419
37926
|
if (!isUser) {
|
|
37420
37927
|
const configPath = join23(process.cwd(), CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
37421
|
-
if (!
|
|
37928
|
+
if (!existsSync22(configPath)) {
|
|
37422
37929
|
const { promptForClients: promptForClients2 } = await Promise.resolve().then(() => (init_prompt_clients(), exports_prompt_clients));
|
|
37423
37930
|
const clients = await promptForClients2();
|
|
37424
37931
|
if (clients === null) {
|
|
@@ -37509,9 +38016,12 @@ Enabled skills: ${skills.join(", ")}`);
|
|
|
37509
38016
|
if (result.autoRegistered) {
|
|
37510
38017
|
console.log(` Resolved marketplace: ${result.autoRegistered}`);
|
|
37511
38018
|
}
|
|
37512
|
-
console.log(
|
|
38019
|
+
console.log(`Installing plugin "${displayPlugin}"...`);
|
|
37513
38020
|
}
|
|
37514
38021
|
const { ok: syncOk, syncData } = isUser ? await runUserSyncAndPrint() : await runSyncAndPrint();
|
|
38022
|
+
if (!isJsonMode() && syncOk) {
|
|
38023
|
+
console.log(`✔ Successfully installed plugin: ${displayPlugin} (scope: ${isUser ? "user" : "project"})`);
|
|
38024
|
+
}
|
|
37515
38025
|
if (isJsonMode()) {
|
|
37516
38026
|
jsonOutput({
|
|
37517
38027
|
success: syncOk,
|
|
@@ -37701,13 +38211,13 @@ var pluginUpdateCmd = import_cmd_ts4.command({
|
|
|
37701
38211
|
}
|
|
37702
38212
|
}
|
|
37703
38213
|
if (updateProject && !isUserConfigPath(process.cwd())) {
|
|
37704
|
-
const { existsSync:
|
|
38214
|
+
const { existsSync: existsSync23 } = await import("node:fs");
|
|
37705
38215
|
const { readFile: readFile15 } = await import("node:fs/promises");
|
|
37706
38216
|
const { join: join24 } = await import("node:path");
|
|
37707
38217
|
const { load: load2 } = await Promise.resolve().then(() => (init_js_yaml(), exports_js_yaml));
|
|
37708
38218
|
const { CONFIG_DIR: CONFIG_DIR2, WORKSPACE_CONFIG_FILE: WORKSPACE_CONFIG_FILE2 } = await Promise.resolve().then(() => (init_constants(), exports_constants));
|
|
37709
38219
|
const configPath = join24(process.cwd(), CONFIG_DIR2, WORKSPACE_CONFIG_FILE2);
|
|
37710
|
-
if (
|
|
38220
|
+
if (existsSync23(configPath)) {
|
|
37711
38221
|
const content = await readFile15(configPath, "utf-8");
|
|
37712
38222
|
const config = load2(content);
|
|
37713
38223
|
for (const entry of config.plugins ?? []) {
|
|
@@ -38812,7 +39322,7 @@ var addPipeMethods = (spawned) => {
|
|
|
38812
39322
|
};
|
|
38813
39323
|
|
|
38814
39324
|
// node_modules/execa/lib/stream.js
|
|
38815
|
-
import { createReadStream, readFileSync as
|
|
39325
|
+
import { createReadStream, readFileSync as readFileSync6 } from "node:fs";
|
|
38816
39326
|
import { setTimeout as setTimeout2 } from "node:timers/promises";
|
|
38817
39327
|
|
|
38818
39328
|
// node_modules/get-stream/source/contents.js
|
|
@@ -39008,7 +39518,7 @@ var getInputSync = ({ input, inputFile }) => {
|
|
|
39008
39518
|
return input;
|
|
39009
39519
|
}
|
|
39010
39520
|
validateInputOptions(input);
|
|
39011
|
-
return
|
|
39521
|
+
return readFileSync6(inputFile);
|
|
39012
39522
|
};
|
|
39013
39523
|
var handleInputSync = (options2) => {
|
|
39014
39524
|
const input = getInputSync(options2);
|