allagents 0.21.8 → 0.22.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -3673,6 +3673,24 @@ var require_cjs = __commonJS((exports) => {
3673
3673
  });
3674
3674
 
3675
3675
  // node_modules/js-yaml/dist/js-yaml.mjs
3676
+ var exports_js_yaml = {};
3677
+ __export(exports_js_yaml, {
3678
+ types: () => types,
3679
+ safeLoadAll: () => safeLoadAll,
3680
+ safeLoad: () => safeLoad,
3681
+ safeDump: () => safeDump,
3682
+ loadAll: () => loadAll,
3683
+ load: () => load,
3684
+ dump: () => dump,
3685
+ default: () => jsYaml,
3686
+ YAMLException: () => YAMLException,
3687
+ Type: () => Type,
3688
+ Schema: () => Schema,
3689
+ JSON_SCHEMA: () => JSON_SCHEMA,
3690
+ FAILSAFE_SCHEMA: () => FAILSAFE_SCHEMA,
3691
+ DEFAULT_SCHEMA: () => DEFAULT_SCHEMA,
3692
+ CORE_SCHEMA: () => CORE_SCHEMA
3693
+ });
3676
3694
  function isNothing(subject) {
3677
3695
  return typeof subject === "undefined" || subject === null;
3678
3696
  }
@@ -5920,7 +5938,7 @@ function renamed(from, to) {
5920
5938
  };
5921
5939
  }
