allagents 0.21.8 → 0.22.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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
|
-
|
|
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
|
-
##
|
|
7405
|
-
|
|
7406
|
-
|
|
7473
|
+
## Workspace Repositories
|
|
7474
|
+
The following repositories are part of this workspace:
|
|
7475
|
+
${repoList}
|
|
7407
7476
|
|
|
7408
|
-
## Rule:
|
|
7477
|
+
## Rule: Use Repository Paths
|
|
7409
7478
|
TRIGGER: File operations (read, search, modify)
|
|
7410
|
-
ACTION: Use repository paths
|
|
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 = (
|
|
10195
|
+
ZodUnion.create = (types2, params) => {
|
|
10125
10196
|
return new ZodUnion({
|
|
10126
|
-
options:
|
|
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
|
|
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
|
-
|
|
21662
|
-
|
|
21663
|
-
|
|
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 =
|
|
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
|
|
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
|
|
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
|
|
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
|
|
21931
|
+
throw new YAMLException2('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
|
|
21785
21932
|
}
|
|
21786
21933
|
}
|
|
21787
|
-
module.exports =
|
|
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
|
|
21794
|
-
var
|
|
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
|
|
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
|
|
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
|
-
|
|
21841
|
-
|
|
21842
|
-
var schemas,
|
|
21987
|
+
Schema2.DEFAULT = null;
|
|
21988
|
+
Schema2.create = function createSchema() {
|
|
21989
|
+
var schemas, types3;
|
|
21843
21990
|
switch (arguments.length) {
|
|
21844
21991
|
case 1:
|
|
21845
|
-
schemas =
|
|
21846
|
-
|
|
21992
|
+
schemas = Schema2.DEFAULT;
|
|
21993
|
+
types3 = arguments[0];
|
|
21847
21994
|
break;
|
|
21848
21995
|
case 2:
|
|
21849
21996
|
schemas = arguments[0];
|
|
21850
|
-
|
|
21997
|
+
types3 = arguments[1];
|
|
21851
21998
|
break;
|
|
21852
21999
|
default:
|
|
21853
|
-
throw new
|
|
22000
|
+
throw new YAMLException2("Wrong number of arguments for Schema.create function");
|
|
21854
22001
|
}
|
|
21855
22002
|
schemas = common2.toArray(schemas);
|
|
21856
|
-
|
|
22003
|
+
types3 = common2.toArray(types3);
|
|
21857
22004
|
if (!schemas.every(function(schema2) {
|
|
21858
|
-
return schema2 instanceof
|
|
22005
|
+
return schema2 instanceof Schema2;
|
|
21859
22006
|
})) {
|
|
21860
|
-
throw new
|
|
22007
|
+
throw new YAMLException2("Specified list of super schemas (or a single Schema object) contains a non-Schema object.");
|
|
21861
22008
|
}
|
|
21862
|
-
if (!
|
|
21863
|
-
return type2 instanceof
|
|
22009
|
+
if (!types3.every(function(type2) {
|
|
22010
|
+
return type2 instanceof Type2;
|
|
21864
22011
|
})) {
|
|
21865
|
-
throw new
|
|
22012
|
+
throw new YAMLException2("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
|
21866
22013
|
}
|
|
21867
|
-
return new
|
|
22014
|
+
return new Schema2({
|
|
21868
22015
|
include: schemas,
|
|
21869
|
-
explicit:
|
|
22016
|
+
explicit: types3
|
|
21870
22017
|
});
|
|
21871
22018
|
};
|
|
21872
|
-
module.exports =
|
|
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
|
|
21878
|
-
module.exports = new
|
|
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
|
|
21889
|
-
module.exports = new
|
|
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
|
|
21900
|
-
module.exports = new
|
|
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
|
|
21911
|
-
module.exports = new
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
22231
|
-
module.exports = new
|
|
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
|
|
22247
|
-
module.exports = new
|
|
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
|
|
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
|
|
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
|
|
22464
|
+
var Type2 = require_type2();
|
|
22318
22465
|
function resolveYamlMerge2(data) {
|
|
22319
22466
|
return data === "<<" || data === null;
|
|
22320
22467
|
}
|
|
22321
|
-
module.exports = new
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
22529
|
-
module.exports = new
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
22677
|
-
module.exports =
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
24934
|
-
async function ensureWorkspaceRules(filePath,
|
|
24935
|
-
const rulesContent =
|
|
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 =
|
|
25185
|
+
const sourceDir = join7(pluginPath, "commands");
|
|
24965
25186
|
if (!existsSync4(sourceDir)) {
|
|
24966
25187
|
return results;
|
|
24967
25188
|
}
|
|
24968
|
-
const destDir =
|
|
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 =
|
|
24976
|
-
const destPath =
|
|
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 =
|
|
25223
|
+
const sourceDir = join7(pluginPath, "skills");
|
|
25003
25224
|
if (!existsSync4(sourceDir)) {
|
|
25004
25225
|
return results;
|
|
25005
25226
|
}
|
|
25006
|
-
const destDir =
|
|
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 =
|
|
25238
|
+
const skillSourcePath = join7(sourceDir, entry.name);
|
|
25018
25239
|
const resolvedName = skillNameMap?.get(entry.name) ?? entry.name;
|
|
25019
|
-
const skillDestPath =
|
|
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 =
|
|
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 =
|
|
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:
|
|
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 =
|
|
25308
|
+
const sourceDir = join7(pluginPath, "hooks");
|
|
25088
25309
|
if (!existsSync4(sourceDir)) {
|
|
25089
25310
|
return results;
|
|
25090
25311
|
}
|
|
25091
|
-
const destDir =
|
|
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 =
|
|
25338
|
+
const sourceDir = join7(pluginPath, "agents");
|
|
25118
25339
|
if (!existsSync4(sourceDir)) {
|
|
25119
25340
|
return results;
|
|
25120
25341
|
}
|
|
25121
|
-
const destDir =
|
|
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 =
|
|
25129
|
-
const destPath =
|
|
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:
|
|
25466
|
+
return { path: join7(process.cwd(), source) };
|
|
25185
25467
|
}
|
|
25186
25468
|
if (defaultSourcePath) {
|
|
25187
|
-
return { path:
|
|
25469
|
+
return { path: join7(defaultSourcePath, source) };
|
|
25188
25470
|
}
|
|
25189
|
-
return { path:
|
|
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:
|
|
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,
|
|
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:
|
|
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:
|
|
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 =
|
|
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(
|
|
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 =
|
|
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 =
|
|
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(
|
|
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 &&
|
|
25643
|
+
if (!dryRun && repositories.length > 0) {
|
|
25362
25644
|
for (const agentFile of copiedAgentFiles) {
|
|
25363
|
-
const targetPath =
|
|
25645
|
+
const targetPath = join7(workspacePath, agentFile);
|
|
25364
25646
|
try {
|
|
25365
|
-
await
|
|
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
|
|
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
|
|
25727
|
+
import { join as join8, resolve as resolve5 } from "node:path";
|
|
25446
25728
|
async function parseMarketplaceManifest(marketplacePath) {
|
|
25447
|
-
const manifestPath =
|
|
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
|
|
25860
|
+
import { join as join9, resolve as resolve6 } from "node:path";
|
|
25579
25861
|
function getUserWorkspaceConfigPath() {
|
|
25580
|
-
return
|
|
25862
|
+
return join9(getAllagentsDir(), WORKSPACE_CONFIG_FILE);
|
|
25581
25863
|
}
|
|
25582
25864
|
function isUserConfigPath(workspacePath) {
|
|
25583
|
-
const projectConfigPath =
|
|
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 =
|
|
26150
|
+
const configPath = join9(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
25869
26151
|
if (!existsSync6(configPath))
|
|
25870
26152
|
return [];
|
|
25871
26153
|
try {
|
|
@@ -25913,7 +26195,7 @@ var init_user_workspace = __esm(() => {
|
|
|
25913
26195
|
// src/core/marketplace.ts
|
|
25914
26196
|
import { existsSync as existsSync7 } from "node:fs";
|
|
25915
26197
|
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
|
|
26198
|
+
import { basename as basename2, join as join10, resolve as resolve7 } from "node:path";
|
|
25917
26199
|
function parseLocation(location) {
|
|
25918
26200
|
const [owner = "", repo = "", ...rest] = location.split("/");
|
|
25919
26201
|
const branch = rest.length > 0 ? rest.join("/") : undefined;
|
|
@@ -25923,10 +26205,10 @@ function getAllagentsDir() {
|
|
|
25923
26205
|
return resolve7(getHomeDir(), ".allagents");
|
|
25924
26206
|
}
|
|
25925
26207
|
function getMarketplacesDir() {
|
|
25926
|
-
return
|
|
26208
|
+
return join10(getAllagentsDir(), "plugins", "marketplaces");
|
|
25927
26209
|
}
|
|
25928
26210
|
function getRegistryPath() {
|
|
25929
|
-
return
|
|
26211
|
+
return join10(getAllagentsDir(), "marketplaces.json");
|
|
25930
26212
|
}
|
|
25931
26213
|
async function loadRegistry() {
|
|
25932
26214
|
const registryPath = getRegistryPath();
|
|
@@ -26038,7 +26320,7 @@ async function addMarketplace(source, customName, branch) {
|
|
|
26038
26320
|
}
|
|
26039
26321
|
let marketplacePath;
|
|
26040
26322
|
if (parsed.type === "github") {
|
|
26041
|
-
marketplacePath =
|
|
26323
|
+
marketplacePath = join10(getMarketplacesDir(), name);
|
|
26042
26324
|
if (existsSync7(marketplacePath)) {} else {
|
|
26043
26325
|
const parentDir = getMarketplacesDir();
|
|
26044
26326
|
if (!existsSync7(parentDir)) {
|
|
@@ -26257,7 +26539,7 @@ async function listMarketplacePlugins(name) {
|
|
|
26257
26539
|
if (manifestResult.plugins.length > 0) {
|
|
26258
26540
|
return manifestResult;
|
|
26259
26541
|
}
|
|
26260
|
-
const pluginsDir =
|
|
26542
|
+
const pluginsDir = join10(marketplace.path, "plugins");
|
|
26261
26543
|
if (!existsSync7(pluginsDir)) {
|
|
26262
26544
|
return { plugins: [], warnings: manifestResult.warnings };
|
|
26263
26545
|
}
|
|
@@ -26265,7 +26547,7 @@ async function listMarketplacePlugins(name) {
|
|
|
26265
26547
|
const entries = await readdir3(pluginsDir, { withFileTypes: true });
|
|
26266
26548
|
const plugins = entries.filter((e) => e.isDirectory()).map((e) => ({
|
|
26267
26549
|
name: e.name,
|
|
26268
|
-
path:
|
|
26550
|
+
path: join10(pluginsDir, e.name)
|
|
26269
26551
|
})).sort((a, b) => a.name.localeCompare(b.name));
|
|
26270
26552
|
return { plugins, warnings: manifestResult.warnings };
|
|
26271
26553
|
} catch {
|
|
@@ -26357,7 +26639,7 @@ async function resolvePluginSpec(spec, options2 = {}) {
|
|
|
26357
26639
|
}
|
|
26358
26640
|
}
|
|
26359
26641
|
const subpath = options2.subpath ?? parsed.subpath ?? "plugins";
|
|
26360
|
-
const pluginPath =
|
|
26642
|
+
const pluginPath = join10(marketplacePath, subpath, parsed.plugin);
|
|
26361
26643
|
if (!existsSync7(pluginPath)) {
|
|
26362
26644
|
return null;
|
|
26363
26645
|
}
|
|
@@ -26433,7 +26715,7 @@ async function resolvePluginSpecWithAutoRegister(spec, options2 = {}) {
|
|
|
26433
26715
|
return {
|
|
26434
26716
|
success: false,
|
|
26435
26717
|
error: `Plugin '${pluginName}' not found in marketplace '${marketplaceName}'
|
|
26436
|
-
Expected at: ${
|
|
26718
|
+
Expected at: ${join10(marketplace.path, expectedSubpath, pluginName)}`
|
|
26437
26719
|
};
|
|
26438
26720
|
}
|
|
26439
26721
|
const shouldReturnRegisteredAs = didAutoRegister || marketplace.name !== marketplaceName;
|
|
@@ -26448,12 +26730,23 @@ async function autoRegisterMarketplace(source) {
|
|
|
26448
26730
|
if (source.includes("/") && !source.includes("://")) {
|
|
26449
26731
|
const parts = source.split("/");
|
|
26450
26732
|
if (parts.length === 2 && parts[0] && parts[1]) {
|
|
26733
|
+
const cachedName = registeredSourceCache.get(source);
|
|
26734
|
+
if (cachedName) {
|
|
26735
|
+
return { success: true, name: cachedName };
|
|
26736
|
+
}
|
|
26737
|
+
const existing = await findMarketplace(parts[1], source);
|
|
26738
|
+
if (existing) {
|
|
26739
|
+
registeredSourceCache.set(source, existing.name);
|
|
26740
|
+
return { success: true, name: existing.name };
|
|
26741
|
+
}
|
|
26451
26742
|
console.log(`Auto-registering GitHub marketplace: ${source}`);
|
|
26452
26743
|
const result = await addMarketplace(source);
|
|
26453
26744
|
if (!result.success) {
|
|
26454
26745
|
return { success: false, error: result.error || "Unknown error" };
|
|
26455
26746
|
}
|
|
26456
|
-
|
|
26747
|
+
const name = result.marketplace?.name ?? parts[1];
|
|
26748
|
+
registeredSourceCache.set(source, name);
|
|
26749
|
+
return { success: true, name };
|
|
26457
26750
|
}
|
|
26458
26751
|
}
|
|
26459
26752
|
return {
|
|
@@ -26487,13 +26780,6 @@ async function ensureMarketplacesRegistered(plugins) {
|
|
|
26487
26780
|
const sources = extractUniqueMarketplaceSources(plugins);
|
|
26488
26781
|
const results = [];
|
|
26489
26782
|
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
26783
|
const result = await autoRegisterMarketplace(source);
|
|
26498
26784
|
results.push({ source, ...result });
|
|
26499
26785
|
}
|
|
@@ -26511,6 +26797,7 @@ async function getMarketplaceVersion(marketplacePath) {
|
|
|
26511
26797
|
return null;
|
|
26512
26798
|
}
|
|
26513
26799
|
}
|
|
26800
|
+
var registeredSourceCache;
|
|
26514
26801
|
var init_marketplace = __esm(() => {
|
|
26515
26802
|
init_esm();
|
|
26516
26803
|
init_constants();
|
|
@@ -26518,16 +26805,17 @@ var init_marketplace = __esm(() => {
|
|
|
26518
26805
|
init_plugin_path();
|
|
26519
26806
|
init_git();
|
|
26520
26807
|
init_plugin();
|
|
26808
|
+
registeredSourceCache = new Map;
|
|
26521
26809
|
});
|
|
26522
26810
|
|
|
26523
26811
|
// src/core/workspace-modify.ts
|
|
26524
26812
|
import { existsSync as existsSync8 } from "node:fs";
|
|
26525
26813
|
import { mkdir as mkdir6, readFile as readFile8, writeFile as writeFile4 } from "node:fs/promises";
|
|
26526
|
-
import { join as
|
|
26814
|
+
import { join as join11 } from "node:path";
|
|
26527
26815
|
async function setClients(clients, workspacePath = process.cwd()) {
|
|
26528
26816
|
try {
|
|
26529
26817
|
await ensureWorkspace(workspacePath);
|
|
26530
|
-
const configPath =
|
|
26818
|
+
const configPath = join11(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
26531
26819
|
const content = await readFile8(configPath, "utf-8");
|
|
26532
26820
|
const config = load(content);
|
|
26533
26821
|
config.clients = clients;
|
|
@@ -26541,8 +26829,8 @@ async function setClients(clients, workspacePath = process.cwd()) {
|
|
|
26541
26829
|
}
|
|
26542
26830
|
}
|
|
26543
26831
|
async function ensureWorkspace(workspacePath) {
|
|
26544
|
-
const configDir =
|
|
26545
|
-
const configPath =
|
|
26832
|
+
const configDir = join11(workspacePath, CONFIG_DIR);
|
|
26833
|
+
const configPath = join11(configDir, WORKSPACE_CONFIG_FILE);
|
|
26546
26834
|
if (existsSync8(configPath))
|
|
26547
26835
|
return;
|
|
26548
26836
|
const defaultConfig = {
|
|
@@ -26554,7 +26842,7 @@ async function ensureWorkspace(workspacePath) {
|
|
|
26554
26842
|
await writeFile4(configPath, dump(defaultConfig, { lineWidth: -1 }), "utf-8");
|
|
26555
26843
|
}
|
|
26556
26844
|
async function addPlugin(plugin, workspacePath = process.cwd()) {
|
|
26557
|
-
const configPath =
|
|
26845
|
+
const configPath = join11(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
26558
26846
|
await ensureWorkspace(workspacePath);
|
|
26559
26847
|
if (isPluginSpec(plugin)) {
|
|
26560
26848
|
const resolved = await resolvePluginSpecWithAutoRegister(plugin);
|
|
@@ -26582,7 +26870,7 @@ async function addPlugin(plugin, workspacePath = process.cwd()) {
|
|
|
26582
26870
|
};
|
|
26583
26871
|
}
|
|
26584
26872
|
} else {
|
|
26585
|
-
const fullPath =
|
|
26873
|
+
const fullPath = join11(workspacePath, plugin);
|
|
26586
26874
|
if (!existsSync8(fullPath) && !existsSync8(plugin)) {
|
|
26587
26875
|
return {
|
|
26588
26876
|
success: false,
|
|
@@ -26618,7 +26906,7 @@ async function addPluginToConfig(plugin, configPath, autoRegistered) {
|
|
|
26618
26906
|
}
|
|
26619
26907
|
}
|
|
26620
26908
|
async function hasPlugin(plugin, workspacePath = process.cwd()) {
|
|
26621
|
-
const configPath =
|
|
26909
|
+
const configPath = join11(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
26622
26910
|
if (!existsSync8(configPath))
|
|
26623
26911
|
return false;
|
|
26624
26912
|
try {
|
|
@@ -26635,7 +26923,7 @@ async function hasPlugin(plugin, workspacePath = process.cwd()) {
|
|
|
26635
26923
|
}
|
|
26636
26924
|
}
|
|
26637
26925
|
async function removePlugin(plugin, workspacePath = process.cwd()) {
|
|
26638
|
-
const configPath =
|
|
26926
|
+
const configPath = join11(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
26639
26927
|
if (!existsSync8(configPath)) {
|
|
26640
26928
|
return {
|
|
26641
26929
|
success: false,
|
|
@@ -26692,7 +26980,7 @@ function extractPluginName(pluginSource) {
|
|
|
26692
26980
|
return last2.replace(/\.git$/, "");
|
|
26693
26981
|
}
|
|
26694
26982
|
async function addDisabledSkill(skillKey, workspacePath = process.cwd()) {
|
|
26695
|
-
const configPath =
|
|
26983
|
+
const configPath = join11(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
26696
26984
|
if (!existsSync8(configPath)) {
|
|
26697
26985
|
return {
|
|
26698
26986
|
success: false,
|
|
@@ -26720,7 +27008,7 @@ async function addDisabledSkill(skillKey, workspacePath = process.cwd()) {
|
|
|
26720
27008
|
}
|
|
26721
27009
|
}
|
|
26722
27010
|
async function removeDisabledSkill(skillKey, workspacePath = process.cwd()) {
|
|
26723
|
-
const configPath =
|
|
27011
|
+
const configPath = join11(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
26724
27012
|
if (!existsSync8(configPath)) {
|
|
26725
27013
|
return {
|
|
26726
27014
|
success: false,
|
|
@@ -26767,7 +27055,7 @@ var init_workspace_modify = __esm(() => {
|
|
|
26767
27055
|
// src/core/workspace-repo.ts
|
|
26768
27056
|
import { readFile as readFile9, writeFile as writeFile5 } from "node:fs/promises";
|
|
26769
27057
|
import { existsSync as existsSync9 } from "node:fs";
|
|
26770
|
-
import { join as
|
|
27058
|
+
import { join as join12 } from "node:path";
|
|
26771
27059
|
async function detectRemote(repoPath) {
|
|
26772
27060
|
try {
|
|
26773
27061
|
const env2 = { ...process.env };
|
|
@@ -26809,7 +27097,7 @@ function normalizePath(p) {
|
|
|
26809
27097
|
}
|
|
26810
27098
|
async function addRepository(path, options2 = {}, workspacePath = process.cwd()) {
|
|
26811
27099
|
const normalizedPath = normalizePath(path);
|
|
26812
|
-
const configPath =
|
|
27100
|
+
const configPath = join12(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
26813
27101
|
await ensureWorkspace(workspacePath);
|
|
26814
27102
|
try {
|
|
26815
27103
|
const content = await readFile9(configPath, "utf-8");
|
|
@@ -26832,7 +27120,7 @@ async function addRepository(path, options2 = {}, workspacePath = process.cwd())
|
|
|
26832
27120
|
}
|
|
26833
27121
|
}
|
|
26834
27122
|
async function removeRepository(path, workspacePath = process.cwd()) {
|
|
26835
|
-
const configPath =
|
|
27123
|
+
const configPath = join12(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
26836
27124
|
if (!existsSync9(configPath)) {
|
|
26837
27125
|
return {
|
|
26838
27126
|
success: false,
|
|
@@ -26856,7 +27144,7 @@ async function removeRepository(path, workspacePath = process.cwd()) {
|
|
|
26856
27144
|
}
|
|
26857
27145
|
}
|
|
26858
27146
|
async function listRepositories(workspacePath = process.cwd()) {
|
|
26859
|
-
const configPath =
|
|
27147
|
+
const configPath = join12(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
26860
27148
|
if (!existsSync9(configPath))
|
|
26861
27149
|
return [];
|
|
26862
27150
|
try {
|
|
@@ -26868,7 +27156,7 @@ async function listRepositories(workspacePath = process.cwd()) {
|
|
|
26868
27156
|
}
|
|
26869
27157
|
}
|
|
26870
27158
|
async function updateAgentFiles(workspacePath = process.cwd()) {
|
|
26871
|
-
const configPath =
|
|
27159
|
+
const configPath = join12(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
26872
27160
|
if (!existsSync9(configPath))
|
|
26873
27161
|
return;
|
|
26874
27162
|
const content = await readFile9(configPath, "utf-8");
|
|
@@ -26883,7 +27171,7 @@ async function updateAgentFiles(workspacePath = process.cwd()) {
|
|
|
26883
27171
|
}
|
|
26884
27172
|
agentFiles.add("AGENTS.md");
|
|
26885
27173
|
for (const agentFile of agentFiles) {
|
|
26886
|
-
await ensureWorkspaceRules(
|
|
27174
|
+
await ensureWorkspaceRules(join12(workspacePath, agentFile), config.repositories);
|
|
26887
27175
|
}
|
|
26888
27176
|
}
|
|
26889
27177
|
var init_workspace_repo = __esm(() => {
|
|
@@ -27056,9 +27344,9 @@ var init_sync_state = __esm(() => {
|
|
|
27056
27344
|
// src/core/sync-state.ts
|
|
27057
27345
|
import { readFile as readFile10, writeFile as writeFile6, mkdir as mkdir7 } from "node:fs/promises";
|
|
27058
27346
|
import { existsSync as existsSync10 } from "node:fs";
|
|
27059
|
-
import { join as
|
|
27347
|
+
import { join as join13, dirname as dirname5 } from "node:path";
|
|
27060
27348
|
function getSyncStatePath(workspacePath) {
|
|
27061
|
-
return
|
|
27349
|
+
return join13(workspacePath, CONFIG_DIR, SYNC_STATE_FILE);
|
|
27062
27350
|
}
|
|
27063
27351
|
async function loadSyncState(workspacePath) {
|
|
27064
27352
|
const statePath = getSyncStatePath(workspacePath);
|
|
@@ -27084,7 +27372,7 @@ async function saveSyncState(workspacePath, files) {
|
|
|
27084
27372
|
lastSync: new Date().toISOString(),
|
|
27085
27373
|
files
|
|
27086
27374
|
};
|
|
27087
|
-
await mkdir7(
|
|
27375
|
+
await mkdir7(dirname5(statePath), { recursive: true });
|
|
27088
27376
|
await writeFile6(statePath, JSON.stringify(state, null, 2), "utf-8");
|
|
27089
27377
|
}
|
|
27090
27378
|
function getPreviouslySyncedFiles(state, client) {
|
|
@@ -27099,7 +27387,7 @@ var init_sync_state2 = __esm(() => {
|
|
|
27099
27387
|
});
|
|
27100
27388
|
|
|
27101
27389
|
// src/core/vscode-workspace.ts
|
|
27102
|
-
import { resolve as resolve8, basename as basename3, isAbsolute as
|
|
27390
|
+
import { resolve as resolve8, basename as basename3, isAbsolute as isAbsolute3 } from "node:path";
|
|
27103
27391
|
function buildPathPlaceholderMap(repositories, workspacePath) {
|
|
27104
27392
|
const map2 = new Map;
|
|
27105
27393
|
for (const repo of repositories) {
|
|
@@ -27147,7 +27435,7 @@ function generateVscodeWorkspace(input) {
|
|
|
27147
27435
|
if (resolvedTemplate && Array.isArray(resolvedTemplate.folders)) {
|
|
27148
27436
|
for (const folder of resolvedTemplate.folders) {
|
|
27149
27437
|
const rawPath = folder.path;
|
|
27150
|
-
const normalizedPath = (typeof rawPath === "string" && !
|
|
27438
|
+
const normalizedPath = (typeof rawPath === "string" && !isAbsolute3(rawPath) ? resolve8(workspacePath, rawPath) : rawPath).replace(/\\/g, "/");
|
|
27151
27439
|
if (!seenPaths.has(normalizedPath)) {
|
|
27152
27440
|
const entry = { path: normalizedPath };
|
|
27153
27441
|
if (folder.name)
|
|
@@ -27189,10 +27477,148 @@ var init_vscode_workspace = __esm(() => {
|
|
|
27189
27477
|
};
|
|
27190
27478
|
});
|
|
27191
27479
|
|
|
27480
|
+
// src/core/vscode-mcp.ts
|
|
27481
|
+
import { existsSync as existsSync11, readFileSync, writeFileSync, mkdirSync } from "node:fs";
|
|
27482
|
+
import { join as join14, dirname as dirname6 } from "node:path";
|
|
27483
|
+
function deepEqual(a, b) {
|
|
27484
|
+
if (a === b)
|
|
27485
|
+
return true;
|
|
27486
|
+
if (typeof a !== typeof b)
|
|
27487
|
+
return false;
|
|
27488
|
+
if (a === null || b === null)
|
|
27489
|
+
return a === b;
|
|
27490
|
+
if (typeof a !== "object")
|
|
27491
|
+
return false;
|
|
27492
|
+
if (Array.isArray(a) !== Array.isArray(b))
|
|
27493
|
+
return false;
|
|
27494
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
27495
|
+
if (a.length !== b.length)
|
|
27496
|
+
return false;
|
|
27497
|
+
return a.every((val, i2) => deepEqual(val, b[i2]));
|
|
27498
|
+
}
|
|
27499
|
+
const aObj = a;
|
|
27500
|
+
const bObj = b;
|
|
27501
|
+
const aKeys = Object.keys(aObj);
|
|
27502
|
+
const bKeys = Object.keys(bObj);
|
|
27503
|
+
if (aKeys.length !== bKeys.length)
|
|
27504
|
+
return false;
|
|
27505
|
+
return aKeys.every((key) => (key in bObj) && deepEqual(aObj[key], bObj[key]));
|
|
27506
|
+
}
|
|
27507
|
+
function getVscodeMcpConfigPath() {
|
|
27508
|
+
const platform2 = process.platform;
|
|
27509
|
+
if (platform2 === "win32") {
|
|
27510
|
+
const appData = process.env.APPDATA;
|
|
27511
|
+
if (!appData) {
|
|
27512
|
+
throw new Error("APPDATA environment variable not set");
|
|
27513
|
+
}
|
|
27514
|
+
return join14(appData, "Code", "User", "mcp.json");
|
|
27515
|
+
}
|
|
27516
|
+
const home = getHomeDir();
|
|
27517
|
+
if (platform2 === "darwin") {
|
|
27518
|
+
return join14(home, "Library", "Application Support", "Code", "User", "mcp.json");
|
|
27519
|
+
}
|
|
27520
|
+
return join14(home, ".config", "Code", "User", "mcp.json");
|
|
27521
|
+
}
|
|
27522
|
+
function readPluginMcpConfig(pluginPath) {
|
|
27523
|
+
const mcpPath = join14(pluginPath, ".mcp.json");
|
|
27524
|
+
if (!existsSync11(mcpPath)) {
|
|
27525
|
+
return null;
|
|
27526
|
+
}
|
|
27527
|
+
try {
|
|
27528
|
+
const content = readFileSync(mcpPath, "utf-8");
|
|
27529
|
+
const parsed = import_json5.default.parse(content);
|
|
27530
|
+
if (parsed && typeof parsed === "object" && parsed.mcpServers && typeof parsed.mcpServers === "object") {
|
|
27531
|
+
return parsed.mcpServers;
|
|
27532
|
+
}
|
|
27533
|
+
return null;
|
|
27534
|
+
} catch {
|
|
27535
|
+
return null;
|
|
27536
|
+
}
|
|
27537
|
+
}
|
|
27538
|
+
function collectMcpServers(validatedPlugins) {
|
|
27539
|
+
const servers = new Map;
|
|
27540
|
+
const warnings = [];
|
|
27541
|
+
for (const plugin of validatedPlugins) {
|
|
27542
|
+
const mcpServers = readPluginMcpConfig(plugin.resolved);
|
|
27543
|
+
if (!mcpServers)
|
|
27544
|
+
continue;
|
|
27545
|
+
for (const [name, config] of Object.entries(mcpServers)) {
|
|
27546
|
+
if (servers.has(name)) {
|
|
27547
|
+
warnings.push(`MCP server '${name}' from ${plugin.plugin} conflicts with earlier plugin (skipped)`);
|
|
27548
|
+
} else {
|
|
27549
|
+
servers.set(name, config);
|
|
27550
|
+
}
|
|
27551
|
+
}
|
|
27552
|
+
}
|
|
27553
|
+
return { servers, warnings };
|
|
27554
|
+
}
|
|
27555
|
+
function syncVscodeMcpConfig(validatedPlugins, options2) {
|
|
27556
|
+
const dryRun = options2?.dryRun ?? false;
|
|
27557
|
+
const force = options2?.force ?? false;
|
|
27558
|
+
const configPath = options2?.configPath ?? getVscodeMcpConfigPath();
|
|
27559
|
+
const { servers: pluginServers, warnings } = collectMcpServers(validatedPlugins);
|
|
27560
|
+
const result = {
|
|
27561
|
+
added: 0,
|
|
27562
|
+
skipped: 0,
|
|
27563
|
+
overwritten: 0,
|
|
27564
|
+
warnings: [...warnings],
|
|
27565
|
+
addedServers: [],
|
|
27566
|
+
skippedServers: [],
|
|
27567
|
+
overwrittenServers: []
|
|
27568
|
+
};
|
|
27569
|
+
if (pluginServers.size === 0) {
|
|
27570
|
+
return result;
|
|
27571
|
+
}
|
|
27572
|
+
let existingConfig = {};
|
|
27573
|
+
if (existsSync11(configPath)) {
|
|
27574
|
+
try {
|
|
27575
|
+
const content = readFileSync(configPath, "utf-8");
|
|
27576
|
+
existingConfig = import_json5.default.parse(content);
|
|
27577
|
+
} catch {
|
|
27578
|
+
result.warnings.push(`Could not parse existing ${configPath}, starting fresh`);
|
|
27579
|
+
existingConfig = {};
|
|
27580
|
+
}
|
|
27581
|
+
}
|
|
27582
|
+
const existingServers = existingConfig.servers ?? {};
|
|
27583
|
+
for (const [name, config] of pluginServers) {
|
|
27584
|
+
if (name in existingServers) {
|
|
27585
|
+
if (!deepEqual(existingServers[name], config)) {
|
|
27586
|
+
if (force) {
|
|
27587
|
+
existingServers[name] = config;
|
|
27588
|
+
result.overwritten++;
|
|
27589
|
+
result.overwrittenServers.push(name);
|
|
27590
|
+
} else {
|
|
27591
|
+
result.skipped++;
|
|
27592
|
+
result.skippedServers.push(name);
|
|
27593
|
+
}
|
|
27594
|
+
}
|
|
27595
|
+
} else {
|
|
27596
|
+
existingServers[name] = config;
|
|
27597
|
+
result.added++;
|
|
27598
|
+
result.addedServers.push(name);
|
|
27599
|
+
}
|
|
27600
|
+
}
|
|
27601
|
+
if ((result.added > 0 || result.overwritten > 0) && !dryRun) {
|
|
27602
|
+
existingConfig.servers = existingServers;
|
|
27603
|
+
const dir = dirname6(configPath);
|
|
27604
|
+
if (!existsSync11(dir)) {
|
|
27605
|
+
mkdirSync(dir, { recursive: true });
|
|
27606
|
+
}
|
|
27607
|
+
writeFileSync(configPath, `${JSON.stringify(existingConfig, null, 2)}
|
|
27608
|
+
`, "utf-8");
|
|
27609
|
+
}
|
|
27610
|
+
return result;
|
|
27611
|
+
}
|
|
27612
|
+
var import_json5;
|
|
27613
|
+
var init_vscode_mcp = __esm(() => {
|
|
27614
|
+
init_constants();
|
|
27615
|
+
import_json5 = __toESM(require_lib(), 1);
|
|
27616
|
+
});
|
|
27617
|
+
|
|
27192
27618
|
// src/core/sync.ts
|
|
27193
|
-
import { existsSync as
|
|
27619
|
+
import { existsSync as existsSync12, readFileSync as readFileSync2, writeFileSync as writeFileSync2, lstatSync } from "node:fs";
|
|
27194
27620
|
import { rm as rm4, unlink as unlink2, rmdir, copyFile } from "node:fs/promises";
|
|
27195
|
-
import { join as
|
|
27621
|
+
import { join as join15, resolve as resolve9, dirname as dirname7, relative as relative3 } from "node:path";
|
|
27196
27622
|
function deduplicateClientsByPath(clients, clientMappings = CLIENT_MAPPINGS) {
|
|
27197
27623
|
const pathToClients = new Map;
|
|
27198
27624
|
for (const client of clients) {
|
|
@@ -27216,6 +27642,7 @@ function deduplicateClientsByPath(clients, clientMappings = CLIENT_MAPPINGS) {
|
|
|
27216
27642
|
function mergeSyncResults(a, b) {
|
|
27217
27643
|
const warnings = [...a.warnings || [], ...b.warnings || []];
|
|
27218
27644
|
const purgedPaths = [...a.purgedPaths || [], ...b.purgedPaths || []];
|
|
27645
|
+
const mcpResult = a.mcpResult ?? b.mcpResult;
|
|
27219
27646
|
return {
|
|
27220
27647
|
success: a.success && b.success,
|
|
27221
27648
|
pluginResults: [...a.pluginResults, ...b.pluginResults],
|
|
@@ -27224,7 +27651,8 @@ function mergeSyncResults(a, b) {
|
|
|
27224
27651
|
totalSkipped: a.totalSkipped + b.totalSkipped,
|
|
27225
27652
|
totalGenerated: a.totalGenerated + b.totalGenerated,
|
|
27226
27653
|
...warnings.length > 0 && { warnings },
|
|
27227
|
-
...purgedPaths.length > 0 && { purgedPaths }
|
|
27654
|
+
...purgedPaths.length > 0 && { purgedPaths },
|
|
27655
|
+
...mcpResult && { mcpResult }
|
|
27228
27656
|
};
|
|
27229
27657
|
}
|
|
27230
27658
|
async function selectivePurgeWorkspace(workspacePath, state, clients, options2) {
|
|
@@ -27238,8 +27666,8 @@ async function selectivePurgeWorkspace(workspacePath, state, clients, options2)
|
|
|
27238
27666
|
const previousFiles = getPreviouslySyncedFiles(state, client);
|
|
27239
27667
|
const purgedPaths = [];
|
|
27240
27668
|
for (const filePath of previousFiles) {
|
|
27241
|
-
const fullPath =
|
|
27242
|
-
if (!
|
|
27669
|
+
const fullPath = join15(workspacePath, filePath);
|
|
27670
|
+
if (!existsSync12(fullPath)) {
|
|
27243
27671
|
continue;
|
|
27244
27672
|
}
|
|
27245
27673
|
try {
|
|
@@ -27262,16 +27690,16 @@ async function selectivePurgeWorkspace(workspacePath, state, clients, options2)
|
|
|
27262
27690
|
return result;
|
|
27263
27691
|
}
|
|
27264
27692
|
async function cleanupEmptyParents(workspacePath, filePath) {
|
|
27265
|
-
let parentPath =
|
|
27693
|
+
let parentPath = dirname7(filePath);
|
|
27266
27694
|
while (parentPath && parentPath !== "." && parentPath !== "/") {
|
|
27267
|
-
const fullParentPath =
|
|
27268
|
-
if (!
|
|
27269
|
-
parentPath =
|
|
27695
|
+
const fullParentPath = join15(workspacePath, parentPath);
|
|
27696
|
+
if (!existsSync12(fullParentPath)) {
|
|
27697
|
+
parentPath = dirname7(parentPath);
|
|
27270
27698
|
continue;
|
|
27271
27699
|
}
|
|
27272
27700
|
try {
|
|
27273
27701
|
await rmdir(fullParentPath);
|
|
27274
|
-
parentPath =
|
|
27702
|
+
parentPath = dirname7(parentPath);
|
|
27275
27703
|
} catch {
|
|
27276
27704
|
break;
|
|
27277
27705
|
}
|
|
@@ -27350,8 +27778,8 @@ function validateFileSources(files, defaultSourcePath, githubCache) {
|
|
|
27350
27778
|
errors2.push(`Cannot resolve file '${file}' - no workspace.source configured`);
|
|
27351
27779
|
continue;
|
|
27352
27780
|
}
|
|
27353
|
-
const fullPath =
|
|
27354
|
-
if (!
|
|
27781
|
+
const fullPath = join15(defaultSourcePath, file);
|
|
27782
|
+
if (!existsSync12(fullPath)) {
|
|
27355
27783
|
errors2.push(`File source not found: ${fullPath}`);
|
|
27356
27784
|
}
|
|
27357
27785
|
continue;
|
|
@@ -27369,8 +27797,8 @@ function validateFileSources(files, defaultSourcePath, githubCache) {
|
|
|
27369
27797
|
errors2.push(`GitHub cache not found for ${cacheKey}`);
|
|
27370
27798
|
continue;
|
|
27371
27799
|
}
|
|
27372
|
-
const fullPath =
|
|
27373
|
-
if (!
|
|
27800
|
+
const fullPath = join15(cachePath, parsed.filePath);
|
|
27801
|
+
if (!existsSync12(fullPath)) {
|
|
27374
27802
|
errors2.push(`Path not found in repository: ${cacheKey}/${parsed.filePath}`);
|
|
27375
27803
|
}
|
|
27376
27804
|
} else {
|
|
@@ -27380,11 +27808,11 @@ function validateFileSources(files, defaultSourcePath, githubCache) {
|
|
|
27380
27808
|
} else if (file.source.startsWith("../")) {
|
|
27381
27809
|
fullPath = resolve9(file.source);
|
|
27382
27810
|
} else if (defaultSourcePath) {
|
|
27383
|
-
fullPath =
|
|
27811
|
+
fullPath = join15(defaultSourcePath, file.source);
|
|
27384
27812
|
} else {
|
|
27385
27813
|
fullPath = resolve9(file.source);
|
|
27386
27814
|
}
|
|
27387
|
-
if (!
|
|
27815
|
+
if (!existsSync12(fullPath)) {
|
|
27388
27816
|
errors2.push(`File source not found: ${fullPath}`);
|
|
27389
27817
|
}
|
|
27390
27818
|
}
|
|
@@ -27393,8 +27821,8 @@ function validateFileSources(files, defaultSourcePath, githubCache) {
|
|
|
27393
27821
|
errors2.push(`Cannot resolve file '${file.dest}' - no workspace.source configured and no explicit source provided`);
|
|
27394
27822
|
continue;
|
|
27395
27823
|
}
|
|
27396
|
-
const fullPath =
|
|
27397
|
-
if (!
|
|
27824
|
+
const fullPath = join15(defaultSourcePath, file.dest ?? "");
|
|
27825
|
+
if (!existsSync12(fullPath)) {
|
|
27398
27826
|
errors2.push(`File source not found: ${fullPath}`);
|
|
27399
27827
|
}
|
|
27400
27828
|
}
|
|
@@ -27411,7 +27839,7 @@ function collectSyncedPaths(copyResults, workspacePath, clients, clientMappings)
|
|
|
27411
27839
|
if (copyResult.action !== "copied" && copyResult.action !== "generated") {
|
|
27412
27840
|
continue;
|
|
27413
27841
|
}
|
|
27414
|
-
const relativePath =
|
|
27842
|
+
const relativePath = relative3(workspacePath, copyResult.destination).replace(/\\/g, "/");
|
|
27415
27843
|
for (const client of clients) {
|
|
27416
27844
|
const mapping = mappings[client];
|
|
27417
27845
|
if (mapping.skillsPath && relativePath.startsWith(mapping.skillsPath)) {
|
|
@@ -27462,7 +27890,7 @@ async function validatePlugin(pluginSource, workspacePath, offline) {
|
|
|
27462
27890
|
...fetchResult.error && { error: fetchResult.error }
|
|
27463
27891
|
};
|
|
27464
27892
|
}
|
|
27465
|
-
const resolvedPath2 = parsed?.subpath ?
|
|
27893
|
+
const resolvedPath2 = parsed?.subpath ? join15(fetchResult.cachePath, parsed.subpath) : fetchResult.cachePath;
|
|
27466
27894
|
return {
|
|
27467
27895
|
plugin: pluginSource,
|
|
27468
27896
|
resolved: resolvedPath2,
|
|
@@ -27470,7 +27898,7 @@ async function validatePlugin(pluginSource, workspacePath, offline) {
|
|
|
27470
27898
|
};
|
|
27471
27899
|
}
|
|
27472
27900
|
const resolvedPath = resolve9(workspacePath, pluginSource);
|
|
27473
|
-
if (!
|
|
27901
|
+
if (!existsSync12(resolvedPath)) {
|
|
27474
27902
|
return {
|
|
27475
27903
|
plugin: pluginSource,
|
|
27476
27904
|
resolved: resolvedPath,
|
|
@@ -27587,12 +28015,12 @@ function buildPluginSkillNameMaps(allSkills) {
|
|
|
27587
28015
|
return pluginMaps;
|
|
27588
28016
|
}
|
|
27589
28017
|
function generateVscodeWorkspaceFile(workspacePath, config) {
|
|
27590
|
-
const configDir =
|
|
27591
|
-
const templatePath =
|
|
28018
|
+
const configDir = join15(workspacePath, CONFIG_DIR);
|
|
28019
|
+
const templatePath = join15(configDir, VSCODE_TEMPLATE_FILE);
|
|
27592
28020
|
let template;
|
|
27593
|
-
if (
|
|
28021
|
+
if (existsSync12(templatePath)) {
|
|
27594
28022
|
try {
|
|
27595
|
-
template =
|
|
28023
|
+
template = import_json52.default.parse(readFileSync2(templatePath, "utf-8"));
|
|
27596
28024
|
} catch (error) {
|
|
27597
28025
|
throw new Error(`Failed to parse ${templatePath}: ${error instanceof Error ? error.message : String(error)}`);
|
|
27598
28026
|
}
|
|
@@ -27603,14 +28031,14 @@ function generateVscodeWorkspaceFile(workspacePath, config) {
|
|
|
27603
28031
|
template
|
|
27604
28032
|
});
|
|
27605
28033
|
const outputPath = getWorkspaceOutputPath(workspacePath, config.vscode);
|
|
27606
|
-
|
|
28034
|
+
writeFileSync2(outputPath, `${JSON.stringify(content, null, "\t")}
|
|
27607
28035
|
`, "utf-8");
|
|
27608
28036
|
}
|
|
27609
28037
|
async function syncWorkspace(workspacePath = process.cwd(), options2 = {}) {
|
|
27610
|
-
const { offline = false, dryRun = false, workspaceSourceBase } = options2;
|
|
27611
|
-
const configDir =
|
|
27612
|
-
const configPath =
|
|
27613
|
-
if (!
|
|
28038
|
+
const { offline = false, dryRun = false, workspaceSourceBase, skipAgentFiles = false } = options2;
|
|
28039
|
+
const configDir = join15(workspacePath, CONFIG_DIR);
|
|
28040
|
+
const configPath = join15(configDir, WORKSPACE_CONFIG_FILE);
|
|
28041
|
+
if (!existsSync12(configPath)) {
|
|
27614
28042
|
return {
|
|
27615
28043
|
success: false,
|
|
27616
28044
|
pluginResults: [],
|
|
@@ -27712,8 +28140,8 @@ ${failedValidations.map((v) => ` - ${v.plugin}: ${v.error}`).join(`
|
|
|
27712
28140
|
const filesToCopy = [...config.workspace.files];
|
|
27713
28141
|
if (hasRepositories && sourcePath) {
|
|
27714
28142
|
for (const agentFile of AGENT_FILES) {
|
|
27715
|
-
const agentPath =
|
|
27716
|
-
if (
|
|
28143
|
+
const agentPath = join15(sourcePath, agentFile);
|
|
28144
|
+
if (existsSync12(agentPath) && !filesToCopy.includes(agentFile)) {
|
|
27717
28145
|
filesToCopy.push(agentFile);
|
|
27718
28146
|
}
|
|
27719
28147
|
}
|
|
@@ -27751,17 +28179,17 @@ ${fileValidationErrors.map((e) => ` - ${e}`).join(`
|
|
|
27751
28179
|
`)}`
|
|
27752
28180
|
};
|
|
27753
28181
|
}
|
|
27754
|
-
workspaceFileResults = await copyWorkspaceFiles(sourcePath, workspacePath, filesToCopy, { dryRun, githubCache,
|
|
28182
|
+
workspaceFileResults = await copyWorkspaceFiles(sourcePath, workspacePath, filesToCopy, { dryRun, githubCache, repositories: config.repositories });
|
|
27755
28183
|
if (hasRepositories && !dryRun && clients.includes("claude") && sourcePath) {
|
|
27756
|
-
const claudePath =
|
|
27757
|
-
const agentsPath =
|
|
27758
|
-
const claudeExistsInSource =
|
|
27759
|
-
if (!claudeExistsInSource &&
|
|
28184
|
+
const claudePath = join15(workspacePath, "CLAUDE.md");
|
|
28185
|
+
const agentsPath = join15(workspacePath, "AGENTS.md");
|
|
28186
|
+
const claudeExistsInSource = existsSync12(join15(sourcePath, "CLAUDE.md"));
|
|
28187
|
+
if (!claudeExistsInSource && existsSync12(agentsPath) && !existsSync12(claudePath)) {
|
|
27760
28188
|
await copyFile(agentsPath, claudePath);
|
|
27761
28189
|
}
|
|
27762
28190
|
}
|
|
27763
28191
|
}
|
|
27764
|
-
if (!config.workspace && !dryRun) {
|
|
28192
|
+
if (!config.workspace && !dryRun && !skipAgentFiles) {
|
|
27765
28193
|
await updateAgentFiles(workspacePath);
|
|
27766
28194
|
}
|
|
27767
28195
|
if (clients.includes("vscode") && !dryRun) {
|
|
@@ -27843,7 +28271,7 @@ async function syncUserWorkspace(options2 = {}) {
|
|
|
27843
28271
|
};
|
|
27844
28272
|
}
|
|
27845
28273
|
const clients = config.clients;
|
|
27846
|
-
const { offline = false, dryRun = false } = options2;
|
|
28274
|
+
const { offline = false, dryRun = false, force = false } = options2;
|
|
27847
28275
|
await ensureMarketplacesRegistered(config.plugins);
|
|
27848
28276
|
const validatedPlugins = await validateAllPlugins(config.plugins, homeDir, offline);
|
|
27849
28277
|
const failedValidations = validatedPlugins.filter((v) => !v.success);
|
|
@@ -27902,6 +28330,13 @@ ${failedValidations.map((v) => ` - ${v.plugin}: ${v.error}`).join(`
|
|
|
27902
28330
|
const syncedFiles = collectSyncedPaths(allCopyResults, homeDir, clients, USER_CLIENT_MAPPINGS);
|
|
27903
28331
|
await saveSyncState(homeDir, syncedFiles);
|
|
27904
28332
|
}
|
|
28333
|
+
let mcpResult;
|
|
28334
|
+
if (clients.includes("vscode") && validPlugins.length > 0) {
|
|
28335
|
+
mcpResult = syncVscodeMcpConfig(validPlugins, { dryRun, force });
|
|
28336
|
+
if (mcpResult.warnings.length > 0) {
|
|
28337
|
+
warnings.push(...mcpResult.warnings);
|
|
28338
|
+
}
|
|
28339
|
+
}
|
|
27905
28340
|
return {
|
|
27906
28341
|
success: totalFailed === 0,
|
|
27907
28342
|
pluginResults,
|
|
@@ -27909,10 +28344,11 @@ ${failedValidations.map((v) => ` - ${v.plugin}: ${v.error}`).join(`
|
|
|
27909
28344
|
totalFailed,
|
|
27910
28345
|
totalSkipped,
|
|
27911
28346
|
totalGenerated,
|
|
27912
|
-
...warnings.length > 0 && { warnings }
|
|
28347
|
+
...warnings.length > 0 && { warnings },
|
|
28348
|
+
...mcpResult && { mcpResult }
|
|
27913
28349
|
};
|
|
27914
28350
|
}
|
|
27915
|
-
var
|
|
28351
|
+
var import_json52, VSCODE_TEMPLATE_FILE = "template.code-workspace";
|
|
27916
28352
|
var init_sync = __esm(() => {
|
|
27917
28353
|
init_constants();
|
|
27918
28354
|
init_workspace_parser();
|
|
@@ -27926,16 +28362,17 @@ var init_sync = __esm(() => {
|
|
|
27926
28362
|
init_sync_state2();
|
|
27927
28363
|
init_user_workspace();
|
|
27928
28364
|
init_vscode_workspace();
|
|
27929
|
-
|
|
28365
|
+
init_vscode_mcp();
|
|
28366
|
+
import_json52 = __toESM(require_lib(), 1);
|
|
27930
28367
|
});
|
|
27931
28368
|
|
|
27932
28369
|
// src/core/github-fetch.ts
|
|
27933
|
-
import { existsSync as
|
|
27934
|
-
import { join as
|
|
28370
|
+
import { existsSync as existsSync13, readFileSync as readFileSync3 } from "node:fs";
|
|
28371
|
+
import { join as join16 } from "node:path";
|
|
27935
28372
|
function readFileFromClone(tempDir, filePath) {
|
|
27936
|
-
const fullPath =
|
|
27937
|
-
if (
|
|
27938
|
-
return
|
|
28373
|
+
const fullPath = join16(tempDir, filePath);
|
|
28374
|
+
if (existsSync13(fullPath)) {
|
|
28375
|
+
return readFileSync3(fullPath, "utf-8");
|
|
27939
28376
|
}
|
|
27940
28377
|
return null;
|
|
27941
28378
|
}
|
|
@@ -28028,21 +28465,21 @@ var init_github_fetch = __esm(() => {
|
|
|
28028
28465
|
|
|
28029
28466
|
// src/core/workspace.ts
|
|
28030
28467
|
import { mkdir as mkdir8, readFile as readFile11, writeFile as writeFile7, copyFile as copyFile2 } from "node:fs/promises";
|
|
28031
|
-
import { existsSync as
|
|
28032
|
-
import { join as
|
|
28468
|
+
import { existsSync as existsSync14 } from "node:fs";
|
|
28469
|
+
import { join as join17, resolve as resolve10, dirname as dirname8, relative as relative4, sep as sep2, isAbsolute as isAbsolute4 } from "node:path";
|
|
28033
28470
|
import { fileURLToPath } from "node:url";
|
|
28034
28471
|
async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
28035
28472
|
const absoluteTarget = resolve10(targetPath);
|
|
28036
|
-
const configDir =
|
|
28037
|
-
const configPath =
|
|
28038
|
-
if (
|
|
28473
|
+
const configDir = join17(absoluteTarget, CONFIG_DIR);
|
|
28474
|
+
const configPath = join17(configDir, WORKSPACE_CONFIG_FILE);
|
|
28475
|
+
if (existsSync14(configPath)) {
|
|
28039
28476
|
throw new Error(`Workspace already exists: ${absoluteTarget}
|
|
28040
28477
|
Found existing ${CONFIG_DIR}/${WORKSPACE_CONFIG_FILE}`);
|
|
28041
28478
|
}
|
|
28042
28479
|
const currentFilePath = fileURLToPath(import.meta.url);
|
|
28043
|
-
const currentFileDir =
|
|
28480
|
+
const currentFileDir = dirname8(currentFilePath);
|
|
28044
28481
|
const isProduction = currentFilePath.includes(`${sep2}dist${sep2}`);
|
|
28045
|
-
const defaultTemplatePath = isProduction ?
|
|
28482
|
+
const defaultTemplatePath = isProduction ? join17(currentFileDir, "templates", "default") : join17(currentFileDir, "..", "templates", "default");
|
|
28046
28483
|
let githubTempDir;
|
|
28047
28484
|
try {
|
|
28048
28485
|
await mkdir8(absoluteTarget, { recursive: true });
|
|
@@ -28064,7 +28501,7 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
28064
28501
|
const workspace = parsed2?.workspace;
|
|
28065
28502
|
if (workspace?.source) {
|
|
28066
28503
|
const source = workspace.source;
|
|
28067
|
-
if (!isGitHubUrl(source) && !
|
|
28504
|
+
if (!isGitHubUrl(source) && !isAbsolute4(source)) {
|
|
28068
28505
|
const parsedUrl = parseGitHubUrl(options2.from);
|
|
28069
28506
|
if (parsedUrl) {
|
|
28070
28507
|
const basePath = parsedUrl.subpath || "";
|
|
@@ -28079,19 +28516,19 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
28079
28516
|
console.log(`✓ Using workspace.yaml from: ${options2.from}`);
|
|
28080
28517
|
} else {
|
|
28081
28518
|
const fromPath = resolve10(options2.from);
|
|
28082
|
-
if (!
|
|
28519
|
+
if (!existsSync14(fromPath)) {
|
|
28083
28520
|
throw new Error(`Template not found: ${fromPath}`);
|
|
28084
28521
|
}
|
|
28085
28522
|
const { stat: stat2 } = await import("node:fs/promises");
|
|
28086
28523
|
const fromStat = await stat2(fromPath);
|
|
28087
28524
|
let sourceYamlPath;
|
|
28088
28525
|
if (fromStat.isDirectory()) {
|
|
28089
|
-
const nestedPath =
|
|
28090
|
-
const rootPath =
|
|
28091
|
-
if (
|
|
28526
|
+
const nestedPath = join17(fromPath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
28527
|
+
const rootPath = join17(fromPath, WORKSPACE_CONFIG_FILE);
|
|
28528
|
+
if (existsSync14(nestedPath)) {
|
|
28092
28529
|
sourceYamlPath = nestedPath;
|
|
28093
28530
|
sourceDir = fromPath;
|
|
28094
|
-
} else if (
|
|
28531
|
+
} else if (existsSync14(rootPath)) {
|
|
28095
28532
|
sourceYamlPath = rootPath;
|
|
28096
28533
|
sourceDir = fromPath;
|
|
28097
28534
|
} else {
|
|
@@ -28100,9 +28537,9 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
28100
28537
|
}
|
|
28101
28538
|
} else {
|
|
28102
28539
|
sourceYamlPath = fromPath;
|
|
28103
|
-
const parentDir =
|
|
28540
|
+
const parentDir = dirname8(fromPath);
|
|
28104
28541
|
if (parentDir.endsWith(CONFIG_DIR)) {
|
|
28105
|
-
sourceDir =
|
|
28542
|
+
sourceDir = dirname8(parentDir);
|
|
28106
28543
|
} else {
|
|
28107
28544
|
sourceDir = parentDir;
|
|
28108
28545
|
}
|
|
@@ -28113,7 +28550,7 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
28113
28550
|
const workspace = parsed2?.workspace;
|
|
28114
28551
|
if (workspace?.source) {
|
|
28115
28552
|
const source = workspace.source;
|
|
28116
|
-
if (!isGitHubUrl(source) && !
|
|
28553
|
+
if (!isGitHubUrl(source) && !isAbsolute4(source)) {
|
|
28117
28554
|
workspace.source = resolve10(sourceDir, source);
|
|
28118
28555
|
workspaceYamlContent = dump(parsed2, { lineWidth: -1 });
|
|
28119
28556
|
}
|
|
@@ -28122,8 +28559,8 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
28122
28559
|
console.log(`✓ Using workspace.yaml from: ${sourceYamlPath}`);
|
|
28123
28560
|
}
|
|
28124
28561
|
} else {
|
|
28125
|
-
const defaultYamlPath =
|
|
28126
|
-
if (!
|
|
28562
|
+
const defaultYamlPath = join17(defaultTemplatePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
28563
|
+
if (!existsSync14(defaultYamlPath)) {
|
|
28127
28564
|
throw new Error(`Default template not found at: ${defaultTemplatePath}`);
|
|
28128
28565
|
}
|
|
28129
28566
|
workspaceYamlContent = await readFile11(defaultYamlPath, "utf-8");
|
|
@@ -28138,8 +28575,8 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
28138
28575
|
const clients = parsed?.clients ?? [];
|
|
28139
28576
|
const VSCODE_TEMPLATE_FILE2 = "template.code-workspace";
|
|
28140
28577
|
if (clients.includes("vscode") && options2.from) {
|
|
28141
|
-
const targetTemplatePath =
|
|
28142
|
-
if (!
|
|
28578
|
+
const targetTemplatePath = join17(configDir, VSCODE_TEMPLATE_FILE2);
|
|
28579
|
+
if (!existsSync14(targetTemplatePath)) {
|
|
28143
28580
|
if (isGitHubUrl(options2.from) && githubTempDir) {
|
|
28144
28581
|
const parsedUrl = parseGitHubUrl(options2.from);
|
|
28145
28582
|
if (parsedUrl) {
|
|
@@ -28152,8 +28589,8 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
28152
28589
|
}
|
|
28153
28590
|
}
|
|
28154
28591
|
} else if (sourceDir) {
|
|
28155
|
-
const sourceTemplatePath =
|
|
28156
|
-
if (
|
|
28592
|
+
const sourceTemplatePath = join17(sourceDir, CONFIG_DIR, VSCODE_TEMPLATE_FILE2);
|
|
28593
|
+
if (existsSync14(sourceTemplatePath)) {
|
|
28157
28594
|
await copyFile2(sourceTemplatePath, targetTemplatePath);
|
|
28158
28595
|
}
|
|
28159
28596
|
}
|
|
@@ -28168,8 +28605,8 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
28168
28605
|
if (parsedUrl) {
|
|
28169
28606
|
const basePath = parsedUrl.subpath || "";
|
|
28170
28607
|
for (const agentFile of AGENT_FILES) {
|
|
28171
|
-
const targetFilePath =
|
|
28172
|
-
if (
|
|
28608
|
+
const targetFilePath = join17(absoluteTarget, agentFile);
|
|
28609
|
+
if (existsSync14(targetFilePath)) {
|
|
28173
28610
|
copiedAgentFiles.push(agentFile);
|
|
28174
28611
|
continue;
|
|
28175
28612
|
}
|
|
@@ -28184,13 +28621,13 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
28184
28621
|
} else {
|
|
28185
28622
|
const effectiveSourceDir = sourceDir ?? defaultTemplatePath;
|
|
28186
28623
|
for (const agentFile of AGENT_FILES) {
|
|
28187
|
-
const targetFilePath =
|
|
28188
|
-
if (
|
|
28624
|
+
const targetFilePath = join17(absoluteTarget, agentFile);
|
|
28625
|
+
if (existsSync14(targetFilePath)) {
|
|
28189
28626
|
copiedAgentFiles.push(agentFile);
|
|
28190
28627
|
continue;
|
|
28191
28628
|
}
|
|
28192
|
-
const sourcePath =
|
|
28193
|
-
if (
|
|
28629
|
+
const sourcePath = join17(effectiveSourceDir, agentFile);
|
|
28630
|
+
if (existsSync14(sourcePath)) {
|
|
28194
28631
|
const content = await readFile11(sourcePath, "utf-8");
|
|
28195
28632
|
await writeFile7(targetFilePath, content, "utf-8");
|
|
28196
28633
|
copiedAgentFiles.push(agentFile);
|
|
@@ -28198,16 +28635,16 @@ async function initWorkspace(targetPath = ".", options2 = {}) {
|
|
|
28198
28635
|
}
|
|
28199
28636
|
}
|
|
28200
28637
|
if (copiedAgentFiles.length === 0) {
|
|
28201
|
-
await ensureWorkspaceRules(
|
|
28638
|
+
await ensureWorkspaceRules(join17(absoluteTarget, "AGENTS.md"), repositories);
|
|
28202
28639
|
copiedAgentFiles.push("AGENTS.md");
|
|
28203
28640
|
} else {
|
|
28204
28641
|
for (const agentFile of copiedAgentFiles) {
|
|
28205
|
-
await ensureWorkspaceRules(
|
|
28642
|
+
await ensureWorkspaceRules(join17(absoluteTarget, agentFile), repositories);
|
|
28206
28643
|
}
|
|
28207
28644
|
}
|
|
28208
28645
|
if (clients.includes("claude") && !copiedAgentFiles.includes("CLAUDE.md") && copiedAgentFiles.includes("AGENTS.md")) {
|
|
28209
|
-
const agentsPath =
|
|
28210
|
-
const claudePath =
|
|
28646
|
+
const agentsPath = join17(absoluteTarget, "AGENTS.md");
|
|
28647
|
+
const claudePath = join17(absoluteTarget, "CLAUDE.md");
|
|
28211
28648
|
await copyFile2(agentsPath, claudePath);
|
|
28212
28649
|
}
|
|
28213
28650
|
}
|
|
@@ -28230,7 +28667,7 @@ Syncing plugins...`);
|
|
|
28230
28667
|
if (targetPath !== ".") {
|
|
28231
28668
|
console.log(`
|
|
28232
28669
|
Next steps:`);
|
|
28233
|
-
console.log(` cd ${
|
|
28670
|
+
console.log(` cd ${relative4(process.cwd(), absoluteTarget)}`);
|
|
28234
28671
|
}
|
|
28235
28672
|
return {
|
|
28236
28673
|
path: absoluteTarget,
|
|
@@ -28257,11 +28694,11 @@ var init_workspace = __esm(() => {
|
|
|
28257
28694
|
});
|
|
28258
28695
|
|
|
28259
28696
|
// src/core/status.ts
|
|
28260
|
-
import { existsSync as
|
|
28261
|
-
import { join as
|
|
28697
|
+
import { existsSync as existsSync15 } from "node:fs";
|
|
28698
|
+
import { join as join18 } from "node:path";
|
|
28262
28699
|
async function getWorkspaceStatus(workspacePath = process.cwd()) {
|
|
28263
|
-
const configPath =
|
|
28264
|
-
if (!
|
|
28700
|
+
const configPath = join18(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
28701
|
+
if (!existsSync15(configPath) || isUserConfigPath(workspacePath)) {
|
|
28265
28702
|
const userPlugins = await getUserPluginStatuses();
|
|
28266
28703
|
return {
|
|
28267
28704
|
success: true,
|
|
@@ -28302,7 +28739,7 @@ async function getWorkspaceStatus(workspacePath = process.cwd()) {
|
|
|
28302
28739
|
function getPluginStatus(parsed) {
|
|
28303
28740
|
if (parsed.type === "github") {
|
|
28304
28741
|
const cachePath = parsed.owner && parsed.repo ? getPluginCachePath(parsed.owner, parsed.repo) : "";
|
|
28305
|
-
const available2 = cachePath ?
|
|
28742
|
+
const available2 = cachePath ? existsSync15(cachePath) : false;
|
|
28306
28743
|
return {
|
|
28307
28744
|
source: parsed.original,
|
|
28308
28745
|
type: "github",
|
|
@@ -28312,7 +28749,7 @@ function getPluginStatus(parsed) {
|
|
|
28312
28749
|
...parsed.repo && { repo: parsed.repo }
|
|
28313
28750
|
};
|
|
28314
28751
|
}
|
|
28315
|
-
const available =
|
|
28752
|
+
const available = existsSync15(parsed.normalized);
|
|
28316
28753
|
return {
|
|
28317
28754
|
source: parsed.original,
|
|
28318
28755
|
type: "local",
|
|
@@ -28353,9 +28790,9 @@ var init_status2 = __esm(() => {
|
|
|
28353
28790
|
});
|
|
28354
28791
|
|
|
28355
28792
|
// src/core/skills.ts
|
|
28356
|
-
import { existsSync as
|
|
28793
|
+
import { existsSync as existsSync18 } from "node:fs";
|
|
28357
28794
|
import { readFile as readFile13, readdir as readdir4 } from "node:fs/promises";
|
|
28358
|
-
import { join as
|
|
28795
|
+
import { join as join21, resolve as resolve12 } from "node:path";
|
|
28359
28796
|
async function resolvePluginPath(pluginSource, workspacePath) {
|
|
28360
28797
|
if (isPluginSpec(pluginSource)) {
|
|
28361
28798
|
const resolved2 = await resolvePluginSpecWithAutoRegister(pluginSource, {
|
|
@@ -28371,14 +28808,14 @@ async function resolvePluginPath(pluginSource, workspacePath) {
|
|
|
28371
28808
|
});
|
|
28372
28809
|
if (!result.success)
|
|
28373
28810
|
return null;
|
|
28374
|
-
return parsed?.subpath ?
|
|
28811
|
+
return parsed?.subpath ? join21(result.cachePath, parsed.subpath) : result.cachePath;
|
|
28375
28812
|
}
|
|
28376
28813
|
const resolved = resolve12(workspacePath, pluginSource);
|
|
28377
|
-
return
|
|
28814
|
+
return existsSync18(resolved) ? resolved : null;
|
|
28378
28815
|
}
|
|
28379
28816
|
async function getAllSkillsFromPlugins(workspacePath = process.cwd()) {
|
|
28380
|
-
const configPath =
|
|
28381
|
-
if (!
|
|
28817
|
+
const configPath = join21(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
28818
|
+
if (!existsSync18(configPath)) {
|
|
28382
28819
|
return [];
|
|
28383
28820
|
}
|
|
28384
28821
|
const content = await readFile13(configPath, "utf-8");
|
|
@@ -28390,8 +28827,8 @@ async function getAllSkillsFromPlugins(workspacePath = process.cwd()) {
|
|
|
28390
28827
|
if (!pluginPath)
|
|
28391
28828
|
continue;
|
|
28392
28829
|
const pluginName = await getPluginName(pluginPath);
|
|
28393
|
-
const skillsDir =
|
|
28394
|
-
if (!
|
|
28830
|
+
const skillsDir = join21(pluginPath, "skills");
|
|
28831
|
+
if (!existsSync18(skillsDir))
|
|
28395
28832
|
continue;
|
|
28396
28833
|
const entries = await readdir4(skillsDir, { withFileTypes: true });
|
|
28397
28834
|
const skillDirs = entries.filter((e) => e.isDirectory());
|
|
@@ -28401,7 +28838,7 @@ async function getAllSkillsFromPlugins(workspacePath = process.cwd()) {
|
|
|
28401
28838
|
name: entry.name,
|
|
28402
28839
|
pluginName,
|
|
28403
28840
|
pluginSource,
|
|
28404
|
-
path:
|
|
28841
|
+
path: join21(skillsDir, entry.name),
|
|
28405
28842
|
disabled: disabledSkills.has(skillKey)
|
|
28406
28843
|
});
|
|
28407
28844
|
}
|
|
@@ -28918,7 +29355,7 @@ var package_default;
|
|
|
28918
29355
|
var init_package = __esm(() => {
|
|
28919
29356
|
package_default = {
|
|
28920
29357
|
name: "allagents",
|
|
28921
|
-
version: "0.
|
|
29358
|
+
version: "0.22.1",
|
|
28922
29359
|
description: "CLI tool for managing multi-repo AI agent workspaces with plugin synchronization",
|
|
28923
29360
|
type: "module",
|
|
28924
29361
|
bin: {
|
|
@@ -28988,10 +29425,10 @@ var init_package = __esm(() => {
|
|
|
28988
29425
|
|
|
28989
29426
|
// src/cli/update-check.ts
|
|
28990
29427
|
import { readFile as readFile14 } from "node:fs/promises";
|
|
28991
|
-
import { join as
|
|
29428
|
+
import { join as join23 } from "node:path";
|
|
28992
29429
|
import { spawn as spawn2 } from "node:child_process";
|
|
28993
29430
|
async function getCachedUpdateInfo(path3) {
|
|
28994
|
-
const filePath = path3 ??
|
|
29431
|
+
const filePath = path3 ?? join23(getHomeDir(), CONFIG_DIR, CACHE_FILE);
|
|
28995
29432
|
try {
|
|
28996
29433
|
const raw = await readFile14(filePath, "utf-8");
|
|
28997
29434
|
const data = JSON.parse(raw);
|
|
@@ -29029,8 +29466,8 @@ function buildNotice(currentVersion, latestVersion) {
|
|
|
29029
29466
|
Run \`allagents self update\` to upgrade.`;
|
|
29030
29467
|
}
|
|
29031
29468
|
function backgroundUpdateCheck() {
|
|
29032
|
-
const dir =
|
|
29033
|
-
const filePath =
|
|
29469
|
+
const dir = join23(getHomeDir(), CONFIG_DIR);
|
|
29470
|
+
const filePath = join23(dir, CACHE_FILE);
|
|
29034
29471
|
const script = `
|
|
29035
29472
|
const https = require('https');
|
|
29036
29473
|
const fs = require('fs');
|
|
@@ -30866,15 +31303,15 @@ class TuiCache {
|
|
|
30866
31303
|
}
|
|
30867
31304
|
|
|
30868
31305
|
// src/cli/tui/context.ts
|
|
30869
|
-
import { existsSync as
|
|
30870
|
-
import { join as
|
|
31306
|
+
import { existsSync as existsSync20 } from "node:fs";
|
|
31307
|
+
import { join as join24 } from "node:path";
|
|
30871
31308
|
async function getTuiContext(cwd = process.cwd(), cache2) {
|
|
30872
31309
|
const cachedContext = cache2?.getContext();
|
|
30873
31310
|
if (cachedContext) {
|
|
30874
31311
|
return cachedContext;
|
|
30875
31312
|
}
|
|
30876
|
-
const configPath =
|
|
30877
|
-
const hasWorkspace =
|
|
31313
|
+
const configPath = join24(cwd, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
31314
|
+
const hasWorkspace = existsSync20(configPath) && !isUserConfigPath(cwd);
|
|
30878
31315
|
let projectPluginCount = 0;
|
|
30879
31316
|
if (hasWorkspace) {
|
|
30880
31317
|
try {
|
|
@@ -30967,6 +31404,14 @@ async function runSync(context) {
|
|
|
30967
31404
|
const lines = userResult.pluginResults.map((pr) => `${pr.success ? "✓" : "✗"} ${pr.plugin}`);
|
|
30968
31405
|
lines.push("");
|
|
30969
31406
|
lines.push(`Copied: ${userResult.totalCopied} Failed: ${userResult.totalFailed} Skipped: ${userResult.totalSkipped}`);
|
|
31407
|
+
if (userResult.mcpResult && (userResult.mcpResult.added > 0 || userResult.mcpResult.skipped > 0 || userResult.mcpResult.overwritten > 0)) {
|
|
31408
|
+
const parts = [`${userResult.mcpResult.added} added`];
|
|
31409
|
+
if (userResult.mcpResult.overwritten > 0)
|
|
31410
|
+
parts.push(`${userResult.mcpResult.overwritten} overwritten`);
|
|
31411
|
+
if (userResult.mcpResult.skipped > 0)
|
|
31412
|
+
parts.push(`${userResult.mcpResult.skipped} skipped`);
|
|
31413
|
+
lines.push(`MCP servers: ${parts.join(", ")}`);
|
|
31414
|
+
}
|
|
30970
31415
|
kt2(lines.join(`
|
|
30971
31416
|
`), "User Sync");
|
|
30972
31417
|
}
|
|
@@ -31000,8 +31445,8 @@ async function runInit() {
|
|
|
31000
31445
|
if (Ct(fromSource)) {
|
|
31001
31446
|
return;
|
|
31002
31447
|
}
|
|
31003
|
-
const allClients = ClientTypeSchema.options
|
|
31004
|
-
const defaultClients = ["claude", "copilot", "codex", "opencode"];
|
|
31448
|
+
const allClients = ClientTypeSchema.options;
|
|
31449
|
+
const defaultClients = ["claude", "copilot", "vscode", "codex", "opencode"];
|
|
31005
31450
|
const selectedClients = await multiselect({
|
|
31006
31451
|
message: "Which AI clients do you use?",
|
|
31007
31452
|
options: allClients.map((c) => ({
|
|
@@ -31559,7 +32004,7 @@ async function runManageClients(context, cache2) {
|
|
|
31559
32004
|
const userConfig = await getUserWorkspaceConfig();
|
|
31560
32005
|
currentClients = userConfig?.clients ?? [];
|
|
31561
32006
|
}
|
|
31562
|
-
const allClients = ClientTypeSchema.options
|
|
32007
|
+
const allClients = ClientTypeSchema.options;
|
|
31563
32008
|
const selectedClients = await multiselect3({
|
|
31564
32009
|
message: `Select AI clients [${scope}]`,
|
|
31565
32010
|
options: allClients.map((c) => ({
|
|
@@ -31740,7 +32185,7 @@ __export(exports_wizard, {
|
|
|
31740
32185
|
runWizard: () => runWizard,
|
|
31741
32186
|
buildMenuOptions: () => buildMenuOptions
|
|
31742
32187
|
});
|
|
31743
|
-
import { relative as
|
|
32188
|
+
import { relative as relative5 } from "node:path";
|
|
31744
32189
|
function buildMenuOptions(context) {
|
|
31745
32190
|
const options2 = [];
|
|
31746
32191
|
if (context.needsSync) {
|
|
@@ -31757,7 +32202,7 @@ function buildMenuOptions(context) {
|
|
|
31757
32202
|
function buildSummary(context) {
|
|
31758
32203
|
const lines = [];
|
|
31759
32204
|
if (context.hasWorkspace && context.workspacePath) {
|
|
31760
|
-
const relPath =
|
|
32205
|
+
const relPath = relative5(process.cwd(), context.workspacePath) || ".";
|
|
31761
32206
|
lines.push(`Workspace: ${relPath}`);
|
|
31762
32207
|
lines.push(`Project plugins: ${context.projectPluginCount}`);
|
|
31763
32208
|
} else {
|
|
@@ -31887,8 +32332,8 @@ init_workspace();
|
|
|
31887
32332
|
init_sync();
|
|
31888
32333
|
init_status2();
|
|
31889
32334
|
var import_cmd_ts2 = __toESM(require_cjs(), 1);
|
|
31890
|
-
import { existsSync as
|
|
31891
|
-
import { join as
|
|
32335
|
+
import { existsSync as existsSync17 } from "node:fs";
|
|
32336
|
+
import { join as join20, resolve as resolve11 } from "node:path";
|
|
31892
32337
|
|
|
31893
32338
|
// src/core/prune.ts
|
|
31894
32339
|
init_js_yaml();
|
|
@@ -31896,8 +32341,8 @@ init_constants();
|
|
|
31896
32341
|
init_marketplace();
|
|
31897
32342
|
init_user_workspace();
|
|
31898
32343
|
import { readFile as readFile12, writeFile as writeFile8 } from "node:fs/promises";
|
|
31899
|
-
import { existsSync as
|
|
31900
|
-
import { join as
|
|
32344
|
+
import { existsSync as existsSync16 } from "node:fs";
|
|
32345
|
+
import { join as join19 } from "node:path";
|
|
31901
32346
|
async function isOrphanedPlugin(pluginSpec) {
|
|
31902
32347
|
if (!isPluginSpec(pluginSpec))
|
|
31903
32348
|
return false;
|
|
@@ -31921,8 +32366,8 @@ async function prunePlugins(plugins) {
|
|
|
31921
32366
|
}
|
|
31922
32367
|
async function pruneOrphanedPlugins(workspacePath) {
|
|
31923
32368
|
let projectResult = { removed: [], kept: [] };
|
|
31924
|
-
const projectConfigPath =
|
|
31925
|
-
if (
|
|
32369
|
+
const projectConfigPath = join19(workspacePath, CONFIG_DIR, WORKSPACE_CONFIG_FILE);
|
|
32370
|
+
if (existsSync16(projectConfigPath) && !isUserConfigPath(workspacePath)) {
|
|
31926
32371
|
const content = await readFile12(projectConfigPath, "utf-8");
|
|
31927
32372
|
const config = load(content);
|
|
31928
32373
|
projectResult = await prunePlugins(config.plugins);
|
|
@@ -32121,7 +32566,17 @@ function buildSyncData(result) {
|
|
|
32121
32566
|
failed: pr.copyResults.filter((r) => r.action === "failed").length,
|
|
32122
32567
|
copyResults: pr.copyResults
|
|
32123
32568
|
})),
|
|
32124
|
-
purgedPaths: result.purgedPaths ?? []
|
|
32569
|
+
purgedPaths: result.purgedPaths ?? [],
|
|
32570
|
+
...result.mcpResult && {
|
|
32571
|
+
mcpServers: {
|
|
32572
|
+
added: result.mcpResult.added,
|
|
32573
|
+
skipped: result.mcpResult.skipped,
|
|
32574
|
+
overwritten: result.mcpResult.overwritten,
|
|
32575
|
+
addedServers: result.mcpResult.addedServers,
|
|
32576
|
+
skippedServers: result.mcpResult.skippedServers,
|
|
32577
|
+
overwrittenServers: result.mcpResult.overwrittenServers
|
|
32578
|
+
}
|
|
32579
|
+
}
|
|
32125
32580
|
};
|
|
32126
32581
|
}
|
|
32127
32582
|
var initCmd = import_cmd_ts2.command({
|
|
@@ -32195,9 +32650,10 @@ var syncCmd = import_cmd_ts2.command({
|
|
|
32195
32650
|
args: {
|
|
32196
32651
|
offline: import_cmd_ts2.flag({ long: "offline", description: "Use cached plugins without fetching latest from remote" }),
|
|
32197
32652
|
dryRun: import_cmd_ts2.flag({ long: "dry-run", short: "n", description: "Simulate sync without making changes" }),
|
|
32653
|
+
force: import_cmd_ts2.flag({ long: "force", short: "f", description: "Overwrite existing MCP server entries that differ from plugin config" }),
|
|
32198
32654
|
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
32655
|
},
|
|
32200
|
-
handler: async ({ offline, dryRun, client }) => {
|
|
32656
|
+
handler: async ({ offline, dryRun, force, client }) => {
|
|
32201
32657
|
try {
|
|
32202
32658
|
if (!isJsonMode() && dryRun) {
|
|
32203
32659
|
console.log(`Dry run mode - no changes will be made
|
|
@@ -32208,8 +32664,8 @@ var syncCmd = import_cmd_ts2.command({
|
|
|
32208
32664
|
`);
|
|
32209
32665
|
}
|
|
32210
32666
|
const userConfigExists = !!await getUserWorkspaceConfig();
|
|
32211
|
-
const projectConfigPath =
|
|
32212
|
-
const projectConfigExists =
|
|
32667
|
+
const projectConfigPath = join20(process.cwd(), ".allagents", "workspace.yaml");
|
|
32668
|
+
const projectConfigExists = existsSync17(projectConfigPath);
|
|
32213
32669
|
if (!userConfigExists && !projectConfigExists) {
|
|
32214
32670
|
await ensureUserWorkspace();
|
|
32215
32671
|
if (isJsonMode()) {
|
|
@@ -32225,7 +32681,7 @@ var syncCmd = import_cmd_ts2.command({
|
|
|
32225
32681
|
console.log(`Syncing user workspace...
|
|
32226
32682
|
`);
|
|
32227
32683
|
}
|
|
32228
|
-
const userResult = await syncUserWorkspace({ offline, dryRun });
|
|
32684
|
+
const userResult = await syncUserWorkspace({ offline, dryRun, force });
|
|
32229
32685
|
combined = userResult;
|
|
32230
32686
|
}
|
|
32231
32687
|
if (projectConfigExists) {
|
|
@@ -32292,6 +32748,21 @@ Warnings:`);
|
|
|
32292
32748
|
console.log(` ⚠ ${warning}`);
|
|
32293
32749
|
}
|
|
32294
32750
|
}
|
|
32751
|
+
if (result.mcpResult && (result.mcpResult.added > 0 || result.mcpResult.skipped > 0 || result.mcpResult.overwritten > 0)) {
|
|
32752
|
+
const parts = [`${result.mcpResult.added} added`];
|
|
32753
|
+
if (result.mcpResult.overwritten > 0)
|
|
32754
|
+
parts.push(`${result.mcpResult.overwritten} overwritten`);
|
|
32755
|
+
if (result.mcpResult.skipped > 0)
|
|
32756
|
+
parts.push(`${result.mcpResult.skipped} skipped`);
|
|
32757
|
+
console.log(`
|
|
32758
|
+
MCP servers: ${parts.join(", ")}`);
|
|
32759
|
+
for (const name of result.mcpResult.addedServers) {
|
|
32760
|
+
console.log(` + ${name}`);
|
|
32761
|
+
}
|
|
32762
|
+
for (const name of result.mcpResult.overwrittenServers) {
|
|
32763
|
+
console.log(` ~ ${name}`);
|
|
32764
|
+
}
|
|
32765
|
+
}
|
|
32295
32766
|
console.log(`
|
|
32296
32767
|
Sync complete${dryRun ? " (dry run)" : ""}:`);
|
|
32297
32768
|
console.log(` Total ${dryRun ? "would copy" : "copied"}: ${result.totalCopied}`);
|
|
@@ -32610,6 +33081,8 @@ init_marketplace();
|
|
|
32610
33081
|
init_sync();
|
|
32611
33082
|
init_workspace_modify();
|
|
32612
33083
|
init_user_workspace();
|
|
33084
|
+
init_plugin();
|
|
33085
|
+
init_marketplace_manifest_parser();
|
|
32613
33086
|
var import_cmd_ts4 = __toESM(require_cjs(), 1);
|
|
32614
33087
|
|
|
32615
33088
|
// src/cli/metadata/plugin.ts
|
|
@@ -32776,6 +33249,35 @@ var pluginUninstallMeta = {
|
|
|
32776
33249
|
}
|
|
32777
33250
|
}
|
|
32778
33251
|
};
|
|
33252
|
+
var pluginUpdateMeta = {
|
|
33253
|
+
command: "plugin update",
|
|
33254
|
+
description: "Update installed plugins to latest version and sync plugin files (skips AGENTS.md)",
|
|
33255
|
+
whenToUse: "To pull the latest changes for installed plugins and deploy plugin files only, without regenerating AGENTS.md",
|
|
33256
|
+
examples: [
|
|
33257
|
+
"allagents plugin update",
|
|
33258
|
+
"allagents plugin update my-plugin@official",
|
|
33259
|
+
"allagents plugin update --scope user"
|
|
33260
|
+
],
|
|
33261
|
+
expectedOutput: "Shows update status per plugin, then syncs plugin files. Exit 0 if all succeed, exit 1 if any fail.",
|
|
33262
|
+
positionals: [
|
|
33263
|
+
{ name: "plugin", type: "string", required: false, description: "Specific plugin to update (updates all if omitted)" }
|
|
33264
|
+
],
|
|
33265
|
+
options: [
|
|
33266
|
+
{ flag: "--scope", short: "-s", type: "string", description: 'Installation scope: "project" (default), "user", or "all"' }
|
|
33267
|
+
],
|
|
33268
|
+
outputSchema: {
|
|
33269
|
+
results: [{ plugin: "string", success: "boolean", action: "string", error: "string | undefined" }],
|
|
33270
|
+
updated: "number",
|
|
33271
|
+
skipped: "number",
|
|
33272
|
+
failed: "number",
|
|
33273
|
+
syncResult: {
|
|
33274
|
+
copied: "number",
|
|
33275
|
+
generated: "number",
|
|
33276
|
+
failed: "number",
|
|
33277
|
+
skipped: "number"
|
|
33278
|
+
}
|
|
33279
|
+
}
|
|
33280
|
+
};
|
|
32779
33281
|
|
|
32780
33282
|
// src/cli/commands/plugin-skills.ts
|
|
32781
33283
|
init_source();
|
|
@@ -32784,8 +33286,8 @@ init_workspace_modify();
|
|
|
32784
33286
|
init_user_workspace();
|
|
32785
33287
|
init_skills();
|
|
32786
33288
|
var import_cmd_ts3 = __toESM(require_cjs(), 1);
|
|
32787
|
-
import { existsSync as
|
|
32788
|
-
import { join as
|
|
33289
|
+
import { existsSync as existsSync19 } from "node:fs";
|
|
33290
|
+
import { join as join22 } from "node:path";
|
|
32789
33291
|
|
|
32790
33292
|
// src/cli/metadata/plugin-skills.ts
|
|
32791
33293
|
var skillsListMeta = {
|
|
@@ -32853,7 +33355,7 @@ var skillsAddMeta = {
|
|
|
32853
33355
|
// src/cli/commands/plugin-skills.ts
|
|
32854
33356
|
init_constants();
|
|
32855
33357
|
function hasProjectConfig(dir) {
|
|
32856
|
-
return
|
|
33358
|
+
return existsSync19(join22(dir, CONFIG_DIR, WORKSPACE_CONFIG_FILE));
|
|
32857
33359
|
}
|
|
32858
33360
|
function resolveScope(cwd) {
|
|
32859
33361
|
if (isUserConfigPath(cwd))
|
|
@@ -33239,13 +33741,13 @@ function buildSyncData2(result) {
|
|
|
33239
33741
|
purgedPaths: result.purgedPaths ?? []
|
|
33240
33742
|
};
|
|
33241
33743
|
}
|
|
33242
|
-
async function runSyncAndPrint() {
|
|
33744
|
+
async function runSyncAndPrint(options2) {
|
|
33243
33745
|
if (!isJsonMode()) {
|
|
33244
33746
|
console.log(`
|
|
33245
33747
|
Syncing workspace...
|
|
33246
33748
|
`);
|
|
33247
33749
|
}
|
|
33248
|
-
const result = await syncWorkspace();
|
|
33750
|
+
const result = await syncWorkspace(process.cwd(), options2);
|
|
33249
33751
|
if (!result.success && result.error) {
|
|
33250
33752
|
if (!isJsonMode()) {
|
|
33251
33753
|
console.error(`Sync error: ${result.error}`);
|
|
@@ -33927,12 +34429,188 @@ var pluginUninstallCmd = import_cmd_ts4.command({
|
|
|
33927
34429
|
}
|
|
33928
34430
|
}
|
|
33929
34431
|
});
|
|
34432
|
+
var pluginUpdateCmd = import_cmd_ts4.command({
|
|
34433
|
+
name: "update",
|
|
34434
|
+
description: buildDescription(pluginUpdateMeta),
|
|
34435
|
+
args: {
|
|
34436
|
+
plugin: import_cmd_ts4.positional({ type: import_cmd_ts4.optional(import_cmd_ts4.string), displayName: "plugin" }),
|
|
34437
|
+
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"' })
|
|
34438
|
+
},
|
|
34439
|
+
handler: async ({ plugin, scope }) => {
|
|
34440
|
+
try {
|
|
34441
|
+
const updateAll = scope === "all";
|
|
34442
|
+
const updateUser = scope === "user" || updateAll;
|
|
34443
|
+
const updateProject = scope === "project" || !scope && !updateAll || updateAll;
|
|
34444
|
+
const pluginsToUpdate = [];
|
|
34445
|
+
if (updateProject && !isUserConfigPath(process.cwd())) {
|
|
34446
|
+
const projectPlugins = await getInstalledProjectPlugins(process.cwd());
|
|
34447
|
+
for (const p of projectPlugins) {
|
|
34448
|
+
pluginsToUpdate.push(p.spec);
|
|
34449
|
+
}
|
|
34450
|
+
}
|
|
34451
|
+
if (updateUser) {
|
|
34452
|
+
const userPlugins = await getInstalledUserPlugins();
|
|
34453
|
+
for (const p of userPlugins) {
|
|
34454
|
+
if (!pluginsToUpdate.includes(p.spec)) {
|
|
34455
|
+
pluginsToUpdate.push(p.spec);
|
|
34456
|
+
}
|
|
34457
|
+
}
|
|
34458
|
+
}
|
|
34459
|
+
if (updateProject && !isUserConfigPath(process.cwd())) {
|
|
34460
|
+
const { existsSync: existsSync20 } = await import("node:fs");
|
|
34461
|
+
const { readFile: readFile14 } = await import("node:fs/promises");
|
|
34462
|
+
const { join: join23 } = await import("node:path");
|
|
34463
|
+
const { load: load2 } = await Promise.resolve().then(() => (init_js_yaml(), exports_js_yaml));
|
|
34464
|
+
const { CONFIG_DIR: CONFIG_DIR2, WORKSPACE_CONFIG_FILE: WORKSPACE_CONFIG_FILE2 } = await Promise.resolve().then(() => (init_constants(), exports_constants));
|
|
34465
|
+
const configPath = join23(process.cwd(), CONFIG_DIR2, WORKSPACE_CONFIG_FILE2);
|
|
34466
|
+
if (existsSync20(configPath)) {
|
|
34467
|
+
const content = await readFile14(configPath, "utf-8");
|
|
34468
|
+
const config = load2(content);
|
|
34469
|
+
for (const p of config.plugins ?? []) {
|
|
34470
|
+
if (!pluginsToUpdate.includes(p)) {
|
|
34471
|
+
pluginsToUpdate.push(p);
|
|
34472
|
+
}
|
|
34473
|
+
}
|
|
34474
|
+
}
|
|
34475
|
+
}
|
|
34476
|
+
if (updateUser) {
|
|
34477
|
+
const userConfig = await getUserWorkspaceConfig();
|
|
34478
|
+
if (userConfig) {
|
|
34479
|
+
for (const p of userConfig.plugins ?? []) {
|
|
34480
|
+
if (!pluginsToUpdate.includes(p)) {
|
|
34481
|
+
pluginsToUpdate.push(p);
|
|
34482
|
+
}
|
|
34483
|
+
}
|
|
34484
|
+
}
|
|
34485
|
+
}
|
|
34486
|
+
const toUpdate = plugin ? pluginsToUpdate.filter((p) => {
|
|
34487
|
+
if (p === plugin)
|
|
34488
|
+
return true;
|
|
34489
|
+
const parsed = parsePluginSpec(p);
|
|
34490
|
+
return parsed?.plugin === plugin || p.endsWith(`/${plugin}`);
|
|
34491
|
+
}) : pluginsToUpdate;
|
|
34492
|
+
if (plugin && toUpdate.length === 0) {
|
|
34493
|
+
const error = `Plugin not found: ${plugin}`;
|
|
34494
|
+
if (isJsonMode()) {
|
|
34495
|
+
jsonOutput({ success: false, command: "plugin update", error });
|
|
34496
|
+
process.exit(1);
|
|
34497
|
+
}
|
|
34498
|
+
console.error(`Error: ${error}`);
|
|
34499
|
+
process.exit(1);
|
|
34500
|
+
}
|
|
34501
|
+
if (toUpdate.length === 0) {
|
|
34502
|
+
if (isJsonMode()) {
|
|
34503
|
+
jsonOutput({
|
|
34504
|
+
success: true,
|
|
34505
|
+
command: "plugin update",
|
|
34506
|
+
data: { results: [], updated: 0, skipped: 0, failed: 0 }
|
|
34507
|
+
});
|
|
34508
|
+
return;
|
|
34509
|
+
}
|
|
34510
|
+
console.log("No plugins to update.");
|
|
34511
|
+
return;
|
|
34512
|
+
}
|
|
34513
|
+
if (!isJsonMode()) {
|
|
34514
|
+
console.log(plugin ? `Updating plugin: ${plugin}...` : "Updating plugins...");
|
|
34515
|
+
console.log();
|
|
34516
|
+
}
|
|
34517
|
+
const results = [];
|
|
34518
|
+
const updatedMarketplaces = new Set;
|
|
34519
|
+
const deps = {
|
|
34520
|
+
parsePluginSpec,
|
|
34521
|
+
getMarketplace,
|
|
34522
|
+
parseMarketplaceManifest,
|
|
34523
|
+
updateMarketplace: async (name) => {
|
|
34524
|
+
if (updatedMarketplaces.has(name)) {
|
|
34525
|
+
return [{ name, success: true }];
|
|
34526
|
+
}
|
|
34527
|
+
const result = await updateMarketplace(name);
|
|
34528
|
+
if (result[0]?.success) {
|
|
34529
|
+
updatedMarketplaces.add(name);
|
|
34530
|
+
}
|
|
34531
|
+
return result;
|
|
34532
|
+
}
|
|
34533
|
+
};
|
|
34534
|
+
for (const pluginSpec of toUpdate) {
|
|
34535
|
+
const result = await updatePlugin(pluginSpec, deps);
|
|
34536
|
+
results.push(result);
|
|
34537
|
+
if (!isJsonMode()) {
|
|
34538
|
+
const icon = result.success ? result.action === "updated" ? "✓" : "-" : "✗";
|
|
34539
|
+
const actionLabel = result.action === "updated" ? "updated" : result.action === "skipped" ? "skipped" : "failed";
|
|
34540
|
+
console.log(`${icon} ${pluginSpec} (${actionLabel})`);
|
|
34541
|
+
if (result.error) {
|
|
34542
|
+
console.log(` Error: ${result.error}`);
|
|
34543
|
+
}
|
|
34544
|
+
}
|
|
34545
|
+
}
|
|
34546
|
+
const updated = results.filter((r) => r.action === "updated").length;
|
|
34547
|
+
const skipped = results.filter((r) => r.action === "skipped").length;
|
|
34548
|
+
const failed = results.filter((r) => r.action === "failed").length;
|
|
34549
|
+
let syncOk = true;
|
|
34550
|
+
let syncData = null;
|
|
34551
|
+
if (updated > 0) {
|
|
34552
|
+
if (updateProject && !isUserConfigPath(process.cwd())) {
|
|
34553
|
+
const { ok, syncData: data } = await runSyncAndPrint({ skipAgentFiles: true });
|
|
34554
|
+
if (!ok)
|
|
34555
|
+
syncOk = false;
|
|
34556
|
+
syncData = data;
|
|
34557
|
+
}
|
|
34558
|
+
if (updateUser) {
|
|
34559
|
+
const { ok, syncData: data } = await runUserSyncAndPrint();
|
|
34560
|
+
if (!ok)
|
|
34561
|
+
syncOk = false;
|
|
34562
|
+
if (!syncData)
|
|
34563
|
+
syncData = data;
|
|
34564
|
+
}
|
|
34565
|
+
}
|
|
34566
|
+
if (isJsonMode()) {
|
|
34567
|
+
jsonOutput({
|
|
34568
|
+
success: failed === 0 && syncOk,
|
|
34569
|
+
command: "plugin update",
|
|
34570
|
+
data: {
|
|
34571
|
+
results: results.map((r) => ({
|
|
34572
|
+
plugin: r.plugin,
|
|
34573
|
+
success: r.success,
|
|
34574
|
+
action: r.action,
|
|
34575
|
+
...r.error && { error: r.error }
|
|
34576
|
+
})),
|
|
34577
|
+
updated,
|
|
34578
|
+
skipped,
|
|
34579
|
+
failed,
|
|
34580
|
+
...syncData && { syncResult: syncData }
|
|
34581
|
+
},
|
|
34582
|
+
...failed > 0 && { error: `${failed} plugin(s) failed to update` }
|
|
34583
|
+
});
|
|
34584
|
+
if (failed > 0 || !syncOk) {
|
|
34585
|
+
process.exit(1);
|
|
34586
|
+
}
|
|
34587
|
+
return;
|
|
34588
|
+
}
|
|
34589
|
+
console.log();
|
|
34590
|
+
console.log(`Update complete: ${updated} updated, ${skipped} skipped, ${failed} failed`);
|
|
34591
|
+
if (failed > 0 || !syncOk) {
|
|
34592
|
+
process.exit(1);
|
|
34593
|
+
}
|
|
34594
|
+
} catch (error) {
|
|
34595
|
+
if (error instanceof Error) {
|
|
34596
|
+
if (isJsonMode()) {
|
|
34597
|
+
jsonOutput({ success: false, command: "plugin update", error: error.message });
|
|
34598
|
+
process.exit(1);
|
|
34599
|
+
}
|
|
34600
|
+
console.error(`Error: ${error.message}`);
|
|
34601
|
+
process.exit(1);
|
|
34602
|
+
}
|
|
34603
|
+
throw error;
|
|
34604
|
+
}
|
|
34605
|
+
}
|
|
34606
|
+
});
|
|
33930
34607
|
var pluginCmd = conciseSubcommands({
|
|
33931
34608
|
name: "plugin",
|
|
33932
34609
|
description: "Manage plugins and marketplaces",
|
|
33933
34610
|
cmds: {
|
|
33934
34611
|
install: pluginInstallCmd,
|
|
33935
34612
|
uninstall: pluginUninstallCmd,
|
|
34613
|
+
update: pluginUpdateCmd,
|
|
33936
34614
|
marketplace: marketplaceCmd,
|
|
33937
34615
|
list: pluginListCmd,
|
|
33938
34616
|
validate: pluginValidateCmd,
|
|
@@ -34888,7 +35566,7 @@ var addPipeMethods = (spawned) => {
|
|
|
34888
35566
|
};
|
|
34889
35567
|
|
|
34890
35568
|
// node_modules/execa/lib/stream.js
|
|
34891
|
-
import { createReadStream, readFileSync as
|
|
35569
|
+
import { createReadStream, readFileSync as readFileSync4 } from "node:fs";
|
|
34892
35570
|
import { setTimeout as setTimeout2 } from "node:timers/promises";
|
|
34893
35571
|
|
|
34894
35572
|
// node_modules/get-stream/source/contents.js
|
|
@@ -35084,7 +35762,7 @@ var getInputSync = ({ input, inputFile }) => {
|
|
|
35084
35762
|
return input;
|
|
35085
35763
|
}
|
|
35086
35764
|
validateInputOptions(input);
|
|
35087
|
-
return
|
|
35765
|
+
return readFileSync4(inputFile);
|
|
35088
35766
|
};
|
|
35089
35767
|
var handleInputSync = (options2) => {
|
|
35090
35768
|
const input = getInputSync(options2);
|