@introspection-ai/recipes 0.52.1 → 0.53.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/schema-args.d.ts +74 -0
- package/dist/cli/schema-args.d.ts.map +1 -0
- package/dist/cli/schema-args.js +546 -0
- package/dist/cli/schema-args.js.map +1 -0
- package/dist/documents/arguments.d.ts +218 -0
- package/dist/documents/arguments.d.ts.map +1 -0
- package/dist/documents/arguments.generated.d.ts +12 -0
- package/dist/documents/arguments.generated.d.ts.map +1 -0
- package/dist/documents/arguments.generated.js +341 -0
- package/dist/documents/arguments.generated.js.map +1 -0
- package/dist/documents/arguments.js +8 -0
- package/dist/documents/arguments.js.map +1 -0
- package/dist/documents/tools.d.ts.map +1 -1
- package/dist/documents/tools.js +11 -164
- package/dist/documents/tools.js.map +1 -1
- package/dist/issues/arguments.d.ts +87 -0
- package/dist/issues/arguments.d.ts.map +1 -0
- package/dist/issues/arguments.generated.d.ts +11 -0
- package/dist/issues/arguments.generated.d.ts.map +1 -0
- package/dist/issues/arguments.generated.js +116 -0
- package/dist/issues/arguments.generated.js.map +1 -0
- package/dist/issues/arguments.js +10 -0
- package/dist/issues/arguments.js.map +1 -0
- package/dist/issues/tool.d.ts +9 -23
- package/dist/issues/tool.d.ts.map +1 -1
- package/dist/issues/tool.js +37 -35
- package/dist/issues/tool.js.map +1 -1
- package/dist/mcp/cli/core.d.ts.map +1 -1
- package/dist/mcp/cli/core.js +75 -92
- package/dist/mcp/cli/core.js.map +1 -1
- package/dist/mcp/cli/help.d.ts.map +1 -1
- package/dist/mcp/cli/help.js +3 -2
- package/dist/mcp/cli/help.js.map +1 -1
- package/dist/mcp/cli/policy.d.ts +1 -0
- package/dist/mcp/cli/policy.d.ts.map +1 -1
- package/dist/mcp/cli/policy.js +9 -7
- package/dist/mcp/cli/policy.js.map +1 -1
- package/dist/mcp-chunks/{chunk-CGJ2XOSF.js → chunk-T5BPTC3T.js} +893 -484
- package/dist/mcp-daemon.js +1 -1
- package/dist/mcp-run-worker.js +1 -1
- package/dist/recipe/manifest.generated.d.ts +1 -1
- package/dist/recipe/manifest.generated.js +1 -1
- package/dist/search/arguments.d.ts +35 -0
- package/dist/search/arguments.d.ts.map +1 -0
- package/dist/search/arguments.generated.d.ts +4 -0
- package/dist/search/arguments.generated.d.ts.map +1 -0
- package/dist/search/arguments.generated.js +37 -0
- package/dist/search/arguments.generated.js.map +1 -0
- package/dist/search/arguments.js +11 -0
- package/dist/search/arguments.js.map +1 -0
- package/dist/search/tool.d.ts +1 -1
- package/dist/search/tool.d.ts.map +1 -1
- package/dist/search/tool.js +16 -33
- package/dist/search/tool.js.map +1 -1
- package/dist/session.js +1 -1
- package/dist/session.js.map +1 -1
- package/dist/tools/cli.d.ts +2 -0
- package/dist/tools/cli.d.ts.map +1 -1
- package/dist/tools/cli.js +110 -38
- package/dist/tools/cli.js.map +1 -1
- package/dist/tools/shell.d.ts +7 -2
- package/dist/tools/shell.d.ts.map +1 -1
- package/dist/tools/shell.js +33 -11
- package/dist/tools/shell.js.map +1 -1
- package/docs/issues/README.md +18 -16
- package/docs/providers.md +38 -29
- package/package.json +10 -11
|
@@ -21,14 +21,14 @@ var require_identity = __commonJS({
|
|
|
21
21
|
var DOC = /* @__PURE__ */ Symbol.for("yaml.document");
|
|
22
22
|
var MAP = /* @__PURE__ */ Symbol.for("yaml.map");
|
|
23
23
|
var PAIR = /* @__PURE__ */ Symbol.for("yaml.pair");
|
|
24
|
-
var
|
|
24
|
+
var SCALAR2 = /* @__PURE__ */ Symbol.for("yaml.scalar");
|
|
25
25
|
var SEQ = /* @__PURE__ */ Symbol.for("yaml.seq");
|
|
26
26
|
var NODE_TYPE = /* @__PURE__ */ Symbol.for("yaml.node.type");
|
|
27
27
|
var isAlias = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === ALIAS;
|
|
28
28
|
var isDocument = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === DOC;
|
|
29
29
|
var isMap = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === MAP;
|
|
30
30
|
var isPair = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === PAIR;
|
|
31
|
-
var isScalar = (node) => !!node && typeof node === "object" && node[NODE_TYPE] ===
|
|
31
|
+
var isScalar = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === SCALAR2;
|
|
32
32
|
var isSeq = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === SEQ;
|
|
33
33
|
function isCollection(node) {
|
|
34
34
|
if (node && typeof node === "object")
|
|
@@ -44,7 +44,7 @@ var require_identity = __commonJS({
|
|
|
44
44
|
switch (node[NODE_TYPE]) {
|
|
45
45
|
case ALIAS:
|
|
46
46
|
case MAP:
|
|
47
|
-
case
|
|
47
|
+
case SCALAR2:
|
|
48
48
|
case SEQ:
|
|
49
49
|
return true;
|
|
50
50
|
}
|
|
@@ -56,7 +56,7 @@ var require_identity = __commonJS({
|
|
|
56
56
|
exports.MAP = MAP;
|
|
57
57
|
exports.NODE_TYPE = NODE_TYPE;
|
|
58
58
|
exports.PAIR = PAIR;
|
|
59
|
-
exports.SCALAR =
|
|
59
|
+
exports.SCALAR = SCALAR2;
|
|
60
60
|
exports.SEQ = SEQ;
|
|
61
61
|
exports.hasAnchor = hasAnchor;
|
|
62
62
|
exports.isAlias = isAlias;
|
|
@@ -1400,7 +1400,7 @@ var require_stringify = __commonJS({
|
|
|
1400
1400
|
var identity = require_identity();
|
|
1401
1401
|
var stringifyComment = require_stringifyComment();
|
|
1402
1402
|
var stringifyString = require_stringifyString();
|
|
1403
|
-
function createStringifyContext(doc,
|
|
1403
|
+
function createStringifyContext(doc, options2) {
|
|
1404
1404
|
const opt = Object.assign({
|
|
1405
1405
|
blockQuote: true,
|
|
1406
1406
|
commentString: stringifyComment.stringifyComment,
|
|
@@ -1420,7 +1420,7 @@ var require_stringify = __commonJS({
|
|
|
1420
1420
|
trailingComma: false,
|
|
1421
1421
|
trueStr: "true",
|
|
1422
1422
|
verifyAliasOrder: true
|
|
1423
|
-
}, doc.schema.toStringOptions,
|
|
1423
|
+
}, doc.schema.toStringOptions, options2);
|
|
1424
1424
|
let inFlow;
|
|
1425
1425
|
switch (opt.collectionStyle) {
|
|
1426
1426
|
case "block":
|
|
@@ -1842,10 +1842,10 @@ var require_stringifyCollection = __commonJS({
|
|
|
1842
1842
|
var identity = require_identity();
|
|
1843
1843
|
var stringify = require_stringify();
|
|
1844
1844
|
var stringifyComment = require_stringifyComment();
|
|
1845
|
-
function stringifyCollection(collection, ctx,
|
|
1845
|
+
function stringifyCollection(collection, ctx, options2) {
|
|
1846
1846
|
const flow = ctx.inFlow ?? collection.flow;
|
|
1847
1847
|
const stringify2 = flow ? stringifyFlowCollection : stringifyBlockCollection;
|
|
1848
|
-
return stringify2(collection, ctx,
|
|
1848
|
+
return stringify2(collection, ctx, options2);
|
|
1849
1849
|
}
|
|
1850
1850
|
function stringifyBlockCollection({ comment, items }, ctx, { blockItemPrefix, flowChars, itemIndent, onChompKeep, onComment }) {
|
|
1851
1851
|
const { indent, options: { commentString } } = ctx;
|
|
@@ -3300,10 +3300,10 @@ var require_stringifyDocument = __commonJS({
|
|
|
3300
3300
|
var identity = require_identity();
|
|
3301
3301
|
var stringify = require_stringify();
|
|
3302
3302
|
var stringifyComment = require_stringifyComment();
|
|
3303
|
-
function stringifyDocument(doc,
|
|
3303
|
+
function stringifyDocument(doc, options2) {
|
|
3304
3304
|
const lines = [];
|
|
3305
|
-
let hasDirectives =
|
|
3306
|
-
if (
|
|
3305
|
+
let hasDirectives = options2.directives === true;
|
|
3306
|
+
if (options2.directives !== false && doc.directives) {
|
|
3307
3307
|
const dir = doc.directives.toString(doc);
|
|
3308
3308
|
if (dir) {
|
|
3309
3309
|
lines.push(dir);
|
|
@@ -3313,7 +3313,7 @@ var require_stringifyDocument = __commonJS({
|
|
|
3313
3313
|
}
|
|
3314
3314
|
if (hasDirectives)
|
|
3315
3315
|
lines.push("---");
|
|
3316
|
-
const ctx = stringify.createStringifyContext(doc,
|
|
3316
|
+
const ctx = stringify.createStringifyContext(doc, options2);
|
|
3317
3317
|
const { commentString } = ctx.options;
|
|
3318
3318
|
if (doc.commentBefore) {
|
|
3319
3319
|
if (lines.length !== 1)
|
|
@@ -3389,7 +3389,7 @@ var require_Document = __commonJS({
|
|
|
3389
3389
|
var createNode = require_createNode();
|
|
3390
3390
|
var directives = require_directives();
|
|
3391
3391
|
var Document = class _Document {
|
|
3392
|
-
constructor(value, replacer,
|
|
3392
|
+
constructor(value, replacer, options2) {
|
|
3393
3393
|
this.commentBefore = null;
|
|
3394
3394
|
this.comment = null;
|
|
3395
3395
|
this.errors = [];
|
|
@@ -3398,8 +3398,8 @@ var require_Document = __commonJS({
|
|
|
3398
3398
|
let _replacer = null;
|
|
3399
3399
|
if (typeof replacer === "function" || Array.isArray(replacer)) {
|
|
3400
3400
|
_replacer = replacer;
|
|
3401
|
-
} else if (
|
|
3402
|
-
|
|
3401
|
+
} else if (options2 === void 0 && replacer) {
|
|
3402
|
+
options2 = replacer;
|
|
3403
3403
|
replacer = void 0;
|
|
3404
3404
|
}
|
|
3405
3405
|
const opt = Object.assign({
|
|
@@ -3411,17 +3411,17 @@ var require_Document = __commonJS({
|
|
|
3411
3411
|
stringKeys: false,
|
|
3412
3412
|
uniqueKeys: true,
|
|
3413
3413
|
version: "1.2"
|
|
3414
|
-
},
|
|
3414
|
+
}, options2);
|
|
3415
3415
|
this.options = opt;
|
|
3416
3416
|
let { version } = opt;
|
|
3417
|
-
if (
|
|
3418
|
-
this.directives =
|
|
3417
|
+
if (options2?._directives) {
|
|
3418
|
+
this.directives = options2._directives.atDocument();
|
|
3419
3419
|
if (this.directives.yaml.explicit)
|
|
3420
3420
|
version = this.directives.yaml.version;
|
|
3421
3421
|
} else
|
|
3422
3422
|
this.directives = new directives.Directives({ version });
|
|
3423
|
-
this.setSchema(version,
|
|
3424
|
-
this.contents = value === void 0 ? null : this.createNode(value, _replacer,
|
|
3423
|
+
this.setSchema(version, options2);
|
|
3424
|
+
this.contents = value === void 0 ? null : this.createNode(value, _replacer, options2);
|
|
3425
3425
|
}
|
|
3426
3426
|
/**
|
|
3427
3427
|
* Create a deep copy of this Document and its contents.
|
|
@@ -3472,7 +3472,7 @@ var require_Document = __commonJS({
|
|
|
3472
3472
|
}
|
|
3473
3473
|
return new Alias.Alias(node.anchor);
|
|
3474
3474
|
}
|
|
3475
|
-
createNode(value, replacer,
|
|
3475
|
+
createNode(value, replacer, options2) {
|
|
3476
3476
|
let _replacer = void 0;
|
|
3477
3477
|
if (typeof replacer === "function") {
|
|
3478
3478
|
value = replacer.call({ "": value }, "", value);
|
|
@@ -3483,11 +3483,11 @@ var require_Document = __commonJS({
|
|
|
3483
3483
|
if (asStr.length > 0)
|
|
3484
3484
|
replacer = replacer.concat(asStr);
|
|
3485
3485
|
_replacer = replacer;
|
|
3486
|
-
} else if (
|
|
3487
|
-
|
|
3486
|
+
} else if (options2 === void 0 && replacer) {
|
|
3487
|
+
options2 = replacer;
|
|
3488
3488
|
replacer = void 0;
|
|
3489
3489
|
}
|
|
3490
|
-
const { aliasDuplicateObjects, anchorPrefix, flow, keepUndefined, onTagObj, tag } =
|
|
3490
|
+
const { aliasDuplicateObjects, anchorPrefix, flow, keepUndefined, onTagObj, tag } = options2 ?? {};
|
|
3491
3491
|
const { onAnchor, setAnchors, sourceObjects } = anchors.createNodeAnchors(
|
|
3492
3492
|
this,
|
|
3493
3493
|
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
@@ -3512,9 +3512,9 @@ var require_Document = __commonJS({
|
|
|
3512
3512
|
* Convert a key and a value into a `Pair` using the current schema,
|
|
3513
3513
|
* recursively wrapping all values as `Scalar` or `Collection` nodes.
|
|
3514
3514
|
*/
|
|
3515
|
-
createPair(key, value,
|
|
3516
|
-
const k = this.createNode(key, null,
|
|
3517
|
-
const v = this.createNode(value, null,
|
|
3515
|
+
createPair(key, value, options2 = {}) {
|
|
3516
|
+
const k = this.createNode(key, null, options2);
|
|
3517
|
+
const v = this.createNode(value, null, options2);
|
|
3518
3518
|
return new Pair.Pair(k, v);
|
|
3519
3519
|
}
|
|
3520
3520
|
/**
|
|
@@ -3600,7 +3600,7 @@ var require_Document = __commonJS({
|
|
|
3600
3600
|
*
|
|
3601
3601
|
* Overrides all previously set schema options.
|
|
3602
3602
|
*/
|
|
3603
|
-
setSchema(version,
|
|
3603
|
+
setSchema(version, options2 = {}) {
|
|
3604
3604
|
if (typeof version === "number")
|
|
3605
3605
|
version = String(version);
|
|
3606
3606
|
let opt;
|
|
@@ -3630,10 +3630,10 @@ var require_Document = __commonJS({
|
|
|
3630
3630
|
throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${sv}`);
|
|
3631
3631
|
}
|
|
3632
3632
|
}
|
|
3633
|
-
if (
|
|
3634
|
-
this.schema =
|
|
3633
|
+
if (options2.schema instanceof Object)
|
|
3634
|
+
this.schema = options2.schema;
|
|
3635
3635
|
else if (opt)
|
|
3636
|
-
this.schema = new Schema.Schema(Object.assign(opt,
|
|
3636
|
+
this.schema = new Schema.Schema(Object.assign(opt, options2));
|
|
3637
3637
|
else
|
|
3638
3638
|
throw new Error(`With a null YAML version, the { schema: Schema } option is required`);
|
|
3639
3639
|
}
|
|
@@ -3663,14 +3663,14 @@ var require_Document = __commonJS({
|
|
|
3663
3663
|
return this.toJS({ json: true, jsonArg, mapAsMap: false, onAnchor });
|
|
3664
3664
|
}
|
|
3665
3665
|
/** A YAML representation of the document. */
|
|
3666
|
-
toString(
|
|
3666
|
+
toString(options2 = {}) {
|
|
3667
3667
|
if (this.errors.length > 0)
|
|
3668
3668
|
throw new Error("Document with errors cannot be stringified");
|
|
3669
|
-
if ("indent" in
|
|
3670
|
-
const s = JSON.stringify(
|
|
3669
|
+
if ("indent" in options2 && (!Number.isInteger(options2.indent) || Number(options2.indent) <= 0)) {
|
|
3670
|
+
const s = JSON.stringify(options2.indent);
|
|
3671
3671
|
throw new Error(`"indent" option must be a positive integer, not ${s}`);
|
|
3672
3672
|
}
|
|
3673
|
-
return stringifyDocument.stringifyDocument(this,
|
|
3673
|
+
return stringifyDocument.stringifyDocument(this, options2);
|
|
3674
3674
|
}
|
|
3675
3675
|
};
|
|
3676
3676
|
function assertCollection(contents) {
|
|
@@ -4831,7 +4831,7 @@ var require_compose_scalar = __commonJS({
|
|
|
4831
4831
|
var resolveBlockScalar = require_resolve_block_scalar();
|
|
4832
4832
|
var resolveFlowScalar = require_resolve_flow_scalar();
|
|
4833
4833
|
function composeScalar(ctx, token, tagToken, onError) {
|
|
4834
|
-
const { value, type, comment, range:
|
|
4834
|
+
const { value, type, comment, range: range3 } = token.type === "block-scalar" ? resolveBlockScalar.resolveBlockScalar(ctx, token, onError) : resolveFlowScalar.resolveFlowScalar(token, ctx.options.strict, onError);
|
|
4835
4835
|
const tagName = tagToken ? ctx.directives.tagName(tagToken.source, (msg) => onError(tagToken, "TAG_RESOLVE_FAILED", msg)) : null;
|
|
4836
4836
|
let tag;
|
|
4837
4837
|
if (ctx.options.stringKeys && ctx.atKey) {
|
|
@@ -4851,7 +4851,7 @@ var require_compose_scalar = __commonJS({
|
|
|
4851
4851
|
onError(tagToken ?? token, "TAG_RESOLVE_FAILED", msg);
|
|
4852
4852
|
scalar = new Scalar.Scalar(value);
|
|
4853
4853
|
}
|
|
4854
|
-
scalar.range =
|
|
4854
|
+
scalar.range = range3;
|
|
4855
4855
|
scalar.source = value;
|
|
4856
4856
|
if (type)
|
|
4857
4857
|
scalar.type = type;
|
|
@@ -5021,14 +5021,14 @@ var require_compose_node = __commonJS({
|
|
|
5021
5021
|
}
|
|
5022
5022
|
return node;
|
|
5023
5023
|
}
|
|
5024
|
-
function composeAlias({ options }, { offset, source, end }, onError) {
|
|
5024
|
+
function composeAlias({ options: options2 }, { offset, source, end }, onError) {
|
|
5025
5025
|
const alias = new Alias.Alias(source.substring(1));
|
|
5026
5026
|
if (alias.source === "")
|
|
5027
5027
|
onError(offset, "BAD_ALIAS", "Alias cannot be an empty string");
|
|
5028
5028
|
if (alias.source.endsWith(":"))
|
|
5029
5029
|
onError(offset + source.length - 1, "BAD_ALIAS", "Alias ending in : is ambiguous", true);
|
|
5030
5030
|
const valueEnd = offset + source.length;
|
|
5031
|
-
const re2 = resolveEnd.resolveEnd(end, valueEnd,
|
|
5031
|
+
const re2 = resolveEnd.resolveEnd(end, valueEnd, options2.strict, onError);
|
|
5032
5032
|
alias.range = [offset, valueEnd, re2.offset];
|
|
5033
5033
|
if (re2.comment)
|
|
5034
5034
|
alias.comment = re2.comment;
|
|
@@ -5047,8 +5047,8 @@ var require_compose_doc = __commonJS({
|
|
|
5047
5047
|
var composeNode = require_compose_node();
|
|
5048
5048
|
var resolveEnd = require_resolve_end();
|
|
5049
5049
|
var resolveProps = require_resolve_props();
|
|
5050
|
-
function composeDoc(
|
|
5051
|
-
const opts = Object.assign({ _directives: directives },
|
|
5050
|
+
function composeDoc(options2, directives, { offset, start, value, end }, onError) {
|
|
5051
|
+
const opts = Object.assign({ _directives: directives }, options2);
|
|
5052
5052
|
const doc = new Document.Document(void 0, opts);
|
|
5053
5053
|
const ctx = {
|
|
5054
5054
|
atKey: false,
|
|
@@ -5127,7 +5127,7 @@ var require_composer = __commonJS({
|
|
|
5127
5127
|
return { comment, afterEmptyLine };
|
|
5128
5128
|
}
|
|
5129
5129
|
var Composer = class {
|
|
5130
|
-
constructor(
|
|
5130
|
+
constructor(options2 = {}) {
|
|
5131
5131
|
this.doc = null;
|
|
5132
5132
|
this.atDirectives = false;
|
|
5133
5133
|
this.prelude = [];
|
|
@@ -5140,8 +5140,8 @@ var require_composer = __commonJS({
|
|
|
5140
5140
|
else
|
|
5141
5141
|
this.errors.push(new errors.YAMLParseError(pos, code, message));
|
|
5142
5142
|
};
|
|
5143
|
-
this.directives = new directives.Directives({ version:
|
|
5144
|
-
this.options =
|
|
5143
|
+
this.directives = new directives.Directives({ version: options2.version || "1.2" });
|
|
5144
|
+
this.options = options2;
|
|
5145
5145
|
}
|
|
5146
5146
|
decorate(doc, afterDoc) {
|
|
5147
5147
|
const { comment, afterEmptyLine } = parsePrelude(this.prelude);
|
|
@@ -5608,7 +5608,7 @@ var require_cst = __commonJS({
|
|
|
5608
5608
|
var BOM = "\uFEFF";
|
|
5609
5609
|
var DOCUMENT = "";
|
|
5610
5610
|
var FLOW_END = "";
|
|
5611
|
-
var
|
|
5611
|
+
var SCALAR2 = "";
|
|
5612
5612
|
var isCollection = (token) => !!token && "items" in token;
|
|
5613
5613
|
var isScalar = (token) => !!token && (token.type === "scalar" || token.type === "single-quoted-scalar" || token.type === "double-quoted-scalar" || token.type === "block-scalar");
|
|
5614
5614
|
function prettyToken(token) {
|
|
@@ -5619,7 +5619,7 @@ var require_cst = __commonJS({
|
|
|
5619
5619
|
return "<DOC>";
|
|
5620
5620
|
case FLOW_END:
|
|
5621
5621
|
return "<FLOW_END>";
|
|
5622
|
-
case
|
|
5622
|
+
case SCALAR2:
|
|
5623
5623
|
return "<SCALAR>";
|
|
5624
5624
|
default:
|
|
5625
5625
|
return JSON.stringify(token);
|
|
@@ -5633,7 +5633,7 @@ var require_cst = __commonJS({
|
|
|
5633
5633
|
return "doc-mode";
|
|
5634
5634
|
case FLOW_END:
|
|
5635
5635
|
return "flow-error-end";
|
|
5636
|
-
case
|
|
5636
|
+
case SCALAR2:
|
|
5637
5637
|
return "scalar";
|
|
5638
5638
|
case "---":
|
|
5639
5639
|
return "doc-start";
|
|
@@ -5692,7 +5692,7 @@ var require_cst = __commonJS({
|
|
|
5692
5692
|
exports.BOM = BOM;
|
|
5693
5693
|
exports.DOCUMENT = DOCUMENT;
|
|
5694
5694
|
exports.FLOW_END = FLOW_END;
|
|
5695
|
-
exports.SCALAR =
|
|
5695
|
+
exports.SCALAR = SCALAR2;
|
|
5696
5696
|
exports.isCollection = isCollection;
|
|
5697
5697
|
exports.isScalar = isScalar;
|
|
5698
5698
|
exports.prettyToken = prettyToken;
|
|
@@ -7205,15 +7205,15 @@ var require_public_api = __commonJS({
|
|
|
7205
7205
|
var identity = require_identity();
|
|
7206
7206
|
var lineCounter = require_line_counter();
|
|
7207
7207
|
var parser = require_parser();
|
|
7208
|
-
function parseOptions(
|
|
7209
|
-
const prettyErrors =
|
|
7210
|
-
const lineCounter$1 =
|
|
7208
|
+
function parseOptions(options2) {
|
|
7209
|
+
const prettyErrors = options2.prettyErrors !== false;
|
|
7210
|
+
const lineCounter$1 = options2.lineCounter || prettyErrors && new lineCounter.LineCounter() || null;
|
|
7211
7211
|
return { lineCounter: lineCounter$1, prettyErrors };
|
|
7212
7212
|
}
|
|
7213
|
-
function parseAllDocuments(source,
|
|
7214
|
-
const { lineCounter: lineCounter2, prettyErrors } = parseOptions(
|
|
7213
|
+
function parseAllDocuments(source, options2 = {}) {
|
|
7214
|
+
const { lineCounter: lineCounter2, prettyErrors } = parseOptions(options2);
|
|
7215
7215
|
const parser$1 = new parser.Parser(lineCounter2?.addNewLine);
|
|
7216
|
-
const composer$1 = new composer.Composer(
|
|
7216
|
+
const composer$1 = new composer.Composer(options2);
|
|
7217
7217
|
const docs = Array.from(composer$1.compose(parser$1.parse(source)));
|
|
7218
7218
|
if (prettyErrors && lineCounter2)
|
|
7219
7219
|
for (const doc of docs) {
|
|
@@ -7224,10 +7224,10 @@ var require_public_api = __commonJS({
|
|
|
7224
7224
|
return docs;
|
|
7225
7225
|
return Object.assign([], { empty: true }, composer$1.streamInfo());
|
|
7226
7226
|
}
|
|
7227
|
-
function parseDocument(source,
|
|
7228
|
-
const { lineCounter: lineCounter2, prettyErrors } = parseOptions(
|
|
7227
|
+
function parseDocument(source, options2 = {}) {
|
|
7228
|
+
const { lineCounter: lineCounter2, prettyErrors } = parseOptions(options2);
|
|
7229
7229
|
const parser$1 = new parser.Parser(lineCounter2?.addNewLine);
|
|
7230
|
-
const composer$1 = new composer.Composer(
|
|
7230
|
+
const composer$1 = new composer.Composer(options2);
|
|
7231
7231
|
let doc = null;
|
|
7232
7232
|
for (const _doc of composer$1.compose(parser$1.parse(source), true, source.length)) {
|
|
7233
7233
|
if (!doc)
|
|
@@ -7243,14 +7243,14 @@ var require_public_api = __commonJS({
|
|
|
7243
7243
|
}
|
|
7244
7244
|
return doc;
|
|
7245
7245
|
}
|
|
7246
|
-
function parse2(src, reviver,
|
|
7246
|
+
function parse2(src, reviver, options2) {
|
|
7247
7247
|
let _reviver = void 0;
|
|
7248
7248
|
if (typeof reviver === "function") {
|
|
7249
7249
|
_reviver = reviver;
|
|
7250
|
-
} else if (
|
|
7251
|
-
|
|
7250
|
+
} else if (options2 === void 0 && reviver && typeof reviver === "object") {
|
|
7251
|
+
options2 = reviver;
|
|
7252
7252
|
}
|
|
7253
|
-
const doc = parseDocument(src,
|
|
7253
|
+
const doc = parseDocument(src, options2);
|
|
7254
7254
|
if (!doc)
|
|
7255
7255
|
return null;
|
|
7256
7256
|
doc.warnings.forEach((warning) => log.warn(doc.options.logLevel, warning));
|
|
@@ -7260,29 +7260,29 @@ var require_public_api = __commonJS({
|
|
|
7260
7260
|
else
|
|
7261
7261
|
doc.errors = [];
|
|
7262
7262
|
}
|
|
7263
|
-
return doc.toJS(Object.assign({ reviver: _reviver },
|
|
7263
|
+
return doc.toJS(Object.assign({ reviver: _reviver }, options2));
|
|
7264
7264
|
}
|
|
7265
|
-
function stringify(value, replacer,
|
|
7265
|
+
function stringify(value, replacer, options2) {
|
|
7266
7266
|
let _replacer = null;
|
|
7267
7267
|
if (typeof replacer === "function" || Array.isArray(replacer)) {
|
|
7268
7268
|
_replacer = replacer;
|
|
7269
|
-
} else if (
|
|
7270
|
-
|
|
7269
|
+
} else if (options2 === void 0 && replacer) {
|
|
7270
|
+
options2 = replacer;
|
|
7271
7271
|
}
|
|
7272
|
-
if (typeof
|
|
7273
|
-
|
|
7274
|
-
if (typeof
|
|
7275
|
-
const indent = Math.round(
|
|
7276
|
-
|
|
7272
|
+
if (typeof options2 === "string")
|
|
7273
|
+
options2 = options2.length;
|
|
7274
|
+
if (typeof options2 === "number") {
|
|
7275
|
+
const indent = Math.round(options2);
|
|
7276
|
+
options2 = indent < 1 ? void 0 : indent > 8 ? { indent: 8 } : { indent };
|
|
7277
7277
|
}
|
|
7278
7278
|
if (value === void 0) {
|
|
7279
|
-
const { keepUndefined } =
|
|
7279
|
+
const { keepUndefined } = options2 ?? replacer ?? {};
|
|
7280
7280
|
if (!keepUndefined)
|
|
7281
7281
|
return void 0;
|
|
7282
7282
|
}
|
|
7283
7283
|
if (identity.isDocument(value) && !_replacer)
|
|
7284
|
-
return value.toString(
|
|
7285
|
-
return new Document.Document(value, _replacer,
|
|
7284
|
+
return value.toString(options2);
|
|
7285
|
+
return new Document.Document(value, _replacer, options2).toString(options2);
|
|
7286
7286
|
}
|
|
7287
7287
|
exports.parse = parse2;
|
|
7288
7288
|
exports.parseAllDocuments = parseAllDocuments;
|
|
@@ -7479,14 +7479,14 @@ var require_parse_options = __commonJS({
|
|
|
7479
7479
|
"use strict";
|
|
7480
7480
|
var looseOption = Object.freeze({ loose: true });
|
|
7481
7481
|
var emptyOpts = Object.freeze({});
|
|
7482
|
-
var parseOptions = (
|
|
7483
|
-
if (!
|
|
7482
|
+
var parseOptions = (options2) => {
|
|
7483
|
+
if (!options2) {
|
|
7484
7484
|
return emptyOpts;
|
|
7485
7485
|
}
|
|
7486
|
-
if (typeof
|
|
7486
|
+
if (typeof options2 !== "object") {
|
|
7487
7487
|
return looseOption;
|
|
7488
7488
|
}
|
|
7489
|
-
return
|
|
7489
|
+
return options2;
|
|
7490
7490
|
};
|
|
7491
7491
|
module.exports = parseOptions;
|
|
7492
7492
|
}
|
|
@@ -7539,10 +7539,10 @@ var require_semver = __commonJS({
|
|
|
7539
7539
|
return true;
|
|
7540
7540
|
};
|
|
7541
7541
|
var SemVer = class _SemVer {
|
|
7542
|
-
constructor(version,
|
|
7543
|
-
|
|
7542
|
+
constructor(version, options2) {
|
|
7543
|
+
options2 = parseOptions(options2);
|
|
7544
7544
|
if (version instanceof _SemVer) {
|
|
7545
|
-
if (version.loose === !!
|
|
7545
|
+
if (version.loose === !!options2.loose && version.includePrerelease === !!options2.includePrerelease) {
|
|
7546
7546
|
return version;
|
|
7547
7547
|
} else {
|
|
7548
7548
|
version = version.version;
|
|
@@ -7555,11 +7555,11 @@ var require_semver = __commonJS({
|
|
|
7555
7555
|
`version is longer than ${MAX_LENGTH} characters`
|
|
7556
7556
|
);
|
|
7557
7557
|
}
|
|
7558
|
-
debug("SemVer", version,
|
|
7559
|
-
this.options =
|
|
7560
|
-
this.loose = !!
|
|
7561
|
-
this.includePrerelease = !!
|
|
7562
|
-
const m = version.trim().match(
|
|
7558
|
+
debug("SemVer", version, options2);
|
|
7559
|
+
this.options = options2;
|
|
7560
|
+
this.loose = !!options2.loose;
|
|
7561
|
+
this.includePrerelease = !!options2.includePrerelease;
|
|
7562
|
+
const m = version.trim().match(options2.loose ? re2[t.LOOSE] : re2[t.FULL]);
|
|
7563
7563
|
if (!m) {
|
|
7564
7564
|
throw new TypeError(`Invalid Version: ${version}`);
|
|
7565
7565
|
}
|
|
@@ -7814,12 +7814,12 @@ var require_parse = __commonJS({
|
|
|
7814
7814
|
"node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/parse.js"(exports, module) {
|
|
7815
7815
|
"use strict";
|
|
7816
7816
|
var SemVer = require_semver();
|
|
7817
|
-
var parse2 = (version,
|
|
7817
|
+
var parse2 = (version, options2, throwErrors = false) => {
|
|
7818
7818
|
if (version instanceof SemVer) {
|
|
7819
7819
|
return version;
|
|
7820
7820
|
}
|
|
7821
7821
|
try {
|
|
7822
|
-
return new SemVer(version,
|
|
7822
|
+
return new SemVer(version, options2);
|
|
7823
7823
|
} catch (er) {
|
|
7824
7824
|
if (!throwErrors) {
|
|
7825
7825
|
return null;
|
|
@@ -7836,8 +7836,8 @@ var require_valid = __commonJS({
|
|
|
7836
7836
|
"node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/valid.js"(exports, module) {
|
|
7837
7837
|
"use strict";
|
|
7838
7838
|
var parse2 = require_parse();
|
|
7839
|
-
var valid = (version,
|
|
7840
|
-
const v = parse2(version,
|
|
7839
|
+
var valid = (version, options2) => {
|
|
7840
|
+
const v = parse2(version, options2);
|
|
7841
7841
|
return v ? v.version : null;
|
|
7842
7842
|
};
|
|
7843
7843
|
module.exports = valid;
|
|
@@ -7849,8 +7849,8 @@ var require_clean = __commonJS({
|
|
|
7849
7849
|
"node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/clean.js"(exports, module) {
|
|
7850
7850
|
"use strict";
|
|
7851
7851
|
var parse2 = require_parse();
|
|
7852
|
-
var clean = (version,
|
|
7853
|
-
const s = parse2(version.trim().replace(/^[=v]+/, ""),
|
|
7852
|
+
var clean = (version, options2) => {
|
|
7853
|
+
const s = parse2(version.trim().replace(/^[=v]+/, ""), options2);
|
|
7854
7854
|
return s ? s.version : null;
|
|
7855
7855
|
};
|
|
7856
7856
|
module.exports = clean;
|
|
@@ -7862,16 +7862,16 @@ var require_inc = __commonJS({
|
|
|
7862
7862
|
"node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/inc.js"(exports, module) {
|
|
7863
7863
|
"use strict";
|
|
7864
7864
|
var SemVer = require_semver();
|
|
7865
|
-
var inc = (version, release,
|
|
7866
|
-
if (typeof
|
|
7865
|
+
var inc = (version, release, options2, identifier, identifierBase) => {
|
|
7866
|
+
if (typeof options2 === "string") {
|
|
7867
7867
|
identifierBase = identifier;
|
|
7868
|
-
identifier =
|
|
7869
|
-
|
|
7868
|
+
identifier = options2;
|
|
7869
|
+
options2 = void 0;
|
|
7870
7870
|
}
|
|
7871
7871
|
try {
|
|
7872
7872
|
return new SemVer(
|
|
7873
7873
|
version instanceof SemVer ? version.version : version,
|
|
7874
|
-
|
|
7874
|
+
options2
|
|
7875
7875
|
).inc(release, identifier, identifierBase).version;
|
|
7876
7876
|
} catch (er) {
|
|
7877
7877
|
return null;
|
|
@@ -7960,8 +7960,8 @@ var require_prerelease = __commonJS({
|
|
|
7960
7960
|
"node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/prerelease.js"(exports, module) {
|
|
7961
7961
|
"use strict";
|
|
7962
7962
|
var parse2 = require_parse();
|
|
7963
|
-
var prerelease = (version,
|
|
7964
|
-
const parsed = parse2(version,
|
|
7963
|
+
var prerelease = (version, options2) => {
|
|
7964
|
+
const parsed = parse2(version, options2);
|
|
7965
7965
|
return parsed && parsed.prerelease.length ? parsed.prerelease : null;
|
|
7966
7966
|
};
|
|
7967
7967
|
module.exports = prerelease;
|
|
@@ -8149,7 +8149,7 @@ var require_coerce = __commonJS({
|
|
|
8149
8149
|
var SemVer = require_semver();
|
|
8150
8150
|
var parse2 = require_parse();
|
|
8151
8151
|
var { safeRe: re2, t } = require_re();
|
|
8152
|
-
var coerce = (version,
|
|
8152
|
+
var coerce = (version, options2) => {
|
|
8153
8153
|
if (version instanceof SemVer) {
|
|
8154
8154
|
return version;
|
|
8155
8155
|
}
|
|
@@ -8159,12 +8159,12 @@ var require_coerce = __commonJS({
|
|
|
8159
8159
|
if (typeof version !== "string") {
|
|
8160
8160
|
return null;
|
|
8161
8161
|
}
|
|
8162
|
-
|
|
8162
|
+
options2 = options2 || {};
|
|
8163
8163
|
let match2 = null;
|
|
8164
|
-
if (!
|
|
8165
|
-
match2 = version.match(
|
|
8164
|
+
if (!options2.rtl) {
|
|
8165
|
+
match2 = version.match(options2.includePrerelease ? re2[t.COERCEFULL] : re2[t.COERCE]);
|
|
8166
8166
|
} else {
|
|
8167
|
-
const coerceRtlRegex =
|
|
8167
|
+
const coerceRtlRegex = options2.includePrerelease ? re2[t.COERCERTLFULL] : re2[t.COERCERTL];
|
|
8168
8168
|
let next;
|
|
8169
8169
|
while ((next = coerceRtlRegex.exec(version)) && (!match2 || match2.index + match2[0].length !== version.length)) {
|
|
8170
8170
|
if (!match2 || next.index + next[0].length !== match2.index + match2[0].length) {
|
|
@@ -8180,9 +8180,9 @@ var require_coerce = __commonJS({
|
|
|
8180
8180
|
const major2 = match2[2];
|
|
8181
8181
|
const minor = match2[3] || "0";
|
|
8182
8182
|
const patch = match2[4] || "0";
|
|
8183
|
-
const prerelease =
|
|
8184
|
-
const build =
|
|
8185
|
-
return parse2(`${major2}.${minor}.${patch}${prerelease}${build}`,
|
|
8183
|
+
const prerelease = options2.includePrerelease && match2[5] ? `-${match2[5]}` : "";
|
|
8184
|
+
const build = options2.includePrerelease && match2[6] ? `+${match2[6]}` : "";
|
|
8185
|
+
return parse2(`${major2}.${minor}.${patch}${prerelease}${build}`, options2);
|
|
8186
8186
|
};
|
|
8187
8187
|
module.exports = coerce;
|
|
8188
8188
|
}
|
|
@@ -8195,16 +8195,16 @@ var require_truncate = __commonJS({
|
|
|
8195
8195
|
var parse2 = require_parse();
|
|
8196
8196
|
var constants = require_constants();
|
|
8197
8197
|
var SemVer = require_semver();
|
|
8198
|
-
var truncate = (version, truncation,
|
|
8198
|
+
var truncate = (version, truncation, options2) => {
|
|
8199
8199
|
if (!constants.RELEASE_TYPES.includes(truncation)) {
|
|
8200
8200
|
return null;
|
|
8201
8201
|
}
|
|
8202
|
-
const clonedVersion = cloneInputVersion(version,
|
|
8202
|
+
const clonedVersion = cloneInputVersion(version, options2);
|
|
8203
8203
|
return clonedVersion && doTruncation(clonedVersion, truncation);
|
|
8204
8204
|
};
|
|
8205
|
-
var cloneInputVersion = (version,
|
|
8205
|
+
var cloneInputVersion = (version, options2) => {
|
|
8206
8206
|
const versionStringToParse = version instanceof SemVer ? version.version : version;
|
|
8207
|
-
return parse2(versionStringToParse,
|
|
8207
|
+
return parse2(versionStringToParse, options2);
|
|
8208
8208
|
};
|
|
8209
8209
|
var doTruncation = (version, truncation) => {
|
|
8210
8210
|
if (isPrerelease(truncation)) {
|
|
@@ -8273,25 +8273,25 @@ var require_range = __commonJS({
|
|
|
8273
8273
|
"use strict";
|
|
8274
8274
|
var SPACE_CHARACTERS = /\s+/g;
|
|
8275
8275
|
var Range = class _Range {
|
|
8276
|
-
constructor(
|
|
8277
|
-
|
|
8278
|
-
if (
|
|
8279
|
-
if (
|
|
8280
|
-
return
|
|
8276
|
+
constructor(range3, options2) {
|
|
8277
|
+
options2 = parseOptions(options2);
|
|
8278
|
+
if (range3 instanceof _Range) {
|
|
8279
|
+
if (range3.loose === !!options2.loose && range3.includePrerelease === !!options2.includePrerelease) {
|
|
8280
|
+
return range3;
|
|
8281
8281
|
} else {
|
|
8282
|
-
return new _Range(
|
|
8282
|
+
return new _Range(range3.raw, options2);
|
|
8283
8283
|
}
|
|
8284
8284
|
}
|
|
8285
|
-
if (
|
|
8286
|
-
this.raw =
|
|
8287
|
-
this.set = [[
|
|
8285
|
+
if (range3 instanceof Comparator) {
|
|
8286
|
+
this.raw = range3.value;
|
|
8287
|
+
this.set = [[range3]];
|
|
8288
8288
|
this.formatted = void 0;
|
|
8289
8289
|
return this;
|
|
8290
8290
|
}
|
|
8291
|
-
this.options =
|
|
8292
|
-
this.loose = !!
|
|
8293
|
-
this.includePrerelease = !!
|
|
8294
|
-
this.raw =
|
|
8291
|
+
this.options = options2;
|
|
8292
|
+
this.loose = !!options2.loose;
|
|
8293
|
+
this.includePrerelease = !!options2.includePrerelease;
|
|
8294
|
+
this.raw = range3.trim().replace(SPACE_CHARACTERS, " ");
|
|
8295
8295
|
this.set = this.raw.split("||").map((r) => this.parseRange(r.trim())).filter((c) => c.length);
|
|
8296
8296
|
if (!this.set.length) {
|
|
8297
8297
|
throw new TypeError(`Invalid SemVer Range: ${this.raw}`);
|
|
@@ -8336,25 +8336,25 @@ var require_range = __commonJS({
|
|
|
8336
8336
|
toString() {
|
|
8337
8337
|
return this.range;
|
|
8338
8338
|
}
|
|
8339
|
-
parseRange(
|
|
8340
|
-
|
|
8339
|
+
parseRange(range3) {
|
|
8340
|
+
range3 = range3.replace(BUILDSTRIPRE, "");
|
|
8341
8341
|
const memoOpts = (this.options.includePrerelease && FLAG_INCLUDE_PRERELEASE) | (this.options.loose && FLAG_LOOSE);
|
|
8342
|
-
const memoKey = memoOpts + ":" +
|
|
8342
|
+
const memoKey = memoOpts + ":" + range3;
|
|
8343
8343
|
const cached = cache.get(memoKey);
|
|
8344
8344
|
if (cached) {
|
|
8345
8345
|
return cached;
|
|
8346
8346
|
}
|
|
8347
8347
|
const loose = this.options.loose;
|
|
8348
8348
|
const hr = loose ? re2[t.HYPHENRANGELOOSE] : re2[t.HYPHENRANGE];
|
|
8349
|
-
|
|
8350
|
-
debug("hyphen replace",
|
|
8351
|
-
|
|
8352
|
-
debug("comparator trim",
|
|
8353
|
-
|
|
8354
|
-
debug("tilde trim",
|
|
8355
|
-
|
|
8356
|
-
debug("caret trim",
|
|
8357
|
-
let rangeList =
|
|
8349
|
+
range3 = range3.replace(hr, hyphenReplace(this.options.includePrerelease));
|
|
8350
|
+
debug("hyphen replace", range3);
|
|
8351
|
+
range3 = range3.replace(re2[t.COMPARATORTRIM], comparatorTrimReplace);
|
|
8352
|
+
debug("comparator trim", range3);
|
|
8353
|
+
range3 = range3.replace(re2[t.TILDETRIM], tildeTrimReplace);
|
|
8354
|
+
debug("tilde trim", range3);
|
|
8355
|
+
range3 = range3.replace(re2[t.CARETTRIM], caretTrimReplace);
|
|
8356
|
+
debug("caret trim", range3);
|
|
8357
|
+
let rangeList = range3.split(" ").map((comp) => parseComparator(comp, this.options)).join(" ").split(/\s+/).map((comp) => replaceGTE0(comp, this.options));
|
|
8358
8358
|
if (loose) {
|
|
8359
8359
|
rangeList = rangeList.filter((comp) => {
|
|
8360
8360
|
debug("loose invalid filter", comp, this.options);
|
|
@@ -8377,15 +8377,15 @@ var require_range = __commonJS({
|
|
|
8377
8377
|
cache.set(memoKey, result);
|
|
8378
8378
|
return result;
|
|
8379
8379
|
}
|
|
8380
|
-
intersects(
|
|
8381
|
-
if (!(
|
|
8380
|
+
intersects(range3, options2) {
|
|
8381
|
+
if (!(range3 instanceof _Range)) {
|
|
8382
8382
|
throw new TypeError("a Range is required");
|
|
8383
8383
|
}
|
|
8384
8384
|
return this.set.some((thisComparators) => {
|
|
8385
|
-
return isSatisfiable(thisComparators,
|
|
8386
|
-
return isSatisfiable(rangeComparators,
|
|
8385
|
+
return isSatisfiable(thisComparators, options2) && range3.set.some((rangeComparators) => {
|
|
8386
|
+
return isSatisfiable(rangeComparators, options2) && thisComparators.every((thisComparator) => {
|
|
8387
8387
|
return rangeComparators.every((rangeComparator) => {
|
|
8388
|
-
return thisComparator.intersects(rangeComparator,
|
|
8388
|
+
return thisComparator.intersects(rangeComparator, options2);
|
|
8389
8389
|
});
|
|
8390
8390
|
});
|
|
8391
8391
|
});
|
|
@@ -8430,39 +8430,39 @@ var require_range = __commonJS({
|
|
|
8430
8430
|
var BUILDSTRIPRE = new RegExp(src[t.BUILD], "g");
|
|
8431
8431
|
var isNullSet = (c) => c.value === "<0.0.0-0";
|
|
8432
8432
|
var isAny = (c) => c.value === "";
|
|
8433
|
-
var isSatisfiable = (comparators,
|
|
8433
|
+
var isSatisfiable = (comparators, options2) => {
|
|
8434
8434
|
let result = true;
|
|
8435
8435
|
const remainingComparators = comparators.slice();
|
|
8436
8436
|
let testComparator = remainingComparators.pop();
|
|
8437
8437
|
while (result && remainingComparators.length) {
|
|
8438
8438
|
result = remainingComparators.every((otherComparator) => {
|
|
8439
|
-
return testComparator.intersects(otherComparator,
|
|
8439
|
+
return testComparator.intersects(otherComparator, options2);
|
|
8440
8440
|
});
|
|
8441
8441
|
testComparator = remainingComparators.pop();
|
|
8442
8442
|
}
|
|
8443
8443
|
return result;
|
|
8444
8444
|
};
|
|
8445
|
-
var parseComparator = (comp,
|
|
8445
|
+
var parseComparator = (comp, options2) => {
|
|
8446
8446
|
comp = comp.replace(re2[t.BUILD], "");
|
|
8447
|
-
debug("comp", comp,
|
|
8448
|
-
comp = replaceCarets(comp,
|
|
8447
|
+
debug("comp", comp, options2);
|
|
8448
|
+
comp = replaceCarets(comp, options2);
|
|
8449
8449
|
debug("caret", comp);
|
|
8450
|
-
comp = replaceTildes(comp,
|
|
8450
|
+
comp = replaceTildes(comp, options2);
|
|
8451
8451
|
debug("tildes", comp);
|
|
8452
|
-
comp = replaceXRanges(comp,
|
|
8452
|
+
comp = replaceXRanges(comp, options2);
|
|
8453
8453
|
debug("xrange", comp);
|
|
8454
|
-
comp = replaceStars(comp,
|
|
8454
|
+
comp = replaceStars(comp, options2);
|
|
8455
8455
|
debug("stars", comp);
|
|
8456
8456
|
return comp;
|
|
8457
8457
|
};
|
|
8458
8458
|
var isX = (id) => !id || id.toLowerCase() === "x" || id === "*";
|
|
8459
8459
|
var invalidXRangeOrder = (M, m, p) => isX(M) && !isX(m) || isX(m) && p && !isX(p);
|
|
8460
|
-
var replaceTildes = (comp,
|
|
8461
|
-
return comp.trim().split(/\s+/).map((c) => replaceTilde(c,
|
|
8460
|
+
var replaceTildes = (comp, options2) => {
|
|
8461
|
+
return comp.trim().split(/\s+/).map((c) => replaceTilde(c, options2)).join(" ");
|
|
8462
8462
|
};
|
|
8463
|
-
var replaceTilde = (comp,
|
|
8464
|
-
const r =
|
|
8465
|
-
const z =
|
|
8463
|
+
var replaceTilde = (comp, options2) => {
|
|
8464
|
+
const r = options2.loose ? re2[t.TILDELOOSE] : re2[t.TILDE];
|
|
8465
|
+
const z = options2.includePrerelease ? "-0" : "";
|
|
8466
8466
|
return comp.replace(r, (_, M, m, p, pr) => {
|
|
8467
8467
|
debug("tilde", comp, _, M, m, p, pr);
|
|
8468
8468
|
let ret;
|
|
@@ -8482,13 +8482,13 @@ var require_range = __commonJS({
|
|
|
8482
8482
|
return ret;
|
|
8483
8483
|
});
|
|
8484
8484
|
};
|
|
8485
|
-
var replaceCarets = (comp,
|
|
8486
|
-
return comp.trim().split(/\s+/).map((c) => replaceCaret(c,
|
|
8485
|
+
var replaceCarets = (comp, options2) => {
|
|
8486
|
+
return comp.trim().split(/\s+/).map((c) => replaceCaret(c, options2)).join(" ");
|
|
8487
8487
|
};
|
|
8488
|
-
var replaceCaret = (comp,
|
|
8489
|
-
debug("caret", comp,
|
|
8490
|
-
const r =
|
|
8491
|
-
const z =
|
|
8488
|
+
var replaceCaret = (comp, options2) => {
|
|
8489
|
+
debug("caret", comp, options2);
|
|
8490
|
+
const r = options2.loose ? re2[t.CARETLOOSE] : re2[t.CARET];
|
|
8491
|
+
const z = options2.includePrerelease ? "-0" : "";
|
|
8492
8492
|
return comp.replace(r, (_, M, m, p, pr) => {
|
|
8493
8493
|
debug("caret", comp, _, M, m, p, pr);
|
|
8494
8494
|
let ret;
|
|
@@ -8529,13 +8529,13 @@ var require_range = __commonJS({
|
|
|
8529
8529
|
return ret;
|
|
8530
8530
|
});
|
|
8531
8531
|
};
|
|
8532
|
-
var replaceXRanges = (comp,
|
|
8533
|
-
debug("replaceXRanges", comp,
|
|
8534
|
-
return comp.split(/\s+/).map((c) => replaceXRange(c,
|
|
8532
|
+
var replaceXRanges = (comp, options2) => {
|
|
8533
|
+
debug("replaceXRanges", comp, options2);
|
|
8534
|
+
return comp.split(/\s+/).map((c) => replaceXRange(c, options2)).join(" ");
|
|
8535
8535
|
};
|
|
8536
|
-
var replaceXRange = (comp,
|
|
8536
|
+
var replaceXRange = (comp, options2) => {
|
|
8537
8537
|
comp = comp.trim();
|
|
8538
|
-
const r =
|
|
8538
|
+
const r = options2.loose ? re2[t.XRANGELOOSE] : re2[t.XRANGE];
|
|
8539
8539
|
return comp.replace(r, (ret, gtlt, M, m, p, pr) => {
|
|
8540
8540
|
debug("xRange", comp, ret, gtlt, M, m, p, pr);
|
|
8541
8541
|
if (invalidXRangeOrder(M, m, p)) {
|
|
@@ -8548,7 +8548,7 @@ var require_range = __commonJS({
|
|
|
8548
8548
|
if (gtlt === "=" && anyX) {
|
|
8549
8549
|
gtlt = "";
|
|
8550
8550
|
}
|
|
8551
|
-
pr =
|
|
8551
|
+
pr = options2.includePrerelease ? "-0" : "";
|
|
8552
8552
|
if (xM) {
|
|
8553
8553
|
if (gtlt === ">" || gtlt === "<") {
|
|
8554
8554
|
ret = "<0.0.0-0";
|
|
@@ -8591,13 +8591,13 @@ var require_range = __commonJS({
|
|
|
8591
8591
|
return ret;
|
|
8592
8592
|
});
|
|
8593
8593
|
};
|
|
8594
|
-
var replaceStars = (comp,
|
|
8595
|
-
debug("replaceStars", comp,
|
|
8594
|
+
var replaceStars = (comp, options2) => {
|
|
8595
|
+
debug("replaceStars", comp, options2);
|
|
8596
8596
|
return comp.trim().replace(re2[t.STAR], "");
|
|
8597
8597
|
};
|
|
8598
|
-
var replaceGTE0 = (comp,
|
|
8599
|
-
debug("replaceGTE0", comp,
|
|
8600
|
-
return comp.trim().replace(re2[
|
|
8598
|
+
var replaceGTE0 = (comp, options2) => {
|
|
8599
|
+
debug("replaceGTE0", comp, options2);
|
|
8600
|
+
return comp.trim().replace(re2[options2.includePrerelease ? t.GTE0PRE : t.GTE0], "");
|
|
8601
8601
|
};
|
|
8602
8602
|
var hyphenReplace = (incPr) => ($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr) => {
|
|
8603
8603
|
if (isX(fM)) {
|
|
@@ -8626,13 +8626,13 @@ var require_range = __commonJS({
|
|
|
8626
8626
|
}
|
|
8627
8627
|
return `${from} ${to}`.trim();
|
|
8628
8628
|
};
|
|
8629
|
-
var testSet = (set, version,
|
|
8629
|
+
var testSet = (set, version, options2) => {
|
|
8630
8630
|
for (let i = 0; i < set.length; i++) {
|
|
8631
8631
|
if (!set[i].test(version)) {
|
|
8632
8632
|
return false;
|
|
8633
8633
|
}
|
|
8634
8634
|
}
|
|
8635
|
-
if (version.prerelease.length && !
|
|
8635
|
+
if (version.prerelease.length && !options2.includePrerelease) {
|
|
8636
8636
|
for (let i = 0; i < set.length; i++) {
|
|
8637
8637
|
debug(set[i].semver);
|
|
8638
8638
|
if (set[i].semver === Comparator.ANY) {
|
|
@@ -8661,19 +8661,19 @@ var require_comparator = __commonJS({
|
|
|
8661
8661
|
static get ANY() {
|
|
8662
8662
|
return ANY;
|
|
8663
8663
|
}
|
|
8664
|
-
constructor(comp,
|
|
8665
|
-
|
|
8664
|
+
constructor(comp, options2) {
|
|
8665
|
+
options2 = parseOptions(options2);
|
|
8666
8666
|
if (comp instanceof _Comparator) {
|
|
8667
|
-
if (comp.loose === !!
|
|
8667
|
+
if (comp.loose === !!options2.loose) {
|
|
8668
8668
|
return comp;
|
|
8669
8669
|
} else {
|
|
8670
8670
|
comp = comp.value;
|
|
8671
8671
|
}
|
|
8672
8672
|
}
|
|
8673
8673
|
comp = comp.trim().split(/\s+/).join(" ");
|
|
8674
|
-
debug("comparator", comp,
|
|
8675
|
-
this.options =
|
|
8676
|
-
this.loose = !!
|
|
8674
|
+
debug("comparator", comp, options2);
|
|
8675
|
+
this.options = options2;
|
|
8676
|
+
this.loose = !!options2.loose;
|
|
8677
8677
|
this.parse(comp);
|
|
8678
8678
|
if (this.semver === ANY) {
|
|
8679
8679
|
this.value = "";
|
|
@@ -8715,7 +8715,7 @@ var require_comparator = __commonJS({
|
|
|
8715
8715
|
}
|
|
8716
8716
|
return cmp(version, this.operator, this.semver, this.options);
|
|
8717
8717
|
}
|
|
8718
|
-
intersects(comp,
|
|
8718
|
+
intersects(comp, options2) {
|
|
8719
8719
|
if (!(comp instanceof _Comparator)) {
|
|
8720
8720
|
throw new TypeError("a Comparator is required");
|
|
8721
8721
|
}
|
|
@@ -8723,18 +8723,18 @@ var require_comparator = __commonJS({
|
|
|
8723
8723
|
if (this.value === "") {
|
|
8724
8724
|
return true;
|
|
8725
8725
|
}
|
|
8726
|
-
return new Range(comp.value,
|
|
8726
|
+
return new Range(comp.value, options2).test(this.value);
|
|
8727
8727
|
} else if (comp.operator === "") {
|
|
8728
8728
|
if (comp.value === "") {
|
|
8729
8729
|
return true;
|
|
8730
8730
|
}
|
|
8731
|
-
return new Range(this.value,
|
|
8731
|
+
return new Range(this.value, options2).test(comp.semver);
|
|
8732
8732
|
}
|
|
8733
|
-
|
|
8734
|
-
if (
|
|
8733
|
+
options2 = parseOptions(options2);
|
|
8734
|
+
if (options2.includePrerelease && (this.value === "<0.0.0-0" || comp.value === "<0.0.0-0")) {
|
|
8735
8735
|
return false;
|
|
8736
8736
|
}
|
|
8737
|
-
if (!
|
|
8737
|
+
if (!options2.includePrerelease && (this.value.startsWith("<0.0.0") || comp.value.startsWith("<0.0.0"))) {
|
|
8738
8738
|
return false;
|
|
8739
8739
|
}
|
|
8740
8740
|
if (this.operator.startsWith(">") && comp.operator.startsWith(">")) {
|
|
@@ -8746,10 +8746,10 @@ var require_comparator = __commonJS({
|
|
|
8746
8746
|
if (this.semver.version === comp.semver.version && this.operator.includes("=") && comp.operator.includes("=")) {
|
|
8747
8747
|
return true;
|
|
8748
8748
|
}
|
|
8749
|
-
if (cmp(this.semver, "<", comp.semver,
|
|
8749
|
+
if (cmp(this.semver, "<", comp.semver, options2) && this.operator.startsWith(">") && comp.operator.startsWith("<")) {
|
|
8750
8750
|
return true;
|
|
8751
8751
|
}
|
|
8752
|
-
if (cmp(this.semver, ">", comp.semver,
|
|
8752
|
+
if (cmp(this.semver, ">", comp.semver, options2) && this.operator.startsWith("<") && comp.operator.startsWith(">")) {
|
|
8753
8753
|
return true;
|
|
8754
8754
|
}
|
|
8755
8755
|
return false;
|
|
@@ -8770,13 +8770,13 @@ var require_satisfies = __commonJS({
|
|
|
8770
8770
|
"node_modules/.pnpm/semver@7.8.5/node_modules/semver/functions/satisfies.js"(exports, module) {
|
|
8771
8771
|
"use strict";
|
|
8772
8772
|
var Range = require_range();
|
|
8773
|
-
var satisfies = (version,
|
|
8773
|
+
var satisfies = (version, range3, options2) => {
|
|
8774
8774
|
try {
|
|
8775
|
-
|
|
8775
|
+
range3 = new Range(range3, options2);
|
|
8776
8776
|
} catch (er) {
|
|
8777
8777
|
return false;
|
|
8778
8778
|
}
|
|
8779
|
-
return
|
|
8779
|
+
return range3.test(version);
|
|
8780
8780
|
};
|
|
8781
8781
|
module.exports = satisfies;
|
|
8782
8782
|
}
|
|
@@ -8787,7 +8787,7 @@ var require_to_comparators = __commonJS({
|
|
|
8787
8787
|
"node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/to-comparators.js"(exports, module) {
|
|
8788
8788
|
"use strict";
|
|
8789
8789
|
var Range = require_range();
|
|
8790
|
-
var toComparators = (
|
|
8790
|
+
var toComparators = (range3, options2) => new Range(range3, options2).set.map((comp) => comp.map((c) => c.value).join(" ").trim().split(" "));
|
|
8791
8791
|
module.exports = toComparators;
|
|
8792
8792
|
}
|
|
8793
8793
|
});
|
|
@@ -8798,12 +8798,12 @@ var require_max_satisfying = __commonJS({
|
|
|
8798
8798
|
"use strict";
|
|
8799
8799
|
var SemVer = require_semver();
|
|
8800
8800
|
var Range = require_range();
|
|
8801
|
-
var maxSatisfying = (versions,
|
|
8801
|
+
var maxSatisfying = (versions, range3, options2) => {
|
|
8802
8802
|
let max = null;
|
|
8803
8803
|
let maxSV = null;
|
|
8804
8804
|
let rangeObj = null;
|
|
8805
8805
|
try {
|
|
8806
|
-
rangeObj = new Range(
|
|
8806
|
+
rangeObj = new Range(range3, options2);
|
|
8807
8807
|
} catch (er) {
|
|
8808
8808
|
return null;
|
|
8809
8809
|
}
|
|
@@ -8811,7 +8811,7 @@ var require_max_satisfying = __commonJS({
|
|
|
8811
8811
|
if (rangeObj.test(v)) {
|
|
8812
8812
|
if (!max || maxSV.compare(v) === -1) {
|
|
8813
8813
|
max = v;
|
|
8814
|
-
maxSV = new SemVer(max,
|
|
8814
|
+
maxSV = new SemVer(max, options2);
|
|
8815
8815
|
}
|
|
8816
8816
|
}
|
|
8817
8817
|
});
|
|
@@ -8827,12 +8827,12 @@ var require_min_satisfying = __commonJS({
|
|
|
8827
8827
|
"use strict";
|
|
8828
8828
|
var SemVer = require_semver();
|
|
8829
8829
|
var Range = require_range();
|
|
8830
|
-
var minSatisfying = (versions,
|
|
8830
|
+
var minSatisfying = (versions, range3, options2) => {
|
|
8831
8831
|
let min = null;
|
|
8832
8832
|
let minSV = null;
|
|
8833
8833
|
let rangeObj = null;
|
|
8834
8834
|
try {
|
|
8835
|
-
rangeObj = new Range(
|
|
8835
|
+
rangeObj = new Range(range3, options2);
|
|
8836
8836
|
} catch (er) {
|
|
8837
8837
|
return null;
|
|
8838
8838
|
}
|
|
@@ -8840,7 +8840,7 @@ var require_min_satisfying = __commonJS({
|
|
|
8840
8840
|
if (rangeObj.test(v)) {
|
|
8841
8841
|
if (!min || minSV.compare(v) === 1) {
|
|
8842
8842
|
min = v;
|
|
8843
|
-
minSV = new SemVer(min,
|
|
8843
|
+
minSV = new SemVer(min, options2);
|
|
8844
8844
|
}
|
|
8845
8845
|
}
|
|
8846
8846
|
});
|
|
@@ -8857,19 +8857,19 @@ var require_min_version = __commonJS({
|
|
|
8857
8857
|
var SemVer = require_semver();
|
|
8858
8858
|
var Range = require_range();
|
|
8859
8859
|
var gt = require_gt();
|
|
8860
|
-
var minVersion = (
|
|
8861
|
-
|
|
8860
|
+
var minVersion = (range3, loose) => {
|
|
8861
|
+
range3 = new Range(range3, loose);
|
|
8862
8862
|
let minver = new SemVer("0.0.0");
|
|
8863
|
-
if (
|
|
8863
|
+
if (range3.test(minver)) {
|
|
8864
8864
|
return minver;
|
|
8865
8865
|
}
|
|
8866
8866
|
minver = new SemVer("0.0.0-0");
|
|
8867
|
-
if (
|
|
8867
|
+
if (range3.test(minver)) {
|
|
8868
8868
|
return minver;
|
|
8869
8869
|
}
|
|
8870
8870
|
minver = null;
|
|
8871
|
-
for (let i = 0; i <
|
|
8872
|
-
const comparators =
|
|
8871
|
+
for (let i = 0; i < range3.set.length; ++i) {
|
|
8872
|
+
const comparators = range3.set[i];
|
|
8873
8873
|
let setMin = null;
|
|
8874
8874
|
comparators.forEach((comparator) => {
|
|
8875
8875
|
const compver = new SemVer(comparator.semver.version);
|
|
@@ -8900,7 +8900,7 @@ var require_min_version = __commonJS({
|
|
|
8900
8900
|
minver = setMin;
|
|
8901
8901
|
}
|
|
8902
8902
|
}
|
|
8903
|
-
if (minver &&
|
|
8903
|
+
if (minver && range3.test(minver)) {
|
|
8904
8904
|
return minver;
|
|
8905
8905
|
}
|
|
8906
8906
|
return null;
|
|
@@ -8914,9 +8914,9 @@ var require_valid2 = __commonJS({
|
|
|
8914
8914
|
"node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/valid.js"(exports, module) {
|
|
8915
8915
|
"use strict";
|
|
8916
8916
|
var Range = require_range();
|
|
8917
|
-
var validRange = (
|
|
8917
|
+
var validRange = (range3, options2) => {
|
|
8918
8918
|
try {
|
|
8919
|
-
return new Range(
|
|
8919
|
+
return new Range(range3, options2).range || "*";
|
|
8920
8920
|
} catch (er) {
|
|
8921
8921
|
return null;
|
|
8922
8922
|
}
|
|
@@ -8938,9 +8938,9 @@ var require_outside = __commonJS({
|
|
|
8938
8938
|
var lt = require_lt();
|
|
8939
8939
|
var lte2 = require_lte();
|
|
8940
8940
|
var gte2 = require_gte();
|
|
8941
|
-
var outside = (version,
|
|
8942
|
-
version = new SemVer(version,
|
|
8943
|
-
|
|
8941
|
+
var outside = (version, range3, hilo, options2) => {
|
|
8942
|
+
version = new SemVer(version, options2);
|
|
8943
|
+
range3 = new Range(range3, options2);
|
|
8944
8944
|
let gtfn, ltefn, ltfn, comp, ecomp;
|
|
8945
8945
|
switch (hilo) {
|
|
8946
8946
|
case ">":
|
|
@@ -8960,11 +8960,11 @@ var require_outside = __commonJS({
|
|
|
8960
8960
|
default:
|
|
8961
8961
|
throw new TypeError('Must provide a hilo val of "<" or ">"');
|
|
8962
8962
|
}
|
|
8963
|
-
if (satisfies(version,
|
|
8963
|
+
if (satisfies(version, range3, options2)) {
|
|
8964
8964
|
return false;
|
|
8965
8965
|
}
|
|
8966
|
-
for (let i = 0; i <
|
|
8967
|
-
const comparators =
|
|
8966
|
+
for (let i = 0; i < range3.set.length; ++i) {
|
|
8967
|
+
const comparators = range3.set[i];
|
|
8968
8968
|
let high = null;
|
|
8969
8969
|
let low = null;
|
|
8970
8970
|
comparators.forEach((comparator) => {
|
|
@@ -8973,9 +8973,9 @@ var require_outside = __commonJS({
|
|
|
8973
8973
|
}
|
|
8974
8974
|
high = high || comparator;
|
|
8975
8975
|
low = low || comparator;
|
|
8976
|
-
if (gtfn(comparator.semver, high.semver,
|
|
8976
|
+
if (gtfn(comparator.semver, high.semver, options2)) {
|
|
8977
8977
|
high = comparator;
|
|
8978
|
-
} else if (ltfn(comparator.semver, low.semver,
|
|
8978
|
+
} else if (ltfn(comparator.semver, low.semver, options2)) {
|
|
8979
8979
|
low = comparator;
|
|
8980
8980
|
}
|
|
8981
8981
|
});
|
|
@@ -8999,7 +8999,7 @@ var require_gtr = __commonJS({
|
|
|
8999
8999
|
"node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/gtr.js"(exports, module) {
|
|
9000
9000
|
"use strict";
|
|
9001
9001
|
var outside = require_outside();
|
|
9002
|
-
var gtr = (version,
|
|
9002
|
+
var gtr = (version, range3, options2) => outside(version, range3, ">", options2);
|
|
9003
9003
|
module.exports = gtr;
|
|
9004
9004
|
}
|
|
9005
9005
|
});
|
|
@@ -9009,7 +9009,7 @@ var require_ltr = __commonJS({
|
|
|
9009
9009
|
"node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/ltr.js"(exports, module) {
|
|
9010
9010
|
"use strict";
|
|
9011
9011
|
var outside = require_outside();
|
|
9012
|
-
var ltr = (version,
|
|
9012
|
+
var ltr = (version, range3, options2) => outside(version, range3, "<", options2);
|
|
9013
9013
|
module.exports = ltr;
|
|
9014
9014
|
}
|
|
9015
9015
|
});
|
|
@@ -9019,10 +9019,10 @@ var require_intersects = __commonJS({
|
|
|
9019
9019
|
"node_modules/.pnpm/semver@7.8.5/node_modules/semver/ranges/intersects.js"(exports, module) {
|
|
9020
9020
|
"use strict";
|
|
9021
9021
|
var Range = require_range();
|
|
9022
|
-
var intersects = (r1, r2,
|
|
9023
|
-
r1 = new Range(r1,
|
|
9024
|
-
r2 = new Range(r2,
|
|
9025
|
-
return r1.intersects(r2,
|
|
9022
|
+
var intersects = (r1, r2, options2) => {
|
|
9023
|
+
r1 = new Range(r1, options2);
|
|
9024
|
+
r2 = new Range(r2, options2);
|
|
9025
|
+
return r1.intersects(r2, options2);
|
|
9026
9026
|
};
|
|
9027
9027
|
module.exports = intersects;
|
|
9028
9028
|
}
|
|
@@ -9034,13 +9034,13 @@ var require_simplify = __commonJS({
|
|
|
9034
9034
|
"use strict";
|
|
9035
9035
|
var satisfies = require_satisfies();
|
|
9036
9036
|
var compare = require_compare();
|
|
9037
|
-
module.exports = (versions,
|
|
9037
|
+
module.exports = (versions, range3, options2) => {
|
|
9038
9038
|
const set = [];
|
|
9039
9039
|
let first = null;
|
|
9040
9040
|
let prev = null;
|
|
9041
|
-
const v = versions.sort((a, b) => compare(a, b,
|
|
9041
|
+
const v = versions.sort((a, b) => compare(a, b, options2));
|
|
9042
9042
|
for (const version of v) {
|
|
9043
|
-
const included = satisfies(version,
|
|
9043
|
+
const included = satisfies(version, range3, options2);
|
|
9044
9044
|
if (included) {
|
|
9045
9045
|
prev = version;
|
|
9046
9046
|
if (!first) {
|
|
@@ -9072,8 +9072,8 @@ var require_simplify = __commonJS({
|
|
|
9072
9072
|
}
|
|
9073
9073
|
}
|
|
9074
9074
|
const simplified = ranges.join(" || ");
|
|
9075
|
-
const original = typeof
|
|
9076
|
-
return simplified.length < original.length ? simplified :
|
|
9075
|
+
const original = typeof range3.raw === "string" ? range3.raw : String(range3);
|
|
9076
|
+
return simplified.length < original.length ? simplified : range3;
|
|
9077
9077
|
};
|
|
9078
9078
|
}
|
|
9079
9079
|
});
|
|
@@ -9087,16 +9087,16 @@ var require_subset = __commonJS({
|
|
|
9087
9087
|
var { ANY } = Comparator;
|
|
9088
9088
|
var satisfies = require_satisfies();
|
|
9089
9089
|
var compare = require_compare();
|
|
9090
|
-
var subset = (sub, dom,
|
|
9090
|
+
var subset = (sub, dom, options2 = {}) => {
|
|
9091
9091
|
if (sub === dom) {
|
|
9092
9092
|
return true;
|
|
9093
9093
|
}
|
|
9094
|
-
sub = new Range(sub,
|
|
9095
|
-
dom = new Range(dom,
|
|
9094
|
+
sub = new Range(sub, options2);
|
|
9095
|
+
dom = new Range(dom, options2);
|
|
9096
9096
|
let sawNonNull = false;
|
|
9097
9097
|
OUTER: for (const simpleSub of sub.set) {
|
|
9098
9098
|
for (const simpleDom of dom.set) {
|
|
9099
|
-
const isSub = simpleSubset(simpleSub, simpleDom,
|
|
9099
|
+
const isSub = simpleSubset(simpleSub, simpleDom, options2);
|
|
9100
9100
|
sawNonNull = sawNonNull || isSub !== null;
|
|
9101
9101
|
if (isSub) {
|
|
9102
9102
|
continue OUTER;
|
|
@@ -9110,21 +9110,21 @@ var require_subset = __commonJS({
|
|
|
9110
9110
|
};
|
|
9111
9111
|
var minimumVersionWithPreRelease = [new Comparator(">=0.0.0-0")];
|
|
9112
9112
|
var minimumVersion = [new Comparator(">=0.0.0")];
|
|
9113
|
-
var simpleSubset = (sub, dom,
|
|
9113
|
+
var simpleSubset = (sub, dom, options2) => {
|
|
9114
9114
|
if (sub === dom) {
|
|
9115
9115
|
return true;
|
|
9116
9116
|
}
|
|
9117
9117
|
if (sub.length === 1 && sub[0].semver === ANY) {
|
|
9118
9118
|
if (dom.length === 1 && dom[0].semver === ANY) {
|
|
9119
9119
|
return true;
|
|
9120
|
-
} else if (
|
|
9120
|
+
} else if (options2.includePrerelease) {
|
|
9121
9121
|
sub = minimumVersionWithPreRelease;
|
|
9122
9122
|
} else {
|
|
9123
9123
|
sub = minimumVersion;
|
|
9124
9124
|
}
|
|
9125
9125
|
}
|
|
9126
9126
|
if (dom.length === 1 && dom[0].semver === ANY) {
|
|
9127
|
-
if (
|
|
9127
|
+
if (options2.includePrerelease) {
|
|
9128
9128
|
return true;
|
|
9129
9129
|
} else {
|
|
9130
9130
|
dom = minimumVersion;
|
|
@@ -9134,9 +9134,9 @@ var require_subset = __commonJS({
|
|
|
9134
9134
|
let gt, lt;
|
|
9135
9135
|
for (const c of sub) {
|
|
9136
9136
|
if (c.operator === ">" || c.operator === ">=") {
|
|
9137
|
-
gt = higherGT(gt, c,
|
|
9137
|
+
gt = higherGT(gt, c, options2);
|
|
9138
9138
|
} else if (c.operator === "<" || c.operator === "<=") {
|
|
9139
|
-
lt = lowerLT(lt, c,
|
|
9139
|
+
lt = lowerLT(lt, c, options2);
|
|
9140
9140
|
} else {
|
|
9141
9141
|
eqSet.add(c.semver);
|
|
9142
9142
|
}
|
|
@@ -9146,7 +9146,7 @@ var require_subset = __commonJS({
|
|
|
9146
9146
|
}
|
|
9147
9147
|
let gtltComp;
|
|
9148
9148
|
if (gt && lt) {
|
|
9149
|
-
gtltComp = compare(gt.semver, lt.semver,
|
|
9149
|
+
gtltComp = compare(gt.semver, lt.semver, options2);
|
|
9150
9150
|
if (gtltComp > 0) {
|
|
9151
9151
|
return null;
|
|
9152
9152
|
} else if (gtltComp === 0 && (gt.operator !== ">=" || lt.operator !== "<=")) {
|
|
@@ -9154,14 +9154,14 @@ var require_subset = __commonJS({
|
|
|
9154
9154
|
}
|
|
9155
9155
|
}
|
|
9156
9156
|
for (const eq of eqSet) {
|
|
9157
|
-
if (gt && !satisfies(eq, String(gt),
|
|
9157
|
+
if (gt && !satisfies(eq, String(gt), options2)) {
|
|
9158
9158
|
return null;
|
|
9159
9159
|
}
|
|
9160
|
-
if (lt && !satisfies(eq, String(lt),
|
|
9160
|
+
if (lt && !satisfies(eq, String(lt), options2)) {
|
|
9161
9161
|
return null;
|
|
9162
9162
|
}
|
|
9163
9163
|
for (const c of dom) {
|
|
9164
|
-
if (!satisfies(eq, String(c),
|
|
9164
|
+
if (!satisfies(eq, String(c), options2)) {
|
|
9165
9165
|
return false;
|
|
9166
9166
|
}
|
|
9167
9167
|
}
|
|
@@ -9169,8 +9169,8 @@ var require_subset = __commonJS({
|
|
|
9169
9169
|
}
|
|
9170
9170
|
let higher, lower;
|
|
9171
9171
|
let hasDomLT, hasDomGT;
|
|
9172
|
-
let needDomLTPre = lt && !
|
|
9173
|
-
let needDomGTPre = gt && !
|
|
9172
|
+
let needDomLTPre = lt && !options2.includePrerelease && lt.semver.prerelease.length ? lt.semver : false;
|
|
9173
|
+
let needDomGTPre = gt && !options2.includePrerelease && gt.semver.prerelease.length ? gt.semver : false;
|
|
9174
9174
|
if (needDomLTPre && needDomLTPre.prerelease.length === 1 && lt.operator === "<" && needDomLTPre.prerelease[0] === 0) {
|
|
9175
9175
|
needDomLTPre = false;
|
|
9176
9176
|
}
|
|
@@ -9184,7 +9184,7 @@ var require_subset = __commonJS({
|
|
|
9184
9184
|
}
|
|
9185
9185
|
}
|
|
9186
9186
|
if (c.operator === ">" || c.operator === ">=") {
|
|
9187
|
-
higher = higherGT(gt, c,
|
|
9187
|
+
higher = higherGT(gt, c, options2);
|
|
9188
9188
|
if (higher === c && higher !== gt) {
|
|
9189
9189
|
return false;
|
|
9190
9190
|
}
|
|
@@ -9199,7 +9199,7 @@ var require_subset = __commonJS({
|
|
|
9199
9199
|
}
|
|
9200
9200
|
}
|
|
9201
9201
|
if (c.operator === "<" || c.operator === "<=") {
|
|
9202
|
-
lower = lowerLT(lt, c,
|
|
9202
|
+
lower = lowerLT(lt, c, options2);
|
|
9203
9203
|
if (lower === c && lower !== lt) {
|
|
9204
9204
|
return false;
|
|
9205
9205
|
}
|
|
@@ -9222,18 +9222,18 @@ var require_subset = __commonJS({
|
|
|
9222
9222
|
}
|
|
9223
9223
|
return true;
|
|
9224
9224
|
};
|
|
9225
|
-
var higherGT = (a, b,
|
|
9225
|
+
var higherGT = (a, b, options2) => {
|
|
9226
9226
|
if (!a) {
|
|
9227
9227
|
return b;
|
|
9228
9228
|
}
|
|
9229
|
-
const comp = compare(a.semver, b.semver,
|
|
9229
|
+
const comp = compare(a.semver, b.semver, options2);
|
|
9230
9230
|
return comp > 0 ? a : comp < 0 ? b : b.operator === ">" && a.operator === ">=" ? b : a;
|
|
9231
9231
|
};
|
|
9232
|
-
var lowerLT = (a, b,
|
|
9232
|
+
var lowerLT = (a, b, options2) => {
|
|
9233
9233
|
if (!a) {
|
|
9234
9234
|
return b;
|
|
9235
9235
|
}
|
|
9236
|
-
const comp = compare(a.semver, b.semver,
|
|
9236
|
+
const comp = compare(a.semver, b.semver, options2);
|
|
9237
9237
|
return comp < 0 ? a : comp > 0 ? b : b.operator === "<" && a.operator === "<=" ? b : a;
|
|
9238
9238
|
};
|
|
9239
9239
|
module.exports = subset;
|
|
@@ -9523,8 +9523,8 @@ var DiagAPI = class DiagAPI2 {
|
|
|
9523
9523
|
self2.disable = () => {
|
|
9524
9524
|
unregisterGlobal(API_NAME, self2);
|
|
9525
9525
|
};
|
|
9526
|
-
self2.createComponentLogger = (
|
|
9527
|
-
return new DiagComponentLogger(
|
|
9526
|
+
self2.createComponentLogger = (options2) => {
|
|
9527
|
+
return new DiagComponentLogger(options2);
|
|
9528
9528
|
};
|
|
9529
9529
|
self2.verbose = _logProxy("verbose");
|
|
9530
9530
|
self2.debug = _logProxy("debug");
|
|
@@ -9875,8 +9875,8 @@ function getSpanContext(context2) {
|
|
|
9875
9875
|
// node_modules/.pnpm/@opentelemetry+api@1.10.0/node_modules/@opentelemetry/api/dist/trace/NoopTracer.mjs
|
|
9876
9876
|
var contextApi = ContextAPI.getInstance();
|
|
9877
9877
|
var NoopTracer = class {
|
|
9878
|
-
startSpan(name,
|
|
9879
|
-
if (Boolean(
|
|
9878
|
+
startSpan(name, options2, context2 = contextApi.active()) {
|
|
9879
|
+
if (Boolean(options2 === null || options2 === void 0 ? void 0 : options2.root)) return new NonRecordingSpan();
|
|
9880
9880
|
const parentFromContext = context2 && getSpanContext(context2);
|
|
9881
9881
|
if (isSpanContext(parentFromContext) && isSpanContextValid(parentFromContext)) return new NonRecordingSpan(parentFromContext);
|
|
9882
9882
|
else return new NonRecordingSpan();
|
|
@@ -9909,14 +9909,14 @@ function isSpanContext(spanContext) {
|
|
|
9909
9909
|
// node_modules/.pnpm/@opentelemetry+api@1.10.0/node_modules/@opentelemetry/api/dist/trace/ProxyTracer.mjs
|
|
9910
9910
|
var NOOP_TRACER = new NoopTracer();
|
|
9911
9911
|
var ProxyTracer = class {
|
|
9912
|
-
constructor(provider, name, version,
|
|
9912
|
+
constructor(provider, name, version, options2) {
|
|
9913
9913
|
this._provider = provider;
|
|
9914
9914
|
this.name = name;
|
|
9915
9915
|
this.version = version;
|
|
9916
|
-
this.options =
|
|
9916
|
+
this.options = options2;
|
|
9917
9917
|
}
|
|
9918
|
-
startSpan(name,
|
|
9919
|
-
return this._getTracer().startSpan(name,
|
|
9918
|
+
startSpan(name, options2, context2) {
|
|
9919
|
+
return this._getTracer().startSpan(name, options2, context2);
|
|
9920
9920
|
}
|
|
9921
9921
|
startActiveSpan(_name, _options, _context, _fn) {
|
|
9922
9922
|
const tracer = this._getTracer();
|
|
@@ -10027,9 +10027,9 @@ var ProxyTracerProvider = class {
|
|
|
10027
10027
|
/**
|
|
10028
10028
|
* Get a {@link ProxyTracer}
|
|
10029
10029
|
*/
|
|
10030
|
-
getTracer(name, version,
|
|
10030
|
+
getTracer(name, version, options2) {
|
|
10031
10031
|
var _this$getDelegateTrac;
|
|
10032
|
-
return (_this$getDelegateTrac = this.getDelegateTracer(name, version,
|
|
10032
|
+
return (_this$getDelegateTrac = this.getDelegateTracer(name, version, options2)) !== null && _this$getDelegateTrac !== void 0 ? _this$getDelegateTrac : new ProxyTracer(this, name, version, options2);
|
|
10033
10033
|
}
|
|
10034
10034
|
getDelegate() {
|
|
10035
10035
|
var _this$_delegate;
|
|
@@ -10041,9 +10041,9 @@ var ProxyTracerProvider = class {
|
|
|
10041
10041
|
setDelegate(delegate) {
|
|
10042
10042
|
this._delegate = delegate;
|
|
10043
10043
|
}
|
|
10044
|
-
getDelegateTracer(name, version,
|
|
10044
|
+
getDelegateTracer(name, version, options2) {
|
|
10045
10045
|
var _this$_delegate2;
|
|
10046
|
-
return (_this$_delegate2 = this._delegate) === null || _this$_delegate2 === void 0 ? void 0 : _this$_delegate2.getTracer(name, version,
|
|
10046
|
+
return (_this$_delegate2 = this._delegate) === null || _this$_delegate2 === void 0 ? void 0 : _this$_delegate2.getTracer(name, version, options2);
|
|
10047
10047
|
}
|
|
10048
10048
|
};
|
|
10049
10049
|
|
|
@@ -10191,9 +10191,427 @@ import {
|
|
|
10191
10191
|
import { dirname as dirname2, join as join2 } from "node:path";
|
|
10192
10192
|
import { setTimeout as delay2 } from "node:timers/promises";
|
|
10193
10193
|
import { stdin as input, stderr, stdout } from "node:process";
|
|
10194
|
-
import { inspect, parseArgs } from "node:util";
|
|
10194
|
+
import { inspect, parseArgs as parseArgs2 } from "node:util";
|
|
10195
10195
|
import { isMainThread, Worker } from "node:worker_threads";
|
|
10196
10196
|
|
|
10197
|
+
// src/cli/schema-args.ts
|
|
10198
|
+
import { readFileSync } from "node:fs";
|
|
10199
|
+
import { parseArgs } from "node:util";
|
|
10200
|
+
var SchemaArgsError = class extends Error {
|
|
10201
|
+
constructor(usage, message) {
|
|
10202
|
+
super(message);
|
|
10203
|
+
this.usage = usage;
|
|
10204
|
+
}
|
|
10205
|
+
usage;
|
|
10206
|
+
};
|
|
10207
|
+
var RESERVED = /* @__PURE__ */ new Set(["help", "json"]);
|
|
10208
|
+
var SCALAR = /* @__PURE__ */ new Set(["string", "number", "integer", "boolean"]);
|
|
10209
|
+
function record(value) {
|
|
10210
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
10211
|
+
}
|
|
10212
|
+
function usageOf(command) {
|
|
10213
|
+
return command.path.join(" ");
|
|
10214
|
+
}
|
|
10215
|
+
function enumOf(property) {
|
|
10216
|
+
if (Array.isArray(property.enum)) return property.enum;
|
|
10217
|
+
if ("const" in property) return [property.const];
|
|
10218
|
+
const variants = property.anyOf ?? property.oneOf;
|
|
10219
|
+
if (!Array.isArray(variants)) return void 0;
|
|
10220
|
+
const consts = variants.map(record).filter((variant) => variant.type !== "null");
|
|
10221
|
+
return consts.length > 0 && consts.every((variant) => "const" in variant) ? consts.map((variant) => variant.const) : void 0;
|
|
10222
|
+
}
|
|
10223
|
+
function scalarOf(property) {
|
|
10224
|
+
const { type } = property;
|
|
10225
|
+
const types2 = (Array.isArray(type) ? type : [type]).filter(
|
|
10226
|
+
(entry) => entry !== void 0 && entry !== "null"
|
|
10227
|
+
);
|
|
10228
|
+
if (types2.length === 1 && SCALAR.has(String(types2[0])))
|
|
10229
|
+
return String(types2[0]);
|
|
10230
|
+
const variants = property.anyOf ?? property.oneOf;
|
|
10231
|
+
if (types2.length === 0 && Array.isArray(variants)) {
|
|
10232
|
+
const typed = variants.map(record).filter((variant) => variant.type !== "null" && !("const" in variant));
|
|
10233
|
+
if (typed.length === 1) {
|
|
10234
|
+
const type2 = scalarOf(typed[0]);
|
|
10235
|
+
if (type2) return type2;
|
|
10236
|
+
}
|
|
10237
|
+
}
|
|
10238
|
+
const values = enumOf(property);
|
|
10239
|
+
if (types2.length === 0 && values?.length) {
|
|
10240
|
+
const kinds = new Set(values.map((value) => typeof value));
|
|
10241
|
+
if (kinds.size === 1) {
|
|
10242
|
+
const [kind] = kinds;
|
|
10243
|
+
if (kind === "number")
|
|
10244
|
+
return values.every(Number.isInteger) ? "integer" : "number";
|
|
10245
|
+
if (kind === "string" || kind === "boolean") return kind;
|
|
10246
|
+
}
|
|
10247
|
+
}
|
|
10248
|
+
return void 0;
|
|
10249
|
+
}
|
|
10250
|
+
function allowsType(property, wanted) {
|
|
10251
|
+
const type = property.type;
|
|
10252
|
+
if (type === wanted || Array.isArray(type) && type.includes(wanted))
|
|
10253
|
+
return true;
|
|
10254
|
+
return ["anyOf", "oneOf", "allOf"].some((key) => {
|
|
10255
|
+
const branches = property[key];
|
|
10256
|
+
return Array.isArray(branches) && branches.some((branch) => allowsType(record(branch), wanted));
|
|
10257
|
+
});
|
|
10258
|
+
}
|
|
10259
|
+
function untyped(property) {
|
|
10260
|
+
return property.type === void 0 && enumOf(property) === void 0 && !["$ref", "anyOf", "oneOf", "allOf", "properties", "items"].some(
|
|
10261
|
+
(key) => key in property
|
|
10262
|
+
);
|
|
10263
|
+
}
|
|
10264
|
+
function shapeOf(property) {
|
|
10265
|
+
const type = scalarOf(property);
|
|
10266
|
+
if (type || untyped(property)) return { kind: "scalar", type };
|
|
10267
|
+
if (property.type === "array") {
|
|
10268
|
+
const items = record(property.items);
|
|
10269
|
+
const itemType = scalarOf(items);
|
|
10270
|
+
if (itemType && itemType !== "boolean" || items && untyped(items))
|
|
10271
|
+
return { kind: "array", items, type: itemType };
|
|
10272
|
+
}
|
|
10273
|
+
return { kind: "json" };
|
|
10274
|
+
}
|
|
10275
|
+
function kebab(name) {
|
|
10276
|
+
return name.replace(/([a-z0-9])([A-Z])/g, "$1-$2").replace(/_/g, "-").toLowerCase();
|
|
10277
|
+
}
|
|
10278
|
+
var isBoolean = (shape) => shape.kind === "scalar" && shape.type === "boolean";
|
|
10279
|
+
function fields(command) {
|
|
10280
|
+
const required = new Set(
|
|
10281
|
+
Array.isArray(command.schema.required) ? command.schema.required.map(String) : []
|
|
10282
|
+
);
|
|
10283
|
+
const all = Object.entries(record(command.schema.properties)).map(
|
|
10284
|
+
([name, value]) => {
|
|
10285
|
+
const property = record(value);
|
|
10286
|
+
const shape = RESERVED.has(name) ? { kind: "json" } : shapeOf(property);
|
|
10287
|
+
return { name, property, shape, required: required.has(name) };
|
|
10288
|
+
}
|
|
10289
|
+
);
|
|
10290
|
+
const spellings = (name, shape) => {
|
|
10291
|
+
const forms = [name, kebab(name)];
|
|
10292
|
+
return isBoolean(shape) ? [...forms, ...forms.map((form) => `no-${form}`)] : forms;
|
|
10293
|
+
};
|
|
10294
|
+
const counts = /* @__PURE__ */ new Map();
|
|
10295
|
+
for (const field of all)
|
|
10296
|
+
for (const form of new Set(spellings(field.name, field.shape)))
|
|
10297
|
+
counts.set(form, (counts.get(form) ?? 0) + 1);
|
|
10298
|
+
const reserved = new Set(command.reserved ?? []);
|
|
10299
|
+
return all.map((field) => {
|
|
10300
|
+
let flag = spellings(field.name, field.shape).every(
|
|
10301
|
+
(form) => counts.get(form) === 1
|
|
10302
|
+
) ? kebab(field.name) : field.name;
|
|
10303
|
+
if (isBoolean(field.shape) && flag.startsWith("no-")) flag = field.name;
|
|
10304
|
+
const forms = isBoolean(field.shape) ? [flag, field.name, `no-${flag}`, `no-${field.name}`] : [flag, field.name];
|
|
10305
|
+
return {
|
|
10306
|
+
...field,
|
|
10307
|
+
flag,
|
|
10308
|
+
reserved: forms.some((form) => reserved.has(form)) || isBoolean(field.shape) && flag.startsWith("no-")
|
|
10309
|
+
};
|
|
10310
|
+
});
|
|
10311
|
+
}
|
|
10312
|
+
var flagged = (field) => field.shape.kind !== "json" && !field.reserved;
|
|
10313
|
+
function options(command) {
|
|
10314
|
+
const config = {
|
|
10315
|
+
help: { type: "boolean", short: "h" },
|
|
10316
|
+
json: { type: "string" }
|
|
10317
|
+
};
|
|
10318
|
+
for (const field of fields(command).filter(flagged))
|
|
10319
|
+
config[field.flag] = isBoolean(field.shape) ? { type: "boolean" } : { type: "string", multiple: field.shape.kind === "array" };
|
|
10320
|
+
return config;
|
|
10321
|
+
}
|
|
10322
|
+
function canonical(command, argv) {
|
|
10323
|
+
const aliases = /* @__PURE__ */ new Map();
|
|
10324
|
+
const takesValue = /* @__PURE__ */ new Set(["json"]);
|
|
10325
|
+
for (const field of fields(command).filter(flagged)) {
|
|
10326
|
+
if (!isBoolean(field.shape)) {
|
|
10327
|
+
takesValue.add(field.flag);
|
|
10328
|
+
takesValue.add(field.name);
|
|
10329
|
+
}
|
|
10330
|
+
if (field.flag !== field.name) {
|
|
10331
|
+
aliases.set(field.name, field.flag);
|
|
10332
|
+
if (isBoolean(field.shape))
|
|
10333
|
+
aliases.set(`no-${field.name}`, `no-${field.flag}`);
|
|
10334
|
+
}
|
|
10335
|
+
}
|
|
10336
|
+
const out = [];
|
|
10337
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
10338
|
+
const word = argv[index];
|
|
10339
|
+
if (word === "--") {
|
|
10340
|
+
out.push(...argv.slice(index));
|
|
10341
|
+
break;
|
|
10342
|
+
}
|
|
10343
|
+
if (!word.startsWith("--")) {
|
|
10344
|
+
out.push(word);
|
|
10345
|
+
continue;
|
|
10346
|
+
}
|
|
10347
|
+
const equals = word.indexOf("=");
|
|
10348
|
+
const name = word.slice(2, equals === -1 ? void 0 : equals);
|
|
10349
|
+
const flag = aliases.get(name);
|
|
10350
|
+
out.push(
|
|
10351
|
+
flag === void 0 ? word : `--${flag}${equals === -1 ? "" : word.slice(equals)}`
|
|
10352
|
+
);
|
|
10353
|
+
if (equals === -1 && takesValue.has(name) && index + 1 < argv.length)
|
|
10354
|
+
out.push(argv[++index]);
|
|
10355
|
+
}
|
|
10356
|
+
return out;
|
|
10357
|
+
}
|
|
10358
|
+
function decode(type, text) {
|
|
10359
|
+
if (type === "string") return text;
|
|
10360
|
+
if (type === "number" || type === "integer") {
|
|
10361
|
+
const value = Number(text);
|
|
10362
|
+
return text.trim() && Number.isFinite(value) ? value : text;
|
|
10363
|
+
}
|
|
10364
|
+
try {
|
|
10365
|
+
const value = JSON.parse(text);
|
|
10366
|
+
return typeof value === "string" ? text : value;
|
|
10367
|
+
} catch {
|
|
10368
|
+
return text;
|
|
10369
|
+
}
|
|
10370
|
+
}
|
|
10371
|
+
function valueOf(field, raw) {
|
|
10372
|
+
const { shape } = field;
|
|
10373
|
+
if (typeof raw === "boolean") return raw;
|
|
10374
|
+
if (shape.kind !== "array") {
|
|
10375
|
+
const text = String(Array.isArray(raw) ? raw.at(-1) : raw);
|
|
10376
|
+
if (text === "null" && allowsType(field.property, "null")) return null;
|
|
10377
|
+
return decode(shape.kind === "scalar" ? shape.type : void 0, text);
|
|
10378
|
+
}
|
|
10379
|
+
const texts = (Array.isArray(raw) ? raw : [raw]).map(String);
|
|
10380
|
+
if (texts.length === 1 && texts[0].trimStart().startsWith("[")) {
|
|
10381
|
+
try {
|
|
10382
|
+
const whole = JSON.parse(texts[0]);
|
|
10383
|
+
if (Array.isArray(whole)) return whole;
|
|
10384
|
+
} catch {
|
|
10385
|
+
}
|
|
10386
|
+
}
|
|
10387
|
+
return texts.map((text) => decode(shape.type, text));
|
|
10388
|
+
}
|
|
10389
|
+
var ASSIGNMENT = /^([A-Za-z_][A-Za-z0-9_.-]*)=([\s\S]*)$/;
|
|
10390
|
+
function withNamed(command, argv, reserved) {
|
|
10391
|
+
const properties = { ...record(command.schema.properties) };
|
|
10392
|
+
for (const word of argv) {
|
|
10393
|
+
const name = /^--([^=]+)/.exec(word)?.[1] ?? ASSIGNMENT.exec(word)?.[1];
|
|
10394
|
+
if (name && !reserved.has(name) && !(name in properties))
|
|
10395
|
+
properties[name] = {};
|
|
10396
|
+
}
|
|
10397
|
+
return { ...command, schema: { ...command.schema, properties } };
|
|
10398
|
+
}
|
|
10399
|
+
function assignedText(usage, name, text) {
|
|
10400
|
+
if (text.startsWith('"'))
|
|
10401
|
+
try {
|
|
10402
|
+
const unquoted = JSON.parse(text);
|
|
10403
|
+
if (typeof unquoted === "string") return { text: unquoted, exact: true };
|
|
10404
|
+
} catch {
|
|
10405
|
+
}
|
|
10406
|
+
if (text.startsWith("@@")) return { text: text.slice(1), exact: false };
|
|
10407
|
+
if (!text.startsWith("@")) return { text, exact: false };
|
|
10408
|
+
const path2 = text.slice(1);
|
|
10409
|
+
const fail = (message) => new SchemaArgsError(usage, `${usage}: ${message}`);
|
|
10410
|
+
if (!path2)
|
|
10411
|
+
throw fail(`${name}=@ needs a path; use @@ for a literal leading @`);
|
|
10412
|
+
let contents;
|
|
10413
|
+
try {
|
|
10414
|
+
contents = readFileSync(path2);
|
|
10415
|
+
} catch (error) {
|
|
10416
|
+
throw fail(
|
|
10417
|
+
`cannot read ${path2} for ${name}: ${error instanceof Error ? error.message : String(error)}`
|
|
10418
|
+
);
|
|
10419
|
+
}
|
|
10420
|
+
try {
|
|
10421
|
+
return {
|
|
10422
|
+
text: new TextDecoder("utf-8", { fatal: true }).decode(contents),
|
|
10423
|
+
exact: true
|
|
10424
|
+
};
|
|
10425
|
+
} catch {
|
|
10426
|
+
throw fail(`${path2} for ${name} is not UTF-8 text`);
|
|
10427
|
+
}
|
|
10428
|
+
}
|
|
10429
|
+
function parseSchemaArgs(command, argv, stdin, { assignments = false, unknown = false } = {}) {
|
|
10430
|
+
if (unknown) command = withNamed(command, argv, RESERVED);
|
|
10431
|
+
const usage = usageOf(command);
|
|
10432
|
+
const fail = (message) => new SchemaArgsError(usage, `${usage}: ${message}`);
|
|
10433
|
+
let values;
|
|
10434
|
+
let positionals;
|
|
10435
|
+
try {
|
|
10436
|
+
({ values, positionals } = parseArgs({
|
|
10437
|
+
args: canonical(command, argv),
|
|
10438
|
+
options: options(command),
|
|
10439
|
+
strict: true,
|
|
10440
|
+
allowPositionals: assignments,
|
|
10441
|
+
allowNegative: true
|
|
10442
|
+
}));
|
|
10443
|
+
} catch (error) {
|
|
10444
|
+
throw fail(
|
|
10445
|
+
(error instanceof Error ? error.message : String(error)).split("\n")[0]
|
|
10446
|
+
);
|
|
10447
|
+
}
|
|
10448
|
+
if (values.help === true) return { help: true, args: {} };
|
|
10449
|
+
let args = {};
|
|
10450
|
+
if (typeof values.json === "string") {
|
|
10451
|
+
const text = values.json === "-" ? stdin?.() ?? "" : values.json;
|
|
10452
|
+
let body = {};
|
|
10453
|
+
if (text.trim())
|
|
10454
|
+
try {
|
|
10455
|
+
body = JSON.parse(text);
|
|
10456
|
+
} catch {
|
|
10457
|
+
throw fail("--json is not valid JSON");
|
|
10458
|
+
}
|
|
10459
|
+
if (!body || typeof body !== "object" || Array.isArray(body))
|
|
10460
|
+
throw fail("--json must be an object");
|
|
10461
|
+
args = { ...body };
|
|
10462
|
+
}
|
|
10463
|
+
const all = fields(command);
|
|
10464
|
+
for (const field of all.filter(flagged)) {
|
|
10465
|
+
const raw = values[field.flag];
|
|
10466
|
+
if (raw !== void 0) args[field.name] = valueOf(field, raw);
|
|
10467
|
+
}
|
|
10468
|
+
const assigned = /* @__PURE__ */ new Set();
|
|
10469
|
+
for (const word of positionals) {
|
|
10470
|
+
const match2 = ASSIGNMENT.exec(word);
|
|
10471
|
+
if (!match2) throw fail(`'${word}' is not name=value or a --flag`);
|
|
10472
|
+
const [, name, raw] = match2;
|
|
10473
|
+
const field = all.find((entry) => entry.name === name);
|
|
10474
|
+
if (assigned.has(name) || field && values[field.flag] !== void 0)
|
|
10475
|
+
throw fail(
|
|
10476
|
+
`argument '${name}' was passed more than once; pass each argument exactly once`
|
|
10477
|
+
);
|
|
10478
|
+
assigned.add(name);
|
|
10479
|
+
if (!field) throw fail(`unknown argument '${name}'`);
|
|
10480
|
+
const { text, exact } = assignedText(usage, name, raw);
|
|
10481
|
+
if (exact) args[name] = text;
|
|
10482
|
+
else if (field.shape.kind !== "json") args[name] = valueOf(field, text);
|
|
10483
|
+
else
|
|
10484
|
+
try {
|
|
10485
|
+
const value = JSON.parse(text);
|
|
10486
|
+
args[name] = typeof value !== "object" && allowsType(field.property, "string") ? text : value;
|
|
10487
|
+
} catch {
|
|
10488
|
+
args[name] = text;
|
|
10489
|
+
}
|
|
10490
|
+
}
|
|
10491
|
+
return { help: false, args };
|
|
10492
|
+
}
|
|
10493
|
+
function placeholder(field) {
|
|
10494
|
+
const { shape, property } = field;
|
|
10495
|
+
if (shape.kind === "json") return "";
|
|
10496
|
+
if (shape.kind === "scalar" && shape.type === "boolean") return "";
|
|
10497
|
+
const values = enumOf(shape.kind === "array" ? shape.items : property);
|
|
10498
|
+
const name = values && values.length <= 6 ? values.map(String).join("|") : shape.type ?? "value";
|
|
10499
|
+
return ` <${name}>${shape.kind === "array" ? "..." : ""}`;
|
|
10500
|
+
}
|
|
10501
|
+
function range(property) {
|
|
10502
|
+
const { minimum, maximum } = property;
|
|
10503
|
+
if (typeof minimum === "number" && typeof maximum === "number")
|
|
10504
|
+
return `From ${minimum} to ${maximum}.`;
|
|
10505
|
+
if (typeof minimum === "number") return `At least ${minimum}.`;
|
|
10506
|
+
if (typeof maximum === "number") return `At most ${maximum}.`;
|
|
10507
|
+
return void 0;
|
|
10508
|
+
}
|
|
10509
|
+
function note(field) {
|
|
10510
|
+
const { property, shape } = field;
|
|
10511
|
+
const parts = [];
|
|
10512
|
+
if (field.required) parts.push("Required.");
|
|
10513
|
+
const description = String(property.description ?? property.title ?? "").split("\n")[0].trim();
|
|
10514
|
+
if (description)
|
|
10515
|
+
parts.push(/[.!?]$/.test(description) ? description : `${description}.`);
|
|
10516
|
+
const values = enumOf(shape.kind === "array" ? shape.items : property);
|
|
10517
|
+
if (shape.kind !== "json" && values && values.length > 6)
|
|
10518
|
+
parts.push(`One of: ${values.map(String).join(", ")}.`);
|
|
10519
|
+
const bounds = range(property);
|
|
10520
|
+
if (bounds) parts.push(bounds);
|
|
10521
|
+
if ("default" in property)
|
|
10522
|
+
parts.push(`Default: ${JSON.stringify(property.default)}.`);
|
|
10523
|
+
if (flagged(field) && shape.kind === "array")
|
|
10524
|
+
parts.push("Repeat it for each value, or pass a JSON array.");
|
|
10525
|
+
if (flagged(field) && isBoolean(shape))
|
|
10526
|
+
parts.push(`--no-${field.flag} for false.`);
|
|
10527
|
+
return parts.join(" ");
|
|
10528
|
+
}
|
|
10529
|
+
function columns(rows) {
|
|
10530
|
+
const width = Math.min(
|
|
10531
|
+
30,
|
|
10532
|
+
Math.max(0, ...rows.map(([left]) => left.length)) + 2
|
|
10533
|
+
);
|
|
10534
|
+
return rows.map(
|
|
10535
|
+
([left, right]) => !right ? ` ${left}` : left.length + 2 > width ? ` ${left}
|
|
10536
|
+
${" ".repeat(width)}${right}` : ` ${left.padEnd(width)}${right}`
|
|
10537
|
+
);
|
|
10538
|
+
}
|
|
10539
|
+
function schemaHelp(command, schemaPointer) {
|
|
10540
|
+
const usage = usageOf(command);
|
|
10541
|
+
const all = fields(command);
|
|
10542
|
+
const flags = all.filter(flagged);
|
|
10543
|
+
const jsonOnly = all.filter((field) => !flagged(field));
|
|
10544
|
+
const call = [
|
|
10545
|
+
usage,
|
|
10546
|
+
...flags.filter((field) => field.required).map((field) => `--${field.flag}${placeholder(field)}`)
|
|
10547
|
+
];
|
|
10548
|
+
if (flags.some((field) => !field.required))
|
|
10549
|
+
call.push("[--<argument> <value> ...]");
|
|
10550
|
+
const lines = [
|
|
10551
|
+
`Usage: ${call.join(" ")}`,
|
|
10552
|
+
` ${usage} --json '{...}' (--json - reads the object from stdin)`
|
|
10553
|
+
];
|
|
10554
|
+
const description = command.description.trim().split("\n")[0];
|
|
10555
|
+
if (description) lines.push("", description);
|
|
10556
|
+
if (flags.length)
|
|
10557
|
+
lines.push(
|
|
10558
|
+
"",
|
|
10559
|
+
"Arguments:",
|
|
10560
|
+
...columns(
|
|
10561
|
+
flags.map((field) => [
|
|
10562
|
+
`--${field.flag}${placeholder(field)}`,
|
|
10563
|
+
note(field)
|
|
10564
|
+
])
|
|
10565
|
+
)
|
|
10566
|
+
);
|
|
10567
|
+
if (jsonOnly.length)
|
|
10568
|
+
lines.push(
|
|
10569
|
+
"",
|
|
10570
|
+
"Only through --json:",
|
|
10571
|
+
...columns(jsonOnly.map((field) => [field.name, note(field)]))
|
|
10572
|
+
);
|
|
10573
|
+
lines.push(
|
|
10574
|
+
"",
|
|
10575
|
+
...columns([
|
|
10576
|
+
[
|
|
10577
|
+
"--json <object|->",
|
|
10578
|
+
`Every argument as one JSON object (\`${schemaPointer}\` prints its schema); flags given beside it override its keys.`
|
|
10579
|
+
],
|
|
10580
|
+
["--help", "This help."]
|
|
10581
|
+
])
|
|
10582
|
+
);
|
|
10583
|
+
return lines.join("\n");
|
|
10584
|
+
}
|
|
10585
|
+
function takeOptions(argv, names) {
|
|
10586
|
+
const options2 = {};
|
|
10587
|
+
const rest = [];
|
|
10588
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
10589
|
+
const word = argv[index];
|
|
10590
|
+
if (word === "--") {
|
|
10591
|
+
rest.push(...argv.slice(index));
|
|
10592
|
+
break;
|
|
10593
|
+
}
|
|
10594
|
+
const [flag, inline] = word.startsWith("--") ? [
|
|
10595
|
+
word.slice(2).split("=")[0],
|
|
10596
|
+
word.includes("=") ? word.slice(word.indexOf("=") + 1) : void 0
|
|
10597
|
+
] : [void 0, void 0];
|
|
10598
|
+
const type = flag === void 0 ? void 0 : names[flag];
|
|
10599
|
+
if (!type) {
|
|
10600
|
+
rest.push(word);
|
|
10601
|
+
continue;
|
|
10602
|
+
}
|
|
10603
|
+
if (type === "boolean") options2[flag] = true;
|
|
10604
|
+
else {
|
|
10605
|
+
const value = inline ?? argv[index + 1];
|
|
10606
|
+
if (value === void 0 || inline === void 0 && value.startsWith("--"))
|
|
10607
|
+
throw new Error(`Flag '--${flag}' requires a value.`);
|
|
10608
|
+
if (inline === void 0) index += 1;
|
|
10609
|
+
options2[flag] = value;
|
|
10610
|
+
}
|
|
10611
|
+
}
|
|
10612
|
+
return { options: options2, rest };
|
|
10613
|
+
}
|
|
10614
|
+
|
|
10197
10615
|
// src/mcp/cli/handshake-retry.ts
|
|
10198
10616
|
import { setTimeout as delay } from "node:timers/promises";
|
|
10199
10617
|
var HANDSHAKE_RETRY_DELAYS_MS = [500, 1500];
|
|
@@ -10209,10 +10627,10 @@ function refusedHandshake(error) {
|
|
|
10209
10627
|
}
|
|
10210
10628
|
return false;
|
|
10211
10629
|
}
|
|
10212
|
-
async function callToolWithHandshakeRetry(runtime, server, tool,
|
|
10630
|
+
async function callToolWithHandshakeRetry(runtime, server, tool, options2, deadlineMs = Number.POSITIVE_INFINITY) {
|
|
10213
10631
|
for (let attempt = 0; ; attempt += 1) {
|
|
10214
10632
|
try {
|
|
10215
|
-
return await runtime.callTool(server, tool,
|
|
10633
|
+
return await runtime.callTool(server, tool, options2());
|
|
10216
10634
|
} catch (error) {
|
|
10217
10635
|
const wait = HANDSHAKE_RETRY_DELAYS_MS[attempt];
|
|
10218
10636
|
if (wait === void 0 || !refusedHandshake(error) || Date.now() + wait >= deadlineMs) {
|
|
@@ -10227,7 +10645,7 @@ async function callToolWithHandshakeRetry(runtime, server, tool, options, deadli
|
|
|
10227
10645
|
var MAX_EXAMPLE_ARRAY_ITEMS = 3;
|
|
10228
10646
|
var SAFE_CLI_KEY = /^[A-Za-z_][A-Za-z0-9_.-]*$/;
|
|
10229
10647
|
var SAFE_SHELL_TOKEN = /^[A-Za-z0-9_./:@+-]+$/;
|
|
10230
|
-
function
|
|
10648
|
+
function record2(value) {
|
|
10231
10649
|
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
10232
10650
|
}
|
|
10233
10651
|
function number(value) {
|
|
@@ -10237,18 +10655,18 @@ function quoted(value) {
|
|
|
10237
10655
|
return JSON.stringify(value);
|
|
10238
10656
|
}
|
|
10239
10657
|
function renderSchema(value) {
|
|
10240
|
-
const schema =
|
|
10658
|
+
const schema = record2(value);
|
|
10241
10659
|
if (!schema || !Array.isArray(schema.allOf)) return schema;
|
|
10242
10660
|
const branches = schema.allOf.map(renderSchema).filter((branch) => Boolean(branch));
|
|
10243
|
-
const baseProperties =
|
|
10661
|
+
const baseProperties = record2(schema.properties) ?? {};
|
|
10244
10662
|
const objectLike = branches.every(
|
|
10245
|
-
(branch) => branch.type === "object" || Boolean(
|
|
10663
|
+
(branch) => branch.type === "object" || Boolean(record2(branch.properties))
|
|
10246
10664
|
);
|
|
10247
10665
|
if (!objectLike) return { ...schema, allOf: branches };
|
|
10248
10666
|
const properties = Object.assign(
|
|
10249
10667
|
{},
|
|
10250
10668
|
baseProperties,
|
|
10251
|
-
...branches.map((branch) =>
|
|
10669
|
+
...branches.map((branch) => record2(branch.properties) ?? {})
|
|
10252
10670
|
);
|
|
10253
10671
|
const required = new Set(
|
|
10254
10672
|
Array.isArray(schema.required) ? schema.required.filter(
|
|
@@ -10301,18 +10719,18 @@ function compactSchemaType(value) {
|
|
|
10301
10719
|
if (schema.type === "array") {
|
|
10302
10720
|
return `${compactSchemaType(schema.items)}[]${constraintSuffix(schema)}`;
|
|
10303
10721
|
}
|
|
10304
|
-
if (schema.type === "object" ||
|
|
10305
|
-
const properties =
|
|
10722
|
+
if (schema.type === "object" || record2(schema.properties)) {
|
|
10723
|
+
const properties = record2(schema.properties);
|
|
10306
10724
|
if (!properties || Object.keys(properties).length === 0) return "object";
|
|
10307
10725
|
const required = new Set(
|
|
10308
10726
|
Array.isArray(schema.required) ? schema.required.filter(
|
|
10309
10727
|
(entry) => typeof entry === "string"
|
|
10310
10728
|
) : []
|
|
10311
10729
|
);
|
|
10312
|
-
const
|
|
10730
|
+
const fields2 = Object.entries(properties).map(
|
|
10313
10731
|
([name, descriptor]) => `${name}${required.has(name) ? "" : "?"}: ${compactSchemaType(descriptor)}`
|
|
10314
10732
|
);
|
|
10315
|
-
return `{${
|
|
10733
|
+
return `{${fields2.join(", ")}}`;
|
|
10316
10734
|
}
|
|
10317
10735
|
const type = schema.type === "number" ? "number" : schema.type;
|
|
10318
10736
|
return `${typeof type === "string" ? type : "unknown"}${constraintSuffix(schema)}`;
|
|
@@ -10325,7 +10743,7 @@ function descriptionText(value, verbose) {
|
|
|
10325
10743
|
}
|
|
10326
10744
|
function hasLongDescription(value) {
|
|
10327
10745
|
if (Array.isArray(value)) return value.some(hasLongDescription);
|
|
10328
|
-
const object =
|
|
10746
|
+
const object = record2(value);
|
|
10329
10747
|
if (!object) return false;
|
|
10330
10748
|
if (typeof object.description === "string" && object.description.trim().replace(/\s+/g, " ").length > 160) {
|
|
10331
10749
|
return true;
|
|
@@ -10334,10 +10752,10 @@ function hasLongDescription(value) {
|
|
|
10334
10752
|
([key, nested]) => key !== "description" && hasLongDescription(nested)
|
|
10335
10753
|
);
|
|
10336
10754
|
}
|
|
10337
|
-
function schemaLines(value, indent,
|
|
10755
|
+
function schemaLines(value, indent, options2 = {}) {
|
|
10338
10756
|
const schema = renderSchema(value);
|
|
10339
10757
|
if (!schema) return [`${indent}unknown`];
|
|
10340
|
-
const properties =
|
|
10758
|
+
const properties = record2(schema.properties);
|
|
10341
10759
|
if (!properties) return [`${indent}${compactSchemaType(schema)}`];
|
|
10342
10760
|
const required = new Set(
|
|
10343
10761
|
Array.isArray(schema.required) ? schema.required.filter(
|
|
@@ -10346,17 +10764,17 @@ function schemaLines(value, indent, options = {}) {
|
|
|
10346
10764
|
);
|
|
10347
10765
|
const lines = [];
|
|
10348
10766
|
for (const [name, descriptorValue] of Object.entries(properties)) {
|
|
10349
|
-
const descriptor =
|
|
10767
|
+
const descriptor = record2(descriptorValue) ?? {};
|
|
10350
10768
|
const optional = required.has(name) ? "" : "?";
|
|
10351
10769
|
const compactDescription = descriptionText(
|
|
10352
10770
|
descriptor.description,
|
|
10353
|
-
|
|
10771
|
+
options2.verboseDescriptions === true
|
|
10354
10772
|
);
|
|
10355
10773
|
const description = compactDescription ? ` \u2014 ${compactDescription}` : "";
|
|
10356
|
-
const nested =
|
|
10774
|
+
const nested = record2(descriptor.properties);
|
|
10357
10775
|
if (nested) {
|
|
10358
10776
|
lines.push(`${indent}${name}${optional}: {`);
|
|
10359
|
-
lines.push(...schemaLines(descriptor, `${indent} `,
|
|
10777
|
+
lines.push(...schemaLines(descriptor, `${indent} `, options2));
|
|
10360
10778
|
lines.push(`${indent}}${description}`);
|
|
10361
10779
|
} else {
|
|
10362
10780
|
lines.push(
|
|
@@ -10367,7 +10785,7 @@ function schemaLines(value, indent, options = {}) {
|
|
|
10367
10785
|
return lines.length > 0 ? lines : [`${indent}{}`];
|
|
10368
10786
|
}
|
|
10369
10787
|
function schemaObject(value) {
|
|
10370
|
-
return
|
|
10788
|
+
return record2(value);
|
|
10371
10789
|
}
|
|
10372
10790
|
function shellQuote(value) {
|
|
10373
10791
|
return `'${value.replace(/'/g, `'"'"'`)}'`;
|
|
@@ -10399,8 +10817,8 @@ function exampleValue(value, name) {
|
|
|
10399
10817
|
() => exampleValue(schema.items, "value")
|
|
10400
10818
|
);
|
|
10401
10819
|
}
|
|
10402
|
-
if (schema.type === "object" ||
|
|
10403
|
-
const properties =
|
|
10820
|
+
if (schema.type === "object" || record2(schema.properties)) {
|
|
10821
|
+
const properties = record2(schema.properties) ?? {};
|
|
10404
10822
|
const required = Array.isArray(schema.required) ? schema.required.filter(
|
|
10405
10823
|
(entry) => typeof entry === "string"
|
|
10406
10824
|
) : [];
|
|
@@ -10416,7 +10834,7 @@ function callValue(value, name) {
|
|
|
10416
10834
|
}
|
|
10417
10835
|
function callExample(server, tool) {
|
|
10418
10836
|
const schema = renderSchema(tool.inputSchema);
|
|
10419
|
-
const properties =
|
|
10837
|
+
const properties = record2(schema?.properties) ?? {};
|
|
10420
10838
|
const required = Array.isArray(schema?.required) ? schema.required.filter(
|
|
10421
10839
|
(entry) => typeof entry === "string"
|
|
10422
10840
|
) : [];
|
|
@@ -10433,7 +10851,7 @@ function callExample(server, tool) {
|
|
|
10433
10851
|
return `mcp call ${toolSelector(server, tool.name)} --json ${shellQuote(json)}`;
|
|
10434
10852
|
}
|
|
10435
10853
|
const args = required.map((name) => {
|
|
10436
|
-
const descriptor =
|
|
10854
|
+
const descriptor = record2(properties[name]) ?? {};
|
|
10437
10855
|
return `${name}=${callValue(descriptor, name)}`;
|
|
10438
10856
|
});
|
|
10439
10857
|
return `mcp call ${toolSelector(server, tool.name)}${args.length > 0 ? ` ${args.join(" ")}` : ""}`;
|
|
@@ -10441,7 +10859,7 @@ function callExample(server, tool) {
|
|
|
10441
10859
|
function structuredBranch(value, kind) {
|
|
10442
10860
|
const schema = renderSchema(value);
|
|
10443
10861
|
if (!schema) return void 0;
|
|
10444
|
-
if (kind === "array" && schema.type === "array" || kind === "object" && (schema.type === "object" ||
|
|
10862
|
+
if (kind === "array" && schema.type === "array" || kind === "object" && (schema.type === "object" || record2(schema.properties))) {
|
|
10445
10863
|
return schema;
|
|
10446
10864
|
}
|
|
10447
10865
|
const union = Array.isArray(schema.anyOf) ? schema.anyOf : Array.isArray(schema.oneOf) ? schema.oneOf : [];
|
|
@@ -10449,7 +10867,7 @@ function structuredBranch(value, kind) {
|
|
|
10449
10867
|
}
|
|
10450
10868
|
function structuredCallExample(server, tool) {
|
|
10451
10869
|
const schema = renderSchema(tool.inputSchema);
|
|
10452
|
-
const properties =
|
|
10870
|
+
const properties = record2(schema?.properties) ?? {};
|
|
10453
10871
|
const required = new Set(
|
|
10454
10872
|
Array.isArray(schema?.required) ? schema.required.filter(
|
|
10455
10873
|
(entry) => typeof entry === "string"
|
|
@@ -10471,23 +10889,23 @@ function structuredCallExample(server, tool) {
|
|
|
10471
10889
|
}
|
|
10472
10890
|
return void 0;
|
|
10473
10891
|
}
|
|
10474
|
-
function renderToolContract(server, tool,
|
|
10892
|
+
function renderToolContract(server, tool, options2 = {}) {
|
|
10475
10893
|
const lines = [`${server}.${tool.name}`];
|
|
10476
10894
|
const description = descriptionText(
|
|
10477
10895
|
tool.description,
|
|
10478
|
-
|
|
10896
|
+
options2.verboseDescriptions === true
|
|
10479
10897
|
);
|
|
10480
10898
|
if (description) {
|
|
10481
10899
|
lines.push(description);
|
|
10482
10900
|
}
|
|
10483
|
-
if (!
|
|
10901
|
+
if (!options2.verboseDescriptions && (descriptionText(tool.description, true).length > 160 || hasLongDescription(tool.inputSchema) || hasLongDescription(tool.outputSchema))) {
|
|
10484
10902
|
lines.push("Descriptions shortened; use --verbose for full text.");
|
|
10485
10903
|
}
|
|
10486
|
-
lines.push("", "input", ...schemaLines(tool.inputSchema, " ",
|
|
10904
|
+
lines.push("", "input", ...schemaLines(tool.inputSchema, " ", options2));
|
|
10487
10905
|
lines.push(
|
|
10488
10906
|
"",
|
|
10489
10907
|
"output",
|
|
10490
|
-
...schemaObject(tool.outputSchema) ? schemaLines(tool.outputSchema, " ",
|
|
10908
|
+
...schemaObject(tool.outputSchema) ? schemaLines(tool.outputSchema, " ", options2) : [" unspecified"]
|
|
10491
10909
|
);
|
|
10492
10910
|
lines.push("", "call", ` ${callExample(server, tool)}`);
|
|
10493
10911
|
const structured = structuredCallExample(server, tool);
|
|
@@ -10495,9 +10913,9 @@ function renderToolContract(server, tool, options = {}) {
|
|
|
10495
10913
|
return `${lines.join("\n")}
|
|
10496
10914
|
`;
|
|
10497
10915
|
}
|
|
10498
|
-
function renderToolSignature(server, tool,
|
|
10916
|
+
function renderToolSignature(server, tool, options2 = {}) {
|
|
10499
10917
|
const schema = renderSchema(tool.inputSchema);
|
|
10500
|
-
const properties =
|
|
10918
|
+
const properties = record2(schema?.properties) ?? {};
|
|
10501
10919
|
const required = new Set(
|
|
10502
10920
|
Array.isArray(schema?.required) ? schema.required.filter(
|
|
10503
10921
|
(entry) => typeof entry === "string"
|
|
@@ -10507,13 +10925,13 @@ function renderToolSignature(server, tool, options = {}) {
|
|
|
10507
10925
|
const included = new Set(
|
|
10508
10926
|
entries.filter(([name]) => required.has(name)).map(([name]) => name)
|
|
10509
10927
|
);
|
|
10510
|
-
if (!
|
|
10928
|
+
if (!options2.allParameters) {
|
|
10511
10929
|
for (const [name] of entries) {
|
|
10512
10930
|
if (included.size >= 5) break;
|
|
10513
10931
|
included.add(name);
|
|
10514
10932
|
}
|
|
10515
10933
|
}
|
|
10516
|
-
const visible =
|
|
10934
|
+
const visible = options2.allParameters ? entries : entries.filter(([name]) => included.has(name));
|
|
10517
10935
|
const parameters = visible.map(([name, descriptor]) => {
|
|
10518
10936
|
const optional = required.has(name) ? "" : "?";
|
|
10519
10937
|
return `${name}${optional}: ${compactSchemaType(descriptor)}`;
|
|
@@ -10586,8 +11004,9 @@ function mcpCallHelpText() {
|
|
|
10586
11004
|
"",
|
|
10587
11005
|
"Calls exact tools materialized in this recipe session.",
|
|
10588
11006
|
"",
|
|
10589
|
-
"Arguments:",
|
|
10590
|
-
"
|
|
11007
|
+
"Arguments, read from the tool's input schema (`mcp call <server>.<tool> --help` lists them):",
|
|
11008
|
+
" --<argument> <value> One argument as a flag.",
|
|
11009
|
+
" key=value The same, as a word.",
|
|
10591
11010
|
" key=@path Read an exact UTF-8 string; use @@ for a literal @.",
|
|
10592
11011
|
" --json <json|-> Supply a structured JSON object directly or from stdin.",
|
|
10593
11012
|
` Array example: mcp call server.tool --json '{"tags":["a","b"]}'.`,
|
|
@@ -10652,7 +11071,7 @@ import { delimiter, dirname, join, resolve } from "node:path";
|
|
|
10652
11071
|
var balanced = (a, b, str) => {
|
|
10653
11072
|
const ma = a instanceof RegExp ? maybeMatch(a, str) : a;
|
|
10654
11073
|
const mb = b instanceof RegExp ? maybeMatch(b, str) : b;
|
|
10655
|
-
const r = ma !== null && mb != null &&
|
|
11074
|
+
const r = ma !== null && mb != null && range2(ma, mb, str);
|
|
10656
11075
|
return r && {
|
|
10657
11076
|
start: r[0],
|
|
10658
11077
|
end: r[1],
|
|
@@ -10665,7 +11084,7 @@ var maybeMatch = (reg, str) => {
|
|
|
10665
11084
|
const m = str.match(reg);
|
|
10666
11085
|
return m ? m[0] : null;
|
|
10667
11086
|
};
|
|
10668
|
-
var
|
|
11087
|
+
var range2 = (a, b, str) => {
|
|
10669
11088
|
let begs, beg, left, right = void 0, result;
|
|
10670
11089
|
let ai = str.indexOf(a);
|
|
10671
11090
|
let bi = str.indexOf(b, ai + 1);
|
|
@@ -10759,11 +11178,11 @@ function parseCommaParts(str) {
|
|
|
10759
11178
|
str = post;
|
|
10760
11179
|
}
|
|
10761
11180
|
}
|
|
10762
|
-
function expand(str,
|
|
11181
|
+
function expand(str, options2 = {}) {
|
|
10763
11182
|
if (!str) {
|
|
10764
11183
|
return [];
|
|
10765
11184
|
}
|
|
10766
|
-
const { max = EXPANSION_MAX, maxLength = EXPANSION_MAX_LENGTH, maxDepth = EXPANSION_MAX_DEPTH, maxRewrites = EXPANSION_MAX_REWRITES } =
|
|
11185
|
+
const { max = EXPANSION_MAX, maxLength = EXPANSION_MAX_LENGTH, maxDepth = EXPANSION_MAX_DEPTH, maxRewrites = EXPANSION_MAX_REWRITES } = options2;
|
|
10767
11186
|
if (str.slice(0, 2) === "{}") {
|
|
10768
11187
|
str = "\\{\\}" + str.slice(2);
|
|
10769
11188
|
}
|
|
@@ -11149,13 +11568,13 @@ var AST = class {
|
|
|
11149
11568
|
parts: this.#parts
|
|
11150
11569
|
};
|
|
11151
11570
|
}
|
|
11152
|
-
constructor(type, parent,
|
|
11571
|
+
constructor(type, parent, options2 = {}) {
|
|
11153
11572
|
this.type = type;
|
|
11154
11573
|
if (type)
|
|
11155
11574
|
this.#hasMagic = true;
|
|
11156
11575
|
this.#parent = parent;
|
|
11157
11576
|
this.#root = this.#parent ? this.#parent.#root : this;
|
|
11158
|
-
this.#options = this.#root === this ?
|
|
11577
|
+
this.#options = this.#root === this ? options2 : this.#root.#options;
|
|
11159
11578
|
this.#negs = this.#root === this ? [] : this.#root.#negs;
|
|
11160
11579
|
if (type === "!" && !this.#root.#filledNegs)
|
|
11161
11580
|
this.#negs.push(this);
|
|
@@ -11435,9 +11854,9 @@ var AST = class {
|
|
|
11435
11854
|
this.#toString = void 0;
|
|
11436
11855
|
this.#emptyExt = false;
|
|
11437
11856
|
}
|
|
11438
|
-
static fromGlob(pattern,
|
|
11439
|
-
const ast = new _a(null, void 0,
|
|
11440
|
-
_a.#parseAST(pattern, ast, 0,
|
|
11857
|
+
static fromGlob(pattern, options2 = {}) {
|
|
11858
|
+
const ast = new _a(null, void 0, options2);
|
|
11859
|
+
_a.#parseAST(pattern, ast, 0, options2, 0);
|
|
11441
11860
|
return ast;
|
|
11442
11861
|
}
|
|
11443
11862
|
// returns the regular expression if there's magic, or the unescaped
|
|
@@ -11710,12 +12129,12 @@ var escape = (s, { windowsPathsNoEscape = false, magicalBraces = false } = {}) =
|
|
|
11710
12129
|
};
|
|
11711
12130
|
|
|
11712
12131
|
// node_modules/.pnpm/minimatch@10.2.6/node_modules/minimatch/dist/esm/index.js
|
|
11713
|
-
var minimatch = (p, pattern,
|
|
12132
|
+
var minimatch = (p, pattern, options2 = {}) => {
|
|
11714
12133
|
assertValidPattern(pattern);
|
|
11715
|
-
if (!
|
|
12134
|
+
if (!options2.nocomment && pattern.charAt(0) === "#") {
|
|
11716
12135
|
return false;
|
|
11717
12136
|
}
|
|
11718
|
-
return new Minimatch(pattern,
|
|
12137
|
+
return new Minimatch(pattern, options2).match(p);
|
|
11719
12138
|
};
|
|
11720
12139
|
var starDotExtRE = /^\*+([^+@!?*[(]*)$/;
|
|
11721
12140
|
var starDotExtTest = (ext2) => (f) => !f.startsWith(".") && f.endsWith(ext2);
|
|
@@ -11780,7 +12199,7 @@ var qmark2 = "[^/]";
|
|
|
11780
12199
|
var star2 = qmark2 + "*?";
|
|
11781
12200
|
var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
|
|
11782
12201
|
var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
|
|
11783
|
-
var filter = (pattern,
|
|
12202
|
+
var filter = (pattern, options2 = {}) => (p) => minimatch(p, pattern, options2);
|
|
11784
12203
|
minimatch.filter = filter;
|
|
11785
12204
|
var ext = (a, b = {}) => Object.assign({}, a, b);
|
|
11786
12205
|
var defaults = (def) => {
|
|
@@ -11788,50 +12207,50 @@ var defaults = (def) => {
|
|
|
11788
12207
|
return minimatch;
|
|
11789
12208
|
}
|
|
11790
12209
|
const orig = minimatch;
|
|
11791
|
-
const m = (p, pattern,
|
|
12210
|
+
const m = (p, pattern, options2 = {}) => orig(p, pattern, ext(def, options2));
|
|
11792
12211
|
return Object.assign(m, {
|
|
11793
12212
|
Minimatch: class Minimatch extends orig.Minimatch {
|
|
11794
|
-
constructor(pattern,
|
|
11795
|
-
super(pattern, ext(def,
|
|
12213
|
+
constructor(pattern, options2 = {}) {
|
|
12214
|
+
super(pattern, ext(def, options2));
|
|
11796
12215
|
}
|
|
11797
|
-
static defaults(
|
|
11798
|
-
return orig.defaults(ext(def,
|
|
12216
|
+
static defaults(options2) {
|
|
12217
|
+
return orig.defaults(ext(def, options2)).Minimatch;
|
|
11799
12218
|
}
|
|
11800
12219
|
},
|
|
11801
12220
|
AST: class AST extends orig.AST {
|
|
11802
12221
|
/* c8 ignore start */
|
|
11803
|
-
constructor(type, parent,
|
|
11804
|
-
super(type, parent, ext(def,
|
|
12222
|
+
constructor(type, parent, options2 = {}) {
|
|
12223
|
+
super(type, parent, ext(def, options2));
|
|
11805
12224
|
}
|
|
11806
12225
|
/* c8 ignore stop */
|
|
11807
|
-
static fromGlob(pattern,
|
|
11808
|
-
return orig.AST.fromGlob(pattern, ext(def,
|
|
12226
|
+
static fromGlob(pattern, options2 = {}) {
|
|
12227
|
+
return orig.AST.fromGlob(pattern, ext(def, options2));
|
|
11809
12228
|
}
|
|
11810
12229
|
},
|
|
11811
|
-
unescape: (s,
|
|
11812
|
-
escape: (s,
|
|
11813
|
-
filter: (pattern,
|
|
11814
|
-
defaults: (
|
|
11815
|
-
makeRe: (pattern,
|
|
11816
|
-
braceExpand: (pattern,
|
|
11817
|
-
match: (list, pattern,
|
|
12230
|
+
unescape: (s, options2 = {}) => orig.unescape(s, ext(def, options2)),
|
|
12231
|
+
escape: (s, options2 = {}) => orig.escape(s, ext(def, options2)),
|
|
12232
|
+
filter: (pattern, options2 = {}) => orig.filter(pattern, ext(def, options2)),
|
|
12233
|
+
defaults: (options2) => orig.defaults(ext(def, options2)),
|
|
12234
|
+
makeRe: (pattern, options2 = {}) => orig.makeRe(pattern, ext(def, options2)),
|
|
12235
|
+
braceExpand: (pattern, options2 = {}) => orig.braceExpand(pattern, ext(def, options2)),
|
|
12236
|
+
match: (list, pattern, options2 = {}) => orig.match(list, pattern, ext(def, options2)),
|
|
11818
12237
|
sep: orig.sep,
|
|
11819
12238
|
GLOBSTAR
|
|
11820
12239
|
});
|
|
11821
12240
|
};
|
|
11822
12241
|
minimatch.defaults = defaults;
|
|
11823
|
-
var braceExpand = (pattern,
|
|
12242
|
+
var braceExpand = (pattern, options2 = {}) => {
|
|
11824
12243
|
assertValidPattern(pattern);
|
|
11825
|
-
if (
|
|
12244
|
+
if (options2.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
|
|
11826
12245
|
return [pattern];
|
|
11827
12246
|
}
|
|
11828
|
-
return expand(pattern, { max:
|
|
12247
|
+
return expand(pattern, { max: options2.braceExpandMax });
|
|
11829
12248
|
};
|
|
11830
12249
|
minimatch.braceExpand = braceExpand;
|
|
11831
|
-
var makeRe = (pattern,
|
|
12250
|
+
var makeRe = (pattern, options2 = {}) => new Minimatch(pattern, options2).makeRe();
|
|
11832
12251
|
minimatch.makeRe = makeRe;
|
|
11833
|
-
var match = (list, pattern,
|
|
11834
|
-
const mm = new Minimatch(pattern,
|
|
12252
|
+
var match = (list, pattern, options2 = {}) => {
|
|
12253
|
+
const mm = new Minimatch(pattern, options2);
|
|
11835
12254
|
list = list.filter((f) => mm.match(f));
|
|
11836
12255
|
if (mm.options.nonull && !list.length) {
|
|
11837
12256
|
list.push(pattern);
|
|
@@ -11860,28 +12279,28 @@ var Minimatch = class {
|
|
|
11860
12279
|
windowsNoMagicRoot;
|
|
11861
12280
|
maxGlobstarRecursion;
|
|
11862
12281
|
regexp;
|
|
11863
|
-
constructor(pattern,
|
|
12282
|
+
constructor(pattern, options2 = {}) {
|
|
11864
12283
|
assertValidPattern(pattern);
|
|
11865
|
-
|
|
11866
|
-
this.options =
|
|
11867
|
-
this.maxGlobstarRecursion =
|
|
12284
|
+
options2 = options2 || {};
|
|
12285
|
+
this.options = options2;
|
|
12286
|
+
this.maxGlobstarRecursion = options2.maxGlobstarRecursion ?? 200;
|
|
11868
12287
|
this.pattern = pattern;
|
|
11869
|
-
this.platform =
|
|
12288
|
+
this.platform = options2.platform || defaultPlatform;
|
|
11870
12289
|
this.isWindows = this.platform === "win32";
|
|
11871
12290
|
const awe = "allowWindowsEscape";
|
|
11872
|
-
this.windowsPathsNoEscape = !!
|
|
12291
|
+
this.windowsPathsNoEscape = !!options2.windowsPathsNoEscape || options2[awe] === false;
|
|
11873
12292
|
if (this.windowsPathsNoEscape) {
|
|
11874
12293
|
this.pattern = this.pattern.replace(/\\/g, "/");
|
|
11875
12294
|
}
|
|
11876
|
-
this.preserveMultipleSlashes = !!
|
|
12295
|
+
this.preserveMultipleSlashes = !!options2.preserveMultipleSlashes;
|
|
11877
12296
|
this.regexp = null;
|
|
11878
12297
|
this.negate = false;
|
|
11879
|
-
this.nonegate = !!
|
|
12298
|
+
this.nonegate = !!options2.nonegate;
|
|
11880
12299
|
this.comment = false;
|
|
11881
12300
|
this.empty = false;
|
|
11882
|
-
this.partial = !!
|
|
12301
|
+
this.partial = !!options2.partial;
|
|
11883
12302
|
this.nocase = !!this.options.nocase;
|
|
11884
|
-
this.windowsNoMagicRoot =
|
|
12303
|
+
this.windowsNoMagicRoot = options2.windowsNoMagicRoot !== void 0 ? options2.windowsNoMagicRoot : !!(this.isWindows && this.nocase);
|
|
11885
12304
|
this.globSet = [];
|
|
11886
12305
|
this.globParts = [];
|
|
11887
12306
|
this.set = [];
|
|
@@ -11903,8 +12322,8 @@ var Minimatch = class {
|
|
|
11903
12322
|
}
|
|
11904
12323
|
make() {
|
|
11905
12324
|
const pattern = this.pattern;
|
|
11906
|
-
const
|
|
11907
|
-
if (!
|
|
12325
|
+
const options2 = this.options;
|
|
12326
|
+
if (!options2.nocomment && pattern.charAt(0) === "#") {
|
|
11908
12327
|
this.comment = true;
|
|
11909
12328
|
return;
|
|
11910
12329
|
}
|
|
@@ -11914,7 +12333,7 @@ var Minimatch = class {
|
|
|
11914
12333
|
}
|
|
11915
12334
|
this.parseNegate();
|
|
11916
12335
|
this.globSet = [...new Set(this.braceExpand())];
|
|
11917
|
-
if (
|
|
12336
|
+
if (options2.debug) {
|
|
11918
12337
|
this.debug = (...args) => console.error(...args);
|
|
11919
12338
|
}
|
|
11920
12339
|
this.debug(this.pattern, this.globSet);
|
|
@@ -12371,7 +12790,7 @@ var Minimatch = class {
|
|
|
12371
12790
|
}
|
|
12372
12791
|
parse(pattern) {
|
|
12373
12792
|
assertValidPattern(pattern);
|
|
12374
|
-
const
|
|
12793
|
+
const options2 = this.options;
|
|
12375
12794
|
if (pattern === "**")
|
|
12376
12795
|
return GLOBSTAR;
|
|
12377
12796
|
if (pattern === "")
|
|
@@ -12379,13 +12798,13 @@ var Minimatch = class {
|
|
|
12379
12798
|
let m;
|
|
12380
12799
|
let fastTest = null;
|
|
12381
12800
|
if (m = pattern.match(starRE)) {
|
|
12382
|
-
fastTest =
|
|
12801
|
+
fastTest = options2.dot ? starTestDot : starTest;
|
|
12383
12802
|
} else if (m = pattern.match(starDotExtRE)) {
|
|
12384
|
-
fastTest = (
|
|
12803
|
+
fastTest = (options2.nocase ? options2.dot ? starDotExtTestNocaseDot : starDotExtTestNocase : options2.dot ? starDotExtTestDot : starDotExtTest)(m[1]);
|
|
12385
12804
|
} else if (m = pattern.match(qmarksRE)) {
|
|
12386
|
-
fastTest = (
|
|
12805
|
+
fastTest = (options2.nocase ? options2.dot ? qmarksTestNocaseDot : qmarksTestNocase : options2.dot ? qmarksTestDot : qmarksTest)(m);
|
|
12387
12806
|
} else if (m = pattern.match(starDotStarRE)) {
|
|
12388
|
-
fastTest =
|
|
12807
|
+
fastTest = options2.dot ? starDotStarTestDot : starDotStarTest;
|
|
12389
12808
|
} else if (m = pattern.match(dotStarRE)) {
|
|
12390
12809
|
fastTest = dotStarTest;
|
|
12391
12810
|
}
|
|
@@ -12403,9 +12822,9 @@ var Minimatch = class {
|
|
|
12403
12822
|
this.regexp = false;
|
|
12404
12823
|
return this.regexp;
|
|
12405
12824
|
}
|
|
12406
|
-
const
|
|
12407
|
-
const twoStar =
|
|
12408
|
-
const flags = new Set(
|
|
12825
|
+
const options2 = this.options;
|
|
12826
|
+
const twoStar = options2.noglobstar ? star2 : options2.dot ? twoStarDot : twoStarNoDot;
|
|
12827
|
+
const flags = new Set(options2.nocase ? ["i"] : []);
|
|
12409
12828
|
let re2 = set.map((pattern) => {
|
|
12410
12829
|
const pp = pattern.map((p) => {
|
|
12411
12830
|
if (p instanceof RegExp) {
|
|
@@ -12477,7 +12896,7 @@ var Minimatch = class {
|
|
|
12477
12896
|
if (f === "/" && partial) {
|
|
12478
12897
|
return true;
|
|
12479
12898
|
}
|
|
12480
|
-
const
|
|
12899
|
+
const options2 = this.options;
|
|
12481
12900
|
if (this.isWindows) {
|
|
12482
12901
|
f = f.split("\\").join("/");
|
|
12483
12902
|
}
|
|
@@ -12493,18 +12912,18 @@ var Minimatch = class {
|
|
|
12493
12912
|
}
|
|
12494
12913
|
for (const pattern of set) {
|
|
12495
12914
|
let file = ff;
|
|
12496
|
-
if (
|
|
12915
|
+
if (options2.matchBase && pattern.length === 1) {
|
|
12497
12916
|
file = [filename];
|
|
12498
12917
|
}
|
|
12499
12918
|
const hit = this.matchOne(file, pattern, partial);
|
|
12500
12919
|
if (hit) {
|
|
12501
|
-
if (
|
|
12920
|
+
if (options2.flipNegate) {
|
|
12502
12921
|
return true;
|
|
12503
12922
|
}
|
|
12504
12923
|
return !this.negate;
|
|
12505
12924
|
}
|
|
12506
12925
|
}
|
|
12507
|
-
if (
|
|
12926
|
+
if (options2.flipNegate) {
|
|
12508
12927
|
return false;
|
|
12509
12928
|
}
|
|
12510
12929
|
return this.negate;
|
|
@@ -12638,7 +13057,10 @@ var FORBIDDEN_DELEGATED_FLAGS = /* @__PURE__ */ new Set([
|
|
|
12638
13057
|
"--no-oauth",
|
|
12639
13058
|
"--oauth-timeout",
|
|
12640
13059
|
"--raw-strings",
|
|
12641
|
-
"--no-coerce"
|
|
13060
|
+
"--no-coerce",
|
|
13061
|
+
"--save-images",
|
|
13062
|
+
"--params",
|
|
13063
|
+
"--mcp"
|
|
12642
13064
|
]);
|
|
12643
13065
|
var LIST_OUTPUT_MODES = /* @__PURE__ */ new Map([
|
|
12644
13066
|
["--schema", "schema"],
|
|
@@ -12667,14 +13089,14 @@ function withNoOAuth(args) {
|
|
|
12667
13089
|
}
|
|
12668
13090
|
function forbiddenFlag(args) {
|
|
12669
13091
|
const literalSeparator = args.indexOf("--");
|
|
12670
|
-
const
|
|
12671
|
-
return
|
|
13092
|
+
const options2 = literalSeparator === -1 ? args : args.slice(0, literalSeparator);
|
|
13093
|
+
return options2.map(flagName).find((flag) => FORBIDDEN_DELEGATED_FLAGS.has(flag));
|
|
12672
13094
|
}
|
|
12673
13095
|
function listOutputModeError(args) {
|
|
12674
13096
|
const literalSeparator = args.indexOf("--");
|
|
12675
|
-
const
|
|
13097
|
+
const options2 = literalSeparator === -1 ? args : args.slice(0, literalSeparator);
|
|
12676
13098
|
const modes = new Set(
|
|
12677
|
-
|
|
13099
|
+
options2.map((arg) => LIST_OUTPUT_MODES.get(flagName(arg))).filter((mode) => Boolean(mode))
|
|
12678
13100
|
);
|
|
12679
13101
|
return modes.size > 1 ? "mcp list accepts only one output mode: --schema, --all-parameters, or --status." : void 0;
|
|
12680
13102
|
}
|
|
@@ -12755,19 +13177,17 @@ function validateList(args, policy) {
|
|
|
12755
13177
|
}
|
|
12756
13178
|
};
|
|
12757
13179
|
}
|
|
12758
|
-
var CALL_FLAGS_WITH_VALUE = /* @__PURE__ */ new Set(["--json", "--output", "--timeout"]);
|
|
12759
13180
|
function callSyntaxError(args) {
|
|
12760
13181
|
for (let index = 0; index < args.length; index += 1) {
|
|
12761
13182
|
const arg = args[index];
|
|
12762
13183
|
if (arg === "--") {
|
|
12763
13184
|
return "mcp call positional arguments are unavailable; use key=value or --json instead.";
|
|
12764
13185
|
}
|
|
13186
|
+
if (arg === "-h") continue;
|
|
12765
13187
|
if (arg.startsWith("--")) {
|
|
12766
|
-
const
|
|
12767
|
-
if (!
|
|
12768
|
-
|
|
12769
|
-
}
|
|
12770
|
-
if (!arg.includes("=")) index += 1;
|
|
13188
|
+
const next = args[index + 1];
|
|
13189
|
+
if (!arg.includes("=") && next !== void 0 && !next.startsWith("--"))
|
|
13190
|
+
index += 1;
|
|
12771
13191
|
continue;
|
|
12772
13192
|
}
|
|
12773
13193
|
if (/^[A-Za-z_][A-Za-z0-9_.-]*=/.test(arg)) continue;
|
|
@@ -12882,16 +13302,16 @@ var McpRemoteToolResultError = class extends Error {
|
|
|
12882
13302
|
details;
|
|
12883
13303
|
};
|
|
12884
13304
|
var McpRunToolError = class extends Error {
|
|
12885
|
-
constructor(server, tool, message,
|
|
12886
|
-
super(message,
|
|
13305
|
+
constructor(server, tool, message, options2) {
|
|
13306
|
+
super(message, options2);
|
|
12887
13307
|
this.server = server;
|
|
12888
13308
|
this.tool = tool;
|
|
12889
13309
|
this.name = "McpRunToolError";
|
|
12890
|
-
this.details =
|
|
12891
|
-
this.code =
|
|
12892
|
-
this.retryable =
|
|
12893
|
-
this.action =
|
|
12894
|
-
this.outcome =
|
|
13310
|
+
this.details = options2?.details;
|
|
13311
|
+
this.code = options2?.details?.code;
|
|
13312
|
+
this.retryable = options2?.details?.retryable;
|
|
13313
|
+
this.action = options2?.details?.action;
|
|
13314
|
+
this.outcome = options2?.details?.outcome;
|
|
12895
13315
|
}
|
|
12896
13316
|
server;
|
|
12897
13317
|
tool;
|
|
@@ -13321,7 +13741,7 @@ function parseSearchArgs(args) {
|
|
|
13321
13741
|
}
|
|
13322
13742
|
let parsed;
|
|
13323
13743
|
try {
|
|
13324
|
-
parsed =
|
|
13744
|
+
parsed = parseArgs2({
|
|
13325
13745
|
args,
|
|
13326
13746
|
options: SEARCH_OPTIONS,
|
|
13327
13747
|
allowPositionals: true
|
|
@@ -13469,7 +13889,7 @@ function toolCount(count) {
|
|
|
13469
13889
|
function parseListTimeoutMs(args) {
|
|
13470
13890
|
const configured = process.env.MCPORTER_LIST_TIMEOUT;
|
|
13471
13891
|
let raw = configured && /^[1-9]\d*$/.test(configured) ? configured : String(DEFAULT_LIST_TIMEOUT_MS);
|
|
13472
|
-
const { values } =
|
|
13892
|
+
const { values } = parseArgs2({
|
|
13473
13893
|
args: [...args.slice(1)],
|
|
13474
13894
|
options: { timeout: { type: "string" } },
|
|
13475
13895
|
strict: false,
|
|
@@ -13536,10 +13956,10 @@ function isValidListOption(arg) {
|
|
|
13536
13956
|
function compactListArgumentError(args) {
|
|
13537
13957
|
const rest = args.slice(1);
|
|
13538
13958
|
const target = rest[0] !== void 0 && !rest[0].startsWith("-");
|
|
13539
|
-
const
|
|
13959
|
+
const options2 = target ? rest.slice(1) : rest;
|
|
13540
13960
|
try {
|
|
13541
|
-
const { positionals } =
|
|
13542
|
-
args: [...
|
|
13961
|
+
const { positionals } = parseArgs2({
|
|
13962
|
+
args: [...options2],
|
|
13543
13963
|
options: LIST_OPTIONS,
|
|
13544
13964
|
allowPositionals: true
|
|
13545
13965
|
});
|
|
@@ -13548,7 +13968,7 @@ function compactListArgumentError(args) {
|
|
|
13548
13968
|
}
|
|
13549
13969
|
return void 0;
|
|
13550
13970
|
} catch {
|
|
13551
|
-
const offending =
|
|
13971
|
+
const offending = options2.find(
|
|
13552
13972
|
(arg) => arg.startsWith("-") && !isValidListOption(arg)
|
|
13553
13973
|
);
|
|
13554
13974
|
return offending ? `Unknown mcp list option '${offending}'.` : void 0;
|
|
@@ -13880,20 +14300,20 @@ async function createTools(opts) {
|
|
|
13880
14300
|
release?.();
|
|
13881
14301
|
}
|
|
13882
14302
|
})();
|
|
13883
|
-
const
|
|
14303
|
+
const record3 = {
|
|
13884
14304
|
ref: `${server}.${property}`,
|
|
13885
14305
|
observed: false,
|
|
13886
14306
|
outcome: "pending",
|
|
13887
14307
|
promise: rawCall
|
|
13888
14308
|
};
|
|
13889
|
-
calls.push(
|
|
14309
|
+
calls.push(record3);
|
|
13890
14310
|
rawCall.then(
|
|
13891
14311
|
() => {
|
|
13892
|
-
|
|
14312
|
+
record3.outcome = "succeeded";
|
|
13893
14313
|
},
|
|
13894
14314
|
(error) => {
|
|
13895
|
-
|
|
13896
|
-
|
|
14315
|
+
record3.outcome = "failed";
|
|
14316
|
+
record3.error = error instanceof Error ? error.message : String(error);
|
|
13897
14317
|
}
|
|
13898
14318
|
);
|
|
13899
14319
|
return new Proxy(rawCall, {
|
|
@@ -13902,7 +14322,7 @@ async function createTools(opts) {
|
|
|
13902
14322
|
return () => `[pending tool call ${server}.${property} \u2014 did you forget await?]`;
|
|
13903
14323
|
}
|
|
13904
14324
|
if (key === "then" || key === "catch" || key === "finally") {
|
|
13905
|
-
|
|
14325
|
+
record3.observed = true;
|
|
13906
14326
|
}
|
|
13907
14327
|
const value = Reflect.get(target, key, target);
|
|
13908
14328
|
return typeof value === "function" ? value.bind(target) : value;
|
|
@@ -14243,21 +14663,6 @@ function createDelegatedErrorFilter(write) {
|
|
|
14243
14663
|
}
|
|
14244
14664
|
};
|
|
14245
14665
|
}
|
|
14246
|
-
function duplicateCallArgumentKeys(args) {
|
|
14247
|
-
const seen = /* @__PURE__ */ new Set();
|
|
14248
|
-
const duplicates = /* @__PURE__ */ new Set();
|
|
14249
|
-
for (const token of args.slice(1)) {
|
|
14250
|
-
const rawKey = token.match(/^([A-Za-z_][A-Za-z0-9_.-]*)=/)?.[1];
|
|
14251
|
-
if (!rawKey) continue;
|
|
14252
|
-
const key = rawKey.replace(
|
|
14253
|
-
/-([a-zA-Z0-9])/g,
|
|
14254
|
-
(_match, char) => char.toUpperCase()
|
|
14255
|
-
);
|
|
14256
|
-
if (seen.has(key)) duplicates.add(key);
|
|
14257
|
-
seen.add(key);
|
|
14258
|
-
}
|
|
14259
|
-
return [...duplicates];
|
|
14260
|
-
}
|
|
14261
14666
|
function callJsonArgumentError(args) {
|
|
14262
14667
|
for (let index = 1; index < args.length; index += 1) {
|
|
14263
14668
|
const arg = args[index];
|
|
@@ -14291,7 +14696,22 @@ async function callWithMcporter(args) {
|
|
|
14291
14696
|
let owned = false;
|
|
14292
14697
|
try {
|
|
14293
14698
|
({ runtime, owned } = await acquireRuntime());
|
|
14294
|
-
if (usesPiMcpClient()
|
|
14699
|
+
if (usesPiMcpClient() || args.includes("--help") || args.includes("-h"))
|
|
14700
|
+
return await callWithSharedRuntime(runtime, args);
|
|
14701
|
+
const words2 = takeOptions(args.slice(1), CALL_OPTIONS).rest;
|
|
14702
|
+
try {
|
|
14703
|
+
parseSchemaArgs(
|
|
14704
|
+
{ path: ["mcp", "call", args[0]], description: "", schema: {} },
|
|
14705
|
+
words2,
|
|
14706
|
+
() => "{}",
|
|
14707
|
+
{ assignments: true, unknown: true }
|
|
14708
|
+
);
|
|
14709
|
+
} catch (error) {
|
|
14710
|
+
if (!(error instanceof SchemaArgsError)) throw error;
|
|
14711
|
+
stderr.write(`${error.message}
|
|
14712
|
+
`);
|
|
14713
|
+
return 2;
|
|
14714
|
+
}
|
|
14295
14715
|
const { handleCall } = await loadMcporterCli();
|
|
14296
14716
|
await handleCall(runtime, args);
|
|
14297
14717
|
return process.exitCode ?? 0;
|
|
@@ -14315,43 +14735,61 @@ async function callWithSharedRuntime(runtime, args) {
|
|
|
14315
14735
|
}
|
|
14316
14736
|
const server = selector.slice(0, separator);
|
|
14317
14737
|
const tool = selector.slice(separator + 1);
|
|
14318
|
-
const normalizedArgs = [...args];
|
|
14319
|
-
for (let index = 1; index < normalizedArgs.length; index += 1) {
|
|
14320
|
-
let token = normalizedArgs[index];
|
|
14321
|
-
const equals = token.indexOf("=");
|
|
14322
|
-
if (equals > 0 && !token.startsWith("--")) {
|
|
14323
|
-
const rawValue = token.slice(equals + 1);
|
|
14324
|
-
try {
|
|
14325
|
-
const decoded = JSON.parse(rawValue);
|
|
14326
|
-
if (typeof decoded === "string") {
|
|
14327
|
-
token = `${token.slice(0, equals + 1)}${decoded}`;
|
|
14328
|
-
normalizedArgs[index] = token;
|
|
14329
|
-
}
|
|
14330
|
-
} catch {
|
|
14331
|
-
}
|
|
14332
|
-
}
|
|
14333
|
-
for (const flag of ["--json", "--timeout", "--output"]) {
|
|
14334
|
-
if (token.startsWith(`${flag}=`)) {
|
|
14335
|
-
normalizedArgs.splice(index, 1, flag, token.slice(flag.length + 1));
|
|
14336
|
-
break;
|
|
14337
|
-
}
|
|
14338
|
-
}
|
|
14339
|
-
if (normalizedArgs[index] === "--json" && normalizedArgs[index + 1] === "-") {
|
|
14340
|
-
normalizedArgs[index + 1] = await readStdin();
|
|
14341
|
-
}
|
|
14342
|
-
}
|
|
14343
14738
|
try {
|
|
14344
|
-
const {
|
|
14345
|
-
|
|
14346
|
-
|
|
14347
|
-
|
|
14348
|
-
|
|
14349
|
-
|
|
14350
|
-
|
|
14351
|
-
|
|
14352
|
-
|
|
14353
|
-
|
|
14739
|
+
const {
|
|
14740
|
+
options: { timeout, output = "auto" },
|
|
14741
|
+
rest
|
|
14742
|
+
} = takeOptions(args.slice(1), CALL_OPTIONS);
|
|
14743
|
+
if (timeout !== void 0 && !/^[1-9]\d*$/.test(String(timeout)))
|
|
14744
|
+
throw new Error("--timeout must be a positive integer (milliseconds).");
|
|
14745
|
+
if (!OUTPUT_FORMATS.includes(output))
|
|
14746
|
+
throw new Error(
|
|
14747
|
+
`--output format must be one of: ${OUTPUT_FORMATS.join(", ")}.`
|
|
14748
|
+
);
|
|
14749
|
+
const { resolveCallTimeout } = await loadMcporterCli();
|
|
14750
|
+
const timeoutMs = resolveCallTimeout(
|
|
14751
|
+
timeout === void 0 ? void 0 : Number(timeout)
|
|
14752
|
+
);
|
|
14753
|
+
const entry = await loadCallCatalogEntry(runtime, server, tool, timeoutMs);
|
|
14754
|
+
const schema = entry?.input_schema;
|
|
14755
|
+
const command = {
|
|
14756
|
+
path: ["mcp", "call", `${server}.${tool}`],
|
|
14757
|
+
description: entry?.description ?? "",
|
|
14758
|
+
schema: schema ?? {},
|
|
14759
|
+
// Flags the session refuses, and the call's own, are not the tool's.
|
|
14760
|
+
reserved: [
|
|
14761
|
+
...[...FORBIDDEN_DELEGATED_FLAGS].map((flag) => flag.slice(2)),
|
|
14762
|
+
...Object.keys(CALL_OPTIONS)
|
|
14763
|
+
]
|
|
14764
|
+
};
|
|
14765
|
+
let stdinText;
|
|
14766
|
+
const parse2 = () => parseSchemaArgs(
|
|
14767
|
+
command,
|
|
14768
|
+
rest,
|
|
14769
|
+
() => {
|
|
14770
|
+
if (stdinText === void 0) throw NEEDS_STDIN;
|
|
14771
|
+
return stdinText;
|
|
14772
|
+
},
|
|
14773
|
+
// With no catalog entry the server judges every argument.
|
|
14774
|
+
{ assignments: true, unknown: !schema }
|
|
14354
14775
|
);
|
|
14776
|
+
let parsed;
|
|
14777
|
+
try {
|
|
14778
|
+
parsed = parse2();
|
|
14779
|
+
} catch (error) {
|
|
14780
|
+
if (error !== NEEDS_STDIN) throw error;
|
|
14781
|
+
stdinText = await readStdin();
|
|
14782
|
+
parsed = parse2();
|
|
14783
|
+
}
|
|
14784
|
+
if (parsed.help) {
|
|
14785
|
+
stdout.write(
|
|
14786
|
+
`${schemaHelp(command, `mcp list ${server}.${tool} --schema`)}
|
|
14787
|
+
`
|
|
14788
|
+
);
|
|
14789
|
+
return 0;
|
|
14790
|
+
}
|
|
14791
|
+
const options2 = { output };
|
|
14792
|
+
const values = parsed.args;
|
|
14355
14793
|
const signal = currentMcpCommandContext()?.signal;
|
|
14356
14794
|
const call = callToolWithHandshakeRetry(runtime, server, tool, () => ({
|
|
14357
14795
|
args: values,
|
|
@@ -14371,8 +14809,8 @@ async function callWithSharedRuntime(runtime, args) {
|
|
|
14371
14809
|
if (cancelled) signal.removeEventListener("abort", cancelled);
|
|
14372
14810
|
}) : await call;
|
|
14373
14811
|
const result = createCallResult(raw);
|
|
14374
|
-
const rendered = selectCallOutput(result, raw,
|
|
14375
|
-
const serialized = serializeCallOutput(rendered,
|
|
14812
|
+
const rendered = selectCallOutput(result, raw, options2.output);
|
|
14813
|
+
const serialized = serializeCallOutput(rendered, options2.output);
|
|
14376
14814
|
const configuredLimit = process.env.PI_RECIPES_MCP_MAX_OUTPUT_BYTES;
|
|
14377
14815
|
if (configuredLimit !== void 0) {
|
|
14378
14816
|
const limit = Number(configuredLimit);
|
|
@@ -14395,11 +14833,26 @@ async function callWithSharedRuntime(runtime, args) {
|
|
|
14395
14833
|
`);
|
|
14396
14834
|
return asRecord(raw).isError === true ? 1 : 0;
|
|
14397
14835
|
} catch (error) {
|
|
14836
|
+
if (error instanceof SchemaArgsError) {
|
|
14837
|
+
stderr.write(
|
|
14838
|
+
`${error.message}
|
|
14839
|
+
Run \`${error.usage} --help\` for its arguments.
|
|
14840
|
+
`
|
|
14841
|
+
);
|
|
14842
|
+
return 2;
|
|
14843
|
+
}
|
|
14398
14844
|
stderr.write(`${describeSharedCallError(error, server, tool)}
|
|
14399
14845
|
`);
|
|
14400
14846
|
return 1;
|
|
14401
14847
|
}
|
|
14402
14848
|
}
|
|
14849
|
+
var OUTPUT_FORMATS = ["auto", "text", "markdown", "json", "raw"];
|
|
14850
|
+
var NEEDS_STDIN = /* @__PURE__ */ Symbol("needs stdin");
|
|
14851
|
+
var CALL_OPTIONS = {
|
|
14852
|
+
timeout: "string",
|
|
14853
|
+
output: "string",
|
|
14854
|
+
"no-oauth": "boolean"
|
|
14855
|
+
};
|
|
14403
14856
|
function selectCallOutput(result, raw, format) {
|
|
14404
14857
|
const preferred = {
|
|
14405
14858
|
auto: ["json", "markdown", "text", "raw"],
|
|
@@ -14471,17 +14924,7 @@ function describeSharedCallError(error, server, tool) {
|
|
|
14471
14924
|
}
|
|
14472
14925
|
return issue.rawMessage || (error instanceof Error ? error.message : String(error));
|
|
14473
14926
|
}
|
|
14474
|
-
function
|
|
14475
|
-
const schema = asRecord(value);
|
|
14476
|
-
if (!schema) return false;
|
|
14477
|
-
if (schema.type === "string") return true;
|
|
14478
|
-
if (Array.isArray(schema.type) && schema.type.includes("string")) return true;
|
|
14479
|
-
return ["anyOf", "oneOf", "allOf"].some((key) => {
|
|
14480
|
-
const branches = schema[key];
|
|
14481
|
-
return Array.isArray(branches) && branches.some(schemaAllowsString);
|
|
14482
|
-
});
|
|
14483
|
-
}
|
|
14484
|
-
async function loadCallInputSchema(runtime, server, tool, timeoutMs) {
|
|
14927
|
+
async function loadCallCatalogEntry(runtime, server, tool, timeoutMs) {
|
|
14485
14928
|
let cache = callCatalogCache.get(runtime);
|
|
14486
14929
|
if (!cache) {
|
|
14487
14930
|
cache = /* @__PURE__ */ new Map();
|
|
@@ -14508,27 +14951,7 @@ async function loadCallInputSchema(runtime, server, tool, timeoutMs) {
|
|
|
14508
14951
|
const catalog = await withListTimeout(pending, timeoutMs).catch(
|
|
14509
14952
|
() => void 0
|
|
14510
14953
|
);
|
|
14511
|
-
return catalog?.find((entry) => entry.name === tool)
|
|
14512
|
-
}
|
|
14513
|
-
async function restoreSchemaStringArguments(runtime, server, tool, values, candidates, timeoutMs) {
|
|
14514
|
-
if (!candidates || Object.keys(candidates).length === 0) return values;
|
|
14515
|
-
const inputSchema = await loadCallInputSchema(
|
|
14516
|
-
runtime,
|
|
14517
|
-
server,
|
|
14518
|
-
tool,
|
|
14519
|
-
timeoutMs
|
|
14520
|
-
);
|
|
14521
|
-
const properties = asRecord(inputSchema?.properties);
|
|
14522
|
-
if (!properties) return values;
|
|
14523
|
-
let corrected;
|
|
14524
|
-
for (const [key, rawValue] of Object.entries(candidates)) {
|
|
14525
|
-
if (typeof values[key] !== "number" || !schemaAllowsString(properties[key])) {
|
|
14526
|
-
continue;
|
|
14527
|
-
}
|
|
14528
|
-
corrected ??= { ...values };
|
|
14529
|
-
corrected[key] = rawValue;
|
|
14530
|
-
}
|
|
14531
|
-
return corrected ?? values;
|
|
14954
|
+
return catalog?.find((entry) => entry.name === tool);
|
|
14532
14955
|
}
|
|
14533
14956
|
async function main(args = process.argv.slice(2)) {
|
|
14534
14957
|
if (args.length === 0 || args[0] === "--help" || args[0] === "-h" || args[0] === "help" && args.length === 1) {
|
|
@@ -14546,7 +14969,7 @@ async function main(args = process.argv.slice(2)) {
|
|
|
14546
14969
|
`);
|
|
14547
14970
|
return 0;
|
|
14548
14971
|
}
|
|
14549
|
-
if (args[0] === "call" && args.slice(1).some(isHelpArg)) {
|
|
14972
|
+
if (args[0] === "call" && args.slice(1).some(isHelpArg) && (args[1] === void 0 || args[1].startsWith("-") || isHelpArg(args[1]))) {
|
|
14550
14973
|
stdout.write(`${mcpCallHelpText()}
|
|
14551
14974
|
`);
|
|
14552
14975
|
return 0;
|
|
@@ -14592,20 +15015,6 @@ async function main(args = process.argv.slice(2)) {
|
|
|
14592
15015
|
stderr.write("mcp: invalid session command policy result.\n");
|
|
14593
15016
|
return 1;
|
|
14594
15017
|
}
|
|
14595
|
-
if (args[0] === "call") {
|
|
14596
|
-
const duplicates = duplicateCallArgumentKeys(
|
|
14597
|
-
validated.command.args.slice(1)
|
|
14598
|
-
);
|
|
14599
|
-
if (duplicates.length > 0) {
|
|
14600
|
-
stderr.write(
|
|
14601
|
-
`mcp call: argument${duplicates.length === 1 ? "" : "s"} ${duplicates.map((key) => `'${key}'`).join(
|
|
14602
|
-
", "
|
|
14603
|
-
)} ${duplicates.length === 1 ? "was" : "were"} passed more than once. Pass each argument exactly once.
|
|
14604
|
-
`
|
|
14605
|
-
);
|
|
14606
|
-
return 2;
|
|
14607
|
-
}
|
|
14608
|
-
}
|
|
14609
15018
|
const delegatedArgs = validated.command.args;
|
|
14610
15019
|
if (delegatedArgs[0] === "list") return compactList(delegatedArgs);
|
|
14611
15020
|
if (delegatedArgs[0] === "call") {
|