5922
5940
  var isNothing_1, isObject_1, toArray_1, repeat_1, isNegativeZero_1, extend_1, common, exception, snippet, TYPE_CONSTRUCTOR_OPTIONS, YAML_NODE_KINDS, type, schema, str2, seq, map, failsafe, _null, bool, int, YAML_FLOAT_PATTERN, SCIENTIFIC_WITHOUT_DOT, float, json, core, YAML_DATE_REGEXP, YAML_TIMESTAMP_REGEXP, timestamp, merge, BASE64_MAP = `ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
5923
- \r`, binary, _hasOwnProperty$3, _toString$2, omap, _toString$1, pairs, _hasOwnProperty$2, set, _default, _hasOwnProperty$1, CONTEXT_FLOW_IN = 1, CONTEXT_FLOW_OUT = 2, CONTEXT_BLOCK_IN = 3, CONTEXT_BLOCK_OUT = 4, CHOMPING_CLIP = 1, CHOMPING_STRIP = 2, CHOMPING_KEEP = 3, PATTERN_NON_PRINTABLE, PATTERN_NON_ASCII_LINE_BREAKS, PATTERN_FLOW_INDICATORS, PATTERN_TAG_HANDLE, PATTERN_TAG_URI, simpleEscapeCheck, simpleEscapeMap, i, directiveHandlers, loadAll_1, load_1, loader, _toString, _hasOwnProperty, CHAR_BOM = 65279, CHAR_TAB = 9, CHAR_LINE_FEED = 10, CHAR_CARRIAGE_RETURN = 13, CHAR_SPACE = 32, CHAR_EXCLAMATION = 33, CHAR_DOUBLE_QUOTE = 34, CHAR_SHARP = 35, CHAR_PERCENT = 37, CHAR_AMPERSAND = 38, CHAR_SINGLE_QUOTE = 39, CHAR_ASTERISK = 42, CHAR_COMMA = 44, CHAR_MINUS = 45, CHAR_COLON = 58, CHAR_EQUALS = 61, CHAR_GREATER_THAN = 62, CHAR_QUESTION = 63, CHAR_COMMERCIAL_AT = 64, CHAR_LEFT_SQUARE_BRACKET = 91, CHAR_RIGHT_SQUARE_BRACKET = 93, CHAR_GRAVE_ACCENT = 96, CHAR_LEFT_CURLY_BRACKET = 123, CHAR_VERTICAL_LINE = 124, CHAR_RIGHT_CURLY_BRACKET = 125, ESCAPE_SEQUENCES, DEPRECATED_BOOLEANS_SYNTAX, DEPRECATED_BASE60_SYNTAX, QUOTING_TYPE_SINGLE = 1, QUOTING_TYPE_DOUBLE = 2, STYLE_PLAIN = 1, STYLE_SINGLE = 2, STYLE_LITERAL = 3, STYLE_FOLDED = 4, STYLE_DOUBLE = 5, dump_1, dumper, load, loadAll, dump, safeLoad, safeLoadAll, safeDump;
5941
+ \r`, binary, _hasOwnProperty$3, _toString$2, omap, _toString$1, pairs, _hasOwnProperty$2, set, _default, _hasOwnProperty$1, CONTEXT_FLOW_IN = 1, CONTEXT_FLOW_OUT = 2, CONTEXT_BLOCK_IN = 3, CONTEXT_BLOCK_OUT = 4, CHOMPING_CLIP = 1, CHOMPING_STRIP = 2, CHOMPING_KEEP = 3, PATTERN_NON_PRINTABLE, PATTERN_NON_ASCII_LINE_BREAKS, PATTERN_FLOW_INDICATORS, PATTERN_TAG_HANDLE, PATTERN_TAG_URI, simpleEscapeCheck, simpleEscapeMap, i, directiveHandlers, loadAll_1, load_1, loader, _toString, _hasOwnProperty, CHAR_BOM = 65279, CHAR_TAB = 9, CHAR_LINE_FEED = 10, CHAR_CARRIAGE_RETURN = 13, CHAR_SPACE = 32, CHAR_EXCLAMATION = 33, CHAR_DOUBLE_QUOTE = 34, CHAR_SHARP = 35, CHAR_PERCENT = 37, CHAR_AMPERSAND = 38, CHAR_SINGLE_QUOTE = 39, CHAR_ASTERISK = 42, CHAR_COMMA = 44, CHAR_MINUS = 45, CHAR_COLON = 58, CHAR_EQUALS = 61, CHAR_GREATER_THAN = 62, CHAR_QUESTION = 63, CHAR_COMMERCIAL_AT = 64, CHAR_LEFT_SQUARE_BRACKET = 91, CHAR_RIGHT_SQUARE_BRACKET = 93, CHAR_GRAVE_ACCENT = 96, CHAR_LEFT_CURLY_BRACKET = 123, CHAR_VERTICAL_LINE = 124, CHAR_RIGHT_CURLY_BRACKET = 125, ESCAPE_SEQUENCES, DEPRECATED_BOOLEANS_SYNTAX, DEPRECATED_BASE60_SYNTAX, QUOTING_TYPE_SINGLE = 1, QUOTING_TYPE_DOUBLE = 2, STYLE_PLAIN = 1, STYLE_SINGLE = 2, STYLE_LITERAL = 3, STYLE_FOLDED = 4, STYLE_DOUBLE = 5, dump_1, dumper, Type, Schema, FAILSAFE_SCHEMA, JSON_SCHEMA, CORE_SCHEMA, DEFAULT_SCHEMA, load, loadAll, dump, YAMLException, types, safeLoad, safeLoadAll, safeDump, jsYaml;
5924
5942
  var init_js_yaml = __esm(() => {
5925
5943
  /*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT */
5926
5944
  isNothing_1 = isNothing;
@@ -6273,12 +6291,50 @@ var init_js_yaml = __esm(() => {
6273
6291
  dumper = {
6274
6292
  dump: dump_1
6275
6293
  };
6294
+ Type = type;
6295
+ Schema = schema;
6296
+ FAILSAFE_SCHEMA = failsafe;
6297
+ JSON_SCHEMA = json;
6298
+ CORE_SCHEMA = core;
6299
+ DEFAULT_SCHEMA = _default;
6276
6300
  load = loader.load;
6277
6301
  loadAll = loader.loadAll;
6278
6302
  dump = dumper.dump;
6303
+ YAMLException = exception;
6304
+ types = {
6305
+ binary,
6306
+ float,
6307
+ map,
6308
+ null: _null,
6309
+ pairs,
6310
+ set,
6311
+ timestamp,
6312
+ bool,
6313
+ int,
6314
+ merge,
6315
+ omap,
6316
+ seq,
6317
+ str: str2
6318
+ };
6279
6319
  safeLoad = renamed("safeLoad", "load");
6280
6320
  safeLoadAll = renamed("safeLoadAll", "loadAll");
6281
6321
  safeDump = renamed("safeDump", "dump");
6322
+ jsYaml = {
6323
+ Type,
6324
+ Schema,
6325
+ FAILSAFE_SCHEMA,
6326
+ JSON_SCHEMA,
6327
+ CORE_SCHEMA,
6328
+ DEFAULT_SCHEMA,
6329
+ load,
6330
+ loadAll,
6331
+ dump,
6332
+ YAMLException,
6333
+ types,
6334
+ safeLoad,
6335
+ safeLoadAll,
6336
+ safeDump
6337
+ };
6282
6338
  });
6283
6339
 
6284
6340
  // node_modules/json5/lib/unicode.js
@@ -7396,20 +7452,35 @@ var require_lib = __commonJS((exports, module) => {
7396
7452
  });
7397
7453
 
7398
7454
  // src/constants.ts
7455
+ var exports_constants = {};
7456
+ __export(exports_constants, {
7457
+ getHomeDir: () => getHomeDir,
7458
+ generateWorkspaceRules: () => generateWorkspaceRules,
7459
+ WORKSPACE_CONFIG_PATH: () => WORKSPACE_CONFIG_PATH,
7460
+ WORKSPACE_CONFIG_FILE: () => WORKSPACE_CONFIG_FILE,
7461
+ SYNC_STATE_FILE: () => SYNC_STATE_FILE,
7462
+ CONFIG_DIR: () => CONFIG_DIR,
7463
+ AGENT_FILES: () => AGENT_FILES
7464
+ });
7399
7465
  function getHomeDir() {
7400
7466
  return process.env.HOME || process.env.USERPROFILE || "~";
7401
7467
  }
7402
- var CONFIG_DIR = ".allagents", SYNC_STATE_FILE = "sync-state.json", WORKSPACE_CONFIG_FILE = "workspace.yaml", WORKSPACE_CONFIG_PATH, AGENT_FILES, WORKSPACE_RULES = `
7468
+ function generateWorkspaceRules(repositories) {
7469
+ const repoList = repositories.map((r) => `- ${r.path}${r.description ? ` - ${r.description}` : ""}`).join(`
7470
+ `);
7471
+ return `
7403
7472
  <!-- WORKSPACE-RULES:START -->
7404
- ## Rule: Workspace Discovery
7405
- TRIGGER: Any task
7406
- ACTION: Read \`.allagents/workspace.yaml\` to get repository paths and project domains
7473
+ ## Workspace Repositories
7474
+ The following repositories are part of this workspace:
7475
+ ${repoList}
7407
7476
 
7408
- ## Rule: Correct Repository Paths
7477
+ ## Rule: Use Repository Paths
7409
7478
  TRIGGER: File operations (read, search, modify)
7410
- ACTION: Use repository paths from \`.allagents/workspace.yaml\`, not assumptions
7479
+ ACTION: Use the repository paths listed above, not assumptions
7411
7480
  <!-- WORKSPACE-RULES:END -->
7412
7481
  `;
7482
+ }
7483
+ var CONFIG_DIR = ".allagents", SYNC_STATE_FILE = "sync-state.json", WORKSPACE_CONFIG_FILE = "workspace.yaml", WORKSPACE_CONFIG_PATH, AGENT_FILES;
7413
7484
  var init_constants = __esm(() => {
7414
7485
  WORKSPACE_CONFIG_PATH = `${CONFIG_DIR}/${WORKSPACE_CONFIG_FILE}`;
7415
7486
  AGENT_FILES = ["AGENTS.md", "CLAUDE.md"];
@@ -10121,9 +10192,9 @@ var init_types = __esm(() => {
10121
10192
  return this._def.options;
10122
10193
  }
10123
10194
  };
10124
- ZodUnion.create = (types, params) => {
10195
+ ZodUnion.create = (types2, params) => {
10125
10196
  return new ZodUnion({
10126
- options: types,
10197
+ options: types2,
10127
10198
  typeName: ZodFirstPartyTypeKind.ZodUnion,
10128
10199
  ...processCreateParams(params)
10129
10200
  });
@@ -15910,6 +15981,78 @@ async function getPluginName(pluginPath) {
15910
15981
  }
15911
15982
  return basename(pluginPath);
15912
15983
  }
15984
+ async function updatePlugin(pluginSpec, deps) {
15985
+ const fetchFn = deps.fetchFn ?? fetchPlugin;
15986
+ const parsed = deps.parsePluginSpec(pluginSpec);
15987
+ if (!parsed) {
15988
+ if (pluginSpec.startsWith("https://github.com/")) {
15989
+ const result = await fetchFn(pluginSpec);
15990
+ return {
15991
+ plugin: pluginSpec,
15992
+ success: result.success,
15993
+ action: result.action === "updated" ? "updated" : result.success ? "skipped" : "failed",
15994
+ ...result.error && { error: result.error }
15995
+ };
15996
+ }
15997
+ return {
15998
+ plugin: pluginSpec,
15999
+ success: true,
16000
+ action: "skipped"
16001
+ };
16002
+ }
16003
+ const marketplace = await deps.getMarketplace(parsed.marketplaceName);
16004
+ if (!marketplace) {
16005
+ return {
16006
+ plugin: pluginSpec,
16007
+ success: false,
16008
+ action: "failed",
16009
+ error: `Marketplace not found: ${parsed.marketplaceName}`
16010
+ };
16011
+ }
16012
+ const manifestResult = await deps.parseMarketplaceManifest(marketplace.path);
16013
+ if (!manifestResult.success || !manifestResult.data) {
16014
+ const updateResults = await deps.updateMarketplace(parsed.marketplaceName);
16015
+ const result = updateResults[0];
16016
+ return {
16017
+ plugin: pluginSpec,
16018
+ success: result?.success ?? false,
16019
+ action: result?.success ? "updated" : "failed",
16020
+ ...result?.error && { error: result.error }
16021
+ };
16022
+ }
16023
+ const pluginEntry = manifestResult.data.plugins.find((p) => p.name === parsed.plugin);
16024
+ if (!pluginEntry) {
16025
+ const updateResults = await deps.updateMarketplace(parsed.marketplaceName);
16026
+ const result = updateResults[0];
16027
+ return {
16028
+ plugin: pluginSpec,
16029
+ success: result?.success ?? false,
16030
+ action: result?.success ? "updated" : "failed",
16031
+ ...result?.error && { error: result.error }
16032
+ };
16033
+ }
16034
+ if (typeof pluginEntry.source === "string") {
16035
+ const updateResults = await deps.updateMarketplace(parsed.marketplaceName);
16036
+ const result = updateResults[0];
16037
+ return {
16038
+ plugin: pluginSpec,
16039
+ success: result?.success ?? false,
16040
+ action: result?.success ? "updated" : "failed",
16041
+ ...result?.error && { error: result.error }
16042
+ };
16043
+ }
16044
+ const url = pluginEntry.source.url;
16045
+ if (marketplace.source.type === "github") {
16046
+ await deps.updateMarketplace(parsed.marketplaceName);
16047
+ }
16048
+ const fetchResult = await fetchFn(url);
16049
+ return {
16050
+ plugin: pluginSpec,
16051
+ success: fetchResult.success,
16052
+ action: fetchResult.action === "updated" ? "updated" : fetchResult.success ? "skipped" : "failed",
16053
+ ...fetchResult.error && { error: fetchResult.error }
16054
+ };
16055
+ }
15913
16056
  var inflight;
15914
16057
  var init_plugin = __esm(() => {
15915
16058
  init_plugin_path();
@@ -21242,7 +21385,8 @@ var init_client_mapping = __esm(() => {
21242
21385
  },
21243
21386
  copilot: {
21244
21387
  skillsPath: ".agents/skills/",
21245
- agentFile: "AGENTS.md"
21388
+ agentFile: "AGENTS.md",
21389
+ githubPath: ".github/"
21246
21390
  },
21247
21391
  codex: {
21248
21392
  skillsPath: ".agents/skills/",
@@ -21271,8 +21415,9 @@ var init_client_mapping = __esm(() => {
21271
21415
  agentFile: "AGENTS.md"
21272
21416
  },
21273
21417
  vscode: {
21274
- skillsPath: "",
21275
- agentFile: ""
21418
+ skillsPath: ".agents/skills/",
21419
+ agentFile: "AGENTS.md",
21420
+ githubPath: ".github/"
21276
21421
  }
21277
21422
  };
21278
21423
  USER_CLIENT_MAPPINGS = {
@@ -21286,7 +21431,8 @@ var init_client_mapping = __esm(() => {
21286
21431
  },
21287
21432
  copilot: {
21288
21433
  skillsPath: ".agents/skills/",
21289
- agentFile: "AGENTS.md"
21434
+ agentFile: "AGENTS.md",
21435
+ githubPath: ".copilot/"
21290
21436
  },
21291
21437
  codex: {
21292
21438
  skillsPath: ".agents/skills/",
@@ -21315,8 +21461,9 @@ var init_client_mapping = __esm(() => {
21315
21461
  agentFile: "AGENTS.md"
21316
21462
  },
21317
21463
  vscode: {
21318
- skillsPath: "",
21319
- agentFile: ""
21464
+ skillsPath: ".agents/skills/",
21465
+ agentFile: "AGENTS.md",
21466
+ githubPath: ".copilot/"
21320
21467
  }
21321
21468
  };
21322
21469
  });
@@ -21646,7 +21793,7 @@ var require_common4 = __commonJS((exports, module) => {
21646
21793
 
21647
21794
  // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/exception.js
21648
21795
  var require_exception = __commonJS((exports, module) => {
21649
- function YAMLException(reason, mark) {
21796
+ function YAMLException2(reason, mark) {
21650
21797
  Error.call(this);
21651
21798
  this.name = "YAMLException";
21652
21799
  this.reason = reason;
@@ -21658,9 +21805,9 @@ var require_exception = __commonJS((exports, module) => {
21658
21805
  this.stack = new Error().stack || "";
21659
21806
  }
21660
21807
  }
21661
- YAMLException.prototype = Object.create(Error.prototype);
21662
- YAMLException.prototype.constructor = YAMLException;
21663
- YAMLException.prototype.toString = function toString(compact) {
21808
+ YAMLException2.prototype = Object.create(Error.prototype);
21809
+ YAMLException2.prototype.constructor = YAMLException2;
21810
+ YAMLException2.prototype.toString = function toString(compact) {
21664
21811
  var result = this.name + ": ";
21665
21812
  result += this.reason || "(unknown reason)";
21666
21813
  if (!compact && this.mark) {
@@ -21668,7 +21815,7 @@ var require_exception = __commonJS((exports, module) => {
21668
21815
  }
21669
21816
  return result;
21670
21817
  };
21671
- module.exports = YAMLException;
21818
+ module.exports = YAMLException2;
21672
21819
  });
21673
21820
 
21674
21821
  // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/mark.js
@@ -21733,7 +21880,7 @@ var require_mark = __commonJS((exports, module) => {
21733
21880
 
21734
21881
  // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type.js
21735
21882
  var require_type2 = __commonJS((exports, module) => {
21736
- var YAMLException = require_exception();
21883
+ var YAMLException2 = require_exception();
21737
21884
  var TYPE_CONSTRUCTOR_OPTIONS2 = [
21738
21885
  "kind",
21739
21886
  "resolve",
@@ -21760,11 +21907,11 @@ var require_type2 = __commonJS((exports, module) => {
21760
21907
  }
21761
21908
  return result;
21762
21909
  }
21763
- function Type(tag, options2) {
21910
+ function Type2(tag, options2) {
21764
21911
  options2 = options2 || {};
21765
21912
  Object.keys(options2).forEach(function(name) {
21766
21913
  if (TYPE_CONSTRUCTOR_OPTIONS2.indexOf(name) === -1) {
21767
- throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
21914
+ throw new YAMLException2('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
21768
21915
  }
21769
21916
  });
21770
21917
  this.tag = tag;
@@ -21781,17 +21928,17 @@ var require_type2 = __commonJS((exports, module) => {
21781
21928
  this.defaultStyle = options2["defaultStyle"] || null;
21782
21929
  this.styleAliases = compileStyleAliases2(options2["styleAliases"] || null);
21783
21930
  if (YAML_NODE_KINDS2.indexOf(this.kind) === -1) {
21784
- throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
21931
+ throw new YAMLException2('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
21785
21932
  }
21786
21933
  }
21787
- module.exports = Type;
21934
+ module.exports = Type2;
21788
21935
  });
21789
21936
 
21790
21937
  // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema.js
21791
21938
  var require_schema = __commonJS((exports, module) => {
21792
21939
  var common2 = require_common4();
21793
- var YAMLException = require_exception();
21794
- var Type = require_type2();
21940
+ var YAMLException2 = require_exception();
21941
+ var Type2 = require_type2();
21795
21942
  function compileList2(schema2, name, result) {
21796
21943
  var exclude = [];
21797
21944
  schema2.include.forEach(function(includedSchema) {
@@ -21824,58 +21971,58 @@ var require_schema = __commonJS((exports, module) => {
21824
21971
  }
21825
21972
  return result;
21826
21973
  }
21827
- function Schema(definition) {
21974
+ function Schema2(definition) {
21828
21975
  this.include = definition.include || [];
21829
21976
  this.implicit = definition.implicit || [];
21830
21977
  this.explicit = definition.explicit || [];
21831
21978
  this.implicit.forEach(function(type2) {
21832
21979
  if (type2.loadKind && type2.loadKind !== "scalar") {
21833
- throw new YAMLException("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
21980
+ throw new YAMLException2("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");
21834
21981
  }
21835
21982
  });
21836
21983
  this.compiledImplicit = compileList2(this, "implicit", []);
21837
21984
  this.compiledExplicit = compileList2(this, "explicit", []);
21838
21985
  this.compiledTypeMap = compileMap2(this.compiledImplicit, this.compiledExplicit);
21839
21986
  }
21840
- Schema.DEFAULT = null;
21841
- Schema.create = function createSchema() {
21842
- var schemas, types2;
21987
+ Schema2.DEFAULT = null;
21988
+ Schema2.create = function createSchema() {
21989
+ var schemas, types3;
21843
21990
  switch (arguments.length) {
21844
21991
  case 1:
21845
- schemas = Schema.DEFAULT;
21846
- types2 = arguments[0];
21992
+ schemas = Schema2.DEFAULT;
21993
+ types3 = arguments[0];
21847
21994
  break;
21848
21995
  case 2:
21849
21996
  schemas = arguments[0];
21850
- types2 = arguments[1];
21997
+ types3 = arguments[1];
21851
21998
  break;
21852
21999
  default:
21853
- throw new YAMLException("Wrong number of arguments for Schema.create function");
22000
+ throw new YAMLException2("Wrong number of arguments for Schema.create function");
21854
22001
  }
21855
22002
  schemas = common2.toArray(schemas);
21856
- types2 = common2.toArray(types2);
22003
+ types3 = common2.toArray(types3);
21857
22004
  if (!schemas.every(function(schema2) {
21858
- return schema2 instanceof Schema;
22005
+ return schema2 instanceof Schema2;
21859
22006
  })) {
21860
- throw new YAMLException("Specified list of super schemas (or a single Schema object) contains a non-Schema object.");
22007
+ throw new YAMLException2("Specified list of super schemas (or a single Schema object) contains a non-Schema object.");
21861
22008
  }
21862
- if (!types2.every(function(type2) {
21863
- return type2 instanceof Type;
22009
+ if (!types3.every(function(type2) {
22010
+ return type2 instanceof Type2;
21864
22011
  })) {
21865
- throw new YAMLException("Specified list of YAML types (or a single Type object) contains a non-Type object.");
22012
+ throw new YAMLException2("Specified list of YAML types (or a single Type object) contains a non-Type object.");
21866
22013
  }
21867
- return new Schema({
22014
+ return new Schema2({
21868
22015
  include: schemas,
21869
- explicit: types2
22016
+ explicit: types3
21870
22017
  });
21871
22018
  };
21872
- module.exports = Schema;
22019
+ module.exports = Schema2;
21873
22020
  });
21874
22021
 
21875
22022
  // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/str.js
21876
22023
  var require_str = __commonJS((exports, module) => {
21877
- var Type = require_type2();
21878
- module.exports = new Type("tag:yaml.org,2002:str", {
22024
+ var Type2 = require_type2();
22025
+ module.exports = new Type2("tag:yaml.org,2002:str", {
21879
22026
  kind: "scalar",
21880
22027
  construct: function(data) {
21881
22028
  return data !== null ? data : "";
@@ -21885,8 +22032,8 @@ var require_str = __commonJS((exports, module) => {
21885
22032
 
21886
22033
  // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/seq.js
21887
22034
  var require_seq = __commonJS((exports, module) => {
21888
- var Type = require_type2();
21889
- module.exports = new Type("tag:yaml.org,2002:seq", {
22035
+ var Type2 = require_type2();
22036
+ module.exports = new Type2("tag:yaml.org,2002:seq", {
21890
22037
  kind: "sequence",
21891
22038
  construct: function(data) {
21892
22039
  return data !== null ? data : [];
@@ -21896,8 +22043,8 @@ var require_seq = __commonJS((exports, module) => {
21896
22043
 
21897
22044
  // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/map.js
21898
22045
  var require_map = __commonJS((exports, module) => {
21899
- var Type = require_type2();
21900
- module.exports = new Type("tag:yaml.org,2002:map", {
22046
+ var Type2 = require_type2();
22047
+ module.exports = new Type2("tag:yaml.org,2002:map", {
21901
22048
  kind: "mapping",
21902
22049
  construct: function(data) {
21903
22050
  return data !== null ? data : {};
@@ -21907,8 +22054,8 @@ var require_map = __commonJS((exports, module) => {
21907
22054
 
21908
22055
  // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js
21909
22056
  var require_failsafe = __commonJS((exports, module) => {
21910
- var Schema = require_schema();
21911
- module.exports = new Schema({
22057
+ var Schema2 = require_schema();
22058
+ module.exports = new Schema2({
21912
22059
  explicit: [
21913
22060
  require_str(),
21914
22061
  require_seq(),
@@ -21919,7 +22066,7 @@ var require_failsafe = __commonJS((exports, module) => {
21919
22066
 
21920
22067
  // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/null.js
21921
22068
  var require_null = __commonJS((exports, module) => {
21922
- var Type = require_type2();
22069
+ var Type2 = require_type2();
21923
22070
  function resolveYamlNull2(data) {
21924
22071
  if (data === null)
21925
22072
  return true;
@@ -21932,7 +22079,7 @@ var require_null = __commonJS((exports, module) => {
21932
22079
  function isNull2(object) {
21933
22080
  return object === null;
21934
22081
  }
21935
- module.exports = new Type("tag:yaml.org,2002:null", {
22082
+ module.exports = new Type2("tag:yaml.org,2002:null", {
21936
22083
  kind: "scalar",
21937
22084
  resolve: resolveYamlNull2,
21938
22085
  construct: constructYamlNull2,
@@ -21957,7 +22104,7 @@ var require_null = __commonJS((exports, module) => {
21957
22104
 
21958
22105
  // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/bool.js
21959
22106
  var require_bool = __commonJS((exports, module) => {
21960
- var Type = require_type2();
22107
+ var Type2 = require_type2();
21961
22108
  function resolveYamlBoolean2(data) {
21962
22109
  if (data === null)
21963
22110
  return false;
@@ -21970,7 +22117,7 @@ var require_bool = __commonJS((exports, module) => {
21970
22117
  function isBoolean2(object) {
21971
22118
  return Object.prototype.toString.call(object) === "[object Boolean]";
21972
22119
  }
21973
- module.exports = new Type("tag:yaml.org,2002:bool", {
22120
+ module.exports = new Type2("tag:yaml.org,2002:bool", {
21974
22121
  kind: "scalar",
21975
22122
  resolve: resolveYamlBoolean2,
21976
22123
  construct: constructYamlBoolean2,
@@ -21993,7 +22140,7 @@ var require_bool = __commonJS((exports, module) => {
21993
22140
  // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/int.js
21994
22141
  var require_int = __commonJS((exports, module) => {
21995
22142
  var common2 = require_common4();
21996
- var Type = require_type2();
22143
+ var Type2 = require_type2();
21997
22144
  function isHexCode2(c) {
21998
22145
  return 48 <= c && c <= 57 || 65 <= c && c <= 70 || 97 <= c && c <= 102;
21999
22146
  }
@@ -22108,7 +22255,7 @@ var require_int = __commonJS((exports, module) => {
22108
22255
  function isInteger2(object) {
22109
22256
  return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 === 0 && !common2.isNegativeZero(object));
22110
22257
  }
22111
- module.exports = new Type("tag:yaml.org,2002:int", {
22258
+ module.exports = new Type2("tag:yaml.org,2002:int", {
22112
22259
  kind: "scalar",
22113
22260
  resolve: resolveYamlInteger2,
22114
22261
  construct: constructYamlInteger2,
@@ -22140,7 +22287,7 @@ var require_int = __commonJS((exports, module) => {
22140
22287
  // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/float.js
22141
22288
  var require_float = __commonJS((exports, module) => {
22142
22289
  var common2 = require_common4();
22143
- var Type = require_type2();
22290
+ var Type2 = require_type2();
22144
22291
  var YAML_FLOAT_PATTERN2 = new RegExp("^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?" + "|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?" + "|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*" + "|[-+]?\\.(?:inf|Inf|INF)" + "|\\.(?:nan|NaN|NAN))$");
22145
22292
  function resolveYamlFloat2(data) {
22146
22293
  if (data === null)
@@ -22215,7 +22362,7 @@ var require_float = __commonJS((exports, module) => {
22215
22362
  function isFloat2(object) {
22216
22363
  return Object.prototype.toString.call(object) === "[object Number]" && (object % 1 !== 0 || common2.isNegativeZero(object));
22217
22364
  }
22218
- module.exports = new Type("tag:yaml.org,2002:float", {
22365
+ module.exports = new Type2("tag:yaml.org,2002:float", {
22219
22366
  kind: "scalar",
22220
22367
  resolve: resolveYamlFloat2,
22221
22368
  construct: constructYamlFloat2,
@@ -22227,8 +22374,8 @@ var require_float = __commonJS((exports, module) => {
22227
22374
 
22228
22375
  // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/json.js
22229
22376
  var require_json = __commonJS((exports, module) => {
22230
- var Schema = require_schema();
22231
- module.exports = new Schema({
22377
+ var Schema2 = require_schema();
22378
+ module.exports = new Schema2({
22232
22379
  include: [
22233
22380
  require_failsafe()
22234
22381
  ],
@@ -22243,8 +22390,8 @@ var require_json = __commonJS((exports, module) => {
22243
22390
 
22244
22391
  // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/core.js
22245
22392
  var require_core = __commonJS((exports, module) => {
22246
- var Schema = require_schema();
22247
- module.exports = new Schema({
22393
+ var Schema2 = require_schema();
22394
+ module.exports = new Schema2({
22248
22395
  include: [
22249
22396
  require_json()
22250
22397
  ]
@@ -22253,7 +22400,7 @@ var require_core = __commonJS((exports, module) => {
22253
22400
 
22254
22401
  // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/timestamp.js
22255
22402
  var require_timestamp = __commonJS((exports, module) => {
22256
- var Type = require_type2();
22403
+ var Type2 = require_type2();
22257
22404
  var YAML_DATE_REGEXP2 = new RegExp("^([0-9][0-9][0-9][0-9])" + "-([0-9][0-9])" + "-([0-9][0-9])$");
22258
22405
  var YAML_TIMESTAMP_REGEXP2 = new RegExp("^([0-9][0-9][0-9][0-9])" + "-([0-9][0-9]?)" + "-([0-9][0-9]?)" + "(?:[Tt]|[ \\t]+)" + "([0-9][0-9]?)" + ":([0-9][0-9])" + ":([0-9][0-9])" + "(?:\\.([0-9]*))?" + "(?:[ \\t]*(Z|([-+])([0-9][0-9]?)" + "(?::([0-9][0-9]))?))?$");
22259
22406
  function resolveYamlTimestamp2(data) {
@@ -22303,7 +22450,7 @@ var require_timestamp = __commonJS((exports, module) => {
22303
22450
  function representYamlTimestamp2(object) {
22304
22451
  return object.toISOString();
22305
22452
  }
22306
- module.exports = new Type("tag:yaml.org,2002:timestamp", {
22453
+ module.exports = new Type2("tag:yaml.org,2002:timestamp", {
22307
22454
  kind: "scalar",
22308
22455
  resolve: resolveYamlTimestamp2,
22309
22456
  construct: constructYamlTimestamp2,
@@ -22314,11 +22461,11 @@ var require_timestamp = __commonJS((exports, module) => {
22314
22461
 
22315
22462
  // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/merge.js
22316
22463
  var require_merge = __commonJS((exports, module) => {
22317
- var Type = require_type2();
22464
+ var Type2 = require_type2();
22318
22465
  function resolveYamlMerge2(data) {
22319
22466
  return data === "<<" || data === null;
22320
22467
  }
22321
- module.exports = new Type("tag:yaml.org,2002:merge", {
22468
+ module.exports = new Type2("tag:yaml.org,2002:merge", {
22322
22469
  kind: "scalar",
22323
22470
  resolve: resolveYamlMerge2
22324
22471
  });
@@ -22332,7 +22479,7 @@ var require_binary2 = __commonJS((exports, module) => {
22332
22479
  NodeBuffer = _require("buffer").Buffer;
22333
22480
  } catch (__) {}
22334
22481
  var _require;
22335
- var Type = require_type2();
22482
+ var Type2 = require_type2();
22336
22483
  var BASE64_MAP2 = `ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=
22337
22484
  \r`;
22338
22485
  function resolveYamlBinary2(data) {
@@ -22408,7 +22555,7 @@ var require_binary2 = __commonJS((exports, module) => {
22408
22555
  function isBinary2(object) {
22409
22556
  return NodeBuffer && NodeBuffer.isBuffer(object);
22410
22557
  }
22411
- module.exports = new Type("tag:yaml.org,2002:binary", {
22558
+ module.exports = new Type2("tag:yaml.org,2002:binary", {
22412
22559
  kind: "scalar",
22413
22560
  resolve: resolveYamlBinary2,
22414
22561
  construct: constructYamlBinary2,
@@ -22419,7 +22566,7 @@ var require_binary2 = __commonJS((exports, module) => {
22419
22566
 
22420
22567
  // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/omap.js
22421
22568
  var require_omap = __commonJS((exports, module) => {
22422
- var Type = require_type2();
22569
+ var Type2 = require_type2();
22423
22570
  var _hasOwnProperty2 = Object.prototype.hasOwnProperty;
22424
22571
  var _toString2 = Object.prototype.toString;
22425
22572
  function resolveYamlOmap2(data) {
@@ -22451,7 +22598,7 @@ var require_omap = __commonJS((exports, module) => {
22451
22598
  function constructYamlOmap2(data) {
22452
22599
  return data !== null ? data : [];
22453
22600
  }
22454
- module.exports = new Type("tag:yaml.org,2002:omap", {
22601
+ module.exports = new Type2("tag:yaml.org,2002:omap", {
22455
22602
  kind: "sequence",
22456
22603
  resolve: resolveYamlOmap2,
22457
22604
  construct: constructYamlOmap2
@@ -22460,7 +22607,7 @@ var require_omap = __commonJS((exports, module) => {
22460
22607
 
22461
22608
  // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/pairs.js
22462
22609
  var require_pairs = __commonJS((exports, module) => {
22463
- var Type = require_type2();
22610
+ var Type2 = require_type2();
22464
22611
  var _toString2 = Object.prototype.toString;
22465
22612
  function resolveYamlPairs2(data) {
22466
22613
  if (data === null)
@@ -22490,7 +22637,7 @@ var require_pairs = __commonJS((exports, module) => {
22490
22637
  }
22491
22638
  return result;
22492
22639
  }
22493
- module.exports = new Type("tag:yaml.org,2002:pairs", {
22640
+ module.exports = new Type2("tag:yaml.org,2002:pairs", {
22494
22641
  kind: "sequence",
22495
22642
  resolve: resolveYamlPairs2,
22496
22643
  construct: constructYamlPairs2
@@ -22499,7 +22646,7 @@ var require_pairs = __commonJS((exports, module) => {
22499
22646
 
22500
22647
  // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/set.js
22501
22648
  var require_set = __commonJS((exports, module) => {
22502
- var Type = require_type2();
22649
+ var Type2 = require_type2();
22503
22650
  var _hasOwnProperty2 = Object.prototype.hasOwnProperty;
22504
22651
  function resolveYamlSet2(data) {
22505
22652
  if (data === null)
@@ -22516,7 +22663,7 @@ var require_set = __commonJS((exports, module) => {
22516
22663
  function constructYamlSet2(data) {
22517
22664
  return data !== null ? data : {};
22518
22665
  }
22519
- module.exports = new Type("tag:yaml.org,2002:set", {
22666
+ module.exports = new Type2("tag:yaml.org,2002:set", {
22520
22667
  kind: "mapping",
22521
22668
  resolve: resolveYamlSet2,
22522
22669
  construct: constructYamlSet2
@@ -22525,8 +22672,8 @@ var require_set = __commonJS((exports, module) => {
22525
22672
 
22526
22673
  // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js
22527
22674
  var require_default_safe = __commonJS((exports, module) => {
22528
- var Schema = require_schema();
22529
- module.exports = new Schema({
22675
+ var Schema2 = require_schema();
22676
+ module.exports = new Schema2({
22530
22677
  include: [
22531
22678
  require_core()
22532
22679
  ],
@@ -22545,7 +22692,7 @@ var require_default_safe = __commonJS((exports, module) => {
22545
22692
 
22546
22693
  // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js
22547
22694
  var require_undefined = __commonJS((exports, module) => {
22548
- var Type = require_type2();
22695
+ var Type2 = require_type2();
22549
22696
  function resolveJavascriptUndefined() {
22550
22697
  return true;
22551
22698
  }
@@ -22558,7 +22705,7 @@ var require_undefined = __commonJS((exports, module) => {
22558
22705
  function isUndefined(object) {
22559
22706
  return typeof object === "undefined";
22560
22707
  }
22561
- module.exports = new Type("tag:yaml.org,2002:js/undefined", {
22708
+ module.exports = new Type2("tag:yaml.org,2002:js/undefined", {
22562
22709
  kind: "scalar",
22563
22710
  resolve: resolveJavascriptUndefined,
22564
22711
  construct: constructJavascriptUndefined,
@@ -22569,7 +22716,7 @@ var require_undefined = __commonJS((exports, module) => {
22569
22716
 
22570
22717
  // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js
22571
22718
  var require_regexp = __commonJS((exports, module) => {
22572
- var Type = require_type2();
22719
+ var Type2 = require_type2();
22573
22720
  function resolveJavascriptRegExp(data) {
22574
22721
  if (data === null)
22575
22722
  return false;
@@ -22608,7 +22755,7 @@ var require_regexp = __commonJS((exports, module) => {
22608
22755
  function isRegExp(object) {
22609
22756
  return Object.prototype.toString.call(object) === "[object RegExp]";
22610
22757
  }
22611
- module.exports = new Type("tag:yaml.org,2002:js/regexp", {
22758
+ module.exports = new Type2("tag:yaml.org,2002:js/regexp", {
22612
22759
  kind: "scalar",
22613
22760
  resolve: resolveJavascriptRegExp,
22614
22761
  construct: constructJavascriptRegExp,
@@ -22628,7 +22775,7 @@ var require_function = __commonJS((exports, module) => {
22628
22775
  esprima = window.esprima;
22629
22776
  }
22630
22777
  var _require;
22631
- var Type = require_type2();
22778
+ var Type2 = require_type2();
22632
22779
  function resolveJavascriptFunction(data) {
22633
22780
  if (data === null)
22634
22781
  return false;
@@ -22662,7 +22809,7 @@ var require_function = __commonJS((exports, module) => {
22662
22809
  function isFunction(object) {
22663
22810
  return Object.prototype.toString.call(object) === "[object Function]";
22664
22811
  }
22665
- module.exports = new Type("tag:yaml.org,2002:js/function", {
22812
+ module.exports = new Type2("tag:yaml.org,2002:js/function", {
22666
22813
  kind: "scalar",
22667
22814
  resolve: resolveJavascriptFunction,
22668
22815
  construct: constructJavascriptFunction,
@@ -22673,8 +22820,8 @@ var require_function = __commonJS((exports, module) => {
22673
22820
 
22674
22821
  // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/schema/default_full.js
22675
22822
  var require_default_full = __commonJS((exports, module) => {
22676
- var Schema = require_schema();
22677
- module.exports = Schema.DEFAULT = new Schema({
22823
+ var Schema2 = require_schema();
22824
+ module.exports = Schema2.DEFAULT = new Schema2({
22678
22825
  include: [
22679
22826
  require_default_safe()
22680
22827
  ],
@@ -22689,7 +22836,7 @@ var require_default_full = __commonJS((exports, module) => {
22689
22836
  // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/loader.js
22690
22837
  var require_loader = __commonJS((exports, module) => {
22691
22838
  var common2 = require_common4();
22692
- var YAMLException = require_exception();
22839
+ var YAMLException2 = require_exception();
22693
22840
  var Mark = require_mark();
22694
22841
  var DEFAULT_SAFE_SCHEMA = require_default_safe();
22695
22842
  var DEFAULT_FULL_SCHEMA = require_default_full();
@@ -22797,7 +22944,7 @@ var require_loader = __commonJS((exports, module) => {
22797
22944
  this.documents = [];
22798
22945
  }
22799
22946
  function generateError2(state, message) {
22800
- return new YAMLException(message, new Mark(state.filename, state.input, state.position, state.line, state.position - state.lineStart));
22947
+ return new YAMLException2(message, new Mark(state.filename, state.input, state.position, state.line, state.position - state.lineStart));
22801
22948
  }
22802
22949
  function throwError2(state, message) {
22803
22950
  throw generateError2(state, message);
@@ -23792,7 +23939,7 @@ var require_loader = __commonJS((exports, module) => {
23792
23939
  } else if (documents.length === 1) {
23793
23940
  return documents[0];
23794
23941
  }
23795
- throw new YAMLException("expected a single document in the stream, but found more");
23942
+ throw new YAMLException2("expected a single document in the stream, but found more");
23796
23943
  }
23797
23944
  function safeLoadAll2(input, iterator, options2) {
23798
23945
  if (typeof iterator === "object" && iterator !== null && typeof options2 === "undefined") {
@@ -23813,7 +23960,7 @@ var require_loader = __commonJS((exports, module) => {
23813
23960
  // node_modules/gray-matter/node_modules/js-yaml/lib/js-yaml/dumper.js
23814
23961
  var require_dumper = __commonJS((exports, module) => {
23815
23962
  var common2 = require_common4();
23816
- var YAMLException = require_exception();
23963
+ var YAMLException2 = require_exception();
23817
23964
  var DEFAULT_FULL_SCHEMA = require_default_full();
23818
23965
  var DEFAULT_SAFE_SCHEMA = require_default_safe();
23819
23966
  var _toString2 = Object.prototype.toString;
@@ -23909,7 +24056,7 @@ var require_dumper = __commonJS((exports, module) => {
23909
24056
  handle = "U";
23910
24057
  length = 8;
23911
24058
  } else {
23912
- throw new YAMLException("code point within a string may not be greater than 0xFFFFFFFF");
24059
+ throw new YAMLException2("code point within a string may not be greater than 0xFFFFFFFF");
23913
24060
  }
23914
24061
  return "\\" + handle + common2.repeat("0", length - string.length) + string;
23915
24062
  }
@@ -24057,7 +24204,7 @@ var require_dumper = __commonJS((exports, module) => {
24057
24204
  case STYLE_DOUBLE2:
24058
24205
  return '"' + escapeString2(string, lineWidth) + '"';
24059
24206
  default:
24060
- throw new YAMLException("impossible error: invalid scalar style");
24207
+ throw new YAMLException2("impossible error: invalid scalar style");
24061
24208
  }
24062
24209
  }();
24063
24210
  }
@@ -24206,7 +24353,7 @@ var require_dumper = __commonJS((exports, module) => {
24206
24353
  } else if (typeof state.sortKeys === "function") {
24207
24354
  objectKeyList.sort(state.sortKeys);
24208
24355
  } else if (state.sortKeys) {
24209
- throw new YAMLException("sortKeys must be a boolean or a function");
24356
+ throw new YAMLException2("sortKeys must be a boolean or a function");
24210
24357
  }
24211
24358
  for (index = 0, length = objectKeyList.length;index < length; index += 1) {
24212
24359
  pairBuffer = "";
@@ -24258,7 +24405,7 @@ var require_dumper = __commonJS((exports, module) => {
24258
24405
  } else if (_hasOwnProperty2.call(type2.represent, style)) {
24259
24406
  _result = type2.represent[style](object, style);
24260
24407
  } else {
24261
- throw new YAMLException("!<" + type2.tag + '> tag resolver accepts not "' + style + '" style');
24408
+ throw new YAMLException2("!<" + type2.tag + '> tag resolver accepts not "' + style + '" style');
24262
24409
  }
24263
24410
  state.dump = _result;
24264
24411
  }
@@ -24323,7 +24470,7 @@ var require_dumper = __commonJS((exports, module) => {
24323
24470
  } else {
24324
24471
  if (state.skipInvalid)
24325
24472
  return false;
24326
- throw new YAMLException("unacceptable kind of an object to dump " + type2);
24473
+ throw new YAMLException2("unacceptable kind of an object to dump " + type2);
24327
24474
  }
24328
24475
  if (state.tag !== null && state.tag !== "?") {
24329
24476
  state.dump = "!<" + state.tag + "> " + state.dump;
@@ -24927,12 +25074,86 @@ async function createSymlink(target, linkPath) {
24927
25074
  }
24928
25075
  var init_symlink = () => {};
24929
25076
 
25077
+ // src/utils/link-adjuster.ts
25078
+ import { dirname as dirname3, join as join6, normalize as normalize3, isAbsolute as isAbsolute2 } from "node:path/posix";
25079
+ function isUrlOrAbsolute(path) {
25080
+ return path.startsWith("http://") || path.startsWith("https://") || path.startsWith("mailto:") || isAbsolute2(path);
25081
+ }
25082
+ function adjustRelativePath(relativePath, sourceFileRelPath, options2) {
25083
+ if (isUrlOrAbsolute(relativePath)) {
25084
+ return relativePath;
25085
+ }
25086
+ if (!relativePath.startsWith("../")) {
25087
+ return relativePath;
25088
+ }
25089
+ const normalized = normalize3(relativePath);
25090
+ const sourceDir = dirname3(sourceFileRelPath);
25091
+ const sourceDepth = sourceDir === "." ? 0 : sourceDir.split("/").filter(Boolean).length;
25092
+ const upSegments = normalized.split("/").filter((s) => s === "..").length;
25093
+ const exitsGithub = upSegments > sourceDepth;
25094
+ if (!exitsGithub) {
25095
+ return relativePath;
25096
+ }
25097
+ const levelsAboveGithub = upSegments - (sourceDepth + 1);
25098
+ const pathParts = normalized.split("/");
25099
+ const afterUpParts = pathParts.slice(upSegments);
25100
+ const targetPath = afterUpParts.join("/");
25101
+ if (levelsAboveGithub > 0) {
25102
+ return relativePath;
25103
+ }
25104
+ for (const mapping of PATH_MAPPINGS) {
25105
+ if (targetPath.startsWith(mapping.pattern)) {
25106
+ const transformedTarget = mapping.transform(targetPath, options2);
25107
+ const upToRoot = "../".repeat(sourceDepth + 1);
25108
+ return upToRoot + transformedTarget;
25109
+ }
25110
+ }
25111
+ return relativePath;
25112
+ }
25113
+ function adjustLinksInContent(content, sourceFileRelPath, options2) {
25114
+ let result = content;
25115
+ result = result.replace(LINK_PATTERNS.fileReference, (_match, path) => {
25116
+ const adjustedPath = adjustRelativePath(path, sourceFileRelPath, options2);
25117
+ return `#file:${adjustedPath}`;
25118
+ });
25119
+ result = result.replace(LINK_PATTERNS.markdownLink, (match, text, path) => {
25120
+ if (path.startsWith("#")) {
25121
+ return match;
25122
+ }
25123
+ const adjustedPath = adjustRelativePath(path, sourceFileRelPath, options2);
25124
+ return `[${text}](${adjustedPath})`;
25125
+ });
25126
+ return result;
25127
+ }
25128
+ var PATH_MAPPINGS, LINK_PATTERNS;
25129
+ var init_link_adjuster = __esm(() => {
25130
+ PATH_MAPPINGS = [
25131
+ {
25132
+ pattern: "skills/",
25133
+ transform: (matchedPath, options2) => {
25134
+ const skillsPrefix = "skills/";
25135
+ const afterSkills = matchedPath.substring(skillsPrefix.length);
25136
+ const parts = afterSkills.split("/");
25137
+ const skillFolderName = parts[0] ?? "";
25138
+ const restOfPath = parts.slice(1).join("/");
25139
+ const resolvedName = options2.skillNameMap?.get(skillFolderName) ?? skillFolderName;
25140
+ const newPath = join6(options2.workspaceSkillsPath, resolvedName, restOfPath);
25141
+ return newPath;
25142
+ }
25143
+ }
25144
+ ];
25145
+ LINK_PATTERNS = {
25146
+ fileReference: /#file:([^\s\])"'`]+)/g,
25147
+ markdownLink: /\[([^\]]*)\]\(([^)]+)\)/g
25148
+ };
25149
+ });
25150
+
24930
25151
  // src/core/transform.ts
24931
25152
  import { readFile as readFile4, writeFile, mkdir as mkdir3, cp, readdir as readdir2 } from "node:fs/promises";
24932
25153
  import { existsSync as existsSync4 } from "node:fs";
24933
- import { join as join6, dirname as dirname3 } from "node:path";
24934
- async function ensureWorkspaceRules(filePath, rules) {
24935
- const rulesContent = rules ?? WORKSPACE_RULES;
25154
+ import { join as join7, dirname as dirname4, relative as relative2 } from "node:path";
25155
+ async function ensureWorkspaceRules(filePath, repositories) {
25156
+ const rulesContent = generateWorkspaceRules(repositories);
24936
25157
  const startMarker = "<!-- WORKSPACE-RULES:START -->";
24937
25158
  const endMarker = "<!-- WORKSPACE-RULES:END -->";
24938
25159
  if (!existsSync4(filePath)) {
@@ -24961,19 +25182,19 @@ async function copyCommands(pluginPath, workspacePath, client, options2 = {}) {
24961
25182
  if (!mapping.commandsPath) {
24962
25183
  return results;
24963
25184
  }
24964
- const sourceDir = join6(pluginPath, "commands");
25185
+ const sourceDir = join7(pluginPath, "commands");
24965
25186
  if (!existsSync4(sourceDir)) {
24966
25187
  return results;
24967
25188
  }
24968
- const destDir = join6(workspacePath, mapping.commandsPath);
25189
+ const destDir = join7(workspacePath, mapping.commandsPath);
24969
25190
  if (!dryRun) {
24970
25191
  await mkdir3(destDir, { recursive: true });
24971
25192
  }
24972
25193
  const files = await readdir2(sourceDir);
24973
25194
  const mdFiles = files.filter((f) => f.endsWith(".md"));
24974
25195
  const copyPromises = mdFiles.map(async (file) => {
24975
- const sourcePath = join6(sourceDir, file);
24976
- const destPath = join6(destDir, file);
25196
+ const sourcePath = join7(sourceDir, file);
25197
+ const destPath = join7(destDir, file);
24977
25198
  if (dryRun) {
24978
25199
  return { source: sourcePath, destination: destPath, action: "copied" };
24979
25200
  }
@@ -24999,11 +25220,11 @@ async function copySkills(pluginPath, workspacePath, client, options2 = {}) {
24999
25220
  if (!mapping.skillsPath) {
25000
25221
  return results;
25001
25222
  }
25002
- const sourceDir = join6(pluginPath, "skills");
25223
+ const sourceDir = join7(pluginPath, "skills");
25003
25224
  if (!existsSync4(sourceDir)) {
25004
25225
  return results;
25005
25226
  }
25006
- const destDir = join6(workspacePath, mapping.skillsPath);
25227
+ const destDir = join7(workspacePath, mapping.skillsPath);
25007
25228
  if (!dryRun) {
25008
25229
  await mkdir3(destDir, { recursive: true });
25009
25230
  }
@@ -25014,9 +25235,9 @@ async function copySkills(pluginPath, workspacePath, client, options2 = {}) {
25014
25235
  }
25015
25236
  const useSymlinks = syncMode === "symlink" && !isUniversalClient(client) && canonicalSkillsPath;
25016
25237
  const copyPromises = skillDirs.map(async (entry) => {
25017
- const skillSourcePath = join6(sourceDir, entry.name);
25238
+ const skillSourcePath = join7(sourceDir, entry.name);
25018
25239
  const resolvedName = skillNameMap?.get(entry.name) ?? entry.name;
25019
- const skillDestPath = join6(destDir, resolvedName);
25240
+ const skillDestPath = join7(destDir, resolvedName);
25020
25241
  const validation = await validateSkill(skillSourcePath);
25021
25242
  if (!validation.valid) {
25022
25243
  return {
@@ -25034,7 +25255,7 @@ async function copySkills(pluginPath, workspacePath, client, options2 = {}) {
25034
25255
  };
25035
25256
  }
25036
25257
  if (useSymlinks) {
25037
- const canonicalSkillPath = join6(workspacePath, canonicalSkillsPath, resolvedName);
25258
+ const canonicalSkillPath = join7(workspacePath, canonicalSkillsPath, resolvedName);
25038
25259
  const symlinkCreated = await createSymlink(canonicalSkillPath, skillDestPath);
25039
25260
  if (symlinkCreated) {
25040
25261
  return {
@@ -25063,7 +25284,7 @@ async function copySkills(pluginPath, workspacePath, client, options2 = {}) {
25063
25284
  return Promise.all(copyPromises);
25064
25285
  }
25065
25286
  async function collectPluginSkills(pluginPath, pluginSource, disabledSkills, pluginName) {
25066
- const skillsDir = join6(pluginPath, "skills");
25287
+ const skillsDir = join7(pluginPath, "skills");
25067
25288
  if (!existsSync4(skillsDir)) {
25068
25289
  return [];
25069
25290
  }
@@ -25072,7 +25293,7 @@ async function collectPluginSkills(pluginPath, pluginSource, disabledSkills, plu
25072
25293
  const filteredDirs = disabledSkills && pluginName ? skillDirs.filter((e) => !disabledSkills.has(`${pluginName}:${e.name}`)) : skillDirs;
25073
25294
  return filteredDirs.map((entry) => ({
25074
25295
  folderName: entry.name,
25075
- skillPath: join6(skillsDir, entry.name),
25296
+ skillPath: join7(skillsDir, entry.name),
25076
25297
  pluginPath,
25077
25298
  pluginSource
25078
25299
  }));
@@ -25084,11 +25305,11 @@ async function copyHooks(pluginPath, workspacePath, client, options2 = {}) {
25084
25305
  if (!mapping.hooksPath) {
25085
25306
  return results;
25086
25307
  }
25087
- const sourceDir = join6(pluginPath, "hooks");
25308
+ const sourceDir = join7(pluginPath, "hooks");
25088
25309
  if (!existsSync4(sourceDir)) {
25089
25310
  return results;
25090
25311
  }
25091
- const destDir = join6(workspacePath, mapping.hooksPath);
25312
+ const destDir = join7(workspacePath, mapping.hooksPath);
25092
25313
  if (dryRun) {
25093
25314
  results.push({ source: sourceDir, destination: destDir, action: "copied" });
25094
25315
  return results;
@@ -25114,19 +25335,19 @@ async function copyAgents(pluginPath, workspacePath, client, options2 = {}) {
25114
25335
  if (!mapping.agentsPath) {
25115
25336
  return results;
25116
25337
  }
25117
- const sourceDir = join6(pluginPath, "agents");
25338
+ const sourceDir = join7(pluginPath, "agents");
25118
25339
  if (!existsSync4(sourceDir)) {
25119
25340
  return results;
25120
25341
  }
25121
- const destDir = join6(workspacePath, mapping.agentsPath);
25342
+ const destDir = join7(workspacePath, mapping.agentsPath);
25122
25343
  if (!dryRun) {
25123
25344
  await mkdir3(destDir, { recursive: true });
25124
25345
  }
25125
25346
  const files = await readdir2(sourceDir);
25126
25347
  const mdFiles = files.filter((f) => f.endsWith(".md"));
25127
25348
  const copyPromises = mdFiles.map(async (file) => {
25128
- const sourcePath = join6(sourceDir, file);
25129
- const destPath = join6(destDir, file);
25349
+ const sourcePath = join7(sourceDir, file);
25350
+ const destPath = join7(destDir, file);
25130
25351
  if (dryRun) {
25131
25352
  return { source: sourcePath, destination: destPath, action: "copied" };
25132
25353
  }
@@ -25145,9 +25366,66 @@ async function copyAgents(pluginPath, workspacePath, client, options2 = {}) {
25145
25366
  });
25146
25367
  return Promise.all(copyPromises);
25147
25368
  }
25369
+ async function copyAndAdjustDirectory(sourceDir, destDir, sourceBase, skillsPath, skillNameMap) {
25370
+ await mkdir3(destDir, { recursive: true });
25371
+ const entries = await readdir2(sourceDir, { withFileTypes: true });
25372
+ for (const entry of entries) {
25373
+ const sourcePath = join7(sourceDir, entry.name);
25374
+ const destPath = join7(destDir, entry.name);
25375
+ if (entry.isDirectory()) {
25376
+ await copyAndAdjustDirectory(sourcePath, destPath, sourceBase, skillsPath, skillNameMap);
25377
+ } else {
25378
+ const relativePath = relative2(sourceBase, sourcePath).replaceAll("\\", "/");
25379
+ const isMarkdown = entry.name.endsWith(".md") || entry.name.endsWith(".markdown");
25380
+ if (isMarkdown) {
25381
+ let content = await readFile4(sourcePath, "utf-8");
25382
+ content = adjustLinksInContent(content, relativePath, {
25383
+ ...skillNameMap && { skillNameMap },
25384
+ workspaceSkillsPath: skillsPath
25385
+ });
25386
+ await writeFile(destPath, content, "utf-8");
25387
+ } else {
25388
+ await cp(sourcePath, destPath);
25389
+ }
25390
+ }
25391
+ }
25392
+ }
25393
+ async function copyGitHubContent(pluginPath, workspacePath, client, options2 = {}) {
25394
+ const { dryRun = false, skillNameMap } = options2;
25395
+ const mapping = getMapping(client, options2);
25396
+ const results = [];
25397
+ if (!mapping.githubPath) {
25398
+ return results;
25399
+ }
25400
+ const sourceDir = join7(pluginPath, ".github");
25401
+ if (!existsSync4(sourceDir)) {
25402
+ return results;
25403
+ }
25404
+ const destDir = join7(workspacePath, mapping.githubPath);
25405
+ if (dryRun) {
25406
+ results.push({ source: sourceDir, destination: destDir, action: "copied" });
25407
+ return results;
25408
+ }
25409
+ try {
25410
+ if (mapping.skillsPath) {
25411
+ await copyAndAdjustDirectory(sourceDir, destDir, sourceDir, mapping.skillsPath, skillNameMap);
25412
+ } else {
25413
+ await cp(sourceDir, destDir, { recursive: true });
25414
+ }
25415
+ results.push({ source: sourceDir, destination: destDir, action: "copied" });
25416
+ } catch (error) {
25417
+ results.push({
25418
+ source: sourceDir,
25419
+ destination: destDir,
25420
+ action: "failed",
25421
+ error: error instanceof Error ? error.message : "Unknown error"
25422
+ });
25423
+ }
25424
+ return results;
25425
+ }
25148
25426
  async function copyPluginToWorkspace(pluginPath, workspacePath, client, options2 = {}) {
25149
25427
  const { skillNameMap, syncMode, canonicalSkillsPath, ...baseOptions } = options2;
25150
- const [commandResults, skillResults, hookResults, agentResults] = await Promise.all([
25428
+ const [commandResults, skillResults, hookResults, agentResults, githubResults] = await Promise.all([
25151
25429
  copyCommands(pluginPath, workspacePath, client, baseOptions),
25152
25430
  copySkills(pluginPath, workspacePath, client, {
25153
25431
  ...baseOptions,
@@ -25156,9 +25434,13 @@ async function copyPluginToWorkspace(pluginPath, workspacePath, client, options2
25156
25434
  ...canonicalSkillsPath && { canonicalSkillsPath }
25157
25435
  }),
25158
25436
  copyHooks(pluginPath, workspacePath, client, baseOptions),
25159
- copyAgents(pluginPath, workspacePath, client, baseOptions)
25437
+ copyAgents(pluginPath, workspacePath, client, baseOptions),
25438
+ copyGitHubContent(pluginPath, workspacePath, client, {
25439
+ ...baseOptions,
25440
+ ...skillNameMap && { skillNameMap }
25441
+ })
25160
25442
  ]);
25161
- return [...commandResults, ...skillResults, ...hookResults, ...agentResults];
25443
+ return [...commandResults, ...skillResults, ...hookResults, ...agentResults, ...githubResults];
25162
25444
  }
25163
25445
  function isExplicitGitHubSource(source) {
25164
25446
  if (source.startsWith("https://github.com/") || source.startsWith("http://github.com/") || source.startsWith("github.com/") || source.startsWith("gh:")) {
@@ -25181,12 +25463,12 @@ function resolveFileSourcePath(source, defaultSourcePath, githubCache) {
25181
25463
  return { path: source };
25182
25464
  }
25183
25465
  if (source.startsWith("../")) {
25184
- return { path: join6(process.cwd(), source) };
25466
+ return { path: join7(process.cwd(), source) };
25185
25467
  }
25186
25468
  if (defaultSourcePath) {
25187
- return { path: join6(defaultSourcePath, source) };
25469
+ return { path: join7(defaultSourcePath, source) };
25188
25470
  }
25189
- return { path: join6(process.cwd(), source) };
25471
+ return { path: join7(process.cwd(), source) };
25190
25472
  }
25191
25473
  const parsed = parseFileSource(source);
25192
25474
  if (parsed.type === "github" && parsed.owner && parsed.repo && parsed.filePath) {
@@ -25198,7 +25480,7 @@ function resolveFileSourcePath(source, defaultSourcePath, githubCache) {
25198
25480
  error: `GitHub cache not found for ${cacheKey}. Ensure the repo is fetched.`
25199
25481
  };
25200
25482
  }
25201
- return { path: join6(cachePath, parsed.filePath) };
25483
+ return { path: join7(cachePath, parsed.filePath) };
25202
25484
  }
25203
25485
  if (parsed.type === "github") {
25204
25486
  return {
@@ -25209,7 +25491,7 @@ function resolveFileSourcePath(source, defaultSourcePath, githubCache) {
25209
25491
  return null;
25210
25492
  }
25211
25493
  async function copyWorkspaceFiles(sourcePath, workspacePath, files, options2 = {}) {
25212
- const { dryRun = false, githubCache, skipWorkspaceRules = false } = options2;
25494
+ const { dryRun = false, githubCache, repositories = [] } = options2;
25213
25495
  const results = [];
25214
25496
  const stringPatterns = [];
25215
25497
  const objectEntries = [];
@@ -25226,7 +25508,7 @@ async function copyWorkspaceFiles(sourcePath, workspacePath, files, options2 = {
25226
25508
  if (!dest) {
25227
25509
  results.push({
25228
25510
  source: "unknown",
25229
- destination: join6(workspacePath, "unknown"),
25511
+ destination: join7(workspacePath, "unknown"),
25230
25512
  action: "failed",
25231
25513
  error: "File entry must have at least source or dest specified"
25232
25514
  });
@@ -25241,7 +25523,7 @@ async function copyWorkspaceFiles(sourcePath, workspacePath, files, options2 = {
25241
25523
  if (!isGlobPattern(pattern) && !pattern.startsWith("!")) {
25242
25524
  results.push({
25243
25525
  source: pattern,
25244
- destination: join6(workspacePath, pattern),
25526
+ destination: join7(workspacePath, pattern),
25245
25527
  action: "failed",
25246
25528
  error: `Cannot resolve file '${pattern}' - no workspace.source configured and no explicit source provided`
25247
25529
  });
@@ -25250,7 +25532,7 @@ async function copyWorkspaceFiles(sourcePath, workspacePath, files, options2 = {
25250
25532
  } else {
25251
25533
  const resolvedFiles = await resolveGlobPatterns(sourcePath, stringPatterns);
25252
25534
  for (const resolved of resolvedFiles) {
25253
- const destPath = join6(workspacePath, resolved.relativePath);
25535
+ const destPath = join7(workspacePath, resolved.relativePath);
25254
25536
  if (!existsSync4(resolved.sourcePath)) {
25255
25537
  const wasLiteral = stringPatterns.some((p) => !isGlobPattern(p) && !p.startsWith("!") && p === resolved.relativePath);
25256
25538
  if (wasLiteral) {
@@ -25271,7 +25553,7 @@ async function copyWorkspaceFiles(sourcePath, workspacePath, files, options2 = {
25271
25553
  continue;
25272
25554
  }
25273
25555
  try {
25274
- await mkdir3(dirname3(destPath), { recursive: true });
25556
+ await mkdir3(dirname4(destPath), { recursive: true });
25275
25557
  const content = await readFile4(resolved.sourcePath, "utf-8");
25276
25558
  await writeFile(destPath, content, "utf-8");
25277
25559
  results.push({ source: resolved.sourcePath, destination: destPath, action: "copied" });
@@ -25290,7 +25572,7 @@ async function copyWorkspaceFiles(sourcePath, workspacePath, files, options2 = {
25290
25572
  }
25291
25573
  }
25292
25574
  for (const entry of objectEntries) {
25293
- const destPath = join6(workspacePath, entry.dest);
25575
+ const destPath = join7(workspacePath, entry.dest);
25294
25576
  let srcPath;
25295
25577
  if (entry.source) {
25296
25578
  const resolved = resolveFileSourcePath(entry.source, sourcePath, githubCache);
@@ -25323,7 +25605,7 @@ async function copyWorkspaceFiles(sourcePath, workspacePath, files, options2 = {
25323
25605
  });
25324
25606
  continue;
25325
25607
  }
25326
- srcPath = join6(sourcePath, entry.dest);
25608
+ srcPath = join7(sourcePath, entry.dest);
25327
25609
  }
25328
25610
  if (!existsSync4(srcPath)) {
25329
25611
  results.push({
@@ -25342,7 +25624,7 @@ async function copyWorkspaceFiles(sourcePath, workspacePath, files, options2 = {
25342
25624
  continue;
25343
25625
  }
25344
25626
  try {
25345
- await mkdir3(dirname3(destPath), { recursive: true });
25627
+ await mkdir3(dirname4(destPath), { recursive: true });
25346
25628
  const content = await readFile4(srcPath, "utf-8");
25347
25629
  await writeFile(destPath, content, "utf-8");
25348
25630
  results.push({ source: srcPath, destination: destPath, action: "copied" });
@@ -25358,11 +25640,11 @@ async function copyWorkspaceFiles(sourcePath, workspacePath, files, options2 = {
25358
25640
  });
25359
25641
  }
25360
25642
  }
25361
- if (!dryRun && !skipWorkspaceRules) {
25643
+ if (!dryRun && repositories.length > 0) {
25362
25644
  for (const agentFile of copiedAgentFiles) {
25363
- const targetPath = join6(workspacePath, agentFile);
25645
+ const targetPath = join7(workspacePath, agentFile);
25364
25646
  try {
25365
- await injectWorkspaceRules(targetPath);
25647
+ await ensureWorkspaceRules(targetPath, repositories);
25366
25648
  } catch (error) {
25367
25649
  results.push({
25368
25650
  source: "WORKSPACE-RULES",
@@ -25375,7 +25657,7 @@ async function copyWorkspaceFiles(sourcePath, workspacePath, files, options2 = {
25375
25657
  }
25376
25658
  return results;
25377
25659
  }
25378
- var AGENT_FILES2, injectWorkspaceRules;
25660
+ var AGENT_FILES2;
25379
25661
  var init_transform = __esm(() => {
25380
25662
  init_glob_patterns();
25381
25663
  init_client_mapping();
@@ -25383,8 +25665,8 @@ var init_transform = __esm(() => {
25383
25665
  init_constants();
25384
25666
  init_plugin_path();
25385
25667
  init_symlink();
25668
+ init_link_adjuster();
25386
25669
  AGENT_FILES2 = ["AGENTS.md", "CLAUDE.md"];
25387
- injectWorkspaceRules = ensureWorkspaceRules;
25388
25670
  });
25389
25671
 
25390
25672
  // src/models/marketplace-manifest.ts
@@ -25442,9 +25724,9 @@ var init_marketplace_manifest = __esm(() => {
25442
25724
  // src/utils/marketplace-manifest-parser.ts
25443
25725
  import { readFile as readFile5 } from "node:fs/promises";
25444
25726
  import { existsSync as existsSync5 } from "node:fs";
25445
- import { join as join7, resolve as resolve5 } from "node:path";
25727
+ import { join as join8, resolve as resolve5 } from "node:path";
25446
25728
  async function parseMarketplaceManifest(marketplacePath) {
25447
- const manifestPath = join7(marketplacePath, MANIFEST_PATH);
25729
+ const manifestPath = join8(marketplacePath, MANIFEST_PATH);
25448
25730
  if (!existsSync5(manifestPath)) {
25449
25731
  return {
25450
25732
  success: false,
@@ -25575,12 +25857,12 @@ __export(exports_user_workspace, {
25575
25857
  });
25576
25858
  import { existsSync as existsSync6 } from "node:fs";
25577
25859
  import { mkdir as mkdir4, readFile as readFile6, writeFile as writeFile2 } from "node:fs/promises";
25578
- import { join as join8, resolve as resolve6 } from "node:path";
25860
+ import { join as join9, resolve as resolve6 } from "node:path";
25579
25861
  function getUserWorkspaceConfigPath() {
25580
- return join8(getAllagentsDir(), WORKSPACE_CONFIG_FILE);
25862
+ return join9(getAllagentsDir(), WORKSPACE_CONFIG_FILE);
25581
25863
  }
25582
25864
  function isUserConfigPath(workspacePath) {
25583
- const projectConfigPath = join8(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
25865
+ const projectConfigPath = join9(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
25584
25866
  const userConfigPath = getUserWorkspaceConfigPath();
25585
25867
  return resolve6(projectConfigPath) === resolve6(userConfigPath);
25586
25868
  }
@@ -25865,7 +26147,7 @@ async function getInstalledUserPlugins() {
25865
26147
  return result;
25866
26148
  }
25867
26149
  async function getInstalledProjectPlugins(workspacePath) {
25868
- const configPath = join8(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
26150
+ const configPath = join9(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
25869
26151
  if (!existsSync6(configPath))
25870
26152
  return [];
25871
26153
  try {
@@ -25906,14 +26188,15 @@ var init_user_workspace = __esm(() => {
25906
26188
  "opencode",
25907
26189
  "gemini",
25908
26190
  "factory",
25909
- "ampcode"
26191
+ "ampcode",
26192
+ "vscode"
25910
26193
  ];
25911
26194
  });
25912
26195
 
25913
26196
  // src/core/marketplace.ts
25914
26197
  import { existsSync as existsSync7 } from "node:fs";
25915
26198
  import { mkdir as mkdir5, readFile as readFile7, readdir as readdir3, rm as rm3, writeFile as writeFile3 } from "node:fs/promises";
25916
- import { basename as basename2, join as join9, resolve as resolve7 } from "node:path";
26199
+ import { basename as basename2, join as join10, resolve as resolve7 } from "node:path";
25917
26200
  function parseLocation(location) {
25918
26201
  const [owner = "", repo = "", ...rest] = location.split("/");
25919
26202
  const branch = rest.length > 0 ? rest.join("/") : undefined;
@@ -25923,10 +26206,10 @@ function getAllagentsDir() {
25923
26206
  return resolve7(getHomeDir(), ".allagents");
25924
26207
  }
25925
26208
  function getMarketplacesDir() {
25926
- return join9(getAllagentsDir(), "plugins", "marketplaces");
26209
+ return join10(getAllagentsDir(), "plugins", "marketplaces");
25927
26210
  }
25928
26211
  function getRegistryPath() {
25929
- return join9(getAllagentsDir(), "marketplaces.json");
26212
+ return join10(getAllagentsDir(), "marketplaces.json");
25930
26213
  }
25931
26214
  async function loadRegistry() {
25932
26215
  const registryPath = getRegistryPath();
@@ -26038,7 +26321,7 @@ async function addMarketplace(source, customName, branch) {
26038
26321
  }
26039
26322
  let marketplacePath;
26040
26323
  if (parsed.type === "github") {
26041
- marketplacePath = join9(getMarketplacesDir(), name);
26324
+ marketplacePath = join10(getMarketplacesDir(), name);
26042
26325
  if (existsSync7(marketplacePath)) {} else {
26043
26326
  const parentDir = getMarketplacesDir();
26044
26327
  if (!existsSync7(parentDir)) {
@@ -26257,7 +26540,7 @@ async function listMarketplacePlugins(name) {
26257
26540
  if (manifestResult.plugins.length > 0) {
26258
26541
  return manifestResult;
26259
26542
  }
26260
- const pluginsDir = join9(marketplace.path, "plugins");
26543
+ const pluginsDir = join10(marketplace.path, "plugins");
26261
26544
  if (!existsSync7(pluginsDir)) {
26262
26545
  return { plugins: [], warnings: manifestResult.warnings };
26263
26546
  }
@@ -26265,7 +26548,7 @@ async function listMarketplacePlugins(name) {
26265
26548
  const entries = await readdir3(pluginsDir, { withFileTypes: true });
26266
26549
  const plugins = entries.filter((e) => e.isDirectory()).map((e) => ({
26267
26550
  name: e.name,
26268
- path: join9(pluginsDir, e.name)
26551
+ path: join10(pluginsDir, e.name)
26269
26552
  })).sort((a, b) => a.name.localeCompare(b.name));
26270
26553
  return { plugins, warnings: manifestResult.warnings };
26271
26554
  } catch {
@@ -26357,7 +26640,7 @@ async function resolvePluginSpec(spec, options2 = {}) {
26357
26640
  }
26358
26641
  }
26359
26642
  const subpath = options2.subpath ?? parsed.subpath ?? "plugins";
26360
- const pluginPath = join9(marketplacePath, subpath, parsed.plugin);
26643
+ const pluginPath = join10(marketplacePath, subpath, parsed.plugin);
26361
26644
  if (!existsSync7(pluginPath)) {
26362
26645
  return null;
26363
26646
  }
@@ -26433,7 +26716,7 @@ async function resolvePluginSpecWithAutoRegister(spec, options2 = {}) {
26433
26716
  return {
26434
26717
  success: false,
26435
26718
  error: `Plugin '${pluginName}' not found in marketplace '${marketplaceName}'
26436
- Expected at: ${join9(marketplace.path, expectedSubpath, pluginName)}`
26719
+ Expected at: ${join10(marketplace.path, expectedSubpath, pluginName)}`
26437
26720
  };
26438
26721
  }
26439
26722
  const shouldReturnRegisteredAs = didAutoRegister || marketplace.name !== marketplaceName;
@@ -26448,12 +26731,23 @@ async function autoRegisterMarketplace(source) {
26448
26731
  if (source.includes("/") && !source.includes("://")) {
26449
26732
  const parts = source.split("/");
26450
26733
  if (parts.length === 2 && parts[0] && parts[1]) {
26734
+ const cachedName = registeredSourceCache.get(source);
26735
+ if (cachedName) {
26736
+ return { success: true, name: cachedName };
26737
+ }
26738
+ const existing = await findMarketplace(parts[1], source);
26739
+ if (existing) {
26740
+ registeredSourceCache.set(source, existing.name);
26741
+ return { success: true, name: existing.name };
26742
+ }
26451
26743
  console.log(`Auto-registering GitHub marketplace: ${source}`);
26452
26744
  const result = await addMarketplace(source);
26453
26745
  if (!result.success) {
26454
26746
  return { success: false, error: result.error || "Unknown error" };
26455
26747
  }
26456
- return { success: true, name: result.marketplace?.name ?? parts[1] };
26748
+ const name = result.marketplace?.name ?? parts[1];
26749
+ registeredSourceCache.set(source, name);
26750
+ return { success: true, name };
26457
26751
  }
26458
26752
  }
26459
26753
  return {
@@ -26487,13 +26781,6 @@ async function ensureMarketplacesRegistered(plugins) {
26487
26781
  const sources = extractUniqueMarketplaceSources(plugins);
26488
26782
  const results = [];
26489
26783
  for (const source of sources) {
26490
- const parts = source.split("/");
26491
- const sourceLocation = source;
26492
- const existing = await findMarketplace(parts[1] ?? "", sourceLocation);
26493
- if (existing) {
26494
- results.push({ source, success: true, name: existing.name });
26495
- continue;
26496
- }
26497
26784
  const result = await autoRegisterMarketplace(source);
26498
26785
  results.push({ source, ...result });
26499
26786
  }
@@ -26511,6 +26798,7 @@ async function getMarketplaceVersion(marketplacePath) {
26511
26798
  return null;
26512
26799
  }
26513
26800
  }
26801
+ var registeredSourceCache;
26514
26802
  var init_marketplace = __esm(() => {
26515
26803
  init_esm();
26516
26804
  init_constants();
@@ -26518,16 +26806,17 @@ var init_marketplace = __esm(() => {
26518
26806
  init_plugin_path();
26519
26807
  init_git();
26520
26808
  init_plugin();
26809
+ registeredSourceCache = new Map;
26521
26810
  });
26522
26811
 
26523
26812
  // src/core/workspace-modify.ts
26524
26813
  import { existsSync as existsSync8 } from "node:fs";
26525
26814
  import { mkdir as mkdir6, readFile as readFile8, writeFile as writeFile4 } from "node:fs/promises";
26526
- import { join as join10 } from "node:path";
26815
+ import { join as join11 } from "node:path";
26527
26816
  async function setClients(clients, workspacePath = process.cwd()) {
26528
26817
  try {
26529
26818
  await ensureWorkspace(workspacePath);
26530
- const configPath = join10(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
26819
+ const configPath = join11(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
26531
26820
  const content = await readFile8(configPath, "utf-8");
26532
26821
  const config = load(content);
26533
26822
  config.clients = clients;
@@ -26541,8 +26830,8 @@ async function setClients(clients, workspacePath = process.cwd()) {
26541
26830
  }
26542
26831
  }
26543
26832
  async function ensureWorkspace(workspacePath) {
26544
- const configDir = join10(workspacePath, CONFIG_DIR);
26545
- const configPath = join10(configDir, WORKSPACE_CONFIG_FILE);
26833
+ const configDir = join11(workspacePath, CONFIG_DIR);
26834
+ const configPath = join11(configDir, WORKSPACE_CONFIG_FILE);
26546
26835
  if (existsSync8(configPath))
26547
26836
  return;
26548
26837
  const defaultConfig = {
@@ -26554,7 +26843,7 @@ async function ensureWorkspace(workspacePath) {
26554
26843
  await writeFile4(configPath, dump(defaultConfig, { lineWidth: -1 }), "utf-8");
26555
26844
  }
26556
26845
  async function addPlugin(plugin, workspacePath = process.cwd()) {
26557
- const configPath = join10(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
26846
+ const configPath = join11(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
26558
26847
  await ensureWorkspace(workspacePath);
26559
26848
  if (isPluginSpec(plugin)) {
26560
26849
  const resolved = await resolvePluginSpecWithAutoRegister(plugin);
@@ -26582,7 +26871,7 @@ async function addPlugin(plugin, workspacePath = process.cwd()) {
26582
26871
  };
26583
26872
  }
26584
26873
  } else {
26585
- const fullPath = join10(workspacePath, plugin);
26874
+ const fullPath = join11(workspacePath, plugin);
26586
26875
  if (!existsSync8(fullPath) && !existsSync8(plugin)) {
26587
26876
  return {
26588
26877
  success: false,
@@ -26618,7 +26907,7 @@ async function addPluginToConfig(plugin, configPath, autoRegistered) {
26618
26907
  }
26619
26908
  }
26620
26909
  async function hasPlugin(plugin, workspacePath = process.cwd()) {
26621
- const configPath = join10(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
26910
+ const configPath = join11(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
26622
26911
  if (!existsSync8(configPath))
26623
26912
  return false;
26624
26913
  try {
@@ -26635,7 +26924,7 @@ async function hasPlugin(plugin, workspacePath = process.cwd()) {
26635
26924
  }
26636
26925
  }
26637
26926
  async function removePlugin(plugin, workspacePath = process.cwd()) {
26638
- const configPath = join10(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
26927
+ const configPath = join11(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
26639
26928
  if (!existsSync8(configPath)) {
26640
26929
  return {
26641
26930
  success: false,
@@ -26692,7 +26981,7 @@ function extractPluginName(pluginSource) {
26692
26981
  return last2.replace(/\.git$/, "");
26693
26982
  }
26694
26983
  async function addDisabledSkill(skillKey, workspacePath = process.cwd()) {
26695
- const configPath = join10(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
26984
+ const configPath = join11(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
26696
26985
  if (!existsSync8(configPath)) {
26697
26986
  return {
26698
26987
  success: false,
@@ -26720,7 +27009,7 @@ async function addDisabledSkill(skillKey, workspacePath = process.cwd()) {
26720
27009
  }
26721
27010
  }
26722
27011
  async function removeDisabledSkill(skillKey, workspacePath = process.cwd()) {
26723
- const configPath = join10(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
27012
+ const configPath = join11(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
26724
27013
  if (!existsSync8(configPath)) {
26725
27014
  return {
26726
27015
  success: false,
@@ -26767,7 +27056,7 @@ var init_workspace_modify = __esm(() => {
26767
27056
  // src/core/workspace-repo.ts
26768
27057
  import { readFile as readFile9, writeFile as writeFile5 } from "node:fs/promises";
26769
27058
  import { existsSync as existsSync9 } from "node:fs";
26770
- import { join as join11 } from "node:path";
27059
+ import { join as join12 } from "node:path";
26771
27060
  async function detectRemote(repoPath) {
26772
27061
  try {
26773
27062
  const env2 = { ...process.env };
@@ -26809,7 +27098,7 @@ function normalizePath(p) {
26809
27098
  }
26810
27099
  async function addRepository(path, options2 = {}, workspacePath = process.cwd()) {
26811
27100
  const normalizedPath = normalizePath(path);
26812
- const configPath = join11(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
27101
+ const configPath = join12(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
26813
27102
  await ensureWorkspace(workspacePath);
26814
27103
  try {
26815
27104
  const content = await readFile9(configPath, "utf-8");
@@ -26832,7 +27121,7 @@ async function addRepository(path, options2 = {}, workspacePath = process.cwd())
26832
27121
  }
26833
27122
  }
26834
27123
  async function removeRepository(path, workspacePath = process.cwd()) {
26835
- const configPath = join11(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
27124
+ const configPath = join12(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
26836
27125
  if (!existsSync9(configPath)) {
26837
27126
  return {
26838
27127
  success: false,
@@ -26856,7 +27145,7 @@ async function removeRepository(path, workspacePath = process.cwd()) {
26856
27145
  }
26857
27146
  }
26858
27147
  async function listRepositories(workspacePath = process.cwd()) {
26859
- const configPath = join11(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
27148
+ const configPath = join12(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
26860
27149
  if (!existsSync9(configPath))
26861
27150
  return [];
26862
27151
  try {
@@ -26868,7 +27157,7 @@ async function listRepositories(workspacePath = process.cwd()) {
26868
27157
  }
26869
27158
  }
26870
27159
  async function updateAgentFiles(workspacePath = process.cwd()) {
26871
- const configPath = join11(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
27160
+ const configPath = join12(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
26872
27161
  if (!existsSync9(configPath))
26873
27162
  return;
26874
27163
  const content = await readFile9(configPath, "utf-8");
@@ -26883,7 +27172,7 @@ async function updateAgentFiles(workspacePath = process.cwd()) {
26883
27172
  }
26884
27173
  agentFiles.add("AGENTS.md");
26885
27174
  for (const agentFile of agentFiles) {
26886
- await ensureWorkspaceRules(join11(workspacePath, agentFile));
27175
+ await ensureWorkspaceRules(join12(workspacePath, agentFile), config.repositories);
26887
27176
  }
26888
27177
  }
26889
27178
  var init_workspace_repo = __esm(() => {
@@ -27049,16 +27338,17 @@ var init_sync_state = __esm(() => {
27049
27338
  SyncStateSchema = exports_external.object({
27050
27339
  version: exports_external.literal(1),
27051
27340
  lastSync: exports_external.string(),
27052
- files: exports_external.record(ClientTypeSchema, exports_external.array(exports_external.string()))
27341
+ files: exports_external.record(ClientTypeSchema, exports_external.array(exports_external.string())),
27342
+ mcpServers: exports_external.record(exports_external.string(), exports_external.array(exports_external.string())).optional()
27053
27343
  });
27054
27344
  });
27055
27345
 
27056
27346
  // src/core/sync-state.ts
27057
27347
  import { readFile as readFile10, writeFile as writeFile6, mkdir as mkdir7 } from "node:fs/promises";
27058
27348
  import { existsSync as existsSync10 } from "node:fs";
27059
- import { join as join12, dirname as dirname4 } from "node:path";
27349
+ import { join as join13, dirname as dirname5 } from "node:path";
27060
27350
  function getSyncStatePath(workspacePath) {
27061
- return join12(workspacePath, CONFIG_DIR, SYNC_STATE_FILE);
27351
+ return join13(workspacePath, CONFIG_DIR, SYNC_STATE_FILE);
27062
27352
  }
27063
27353
  async function loadSyncState(workspacePath) {
27064
27354
  const statePath = getSyncStatePath(workspacePath);
@@ -27077,14 +27367,16 @@ async function loadSyncState(workspacePath) {
27077
27367
  return null;
27078
27368
  }
27079
27369
  }
27080
- async function saveSyncState(workspacePath, files) {
27370
+ async function saveSyncState(workspacePath, data) {
27081
27371
  const statePath = getSyncStatePath(workspacePath);
27372
+ const normalizedData = "files" in data ? data : { files: data };
27082
27373
  const state = {
27083
27374
  version: 1,
27084
27375
  lastSync: new Date().toISOString(),
27085
- files
27376
+ files: normalizedData.files,
27377
+ ...normalizedData.mcpServers && { mcpServers: normalizedData.mcpServers }
27086
27378
  };
27087
- await mkdir7(dirname4(statePath), { recursive: true });
27379
+ await mkdir7(dirname5(statePath), { recursive: true });
27088
27380
  await writeFile6(statePath, JSON.stringify(state, null, 2), "utf-8");
27089
27381
  }
27090
27382
  function getPreviouslySyncedFiles(state, client) {
@@ -27093,13 +27385,19 @@ function getPreviouslySyncedFiles(state, client) {
27093
27385
  }
27094
27386
  return state.files[client] ?? [];
27095
27387
  }
27388
+ function getPreviouslySyncedMcpServers(state, scope) {
27389
+ if (!state?.mcpServers) {
27390
+ return [];
27391
+ }
27392
+ return state.mcpServers[scope] ?? [];
27393
+ }
27096
27394
  var init_sync_state2 = __esm(() => {
27097
27395
  init_constants();
27098
27396
  init_sync_state();
27099
27397
  });
27100
27398
 
27101
27399
  // src/core/vscode-workspace.ts
27102
- import { resolve as resolve8, basename as basename3, isAbsolute as isAbsolute2 } from "node:path";
27400
+ import { resolve as resolve8, basename as basename3, isAbsolute as isAbsolute3 } from "node:path";
27103
27401
  function buildPathPlaceholderMap(repositories, workspacePath) {
27104
27402
  const map2 = new Map;
27105
27403
  for (const repo of repositories) {
@@ -27147,7 +27445,7 @@ function generateVscodeWorkspace(input) {
27147
27445
  if (resolvedTemplate && Array.isArray(resolvedTemplate.folders)) {
27148
27446
  for (const folder of resolvedTemplate.folders) {
27149
27447
  const rawPath = folder.path;
27150
- const normalizedPath = (typeof rawPath === "string" && !isAbsolute2(rawPath) ? resolve8(workspacePath, rawPath) : rawPath).replace(/\\/g, "/");
27448
+ const normalizedPath = (typeof rawPath === "string" && !isAbsolute3(rawPath) ? resolve8(workspacePath, rawPath) : rawPath).replace(/\\/g, "/");
27151
27449
  if (!seenPaths.has(normalizedPath)) {
27152
27450
  const entry = { path: normalizedPath };
27153
27451
  if (folder.name)
@@ -27189,10 +27487,190 @@ var init_vscode_workspace = __esm(() => {
27189
27487
  };
27190
27488
  });
27191
27489
 
27490
+ // src/core/vscode-mcp.ts
27491
+ import { existsSync as existsSync11, readFileSync, writeFileSync, mkdirSync } from "node:fs";
27492
+ import { join as join14, dirname as dirname6 } from "node:path";
27493
+ function deepEqual(a, b) {
27494
+ if (a === b)
27495
+ return true;
27496
+ if (typeof a !== typeof b)
27497
+ return false;
27498
+ if (a === null || b === null)
27499
+ return a === b;
27500
+ if (typeof a !== "object")
27501
+ return false;
27502
+ if (Array.isArray(a) !== Array.isArray(b))
27503
+ return false;
27504
+ if (Array.isArray(a) && Array.isArray(b)) {
27505
+ if (a.length !== b.length)
27506
+ return false;
27507
+ return a.every((val, i2) => deepEqual(val, b[i2]));
27508
+ }
27509
+ const aObj = a;
27510
+ const bObj = b;
27511
+ const aKeys = Object.keys(aObj);
27512
+ const bKeys = Object.keys(bObj);
27513
+ if (aKeys.length !== bKeys.length)
27514
+ return false;
27515
+ return aKeys.every((key) => (key in bObj) && deepEqual(aObj[key], bObj[key]));
27516
+ }
27517
+ function getVscodeMcpConfigPath() {
27518
+ const platform2 = process.platform;
27519
+ if (platform2 === "win32") {
27520
+ const appData = process.env.APPDATA;
27521
+ if (!appData) {
27522
+ throw new Error("APPDATA environment variable not set");
27523
+ }
27524
+ return join14(appData, "Code", "User", "mcp.json");
27525
+ }
27526
+ const home = getHomeDir();
27527
+ if (platform2 === "darwin") {
27528
+ return join14(home, "Library", "Application Support", "Code", "User", "mcp.json");
27529
+ }
27530
+ return join14(home, ".config", "Code", "User", "mcp.json");
27531
+ }
27532
+ function readPluginMcpConfig(pluginPath) {
27533
+ const mcpPath = join14(pluginPath, ".mcp.json");
27534
+ if (!existsSync11(mcpPath)) {
27535
+ return null;
27536
+ }
27537
+ try {
27538
+ const content = readFileSync(mcpPath, "utf-8");
27539
+ const parsed = import_json5.default.parse(content);
27540
+ if (parsed && typeof parsed === "object" && parsed.mcpServers && typeof parsed.mcpServers === "object") {
27541
+ return parsed.mcpServers;
27542
+ }
27543
+ return null;
27544
+ } catch {
27545
+ return null;
27546
+ }
27547
+ }
27548
+ function collectMcpServers(validatedPlugins) {
27549
+ const servers = new Map;
27550
+ const warnings = [];
27551
+ for (const plugin of validatedPlugins) {
27552
+ const mcpServers = readPluginMcpConfig(plugin.resolved);
27553
+ if (!mcpServers)
27554
+ continue;
27555
+ for (const [name, config] of Object.entries(mcpServers)) {
27556
+ if (servers.has(name)) {
27557
+ warnings.push(`MCP server '${name}' from ${plugin.plugin} conflicts with earlier plugin (skipped)`);
27558
+ } else {
27559
+ servers.set(name, config);
27560
+ }
27561
+ }
27562
+ }
27563
+ return { servers, warnings };
27564
+ }
27565
+ function syncVscodeMcpConfig(validatedPlugins, options2) {
27566
+ const dryRun = options2?.dryRun ?? false;
27567
+ const force = options2?.force ?? false;
27568
+ const configPath = options2?.configPath ?? getVscodeMcpConfigPath();
27569
+ const previouslyTracked = new Set(options2?.trackedServers ?? []);
27570
+ const hasTracking = options2?.trackedServers !== undefined;
27571
+ const { servers: pluginServers, warnings } = collectMcpServers(validatedPlugins);
27572
+ const result = {
27573
+ added: 0,
27574
+ skipped: 0,
27575
+ overwritten: 0,
27576
+ removed: 0,
27577
+ warnings: [...warnings],
27578
+ addedServers: [],
27579
+ skippedServers: [],
27580
+ overwrittenServers: [],
27581
+ removedServers: [],
27582
+ trackedServers: []
27583
+ };
27584
+ let existingConfig = {};
27585
+ if (existsSync11(configPath)) {
27586
+ try {
27587
+ const content = readFileSync(configPath, "utf-8");
27588
+ existingConfig = import_json5.default.parse(content);
27589
+ } catch {
27590
+ result.warnings.push(`Could not parse existing ${configPath}, starting fresh`);
27591
+ existingConfig = {};
27592
+ }
27593
+ }
27594
+ const existingServers = existingConfig.servers ?? {};
27595
+ for (const [name, config] of pluginServers) {
27596
+ if (name in existingServers) {
27597
+ if (!deepEqual(existingServers[name], config)) {
27598
+ if (hasTracking && previouslyTracked.has(name)) {
27599
+ existingServers[name] = config;
27600
+ result.overwritten++;
27601
+ result.overwrittenServers.push(name);
27602
+ result.trackedServers.push(name);
27603
+ } else if (force) {
27604
+ existingServers[name] = config;
27605
+ result.overwritten++;
27606
+ result.overwrittenServers.push(name);
27607
+ result.trackedServers.push(name);
27608
+ } else {
27609
+ result.skipped++;
27610
+ result.skippedServers.push(name);
27611
+ }
27612
+ } else if (hasTracking && previouslyTracked.has(name)) {
27613
+ result.trackedServers.push(name);
27614
+ }
27615
+ } else {
27616
+ existingServers[name] = config;
27617
+ result.added++;
27618
+ result.addedServers.push(name);
27619
+ result.trackedServers.push(name);
27620
+ }
27621
+ }
27622
+ if (hasTracking) {
27623
+ const currentServerNames = new Set(pluginServers.keys());
27624
+ for (const trackedName of previouslyTracked) {
27625
+ if (!currentServerNames.has(trackedName) && trackedName in existingServers) {
27626
+ delete existingServers[trackedName];
27627
+ result.removed++;
27628
+ result.removedServers.push(trackedName);
27629
+ }
27630
+ }
27631
+ }
27632
+ const hasChanges = result.added > 0 || result.overwritten > 0 || result.removed > 0;
27633
+ if (hasChanges && !dryRun) {
27634
+ existingConfig.servers = existingServers;
27635
+ const dir = dirname6(configPath);
27636
+ if (!existsSync11(dir)) {
27637
+ mkdirSync(dir, { recursive: true });
27638
+ }
27639
+ writeFileSync(configPath, `${JSON.stringify(existingConfig, null, 2)}
27640
+ `, "utf-8");
27641
+ result.configPath = configPath;
27642
+ }
27643
+ if (pluginServers.size === 0 && hasTracking && previouslyTracked.size > 0) {
27644
+ for (const trackedName of previouslyTracked) {
27645
+ if (trackedName in existingServers) {
27646
+ delete existingServers[trackedName];
27647
+ result.removed++;
27648
+ result.removedServers.push(trackedName);
27649
+ }
27650
+ }
27651
+ if (result.removed > 0 && !dryRun) {
27652
+ existingConfig.servers = existingServers;
27653
+ const dir = dirname6(configPath);
27654
+ if (!existsSync11(dir)) {
27655
+ mkdirSync(dir, { recursive: true });
27656
+ }
27657
+ writeFileSync(configPath, `${JSON.stringify(existingConfig, null, 2)}
27658
+ `, "utf-8");
27659
+ result.configPath = configPath;
27660
+ }
27661
+ }
27662
+ return result;
27663
+ }
27664
+ var import_json5;
27665
+ var init_vscode_mcp = __esm(() => {
27666
+ init_constants();
27667
+ import_json5 = __toESM(require_lib(), 1);
27668
+ });
27669
+
27192
27670
  // src/core/sync.ts
27193
- import { existsSync as existsSync11, readFileSync, writeFileSync, lstatSync } from "node:fs";
27671
+ import { existsSync as existsSync12, readFileSync as readFileSync2, writeFileSync as writeFileSync2, lstatSync } from "node:fs";
27194
27672
  import { rm as rm4, unlink as unlink2, rmdir, copyFile } from "node:fs/promises";
27195
- import { join as join13, resolve as resolve9, dirname as dirname5, relative as relative2 } from "node:path";
27673
+ import { join as join15, resolve as resolve9, dirname as dirname7, relative as relative3 } from "node:path";
27196
27674
  function deduplicateClientsByPath(clients, clientMappings = CLIENT_MAPPINGS) {
27197
27675
  const pathToClients = new Map;
27198
27676
  for (const client of clients) {
@@ -27216,6 +27694,7 @@ function deduplicateClientsByPath(clients, clientMappings = CLIENT_MAPPINGS) {
27216
27694
  function mergeSyncResults(a, b) {
27217
27695
  const warnings = [...a.warnings || [], ...b.warnings || []];
27218
27696
  const purgedPaths = [...a.purgedPaths || [], ...b.purgedPaths || []];
27697
+ const mcpResult = a.mcpResult ?? b.mcpResult;
27219
27698
  return {
27220
27699
  success: a.success && b.success,
27221
27700
  pluginResults: [...a.pluginResults, ...b.pluginResults],
@@ -27224,7 +27703,8 @@ function mergeSyncResults(a, b) {
27224
27703
  totalSkipped: a.totalSkipped + b.totalSkipped,
27225
27704
  totalGenerated: a.totalGenerated + b.totalGenerated,
27226
27705
  ...warnings.length > 0 && { warnings },
27227
- ...purgedPaths.length > 0 && { purgedPaths }
27706
+ ...purgedPaths.length > 0 && { purgedPaths },
27707
+ ...mcpResult && { mcpResult }
27228
27708
  };
27229
27709
  }
27230
27710
  async function selectivePurgeWorkspace(workspacePath, state, clients, options2) {
@@ -27238,8 +27718,8 @@ async function selectivePurgeWorkspace(workspacePath, state, clients, options2)
27238
27718
  const previousFiles = getPreviouslySyncedFiles(state, client);
27239
27719
  const purgedPaths = [];
27240
27720
  for (const filePath of previousFiles) {
27241
- const fullPath = join13(workspacePath, filePath);
27242
- if (!existsSync11(fullPath)) {
27721
+ const fullPath = join15(workspacePath, filePath);
27722
+ if (!existsSync12(fullPath)) {
27243
27723
  continue;
27244
27724
  }
27245
27725
  try {
@@ -27262,16 +27742,16 @@ async function selectivePurgeWorkspace(workspacePath, state, clients, options2)
27262
27742
  return result;
27263
27743
  }
27264
27744
  async function cleanupEmptyParents(workspacePath, filePath) {
27265
- let parentPath = dirname5(filePath);
27745
+ let parentPath = dirname7(filePath);
27266
27746
  while (parentPath && parentPath !== "." && parentPath !== "/") {
27267
- const fullParentPath = join13(workspacePath, parentPath);
27268
- if (!existsSync11(fullParentPath)) {
27269
- parentPath = dirname5(parentPath);
27747
+ const fullParentPath = join15(workspacePath, parentPath);
27748
+ if (!existsSync12(fullParentPath)) {
27749
+ parentPath = dirname7(parentPath);
27270
27750
  continue;
27271
27751
  }
27272
27752
  try {
27273
27753
  await rmdir(fullParentPath);
27274
- parentPath = dirname5(parentPath);
27754
+ parentPath = dirname7(parentPath);
27275
27755
  } catch {
27276
27756
  break;
27277
27757
  }
@@ -27350,8 +27830,8 @@ function validateFileSources(files, defaultSourcePath, githubCache) {
27350
27830
  errors2.push(`Cannot resolve file '${file}' - no workspace.source configured`);
27351
27831
  continue;
27352
27832
  }
27353
- const fullPath = join13(defaultSourcePath, file);
27354
- if (!existsSync11(fullPath)) {
27833
+ const fullPath = join15(defaultSourcePath, file);
27834
+ if (!existsSync12(fullPath)) {
27355
27835
  errors2.push(`File source not found: ${fullPath}`);
27356
27836
  }
27357
27837
  continue;
@@ -27369,8 +27849,8 @@ function validateFileSources(files, defaultSourcePath, githubCache) {
27369
27849
  errors2.push(`GitHub cache not found for ${cacheKey}`);
27370
27850
  continue;
27371
27851
  }
27372
- const fullPath = join13(cachePath, parsed.filePath);
27373
- if (!existsSync11(fullPath)) {
27852
+ const fullPath = join15(cachePath, parsed.filePath);
27853
+ if (!existsSync12(fullPath)) {
27374
27854
  errors2.push(`Path not found in repository: ${cacheKey}/${parsed.filePath}`);
27375
27855
  }
27376
27856
  } else {
@@ -27380,11 +27860,11 @@ function validateFileSources(files, defaultSourcePath, githubCache) {
27380
27860
  } else if (file.source.startsWith("../")) {
27381
27861
  fullPath = resolve9(file.source);
27382
27862
  } else if (defaultSourcePath) {
27383
- fullPath = join13(defaultSourcePath, file.source);
27863
+ fullPath = join15(defaultSourcePath, file.source);
27384
27864
  } else {
27385
27865
  fullPath = resolve9(file.source);
27386
27866
  }
27387
- if (!existsSync11(fullPath)) {
27867
+ if (!existsSync12(fullPath)) {
27388
27868
  errors2.push(`File source not found: ${fullPath}`);
27389
27869
  }
27390
27870
  }
@@ -27393,8 +27873,8 @@ function validateFileSources(files, defaultSourcePath, githubCache) {
27393
27873
  errors2.push(`Cannot resolve file '${file.dest}' - no workspace.source configured and no explicit source provided`);
27394
27874
  continue;
27395
27875
  }
27396
- const fullPath = join13(defaultSourcePath, file.dest ?? "");
27397
- if (!existsSync11(fullPath)) {
27876
+ const fullPath = join15(defaultSourcePath, file.dest ?? "");
27877
+ if (!existsSync12(fullPath)) {
27398
27878
  errors2.push(`File source not found: ${fullPath}`);
27399
27879
  }
27400
27880
  }
@@ -27411,7 +27891,7 @@ function collectSyncedPaths(copyResults, workspacePath, clients, clientMappings)
27411
27891
  if (copyResult.action !== "copied" && copyResult.action !== "generated") {
27412
27892
  continue;
27413
27893
  }
27414
- const relativePath = relative2(workspacePath, copyResult.destination).replace(/\\/g, "/");
27894
+ const relativePath = relative3(workspacePath, copyResult.destination).replace(/\\/g, "/");
27415
27895
  for (const client of clients) {
27416
27896
  const mapping = mappings[client];
27417
27897
  if (mapping.skillsPath && relativePath.startsWith(mapping.skillsPath)) {
@@ -27462,7 +27942,7 @@ async function validatePlugin(pluginSource, workspacePath, offline) {
27462
27942
  ...fetchResult.error && { error: fetchResult.error }
27463
27943
  };
27464
27944
  }
27465
- const resolvedPath2 = parsed?.subpath ? join13(fetchResult.cachePath, parsed.subpath) : fetchResult.cachePath;
27945
+ const resolvedPath2 = parsed?.subpath ? join15(fetchResult.cachePath, parsed.subpath) : fetchResult.cachePath;
27466
27946
  return {
27467
27947
  plugin: pluginSource,
27468
27948
  resolved: resolvedPath2,
@@ -27470,7 +27950,7 @@ async function validatePlugin(pluginSource, workspacePath, offline) {
27470
27950
  };
27471
27951
  }
27472
27952
  const resolvedPath = resolve9(workspacePath, pluginSource);
27473
- if (!existsSync11(resolvedPath)) {
27953
+ if (!existsSync12(resolvedPath)) {
27474
27954
  return {
27475
27955
  plugin: pluginSource,
27476
27956
  resolved: resolvedPath,
@@ -27587,12 +28067,12 @@ function buildPluginSkillNameMaps(allSkills) {
27587
28067
  return pluginMaps;
27588
28068
  }
27589
28069
  function generateVscodeWorkspaceFile(workspacePath, config) {
27590
- const configDir = join13(workspacePath, CONFIG_DIR);
27591
- const templatePath = join13(configDir, VSCODE_TEMPLATE_FILE);
28070
+ const configDir = join15(workspacePath, CONFIG_DIR);
28071
+ const templatePath = join15(configDir, VSCODE_TEMPLATE_FILE);
27592
28072
  let template;
27593
- if (existsSync11(templatePath)) {
28073
+ if (existsSync12(templatePath)) {
27594
28074
  try {
27595
- template = import_json5.default.parse(readFileSync(templatePath, "utf-8"));
28075
+ template = import_json52.default.parse(readFileSync2(templatePath, "utf-8"));
27596
28076
  } catch (error) {
27597
28077
  throw new Error(`Failed to parse ${templatePath}: ${error instanceof Error ? error.message : String(error)}`);
27598
28078
  }
@@ -27603,14 +28083,14 @@ function generateVscodeWorkspaceFile(workspacePath, config) {
27603
28083
  template
27604
28084
  });
27605
28085
  const outputPath = getWorkspaceOutputPath(workspacePath, config.vscode);
27606
- writeFileSync(outputPath, `${JSON.stringify(content, null, "\t")}
28086
+ writeFileSync2(outputPath, `${JSON.stringify(content, null, "\t")}
27607
28087
  `, "utf-8");
27608
28088
  }
27609
28089
  async function syncWorkspace(workspacePath = process.cwd(), options2 = {}) {
27610
- const { offline = false, dryRun = false, workspaceSourceBase } = options2;
27611
- const configDir = join13(workspacePath, CONFIG_DIR);
27612
- const configPath = join13(configDir, WORKSPACE_CONFIG_FILE);
27613
- if (!existsSync11(configPath)) {
28090
+ const { offline = false, dryRun = false, workspaceSourceBase, skipAgentFiles = false } = options2;
28091
+ const configDir = join15(workspacePath, CONFIG_DIR);
28092
+ const configPath = join15(configDir, WORKSPACE_CONFIG_FILE);
28093
+ if (!existsSync12(configPath)) {
27614
28094
  return {
27615
28095
  success: false,
27616
28096
  pluginResults: [],
@@ -27712,8 +28192,8 @@ ${failedValidations.map((v) => ` - ${v.plugin}: ${v.error}`).join(`
27712
28192
  const filesToCopy = [...config.workspace.files];
27713
28193
  if (hasRepositories && sourcePath) {
27714
28194
  for (const agentFile of AGENT_FILES) {
27715
- const agentPath = join13(sourcePath, agentFile);
27716
- if (existsSync11(agentPath) && !filesToCopy.includes(agentFile)) {
28195
+ const agentPath = join15(sourcePath, agentFile);
28196
+ if (existsSync12(agentPath) && !filesToCopy.includes(agentFile)) {
27717
28197
  filesToCopy.push(agentFile);
27718
28198
  }
27719
28199
  }
@@ -27751,17 +28231,17 @@ ${fileValidationErrors.map((e) => ` - ${e}`).join(`
27751
28231
  `)}`
27752
28232
  };
27753
28233
  }
27754
- workspaceFileResults = await copyWorkspaceFiles(sourcePath, workspacePath, filesToCopy, { dryRun, githubCache, skipWorkspaceRules: !hasRepositories });
28234
+ workspaceFileResults = await copyWorkspaceFiles(sourcePath, workspacePath, filesToCopy, { dryRun, githubCache, repositories: config.repositories });
27755
28235
  if (hasRepositories && !dryRun && clients.includes("claude") && sourcePath) {
27756
- const claudePath = join13(workspacePath, "CLAUDE.md");
27757
- const agentsPath = join13(workspacePath, "AGENTS.md");
27758
- const claudeExistsInSource = existsSync11(join13(sourcePath, "CLAUDE.md"));
27759
- if (!claudeExistsInSource && existsSync11(agentsPath) && !existsSync11(claudePath)) {
28236
+ const claudePath = join15(workspacePath, "CLAUDE.md");
28237
+ const agentsPath = join15(workspacePath, "AGENTS.md");
28238
+ const claudeExistsInSource = existsSync12(join15(sourcePath, "CLAUDE.md"));
28239
+ if (!claudeExistsInSource && existsSync12(agentsPath) && !existsSync12(claudePath)) {
27760
28240
  await copyFile(agentsPath, claudePath);
27761
28241
  }
27762
28242
  }
27763
28243
  }
27764
- if (!config.workspace && !dryRun) {
28244
+ if (!config.workspace && !dryRun && !skipAgentFiles) {
27765
28245
  await updateAgentFiles(workspacePath);
27766
28246
  }
27767
28247
  if (clients.includes("vscode") && !dryRun) {
@@ -27843,7 +28323,7 @@ async function syncUserWorkspace(options2 = {}) {
27843
28323
  };
27844
28324
  }
27845
28325
  const clients = config.clients;
27846
- const { offline = false, dryRun = false } = options2;
28326
+ const { offline = false, dryRun = false, force = false } = options2;
27847
28327
  await ensureMarketplacesRegistered(config.plugins);
27848
28328
  const validatedPlugins = await validateAllPlugins(config.plugins, homeDir, offline);
27849
28329
  const failedValidations = validatedPlugins.filter((v) => !v.success);
@@ -27897,10 +28377,21 @@ ${failedValidations.map((v) => ` - ${v.plugin}: ${v.error}`).join(`
27897
28377
  }
27898
28378
  }
27899
28379
  }
28380
+ let mcpResult;
28381
+ if (clients.includes("vscode")) {
28382
+ const trackedMcpServers = getPreviouslySyncedMcpServers(previousState, "vscode");
28383
+ mcpResult = syncVscodeMcpConfig(validPlugins, { dryRun, force, trackedServers: trackedMcpServers });
28384
+ if (mcpResult.warnings.length > 0) {
28385
+ warnings.push(...mcpResult.warnings);
28386
+ }
28387
+ }
27900
28388
  if (!dryRun) {
27901
28389
  const allCopyResults = pluginResults.flatMap((r) => r.copyResults);
27902
28390
  const syncedFiles = collectSyncedPaths(allCopyResults, homeDir, clients, USER_CLIENT_MAPPINGS);
27903
- await saveSyncState(homeDir, syncedFiles);
28391
+ await saveSyncState(homeDir, {
28392
+ files: syncedFiles,
28393
+ ...mcpResult && { mcpServers: { vscode: mcpResult.trackedServers } }
28394
+ });
27904
28395
  }
27905
28396
  return {
27906
28397
  success: totalFailed === 0,
@@ -27909,10 +28400,11 @@ ${failedValidations.map((v) => ` - ${v.plugin}: ${v.error}`).join(`
27909
28400
  totalFailed,
27910
28401
  totalSkipped,
27911
28402
  totalGenerated,
27912
- ...warnings.length > 0 && { warnings }
28403
+ ...warnings.length > 0 && { warnings },
28404
+ ...mcpResult && { mcpResult }
27913
28405
  };
27914
28406
  }
27915
- var import_json5, VSCODE_TEMPLATE_FILE = "template.code-workspace";
28407
+ var import_json52, VSCODE_TEMPLATE_FILE = "template.code-workspace";
27916
28408
  var init_sync = __esm(() => {
27917
28409
  init_constants();
27918
28410
  init_workspace_parser();
@@ -27926,16 +28418,17 @@ var init_sync = __esm(() => {
27926
28418
  init_sync_state2();
27927
28419
  init_user_workspace();
27928
28420
  init_vscode_workspace();
27929
- import_json5 = __toESM(require_lib(), 1);
28421
+ init_vscode_mcp();
28422
+ import_json52 = __toESM(require_lib(), 1);
27930
28423
  });
27931
28424
 
27932
28425
  // src/core/github-fetch.ts
27933
- import { existsSync as existsSync12, readFileSync as readFileSync2 } from "node:fs";
27934
- import { join as join14 } from "node:path";
28426
+ import { existsSync as existsSync13, readFileSync as readFileSync3 } from "node:fs";
28427
+ import { join as join16 } from "node:path";
27935
28428
  function readFileFromClone(tempDir, filePath) {
27936
- const fullPath = join14(tempDir, filePath);
27937
- if (existsSync12(fullPath)) {
27938
- return readFileSync2(fullPath, "utf-8");
28429
+ const fullPath = join16(tempDir, filePath);
28430
+ if (existsSync13(fullPath)) {
28431
+ return readFileSync3(fullPath, "utf-8");
27939
28432
  }
27940
28433
  return null;
27941
28434
  }
@@ -28028,21 +28521,21 @@ var init_github_fetch = __esm(() => {
28028
28521
 
28029
28522
  // src/core/workspace.ts
28030
28523
  import { mkdir as mkdir8, readFile as readFile11, writeFile as writeFile7, copyFile as copyFile2 } from "node:fs/promises";
28031
- import { existsSync as existsSync13 } from "node:fs";
28032
- import { join as join15, resolve as resolve10, dirname as dirname6, relative as relative3, sep as sep2, isAbsolute as isAbsolute3 } from "node:path";
28524
+ import { existsSync as existsSync14 } from "node:fs";
28525
+ import { join as join17, resolve as resolve10, dirname as dirname8, relative as relative4, sep as sep2, isAbsolute as isAbsolute4 } from "node:path";
28033
28526
  import { fileURLToPath } from "node:url";
28034
28527
  async function initWorkspace(targetPath = ".", options2 = {}) {
28035
28528
  const absoluteTarget = resolve10(targetPath);
28036
- const configDir = join15(absoluteTarget, CONFIG_DIR);
28037
- const configPath = join15(configDir, WORKSPACE_CONFIG_FILE);
28038
- if (existsSync13(configPath)) {
28529
+ const configDir = join17(absoluteTarget, CONFIG_DIR);
28530
+ const configPath = join17(configDir, WORKSPACE_CONFIG_FILE);
28531
+ if (existsSync14(configPath)) {
28039
28532
  throw new Error(`Workspace already exists: ${absoluteTarget}
28040
28533
  Found existing ${CONFIG_DIR}/${WORKSPACE_CONFIG_FILE}`);
28041
28534
  }
28042
28535
  const currentFilePath = fileURLToPath(import.meta.url);
28043
- const currentFileDir = dirname6(currentFilePath);
28536
+ const currentFileDir = dirname8(currentFilePath);
28044
28537
  const isProduction = currentFilePath.includes(`${sep2}dist${sep2}`);
28045
- const defaultTemplatePath = isProduction ? join15(currentFileDir, "templates", "default") : join15(currentFileDir, "..", "templates", "default");
28538
+ const defaultTemplatePath = isProduction ? join17(currentFileDir, "templates", "default") : join17(currentFileDir, "..", "templates", "default");
28046
28539
  let githubTempDir;
28047
28540
  try {
28048
28541
  await mkdir8(absoluteTarget, { recursive: true });
@@ -28064,7 +28557,7 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
28064
28557
  const workspace = parsed2?.workspace;
28065
28558
  if (workspace?.source) {
28066
28559
  const source = workspace.source;
28067
- if (!isGitHubUrl(source) && !isAbsolute3(source)) {
28560
+ if (!isGitHubUrl(source) && !isAbsolute4(source)) {
28068
28561
  const parsedUrl = parseGitHubUrl(options2.from);
28069
28562
  if (parsedUrl) {
28070
28563
  const basePath = parsedUrl.subpath || "";
@@ -28079,19 +28572,19 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
28079
28572
  console.log(`✓ Using workspace.yaml from: ${options2.from}`);
28080
28573
  } else {
28081
28574
  const fromPath = resolve10(options2.from);
28082
- if (!existsSync13(fromPath)) {
28575
+ if (!existsSync14(fromPath)) {
28083
28576
  throw new Error(`Template not found: ${fromPath}`);
28084
28577
  }
28085
28578
  const { stat: stat2 } = await import("node:fs/promises");
28086
28579
  const fromStat = await stat2(fromPath);
28087
28580
  let sourceYamlPath;
28088
28581
  if (fromStat.isDirectory()) {
28089
- const nestedPath = join15(fromPath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
28090
- const rootPath = join15(fromPath, WORKSPACE_CONFIG_FILE);
28091
- if (existsSync13(nestedPath)) {
28582
+ const nestedPath = join17(fromPath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
28583
+ const rootPath = join17(fromPath, WORKSPACE_CONFIG_FILE);
28584
+ if (existsSync14(nestedPath)) {
28092
28585
  sourceYamlPath = nestedPath;
28093
28586
  sourceDir = fromPath;
28094
- } else if (existsSync13(rootPath)) {
28587
+ } else if (existsSync14(rootPath)) {
28095
28588
  sourceYamlPath = rootPath;
28096
28589
  sourceDir = fromPath;
28097
28590
  } else {
@@ -28100,9 +28593,9 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
28100
28593
  }
28101
28594
  } else {
28102
28595
  sourceYamlPath = fromPath;
28103
- const parentDir = dirname6(fromPath);
28596
+ const parentDir = dirname8(fromPath);
28104
28597
  if (parentDir.endsWith(CONFIG_DIR)) {
28105
- sourceDir = dirname6(parentDir);
28598
+ sourceDir = dirname8(parentDir);
28106
28599
  } else {
28107
28600
  sourceDir = parentDir;
28108
28601
  }
@@ -28113,7 +28606,7 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
28113
28606
  const workspace = parsed2?.workspace;
28114
28607
  if (workspace?.source) {
28115
28608
  const source = workspace.source;
28116
- if (!isGitHubUrl(source) && !isAbsolute3(source)) {
28609
+ if (!isGitHubUrl(source) && !isAbsolute4(source)) {
28117
28610
  workspace.source = resolve10(sourceDir, source);
28118
28611
  workspaceYamlContent = dump(parsed2, { lineWidth: -1 });
28119
28612
  }
@@ -28122,8 +28615,8 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
28122
28615
  console.log(`✓ Using workspace.yaml from: ${sourceYamlPath}`);
28123
28616
  }
28124
28617
  } else {
28125
- const defaultYamlPath = join15(defaultTemplatePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
28126
- if (!existsSync13(defaultYamlPath)) {
28618
+ const defaultYamlPath = join17(defaultTemplatePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
28619
+ if (!existsSync14(defaultYamlPath)) {
28127
28620
  throw new Error(`Default template not found at: ${defaultTemplatePath}`);
28128
28621
  }
28129
28622
  workspaceYamlContent = await readFile11(defaultYamlPath, "utf-8");
@@ -28138,8 +28631,8 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
28138
28631
  const clients = parsed?.clients ?? [];
28139
28632
  const VSCODE_TEMPLATE_FILE2 = "template.code-workspace";
28140
28633
  if (clients.includes("vscode") && options2.from) {
28141
- const targetTemplatePath = join15(configDir, VSCODE_TEMPLATE_FILE2);
28142
- if (!existsSync13(targetTemplatePath)) {
28634
+ const targetTemplatePath = join17(configDir, VSCODE_TEMPLATE_FILE2);
28635
+ if (!existsSync14(targetTemplatePath)) {
28143
28636
  if (isGitHubUrl(options2.from) && githubTempDir) {
28144
28637
  const parsedUrl = parseGitHubUrl(options2.from);
28145
28638
  if (parsedUrl) {
@@ -28152,8 +28645,8 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
28152
28645
  }
28153
28646
  }
28154
28647
  } else if (sourceDir) {
28155
- const sourceTemplatePath = join15(sourceDir, CONFIG_DIR, VSCODE_TEMPLATE_FILE2);
28156
- if (existsSync13(sourceTemplatePath)) {
28648
+ const sourceTemplatePath = join17(sourceDir, CONFIG_DIR, VSCODE_TEMPLATE_FILE2);
28649
+ if (existsSync14(sourceTemplatePath)) {
28157
28650
  await copyFile2(sourceTemplatePath, targetTemplatePath);
28158
28651
  }
28159
28652
  }
@@ -28168,8 +28661,8 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
28168
28661
  if (parsedUrl) {
28169
28662
  const basePath = parsedUrl.subpath || "";
28170
28663
  for (const agentFile of AGENT_FILES) {
28171
- const targetFilePath = join15(absoluteTarget, agentFile);
28172
- if (existsSync13(targetFilePath)) {
28664
+ const targetFilePath = join17(absoluteTarget, agentFile);
28665
+ if (existsSync14(targetFilePath)) {
28173
28666
  copiedAgentFiles.push(agentFile);
28174
28667
  continue;
28175
28668
  }
@@ -28184,13 +28677,13 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
28184
28677
  } else {
28185
28678
  const effectiveSourceDir = sourceDir ?? defaultTemplatePath;
28186
28679
  for (const agentFile of AGENT_FILES) {
28187
- const targetFilePath = join15(absoluteTarget, agentFile);
28188
- if (existsSync13(targetFilePath)) {
28680
+ const targetFilePath = join17(absoluteTarget, agentFile);
28681
+ if (existsSync14(targetFilePath)) {
28189
28682
  copiedAgentFiles.push(agentFile);
28190
28683
  continue;
28191
28684
  }
28192
- const sourcePath = join15(effectiveSourceDir, agentFile);
28193
- if (existsSync13(sourcePath)) {
28685
+ const sourcePath = join17(effectiveSourceDir, agentFile);
28686
+ if (existsSync14(sourcePath)) {
28194
28687
  const content = await readFile11(sourcePath, "utf-8");
28195
28688
  await writeFile7(targetFilePath, content, "utf-8");
28196
28689
  copiedAgentFiles.push(agentFile);
@@ -28198,16 +28691,16 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
28198
28691
  }
28199
28692
  }
28200
28693
  if (copiedAgentFiles.length === 0) {
28201
- await ensureWorkspaceRules(join15(absoluteTarget, "AGENTS.md"));
28694
+ await ensureWorkspaceRules(join17(absoluteTarget, "AGENTS.md"), repositories);
28202
28695
  copiedAgentFiles.push("AGENTS.md");
28203
28696
  } else {
28204
28697
  for (const agentFile of copiedAgentFiles) {
28205
- await ensureWorkspaceRules(join15(absoluteTarget, agentFile));
28698
+ await ensureWorkspaceRules(join17(absoluteTarget, agentFile), repositories);
28206
28699
  }
28207
28700
  }
28208
28701
  if (clients.includes("claude") && !copiedAgentFiles.includes("CLAUDE.md") && copiedAgentFiles.includes("AGENTS.md")) {
28209
- const agentsPath = join15(absoluteTarget, "AGENTS.md");
28210
- const claudePath = join15(absoluteTarget, "CLAUDE.md");
28702
+ const agentsPath = join17(absoluteTarget, "AGENTS.md");
28703
+ const claudePath = join17(absoluteTarget, "CLAUDE.md");
28211
28704
  await copyFile2(agentsPath, claudePath);
28212
28705
  }
28213
28706
  }
@@ -28230,7 +28723,7 @@ Syncing plugins...`);
28230
28723
  if (targetPath !== ".") {
28231
28724
  console.log(`
28232
28725
  Next steps:`);
28233
- console.log(` cd ${relative3(process.cwd(), absoluteTarget)}`);
28726
+ console.log(` cd ${relative4(process.cwd(), absoluteTarget)}`);
28234
28727
  }
28235
28728
  return {
28236
28729
  path: absoluteTarget,
@@ -28257,11 +28750,11 @@ var init_workspace = __esm(() => {
28257
28750
  });
28258
28751
 
28259
28752
  // src/core/status.ts
28260
- import { existsSync as existsSync14 } from "node:fs";
28261
- import { join as join16 } from "node:path";
28753
+ import { existsSync as existsSync15 } from "node:fs";
28754
+ import { join as join18 } from "node:path";
28262
28755
  async function getWorkspaceStatus(workspacePath = process.cwd()) {
28263
- const configPath = join16(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
28264
- if (!existsSync14(configPath) || isUserConfigPath(workspacePath)) {
28756
+ const configPath = join18(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
28757
+ if (!existsSync15(configPath) || isUserConfigPath(workspacePath)) {
28265
28758
  const userPlugins = await getUserPluginStatuses();
28266
28759
  return {
28267
28760
  success: true,
@@ -28302,7 +28795,7 @@ async function getWorkspaceStatus(workspacePath = process.cwd()) {
28302
28795
  function getPluginStatus(parsed) {
28303
28796
  if (parsed.type === "github") {
28304
28797
  const cachePath = parsed.owner && parsed.repo ? getPluginCachePath(parsed.owner, parsed.repo) : "";
28305
- const available2 = cachePath ? existsSync14(cachePath) : false;
28798
+ const available2 = cachePath ? existsSync15(cachePath) : false;
28306
28799
  return {
28307
28800
  source: parsed.original,
28308
28801
  type: "github",
@@ -28312,7 +28805,7 @@ function getPluginStatus(parsed) {
28312
28805
  ...parsed.repo && { repo: parsed.repo }
28313
28806
  };
28314
28807
  }
28315
- const available = existsSync14(parsed.normalized);
28808
+ const available = existsSync15(parsed.normalized);
28316
28809
  return {
28317
28810
  source: parsed.original,
28318
28811
  type: "local",
@@ -28352,10 +28845,71 @@ var init_status2 = __esm(() => {
28352
28845
  init_user_workspace();
28353
28846
  });
28354
28847
 
28848
+ // src/cli/format-sync.ts
28849
+ function formatMcpResult(mcpResult) {
28850
+ const { added, overwritten, removed, skipped } = mcpResult;
28851
+ if (added === 0 && overwritten === 0 && removed === 0 && skipped === 0) {
28852
+ return [];
28853
+ }
28854
+ const lines = [];
28855
+ const parts = [`${added} added`];
28856
+ if (overwritten > 0)
28857
+ parts.push(`${overwritten} updated`);
28858
+ if (removed > 0)
28859
+ parts.push(`${removed} removed`);
28860
+ if (skipped > 0)
28861
+ parts.push(`${skipped} skipped`);
28862
+ lines.push(`MCP servers: ${parts.join(", ")}`);
28863
+ for (const name of mcpResult.addedServers) {
28864
+ lines.push(` + ${name}`);
28865
+ }
28866
+ for (const name of mcpResult.overwrittenServers) {
28867
+ lines.push(` ~ ${name}`);
28868
+ }
28869
+ for (const name of mcpResult.removedServers) {
28870
+ lines.push(` - ${name}`);
28871
+ }
28872
+ if (mcpResult.configPath) {
28873
+ lines.push(`File modified: ${mcpResult.configPath}`);
28874
+ }
28875
+ return lines;
28876
+ }
28877
+ function buildSyncData(result) {
28878
+ return {
28879
+ copied: result.totalCopied,
28880
+ generated: result.totalGenerated,
28881
+ failed: result.totalFailed,
28882
+ skipped: result.totalSkipped,
28883
+ plugins: result.pluginResults.map((pr) => ({
28884
+ plugin: pr.plugin,
28885
+ success: pr.success,
28886
+ error: pr.error,
28887
+ copied: pr.copyResults.filter((r) => r.action === "copied").length,
28888
+ generated: pr.copyResults.filter((r) => r.action === "generated").length,
28889
+ failed: pr.copyResults.filter((r) => r.action === "failed").length,
28890
+ copyResults: pr.copyResults
28891
+ })),
28892
+ purgedPaths: result.purgedPaths ?? [],
28893
+ ...result.mcpResult && {
28894
+ mcpServers: {
28895
+ added: result.mcpResult.added,
28896
+ skipped: result.mcpResult.skipped,
28897
+ overwritten: result.mcpResult.overwritten,
28898
+ removed: result.mcpResult.removed,
28899
+ addedServers: result.mcpResult.addedServers,
28900
+ skippedServers: result.mcpResult.skippedServers,
28901
+ overwrittenServers: result.mcpResult.overwrittenServers,
28902
+ removedServers: result.mcpResult.removedServers,
28903
+ ...result.mcpResult.configPath && { configPath: result.mcpResult.configPath }
28904
+ }
28905
+ }
28906
+ };
28907
+ }
28908
+
28355
28909
  // src/core/skills.ts
28356
- import { existsSync as existsSync17 } from "node:fs";
28910
+ import { existsSync as existsSync18 } from "node:fs";
28357
28911
  import { readFile as readFile13, readdir as readdir4 } from "node:fs/promises";
28358
- import { join as join19, resolve as resolve12 } from "node:path";
28912
+ import { join as join21, resolve as resolve12 } from "node:path";
28359
28913
  async function resolvePluginPath(pluginSource, workspacePath) {
28360
28914
  if (isPluginSpec(pluginSource)) {
28361
28915
  const resolved2 = await resolvePluginSpecWithAutoRegister(pluginSource, {
@@ -28371,14 +28925,14 @@ async function resolvePluginPath(pluginSource, workspacePath) {
28371
28925
  });
28372
28926
  if (!result.success)
28373
28927
  return null;
28374
- return parsed?.subpath ? join19(result.cachePath, parsed.subpath) : result.cachePath;
28928
+ return parsed?.subpath ? join21(result.cachePath, parsed.subpath) : result.cachePath;
28375
28929
  }
28376
28930
  const resolved = resolve12(workspacePath, pluginSource);
28377
- return existsSync17(resolved) ? resolved : null;
28931
+ return existsSync18(resolved) ? resolved : null;
28378
28932
  }
28379
28933
  async function getAllSkillsFromPlugins(workspacePath = process.cwd()) {
28380
- const configPath = join19(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
28381
- if (!existsSync17(configPath)) {
28934
+ const configPath = join21(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
28935
+ if (!existsSync18(configPath)) {
28382
28936
  return [];
28383
28937
  }
28384
28938
  const content = await readFile13(configPath, "utf-8");
@@ -28390,8 +28944,8 @@ async function getAllSkillsFromPlugins(workspacePath = process.cwd()) {
28390
28944
  if (!pluginPath)
28391
28945
  continue;
28392
28946
  const pluginName = await getPluginName(pluginPath);
28393
- const skillsDir = join19(pluginPath, "skills");
28394
- if (!existsSync17(skillsDir))
28947
+ const skillsDir = join21(pluginPath, "skills");
28948
+ if (!existsSync18(skillsDir))
28395
28949
  continue;
28396
28950
  const entries = await readdir4(skillsDir, { withFileTypes: true });
28397
28951
  const skillDirs = entries.filter((e) => e.isDirectory());
@@ -28401,7 +28955,7 @@ async function getAllSkillsFromPlugins(workspacePath = process.cwd()) {
28401
28955
  name: entry.name,
28402
28956
  pluginName,
28403
28957
  pluginSource,
28404
- path: join19(skillsDir, entry.name),
28958
+ path: join21(skillsDir, entry.name),
28405
28959
  disabled: disabledSkills.has(skillKey)
28406
28960
  });
28407
28961
  }
@@ -28918,7 +29472,7 @@ var package_default;
28918
29472
  var init_package = __esm(() => {
28919
29473
  package_default = {
28920
29474
  name: "allagents",
28921
- version: "0.21.8",
29475
+ version: "0.22.2",
28922
29476
  description: "CLI tool for managing multi-repo AI agent workspaces with plugin synchronization",
28923
29477
  type: "module",
28924
29478
  bin: {
@@ -28988,10 +29542,10 @@ var init_package = __esm(() => {
28988
29542
 
28989
29543
  // src/cli/update-check.ts
28990
29544
  import { readFile as readFile14 } from "node:fs/promises";
28991
- import { join as join21 } from "node:path";
29545
+ import { join as join23 } from "node:path";
28992
29546
  import { spawn as spawn2 } from "node:child_process";
28993
29547
  async function getCachedUpdateInfo(path3) {
28994
- const filePath = path3 ?? join21(getHomeDir(), CONFIG_DIR, CACHE_FILE);
29548
+ const filePath = path3 ?? join23(getHomeDir(), CONFIG_DIR, CACHE_FILE);
28995
29549
  try {
28996
29550
  const raw = await readFile14(filePath, "utf-8");
28997
29551
  const data = JSON.parse(raw);
@@ -29029,8 +29583,8 @@ function buildNotice(currentVersion, latestVersion) {
29029
29583
  Run \`allagents self update\` to upgrade.`;
29030
29584
  }
29031
29585
  function backgroundUpdateCheck() {
29032
- const dir = join21(getHomeDir(), CONFIG_DIR);
29033
- const filePath = join21(dir, CACHE_FILE);
29586
+ const dir = join23(getHomeDir(), CONFIG_DIR);
29587
+ const filePath = join23(dir, CACHE_FILE);
29034
29588
  const script = `
29035
29589
  const https = require('https');
29036
29590
  const fs = require('fs');
@@ -30866,15 +31420,15 @@ class TuiCache {
30866
31420
  }
30867
31421
 
30868
31422
  // src/cli/tui/context.ts
30869
- import { existsSync as existsSync19 } from "node:fs";
30870
- import { join as join22 } from "node:path";
31423
+ import { existsSync as existsSync20 } from "node:fs";
31424
+ import { join as join24 } from "node:path";
30871
31425
  async function getTuiContext(cwd = process.cwd(), cache2) {
30872
31426
  const cachedContext = cache2?.getContext();
30873
31427
  if (cachedContext) {
30874
31428
  return cachedContext;
30875
31429
  }
30876
- const configPath = join22(cwd, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
30877
- const hasWorkspace = existsSync19(configPath) && !isUserConfigPath(cwd);
31430
+ const configPath = join24(cwd, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
31431
+ const hasWorkspace = existsSync20(configPath) && !isUserConfigPath(cwd);
30878
31432
  let projectPluginCount = 0;
30879
31433
  if (hasWorkspace) {
30880
31434
  try {
@@ -30967,6 +31521,9 @@ async function runSync(context) {
30967
31521
  const lines = userResult.pluginResults.map((pr) => `${pr.success ? "✓" : "✗"} ${pr.plugin}`);
30968
31522
  lines.push("");
30969
31523
  lines.push(`Copied: ${userResult.totalCopied} Failed: ${userResult.totalFailed} Skipped: ${userResult.totalSkipped}`);
31524
+ if (userResult.mcpResult) {
31525
+ lines.push(...formatMcpResult(userResult.mcpResult));
31526
+ }
30970
31527
  kt2(lines.join(`
30971
31528
  `), "User Sync");
30972
31529
  }
@@ -31000,8 +31557,8 @@ async function runInit() {
31000
31557
  if (Ct(fromSource)) {
31001
31558
  return;
31002
31559
  }
31003
- const allClients = ClientTypeSchema.options.filter((c) => c !== "vscode");
31004
- const defaultClients = ["claude", "copilot", "codex", "opencode"];
31560
+ const allClients = ClientTypeSchema.options;
31561
+ const defaultClients = ["claude", "copilot", "vscode", "codex", "opencode"];
31005
31562
  const selectedClients = await multiselect({
31006
31563
  message: "Which AI clients do you use?",
31007
31564
  options: allClients.map((c) => ({
@@ -31559,7 +32116,7 @@ async function runManageClients(context, cache2) {
31559
32116
  const userConfig = await getUserWorkspaceConfig();
31560
32117
  currentClients = userConfig?.clients ?? [];
31561
32118
  }
31562
- const allClients = ClientTypeSchema.options.filter((c) => c !== "vscode");
32119
+ const allClients = ClientTypeSchema.options;
31563
32120
  const selectedClients = await multiselect3({
31564
32121
  message: `Select AI clients [${scope}]`,
31565
32122
  options: allClients.map((c) => ({
@@ -31740,7 +32297,7 @@ __export(exports_wizard, {
31740
32297
  runWizard: () => runWizard,
31741
32298
  buildMenuOptions: () => buildMenuOptions
31742
32299
  });
31743
- import { relative as relative4 } from "node:path";
32300
+ import { relative as relative5 } from "node:path";
31744
32301
  function buildMenuOptions(context) {
31745
32302
  const options2 = [];
31746
32303
  if (context.needsSync) {
@@ -31757,7 +32314,7 @@ function buildMenuOptions(context) {
31757
32314
  function buildSummary(context) {
31758
32315
  const lines = [];
31759
32316
  if (context.hasWorkspace && context.workspacePath) {
31760
- const relPath = relative4(process.cwd(), context.workspacePath) || ".";
32317
+ const relPath = relative5(process.cwd(), context.workspacePath) || ".";
31761
32318
  lines.push(`Workspace: ${relPath}`);
31762
32319
  lines.push(`Project plugins: ${context.projectPluginCount}`);
31763
32320
  } else {
@@ -31887,8 +32444,8 @@ init_workspace();
31887
32444
  init_sync();
31888
32445
  init_status2();
31889
32446
  var import_cmd_ts2 = __toESM(require_cjs(), 1);
31890
- import { existsSync as existsSync16 } from "node:fs";
31891
- import { join as join18, resolve as resolve11 } from "node:path";
32447
+ import { existsSync as existsSync17 } from "node:fs";
32448
+ import { join as join20, resolve as resolve11 } from "node:path";
31892
32449
 
31893
32450
  // src/core/prune.ts
31894
32451
  init_js_yaml();
@@ -31896,8 +32453,8 @@ init_constants();
31896
32453
  init_marketplace();
31897
32454
  init_user_workspace();
31898
32455
  import { readFile as readFile12, writeFile as writeFile8 } from "node:fs/promises";
31899
- import { existsSync as existsSync15 } from "node:fs";
31900
- import { join as join17 } from "node:path";
32456
+ import { existsSync as existsSync16 } from "node:fs";
32457
+ import { join as join19 } from "node:path";
31901
32458
  async function isOrphanedPlugin(pluginSpec) {
31902
32459
  if (!isPluginSpec(pluginSpec))
31903
32460
  return false;
@@ -31921,8 +32478,8 @@ async function prunePlugins(plugins) {
31921
32478
  }
31922
32479
  async function pruneOrphanedPlugins(workspacePath) {
31923
32480
  let projectResult = { removed: [], kept: [] };
31924
- const projectConfigPath = join17(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
31925
- if (existsSync15(projectConfigPath) && !isUserConfigPath(workspacePath)) {
32481
+ const projectConfigPath = join19(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
32482
+ if (existsSync16(projectConfigPath) && !isUserConfigPath(workspacePath)) {
31926
32483
  const content = await readFile12(projectConfigPath, "utf-8");
31927
32484
  const config = load(content);
31928
32485
  projectResult = await prunePlugins(config.plugins);
@@ -32106,24 +32663,6 @@ var repoListMeta = {
32106
32663
  };
32107
32664
 
32108
32665
  // src/cli/commands/workspace.ts
32109
- function buildSyncData(result) {
32110
- return {
32111
- copied: result.totalCopied,
32112
- generated: result.totalGenerated,
32113
- failed: result.totalFailed,
32114
- skipped: result.totalSkipped,
32115
- plugins: result.pluginResults.map((pr) => ({
32116
- plugin: pr.plugin,
32117
- success: pr.success,
32118
- error: pr.error,
32119
- copied: pr.copyResults.filter((r) => r.action === "copied").length,
32120
- generated: pr.copyResults.filter((r) => r.action === "generated").length,
32121
- failed: pr.copyResults.filter((r) => r.action === "failed").length,
32122
- copyResults: pr.copyResults
32123
- })),
32124
- purgedPaths: result.purgedPaths ?? []
32125
- };
32126
- }
32127
32666
  var initCmd = import_cmd_ts2.command({
32128
32667
  name: "init",
32129
32668
  description: buildDescription(initMeta),
@@ -32195,9 +32734,10 @@ var syncCmd = import_cmd_ts2.command({
32195
32734
  args: {
32196
32735
  offline: import_cmd_ts2.flag({ long: "offline", description: "Use cached plugins without fetching latest from remote" }),
32197
32736
  dryRun: import_cmd_ts2.flag({ long: "dry-run", short: "n", description: "Simulate sync without making changes" }),
32737
+ force: import_cmd_ts2.flag({ long: "force", short: "f", description: "Overwrite existing MCP server entries that differ from plugin config" }),
32198
32738
  client: import_cmd_ts2.option({ type: import_cmd_ts2.optional(import_cmd_ts2.string), long: "client", short: "c", description: "Sync only the specified client (e.g., opencode, claude)" })
32199
32739
  },
32200
- handler: async ({ offline, dryRun, client }) => {
32740
+ handler: async ({ offline, dryRun, force, client }) => {
32201
32741
  try {
32202
32742
  if (!isJsonMode() && dryRun) {
32203
32743
  console.log(`Dry run mode - no changes will be made
@@ -32208,8 +32748,8 @@ var syncCmd = import_cmd_ts2.command({
32208
32748
  `);
32209
32749
  }
32210
32750
  const userConfigExists = !!await getUserWorkspaceConfig();
32211
- const projectConfigPath = join18(process.cwd(), ".allagents", "workspace.yaml");
32212
- const projectConfigExists = existsSync16(projectConfigPath);
32751
+ const projectConfigPath = join20(process.cwd(), ".allagents", "workspace.yaml");
32752
+ const projectConfigExists = existsSync17(projectConfigPath);
32213
32753
  if (!userConfigExists && !projectConfigExists) {
32214
32754
  await ensureUserWorkspace();
32215
32755
  if (isJsonMode()) {
@@ -32225,7 +32765,7 @@ var syncCmd = import_cmd_ts2.command({
32225
32765
  console.log(`Syncing user workspace...
32226
32766
  `);
32227
32767
  }
32228
- const userResult = await syncUserWorkspace({ offline, dryRun });
32768
+ const userResult = await syncUserWorkspace({ offline, dryRun, force });
32229
32769
  combined = userResult;
32230
32770
  }
32231
32771
  if (projectConfigExists) {
@@ -32292,6 +32832,15 @@ Warnings:`);
32292
32832
  console.log(` ⚠ ${warning}`);
32293
32833
  }
32294
32834
  }
32835
+ if (result.mcpResult) {
32836
+ const mcpLines = formatMcpResult(result.mcpResult);
32837
+ if (mcpLines.length > 0) {
32838
+ console.log("");
32839
+ for (const line of mcpLines) {
32840
+ console.log(line);
32841
+ }
32842
+ }
32843
+ }
32295
32844
  console.log(`
32296
32845
  Sync complete${dryRun ? " (dry run)" : ""}:`);
32297
32846
  console.log(` Total ${dryRun ? "would copy" : "copied"}: ${result.totalCopied}`);
@@ -32610,6 +33159,8 @@ init_marketplace();
32610
33159
  init_sync();
32611
33160
  init_workspace_modify();
32612
33161
  init_user_workspace();
33162
+ init_plugin();
33163
+ init_marketplace_manifest_parser();
32613
33164
  var import_cmd_ts4 = __toESM(require_cjs(), 1);
32614
33165
 
32615
33166
  // src/cli/metadata/plugin.ts
@@ -32776,6 +33327,35 @@ var pluginUninstallMeta = {
32776
33327
  }
32777
33328
  }
32778
33329
  };
33330
+ var pluginUpdateMeta = {
33331
+ command: "plugin update",
33332
+ description: "Update installed plugins to latest version and sync plugin files (skips AGENTS.md)",
33333
+ whenToUse: "To pull the latest changes for installed plugins and deploy plugin files only, without regenerating AGENTS.md",
33334
+ examples: [
33335
+ "allagents plugin update",
33336
+ "allagents plugin update my-plugin@official",
33337
+ "allagents plugin update --scope user"
33338
+ ],
33339
+ expectedOutput: "Shows update status per plugin, then syncs plugin files. Exit 0 if all succeed, exit 1 if any fail.",
33340
+ positionals: [
33341
+ { name: "plugin", type: "string", required: false, description: "Specific plugin to update (updates all if omitted)" }
33342
+ ],
33343
+ options: [
33344
+ { flag: "--scope", short: "-s", type: "string", description: 'Installation scope: "project" (default), "user", or "all"' }
33345
+ ],
33346
+ outputSchema: {
33347
+ results: [{ plugin: "string", success: "boolean", action: "string", error: "string | undefined" }],
33348
+ updated: "number",
33349
+ skipped: "number",
33350
+ failed: "number",
33351
+ syncResult: {
33352
+ copied: "number",
33353
+ generated: "number",
33354
+ failed: "number",
33355
+ skipped: "number"
33356
+ }
33357
+ }
33358
+ };
32779
33359
 
32780
33360
  // src/cli/commands/plugin-skills.ts
32781
33361
  init_source();
@@ -32784,8 +33364,8 @@ init_workspace_modify();
32784
33364
  init_user_workspace();
32785
33365
  init_skills();
32786
33366
  var import_cmd_ts3 = __toESM(require_cjs(), 1);
32787
- import { existsSync as existsSync18 } from "node:fs";
32788
- import { join as join20 } from "node:path";
33367
+ import { existsSync as existsSync19 } from "node:fs";
33368
+ import { join as join22 } from "node:path";
32789
33369
 
32790
33370
  // src/cli/metadata/plugin-skills.ts
32791
33371
  var skillsListMeta = {
@@ -32853,7 +33433,7 @@ var skillsAddMeta = {
32853
33433
  // src/cli/commands/plugin-skills.ts
32854
33434
  init_constants();
32855
33435
  function hasProjectConfig(dir) {
32856
- return existsSync18(join20(dir, CONFIG_DIR, WORKSPACE_CONFIG_FILE));
33436
+ return existsSync19(join22(dir, CONFIG_DIR, WORKSPACE_CONFIG_FILE));
32857
33437
  }
32858
33438
  function resolveScope(cwd) {
32859
33439
  if (isUserConfigPath(cwd))
@@ -33221,38 +33801,20 @@ var skillsCmd = conciseSubcommands({
33221
33801
  });
33222
33802
 
33223
33803
  // src/cli/commands/plugin.ts
33224
- function buildSyncData2(result) {
33225
- return {
33226
- copied: result.totalCopied,
33227
- generated: result.totalGenerated,
33228
- failed: result.totalFailed,
33229
- skipped: result.totalSkipped,
33230
- plugins: result.pluginResults.map((pr) => ({
33231
- plugin: pr.plugin,
33232
- success: pr.success,
33233
- error: pr.error,
33234
- copied: pr.copyResults.filter((r) => r.action === "copied").length,
33235
- generated: pr.copyResults.filter((r) => r.action === "generated").length,
33236
- failed: pr.copyResults.filter((r) => r.action === "failed").length,
33237
- copyResults: pr.copyResults
33238
- })),
33239
- purgedPaths: result.purgedPaths ?? []
33240
- };
33241
- }
33242
- async function runSyncAndPrint() {
33804
+ async function runSyncAndPrint(options2) {
33243
33805
  if (!isJsonMode()) {
33244
33806
  console.log(`
33245
33807
  Syncing workspace...
33246
33808
  `);
33247
33809
  }
33248
- const result = await syncWorkspace();
33810
+ const result = await syncWorkspace(process.cwd(), options2);
33249
33811
  if (!result.success && result.error) {
33250
33812
  if (!isJsonMode()) {
33251
33813
  console.error(`Sync error: ${result.error}`);
33252
33814
  }
33253
33815
  return { ok: false, syncData: null };
33254
33816
  }
33255
- const syncData = buildSyncData2(result);
33817
+ const syncData = buildSyncData(result);
33256
33818
  if (!isJsonMode()) {
33257
33819
  for (const pluginResult of result.pluginResults) {
33258
33820
  const status = pluginResult.success ? "✓" : "✗";
@@ -33302,7 +33864,7 @@ Syncing user workspace...
33302
33864
  }
33303
33865
  return { ok: false, syncData: null };
33304
33866
  }
33305
- const syncData = buildSyncData2(result);
33867
+ const syncData = buildSyncData(result);
33306
33868
  if (!isJsonMode()) {
33307
33869
  for (const pluginResult of result.pluginResults) {
33308
33870
  const status = pluginResult.success ? "✓" : "✗";
@@ -33324,6 +33886,15 @@ Syncing user workspace...
33324
33886
  }
33325
33887
  }
33326
33888
  }
33889
+ if (result.mcpResult) {
33890
+ const mcpLines = formatMcpResult(result.mcpResult);
33891
+ if (mcpLines.length > 0) {
33892
+ console.log("");
33893
+ for (const line of mcpLines) {
33894
+ console.log(line);
33895
+ }
33896
+ }
33897
+ }
33327
33898
  console.log(`
33328
33899
  User sync complete:`);
33329
33900
  console.log(` Total copied: ${result.totalCopied}`);
@@ -33927,12 +34498,188 @@ var pluginUninstallCmd = import_cmd_ts4.command({
33927
34498
  }
33928
34499
  }
33929
34500
  });
34501
+ var pluginUpdateCmd = import_cmd_ts4.command({
34502
+ name: "update",
34503
+ description: buildDescription(pluginUpdateMeta),
34504
+ args: {
34505
+ plugin: import_cmd_ts4.positional({ type: import_cmd_ts4.optional(import_cmd_ts4.string), displayName: "plugin" }),
34506
+ scope: import_cmd_ts4.option({ type: import_cmd_ts4.optional(import_cmd_ts4.string), long: "scope", short: "s", description: 'Installation scope: "project" (default), "user", or "all"' })
34507
+ },
34508
+ handler: async ({ plugin, scope }) => {
34509
+ try {
34510
+ const updateAll = scope === "all";
34511
+ const updateUser = scope === "user" || updateAll;
34512
+ const updateProject = scope === "project" || !scope && !updateAll || updateAll;
34513
+ const pluginsToUpdate = [];
34514
+ if (updateProject && !isUserConfigPath(process.cwd())) {
34515
+ const projectPlugins = await getInstalledProjectPlugins(process.cwd());
34516
+ for (const p of projectPlugins) {
34517
+ pluginsToUpdate.push(p.spec);
34518
+ }
34519
+ }
34520
+ if (updateUser) {
34521
+ const userPlugins = await getInstalledUserPlugins();
34522
+ for (const p of userPlugins) {
34523
+ if (!pluginsToUpdate.includes(p.spec)) {
34524
+ pluginsToUpdate.push(p.spec);
34525
+ }
34526
+ }
34527
+ }
34528
+ if (updateProject && !isUserConfigPath(process.cwd())) {
34529
+ const { existsSync: existsSync20 } = await import("node:fs");
34530
+ const { readFile: readFile14 } = await import("node:fs/promises");
34531
+ const { join: join23 } = await import("node:path");
34532
+ const { load: load2 } = await Promise.resolve().then(() => (init_js_yaml(), exports_js_yaml));
34533
+ const { CONFIG_DIR: CONFIG_DIR2, WORKSPACE_CONFIG_FILE: WORKSPACE_CONFIG_FILE2 } = await Promise.resolve().then(() => (init_constants(), exports_constants));
34534
+ const configPath = join23(process.cwd(), CONFIG_DIR2, WORKSPACE_CONFIG_FILE2);
34535
+ if (existsSync20(configPath)) {
34536
+ const content = await readFile14(configPath, "utf-8");
34537
+ const config = load2(content);
34538
+ for (const p of config.plugins ?? []) {
34539
+ if (!pluginsToUpdate.includes(p)) {
34540
+ pluginsToUpdate.push(p);
34541
+ }
34542
+ }
34543
+ }
34544
+ }
34545
+ if (updateUser) {
34546
+ const userConfig = await getUserWorkspaceConfig();
34547
+ if (userConfig) {
34548
+ for (const p of userConfig.plugins ?? []) {
34549
+ if (!pluginsToUpdate.includes(p)) {
34550
+ pluginsToUpdate.push(p);
34551
+ }
34552
+ }
34553
+ }
34554
+ }
34555
+ const toUpdate = plugin ? pluginsToUpdate.filter((p) => {
34556
+ if (p === plugin)
34557
+ return true;
34558
+ const parsed = parsePluginSpec(p);
34559
+ return parsed?.plugin === plugin || p.endsWith(`/${plugin}`);
34560
+ }) : pluginsToUpdate;
34561
+ if (plugin && toUpdate.length === 0) {
34562
+ const error = `Plugin not found: ${plugin}`;
34563
+ if (isJsonMode()) {
34564
+ jsonOutput({ success: false, command: "plugin update", error });
34565
+ process.exit(1);
34566
+ }
34567
+ console.error(`Error: ${error}`);
34568
+ process.exit(1);
34569
+ }
34570
+ if (toUpdate.length === 0) {
34571
+ if (isJsonMode()) {
34572
+ jsonOutput({
34573
+ success: true,
34574
+ command: "plugin update",
34575
+ data: { results: [], updated: 0, skipped: 0, failed: 0 }
34576
+ });
34577
+ return;
34578
+ }
34579
+ console.log("No plugins to update.");
34580
+ return;
34581
+ }
34582
+ if (!isJsonMode()) {
34583
+ console.log(plugin ? `Updating plugin: ${plugin}...` : "Updating plugins...");
34584
+ console.log();
34585
+ }
34586
+ const results = [];
34587
+ const updatedMarketplaces = new Set;
34588
+ const deps = {
34589
+ parsePluginSpec,
34590
+ getMarketplace,
34591
+ parseMarketplaceManifest,
34592
+ updateMarketplace: async (name) => {
34593
+ if (updatedMarketplaces.has(name)) {
34594
+ return [{ name, success: true }];
34595
+ }
34596
+ const result = await updateMarketplace(name);
34597
+ if (result[0]?.success) {
34598
+ updatedMarketplaces.add(name);
34599
+ }
34600
+ return result;
34601
+ }
34602
+ };
34603
+ for (const pluginSpec of toUpdate) {
34604
+ const result = await updatePlugin(pluginSpec, deps);
34605
+ results.push(result);
34606
+ if (!isJsonMode()) {
34607
+ const icon = result.success ? result.action === "updated" ? "✓" : "-" : "✗";
34608
+ const actionLabel = result.action === "updated" ? "updated" : result.action === "skipped" ? "skipped" : "failed";
34609
+ console.log(`${icon} ${pluginSpec} (${actionLabel})`);
34610
+ if (result.error) {
34611
+ console.log(` Error: ${result.error}`);
34612
+ }
34613
+ }
34614
+ }
34615
+ const updated = results.filter((r) => r.action === "updated").length;
34616
+ const skipped = results.filter((r) => r.action === "skipped").length;
34617
+ const failed = results.filter((r) => r.action === "failed").length;
34618
+ let syncOk = true;
34619
+ let syncData = null;
34620
+ if (updated > 0) {
34621
+ if (updateProject && !isUserConfigPath(process.cwd())) {
34622
+ const { ok, syncData: data } = await runSyncAndPrint({ skipAgentFiles: true });
34623
+ if (!ok)
34624
+ syncOk = false;
34625
+ syncData = data;
34626
+ }
34627
+ if (updateUser) {
34628
+ const { ok, syncData: data } = await runUserSyncAndPrint();
34629
+ if (!ok)
34630
+ syncOk = false;
34631
+ if (!syncData)
34632
+ syncData = data;
34633
+ }
34634
+ }
34635
+ if (isJsonMode()) {
34636
+ jsonOutput({
34637
+ success: failed === 0 && syncOk,
34638
+ command: "plugin update",
34639
+ data: {
34640
+ results: results.map((r) => ({
34641
+ plugin: r.plugin,
34642
+ success: r.success,
34643
+ action: r.action,
34644
+ ...r.error && { error: r.error }
34645
+ })),
34646
+ updated,
34647
+ skipped,
34648
+ failed,
34649
+ ...syncData && { syncResult: syncData }
34650
+ },
34651
+ ...failed > 0 && { error: `${failed} plugin(s) failed to update` }
34652
+ });
34653
+ if (failed > 0 || !syncOk) {
34654
+ process.exit(1);
34655
+ }
34656
+ return;
34657
+ }
34658
+ console.log();
34659
+ console.log(`Update complete: ${updated} updated, ${skipped} skipped, ${failed} failed`);
34660
+ if (failed > 0 || !syncOk) {
34661
+ process.exit(1);
34662
+ }
34663
+ } catch (error) {
34664
+ if (error instanceof Error) {
34665
+ if (isJsonMode()) {
34666
+ jsonOutput({ success: false, command: "plugin update", error: error.message });
34667
+ process.exit(1);
34668
+ }
34669
+ console.error(`Error: ${error.message}`);
34670
+ process.exit(1);
34671
+ }
34672
+ throw error;
34673
+ }
34674
+ }
34675
+ });
33930
34676
  var pluginCmd = conciseSubcommands({
33931
34677
  name: "plugin",
33932
34678
  description: "Manage plugins and marketplaces",
33933
34679
  cmds: {
33934
34680
  install: pluginInstallCmd,
33935
34681
  uninstall: pluginUninstallCmd,
34682
+ update: pluginUpdateCmd,
33936
34683
  marketplace: marketplaceCmd,
33937
34684
  list: pluginListCmd,
33938
34685
  validate: pluginValidateCmd,
@@ -34888,7 +35635,7 @@ var addPipeMethods = (spawned) => {
34888
35635
  };
34889
35636
 
34890
35637
  // node_modules/execa/lib/stream.js
34891
- import { createReadStream, readFileSync as readFileSync3 } from "node:fs";
35638
+ import { createReadStream, readFileSync as readFileSync4 } from "node:fs";
34892
35639
  import { setTimeout as setTimeout2 } from "node:timers/promises";
34893
35640
 
34894
35641
  // node_modules/get-stream/source/contents.js
@@ -35084,7 +35831,7 @@ var getInputSync = ({ input, inputFile }) => {
35084
35831
  return input;
35085
35832
  }
35086
35833
  validateInputOptions(input);
35087
- return readFileSync3(inputFile);
35834
+ return readFileSync4(inputFile);
35088
35835
  };
35089
35836
  var handleInputSync = (options2) => {
35090
35837
  const input = getInputSync(options2);