allagents 1.1.0 → 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/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 parse(text, reviver) {
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
- ClientTypeSchema,
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 __require() {
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 extend(o) {
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 toString(compact) {
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 toString(compact) {
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 handleYamlDirective(state, name, args) {
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 handleTagDirective(state, name, args) {
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 existsSync12, readFileSync as readFileSync2, writeFileSync as writeFileSync2, lstatSync } from "node:fs";
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 dirname8, relative as relative4 } from "node:path";
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 = dirname8(filePath);
29823
+ let parentPath = dirname9(filePath);
29393
29824
  while (parentPath && parentPath !== "." && parentPath !== "/") {
29394
29825
  const fullParentPath = join15(workspacePath, parentPath);
29395
- if (!existsSync12(fullParentPath)) {
29396
- parentPath = dirname8(parentPath);
29826
+ if (!existsSync14(fullParentPath)) {
29827
+ parentPath = dirname9(parentPath);
29397
29828
  continue;
29398
29829
  }
29399
29830
  try {
29400
29831
  await rmdir(fullParentPath);
29401
- parentPath = dirname8(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 (!existsSync12(fullPath)) {
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 (!existsSync12(fullPath)) {
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 (!existsSync12(fullPath)) {
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 (!existsSync12(fullPath)) {
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 (!existsSync12(resolvedPath)) {
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 (existsSync12(templatePath)) {
30275
+ if (existsSync14(templatePath)) {
29845
30276
  try {
29846
- template = import_json52.default.parse(readFileSync2(templatePath, "utf-8"));
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
- writeFileSync2(outputPath, contentStr, "utf-8");
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 (existsSync12(outputPath)) {
29992
- const existingContent = readFileSync2(outputPath, "utf-8");
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 (!existsSync12(configPath)) {
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
- return copyValidatedPlugin(validatedPlugin, workspacePath, validatedPlugin.clients, dryRun, skillNameMap, undefined, syncMode);
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 (existsSync12(agentPath) && !filesToCopy.includes(agentFile)) {
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 = existsSync12(join15(sourcePath, "CLAUDE.md"));
30157
- if (!claudeExistsInSource && existsSync12(agentsPath) && !existsSync12(claudePath)) {
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
  }
@@ -30185,6 +30617,43 @@ ${fileValidationErrors.map((e) => ` - ${e}`).join(`
30185
30617
  }
30186
30618
  mcpResults.vscode = vscodeMcp;
30187
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
+ }
30188
30657
  const { totalCopied, totalFailed, totalSkipped, totalGenerated } = countCopyResults(pluginResults, workspaceFileResults);
30189
30658
  const hasFailures = pluginResults.some((r) => !r.success) || totalFailed > 0;
30190
30659
  const availableSkillNames = await collectAvailableSkillNames(validPlugins);
@@ -30259,10 +30728,11 @@ ${failedValidations.map((v) => ` - ${v.plugin}: ${v.error}`).join(`
30259
30728
  const allSkills = await collectAllSkills(validPlugins, disabledSkillsSet, enabledSkillsSet);
30260
30729
  const pluginSkillMaps = buildPluginSkillNameMaps(allSkills);
30261
30730
  const syncMode = config.syncMode ?? "symlink";
30262
- const pluginResults = await Promise.all(validPlugins.map((vp) => {
30731
+ const pluginResults = await Promise.all(validPlugins.map(async (vp) => {
30263
30732
  const skillNameMap = pluginSkillMaps.get(vp.resolved);
30264
30733
  const resolvedUserMappings2 = resolveClientMappings(vp.clients, USER_CLIENT_MAPPINGS);
30265
- return copyValidatedPlugin(vp, homeDir, vp.clients, dryRun, skillNameMap, resolvedUserMappings2, syncMode);
30734
+ const result = await copyValidatedPlugin(vp, homeDir, vp.clients, dryRun, skillNameMap, resolvedUserMappings2, syncMode);
30735
+ return { ...result, scope: "user" };
30266
30736
  }));
30267
30737
  const { totalCopied, totalFailed, totalSkipped, totalGenerated } = countCopyResults(pluginResults, []);
30268
30738
  const mcpResults = {};
@@ -30282,6 +30752,23 @@ ${failedValidations.map((v) => ` - ${v.plugin}: ${v.error}`).join(`
30282
30752
  }
30283
30753
  mcpResults.codex = codexMcp;
30284
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
+ }
30285
30772
  const nativeResult = await syncNativePlugins(validPlugins, previousState, "user", homeDir, dryRun, warnings, messages);
30286
30773
  const availableUserSkillNames = await collectAvailableSkillNames(validPlugins);
30287
30774
  const allCopyResultsForState = pluginResults.flatMap((r) => r.copyResults);
@@ -30311,7 +30798,7 @@ ${failedValidations.map((v) => ` - ${v.plugin}: ${v.error}`).join(`
30311
30798
  ...nativeResult && { nativeResult }
30312
30799
  };
30313
30800
  }
30314
- var import_json52, VSCODE_TEMPLATE_FILE = "template.code-workspace";
30801
+ var import_json53, VSCODE_TEMPLATE_FILE = "template.code-workspace";
30315
30802
  var init_sync = __esm(() => {
30316
30803
  init_constants();
30317
30804
  init_workspace_parser();
@@ -30329,17 +30816,18 @@ var init_sync = __esm(() => {
30329
30816
  init_workspace_modify();
30330
30817
  init_vscode_mcp();
30331
30818
  init_codex_mcp();
30819
+ init_claude_mcp();
30332
30820
  init_native();
30333
- import_json52 = __toESM(require_lib(), 1);
30821
+ import_json53 = __toESM(require_lib(), 1);
30334
30822
  });
30335
30823
 
30336
30824
  // src/core/github-fetch.ts
30337
- import { existsSync as existsSync13, readFileSync as readFileSync3 } from "node:fs";
30825
+ import { existsSync as existsSync15, readFileSync as readFileSync5 } from "node:fs";
30338
30826
  import { join as join16 } from "node:path";
30339
30827
  function readFileFromClone(tempDir, filePath) {
30340
30828
  const fullPath = join16(tempDir, filePath);
30341
- if (existsSync13(fullPath)) {
30342
- return readFileSync3(fullPath, "utf-8");
30829
+ if (existsSync15(fullPath)) {
30830
+ return readFileSync5(fullPath, "utf-8");
30343
30831
  }
30344
30832
  return null;
30345
30833
  }
@@ -30438,14 +30926,14 @@ var init_github_fetch = __esm(() => {
30438
30926
 
30439
30927
  // src/core/workspace.ts
30440
30928
  import { mkdir as mkdir8, readFile as readFile10, writeFile as writeFile7, copyFile as copyFile2, unlink as unlink3 } from "node:fs/promises";
30441
- import { existsSync as existsSync14 } from "node:fs";
30442
- import { join as join17, resolve as resolve10, dirname as dirname9, relative as relative5, sep as sep2, isAbsolute as isAbsolute4 } from "node:path";
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";
30443
30931
  import { fileURLToPath } from "node:url";
30444
30932
  async function initWorkspace(targetPath = ".", options2 = {}) {
30445
30933
  const absoluteTarget = resolve10(targetPath);
30446
30934
  const configDir = join17(absoluteTarget, CONFIG_DIR);
30447
30935
  const configPath = join17(configDir, WORKSPACE_CONFIG_FILE);
30448
- if (existsSync14(configPath)) {
30936
+ if (existsSync16(configPath)) {
30449
30937
  if (options2.force) {
30450
30938
  await unlink3(configPath);
30451
30939
  } else {
@@ -30454,7 +30942,7 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
30454
30942
  }
30455
30943
  }
30456
30944
  const currentFilePath = fileURLToPath(import.meta.url);
30457
- const currentFileDir = dirname9(currentFilePath);
30945
+ const currentFileDir = dirname10(currentFilePath);
30458
30946
  const isProduction = currentFilePath.includes(`${sep2}dist${sep2}`);
30459
30947
  const defaultTemplatePath = isProduction ? join17(currentFileDir, "templates", "default") : join17(currentFileDir, "..", "templates", "default");
30460
30948
  let githubTempDir;
@@ -30495,7 +30983,7 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
30495
30983
  console.log(`✓ Using workspace.yaml from: ${options2.from}`);
30496
30984
  } else {
30497
30985
  const fromPath = resolve10(options2.from);
30498
- if (!existsSync14(fromPath)) {
30986
+ if (!existsSync16(fromPath)) {
30499
30987
  throw new Error(`Template not found: ${fromPath}`);
30500
30988
  }
30501
30989
  const { stat: stat2 } = await import("node:fs/promises");
@@ -30504,10 +30992,10 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
30504
30992
  if (fromStat.isDirectory()) {
30505
30993
  const nestedPath = join17(fromPath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
30506
30994
  const rootPath = join17(fromPath, WORKSPACE_CONFIG_FILE);
30507
- if (existsSync14(nestedPath)) {
30995
+ if (existsSync16(nestedPath)) {
30508
30996
  sourceYamlPath = nestedPath;
30509
30997
  sourceDir = fromPath;
30510
- } else if (existsSync14(rootPath)) {
30998
+ } else if (existsSync16(rootPath)) {
30511
30999
  sourceYamlPath = rootPath;
30512
31000
  sourceDir = fromPath;
30513
31001
  } else {
@@ -30516,9 +31004,9 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
30516
31004
  }
30517
31005
  } else {
30518
31006
  sourceYamlPath = fromPath;
30519
- const parentDir = dirname9(fromPath);
31007
+ const parentDir = dirname10(fromPath);
30520
31008
  if (parentDir.endsWith(CONFIG_DIR)) {
30521
- sourceDir = dirname9(parentDir);
31009
+ sourceDir = dirname10(parentDir);
30522
31010
  } else {
30523
31011
  sourceDir = parentDir;
30524
31012
  }
@@ -30539,7 +31027,7 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
30539
31027
  }
30540
31028
  } else {
30541
31029
  const defaultYamlPath = join17(defaultTemplatePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
30542
- if (!existsSync14(defaultYamlPath)) {
31030
+ if (!existsSync16(defaultYamlPath)) {
30543
31031
  throw new Error(`Default template not found at: ${defaultTemplatePath}`);
30544
31032
  }
30545
31033
  workspaceYamlContent = await readFile10(defaultYamlPath, "utf-8");
@@ -30556,7 +31044,7 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
30556
31044
  const VSCODE_TEMPLATE_FILE2 = "template.code-workspace";
30557
31045
  if (clientNames.includes("vscode") && options2.from) {
30558
31046
  const targetTemplatePath = join17(configDir, VSCODE_TEMPLATE_FILE2);
30559
- if (!existsSync14(targetTemplatePath)) {
31047
+ if (!existsSync16(targetTemplatePath)) {
30560
31048
  if (isGitHubUrl(options2.from) && githubTempDir) {
30561
31049
  if (parsedFromUrl) {
30562
31050
  const templatePath = githubBasePath ? `${githubBasePath}/${CONFIG_DIR}/${VSCODE_TEMPLATE_FILE2}` : `${CONFIG_DIR}/${VSCODE_TEMPLATE_FILE2}`;
@@ -30567,7 +31055,7 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
30567
31055
  }
30568
31056
  } else if (sourceDir) {
30569
31057
  const sourceTemplatePath = join17(sourceDir, CONFIG_DIR, VSCODE_TEMPLATE_FILE2);
30570
- if (existsSync14(sourceTemplatePath)) {
31058
+ if (existsSync16(sourceTemplatePath)) {
30571
31059
  await copyFile2(sourceTemplatePath, targetTemplatePath);
30572
31060
  }
30573
31061
  }
@@ -30581,7 +31069,7 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
30581
31069
  if (parsedFromUrl) {
30582
31070
  for (const agentFile of AGENT_FILES) {
30583
31071
  const targetFilePath = join17(absoluteTarget, agentFile);
30584
- if (existsSync14(targetFilePath)) {
31072
+ if (existsSync16(targetFilePath)) {
30585
31073
  copiedAgentFiles.push(agentFile);
30586
31074
  continue;
30587
31075
  }
@@ -30597,12 +31085,12 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
30597
31085
  const effectiveSourceDir = sourceDir ?? defaultTemplatePath;
30598
31086
  for (const agentFile of AGENT_FILES) {
30599
31087
  const targetFilePath = join17(absoluteTarget, agentFile);
30600
- if (existsSync14(targetFilePath)) {
31088
+ if (existsSync16(targetFilePath)) {
30601
31089
  copiedAgentFiles.push(agentFile);
30602
31090
  continue;
30603
31091
  }
30604
31092
  const sourcePath = join17(effectiveSourceDir, agentFile);
30605
- if (existsSync14(sourcePath)) {
31093
+ if (existsSync16(sourcePath)) {
30606
31094
  const content = await readFile10(sourcePath, "utf-8");
30607
31095
  await writeFile7(targetFilePath, content, "utf-8");
30608
31096
  copiedAgentFiles.push(agentFile);
@@ -30670,11 +31158,11 @@ var init_workspace = __esm(() => {
30670
31158
  });
30671
31159
 
30672
31160
  // src/core/status.ts
30673
- import { existsSync as existsSync15 } from "node:fs";
31161
+ import { existsSync as existsSync17 } from "node:fs";
30674
31162
  import { join as join18 } from "node:path";
30675
31163
  async function getWorkspaceStatus(workspacePath = process.cwd()) {
30676
31164
  const configPath = join18(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
30677
- if (!existsSync15(configPath) || isUserConfigPath(workspacePath)) {
31165
+ if (!existsSync17(configPath) || isUserConfigPath(workspacePath)) {
30678
31166
  const userPlugins = await getUserPluginStatuses();
30679
31167
  return {
30680
31168
  success: true,
@@ -30716,7 +31204,7 @@ async function getWorkspaceStatus(workspacePath = process.cwd()) {
30716
31204
  function getPluginStatus(parsed) {
30717
31205
  if (parsed.type === "github") {
30718
31206
  const cachePath = parsed.owner && parsed.repo ? getPluginCachePath(parsed.owner, parsed.repo) : "";
30719
- const available2 = cachePath ? existsSync15(cachePath) : false;
31207
+ const available2 = cachePath ? existsSync17(cachePath) : false;
30720
31208
  return {
30721
31209
  source: parsed.original,
30722
31210
  type: "github",
@@ -30726,7 +31214,7 @@ function getPluginStatus(parsed) {
30726
31214
  ...parsed.repo && { repo: parsed.repo }
30727
31215
  };
30728
31216
  }
30729
- const available = existsSync15(parsed.normalized);
31217
+ const available = existsSync17(parsed.normalized);
30730
31218
  return {
30731
31219
  source: parsed.original,
30732
31220
  type: "local",
@@ -30887,15 +31375,13 @@ function formatSyncHeader(result) {
30887
31375
  `✓ Successfully updated ${successCount} plugin(s)`
30888
31376
  ];
30889
31377
  }
30890
- function formatSyncSummary(result, { dryRun = false } = {}) {
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) {
30891
31384
  const lines = [];
30892
- const allCopied = result.pluginResults.flatMap((pr) => pr.copyResults.filter((r) => r.action === "copied"));
30893
- const classified = classifyCopyResults(allCopied);
30894
- if (classified.size > 0) {
30895
- lines.push(...formatArtifactLines(classified));
30896
- } else if (allCopied.length > 0) {
30897
- lines.push(` Total ${dryRun ? "would copy" : "copied"}: ${result.totalCopied}`);
30898
- }
30899
31385
  if (result.totalGenerated > 0)
30900
31386
  lines.push(` Total generated: ${result.totalGenerated}`);
30901
31387
  if (result.totalFailed > 0)
@@ -30935,7 +31421,8 @@ function formatMcpResult(mcpResult, scope) {
30935
31421
  parts.push(`${removed} removed`);
30936
31422
  if (skipped > 0)
30937
31423
  parts.push(`${skipped} skipped`);
30938
- const label = scope ? `MCP servers (${scope})` : "MCP servers";
31424
+ const displayScope = scope ? getDisplayName(scope) : undefined;
31425
+ const label = displayScope ? `MCP servers (${displayScope})` : "MCP servers";
30939
31426
  lines.push(`${label}: ${parts.join(", ")}`);
30940
31427
  for (const name of mcpResult.addedServers) {
30941
31428
  lines.push(` + ${name}`);
@@ -32819,7 +33306,7 @@ var init_prompt_clients = __esm(() => {
32819
33306
  });
32820
33307
 
32821
33308
  // src/core/skills.ts
32822
- import { existsSync as existsSync18 } from "node:fs";
33309
+ import { existsSync as existsSync20 } from "node:fs";
32823
33310
  import { readFile as readFile12, readdir as readdir4 } from "node:fs/promises";
32824
33311
  import { join as join21, basename as basename6, resolve as resolve12 } from "node:path";
32825
33312
  async function resolvePluginPath(pluginSource, workspacePath) {
@@ -32846,11 +33333,11 @@ async function resolvePluginPath(pluginSource, workspacePath) {
32846
33333
  return { path };
32847
33334
  }
32848
33335
  const resolved = resolve12(workspacePath, pluginSource);
32849
- return existsSync18(resolved) ? { path: resolved } : null;
33336
+ return existsSync20(resolved) ? { path: resolved } : null;
32850
33337
  }
32851
33338
  async function getAllSkillsFromPlugins(workspacePath = process.cwd()) {
32852
33339
  const configPath = join21(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
32853
- if (!existsSync18(configPath)) {
33340
+ if (!existsSync20(configPath)) {
32854
33341
  return [];
32855
33342
  }
32856
33343
  const content = await readFile12(configPath, "utf-8");
@@ -32870,7 +33357,7 @@ async function getAllSkillsFromPlugins(workspacePath = process.cwd()) {
32870
33357
  const pluginSkillsConfig = typeof pluginEntry === "string" ? undefined : pluginEntry.skills;
32871
33358
  const hasEnabledEntries = !pluginSkillsConfig && enabledSkills && [...enabledSkills].some((s) => s.startsWith(`${pluginName}`));
32872
33359
  let skillEntries;
32873
- if (existsSync18(skillsDir)) {
33360
+ if (existsSync20(skillsDir)) {
32874
33361
  const entries = await readdir4(skillsDir, { withFileTypes: true });
32875
33362
  skillEntries = entries.filter((e) => e.isDirectory()).map((e) => ({ name: e.name, skillPath: join21(skillsDir, e.name) }));
32876
33363
  } else {
@@ -32880,7 +33367,7 @@ async function getAllSkillsFromPlugins(workspacePath = process.cwd()) {
32880
33367
  if (!entry.isDirectory())
32881
33368
  continue;
32882
33369
  const skillMdPath = join21(pluginPath, entry.name, "SKILL.md");
32883
- if (existsSync18(skillMdPath)) {
33370
+ if (existsSync20(skillMdPath)) {
32884
33371
  flatSkills.push({ name: entry.name, skillPath: join21(pluginPath, entry.name) });
32885
33372
  }
32886
33373
  }
@@ -32888,7 +33375,7 @@ async function getAllSkillsFromPlugins(workspacePath = process.cwd()) {
32888
33375
  skillEntries = flatSkills;
32889
33376
  } else {
32890
33377
  const rootSkillMd = join21(pluginPath, "SKILL.md");
32891
- if (existsSync18(rootSkillMd)) {
33378
+ if (existsSync20(rootSkillMd)) {
32892
33379
  const skillContent = await readFile12(rootSkillMd, "utf-8");
32893
33380
  const metadata = parseSkillMetadata(skillContent);
32894
33381
  const skillName = metadata?.name ?? basename6(pluginPath);
@@ -32930,10 +33417,10 @@ async function findSkillByName(skillName, workspacePath = process.cwd()) {
32930
33417
  return allSkills.filter((s) => s.name === skillName);
32931
33418
  }
32932
33419
  async function discoverSkillNames(pluginPath) {
32933
- if (!existsSync18(pluginPath))
33420
+ if (!existsSync20(pluginPath))
32934
33421
  return [];
32935
33422
  const skillsDir = join21(pluginPath, "skills");
32936
- if (existsSync18(skillsDir)) {
33423
+ if (existsSync20(skillsDir)) {
32937
33424
  const entries2 = await readdir4(skillsDir, { withFileTypes: true });
32938
33425
  return entries2.filter((e) => e.isDirectory()).map((e) => e.name);
32939
33426
  }
@@ -32942,14 +33429,14 @@ async function discoverSkillNames(pluginPath) {
32942
33429
  for (const entry of entries) {
32943
33430
  if (!entry.isDirectory())
32944
33431
  continue;
32945
- if (existsSync18(join21(pluginPath, entry.name, "SKILL.md"))) {
33432
+ if (existsSync20(join21(pluginPath, entry.name, "SKILL.md"))) {
32946
33433
  flatSkills.push(entry.name);
32947
33434
  }
32948
33435
  }
32949
33436
  if (flatSkills.length > 0)
32950
33437
  return flatSkills;
32951
33438
  const rootSkillMd = join21(pluginPath, "SKILL.md");
32952
- if (existsSync18(rootSkillMd)) {
33439
+ if (existsSync20(rootSkillMd)) {
32953
33440
  try {
32954
33441
  const content = await readFile12(rootSkillMd, "utf-8");
32955
33442
  const { parseSkillMetadata: parseSkillMetadata2 } = await Promise.resolve().then(() => (init_skill(), exports_skill));
@@ -33469,7 +33956,7 @@ var package_default;
33469
33956
  var init_package = __esm(() => {
33470
33957
  package_default = {
33471
33958
  name: "allagents",
33472
- version: "1.1.0",
33959
+ version: "1.2.0",
33473
33960
  description: "CLI tool for managing multi-repo AI agent workspaces with plugin synchronization",
33474
33961
  type: "module",
33475
33962
  bin: {
@@ -33673,7 +34160,7 @@ class TuiCache {
33673
34160
  }
33674
34161
 
33675
34162
  // src/cli/tui/context.ts
33676
- import { existsSync as existsSync21 } from "node:fs";
34163
+ import { existsSync as existsSync23 } from "node:fs";
33677
34164
  import { join as join25 } from "node:path";
33678
34165
  async function getTuiContext(cwd = process.cwd(), cache2) {
33679
34166
  const cachedContext = cache2?.getContext();
@@ -33681,7 +34168,7 @@ async function getTuiContext(cwd = process.cwd(), cache2) {
33681
34168
  return cachedContext;
33682
34169
  }
33683
34170
  const configPath = join25(cwd, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
33684
- const hasWorkspace = existsSync21(configPath) && !isUserConfigPath(cwd);
34171
+ const hasWorkspace = existsSync23(configPath) && !isUserConfigPath(cwd);
33685
34172
  let projectPluginCount = 0;
33686
34173
  if (hasWorkspace) {
33687
34174
  try {
@@ -33757,7 +34244,7 @@ async function runSync(context) {
33757
34244
  if (result.error) {
33758
34245
  kt2(result.error, "Sync Error");
33759
34246
  } else {
33760
- const lines = result.pluginResults.map((pr) => `${pr.success ? "✓" : "✗"} ${pr.plugin}`);
34247
+ const lines = result.pluginResults.map((pr) => formatPluginHeader(pr));
33761
34248
  lines.push("");
33762
34249
  lines.push(...formatSyncSummary(result));
33763
34250
  if (result.nativeResult) {
@@ -33774,7 +34261,7 @@ async function runSync(context) {
33774
34261
  if (userResult.error) {
33775
34262
  kt2(userResult.error, "User Sync Error");
33776
34263
  } else {
33777
- const lines = userResult.pluginResults.map((pr) => `${pr.success ? "✓" : "✗"} ${pr.plugin}`);
34264
+ const lines = userResult.pluginResults.map((pr) => formatPluginHeader(pr));
33778
34265
  lines.push("");
33779
34266
  lines.push(...formatSyncSummary(userResult));
33780
34267
  if (userResult.mcpResults) {
@@ -35069,7 +35556,7 @@ init_workspace();
35069
35556
  init_sync();
35070
35557
  init_status2();
35071
35558
  var import_cmd_ts2 = __toESM(require_cjs(), 1);
35072
- import { existsSync as existsSync17 } from "node:fs";
35559
+ import { existsSync as existsSync19 } from "node:fs";
35073
35560
  import { join as join20, resolve as resolve11 } from "node:path";
35074
35561
 
35075
35562
  // src/core/prune.ts
@@ -35079,7 +35566,7 @@ init_marketplace();
35079
35566
  init_user_workspace();
35080
35567
  init_workspace_config();
35081
35568
  import { readFile as readFile11, writeFile as writeFile8 } from "node:fs/promises";
35082
- import { existsSync as existsSync16 } from "node:fs";
35569
+ import { existsSync as existsSync18 } from "node:fs";
35083
35570
  import { join as join19 } from "node:path";
35084
35571
  async function isOrphanedPlugin(pluginSpec) {
35085
35572
  if (!isPluginSpec(pluginSpec))
@@ -35108,7 +35595,7 @@ async function prunePlugins(plugins) {
35108
35595
  async function pruneOrphanedPlugins(workspacePath) {
35109
35596
  let projectResult = { removed: [], kept: [], keptEntries: [] };
35110
35597
  const projectConfigPath = join19(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
35111
- if (existsSync16(projectConfigPath) && !isUserConfigPath(workspacePath)) {
35598
+ if (existsSync18(projectConfigPath) && !isUserConfigPath(workspacePath)) {
35112
35599
  const content = await readFile11(projectConfigPath, "utf-8");
35113
35600
  const config = load(content);
35114
35601
  projectResult = await prunePlugins(config.plugins);
@@ -35294,29 +35781,24 @@ var repoListMeta = {
35294
35781
  // src/cli/commands/workspace.ts
35295
35782
  init_format_sync();
35296
35783
  function parseClientEntries(input) {
35297
- const validClients = ClientTypeSchema.options;
35298
- const validModes = InstallModeSchema.options;
35299
35784
  const entries = [];
35300
35785
  for (const part of input.split(",").map((s) => s.trim()).filter(Boolean)) {
35301
- const colonIdx = part.indexOf(":");
35302
- if (colonIdx === -1) {
35303
- if (!validClients.includes(part)) {
35786
+ const result = ClientEntrySchema.safeParse(part);
35787
+ if (!result.success) {
35788
+ const colonIdx = part.indexOf(":");
35789
+ if (colonIdx === -1) {
35304
35790
  throw new Error(`Invalid client(s): ${part}
35305
- Valid clients: ${validClients.join(", ")}`);
35791
+ Valid clients: ${ClientTypeSchema.options.join(", ")}`);
35306
35792
  }
35307
- entries.push(part);
35308
- } else {
35309
35793
  const name = part.slice(0, colonIdx);
35310
35794
  const mode = part.slice(colonIdx + 1);
35311
- if (!validClients.includes(name)) {
35795
+ if (!ClientTypeSchema.options.includes(name)) {
35312
35796
  throw new Error(`Invalid client(s): ${name}
35313
- Valid clients: ${validClients.join(", ")}`);
35314
- }
35315
- if (!validModes.includes(mode)) {
35316
- throw new Error(`Invalid install mode '${mode}' for client '${name}'. Valid modes: ${validModes.join(", ")}`);
35797
+ Valid clients: ${ClientTypeSchema.options.join(", ")}`);
35317
35798
  }
35318
- entries.push({ name, install: mode });
35799
+ throw new Error(`Invalid install mode '${mode}' for client '${name}'. Valid modes: ${InstallModeSchema.options.join(", ")}`);
35319
35800
  }
35801
+ entries.push(result.data);
35320
35802
  }
35321
35803
  return entries;
35322
35804
  }
@@ -35364,8 +35846,7 @@ var initCmd = import_cmd_ts2.command({
35364
35846
  console.log(`
35365
35847
  Plugin sync results:`);
35366
35848
  for (const pluginResult of syncResult.pluginResults) {
35367
- const status = pluginResult.success ? "✓" : "✗";
35368
- console.log(` ${status} ${pluginResult.plugin}`);
35849
+ console.log(` ${formatPluginHeader(pluginResult)}`);
35369
35850
  if (pluginResult.error) {
35370
35851
  console.log(` Error: ${pluginResult.error}`);
35371
35852
  }
@@ -35406,7 +35887,7 @@ var syncCmd = import_cmd_ts2.command({
35406
35887
  }
35407
35888
  const userConfigExists = !!await getUserWorkspaceConfig();
35408
35889
  const projectConfigPath = join20(process.cwd(), ".allagents", "workspace.yaml");
35409
- const projectConfigExists = existsSync17(projectConfigPath);
35890
+ const projectConfigExists = existsSync19(projectConfigPath);
35410
35891
  if (!userConfigExists && !projectConfigExists) {
35411
35892
  await ensureUserWorkspace();
35412
35893
  if (isJsonMode()) {
@@ -35458,8 +35939,7 @@ var syncCmd = import_cmd_ts2.command({
35458
35939
  }
35459
35940
  console.log("");
35460
35941
  for (const pluginResult of result.pluginResults) {
35461
- const status = pluginResult.success ? "✓" : "✗";
35462
- console.log(`${status} Plugin: ${pluginResult.plugin}`);
35942
+ console.log(formatPluginHeader(pluginResult));
35463
35943
  if (pluginResult.error) {
35464
35944
  console.log(` Error: ${pluginResult.error}`);
35465
35945
  }
@@ -35513,9 +35993,12 @@ native:`);
35513
35993
  }
35514
35994
  }
35515
35995
  }
35516
- console.log("");
35517
- for (const line of formatSyncSummary(result, { dryRun })) {
35518
- console.log(line);
35996
+ const summaryLines = formatSyncSummary(result);
35997
+ if (summaryLines.length > 0) {
35998
+ console.log("");
35999
+ for (const line of summaryLines) {
36000
+ console.log(line);
36001
+ }
35519
36002
  }
35520
36003
  if (!result.success || result.totalFailed > 0) {
35521
36004
  process.exit(1);
@@ -36051,7 +36534,7 @@ init_workspace_modify();
36051
36534
  init_user_workspace();
36052
36535
  init_skills();
36053
36536
  var import_cmd_ts3 = __toESM(require_cjs(), 1);
36054
- import { existsSync as existsSync19 } from "node:fs";
36537
+ import { existsSync as existsSync21 } from "node:fs";
36055
36538
  import { readFile as readFile13 } from "node:fs/promises";
36056
36539
  import { join as join22 } from "node:path";
36057
36540
 
@@ -36144,7 +36627,7 @@ init_skill();
36144
36627
  init_marketplace();
36145
36628
  init_marketplace_manifest_parser();
36146
36629
  function hasProjectConfig(dir) {
36147
- return existsSync19(join22(dir, CONFIG_DIR, WORKSPACE_CONFIG_FILE));
36630
+ return existsSync21(join22(dir, CONFIG_DIR, WORKSPACE_CONFIG_FILE));
36148
36631
  }
36149
36632
  function resolveScope(cwd) {
36150
36633
  if (isUserConfigPath(cwd))
@@ -36733,7 +37216,7 @@ init_workspace_config();
36733
37216
  init_constants();
36734
37217
  init_js_yaml();
36735
37218
  import { readFile as readFile14 } from "node:fs/promises";
36736
- import { existsSync as existsSync20 } from "node:fs";
37219
+ import { existsSync as existsSync22 } from "node:fs";
36737
37220
  import { join as join23 } from "node:path";
36738
37221
  async function runSyncAndPrint(options2) {
36739
37222
  if (!isJsonMode()) {
@@ -36751,8 +37234,7 @@ Updating workspace...
36751
37234
  const syncData = buildSyncData(result);
36752
37235
  if (!isJsonMode()) {
36753
37236
  for (const pluginResult of result.pluginResults) {
36754
- const status = pluginResult.success ? "✓" : "✗";
36755
- console.log(`${status} Plugin: ${pluginResult.plugin}`);
37237
+ console.log(formatPluginHeader(pluginResult));
36756
37238
  if (pluginResult.error) {
36757
37239
  console.log(` Error: ${pluginResult.error}`);
36758
37240
  }
@@ -36814,8 +37296,7 @@ async function runUserSyncAndPrint() {
36814
37296
  const syncData = buildSyncData(result);
36815
37297
  if (!isJsonMode()) {
36816
37298
  for (const pluginResult of result.pluginResults) {
36817
- const status = pluginResult.success ? "✓" : "✗";
36818
- console.log(`${status} Plugin: ${pluginResult.plugin}`);
37299
+ console.log(formatPluginHeader(pluginResult));
36819
37300
  if (pluginResult.error) {
36820
37301
  console.log(` Error: ${pluginResult.error}`);
36821
37302
  }
@@ -36981,7 +37462,7 @@ var marketplaceAddCmd = import_cmd_ts4.command({
36981
37462
  process.exit(1);
36982
37463
  }
36983
37464
  if (effectiveScope === "project") {
36984
- if (!existsSync20(join23(process.cwd(), CONFIG_DIR, WORKSPACE_CONFIG_FILE))) {
37465
+ if (!existsSync22(join23(process.cwd(), CONFIG_DIR, WORKSPACE_CONFIG_FILE))) {
36985
37466
  const msg = 'No workspace found in current directory. Run "allagents workspace init" first.';
36986
37467
  if (isJsonMode()) {
36987
37468
  jsonOutput({ success: false, command: "plugin marketplace add", error: msg });
@@ -37288,7 +37769,7 @@ var pluginListCmd = import_cmd_ts4.command({
37288
37769
  };
37289
37770
  const pluginClients = new Map;
37290
37771
  async function loadConfigClients(configPath, scope) {
37291
- if (!existsSync20(configPath))
37772
+ if (!existsSync22(configPath))
37292
37773
  return;
37293
37774
  try {
37294
37775
  const content = await readFile14(configPath, "utf-8");
@@ -37444,7 +37925,7 @@ var pluginInstallCmd = import_cmd_ts4.command({
37444
37925
  const isUser = scope === "user" || !scope && isUserConfigPath(process.cwd());
37445
37926
  if (!isUser) {
37446
37927
  const configPath = join23(process.cwd(), CONFIG_DIR, WORKSPACE_CONFIG_FILE);
37447
- if (!existsSync20(configPath)) {
37928
+ if (!existsSync22(configPath)) {
37448
37929
  const { promptForClients: promptForClients2 } = await Promise.resolve().then(() => (init_prompt_clients(), exports_prompt_clients));
37449
37930
  const clients = await promptForClients2();
37450
37931
  if (clients === null) {
@@ -37730,13 +38211,13 @@ var pluginUpdateCmd = import_cmd_ts4.command({
37730
38211
  }
37731
38212
  }
37732
38213
  if (updateProject && !isUserConfigPath(process.cwd())) {
37733
- const { existsSync: existsSync21 } = await import("node:fs");
38214
+ const { existsSync: existsSync23 } = await import("node:fs");
37734
38215
  const { readFile: readFile15 } = await import("node:fs/promises");
37735
38216
  const { join: join24 } = await import("node:path");
37736
38217
  const { load: load2 } = await Promise.resolve().then(() => (init_js_yaml(), exports_js_yaml));
37737
38218
  const { CONFIG_DIR: CONFIG_DIR2, WORKSPACE_CONFIG_FILE: WORKSPACE_CONFIG_FILE2 } = await Promise.resolve().then(() => (init_constants(), exports_constants));
37738
38219
  const configPath = join24(process.cwd(), CONFIG_DIR2, WORKSPACE_CONFIG_FILE2);
37739
- if (existsSync21(configPath)) {
38220
+ if (existsSync23(configPath)) {
37740
38221
  const content = await readFile15(configPath, "utf-8");
37741
38222
  const config = load2(content);
37742
38223
  for (const entry of config.plugins ?? []) {
@@ -38841,7 +39322,7 @@ var addPipeMethods = (spawned) => {
38841
39322
  };
38842
39323
 
38843
39324
  // node_modules/execa/lib/stream.js
38844
- import { createReadStream, readFileSync as readFileSync4 } from "node:fs";
39325
+ import { createReadStream, readFileSync as readFileSync6 } from "node:fs";
38845
39326
  import { setTimeout as setTimeout2 } from "node:timers/promises";
38846
39327
 
38847
39328
  // node_modules/get-stream/source/contents.js
@@ -39037,7 +39518,7 @@ var getInputSync = ({ input, inputFile }) => {
39037
39518
  return input;
39038
39519
  }
39039
39520
  validateInputOptions(input);
39040
- return readFileSync4(inputFile);
39521
+ return readFileSync6(inputFile);
39041
39522
  };
39042
39523
  var handleInputSync = (options2) => {
39043
39524
  const input = getInputSync(options2);