@mcpc-tech/cli 0.1.44 → 0.1.45

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.
Files changed (3) hide show
  1. package/bin/mcpc.cjs +2182 -98
  2. package/bin/mcpc.mjs +2176 -92
  3. package/package.json +1 -2
package/bin/mcpc.cjs CHANGED
@@ -48,15 +48,15 @@ var require_windows = __commonJS({
48
48
  }
49
49
  return false;
50
50
  }
51
- function checkStat(stat, path, options) {
52
- if (!stat.isSymbolicLink() && !stat.isFile()) {
51
+ function checkStat(stat2, path, options) {
52
+ if (!stat2.isSymbolicLink() && !stat2.isFile()) {
53
53
  return false;
54
54
  }
55
55
  return checkPathExt(path, options);
56
56
  }
57
57
  function isexe(path, options, cb) {
58
- fs.stat(path, function(er, stat) {
59
- cb(er, er ? false : checkStat(stat, path, options));
58
+ fs.stat(path, function(er, stat2) {
59
+ cb(er, er ? false : checkStat(stat2, path, options));
60
60
  });
61
61
  }
62
62
  function sync(path, options) {
@@ -72,20 +72,20 @@ var require_mode = __commonJS({
72
72
  isexe.sync = sync;
73
73
  var fs = require("fs");
74
74
  function isexe(path, options, cb) {
75
- fs.stat(path, function(er, stat) {
76
- cb(er, er ? false : checkStat(stat, options));
75
+ fs.stat(path, function(er, stat2) {
76
+ cb(er, er ? false : checkStat(stat2, options));
77
77
  });
78
78
  }
79
79
  function sync(path, options) {
80
80
  return checkStat(fs.statSync(path), options);
81
81
  }
82
- function checkStat(stat, options) {
83
- return stat.isFile() && checkMode(stat, options);
82
+ function checkStat(stat2, options) {
83
+ return stat2.isFile() && checkMode(stat2, options);
84
84
  }
85
- function checkMode(stat, options) {
86
- var mod = stat.mode;
87
- var uid = stat.uid;
88
- var gid = stat.gid;
85
+ function checkMode(stat2, options) {
86
+ var mod = stat2.mode;
87
+ var uid = stat2.uid;
88
+ var gid = stat2.gid;
89
89
  var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
90
90
  var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
91
91
  var u = parseInt("100", 8);
@@ -158,11 +158,11 @@ var require_which = __commonJS({
158
158
  "__mcpc__cli_latest/node_modules/which/which.js"(exports2, module2) {
159
159
  var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
160
160
  var path = require("path");
161
- var COLON = isWindows ? ";" : ":";
161
+ var COLON2 = isWindows ? ";" : ":";
162
162
  var isexe = require_isexe();
163
163
  var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
164
164
  var getPathInfo = (cmd, opt) => {
165
- const colon = opt.colon || COLON;
165
+ const colon = opt.colon || COLON2;
166
166
  const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [
167
167
  // windows always checks the cwd first
168
168
  ...isWindows ? [process.cwd()] : [],
@@ -352,11 +352,11 @@ var require_shebang_command = __commonJS({
352
352
  return null;
353
353
  }
354
354
  const [path, argument] = match[0].replace(/#! ?/, "").split(" ");
355
- const binary = path.split("/").pop();
356
- if (binary === "env") {
355
+ const binary2 = path.split("/").pop();
356
+ if (binary2 === "env") {
357
357
  return argument;
358
358
  }
359
- return argument ? `${binary} ${argument}` : binary;
359
+ return argument ? `${binary2} ${argument}` : binary2;
360
360
  };
361
361
  }
362
362
  });
@@ -422,7 +422,7 @@ var require_parse = __commonJS({
422
422
  }
423
423
  return parsed;
424
424
  }
425
- function parse(command, args, options) {
425
+ function parse2(command, args, options) {
426
426
  if (args && !Array.isArray(args)) {
427
427
  options = args;
428
428
  args = null;
@@ -441,7 +441,7 @@ var require_parse = __commonJS({
441
441
  };
442
442
  return options.shell ? parsed : parseNonShell(parsed);
443
443
  }
444
- module2.exports = parse;
444
+ module2.exports = parse2;
445
445
  }
446
446
  });
447
447
 
@@ -500,16 +500,16 @@ var require_cross_spawn = __commonJS({
500
500
  "__mcpc__cli_latest/node_modules/cross-spawn/index.js"(exports2, module2) {
501
501
  "use strict";
502
502
  var cp = require("child_process");
503
- var parse = require_parse();
503
+ var parse2 = require_parse();
504
504
  var enoent = require_enoent();
505
505
  function spawn2(command, args, options) {
506
- const parsed = parse(command, args, options);
506
+ const parsed = parse2(command, args, options);
507
507
  const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
508
508
  enoent.hookChildProcess(spawned, parsed);
509
509
  return spawned;
510
510
  }
511
511
  function spawnSync(command, args, options) {
512
- const parsed = parse(command, args, options);
512
+ const parsed = parse2(command, args, options);
513
513
  const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
514
514
  result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
515
515
  return result;
@@ -517,7 +517,7 @@ var require_cross_spawn = __commonJS({
517
517
  module2.exports = spawn2;
518
518
  module2.exports.spawn = spawn2;
519
519
  module2.exports.sync = spawnSync;
520
- module2.exports._parse = parse;
520
+ module2.exports._parse = parse2;
521
521
  module2.exports._enoent = enoent;
522
522
  }
523
523
  });
@@ -2419,9 +2419,9 @@ function hasNested(object5, keys) {
2419
2419
  return true;
2420
2420
  }
2421
2421
  function aliasIsBoolean(aliasMap, booleanSet, key) {
2422
- const set = aliasMap.get(key);
2423
- if (set === void 0) return false;
2424
- for (const alias of set) if (booleanSet.has(alias)) return true;
2422
+ const set2 = aliasMap.get(key);
2423
+ if (set2 === void 0) return false;
2424
+ for (const alias of set2) if (booleanSet.has(alias)) return true;
2425
2425
  return false;
2426
2426
  }
2427
2427
  function isBooleanString(value) {
@@ -2636,10 +2636,10 @@ function parseArgs(args, options) {
2636
2636
  }
2637
2637
 
2638
2638
  // __mcpc__cli_latest/node_modules/@mcpc/cli/src/config/loader.js
2639
- var import_promises3 = require("node:fs/promises");
2639
+ var import_promises4 = require("node:fs/promises");
2640
2640
  var import_node_os3 = require("node:os");
2641
2641
  var import_node_path6 = require("node:path");
2642
- var import_node_process3 = __toESM(require("node:process"), 1);
2642
+ var import_node_process4 = __toESM(require("node:process"), 1);
2643
2643
 
2644
2644
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/plugins/large-result.js
2645
2645
  var import_promises = require("node:fs/promises");
@@ -3198,17 +3198,2058 @@ Available skills: ${available.join(", ")}` : "\n\nNo skills available.";
3198
3198
 
3199
3199
  // __mcpc__cli_latest/node_modules/@mcpc/cli/src/defaults.js
3200
3200
  var import_plugin_code_execution = require("@mcpc-tech/plugin-code-execution");
3201
- var import_plugin_markdown_loader = require("@mcpc-tech/plugin-markdown-loader");
3202
- var import_node_path5 = require("node:path");
3201
+
3202
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__plugin-markdown-loader/src/markdown-loader.js
3203
+ var import_promises3 = require("node:fs/promises");
3204
+
3205
+ // __mcpc__cli_latest/node_modules/@jsr/std__yaml/_chars.js
3206
+ var TAB = 9;
3207
+ var LINE_FEED = 10;
3208
+ var CARRIAGE_RETURN = 13;
3209
+ var SPACE = 32;
3210
+ var EXCLAMATION = 33;
3211
+ var DOUBLE_QUOTE = 34;
3212
+ var SHARP = 35;
3213
+ var PERCENT = 37;
3214
+ var AMPERSAND = 38;
3215
+ var SINGLE_QUOTE = 39;
3216
+ var ASTERISK = 42;
3217
+ var PLUS = 43;
3218
+ var COMMA = 44;
3219
+ var MINUS = 45;
3220
+ var DOT = 46;
3221
+ var COLON = 58;
3222
+ var SMALLER_THAN = 60;
3223
+ var GREATER_THAN = 62;
3224
+ var QUESTION = 63;
3225
+ var COMMERCIAL_AT = 64;
3226
+ var LEFT_SQUARE_BRACKET = 91;
3227
+ var BACKSLASH = 92;
3228
+ var RIGHT_SQUARE_BRACKET = 93;
3229
+ var GRAVE_ACCENT = 96;
3230
+ var LEFT_CURLY_BRACKET = 123;
3231
+ var VERTICAL_LINE = 124;
3232
+ var RIGHT_CURLY_BRACKET = 125;
3233
+ function isEOL(c) {
3234
+ return c === LINE_FEED || c === CARRIAGE_RETURN;
3235
+ }
3236
+ function isWhiteSpace(c) {
3237
+ return c === TAB || c === SPACE;
3238
+ }
3239
+ function isWhiteSpaceOrEOL(c) {
3240
+ return isWhiteSpace(c) || isEOL(c);
3241
+ }
3242
+ function isFlowIndicator(c) {
3243
+ return c === COMMA || c === LEFT_SQUARE_BRACKET || c === RIGHT_SQUARE_BRACKET || c === LEFT_CURLY_BRACKET || c === RIGHT_CURLY_BRACKET;
3244
+ }
3245
+
3246
+ // __mcpc__cli_latest/node_modules/@jsr/std__yaml/_type/binary.js
3247
+ var BASE64_MAP = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";
3248
+ function resolveYamlBinary(data) {
3249
+ if (data === null) return false;
3250
+ let code;
3251
+ let bitlen = 0;
3252
+ const max = data.length;
3253
+ const map2 = BASE64_MAP;
3254
+ for (let idx = 0; idx < max; idx++) {
3255
+ code = map2.indexOf(data.charAt(idx));
3256
+ if (code > 64) continue;
3257
+ if (code < 0) return false;
3258
+ bitlen += 6;
3259
+ }
3260
+ return bitlen % 8 === 0;
3261
+ }
3262
+ function constructYamlBinary(data) {
3263
+ const input = data.replace(/[\r\n=]/g, "");
3264
+ const max = input.length;
3265
+ const map2 = BASE64_MAP;
3266
+ const result = [];
3267
+ let bits = 0;
3268
+ for (let idx = 0; idx < max; idx++) {
3269
+ if (idx % 4 === 0 && idx) {
3270
+ result.push(bits >> 16 & 255);
3271
+ result.push(bits >> 8 & 255);
3272
+ result.push(bits & 255);
3273
+ }
3274
+ bits = bits << 6 | map2.indexOf(input.charAt(idx));
3275
+ }
3276
+ const tailbits = max % 4 * 6;
3277
+ if (tailbits === 0) {
3278
+ result.push(bits >> 16 & 255);
3279
+ result.push(bits >> 8 & 255);
3280
+ result.push(bits & 255);
3281
+ } else if (tailbits === 18) {
3282
+ result.push(bits >> 10 & 255);
3283
+ result.push(bits >> 2 & 255);
3284
+ } else if (tailbits === 12) {
3285
+ result.push(bits >> 4 & 255);
3286
+ }
3287
+ return new Uint8Array(result);
3288
+ }
3289
+ function representYamlBinary(object5) {
3290
+ const max = object5.length;
3291
+ const map2 = BASE64_MAP;
3292
+ let result = "";
3293
+ let bits = 0;
3294
+ for (let idx = 0; idx < max; idx++) {
3295
+ if (idx % 3 === 0 && idx) {
3296
+ result += map2[bits >> 18 & 63];
3297
+ result += map2[bits >> 12 & 63];
3298
+ result += map2[bits >> 6 & 63];
3299
+ result += map2[bits & 63];
3300
+ }
3301
+ bits = (bits << 8) + object5[idx];
3302
+ }
3303
+ const tail = max % 3;
3304
+ if (tail === 0) {
3305
+ result += map2[bits >> 18 & 63];
3306
+ result += map2[bits >> 12 & 63];
3307
+ result += map2[bits >> 6 & 63];
3308
+ result += map2[bits & 63];
3309
+ } else if (tail === 2) {
3310
+ result += map2[bits >> 10 & 63];
3311
+ result += map2[bits >> 4 & 63];
3312
+ result += map2[bits << 2 & 63];
3313
+ result += map2[64];
3314
+ } else if (tail === 1) {
3315
+ result += map2[bits >> 2 & 63];
3316
+ result += map2[bits << 4 & 63];
3317
+ result += map2[64];
3318
+ result += map2[64];
3319
+ }
3320
+ return result;
3321
+ }
3322
+ function isBinary(obj) {
3323
+ return obj instanceof Uint8Array;
3324
+ }
3325
+ var binary = {
3326
+ tag: "tag:yaml.org,2002:binary",
3327
+ construct: constructYamlBinary,
3328
+ kind: "scalar",
3329
+ predicate: isBinary,
3330
+ represent: representYamlBinary,
3331
+ resolve: resolveYamlBinary
3332
+ };
3333
+
3334
+ // __mcpc__cli_latest/node_modules/@jsr/std__yaml/_type/bool.js
3335
+ var YAML_TRUE_BOOLEANS = [
3336
+ "true",
3337
+ "True",
3338
+ "TRUE"
3339
+ ];
3340
+ var YAML_FALSE_BOOLEANS = [
3341
+ "false",
3342
+ "False",
3343
+ "FALSE"
3344
+ ];
3345
+ var YAML_BOOLEANS = [
3346
+ ...YAML_TRUE_BOOLEANS,
3347
+ ...YAML_FALSE_BOOLEANS
3348
+ ];
3349
+ var bool = {
3350
+ tag: "tag:yaml.org,2002:bool",
3351
+ kind: "scalar",
3352
+ defaultStyle: "lowercase",
3353
+ predicate: (value) => typeof value === "boolean" || value instanceof Boolean,
3354
+ construct: (data) => YAML_TRUE_BOOLEANS.includes(data),
3355
+ resolve: (data) => YAML_BOOLEANS.includes(data),
3356
+ represent: {
3357
+ // deno-lint-ignore ban-types
3358
+ lowercase: (object5) => {
3359
+ const value = object5 instanceof Boolean ? object5.valueOf() : object5;
3360
+ return value ? "true" : "false";
3361
+ },
3362
+ // deno-lint-ignore ban-types
3363
+ uppercase: (object5) => {
3364
+ const value = object5 instanceof Boolean ? object5.valueOf() : object5;
3365
+ return value ? "TRUE" : "FALSE";
3366
+ },
3367
+ // deno-lint-ignore ban-types
3368
+ camelcase: (object5) => {
3369
+ const value = object5 instanceof Boolean ? object5.valueOf() : object5;
3370
+ return value ? "True" : "False";
3371
+ }
3372
+ }
3373
+ };
3374
+
3375
+ // __mcpc__cli_latest/node_modules/@jsr/std__yaml/_utils.js
3376
+ function isObject(value) {
3377
+ return value !== null && typeof value === "object";
3378
+ }
3379
+ function isNegativeZero(i) {
3380
+ return i === 0 && Number.NEGATIVE_INFINITY === 1 / i;
3381
+ }
3382
+ function isPlainObject(object5) {
3383
+ return Object.prototype.toString.call(object5) === "[object Object]";
3384
+ }
3385
+
3386
+ // __mcpc__cli_latest/node_modules/@jsr/std__yaml/_type/float.js
3387
+ var YAML_FLOAT_PATTERN = new RegExp(
3388
+ // 2.5e4, 2.5 and integers
3389
+ "^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"
3390
+ );
3391
+ function resolveYamlFloat(data) {
3392
+ if (!YAML_FLOAT_PATTERN.test(data) || // Quick hack to not allow integers end with `_`
3393
+ // Probably should update regexp & check speed
3394
+ data[data.length - 1] === "_") {
3395
+ return false;
3396
+ }
3397
+ return true;
3398
+ }
3399
+ function constructYamlFloat(data) {
3400
+ let value = data.replace(/_/g, "").toLowerCase();
3401
+ const sign = value[0] === "-" ? -1 : 1;
3402
+ if (value[0] && "+-".includes(value[0])) {
3403
+ value = value.slice(1);
3404
+ }
3405
+ if (value === ".inf") {
3406
+ return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
3407
+ }
3408
+ if (value === ".nan") {
3409
+ return NaN;
3410
+ }
3411
+ return sign * parseFloat(value);
3412
+ }
3413
+ var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
3414
+ function representYamlFloat(object5, style) {
3415
+ const value = object5 instanceof Number ? object5.valueOf() : object5;
3416
+ if (isNaN(value)) {
3417
+ switch (style) {
3418
+ case "lowercase":
3419
+ return ".nan";
3420
+ case "uppercase":
3421
+ return ".NAN";
3422
+ case "camelcase":
3423
+ return ".NaN";
3424
+ }
3425
+ } else if (Number.POSITIVE_INFINITY === value) {
3426
+ switch (style) {
3427
+ case "lowercase":
3428
+ return ".inf";
3429
+ case "uppercase":
3430
+ return ".INF";
3431
+ case "camelcase":
3432
+ return ".Inf";
3433
+ }
3434
+ } else if (Number.NEGATIVE_INFINITY === value) {
3435
+ switch (style) {
3436
+ case "lowercase":
3437
+ return "-.inf";
3438
+ case "uppercase":
3439
+ return "-.INF";
3440
+ case "camelcase":
3441
+ return "-.Inf";
3442
+ }
3443
+ } else if (isNegativeZero(value)) {
3444
+ return "-0.0";
3445
+ }
3446
+ const res = value.toString(10);
3447
+ return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace("e", ".e") : res;
3448
+ }
3449
+ function isFloat(object5) {
3450
+ if (object5 instanceof Number) object5 = object5.valueOf();
3451
+ return typeof object5 === "number" && (object5 % 1 !== 0 || isNegativeZero(object5));
3452
+ }
3453
+ var float = {
3454
+ tag: "tag:yaml.org,2002:float",
3455
+ construct: constructYamlFloat,
3456
+ defaultStyle: "lowercase",
3457
+ kind: "scalar",
3458
+ predicate: isFloat,
3459
+ represent: representYamlFloat,
3460
+ resolve: resolveYamlFloat
3461
+ };
3462
+
3463
+ // __mcpc__cli_latest/node_modules/@jsr/std__yaml/_type/int.js
3464
+ function isCharCodeInRange(c, lower, upper) {
3465
+ return lower <= c && c <= upper;
3466
+ }
3467
+ function isHexCode(c) {
3468
+ return isCharCodeInRange(c, 48, 57) || // 0-9
3469
+ isCharCodeInRange(c, 65, 70) || // A-F
3470
+ isCharCodeInRange(c, 97, 102);
3471
+ }
3472
+ function isOctCode(c) {
3473
+ return isCharCodeInRange(c, 48, 55);
3474
+ }
3475
+ function isDecCode(c) {
3476
+ return isCharCodeInRange(c, 48, 57);
3477
+ }
3478
+ function resolveYamlInteger(data) {
3479
+ const max = data.length;
3480
+ let index = 0;
3481
+ let hasDigits = false;
3482
+ if (!max) return false;
3483
+ let ch = data[index];
3484
+ if (ch === "-" || ch === "+") {
3485
+ ch = data[++index];
3486
+ }
3487
+ if (ch === "0") {
3488
+ if (index + 1 === max) return true;
3489
+ ch = data[++index];
3490
+ if (ch === "b") {
3491
+ index++;
3492
+ for (; index < max; index++) {
3493
+ ch = data[index];
3494
+ if (ch === "_") continue;
3495
+ if (ch !== "0" && ch !== "1") return false;
3496
+ hasDigits = true;
3497
+ }
3498
+ return hasDigits && ch !== "_";
3499
+ }
3500
+ if (ch === "x") {
3501
+ index++;
3502
+ for (; index < max; index++) {
3503
+ ch = data[index];
3504
+ if (ch === "_") continue;
3505
+ if (!isHexCode(data.charCodeAt(index))) return false;
3506
+ hasDigits = true;
3507
+ }
3508
+ return hasDigits && ch !== "_";
3509
+ }
3510
+ for (; index < max; index++) {
3511
+ ch = data[index];
3512
+ if (ch === "_") continue;
3513
+ if (!isOctCode(data.charCodeAt(index))) return false;
3514
+ hasDigits = true;
3515
+ }
3516
+ return hasDigits && ch !== "_";
3517
+ }
3518
+ if (ch === "_") return false;
3519
+ for (; index < max; index++) {
3520
+ ch = data[index];
3521
+ if (ch === "_") continue;
3522
+ if (!isDecCode(data.charCodeAt(index))) {
3523
+ return false;
3524
+ }
3525
+ hasDigits = true;
3526
+ }
3527
+ if (!hasDigits || ch === "_") return false;
3528
+ return /^(:[0-5]?[0-9])+$/.test(data.slice(index));
3529
+ }
3530
+ function constructYamlInteger(data) {
3531
+ let value = data;
3532
+ if (value.includes("_")) {
3533
+ value = value.replace(/_/g, "");
3534
+ }
3535
+ let sign = 1;
3536
+ let ch = value[0];
3537
+ if (ch === "-" || ch === "+") {
3538
+ if (ch === "-") sign = -1;
3539
+ value = value.slice(1);
3540
+ ch = value[0];
3541
+ }
3542
+ if (value === "0") return 0;
3543
+ if (ch === "0") {
3544
+ if (value[1] === "b") return sign * parseInt(value.slice(2), 2);
3545
+ if (value[1] === "x") return sign * parseInt(value, 16);
3546
+ return sign * parseInt(value, 8);
3547
+ }
3548
+ return sign * parseInt(value, 10);
3549
+ }
3550
+ function isInteger(object5) {
3551
+ if (object5 instanceof Number) object5 = object5.valueOf();
3552
+ return typeof object5 === "number" && object5 % 1 === 0 && !isNegativeZero(object5);
3553
+ }
3554
+ var int = {
3555
+ tag: "tag:yaml.org,2002:int",
3556
+ construct: constructYamlInteger,
3557
+ defaultStyle: "decimal",
3558
+ kind: "scalar",
3559
+ predicate: isInteger,
3560
+ represent: {
3561
+ // deno-lint-ignore ban-types
3562
+ binary(object5) {
3563
+ const value = object5 instanceof Number ? object5.valueOf() : object5;
3564
+ return value >= 0 ? `0b${value.toString(2)}` : `-0b${value.toString(2).slice(1)}`;
3565
+ },
3566
+ // deno-lint-ignore ban-types
3567
+ octal(object5) {
3568
+ const value = object5 instanceof Number ? object5.valueOf() : object5;
3569
+ return value >= 0 ? `0${value.toString(8)}` : `-0${value.toString(8).slice(1)}`;
3570
+ },
3571
+ // deno-lint-ignore ban-types
3572
+ decimal(object5) {
3573
+ const value = object5 instanceof Number ? object5.valueOf() : object5;
3574
+ return value.toString(10);
3575
+ },
3576
+ // deno-lint-ignore ban-types
3577
+ hexadecimal(object5) {
3578
+ const value = object5 instanceof Number ? object5.valueOf() : object5;
3579
+ return value >= 0 ? `0x${value.toString(16).toUpperCase()}` : `-0x${value.toString(16).toUpperCase().slice(1)}`;
3580
+ }
3581
+ },
3582
+ resolve: resolveYamlInteger
3583
+ };
3584
+
3585
+ // __mcpc__cli_latest/node_modules/@jsr/std__yaml/_type/map.js
3586
+ var map = {
3587
+ tag: "tag:yaml.org,2002:map",
3588
+ resolve() {
3589
+ return true;
3590
+ },
3591
+ construct(data) {
3592
+ return data !== null ? data : {};
3593
+ },
3594
+ kind: "mapping"
3595
+ };
3596
+
3597
+ // __mcpc__cli_latest/node_modules/@jsr/std__yaml/_type/merge.js
3598
+ var merge = {
3599
+ tag: "tag:yaml.org,2002:merge",
3600
+ kind: "scalar",
3601
+ resolve: (data) => data === "<<" || data === null,
3602
+ construct: (data) => data
3603
+ };
3604
+
3605
+ // __mcpc__cli_latest/node_modules/@jsr/std__yaml/_type/nil.js
3606
+ var nil = {
3607
+ tag: "tag:yaml.org,2002:null",
3608
+ kind: "scalar",
3609
+ defaultStyle: "lowercase",
3610
+ predicate: (object5) => object5 === null,
3611
+ construct: () => null,
3612
+ resolve: (data) => {
3613
+ return data === "~" || data === "null" || data === "Null" || data === "NULL";
3614
+ },
3615
+ represent: {
3616
+ lowercase: () => "null",
3617
+ uppercase: () => "NULL",
3618
+ camelcase: () => "Null"
3619
+ }
3620
+ };
3621
+
3622
+ // __mcpc__cli_latest/node_modules/@jsr/std__yaml/_type/omap.js
3623
+ function resolveYamlOmap(data) {
3624
+ const objectKeys = /* @__PURE__ */ new Set();
3625
+ for (const object5 of data) {
3626
+ if (!isPlainObject(object5)) return false;
3627
+ const keys = Object.keys(object5);
3628
+ if (keys.length !== 1) return false;
3629
+ for (const key of keys) {
3630
+ if (objectKeys.has(key)) return false;
3631
+ objectKeys.add(key);
3632
+ }
3633
+ }
3634
+ return true;
3635
+ }
3636
+ var omap = {
3637
+ tag: "tag:yaml.org,2002:omap",
3638
+ kind: "sequence",
3639
+ resolve: resolveYamlOmap,
3640
+ construct(data) {
3641
+ return data;
3642
+ }
3643
+ };
3644
+
3645
+ // __mcpc__cli_latest/node_modules/@jsr/std__yaml/_type/pairs.js
3646
+ function resolveYamlPairs(data) {
3647
+ if (data === null) return true;
3648
+ return data.every((it) => isPlainObject(it) && Object.keys(it).length === 1);
3649
+ }
3650
+ var pairs = {
3651
+ tag: "tag:yaml.org,2002:pairs",
3652
+ construct(data) {
3653
+ return data?.flatMap(Object.entries) ?? [];
3654
+ },
3655
+ kind: "sequence",
3656
+ resolve: resolveYamlPairs
3657
+ };
3658
+
3659
+ // __mcpc__cli_latest/node_modules/@jsr/std__yaml/_type/regexp.js
3660
+ var REGEXP = /^\/(?<regexp>[\s\S]+)\/(?<modifiers>[gismuy]*)$/;
3661
+ var regexp = {
3662
+ tag: "tag:yaml.org,2002:js/regexp",
3663
+ kind: "scalar",
3664
+ resolve(data) {
3665
+ if (data === null || !data.length) return false;
3666
+ if (data.charAt(0) === "/") {
3667
+ const groups = data.match(REGEXP)?.groups;
3668
+ if (!groups) return false;
3669
+ const modifiers = groups.modifiers ?? "";
3670
+ if (new Set(modifiers).size < modifiers.length) return false;
3671
+ }
3672
+ return true;
3673
+ },
3674
+ construct(data) {
3675
+ const { regexp: regexp2 = data, modifiers = "" } = data.match(REGEXP)?.groups ?? {};
3676
+ return new RegExp(regexp2, modifiers);
3677
+ },
3678
+ predicate: (object5) => object5 instanceof RegExp,
3679
+ represent: (object5) => object5.toString()
3680
+ };
3681
+
3682
+ // __mcpc__cli_latest/node_modules/@jsr/std__yaml/_type/seq.js
3683
+ var seq = {
3684
+ tag: "tag:yaml.org,2002:seq",
3685
+ kind: "sequence",
3686
+ resolve: () => true,
3687
+ construct: (data) => data !== null ? data : []
3688
+ };
3689
+
3690
+ // __mcpc__cli_latest/node_modules/@jsr/std__yaml/_type/set.js
3691
+ var set = {
3692
+ tag: "tag:yaml.org,2002:set",
3693
+ kind: "mapping",
3694
+ construct: (data) => data !== null ? data : {},
3695
+ resolve: (data) => {
3696
+ if (data === null) return true;
3697
+ return Object.values(data).every((it) => it === null);
3698
+ }
3699
+ };
3700
+
3701
+ // __mcpc__cli_latest/node_modules/@jsr/std__yaml/_type/str.js
3702
+ var str = {
3703
+ tag: "tag:yaml.org,2002:str",
3704
+ kind: "scalar",
3705
+ resolve: () => true,
3706
+ construct: (data) => data !== null ? data : ""
3707
+ };
3708
+
3709
+ // __mcpc__cli_latest/node_modules/@jsr/std__yaml/_type/timestamp.js
3710
+ var YAML_DATE_REGEXP = new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$");
3711
+ var YAML_TIMESTAMP_REGEXP = 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]))?))?$");
3712
+ function resolveYamlTimestamp(data) {
3713
+ if (data === null) return false;
3714
+ if (YAML_DATE_REGEXP.exec(data) !== null) return true;
3715
+ if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true;
3716
+ return false;
3717
+ }
3718
+ function constructYamlTimestamp(data) {
3719
+ let match = YAML_DATE_REGEXP.exec(data);
3720
+ if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data);
3721
+ if (match === null) {
3722
+ throw new Error("Cannot construct YAML timestamp: date resolve error");
3723
+ }
3724
+ const year = +match[1];
3725
+ const month = +match[2] - 1;
3726
+ const day = +match[3];
3727
+ if (!match[4]) {
3728
+ return new Date(Date.UTC(year, month, day));
3729
+ }
3730
+ const hour = +match[4];
3731
+ const minute = +match[5];
3732
+ const second = +match[6];
3733
+ let fraction = 0;
3734
+ if (match[7]) {
3735
+ let partFraction = match[7].slice(0, 3);
3736
+ while (partFraction.length < 3) {
3737
+ partFraction += "0";
3738
+ }
3739
+ fraction = +partFraction;
3740
+ }
3741
+ let delta = null;
3742
+ if (match[9] && match[10]) {
3743
+ const tzHour = +match[10];
3744
+ const tzMinute = +(match[11] || 0);
3745
+ delta = (tzHour * 60 + tzMinute) * 6e4;
3746
+ if (match[9] === "-") delta = -delta;
3747
+ }
3748
+ const date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
3749
+ if (delta) date.setTime(date.getTime() - delta);
3750
+ return date;
3751
+ }
3752
+ function representYamlTimestamp(date) {
3753
+ return date.toISOString();
3754
+ }
3755
+ var timestamp = {
3756
+ tag: "tag:yaml.org,2002:timestamp",
3757
+ construct: constructYamlTimestamp,
3758
+ predicate(object5) {
3759
+ return object5 instanceof Date;
3760
+ },
3761
+ kind: "scalar",
3762
+ represent: representYamlTimestamp,
3763
+ resolve: resolveYamlTimestamp
3764
+ };
3765
+
3766
+ // __mcpc__cli_latest/node_modules/@jsr/std__yaml/_type/undefined.js
3767
+ var undefinedType = {
3768
+ tag: "tag:yaml.org,2002:js/undefined",
3769
+ kind: "scalar",
3770
+ resolve() {
3771
+ return true;
3772
+ },
3773
+ construct() {
3774
+ return void 0;
3775
+ },
3776
+ predicate(object5) {
3777
+ return typeof object5 === "undefined";
3778
+ },
3779
+ represent() {
3780
+ return "";
3781
+ }
3782
+ };
3783
+
3784
+ // __mcpc__cli_latest/node_modules/@jsr/std__yaml/_schema.js
3785
+ function createTypeMap(implicitTypes, explicitTypes) {
3786
+ const result = {
3787
+ fallback: /* @__PURE__ */ new Map(),
3788
+ mapping: /* @__PURE__ */ new Map(),
3789
+ scalar: /* @__PURE__ */ new Map(),
3790
+ sequence: /* @__PURE__ */ new Map()
3791
+ };
3792
+ const fallbackMap = result.fallback;
3793
+ for (const type of [
3794
+ ...implicitTypes,
3795
+ ...explicitTypes
3796
+ ]) {
3797
+ const map2 = result[type.kind];
3798
+ map2.set(type.tag, type);
3799
+ fallbackMap.set(type.tag, type);
3800
+ }
3801
+ return result;
3802
+ }
3803
+ function createSchema({ explicitTypes = [], implicitTypes = [], include }) {
3804
+ if (include) {
3805
+ implicitTypes.push(...include.implicitTypes);
3806
+ explicitTypes.push(...include.explicitTypes);
3807
+ }
3808
+ const typeMap = createTypeMap(implicitTypes, explicitTypes);
3809
+ return {
3810
+ implicitTypes,
3811
+ explicitTypes,
3812
+ typeMap
3813
+ };
3814
+ }
3815
+ var FAILSAFE_SCHEMA = createSchema({
3816
+ explicitTypes: [
3817
+ str,
3818
+ seq,
3819
+ map
3820
+ ]
3821
+ });
3822
+ var JSON_SCHEMA = createSchema({
3823
+ implicitTypes: [
3824
+ nil,
3825
+ bool,
3826
+ int,
3827
+ float
3828
+ ],
3829
+ include: FAILSAFE_SCHEMA
3830
+ });
3831
+ var CORE_SCHEMA = createSchema({
3832
+ include: JSON_SCHEMA
3833
+ });
3834
+ var DEFAULT_SCHEMA = createSchema({
3835
+ explicitTypes: [
3836
+ binary,
3837
+ omap,
3838
+ pairs,
3839
+ set
3840
+ ],
3841
+ implicitTypes: [
3842
+ timestamp,
3843
+ merge
3844
+ ],
3845
+ include: CORE_SCHEMA
3846
+ });
3847
+ var EXTENDED_SCHEMA = createSchema({
3848
+ explicitTypes: [
3849
+ regexp,
3850
+ undefinedType
3851
+ ],
3852
+ include: DEFAULT_SCHEMA
3853
+ });
3854
+ var SCHEMA_MAP = /* @__PURE__ */ new Map([
3855
+ [
3856
+ "core",
3857
+ CORE_SCHEMA
3858
+ ],
3859
+ [
3860
+ "default",
3861
+ DEFAULT_SCHEMA
3862
+ ],
3863
+ [
3864
+ "failsafe",
3865
+ FAILSAFE_SCHEMA
3866
+ ],
3867
+ [
3868
+ "json",
3869
+ JSON_SCHEMA
3870
+ ],
3871
+ [
3872
+ "extended",
3873
+ EXTENDED_SCHEMA
3874
+ ]
3875
+ ]);
3876
+
3877
+ // __mcpc__cli_latest/node_modules/@jsr/std__yaml/_loader_state.js
3878
+ var CONTEXT_FLOW_IN = 1;
3879
+ var CONTEXT_FLOW_OUT = 2;
3880
+ var CONTEXT_BLOCK_IN = 3;
3881
+ var CONTEXT_BLOCK_OUT = 4;
3882
+ var CHOMPING_CLIP = 1;
3883
+ var CHOMPING_STRIP = 2;
3884
+ var CHOMPING_KEEP = 3;
3885
+ var PATTERN_NON_PRINTABLE = (
3886
+ // deno-lint-ignore no-control-regex
3887
+ /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/
3888
+ );
3889
+ var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
3890
+ var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
3891
+ var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
3892
+ var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
3893
+ var ESCAPED_HEX_LENGTHS = /* @__PURE__ */ new Map([
3894
+ [
3895
+ 120,
3896
+ 2
3897
+ ],
3898
+ [
3899
+ 117,
3900
+ 4
3901
+ ],
3902
+ [
3903
+ 85,
3904
+ 8
3905
+ ]
3906
+ ]);
3907
+ var SIMPLE_ESCAPE_SEQUENCES = /* @__PURE__ */ new Map([
3908
+ [
3909
+ 48,
3910
+ "\0"
3911
+ ],
3912
+ [
3913
+ 97,
3914
+ "\x07"
3915
+ ],
3916
+ [
3917
+ 98,
3918
+ "\b"
3919
+ ],
3920
+ [
3921
+ 116,
3922
+ " "
3923
+ ],
3924
+ [
3925
+ 9,
3926
+ " "
3927
+ ],
3928
+ [
3929
+ 110,
3930
+ "\n"
3931
+ ],
3932
+ [
3933
+ 118,
3934
+ "\v"
3935
+ ],
3936
+ [
3937
+ 102,
3938
+ "\f"
3939
+ ],
3940
+ [
3941
+ 114,
3942
+ "\r"
3943
+ ],
3944
+ [
3945
+ 101,
3946
+ "\x1B"
3947
+ ],
3948
+ [
3949
+ 32,
3950
+ " "
3951
+ ],
3952
+ [
3953
+ 34,
3954
+ '"'
3955
+ ],
3956
+ [
3957
+ 47,
3958
+ "/"
3959
+ ],
3960
+ [
3961
+ 92,
3962
+ "\\"
3963
+ ],
3964
+ [
3965
+ 78,
3966
+ "\x85"
3967
+ ],
3968
+ [
3969
+ 95,
3970
+ "\xA0"
3971
+ ],
3972
+ [
3973
+ 76,
3974
+ "\u2028"
3975
+ ],
3976
+ [
3977
+ 80,
3978
+ "\u2029"
3979
+ ]
3980
+ ]);
3981
+ function hexCharCodeToNumber(charCode) {
3982
+ if (48 <= charCode && charCode <= 57) return charCode - 48;
3983
+ const lc = charCode | 32;
3984
+ if (97 <= lc && lc <= 102) return lc - 97 + 10;
3985
+ return -1;
3986
+ }
3987
+ function decimalCharCodeToNumber(charCode) {
3988
+ if (48 <= charCode && charCode <= 57) return charCode - 48;
3989
+ return -1;
3990
+ }
3991
+ function codepointToChar(codepoint) {
3992
+ if (codepoint <= 65535) return String.fromCharCode(codepoint);
3993
+ return String.fromCharCode((codepoint - 65536 >> 10) + 55296, (codepoint - 65536 & 1023) + 56320);
3994
+ }
3995
+ var INDENT = 4;
3996
+ var MAX_LENGTH = 75;
3997
+ var DELIMITERS = "\0\r\n\x85\u2028\u2029";
3998
+ function getSnippet(buffer, position) {
3999
+ if (!buffer) return null;
4000
+ let start = position;
4001
+ let end = position;
4002
+ let head = "";
4003
+ let tail = "";
4004
+ while (start > 0 && !DELIMITERS.includes(buffer.charAt(start - 1))) {
4005
+ start--;
4006
+ if (position - start > MAX_LENGTH / 2 - 1) {
4007
+ head = " ... ";
4008
+ start += 5;
4009
+ break;
4010
+ }
4011
+ }
4012
+ while (end < buffer.length && !DELIMITERS.includes(buffer.charAt(end))) {
4013
+ end++;
4014
+ if (end - position > MAX_LENGTH / 2 - 1) {
4015
+ tail = " ... ";
4016
+ end -= 5;
4017
+ break;
4018
+ }
4019
+ }
4020
+ const snippet = buffer.slice(start, end);
4021
+ const indent = " ".repeat(INDENT);
4022
+ const caretIndent = " ".repeat(INDENT + position - start + head.length);
4023
+ return `${indent + head + snippet + tail}
4024
+ ${caretIndent}^`;
4025
+ }
4026
+ function markToString(buffer, position, line, column) {
4027
+ let where = `at line ${line + 1}, column ${column + 1}`;
4028
+ const snippet = getSnippet(buffer, position);
4029
+ if (snippet) where += `:
4030
+ ${snippet}`;
4031
+ return where;
4032
+ }
4033
+ function getIndentStatus(lineIndent, parentIndent) {
4034
+ if (lineIndent > parentIndent) return 1;
4035
+ if (lineIndent < parentIndent) return -1;
4036
+ return 0;
4037
+ }
4038
+ function writeFoldedLines(count) {
4039
+ if (count === 1) return " ";
4040
+ if (count > 1) return "\n".repeat(count - 1);
4041
+ return "";
4042
+ }
4043
+ var LoaderState = class {
4044
+ input;
4045
+ length;
4046
+ lineIndent = 0;
4047
+ lineStart = 0;
4048
+ position = 0;
4049
+ line = 0;
4050
+ onWarning;
4051
+ allowDuplicateKeys;
4052
+ implicitTypes;
4053
+ typeMap;
4054
+ checkLineBreaks = false;
4055
+ tagMap = /* @__PURE__ */ new Map();
4056
+ anchorMap = /* @__PURE__ */ new Map();
4057
+ constructor(input, { schema = DEFAULT_SCHEMA, onWarning, allowDuplicateKeys = false }) {
4058
+ this.input = input;
4059
+ this.onWarning = onWarning;
4060
+ this.allowDuplicateKeys = allowDuplicateKeys;
4061
+ this.implicitTypes = schema.implicitTypes;
4062
+ this.typeMap = schema.typeMap;
4063
+ this.length = input.length;
4064
+ this.readIndent();
4065
+ }
4066
+ skipWhitespaces() {
4067
+ let ch = this.peek();
4068
+ while (isWhiteSpace(ch)) {
4069
+ ch = this.next();
4070
+ }
4071
+ }
4072
+ skipComment() {
4073
+ let ch = this.peek();
4074
+ if (ch !== SHARP) return;
4075
+ ch = this.next();
4076
+ while (ch !== 0 && !isEOL(ch)) {
4077
+ ch = this.next();
4078
+ }
4079
+ }
4080
+ readIndent() {
4081
+ let char = this.peek();
4082
+ while (char === SPACE) {
4083
+ this.lineIndent += 1;
4084
+ char = this.next();
4085
+ }
4086
+ }
4087
+ peek(offset = 0) {
4088
+ return this.input.charCodeAt(this.position + offset);
4089
+ }
4090
+ next() {
4091
+ this.position += 1;
4092
+ return this.peek();
4093
+ }
4094
+ #createError(message) {
4095
+ const mark = markToString(this.input, this.position, this.line, this.position - this.lineStart);
4096
+ return new SyntaxError(`${message} ${mark}`);
4097
+ }
4098
+ dispatchWarning(message) {
4099
+ const error = this.#createError(message);
4100
+ this.onWarning?.(error);
4101
+ }
4102
+ yamlDirectiveHandler(args) {
4103
+ if (args.length !== 1) {
4104
+ throw this.#createError("Cannot handle YAML directive: YAML directive accepts exactly one argument");
4105
+ }
4106
+ const match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
4107
+ if (match === null) {
4108
+ throw this.#createError("Cannot handle YAML directive: ill-formed argument");
4109
+ }
4110
+ const major = parseInt(match[1], 10);
4111
+ const minor = parseInt(match[2], 10);
4112
+ if (major !== 1) {
4113
+ throw this.#createError("Cannot handle YAML directive: unacceptable YAML version");
4114
+ }
4115
+ this.checkLineBreaks = minor < 2;
4116
+ if (minor !== 1 && minor !== 2) {
4117
+ this.dispatchWarning("Cannot handle YAML directive: unsupported YAML version");
4118
+ }
4119
+ return args[0] ?? null;
4120
+ }
4121
+ tagDirectiveHandler(args) {
4122
+ if (args.length !== 2) {
4123
+ throw this.#createError(`Cannot handle tag directive: directive accepts exactly two arguments, received ${args.length}`);
4124
+ }
4125
+ const handle = args[0];
4126
+ const prefix = args[1];
4127
+ if (!PATTERN_TAG_HANDLE.test(handle)) {
4128
+ throw this.#createError(`Cannot handle tag directive: ill-formed handle (first argument) in "${handle}"`);
4129
+ }
4130
+ if (this.tagMap.has(handle)) {
4131
+ throw this.#createError(`Cannot handle tag directive: previously declared suffix for "${handle}" tag handle`);
4132
+ }
4133
+ if (!PATTERN_TAG_URI.test(prefix)) {
4134
+ throw this.#createError("Cannot handle tag directive: ill-formed tag prefix (second argument) of the TAG directive");
4135
+ }
4136
+ this.tagMap.set(handle, prefix);
4137
+ }
4138
+ captureSegment(start, end, checkJson) {
4139
+ if (start < end) {
4140
+ const result = this.input.slice(start, end);
4141
+ if (checkJson) {
4142
+ for (let position = 0; position < result.length; position++) {
4143
+ const character = result.charCodeAt(position);
4144
+ if (!(character === 9 || 32 <= character && character <= 1114111)) {
4145
+ throw this.#createError(`Expected valid JSON character: received "${character}"`);
4146
+ }
4147
+ }
4148
+ } else if (PATTERN_NON_PRINTABLE.test(result)) {
4149
+ throw this.#createError("Stream contains non-printable characters");
4150
+ }
4151
+ return result;
4152
+ }
4153
+ }
4154
+ readBlockSequence(tag, anchor, nodeIndent) {
4155
+ let detected = false;
4156
+ const result = [];
4157
+ if (anchor !== null) this.anchorMap.set(anchor, result);
4158
+ let ch = this.peek();
4159
+ while (ch !== 0) {
4160
+ if (ch !== MINUS) {
4161
+ break;
4162
+ }
4163
+ const following = this.peek(1);
4164
+ if (!isWhiteSpaceOrEOL(following)) {
4165
+ break;
4166
+ }
4167
+ detected = true;
4168
+ this.position++;
4169
+ if (this.skipSeparationSpace(true, -1)) {
4170
+ if (this.lineIndent <= nodeIndent) {
4171
+ result.push(null);
4172
+ ch = this.peek();
4173
+ continue;
4174
+ }
4175
+ }
4176
+ const line = this.line;
4177
+ const newState = this.composeNode({
4178
+ parentIndent: nodeIndent,
4179
+ nodeContext: CONTEXT_BLOCK_IN,
4180
+ allowToSeek: false,
4181
+ allowCompact: true
4182
+ });
4183
+ if (newState) result.push(newState.result);
4184
+ this.skipSeparationSpace(true, -1);
4185
+ ch = this.peek();
4186
+ if ((this.line === line || this.lineIndent > nodeIndent) && ch !== 0) {
4187
+ throw this.#createError("Cannot read block sequence: bad indentation of a sequence entry");
4188
+ } else if (this.lineIndent < nodeIndent) {
4189
+ break;
4190
+ }
4191
+ }
4192
+ if (detected) return {
4193
+ tag,
4194
+ anchor,
4195
+ kind: "sequence",
4196
+ result
4197
+ };
4198
+ }
4199
+ mergeMappings(destination, source, overridableKeys) {
4200
+ if (!isObject(source)) {
4201
+ throw this.#createError("Cannot merge mappings: the provided source object is unacceptable");
4202
+ }
4203
+ for (const [key, value] of Object.entries(source)) {
4204
+ if (Object.hasOwn(destination, key)) continue;
4205
+ Object.defineProperty(destination, key, {
4206
+ value,
4207
+ writable: true,
4208
+ enumerable: true,
4209
+ configurable: true
4210
+ });
4211
+ overridableKeys.add(key);
4212
+ }
4213
+ }
4214
+ storeMappingPair(result, overridableKeys, keyTag, keyNode, valueNode, startLine, startPos) {
4215
+ if (Array.isArray(keyNode)) {
4216
+ keyNode = Array.prototype.slice.call(keyNode);
4217
+ for (let index = 0; index < keyNode.length; index++) {
4218
+ if (Array.isArray(keyNode[index])) {
4219
+ throw this.#createError("Cannot store mapping pair: nested arrays are not supported inside keys");
4220
+ }
4221
+ if (typeof keyNode === "object" && isPlainObject(keyNode[index])) {
4222
+ keyNode[index] = "[object Object]";
4223
+ }
4224
+ }
4225
+ }
4226
+ if (typeof keyNode === "object" && isPlainObject(keyNode)) {
4227
+ keyNode = "[object Object]";
4228
+ }
4229
+ keyNode = String(keyNode);
4230
+ if (keyTag === "tag:yaml.org,2002:merge") {
4231
+ if (Array.isArray(valueNode)) {
4232
+ for (let index = 0; index < valueNode.length; index++) {
4233
+ this.mergeMappings(result, valueNode[index], overridableKeys);
4234
+ }
4235
+ } else {
4236
+ this.mergeMappings(result, valueNode, overridableKeys);
4237
+ }
4238
+ } else {
4239
+ if (!this.allowDuplicateKeys && !overridableKeys.has(keyNode) && Object.hasOwn(result, keyNode)) {
4240
+ this.line = startLine || this.line;
4241
+ this.position = startPos || this.position;
4242
+ throw this.#createError("Cannot store mapping pair: duplicated key");
4243
+ }
4244
+ Object.defineProperty(result, keyNode, {
4245
+ value: valueNode,
4246
+ writable: true,
4247
+ enumerable: true,
4248
+ configurable: true
4249
+ });
4250
+ overridableKeys.delete(keyNode);
4251
+ }
4252
+ return result;
4253
+ }
4254
+ readLineBreak() {
4255
+ const ch = this.peek();
4256
+ if (ch === LINE_FEED) {
4257
+ this.position++;
4258
+ } else if (ch === CARRIAGE_RETURN) {
4259
+ this.position++;
4260
+ if (this.peek() === LINE_FEED) {
4261
+ this.position++;
4262
+ }
4263
+ } else {
4264
+ throw this.#createError("Cannot read line: line break not found");
4265
+ }
4266
+ this.line += 1;
4267
+ this.lineStart = this.position;
4268
+ }
4269
+ skipSeparationSpace(allowComments, checkIndent) {
4270
+ let lineBreaks = 0;
4271
+ let ch = this.peek();
4272
+ while (ch !== 0) {
4273
+ this.skipWhitespaces();
4274
+ ch = this.peek();
4275
+ if (allowComments) {
4276
+ this.skipComment();
4277
+ ch = this.peek();
4278
+ }
4279
+ if (isEOL(ch)) {
4280
+ this.readLineBreak();
4281
+ ch = this.peek();
4282
+ lineBreaks++;
4283
+ this.lineIndent = 0;
4284
+ this.readIndent();
4285
+ ch = this.peek();
4286
+ } else {
4287
+ break;
4288
+ }
4289
+ }
4290
+ if (checkIndent !== -1 && lineBreaks !== 0 && this.lineIndent < checkIndent) {
4291
+ this.dispatchWarning("deficient indentation");
4292
+ }
4293
+ return lineBreaks;
4294
+ }
4295
+ testDocumentSeparator() {
4296
+ let ch = this.peek();
4297
+ if ((ch === MINUS || ch === DOT) && ch === this.peek(1) && ch === this.peek(2)) {
4298
+ ch = this.peek(3);
4299
+ if (ch === 0 || isWhiteSpaceOrEOL(ch)) {
4300
+ return true;
4301
+ }
4302
+ }
4303
+ return false;
4304
+ }
4305
+ readPlainScalar(tag, anchor, nodeIndent, withinFlowCollection) {
4306
+ let ch = this.peek();
4307
+ if (isWhiteSpaceOrEOL(ch) || isFlowIndicator(ch) || ch === SHARP || ch === AMPERSAND || ch === ASTERISK || ch === EXCLAMATION || ch === VERTICAL_LINE || ch === GREATER_THAN || ch === SINGLE_QUOTE || ch === DOUBLE_QUOTE || ch === PERCENT || ch === COMMERCIAL_AT || ch === GRAVE_ACCENT) {
4308
+ return;
4309
+ }
4310
+ let following;
4311
+ if (ch === QUESTION || ch === MINUS) {
4312
+ following = this.peek(1);
4313
+ if (isWhiteSpaceOrEOL(following) || withinFlowCollection && isFlowIndicator(following)) {
4314
+ return;
4315
+ }
4316
+ }
4317
+ let result = "";
4318
+ let captureEnd = this.position;
4319
+ let captureStart = this.position;
4320
+ let hasPendingContent = false;
4321
+ let line = 0;
4322
+ while (ch !== 0) {
4323
+ if (ch === COLON) {
4324
+ following = this.peek(1);
4325
+ if (isWhiteSpaceOrEOL(following) || withinFlowCollection && isFlowIndicator(following)) {
4326
+ break;
4327
+ }
4328
+ } else if (ch === SHARP) {
4329
+ const preceding = this.peek(-1);
4330
+ if (isWhiteSpaceOrEOL(preceding)) {
4331
+ break;
4332
+ }
4333
+ } else if (this.position === this.lineStart && this.testDocumentSeparator() || withinFlowCollection && isFlowIndicator(ch)) {
4334
+ break;
4335
+ } else if (isEOL(ch)) {
4336
+ line = this.line;
4337
+ const lineStart = this.lineStart;
4338
+ const lineIndent = this.lineIndent;
4339
+ this.skipSeparationSpace(false, -1);
4340
+ if (this.lineIndent >= nodeIndent) {
4341
+ hasPendingContent = true;
4342
+ ch = this.peek();
4343
+ continue;
4344
+ } else {
4345
+ this.position = captureEnd;
4346
+ this.line = line;
4347
+ this.lineStart = lineStart;
4348
+ this.lineIndent = lineIndent;
4349
+ break;
4350
+ }
4351
+ }
4352
+ if (hasPendingContent) {
4353
+ const segment2 = this.captureSegment(captureStart, captureEnd, false);
4354
+ if (segment2) result += segment2;
4355
+ result += writeFoldedLines(this.line - line);
4356
+ captureStart = captureEnd = this.position;
4357
+ hasPendingContent = false;
4358
+ }
4359
+ if (!isWhiteSpace(ch)) {
4360
+ captureEnd = this.position + 1;
4361
+ }
4362
+ ch = this.next();
4363
+ }
4364
+ const segment = this.captureSegment(captureStart, captureEnd, false);
4365
+ if (segment) result += segment;
4366
+ if (anchor !== null) this.anchorMap.set(anchor, result);
4367
+ if (result) return {
4368
+ tag,
4369
+ anchor,
4370
+ kind: "scalar",
4371
+ result
4372
+ };
4373
+ }
4374
+ readSingleQuotedScalar(tag, anchor, nodeIndent) {
4375
+ let ch = this.peek();
4376
+ if (ch !== SINGLE_QUOTE) return;
4377
+ let result = "";
4378
+ this.position++;
4379
+ let captureStart = this.position;
4380
+ let captureEnd = this.position;
4381
+ ch = this.peek();
4382
+ while (ch !== 0) {
4383
+ if (ch === SINGLE_QUOTE) {
4384
+ const segment = this.captureSegment(captureStart, this.position, true);
4385
+ if (segment) result += segment;
4386
+ ch = this.next();
4387
+ if (ch === SINGLE_QUOTE) {
4388
+ captureStart = this.position;
4389
+ this.position++;
4390
+ captureEnd = this.position;
4391
+ } else {
4392
+ if (anchor !== null) this.anchorMap.set(anchor, result);
4393
+ return {
4394
+ tag,
4395
+ anchor,
4396
+ kind: "scalar",
4397
+ result
4398
+ };
4399
+ }
4400
+ } else if (isEOL(ch)) {
4401
+ const segment = this.captureSegment(captureStart, captureEnd, true);
4402
+ if (segment) result += segment;
4403
+ result += writeFoldedLines(this.skipSeparationSpace(false, nodeIndent));
4404
+ captureStart = captureEnd = this.position;
4405
+ } else if (this.position === this.lineStart && this.testDocumentSeparator()) {
4406
+ throw this.#createError("Unexpected end of the document within a single quoted scalar");
4407
+ } else {
4408
+ this.position++;
4409
+ captureEnd = this.position;
4410
+ }
4411
+ ch = this.peek();
4412
+ }
4413
+ throw this.#createError("Unexpected end of the stream within a single quoted scalar");
4414
+ }
4415
+ readDoubleQuotedScalar(tag, anchor, nodeIndent) {
4416
+ let ch = this.peek();
4417
+ if (ch !== DOUBLE_QUOTE) return;
4418
+ let result = "";
4419
+ this.position++;
4420
+ let captureEnd = this.position;
4421
+ let captureStart = this.position;
4422
+ let tmp;
4423
+ ch = this.peek();
4424
+ while (ch !== 0) {
4425
+ if (ch === DOUBLE_QUOTE) {
4426
+ const segment = this.captureSegment(captureStart, this.position, true);
4427
+ if (segment) result += segment;
4428
+ this.position++;
4429
+ if (anchor !== null) this.anchorMap.set(anchor, result);
4430
+ return {
4431
+ tag,
4432
+ anchor,
4433
+ kind: "scalar",
4434
+ result
4435
+ };
4436
+ }
4437
+ if (ch === BACKSLASH) {
4438
+ const segment = this.captureSegment(captureStart, this.position, true);
4439
+ if (segment) result += segment;
4440
+ ch = this.next();
4441
+ if (isEOL(ch)) {
4442
+ this.skipSeparationSpace(false, nodeIndent);
4443
+ } else if (ch < 256 && SIMPLE_ESCAPE_SEQUENCES.has(ch)) {
4444
+ result += SIMPLE_ESCAPE_SEQUENCES.get(ch);
4445
+ this.position++;
4446
+ } else if ((tmp = ESCAPED_HEX_LENGTHS.get(ch) ?? 0) > 0) {
4447
+ let hexLength = tmp;
4448
+ let hexResult = 0;
4449
+ for (; hexLength > 0; hexLength--) {
4450
+ ch = this.next();
4451
+ if ((tmp = hexCharCodeToNumber(ch)) >= 0) {
4452
+ hexResult = (hexResult << 4) + tmp;
4453
+ } else {
4454
+ throw this.#createError("Cannot read double quoted scalar: expected hexadecimal character");
4455
+ }
4456
+ }
4457
+ result += codepointToChar(hexResult);
4458
+ this.position++;
4459
+ } else {
4460
+ throw this.#createError("Cannot read double quoted scalar: unknown escape sequence");
4461
+ }
4462
+ captureStart = captureEnd = this.position;
4463
+ } else if (isEOL(ch)) {
4464
+ const segment = this.captureSegment(captureStart, captureEnd, true);
4465
+ if (segment) result += segment;
4466
+ result += writeFoldedLines(this.skipSeparationSpace(false, nodeIndent));
4467
+ captureStart = captureEnd = this.position;
4468
+ } else if (this.position === this.lineStart && this.testDocumentSeparator()) {
4469
+ throw this.#createError("Unexpected end of the document within a double quoted scalar");
4470
+ } else {
4471
+ this.position++;
4472
+ captureEnd = this.position;
4473
+ }
4474
+ ch = this.peek();
4475
+ }
4476
+ throw this.#createError("Unexpected end of the stream within a double quoted scalar");
4477
+ }
4478
+ readFlowCollection(tag, anchor, nodeIndent) {
4479
+ let ch = this.peek();
4480
+ let terminator;
4481
+ let isMapping = true;
4482
+ let result = {};
4483
+ if (ch === LEFT_SQUARE_BRACKET) {
4484
+ terminator = RIGHT_SQUARE_BRACKET;
4485
+ isMapping = false;
4486
+ result = [];
4487
+ } else if (ch === LEFT_CURLY_BRACKET) {
4488
+ terminator = RIGHT_CURLY_BRACKET;
4489
+ } else {
4490
+ return;
4491
+ }
4492
+ if (anchor !== null) this.anchorMap.set(anchor, result);
4493
+ ch = this.next();
4494
+ let readNext = true;
4495
+ let valueNode = null;
4496
+ let keyNode = null;
4497
+ let keyTag = null;
4498
+ let isExplicitPair = false;
4499
+ let isPair = false;
4500
+ let following = 0;
4501
+ let line = 0;
4502
+ const overridableKeys = /* @__PURE__ */ new Set();
4503
+ while (ch !== 0) {
4504
+ this.skipSeparationSpace(true, nodeIndent);
4505
+ ch = this.peek();
4506
+ if (ch === terminator) {
4507
+ this.position++;
4508
+ const kind = isMapping ? "mapping" : "sequence";
4509
+ return {
4510
+ tag,
4511
+ anchor,
4512
+ kind,
4513
+ result
4514
+ };
4515
+ }
4516
+ if (!readNext) {
4517
+ throw this.#createError("Cannot read flow collection: missing comma between flow collection entries");
4518
+ }
4519
+ keyTag = keyNode = valueNode = null;
4520
+ isPair = isExplicitPair = false;
4521
+ if (ch === QUESTION) {
4522
+ following = this.peek(1);
4523
+ if (isWhiteSpaceOrEOL(following)) {
4524
+ isPair = isExplicitPair = true;
4525
+ this.position++;
4526
+ this.skipSeparationSpace(true, nodeIndent);
4527
+ }
4528
+ }
4529
+ line = this.line;
4530
+ const newState = this.composeNode({
4531
+ parentIndent: nodeIndent,
4532
+ nodeContext: CONTEXT_FLOW_IN,
4533
+ allowToSeek: false,
4534
+ allowCompact: true
4535
+ });
4536
+ if (newState) {
4537
+ keyTag = newState.tag || null;
4538
+ keyNode = newState.result;
4539
+ }
4540
+ this.skipSeparationSpace(true, nodeIndent);
4541
+ ch = this.peek();
4542
+ if ((isExplicitPair || this.line === line) && ch === COLON) {
4543
+ isPair = true;
4544
+ ch = this.next();
4545
+ this.skipSeparationSpace(true, nodeIndent);
4546
+ const newState2 = this.composeNode({
4547
+ parentIndent: nodeIndent,
4548
+ nodeContext: CONTEXT_FLOW_IN,
4549
+ allowToSeek: false,
4550
+ allowCompact: true
4551
+ });
4552
+ if (newState2) valueNode = newState2.result;
4553
+ }
4554
+ if (isMapping) {
4555
+ this.storeMappingPair(result, overridableKeys, keyTag, keyNode, valueNode);
4556
+ } else if (isPair) {
4557
+ result.push(this.storeMappingPair({}, overridableKeys, keyTag, keyNode, valueNode));
4558
+ } else {
4559
+ result.push(keyNode);
4560
+ }
4561
+ this.skipSeparationSpace(true, nodeIndent);
4562
+ ch = this.peek();
4563
+ if (ch === COMMA) {
4564
+ readNext = true;
4565
+ ch = this.next();
4566
+ } else {
4567
+ readNext = false;
4568
+ }
4569
+ }
4570
+ throw this.#createError("Cannot read flow collection: unexpected end of the stream within a flow collection");
4571
+ }
4572
+ // Handles block scaler styles: e.g. '|', '>', '|-' and '>-'.
4573
+ // https://yaml.org/spec/1.2.2/#81-block-scalar-styles
4574
+ readBlockScalar(tag, anchor, nodeIndent) {
4575
+ let chomping = CHOMPING_CLIP;
4576
+ let didReadContent = false;
4577
+ let detectedIndent = false;
4578
+ let textIndent = nodeIndent;
4579
+ let emptyLines = 0;
4580
+ let atMoreIndented = false;
4581
+ let ch = this.peek();
4582
+ let folding = false;
4583
+ if (ch === VERTICAL_LINE) {
4584
+ folding = false;
4585
+ } else if (ch === GREATER_THAN) {
4586
+ folding = true;
4587
+ } else {
4588
+ return;
4589
+ }
4590
+ let result = "";
4591
+ let tmp = 0;
4592
+ while (ch !== 0) {
4593
+ ch = this.next();
4594
+ if (ch === PLUS || ch === MINUS) {
4595
+ if (CHOMPING_CLIP === chomping) {
4596
+ chomping = ch === PLUS ? CHOMPING_KEEP : CHOMPING_STRIP;
4597
+ } else {
4598
+ throw this.#createError("Cannot read block: chomping mode identifier repeated");
4599
+ }
4600
+ } else if ((tmp = decimalCharCodeToNumber(ch)) >= 0) {
4601
+ if (tmp === 0) {
4602
+ throw this.#createError("Cannot read block: indentation width must be greater than 0");
4603
+ } else if (!detectedIndent) {
4604
+ textIndent = nodeIndent + tmp - 1;
4605
+ detectedIndent = true;
4606
+ } else {
4607
+ throw this.#createError("Cannot read block: indentation width identifier repeated");
4608
+ }
4609
+ } else {
4610
+ break;
4611
+ }
4612
+ }
4613
+ if (isWhiteSpace(ch)) {
4614
+ this.skipWhitespaces();
4615
+ this.skipComment();
4616
+ ch = this.peek();
4617
+ }
4618
+ while (ch !== 0) {
4619
+ this.readLineBreak();
4620
+ this.lineIndent = 0;
4621
+ ch = this.peek();
4622
+ while ((!detectedIndent || this.lineIndent < textIndent) && ch === SPACE) {
4623
+ this.lineIndent++;
4624
+ ch = this.next();
4625
+ }
4626
+ if (!detectedIndent && this.lineIndent > textIndent) {
4627
+ textIndent = this.lineIndent;
4628
+ }
4629
+ if (isEOL(ch)) {
4630
+ emptyLines++;
4631
+ continue;
4632
+ }
4633
+ if (this.lineIndent < textIndent) {
4634
+ if (chomping === CHOMPING_KEEP) {
4635
+ result += "\n".repeat(didReadContent ? 1 + emptyLines : emptyLines);
4636
+ } else if (chomping === CHOMPING_CLIP) {
4637
+ if (didReadContent) {
4638
+ result += "\n";
4639
+ }
4640
+ }
4641
+ break;
4642
+ }
4643
+ if (folding) {
4644
+ if (isWhiteSpace(ch)) {
4645
+ atMoreIndented = true;
4646
+ result += "\n".repeat(didReadContent ? 1 + emptyLines : emptyLines);
4647
+ } else if (atMoreIndented) {
4648
+ atMoreIndented = false;
4649
+ result += "\n".repeat(emptyLines + 1);
4650
+ } else if (emptyLines === 0) {
4651
+ if (didReadContent) {
4652
+ result += " ";
4653
+ }
4654
+ } else {
4655
+ result += "\n".repeat(emptyLines);
4656
+ }
4657
+ } else {
4658
+ result += "\n".repeat(didReadContent ? 1 + emptyLines : emptyLines);
4659
+ }
4660
+ didReadContent = true;
4661
+ detectedIndent = true;
4662
+ emptyLines = 0;
4663
+ const captureStart = this.position;
4664
+ while (!isEOL(ch) && ch !== 0) {
4665
+ ch = this.next();
4666
+ }
4667
+ const segment = this.captureSegment(captureStart, this.position, false);
4668
+ if (segment) result += segment;
4669
+ }
4670
+ if (anchor !== null) this.anchorMap.set(anchor, result);
4671
+ return {
4672
+ tag,
4673
+ anchor,
4674
+ kind: "scalar",
4675
+ result
4676
+ };
4677
+ }
4678
+ readBlockMapping(tag, anchor, nodeIndent, flowIndent) {
4679
+ const result = {};
4680
+ const overridableKeys = /* @__PURE__ */ new Set();
4681
+ let allowCompact = false;
4682
+ let line;
4683
+ let pos;
4684
+ let keyTag = null;
4685
+ let keyNode = null;
4686
+ let valueNode = null;
4687
+ let atExplicitKey = false;
4688
+ let detected = false;
4689
+ if (anchor !== null) this.anchorMap.set(anchor, result);
4690
+ let ch = this.peek();
4691
+ while (ch !== 0) {
4692
+ const following = this.peek(1);
4693
+ line = this.line;
4694
+ pos = this.position;
4695
+ if ((ch === QUESTION || ch === COLON) && isWhiteSpaceOrEOL(following)) {
4696
+ if (ch === QUESTION) {
4697
+ if (atExplicitKey) {
4698
+ this.storeMappingPair(result, overridableKeys, keyTag, keyNode, null);
4699
+ keyTag = null;
4700
+ keyNode = null;
4701
+ valueNode = null;
4702
+ }
4703
+ detected = true;
4704
+ atExplicitKey = true;
4705
+ allowCompact = true;
4706
+ } else if (atExplicitKey) {
4707
+ atExplicitKey = false;
4708
+ allowCompact = true;
4709
+ } else {
4710
+ throw this.#createError("Cannot read block as explicit mapping pair is incomplete: a key node is missed or followed by a non-tabulated empty line");
4711
+ }
4712
+ this.position += 1;
4713
+ ch = following;
4714
+ } else {
4715
+ const newState = this.composeNode({
4716
+ parentIndent: flowIndent,
4717
+ nodeContext: CONTEXT_FLOW_OUT,
4718
+ allowToSeek: false,
4719
+ allowCompact: true
4720
+ });
4721
+ if (!newState) break;
4722
+ if (this.line === line) {
4723
+ ch = this.peek();
4724
+ this.skipWhitespaces();
4725
+ ch = this.peek();
4726
+ if (ch === COLON) {
4727
+ ch = this.next();
4728
+ if (!isWhiteSpaceOrEOL(ch)) {
4729
+ throw this.#createError("Cannot read block: a whitespace character is expected after the key-value separator within a block mapping");
4730
+ }
4731
+ if (atExplicitKey) {
4732
+ this.storeMappingPair(result, overridableKeys, keyTag, keyNode, null);
4733
+ keyTag = null;
4734
+ keyNode = null;
4735
+ valueNode = null;
4736
+ }
4737
+ detected = true;
4738
+ atExplicitKey = false;
4739
+ allowCompact = false;
4740
+ keyTag = newState.tag;
4741
+ keyNode = newState.result;
4742
+ } else if (detected) {
4743
+ throw this.#createError("Cannot read an implicit mapping pair: missing colon");
4744
+ } else {
4745
+ const { kind, result: result2 } = newState;
4746
+ return {
4747
+ tag,
4748
+ anchor,
4749
+ kind,
4750
+ result: result2
4751
+ };
4752
+ }
4753
+ } else if (detected) {
4754
+ throw this.#createError("Cannot read a block mapping entry: a multiline key may not be an implicit key");
4755
+ } else {
4756
+ const { kind, result: result2 } = newState;
4757
+ return {
4758
+ tag,
4759
+ anchor,
4760
+ kind,
4761
+ result: result2
4762
+ };
4763
+ }
4764
+ }
4765
+ if (this.line === line || this.lineIndent > nodeIndent) {
4766
+ const newState = this.composeNode({
4767
+ parentIndent: nodeIndent,
4768
+ nodeContext: CONTEXT_BLOCK_OUT,
4769
+ allowToSeek: true,
4770
+ allowCompact
4771
+ });
4772
+ if (newState) {
4773
+ if (atExplicitKey) {
4774
+ keyNode = newState.result;
4775
+ } else {
4776
+ valueNode = newState.result;
4777
+ }
4778
+ }
4779
+ if (!atExplicitKey) {
4780
+ this.storeMappingPair(result, overridableKeys, keyTag, keyNode, valueNode, line, pos);
4781
+ keyTag = keyNode = valueNode = null;
4782
+ }
4783
+ this.skipSeparationSpace(true, -1);
4784
+ ch = this.peek();
4785
+ }
4786
+ if (this.lineIndent > nodeIndent && ch !== 0) {
4787
+ throw this.#createError("Cannot read block: bad indentation of a mapping entry");
4788
+ } else if (this.lineIndent < nodeIndent) {
4789
+ break;
4790
+ }
4791
+ }
4792
+ if (atExplicitKey) {
4793
+ this.storeMappingPair(result, overridableKeys, keyTag, keyNode, null);
4794
+ }
4795
+ if (detected) return {
4796
+ tag,
4797
+ anchor,
4798
+ kind: "mapping",
4799
+ result
4800
+ };
4801
+ }
4802
+ readTagProperty(tag) {
4803
+ let isVerbatim = false;
4804
+ let isNamed = false;
4805
+ let tagHandle = "";
4806
+ let tagName;
4807
+ let ch = this.peek();
4808
+ if (ch !== EXCLAMATION) return;
4809
+ if (tag !== null) {
4810
+ throw this.#createError("Cannot read tag property: duplication of a tag property");
4811
+ }
4812
+ ch = this.next();
4813
+ if (ch === SMALLER_THAN) {
4814
+ isVerbatim = true;
4815
+ ch = this.next();
4816
+ } else if (ch === EXCLAMATION) {
4817
+ isNamed = true;
4818
+ tagHandle = "!!";
4819
+ ch = this.next();
4820
+ } else {
4821
+ tagHandle = "!";
4822
+ }
4823
+ let position = this.position;
4824
+ if (isVerbatim) {
4825
+ do {
4826
+ ch = this.next();
4827
+ } while (ch !== 0 && ch !== GREATER_THAN);
4828
+ if (this.position < this.length) {
4829
+ tagName = this.input.slice(position, this.position);
4830
+ ch = this.next();
4831
+ } else {
4832
+ throw this.#createError("Cannot read tag property: unexpected end of stream");
4833
+ }
4834
+ } else {
4835
+ while (ch !== 0 && !isWhiteSpaceOrEOL(ch)) {
4836
+ if (ch === EXCLAMATION) {
4837
+ if (!isNamed) {
4838
+ tagHandle = this.input.slice(position - 1, this.position + 1);
4839
+ if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
4840
+ throw this.#createError("Cannot read tag property: named tag handle contains invalid characters");
4841
+ }
4842
+ isNamed = true;
4843
+ position = this.position + 1;
4844
+ } else {
4845
+ throw this.#createError("Cannot read tag property: tag suffix cannot contain an exclamation mark");
4846
+ }
4847
+ }
4848
+ ch = this.next();
4849
+ }
4850
+ tagName = this.input.slice(position, this.position);
4851
+ if (PATTERN_FLOW_INDICATORS.test(tagName)) {
4852
+ throw this.#createError("Cannot read tag property: tag suffix cannot contain flow indicator characters");
4853
+ }
4854
+ }
4855
+ if (tagName && !PATTERN_TAG_URI.test(tagName)) {
4856
+ throw this.#createError(`Cannot read tag property: invalid characters in tag name "${tagName}"`);
4857
+ }
4858
+ if (isVerbatim) {
4859
+ return tagName;
4860
+ } else if (this.tagMap.has(tagHandle)) {
4861
+ return this.tagMap.get(tagHandle) + tagName;
4862
+ } else if (tagHandle === "!") {
4863
+ return `!${tagName}`;
4864
+ } else if (tagHandle === "!!") {
4865
+ return `tag:yaml.org,2002:${tagName}`;
4866
+ }
4867
+ throw this.#createError(`Cannot read tag property: undeclared tag handle "${tagHandle}"`);
4868
+ }
4869
+ readAnchorProperty(anchor) {
4870
+ let ch = this.peek();
4871
+ if (ch !== AMPERSAND) return;
4872
+ if (anchor !== null) {
4873
+ throw this.#createError("Cannot read anchor property: duplicate anchor property");
4874
+ }
4875
+ ch = this.next();
4876
+ const position = this.position;
4877
+ while (ch !== 0 && !isWhiteSpaceOrEOL(ch) && !isFlowIndicator(ch)) {
4878
+ ch = this.next();
4879
+ }
4880
+ if (this.position === position) {
4881
+ throw this.#createError("Cannot read anchor property: name of an anchor node must contain at least one character");
4882
+ }
4883
+ return this.input.slice(position, this.position);
4884
+ }
4885
+ readAlias() {
4886
+ if (this.peek() !== ASTERISK) return;
4887
+ let ch = this.next();
4888
+ const position = this.position;
4889
+ while (ch !== 0 && !isWhiteSpaceOrEOL(ch) && !isFlowIndicator(ch)) {
4890
+ ch = this.next();
4891
+ }
4892
+ if (this.position === position) {
4893
+ throw this.#createError("Cannot read alias: alias name must contain at least one character");
4894
+ }
4895
+ const alias = this.input.slice(position, this.position);
4896
+ if (!this.anchorMap.has(alias)) {
4897
+ throw this.#createError(`Cannot read alias: unidentified alias "${alias}"`);
4898
+ }
4899
+ this.skipSeparationSpace(true, -1);
4900
+ return this.anchorMap.get(alias);
4901
+ }
4902
+ resolveTag(state) {
4903
+ switch (state.tag) {
4904
+ case null:
4905
+ case "!":
4906
+ return state;
4907
+ case "?": {
4908
+ for (const type2 of this.implicitTypes) {
4909
+ if (!type2.resolve(state.result)) continue;
4910
+ const result2 = type2.construct(state.result);
4911
+ state.result = result2;
4912
+ state.tag = type2.tag;
4913
+ const { anchor: anchor2 } = state;
4914
+ if (anchor2 !== null) this.anchorMap.set(anchor2, result2);
4915
+ return state;
4916
+ }
4917
+ return state;
4918
+ }
4919
+ }
4920
+ const kind = state.kind ?? "fallback";
4921
+ const map2 = this.typeMap[kind];
4922
+ const type = map2.get(state.tag);
4923
+ if (!type) {
4924
+ throw this.#createError(`Cannot resolve unknown tag !<${state.tag}>`);
4925
+ }
4926
+ if (state.result !== null && type.kind !== state.kind) {
4927
+ throw this.#createError(`Unacceptable node kind for !<${state.tag}> tag: it should be "${type.kind}", not "${state.kind}"`);
4928
+ }
4929
+ if (!type.resolve(state.result)) {
4930
+ throw this.#createError(`Cannot resolve a node with !<${state.tag}> explicit tag`);
4931
+ }
4932
+ const result = type.construct(state.result);
4933
+ state.result = result;
4934
+ const { anchor } = state;
4935
+ if (anchor !== null) this.anchorMap.set(anchor, result);
4936
+ return state;
4937
+ }
4938
+ composeNode({ parentIndent, nodeContext, allowToSeek, allowCompact }) {
4939
+ let indentStatus = 1;
4940
+ let atNewLine = false;
4941
+ const allowBlockScalars = CONTEXT_BLOCK_OUT === nodeContext || CONTEXT_BLOCK_IN === nodeContext;
4942
+ let allowBlockCollections = allowBlockScalars;
4943
+ const allowBlockStyles = allowBlockScalars;
4944
+ if (allowToSeek) {
4945
+ if (this.skipSeparationSpace(true, -1)) {
4946
+ atNewLine = true;
4947
+ indentStatus = getIndentStatus(this.lineIndent, parentIndent);
4948
+ }
4949
+ }
4950
+ let tag = null;
4951
+ let anchor = null;
4952
+ if (indentStatus === 1) {
4953
+ while (true) {
4954
+ const newTag = this.readTagProperty(tag);
4955
+ if (newTag) {
4956
+ tag = newTag;
4957
+ } else {
4958
+ const newAnchor = this.readAnchorProperty(anchor);
4959
+ if (!newAnchor) break;
4960
+ anchor = newAnchor;
4961
+ }
4962
+ if (this.skipSeparationSpace(true, -1)) {
4963
+ atNewLine = true;
4964
+ allowBlockCollections = allowBlockStyles;
4965
+ indentStatus = getIndentStatus(this.lineIndent, parentIndent);
4966
+ } else {
4967
+ allowBlockCollections = false;
4968
+ }
4969
+ }
4970
+ }
4971
+ if (allowBlockCollections) {
4972
+ allowBlockCollections = atNewLine || allowCompact;
4973
+ }
4974
+ if (indentStatus === 1) {
4975
+ const cond = CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext;
4976
+ const flowIndent = cond ? parentIndent : parentIndent + 1;
4977
+ if (allowBlockCollections) {
4978
+ const blockIndent = this.position - this.lineStart;
4979
+ const blockSequenceState = this.readBlockSequence(tag, anchor, blockIndent);
4980
+ if (blockSequenceState) return this.resolveTag(blockSequenceState);
4981
+ const blockMappingState = this.readBlockMapping(tag, anchor, blockIndent, flowIndent);
4982
+ if (blockMappingState) return this.resolveTag(blockMappingState);
4983
+ }
4984
+ const flowCollectionState = this.readFlowCollection(tag, anchor, flowIndent);
4985
+ if (flowCollectionState) return this.resolveTag(flowCollectionState);
4986
+ if (allowBlockScalars) {
4987
+ const blockScalarState = this.readBlockScalar(tag, anchor, flowIndent);
4988
+ if (blockScalarState) return this.resolveTag(blockScalarState);
4989
+ }
4990
+ const singleQuoteState = this.readSingleQuotedScalar(tag, anchor, flowIndent);
4991
+ if (singleQuoteState) return this.resolveTag(singleQuoteState);
4992
+ const doubleQuoteState = this.readDoubleQuotedScalar(tag, anchor, flowIndent);
4993
+ if (doubleQuoteState) return this.resolveTag(doubleQuoteState);
4994
+ const alias = this.readAlias();
4995
+ if (alias) {
4996
+ if (tag !== null || anchor !== null) {
4997
+ throw this.#createError("Cannot compose node: alias node should not have any properties");
4998
+ }
4999
+ return this.resolveTag({
5000
+ tag,
5001
+ anchor,
5002
+ kind: null,
5003
+ result: alias
5004
+ });
5005
+ }
5006
+ const plainScalarState = this.readPlainScalar(tag, anchor, flowIndent, CONTEXT_FLOW_IN === nodeContext);
5007
+ if (plainScalarState) {
5008
+ plainScalarState.tag ??= "?";
5009
+ return this.resolveTag(plainScalarState);
5010
+ }
5011
+ } else if (indentStatus === 0 && CONTEXT_BLOCK_OUT === nodeContext && allowBlockCollections) {
5012
+ const blockIndent = this.position - this.lineStart;
5013
+ const newState2 = this.readBlockSequence(tag, anchor, blockIndent);
5014
+ if (newState2) return this.resolveTag(newState2);
5015
+ }
5016
+ const newState = this.resolveTag({
5017
+ tag,
5018
+ anchor,
5019
+ kind: null,
5020
+ result: null
5021
+ });
5022
+ if (newState.tag !== null || newState.anchor !== null) return newState;
5023
+ }
5024
+ readDirectives() {
5025
+ let hasDirectives = false;
5026
+ let version = null;
5027
+ let ch = this.peek();
5028
+ while (ch !== 0) {
5029
+ this.skipSeparationSpace(true, -1);
5030
+ ch = this.peek();
5031
+ if (this.lineIndent > 0 || ch !== PERCENT) {
5032
+ break;
5033
+ }
5034
+ hasDirectives = true;
5035
+ ch = this.next();
5036
+ let position = this.position;
5037
+ while (ch !== 0 && !isWhiteSpaceOrEOL(ch)) {
5038
+ ch = this.next();
5039
+ }
5040
+ const directiveName = this.input.slice(position, this.position);
5041
+ const directiveArgs = [];
5042
+ if (directiveName.length < 1) {
5043
+ throw this.#createError("Cannot read document: directive name length must be greater than zero");
5044
+ }
5045
+ while (ch !== 0) {
5046
+ this.skipWhitespaces();
5047
+ this.skipComment();
5048
+ ch = this.peek();
5049
+ if (isEOL(ch)) break;
5050
+ position = this.position;
5051
+ while (ch !== 0 && !isWhiteSpaceOrEOL(ch)) {
5052
+ ch = this.next();
5053
+ }
5054
+ directiveArgs.push(this.input.slice(position, this.position));
5055
+ }
5056
+ if (ch !== 0) this.readLineBreak();
5057
+ switch (directiveName) {
5058
+ case "YAML":
5059
+ if (version !== null) {
5060
+ throw this.#createError("Cannot handle YAML directive: duplication of %YAML directive");
5061
+ }
5062
+ version = this.yamlDirectiveHandler(directiveArgs);
5063
+ break;
5064
+ case "TAG":
5065
+ this.tagDirectiveHandler(directiveArgs);
5066
+ break;
5067
+ default:
5068
+ this.dispatchWarning(`unknown document directive "${directiveName}"`);
5069
+ break;
5070
+ }
5071
+ ch = this.peek();
5072
+ }
5073
+ return hasDirectives;
5074
+ }
5075
+ readDocument() {
5076
+ const documentStart = this.position;
5077
+ this.checkLineBreaks = false;
5078
+ this.tagMap = /* @__PURE__ */ new Map();
5079
+ this.anchorMap = /* @__PURE__ */ new Map();
5080
+ const hasDirectives = this.readDirectives();
5081
+ this.skipSeparationSpace(true, -1);
5082
+ let result = null;
5083
+ if (this.lineIndent === 0 && this.peek() === MINUS && this.peek(1) === MINUS && this.peek(2) === MINUS) {
5084
+ this.position += 3;
5085
+ this.skipSeparationSpace(true, -1);
5086
+ } else if (hasDirectives) {
5087
+ throw this.#createError("Cannot read document: directives end mark is expected");
5088
+ }
5089
+ const newState = this.composeNode({
5090
+ parentIndent: this.lineIndent - 1,
5091
+ nodeContext: CONTEXT_BLOCK_OUT,
5092
+ allowToSeek: false,
5093
+ allowCompact: true
5094
+ });
5095
+ if (newState) result = newState.result;
5096
+ this.skipSeparationSpace(true, -1);
5097
+ if (this.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(this.input.slice(documentStart, this.position))) {
5098
+ this.dispatchWarning("non-ASCII line breaks are interpreted as content");
5099
+ }
5100
+ if (this.position === this.lineStart && this.testDocumentSeparator()) {
5101
+ if (this.peek() === DOT) {
5102
+ this.position += 3;
5103
+ this.skipSeparationSpace(true, -1);
5104
+ }
5105
+ } else if (this.position < this.length - 1) {
5106
+ throw this.#createError("Cannot read document: end of the stream or a document separator is expected");
5107
+ }
5108
+ return result;
5109
+ }
5110
+ *readDocuments() {
5111
+ while (this.position < this.length - 1) {
5112
+ yield this.readDocument();
5113
+ }
5114
+ }
5115
+ };
5116
+
5117
+ // __mcpc__cli_latest/node_modules/@jsr/std__yaml/parse.js
5118
+ function sanitizeInput(input) {
5119
+ input = String(input);
5120
+ if (input.length > 0) {
5121
+ if (!isEOL(input.charCodeAt(input.length - 1))) input += "\n";
5122
+ if (input.charCodeAt(0) === 65279) input = input.slice(1);
5123
+ }
5124
+ input += "\0";
5125
+ return input;
5126
+ }
5127
+ function parse(content, options = {}) {
5128
+ content = sanitizeInput(content);
5129
+ const state = new LoaderState(content, {
5130
+ ...options,
5131
+ schema: SCHEMA_MAP.get(options.schema)
5132
+ });
5133
+ const documentGenerator = state.readDocuments();
5134
+ const document = documentGenerator.next().value;
5135
+ if (!documentGenerator.next().done) {
5136
+ throw new SyntaxError("Found more than 1 document in the stream: expected a single document");
5137
+ }
5138
+ return document ?? null;
5139
+ }
5140
+
5141
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__plugin-markdown-loader/src/markdown-loader.js
3203
5142
  var import_node_process2 = __toESM(require("node:process"), 1);
5143
+ function replaceEnvVars(str2) {
5144
+ return str2.replace(/\$([A-Za-z_][A-Za-z0-9_]*)(?!\s*\()/g, (match, varName) => {
5145
+ const value = import_node_process2.default.env[varName];
5146
+ if (value !== void 0) {
5147
+ return value;
5148
+ }
5149
+ return match;
5150
+ });
5151
+ }
5152
+ function replaceEnvVarsInObject(obj) {
5153
+ if (typeof obj === "string") {
5154
+ return replaceEnvVars(obj);
5155
+ }
5156
+ if (Array.isArray(obj)) {
5157
+ return obj.map((item) => replaceEnvVarsInObject(item));
5158
+ }
5159
+ if (obj && typeof obj === "object") {
5160
+ const result = {};
5161
+ for (const [key, value] of Object.entries(obj)) {
5162
+ result[key] = replaceEnvVarsInObject(value);
5163
+ }
5164
+ return result;
5165
+ }
5166
+ return obj;
5167
+ }
5168
+ function parseMarkdownAgent(content) {
5169
+ const frontMatterRegex = /^---\r?\n([\s\S]*?)\r?\n---\r?\n([\s\S]*)$/;
5170
+ const match = content.match(frontMatterRegex);
5171
+ if (!match) {
5172
+ throw new Error("Invalid Markdown agent file: missing YAML front matter. Expected format:\n---\nname: agent-name\n---\n\n# Description...");
5173
+ }
5174
+ const [, yamlContent, markdownContent] = match;
5175
+ let frontMatter;
5176
+ try {
5177
+ frontMatter = parse(yamlContent);
5178
+ } catch (error) {
5179
+ throw new Error(`Failed to parse YAML front matter: ${error}`);
5180
+ }
5181
+ if (!frontMatter.name) {
5182
+ throw new Error("Invalid Markdown agent file: 'name' is required in front matter");
5183
+ }
5184
+ return {
5185
+ frontMatter,
5186
+ body: markdownContent.trim()
5187
+ };
5188
+ }
5189
+ var OPTION_KEYS = [
5190
+ "mode",
5191
+ "maxSteps",
5192
+ "maxTokens",
5193
+ "tracingEnabled",
5194
+ "refs",
5195
+ "samplingConfig",
5196
+ "providerOptions",
5197
+ "acpSettings"
5198
+ ];
5199
+ function markdownAgentToComposeDefinition(parsed) {
5200
+ const frontMatter = replaceEnvVarsInObject(parsed.frontMatter);
5201
+ const body = replaceEnvVars(parsed.body);
5202
+ const options = {};
5203
+ for (const key of OPTION_KEYS) {
5204
+ if (frontMatter[key] !== void 0) {
5205
+ options[key] = frontMatter[key];
5206
+ }
5207
+ }
5208
+ const hasDescription = frontMatter.description !== void 0 && frontMatter.description !== "";
5209
+ return {
5210
+ name: frontMatter.name,
5211
+ description: hasDescription ? frontMatter.description : body,
5212
+ ...hasDescription && body ? {
5213
+ manual: body
5214
+ } : {},
5215
+ deps: frontMatter.deps,
5216
+ plugins: frontMatter.plugins,
5217
+ ...Object.keys(options).length > 0 ? {
5218
+ options
5219
+ } : {}
5220
+ };
5221
+ }
5222
+ async function loadMarkdownAgentFile(filePath) {
5223
+ const content = await (0, import_promises3.readFile)(filePath, "utf-8");
5224
+ const parsed = parseMarkdownAgent(content);
5225
+ return markdownAgentToComposeDefinition(parsed);
5226
+ }
5227
+
5228
+ // __mcpc__cli_latest/node_modules/@jsr/mcpc__plugin-markdown-loader/mod.js
5229
+ function markdownLoaderPlugin() {
5230
+ return {
5231
+ name: "markdown-loader",
5232
+ version: "1.0.0",
5233
+ enforce: "pre",
5234
+ configureServer: (server) => {
5235
+ server.registerFileLoader(".md", loadMarkdownAgentFile);
5236
+ server.registerFileLoader(".markdown", loadMarkdownAgentFile);
5237
+ }
5238
+ };
5239
+ }
5240
+ var defaultPlugin = markdownLoaderPlugin();
5241
+
5242
+ // __mcpc__cli_latest/node_modules/@mcpc/cli/src/defaults.js
5243
+ var import_node_path5 = require("node:path");
5244
+ var import_node_process3 = __toESM(require("node:process"), 1);
3204
5245
  var DEFAULT_SKILLS_PATHS = [
3205
5246
  ".claude/skills"
3206
5247
  ];
3207
5248
  var DEFAULT_CODE_EXECUTION_TIMEOUT = 3e5;
3208
5249
  function getGlobalPlugins(skillsPaths) {
3209
- const resolvedPaths = skillsPaths.map((p2) => (0, import_node_path5.resolve)(import_node_process2.default.cwd(), p2));
5250
+ const resolvedPaths = skillsPaths.map((p2) => (0, import_node_path5.resolve)(import_node_process3.default.cwd(), p2));
3210
5251
  return [
3211
- (0, import_plugin_markdown_loader.markdownLoaderPlugin)(),
5252
+ markdownLoaderPlugin(),
3212
5253
  createSkillsPlugin({
3213
5254
  paths: resolvedPaths
3214
5255
  })
@@ -3263,7 +5304,7 @@ async function saveUserConfig(config, newAgentName) {
3263
5304
  try {
3264
5305
  let existingConfig = null;
3265
5306
  try {
3266
- const content = await (0, import_promises3.readFile)(configPath, "utf-8");
5307
+ const content = await (0, import_promises4.readFile)(configPath, "utf-8");
3267
5308
  existingConfig = JSON.parse(content);
3268
5309
  } catch {
3269
5310
  }
@@ -3277,7 +5318,7 @@ async function saveUserConfig(config, newAgentName) {
3277
5318
  return;
3278
5319
  }
3279
5320
  existingConfig.agents.push(...config.agents);
3280
- await (0, import_promises3.writeFile)(configPath, JSON.stringify(existingConfig, null, 2), "utf-8");
5321
+ await (0, import_promises4.writeFile)(configPath, JSON.stringify(existingConfig, null, 2), "utf-8");
3281
5322
  console.error(`
3282
5323
  \u2713 Added agent "${newAgentName}" (total: ${existingConfig.agents.length})
3283
5324
  Config: ${configPath}
@@ -3285,10 +5326,10 @@ async function saveUserConfig(config, newAgentName) {
3285
5326
  `);
3286
5327
  return;
3287
5328
  }
3288
- await (0, import_promises3.mkdir)(configDir, {
5329
+ await (0, import_promises4.mkdir)(configDir, {
3289
5330
  recursive: true
3290
5331
  });
3291
- await (0, import_promises3.writeFile)(configPath, JSON.stringify(config, null, 2), "utf-8");
5332
+ await (0, import_promises4.writeFile)(configPath, JSON.stringify(config, null, 2), "utf-8");
3292
5333
  console.error(`
3293
5334
  \u2713 Configuration saved to: ${configPath}
3294
5335
  Run: mcpc
@@ -3300,7 +5341,7 @@ async function saveUserConfig(config, newAgentName) {
3300
5341
  async function createWrapConfig(args) {
3301
5342
  if (!args.mcpServers || args.mcpServers.length === 0) {
3302
5343
  console.error("Error: --wrap/--add requires at least one MCP server\nExample: mcpc --wrap --mcp-stdio 'npx -y @wonderwhy-er/desktop-commander'\nMultiple: mcpc --add --mcp-stdio 'npx -y server1' --mcp-http 'https://api.example.com'");
3303
- import_node_process3.default.exit(1);
5344
+ import_node_process4.default.exit(1);
3304
5345
  }
3305
5346
  const mcpServers = {};
3306
5347
  const serverNames = [];
@@ -3423,7 +5464,7 @@ function parseMcpServer(cmdString, transportType) {
3423
5464
  };
3424
5465
  }
3425
5466
  function parseCLIArgs() {
3426
- const args = parseArgs(import_node_process3.default.argv.slice(2), {
5467
+ const args = parseArgs(import_node_process4.default.argv.slice(2), {
3427
5468
  boolean: [
3428
5469
  "help",
3429
5470
  "version",
@@ -3512,15 +5553,15 @@ async function loadConfig() {
3512
5553
  const args = parseCLIArgs();
3513
5554
  if (args.version) {
3514
5555
  printVersion();
3515
- import_node_process3.default.exit(0);
5556
+ import_node_process4.default.exit(0);
3516
5557
  }
3517
5558
  if (args.help) {
3518
5559
  printHelp();
3519
- import_node_process3.default.exit(0);
5560
+ import_node_process4.default.exit(0);
3520
5561
  }
3521
5562
  if (args.cwd) {
3522
- const targetCwd = (0, import_node_path6.resolve)(import_node_process3.default.cwd(), args.cwd);
3523
- import_node_process3.default.chdir(targetCwd);
5563
+ const targetCwd = (0, import_node_path6.resolve)(import_node_process4.default.cwd(), args.cwd);
5564
+ import_node_process4.default.chdir(targetCwd);
3524
5565
  console.error(`Changed working directory to: ${targetCwd}`);
3525
5566
  }
3526
5567
  const mergeSkills = (config) => {
@@ -3532,7 +5573,7 @@ async function loadConfig() {
3532
5573
  ...args,
3533
5574
  saveConfig: true
3534
5575
  });
3535
- import_node_process3.default.exit(0);
5576
+ import_node_process4.default.exit(0);
3536
5577
  }
3537
5578
  if (args.wrap) {
3538
5579
  return mergeSkills(await createWrapConfig({
@@ -3549,16 +5590,16 @@ async function loadConfig() {
3549
5590
  throw error;
3550
5591
  }
3551
5592
  }
3552
- if (import_node_process3.default.env.MCPC_CONFIG) {
5593
+ if (import_node_process4.default.env.MCPC_CONFIG) {
3553
5594
  try {
3554
- const parsed = JSON.parse(import_node_process3.default.env.MCPC_CONFIG);
5595
+ const parsed = JSON.parse(import_node_process4.default.env.MCPC_CONFIG);
3555
5596
  return mergeSkills(applyModeOverride(normalizeConfig(parsed), args.mode));
3556
5597
  } catch (error) {
3557
5598
  console.error("Failed to parse MCPC_CONFIG environment variable:", error);
3558
5599
  throw error;
3559
5600
  }
3560
5601
  }
3561
- const configUrl = args.configUrl || import_node_process3.default.env.MCPC_CONFIG_URL;
5602
+ const configUrl = args.configUrl || import_node_process4.default.env.MCPC_CONFIG_URL;
3562
5603
  if (configUrl) {
3563
5604
  try {
3564
5605
  const headers = {
@@ -3579,7 +5620,7 @@ async function loadConfig() {
3579
5620
  throw error;
3580
5621
  }
3581
5622
  }
3582
- const configFile = args.configFile || import_node_process3.default.env.MCPC_CONFIG_FILE;
5623
+ const configFile = args.configFile || import_node_process4.default.env.MCPC_CONFIG_FILE;
3583
5624
  if (configFile) {
3584
5625
  try {
3585
5626
  const config = await loadConfigFromFile(configFile);
@@ -3604,7 +5645,7 @@ async function loadConfig() {
3604
5645
  throw error;
3605
5646
  }
3606
5647
  }
3607
- const defaultJsonConfigPath = (0, import_node_path6.resolve)(import_node_process3.default.cwd(), "mcpc.config.json");
5648
+ const defaultJsonConfigPath = (0, import_node_path6.resolve)(import_node_process4.default.cwd(), "mcpc.config.json");
3608
5649
  try {
3609
5650
  const config = await loadConfigFromFile(defaultJsonConfigPath);
3610
5651
  return mergeSkills(applyModeOverride(config, args.mode));
@@ -3617,16 +5658,16 @@ async function loadConfig() {
3617
5658
  }
3618
5659
  }
3619
5660
  }
3620
- function replaceEnvVars(str) {
3621
- return str.replace(/\$([A-Z_][A-Z0-9_]*)/g, (_match, varName) => {
3622
- return import_node_process3.default.env[varName] || "";
5661
+ function replaceEnvVars2(str2) {
5662
+ return str2.replace(/\$([A-Z_][A-Z0-9_]*)/g, (_match, varName) => {
5663
+ return import_node_process4.default.env[varName] || "";
3623
5664
  });
3624
5665
  }
3625
- function isMarkdownFile(path) {
5666
+ function isMarkdownFile2(path) {
3626
5667
  return path.endsWith(".md") || path.endsWith(".markdown");
3627
5668
  }
3628
5669
  async function loadConfigFromFile(filePath) {
3629
- if (isMarkdownFile(filePath)) {
5670
+ if (isMarkdownFile2(filePath)) {
3630
5671
  return {
3631
5672
  name: "mcpc-server",
3632
5673
  version: "0.1.0",
@@ -3635,13 +5676,13 @@ async function loadConfigFromFile(filePath) {
3635
5676
  ]
3636
5677
  };
3637
5678
  }
3638
- const content = await (0, import_promises3.readFile)(filePath, "utf-8");
5679
+ const content = await (0, import_promises4.readFile)(filePath, "utf-8");
3639
5680
  const parsed = JSON.parse(content);
3640
5681
  return normalizeConfig(parsed);
3641
5682
  }
3642
5683
  function replaceEnvVarsInConfig(obj) {
3643
5684
  if (typeof obj === "string") {
3644
- return replaceEnvVars(obj);
5685
+ return replaceEnvVars2(obj);
3645
5686
  }
3646
5687
  if (Array.isArray(obj)) {
3647
5688
  return obj.map((item) => replaceEnvVarsInConfig(item));
@@ -4727,7 +6768,7 @@ var Protocol = class {
4727
6768
  };
4728
6769
  }
4729
6770
  };
4730
- function isPlainObject(value) {
6771
+ function isPlainObject2(value) {
4731
6772
  return value !== null && typeof value === "object" && !Array.isArray(value);
4732
6773
  }
4733
6774
  function mergeCapabilities(base, additional) {
@@ -4738,7 +6779,7 @@ function mergeCapabilities(base, additional) {
4738
6779
  if (addValue === void 0)
4739
6780
  continue;
4740
6781
  const baseValue = result[k];
4741
- if (isPlainObject(baseValue) && isPlainObject(addValue)) {
6782
+ if (isPlainObject2(baseValue) && isPlainObject2(addValue)) {
4742
6783
  result[k] = { ...baseValue, ...addValue };
4743
6784
  } else {
4744
6785
  result[k] = addValue;
@@ -6036,9 +8077,9 @@ var Client = class extends Protocol {
6036
8077
 
6037
8078
  // __mcpc__cli_latest/node_modules/@modelcontextprotocol/sdk/dist/esm/client/stdio.js
6038
8079
  var import_cross_spawn = __toESM(require_cross_spawn(), 1);
6039
- var import_node_process4 = __toESM(require("node:process"), 1);
8080
+ var import_node_process5 = __toESM(require("node:process"), 1);
6040
8081
  var import_node_stream = require("node:stream");
6041
- var DEFAULT_INHERITED_ENV_VARS = import_node_process4.default.platform === "win32" ? [
8082
+ var DEFAULT_INHERITED_ENV_VARS = import_node_process5.default.platform === "win32" ? [
6042
8083
  "APPDATA",
6043
8084
  "HOMEDRIVE",
6044
8085
  "HOMEPATH",
@@ -6058,7 +8099,7 @@ var DEFAULT_INHERITED_ENV_VARS = import_node_process4.default.platform === "win3
6058
8099
  function getDefaultEnvironment() {
6059
8100
  const env = {};
6060
8101
  for (const key of DEFAULT_INHERITED_ENV_VARS) {
6061
- const value = import_node_process4.default.env[key];
8102
+ const value = import_node_process5.default.env[key];
6062
8103
  if (value === void 0) {
6063
8104
  continue;
6064
8105
  }
@@ -6094,7 +8135,7 @@ var StdioClientTransport = class {
6094
8135
  },
6095
8136
  stdio: ["pipe", "pipe", this._serverParams.stderr ?? "inherit"],
6096
8137
  shell: false,
6097
- windowsHide: import_node_process4.default.platform === "win32" && isElectron(),
8138
+ windowsHide: import_node_process5.default.platform === "win32" && isElectron(),
6098
8139
  cwd: this._serverParams.cwd
6099
8140
  });
6100
8141
  this._process.on("error", (error) => {
@@ -6202,7 +8243,7 @@ var StdioClientTransport = class {
6202
8243
  }
6203
8244
  };
6204
8245
  function isElectron() {
6205
- return "type" in import_node_process4.default;
8246
+ return "type" in import_node_process5.default;
6206
8247
  }
6207
8248
 
6208
8249
  // __mcpc__cli_latest/node_modules/eventsource-parser/dist/index.js
@@ -8083,8 +10124,8 @@ var InMemoryTransport = class _InMemoryTransport {
8083
10124
  };
8084
10125
 
8085
10126
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/config.js
8086
- var import_node_process5 = __toESM(require("node:process"), 1);
8087
- var GEMINI_PREFERRED_FORMAT = import_node_process5.default.env.GEMINI_PREFERRED_FORMAT === "0" ? false : true;
10127
+ var import_node_process6 = __toESM(require("node:process"), 1);
10128
+ var GEMINI_PREFERRED_FORMAT = import_node_process6.default.env.GEMINI_PREFERRED_FORMAT === "0" ? false : true;
8088
10129
 
8089
10130
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/json.js
8090
10131
  var import_jsonrepair2 = require("jsonrepair");
@@ -8156,8 +10197,8 @@ var cleanToolSchema = (schema) => {
8156
10197
  };
8157
10198
 
8158
10199
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/mcp.js
8159
- var import_node_process6 = require("node:process");
8160
- var import_node_process7 = __toESM(require("node:process"), 1);
10200
+ var import_node_process7 = require("node:process");
10201
+ var import_node_process8 = __toESM(require("node:process"), 1);
8161
10202
  var import_node_crypto = require("node:crypto");
8162
10203
  var mcpClientPool = /* @__PURE__ */ new Map();
8163
10204
  var mcpClientConnecting = /* @__PURE__ */ new Map();
@@ -8210,10 +10251,10 @@ function createTransport(def) {
8210
10251
  command: defAny.command,
8211
10252
  args: defAny.args,
8212
10253
  env: {
8213
- ...import_node_process7.default.env,
10254
+ ...import_node_process8.default.env,
8214
10255
  ...defAny.env ?? {}
8215
10256
  },
8216
- cwd: (0, import_node_process6.cwd)()
10257
+ cwd: (0, import_node_process7.cwd)()
8217
10258
  });
8218
10259
  }
8219
10260
  throw new Error(`Unsupported transport configuration: ${JSON.stringify(def)}`);
@@ -8278,11 +10319,11 @@ var cleanupAllPooledClients = async () => {
8278
10319
  }
8279
10320
  }));
8280
10321
  };
8281
- import_node_process7.default.once?.("exit", () => {
10322
+ import_node_process8.default.once?.("exit", () => {
8282
10323
  cleanupAllPooledClients();
8283
10324
  });
8284
- import_node_process7.default.once?.("SIGINT", () => {
8285
- cleanupAllPooledClients().finally(() => import_node_process7.default.exit(0));
10325
+ import_node_process8.default.once?.("SIGINT", () => {
10326
+ cleanupAllPooledClients().finally(() => import_node_process8.default.exit(0));
8286
10327
  });
8287
10328
  async function composeMcpDepTools(mcpConfig, filterIn) {
8288
10329
  const allTools = {};
@@ -8904,7 +10945,7 @@ function endSpan(span, error) {
8904
10945
  }
8905
10946
 
8906
10947
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/executors/agentic/agentic-executor.js
8907
- var import_node_process8 = __toESM(require("node:process"), 1);
10948
+ var import_node_process9 = __toESM(require("node:process"), 1);
8908
10949
  var AgenticExecutor = class {
8909
10950
  name;
8910
10951
  allToolNames;
@@ -8924,13 +10965,13 @@ var AgenticExecutor = class {
8924
10965
  this.logger = createLogger(`mcpc.agentic.${name}`, server);
8925
10966
  this.toolSchemaMap = new Map(toolNameToDetailList);
8926
10967
  try {
8927
- this.tracingEnabled = import_node_process8.default.env.MCPC_TRACING_ENABLED === "true";
10968
+ this.tracingEnabled = import_node_process9.default.env.MCPC_TRACING_ENABLED === "true";
8928
10969
  if (this.tracingEnabled) {
8929
10970
  initializeTracing({
8930
10971
  enabled: true,
8931
10972
  serviceName: `mcpc-agentic-${name}`,
8932
- exportTo: import_node_process8.default.env.MCPC_TRACING_EXPORT ?? "otlp",
8933
- otlpEndpoint: import_node_process8.default.env.MCPC_TRACING_OTLP_ENDPOINT ?? "http://localhost:4318/v1/traces"
10973
+ exportTo: import_node_process9.default.env.MCPC_TRACING_EXPORT ?? "otlp",
10974
+ otlpEndpoint: import_node_process9.default.env.MCPC_TRACING_OTLP_ENDPOINT ?? "http://localhost:4318/v1/traces"
8934
10975
  });
8935
10976
  }
8936
10977
  } catch {
@@ -10256,7 +12297,7 @@ async function loadPlugin(pluginPath, options = {
10256
12297
  const importPath = typeof resolveFn === "function" ? resolveFn(rawPath) : new URL(rawPath, import_meta.url).href;
10257
12298
  const pluginModule = await import(importPath);
10258
12299
  const pluginFactory = pluginModule.createPlugin;
10259
- const defaultPlugin = pluginModule.default;
12300
+ const defaultPlugin2 = pluginModule.default;
10260
12301
  let plugin;
10261
12302
  if (Object.keys(params).length > 0) {
10262
12303
  if (typeof pluginFactory !== "function") {
@@ -10265,8 +12306,8 @@ async function loadPlugin(pluginPath, options = {
10265
12306
  const typedParams = parseQueryParams(params);
10266
12307
  plugin = pluginFactory(typedParams);
10267
12308
  } else {
10268
- if (defaultPlugin) {
10269
- plugin = defaultPlugin;
12309
+ if (defaultPlugin2) {
12310
+ plugin = defaultPlugin2;
10270
12311
  } else if (typeof pluginFactory === "function") {
10271
12312
  plugin = pluginFactory();
10272
12313
  } else {
@@ -10967,6 +13008,7 @@ var ComposableMCPServer = class extends Server {
10967
13008
  pluginManager;
10968
13009
  toolManager;
10969
13010
  logger = createLogger("mcpc.compose");
13011
+ fileLoaders = /* @__PURE__ */ new Map();
10970
13012
  // Legacy property for backward compatibility
10971
13013
  get toolNameMapping() {
10972
13014
  return this.toolManager.getToolNameMapping();
@@ -10985,6 +13027,58 @@ var ComposableMCPServer = class extends Server {
10985
13027
  this.pluginManager = new PluginManager(this);
10986
13028
  this.toolManager = new ToolManager();
10987
13029
  }
13030
+ /**
13031
+ * Register a file loader for a specific extension.
13032
+ * Plugins can use this to add support for different file formats.
13033
+ *
13034
+ * @param extension - File extension including the dot (e.g., ".md", ".yaml")
13035
+ * @param loader - Function that loads a file and returns a ComposeDefinition
13036
+ *
13037
+ * @example
13038
+ * ```typescript
13039
+ * // In a plugin's configureServer hook:
13040
+ * configureServer: (server) => {
13041
+ * server.registerFileLoader(".md", loadMarkdownAgentFile);
13042
+ * server.registerFileLoader(".yaml", loadYamlAgentFile);
13043
+ * }
13044
+ * ```
13045
+ */
13046
+ registerFileLoader(extension, loader) {
13047
+ this.fileLoaders.set(extension.toLowerCase(), loader);
13048
+ }
13049
+ /**
13050
+ * Get the file loader for a specific extension.
13051
+ */
13052
+ getFileLoader(extension) {
13053
+ return this.fileLoaders.get(extension.toLowerCase());
13054
+ }
13055
+ /**
13056
+ * Check if a file extension has a registered loader.
13057
+ */
13058
+ hasFileLoader(extension) {
13059
+ return this.fileLoaders.has(extension.toLowerCase());
13060
+ }
13061
+ /**
13062
+ * Get all registered file extensions.
13063
+ */
13064
+ getRegisteredExtensions() {
13065
+ return Array.from(this.fileLoaders.keys());
13066
+ }
13067
+ /**
13068
+ * Resolve a file path to a ComposeDefinition using registered loaders.
13069
+ * @internal
13070
+ */
13071
+ async resolveFilePath(filePath) {
13072
+ const lastDot = filePath.lastIndexOf(".");
13073
+ const extension = lastDot === -1 ? "" : filePath.slice(lastDot).toLowerCase();
13074
+ const loader = this.fileLoaders.get(extension);
13075
+ if (!loader) {
13076
+ const supportedExtensions = this.getRegisteredExtensions().join(", ");
13077
+ const hint = supportedExtensions ? ` Supported extensions: ${supportedExtensions}.` : ' No file loaders registered. Use a loader plugin (e.g., markdownLoaderPlugin from "@mcpc/plugin-markdown-loader").';
13078
+ throw new Error(`Cannot load file "${filePath}": No loader registered for "${extension}" extension.${hint}`);
13079
+ }
13080
+ return await loader(filePath);
13081
+ }
10988
13082
  /**
10989
13083
  * Initialize built-in plugins - called during setup
10990
13084
  */
@@ -11529,32 +13623,16 @@ var ComposableMCPServer = class extends Server {
11529
13623
  };
11530
13624
 
11531
13625
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/utils/common/env.js
11532
- var import_node_process9 = __toESM(require("node:process"), 1);
11533
- var isSCF = () => Boolean(import_node_process9.default.env.SCF_RUNTIME || import_node_process9.default.env.PROD_SCF);
13626
+ var import_node_process10 = __toESM(require("node:process"), 1);
13627
+ var isSCF = () => Boolean(import_node_process10.default.env.SCF_RUNTIME || import_node_process10.default.env.PROD_SCF);
11534
13628
  if (isSCF()) {
11535
13629
  console.log({
11536
13630
  isSCF: isSCF(),
11537
- SCF_RUNTIME: import_node_process9.default.env.SCF_RUNTIME
13631
+ SCF_RUNTIME: import_node_process10.default.env.SCF_RUNTIME
11538
13632
  });
11539
13633
  }
11540
13634
 
11541
13635
  // __mcpc__cli_latest/node_modules/@jsr/mcpc__core/src/set-up-mcp-compose.js
11542
- var markdownAgentLoader = null;
11543
- function isMarkdownFile2(path) {
11544
- return path.endsWith(".md") || path.endsWith(".markdown");
11545
- }
11546
- async function resolveComposeInput(input) {
11547
- if (typeof input !== "string") {
11548
- return input;
11549
- }
11550
- if (!isMarkdownFile2(input)) {
11551
- throw new Error(`Invalid compose input: "${input}". Expected a Markdown file path (.md) or a ComposeDefinition object.`);
11552
- }
11553
- if (!markdownAgentLoader) {
11554
- throw new Error(`Cannot load Markdown agent file "${input}": Markdown loader not available. Use markdownLoaderPlugin() from "@mcpc/plugin-markdown-loader", or use inline ComposeDefinition objects.`);
11555
- }
11556
- return await markdownAgentLoader(input);
11557
- }
11558
13636
  function parseMcpcConfigs(conf) {
11559
13637
  return conf ?? [];
11560
13638
  }
@@ -11572,7 +13650,13 @@ async function mcpc(serverConf, composeConf, optionsOrSetup) {
11572
13650
  }
11573
13651
  }
11574
13652
  }
11575
- const resolvedConfigs = composeConf ? await Promise.all(composeConf.map(resolveComposeInput)) : [];
13653
+ const resolveInput = (input) => {
13654
+ if (typeof input !== "string") {
13655
+ return Promise.resolve(input);
13656
+ }
13657
+ return server.resolveFilePath(input);
13658
+ };
13659
+ const resolvedConfigs = composeConf ? await Promise.all(composeConf.map(resolveInput)) : [];
11576
13660
  const parsed = parseMcpcConfigs(resolvedConfigs);
11577
13661
  await server.initBuiltInPlugins();
11578
13662
  for (const mcpcConfig of parsed) {