@yawlabs/ctxlint 0.9.14 → 0.9.16
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/README.md +12 -6
- package/dist/index.js +235 -216
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -260,7 +260,7 @@ Options:
|
|
|
260
260
|
--mcp-global Also scan user/global MCP config files (implies --mcp)
|
|
261
261
|
--session Enable session audit checks (cross-project consistency)
|
|
262
262
|
--session-only Run only session checks, skip context and MCP checks
|
|
263
|
-
--mcp-server Start the MCP server (
|
|
263
|
+
--mcp-server Start the MCP server (alias: `serve` subcommand)
|
|
264
264
|
--watch Re-lint on context file changes
|
|
265
265
|
-V, --version Output the version number
|
|
266
266
|
-h, --help Display help
|
|
@@ -405,10 +405,16 @@ CLI flags override config file settings. Use `--config <path>` to load a config
|
|
|
405
405
|
|
|
406
406
|
ctxlint ships with an MCP server that exposes six tools (`ctxlint_audit`, `ctxlint_mcp_audit`, `ctxlint_session_audit`, `ctxlint_validate_path`, `ctxlint_token_report`, `ctxlint_fix`). All read-only tools declare annotations so MCP clients can skip confirmation dialogs.
|
|
407
407
|
|
|
408
|
+
Launch it with the `serve` subcommand (or the equivalent `--mcp-server` flag, kept for back-compat):
|
|
409
|
+
|
|
410
|
+
```bash
|
|
411
|
+
npx -y @yawlabs/ctxlint serve
|
|
412
|
+
```
|
|
413
|
+
|
|
408
414
|
### With Claude Code
|
|
409
415
|
|
|
410
416
|
```bash
|
|
411
|
-
claude mcp add ctxlint -- npx -y @yawlabs/ctxlint
|
|
417
|
+
claude mcp add ctxlint -- npx -y @yawlabs/ctxlint serve
|
|
412
418
|
```
|
|
413
419
|
|
|
414
420
|
### With `.mcp.json` (Claude Code project config, Cursor, Windsurf)
|
|
@@ -422,7 +428,7 @@ macOS / Linux / WSL:
|
|
|
422
428
|
"mcpServers": {
|
|
423
429
|
"ctxlint": {
|
|
424
430
|
"command": "npx",
|
|
425
|
-
"args": ["-y", "@yawlabs/ctxlint", "
|
|
431
|
+
"args": ["-y", "@yawlabs/ctxlint", "serve"]
|
|
426
432
|
}
|
|
427
433
|
}
|
|
428
434
|
}
|
|
@@ -435,7 +441,7 @@ Windows:
|
|
|
435
441
|
"mcpServers": {
|
|
436
442
|
"ctxlint": {
|
|
437
443
|
"command": "cmd",
|
|
438
|
-
"args": ["/c", "npx", "-y", "@yawlabs/ctxlint", "
|
|
444
|
+
"args": ["/c", "npx", "-y", "@yawlabs/ctxlint", "serve"]
|
|
439
445
|
}
|
|
440
446
|
}
|
|
441
447
|
}
|
|
@@ -452,7 +458,7 @@ Add to `.vscode/mcp.json`:
|
|
|
452
458
|
"servers": {
|
|
453
459
|
"ctxlint": {
|
|
454
460
|
"command": "npx",
|
|
455
|
-
"args": ["-y", "@yawlabs/ctxlint", "
|
|
461
|
+
"args": ["-y", "@yawlabs/ctxlint", "serve"]
|
|
456
462
|
}
|
|
457
463
|
}
|
|
458
464
|
}
|
|
@@ -467,7 +473,7 @@ Add to your Claude Desktop config (`claude_desktop_config.json`):
|
|
|
467
473
|
"mcpServers": {
|
|
468
474
|
"ctxlint": {
|
|
469
475
|
"command": "npx",
|
|
470
|
-
"args": ["-y", "@yawlabs/ctxlint", "
|
|
476
|
+
"args": ["-y", "@yawlabs/ctxlint", "serve"]
|
|
471
477
|
}
|
|
472
478
|
}
|
|
473
479
|
}
|
package/dist/index.js
CHANGED
|
@@ -578,24 +578,24 @@ function processCreateParams(params) {
|
|
|
578
578
|
};
|
|
579
579
|
return { errorMap: customMap, description };
|
|
580
580
|
}
|
|
581
|
-
function timeRegexSource(
|
|
581
|
+
function timeRegexSource(args2) {
|
|
582
582
|
let secondsRegexSource = `[0-5]\\d`;
|
|
583
|
-
if (
|
|
584
|
-
secondsRegexSource = `${secondsRegexSource}\\.\\d{${
|
|
585
|
-
} else if (
|
|
583
|
+
if (args2.precision) {
|
|
584
|
+
secondsRegexSource = `${secondsRegexSource}\\.\\d{${args2.precision}}`;
|
|
585
|
+
} else if (args2.precision == null) {
|
|
586
586
|
secondsRegexSource = `${secondsRegexSource}(\\.\\d+)?`;
|
|
587
587
|
}
|
|
588
|
-
const secondsQuantifier =
|
|
588
|
+
const secondsQuantifier = args2.precision ? "+" : "?";
|
|
589
589
|
return `([01]\\d|2[0-3]):[0-5]\\d(:${secondsRegexSource})${secondsQuantifier}`;
|
|
590
590
|
}
|
|
591
|
-
function timeRegex(
|
|
592
|
-
return new RegExp(`^${timeRegexSource(
|
|
591
|
+
function timeRegex(args2) {
|
|
592
|
+
return new RegExp(`^${timeRegexSource(args2)}$`);
|
|
593
593
|
}
|
|
594
|
-
function datetimeRegex(
|
|
595
|
-
let regex2 = `${dateRegexSource}T${timeRegexSource(
|
|
594
|
+
function datetimeRegex(args2) {
|
|
595
|
+
let regex2 = `${dateRegexSource}T${timeRegexSource(args2)}`;
|
|
596
596
|
const opts = [];
|
|
597
|
-
opts.push(
|
|
598
|
-
if (
|
|
597
|
+
opts.push(args2.local ? `Z?` : `Z`);
|
|
598
|
+
if (args2.offset)
|
|
599
599
|
opts.push(`([+-]\\d{2}:?\\d{2})`);
|
|
600
600
|
regex2 = `${regex2}(${opts.join("|")})`;
|
|
601
601
|
return new RegExp(`^${regex2}$`);
|
|
@@ -3256,9 +3256,9 @@ var init_types = __esm({
|
|
|
3256
3256
|
});
|
|
3257
3257
|
return INVALID;
|
|
3258
3258
|
}
|
|
3259
|
-
function makeArgsIssue(
|
|
3259
|
+
function makeArgsIssue(args2, error49) {
|
|
3260
3260
|
return makeIssue({
|
|
3261
|
-
data:
|
|
3261
|
+
data: args2,
|
|
3262
3262
|
path: ctx.path,
|
|
3263
3263
|
errorMaps: [ctx.common.contextualErrorMap, ctx.schemaErrorMap, getErrorMap(), en_default].filter((x3) => !!x3),
|
|
3264
3264
|
issueData: {
|
|
@@ -3282,10 +3282,10 @@ var init_types = __esm({
|
|
|
3282
3282
|
const fn = ctx.data;
|
|
3283
3283
|
if (this._def.returns instanceof ZodPromise) {
|
|
3284
3284
|
const me2 = this;
|
|
3285
|
-
return OK(async function(...
|
|
3285
|
+
return OK(async function(...args2) {
|
|
3286
3286
|
const error49 = new ZodError([]);
|
|
3287
|
-
const parsedArgs = await me2._def.args.parseAsync(
|
|
3288
|
-
error49.addIssue(makeArgsIssue(
|
|
3287
|
+
const parsedArgs = await me2._def.args.parseAsync(args2, params).catch((e) => {
|
|
3288
|
+
error49.addIssue(makeArgsIssue(args2, e));
|
|
3289
3289
|
throw error49;
|
|
3290
3290
|
});
|
|
3291
3291
|
const result = await Reflect.apply(fn, this, parsedArgs);
|
|
@@ -3297,10 +3297,10 @@ var init_types = __esm({
|
|
|
3297
3297
|
});
|
|
3298
3298
|
} else {
|
|
3299
3299
|
const me2 = this;
|
|
3300
|
-
return OK(function(...
|
|
3301
|
-
const parsedArgs = me2._def.args.safeParse(
|
|
3300
|
+
return OK(function(...args2) {
|
|
3301
|
+
const parsedArgs = me2._def.args.safeParse(args2, params);
|
|
3302
3302
|
if (!parsedArgs.success) {
|
|
3303
|
-
throw new ZodError([makeArgsIssue(
|
|
3303
|
+
throw new ZodError([makeArgsIssue(args2, parsedArgs.error)]);
|
|
3304
3304
|
}
|
|
3305
3305
|
const result = Reflect.apply(fn, this, parsedArgs.data);
|
|
3306
3306
|
const parsedReturns = me2._def.returns.safeParse(result, params);
|
|
@@ -3337,9 +3337,9 @@ var init_types = __esm({
|
|
|
3337
3337
|
const validatedFunc = this.parse(func);
|
|
3338
3338
|
return validatedFunc;
|
|
3339
3339
|
}
|
|
3340
|
-
static create(
|
|
3340
|
+
static create(args2, returns, params) {
|
|
3341
3341
|
return new _ZodFunction({
|
|
3342
|
-
args:
|
|
3342
|
+
args: args2 ? args2 : ZodTuple.create([]).rest(ZodUnknown.create()),
|
|
3343
3343
|
returns: returns || ZodUnknown.create(),
|
|
3344
3344
|
typeName: ZodFirstPartyTypeKind.ZodFunction,
|
|
3345
3345
|
...processCreateParams(params)
|
|
@@ -4613,8 +4613,8 @@ function parsedType(data) {
|
|
|
4613
4613
|
}
|
|
4614
4614
|
return t2;
|
|
4615
4615
|
}
|
|
4616
|
-
function issue(...
|
|
4617
|
-
const [iss, input, inst] =
|
|
4616
|
+
function issue(...args2) {
|
|
4617
|
+
const [iss, input, inst] = args2;
|
|
4618
4618
|
if (typeof iss === "string") {
|
|
4619
4619
|
return {
|
|
4620
4620
|
message: iss,
|
|
@@ -5053,20 +5053,20 @@ __export(regexes_exports, {
|
|
|
5053
5053
|
function emoji() {
|
|
5054
5054
|
return new RegExp(_emoji, "u");
|
|
5055
5055
|
}
|
|
5056
|
-
function timeSource(
|
|
5056
|
+
function timeSource(args2) {
|
|
5057
5057
|
const hhmm = `(?:[01]\\d|2[0-3]):[0-5]\\d`;
|
|
5058
|
-
const regex2 = typeof
|
|
5058
|
+
const regex2 = typeof args2.precision === "number" ? args2.precision === -1 ? `${hhmm}` : args2.precision === 0 ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args2.precision}}` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;
|
|
5059
5059
|
return regex2;
|
|
5060
5060
|
}
|
|
5061
|
-
function time(
|
|
5062
|
-
return new RegExp(`^${timeSource(
|
|
5061
|
+
function time(args2) {
|
|
5062
|
+
return new RegExp(`^${timeSource(args2)}$`);
|
|
5063
5063
|
}
|
|
5064
|
-
function datetime(
|
|
5065
|
-
const time3 = timeSource({ precision:
|
|
5064
|
+
function datetime(args2) {
|
|
5065
|
+
const time3 = timeSource({ precision: args2.precision });
|
|
5066
5066
|
const opts = ["Z"];
|
|
5067
|
-
if (
|
|
5067
|
+
if (args2.local)
|
|
5068
5068
|
opts.push("");
|
|
5069
|
-
if (
|
|
5069
|
+
if (args2.offset)
|
|
5070
5070
|
opts.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);
|
|
5071
5071
|
const timeRegex2 = `${time3}(?:${opts.join("|")})`;
|
|
5072
5072
|
return new RegExp(`^${dateSource}T(?:${timeRegex2})$`);
|
|
@@ -5712,11 +5712,11 @@ var Doc;
|
|
|
5712
5712
|
var init_doc = __esm({
|
|
5713
5713
|
"node_modules/.pnpm/zod@4.3.6/node_modules/zod/v4/core/doc.js"() {
|
|
5714
5714
|
Doc = class {
|
|
5715
|
-
constructor(
|
|
5715
|
+
constructor(args2 = []) {
|
|
5716
5716
|
this.content = [];
|
|
5717
5717
|
this.indent = 0;
|
|
5718
5718
|
if (this)
|
|
5719
|
-
this.args =
|
|
5719
|
+
this.args = args2;
|
|
5720
5720
|
}
|
|
5721
5721
|
indented(fn) {
|
|
5722
5722
|
this.indent += 1;
|
|
@@ -5739,10 +5739,10 @@ var init_doc = __esm({
|
|
|
5739
5739
|
}
|
|
5740
5740
|
compile() {
|
|
5741
5741
|
const F3 = Function;
|
|
5742
|
-
const
|
|
5742
|
+
const args2 = this?.args;
|
|
5743
5743
|
const content = this?.content ?? [``];
|
|
5744
5744
|
const lines = [...content.map((x3) => ` ${x3}`)];
|
|
5745
|
-
return new F3(...
|
|
5745
|
+
return new F3(...args2, lines.join("\n"));
|
|
5746
5746
|
}
|
|
5747
5747
|
};
|
|
5748
5748
|
}
|
|
@@ -7638,8 +7638,8 @@ var init_schemas = __esm({
|
|
|
7638
7638
|
if (typeof func !== "function") {
|
|
7639
7639
|
throw new Error("implement() must be called with a function");
|
|
7640
7640
|
}
|
|
7641
|
-
return function(...
|
|
7642
|
-
const parsedArgs = inst._def.input ? parse(inst._def.input,
|
|
7641
|
+
return function(...args2) {
|
|
7642
|
+
const parsedArgs = inst._def.input ? parse(inst._def.input, args2) : args2;
|
|
7643
7643
|
const result = Reflect.apply(func, this, parsedArgs);
|
|
7644
7644
|
if (inst._def.output) {
|
|
7645
7645
|
return parse(inst._def.output, result);
|
|
@@ -7651,8 +7651,8 @@ var init_schemas = __esm({
|
|
|
7651
7651
|
if (typeof func !== "function") {
|
|
7652
7652
|
throw new Error("implementAsync() must be called with a function");
|
|
7653
7653
|
}
|
|
7654
|
-
return async function(...
|
|
7655
|
-
const parsedArgs = inst._def.input ? await parseAsync(inst._def.input,
|
|
7654
|
+
return async function(...args2) {
|
|
7655
|
+
const parsedArgs = inst._def.input ? await parseAsync(inst._def.input, args2) : args2;
|
|
7656
7656
|
const result = await Reflect.apply(func, this, parsedArgs);
|
|
7657
7657
|
if (inst._def.output) {
|
|
7658
7658
|
return await parseAsync(inst._def.output, result);
|
|
@@ -7678,22 +7678,22 @@ var init_schemas = __esm({
|
|
|
7678
7678
|
}
|
|
7679
7679
|
return payload;
|
|
7680
7680
|
};
|
|
7681
|
-
inst.input = (...
|
|
7681
|
+
inst.input = (...args2) => {
|
|
7682
7682
|
const F3 = inst.constructor;
|
|
7683
|
-
if (Array.isArray(
|
|
7683
|
+
if (Array.isArray(args2[0])) {
|
|
7684
7684
|
return new F3({
|
|
7685
7685
|
type: "function",
|
|
7686
7686
|
input: new $ZodTuple({
|
|
7687
7687
|
type: "tuple",
|
|
7688
|
-
items:
|
|
7689
|
-
rest:
|
|
7688
|
+
items: args2[0],
|
|
7689
|
+
rest: args2[1]
|
|
7690
7690
|
}),
|
|
7691
7691
|
output: inst._def.output
|
|
7692
7692
|
});
|
|
7693
7693
|
}
|
|
7694
7694
|
return new F3({
|
|
7695
7695
|
type: "function",
|
|
7696
|
-
input:
|
|
7696
|
+
input: args2[0],
|
|
7697
7697
|
output: inst._def.output
|
|
7698
7698
|
});
|
|
7699
7699
|
};
|
|
@@ -17185,12 +17185,12 @@ var init_schemas3 = __esm({
|
|
|
17185
17185
|
},
|
|
17186
17186
|
configurable: true
|
|
17187
17187
|
});
|
|
17188
|
-
inst.meta = (...
|
|
17189
|
-
if (
|
|
17188
|
+
inst.meta = (...args2) => {
|
|
17189
|
+
if (args2.length === 0) {
|
|
17190
17190
|
return globalRegistry.get(inst);
|
|
17191
17191
|
}
|
|
17192
17192
|
const cl = inst.clone();
|
|
17193
|
-
globalRegistry.add(cl,
|
|
17193
|
+
globalRegistry.add(cl, args2[0]);
|
|
17194
17194
|
return cl;
|
|
17195
17195
|
};
|
|
17196
17196
|
inst.isOptional = () => inst.safeParse(void 0).success;
|
|
@@ -17206,18 +17206,18 @@ var init_schemas3 = __esm({
|
|
|
17206
17206
|
inst.format = bag.format ?? null;
|
|
17207
17207
|
inst.minLength = bag.minimum ?? null;
|
|
17208
17208
|
inst.maxLength = bag.maximum ?? null;
|
|
17209
|
-
inst.regex = (...
|
|
17210
|
-
inst.includes = (...
|
|
17211
|
-
inst.startsWith = (...
|
|
17212
|
-
inst.endsWith = (...
|
|
17213
|
-
inst.min = (...
|
|
17214
|
-
inst.max = (...
|
|
17215
|
-
inst.length = (...
|
|
17216
|
-
inst.nonempty = (...
|
|
17209
|
+
inst.regex = (...args2) => inst.check(_regex(...args2));
|
|
17210
|
+
inst.includes = (...args2) => inst.check(_includes(...args2));
|
|
17211
|
+
inst.startsWith = (...args2) => inst.check(_startsWith(...args2));
|
|
17212
|
+
inst.endsWith = (...args2) => inst.check(_endsWith(...args2));
|
|
17213
|
+
inst.min = (...args2) => inst.check(_minLength(...args2));
|
|
17214
|
+
inst.max = (...args2) => inst.check(_maxLength(...args2));
|
|
17215
|
+
inst.length = (...args2) => inst.check(_length(...args2));
|
|
17216
|
+
inst.nonempty = (...args2) => inst.check(_minLength(1, ...args2));
|
|
17217
17217
|
inst.lowercase = (params) => inst.check(_lowercase(params));
|
|
17218
17218
|
inst.uppercase = (params) => inst.check(_uppercase(params));
|
|
17219
17219
|
inst.trim = () => inst.check(_trim());
|
|
17220
|
-
inst.normalize = (...
|
|
17220
|
+
inst.normalize = (...args2) => inst.check(_normalize(...args2));
|
|
17221
17221
|
inst.toLowerCase = () => inst.check(_toLowerCase());
|
|
17222
17222
|
inst.toUpperCase = () => inst.check(_toUpperCase());
|
|
17223
17223
|
inst.slugify = () => inst.check(_slugify());
|
|
@@ -17480,8 +17480,8 @@ var init_schemas3 = __esm({
|
|
|
17480
17480
|
inst.merge = (other) => util_exports.merge(inst, other);
|
|
17481
17481
|
inst.pick = (mask) => util_exports.pick(inst, mask);
|
|
17482
17482
|
inst.omit = (mask) => util_exports.omit(inst, mask);
|
|
17483
|
-
inst.partial = (...
|
|
17484
|
-
inst.required = (...
|
|
17483
|
+
inst.partial = (...args2) => util_exports.partial(ZodOptional2, inst, args2[0]);
|
|
17484
|
+
inst.required = (...args2) => util_exports.required(ZodNonOptional, inst, args2[0]);
|
|
17485
17485
|
});
|
|
17486
17486
|
ZodUnion2 = /* @__PURE__ */ $constructor("ZodUnion", (inst, def) => {
|
|
17487
17487
|
$ZodUnion.init(inst, def);
|
|
@@ -17526,19 +17526,19 @@ var init_schemas3 = __esm({
|
|
|
17526
17526
|
inst._zod.processJSONSchema = (ctx, json2, params) => mapProcessor(inst, ctx, json2, params);
|
|
17527
17527
|
inst.keyType = def.keyType;
|
|
17528
17528
|
inst.valueType = def.valueType;
|
|
17529
|
-
inst.min = (...
|
|
17529
|
+
inst.min = (...args2) => inst.check(_minSize(...args2));
|
|
17530
17530
|
inst.nonempty = (params) => inst.check(_minSize(1, params));
|
|
17531
|
-
inst.max = (...
|
|
17532
|
-
inst.size = (...
|
|
17531
|
+
inst.max = (...args2) => inst.check(_maxSize(...args2));
|
|
17532
|
+
inst.size = (...args2) => inst.check(_size(...args2));
|
|
17533
17533
|
});
|
|
17534
17534
|
ZodSet2 = /* @__PURE__ */ $constructor("ZodSet", (inst, def) => {
|
|
17535
17535
|
$ZodSet.init(inst, def);
|
|
17536
17536
|
ZodType2.init(inst, def);
|
|
17537
17537
|
inst._zod.processJSONSchema = (ctx, json2, params) => setProcessor(inst, ctx, json2, params);
|
|
17538
|
-
inst.min = (...
|
|
17538
|
+
inst.min = (...args2) => inst.check(_minSize(...args2));
|
|
17539
17539
|
inst.nonempty = (params) => inst.check(_minSize(1, params));
|
|
17540
|
-
inst.max = (...
|
|
17541
|
-
inst.size = (...
|
|
17540
|
+
inst.max = (...args2) => inst.check(_maxSize(...args2));
|
|
17541
|
+
inst.size = (...args2) => inst.check(_size(...args2));
|
|
17542
17542
|
});
|
|
17543
17543
|
ZodEnum2 = /* @__PURE__ */ $constructor("ZodEnum", (inst, def) => {
|
|
17544
17544
|
$ZodEnum.init(inst, def);
|
|
@@ -17733,11 +17733,11 @@ var init_schemas3 = __esm({
|
|
|
17733
17733
|
});
|
|
17734
17734
|
describe2 = describe;
|
|
17735
17735
|
meta2 = meta;
|
|
17736
|
-
stringbool = (...
|
|
17736
|
+
stringbool = (...args2) => _stringbool({
|
|
17737
17737
|
Codec: ZodCodec,
|
|
17738
17738
|
Boolean: ZodBoolean2,
|
|
17739
17739
|
String: ZodString2
|
|
17740
|
-
}, ...
|
|
17740
|
+
}, ...args2);
|
|
17741
17741
|
}
|
|
17742
17742
|
});
|
|
17743
17743
|
|
|
@@ -22751,23 +22751,23 @@ var require_code = __commonJS({
|
|
|
22751
22751
|
};
|
|
22752
22752
|
exports._Code = _Code;
|
|
22753
22753
|
exports.nil = new _Code("");
|
|
22754
|
-
function _3(strs, ...
|
|
22754
|
+
function _3(strs, ...args2) {
|
|
22755
22755
|
const code = [strs[0]];
|
|
22756
22756
|
let i2 = 0;
|
|
22757
|
-
while (i2 <
|
|
22758
|
-
addCodeArg(code,
|
|
22757
|
+
while (i2 < args2.length) {
|
|
22758
|
+
addCodeArg(code, args2[i2]);
|
|
22759
22759
|
code.push(strs[++i2]);
|
|
22760
22760
|
}
|
|
22761
22761
|
return new _Code(code);
|
|
22762
22762
|
}
|
|
22763
22763
|
exports._ = _3;
|
|
22764
22764
|
var plus = new _Code("+");
|
|
22765
|
-
function str(strs, ...
|
|
22765
|
+
function str(strs, ...args2) {
|
|
22766
22766
|
const expr = [safeStringify(strs[0])];
|
|
22767
22767
|
let i2 = 0;
|
|
22768
|
-
while (i2 <
|
|
22768
|
+
while (i2 < args2.length) {
|
|
22769
22769
|
expr.push(plus);
|
|
22770
|
-
addCodeArg(expr,
|
|
22770
|
+
addCodeArg(expr, args2[i2]);
|
|
22771
22771
|
expr.push(plus, safeStringify(strs[++i2]));
|
|
22772
22772
|
}
|
|
22773
22773
|
optimize(expr);
|
|
@@ -23322,10 +23322,10 @@ var require_codegen = __commonJS({
|
|
|
23322
23322
|
}
|
|
23323
23323
|
};
|
|
23324
23324
|
var Func = class extends BlockNode {
|
|
23325
|
-
constructor(name,
|
|
23325
|
+
constructor(name, args2, async) {
|
|
23326
23326
|
super();
|
|
23327
23327
|
this.name = name;
|
|
23328
|
-
this.args =
|
|
23328
|
+
this.args = args2;
|
|
23329
23329
|
this.async = async;
|
|
23330
23330
|
}
|
|
23331
23331
|
render(opts) {
|
|
@@ -23600,8 +23600,8 @@ var require_codegen = __commonJS({
|
|
|
23600
23600
|
return this;
|
|
23601
23601
|
}
|
|
23602
23602
|
// `function` heading (or definition if funcBody is passed)
|
|
23603
|
-
func(name,
|
|
23604
|
-
this._blockNode(new Func(name,
|
|
23603
|
+
func(name, args2 = code_1.nil, async, funcBody) {
|
|
23604
|
+
this._blockNode(new Func(name, args2, async));
|
|
23605
23605
|
if (funcBody)
|
|
23606
23606
|
this.code(funcBody).endFunc();
|
|
23607
23607
|
return this;
|
|
@@ -23695,13 +23695,13 @@ var require_codegen = __commonJS({
|
|
|
23695
23695
|
}
|
|
23696
23696
|
exports.not = not;
|
|
23697
23697
|
var andCode = mappend(exports.operators.AND);
|
|
23698
|
-
function and(...
|
|
23699
|
-
return
|
|
23698
|
+
function and(...args2) {
|
|
23699
|
+
return args2.reduce(andCode);
|
|
23700
23700
|
}
|
|
23701
23701
|
exports.and = and;
|
|
23702
23702
|
var orCode = mappend(exports.operators.OR);
|
|
23703
|
-
function or(...
|
|
23704
|
-
return
|
|
23703
|
+
function or(...args2) {
|
|
23704
|
+
return args2.reduce(orCode);
|
|
23705
23705
|
}
|
|
23706
23706
|
exports.or = or;
|
|
23707
23707
|
function mappend(op) {
|
|
@@ -24434,8 +24434,8 @@ var require_code2 = __commonJS({
|
|
|
24434
24434
|
];
|
|
24435
24435
|
if (it2.opts.dynamicRef)
|
|
24436
24436
|
valCxt.push([names_1.default.dynamicAnchors, names_1.default.dynamicAnchors]);
|
|
24437
|
-
const
|
|
24438
|
-
return context !== codegen_1.nil ? (0, codegen_1._)`${func}.call(${context}, ${
|
|
24437
|
+
const args2 = (0, codegen_1._)`${dataAndSchema}, ${gen.object(...valCxt)}`;
|
|
24438
|
+
return context !== codegen_1.nil ? (0, codegen_1._)`${func}.call(${context}, ${args2})` : (0, codegen_1._)`${func}(${args2})`;
|
|
24439
24439
|
}
|
|
24440
24440
|
exports.callValidateCode = callValidateCode;
|
|
24441
24441
|
var newRegExp = (0, codegen_1._)`new RegExp`;
|
|
@@ -30480,8 +30480,8 @@ var init_mcp = __esm({
|
|
|
30480
30480
|
if (taskSupport === "optional" && !isTaskRequest && isTaskHandler) {
|
|
30481
30481
|
return await this.handleAutomaticTaskPolling(tool, request, extra);
|
|
30482
30482
|
}
|
|
30483
|
-
const
|
|
30484
|
-
const result = await this.executeToolHandler(tool,
|
|
30483
|
+
const args2 = await this.validateToolInput(tool, request.params.arguments, request.params.name);
|
|
30484
|
+
const result = await this.executeToolHandler(tool, args2, extra);
|
|
30485
30485
|
if (isTaskRequest) {
|
|
30486
30486
|
return result;
|
|
30487
30487
|
}
|
|
@@ -30518,13 +30518,13 @@ var init_mcp = __esm({
|
|
|
30518
30518
|
/**
|
|
30519
30519
|
* Validates tool input arguments against the tool's input schema.
|
|
30520
30520
|
*/
|
|
30521
|
-
async validateToolInput(tool,
|
|
30521
|
+
async validateToolInput(tool, args2, toolName) {
|
|
30522
30522
|
if (!tool.inputSchema) {
|
|
30523
30523
|
return void 0;
|
|
30524
30524
|
}
|
|
30525
30525
|
const inputObj = normalizeObjectSchema(tool.inputSchema);
|
|
30526
30526
|
const schemaToParse = inputObj ?? tool.inputSchema;
|
|
30527
|
-
const parseResult = await safeParseAsync2(schemaToParse,
|
|
30527
|
+
const parseResult = await safeParseAsync2(schemaToParse, args2);
|
|
30528
30528
|
if (!parseResult.success) {
|
|
30529
30529
|
const error49 = "error" in parseResult ? parseResult.error : "Unknown error";
|
|
30530
30530
|
const errorMessage = getParseErrorMessage(error49);
|
|
@@ -30559,7 +30559,7 @@ var init_mcp = __esm({
|
|
|
30559
30559
|
/**
|
|
30560
30560
|
* Executes a tool handler (either regular or task-based).
|
|
30561
30561
|
*/
|
|
30562
|
-
async executeToolHandler(tool,
|
|
30562
|
+
async executeToolHandler(tool, args2, extra) {
|
|
30563
30563
|
const handler = tool.handler;
|
|
30564
30564
|
const isTaskHandler = "createTask" in handler;
|
|
30565
30565
|
if (isTaskHandler) {
|
|
@@ -30569,7 +30569,7 @@ var init_mcp = __esm({
|
|
|
30569
30569
|
const taskExtra = { ...extra, taskStore: extra.taskStore };
|
|
30570
30570
|
if (tool.inputSchema) {
|
|
30571
30571
|
const typedHandler = handler;
|
|
30572
|
-
return await Promise.resolve(typedHandler.createTask(
|
|
30572
|
+
return await Promise.resolve(typedHandler.createTask(args2, taskExtra));
|
|
30573
30573
|
} else {
|
|
30574
30574
|
const typedHandler = handler;
|
|
30575
30575
|
return await Promise.resolve(typedHandler.createTask(taskExtra));
|
|
@@ -30577,7 +30577,7 @@ var init_mcp = __esm({
|
|
|
30577
30577
|
}
|
|
30578
30578
|
if (tool.inputSchema) {
|
|
30579
30579
|
const typedHandler = handler;
|
|
30580
|
-
return await Promise.resolve(typedHandler(
|
|
30580
|
+
return await Promise.resolve(typedHandler(args2, extra));
|
|
30581
30581
|
} else {
|
|
30582
30582
|
const typedHandler = handler;
|
|
30583
30583
|
return await Promise.resolve(typedHandler(extra));
|
|
@@ -30590,10 +30590,10 @@ var init_mcp = __esm({
|
|
|
30590
30590
|
if (!extra.taskStore) {
|
|
30591
30591
|
throw new Error("No task store provided for task-capable tool.");
|
|
30592
30592
|
}
|
|
30593
|
-
const
|
|
30593
|
+
const args2 = await this.validateToolInput(tool, request.params.arguments, request.params.name);
|
|
30594
30594
|
const handler = tool.handler;
|
|
30595
30595
|
const taskExtra = { ...extra, taskStore: extra.taskStore };
|
|
30596
|
-
const createTaskResult =
|
|
30596
|
+
const createTaskResult = args2 ? await Promise.resolve(handler.createTask(args2, taskExtra)) : (
|
|
30597
30597
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
30598
30598
|
await Promise.resolve(handler.createTask(taskExtra))
|
|
30599
30599
|
);
|
|
@@ -30768,9 +30768,9 @@ var init_mcp = __esm({
|
|
|
30768
30768
|
const errorMessage = getParseErrorMessage(error49);
|
|
30769
30769
|
throw new McpError(ErrorCode.InvalidParams, `Invalid arguments for prompt ${request.params.name}: ${errorMessage}`);
|
|
30770
30770
|
}
|
|
30771
|
-
const
|
|
30771
|
+
const args2 = parseResult.data;
|
|
30772
30772
|
const cb = prompt.callback;
|
|
30773
|
-
return await Promise.resolve(cb(
|
|
30773
|
+
return await Promise.resolve(cb(args2, extra));
|
|
30774
30774
|
} else {
|
|
30775
30775
|
const cb = prompt.callback;
|
|
30776
30776
|
return await Promise.resolve(cb(extra));
|
|
@@ -34885,7 +34885,7 @@ var require_common = __commonJS({
|
|
|
34885
34885
|
let enableOverride = null;
|
|
34886
34886
|
let namespacesCache;
|
|
34887
34887
|
let enabledCache;
|
|
34888
|
-
function debug2(...
|
|
34888
|
+
function debug2(...args2) {
|
|
34889
34889
|
if (!debug2.enabled) {
|
|
34890
34890
|
return;
|
|
34891
34891
|
}
|
|
@@ -34896,28 +34896,28 @@ var require_common = __commonJS({
|
|
|
34896
34896
|
self2.prev = prevTime;
|
|
34897
34897
|
self2.curr = curr;
|
|
34898
34898
|
prevTime = curr;
|
|
34899
|
-
|
|
34900
|
-
if (typeof
|
|
34901
|
-
|
|
34899
|
+
args2[0] = createDebug.coerce(args2[0]);
|
|
34900
|
+
if (typeof args2[0] !== "string") {
|
|
34901
|
+
args2.unshift("%O");
|
|
34902
34902
|
}
|
|
34903
34903
|
let index = 0;
|
|
34904
|
-
|
|
34904
|
+
args2[0] = args2[0].replace(/%([a-zA-Z%])/g, (match, format2) => {
|
|
34905
34905
|
if (match === "%%") {
|
|
34906
34906
|
return "%";
|
|
34907
34907
|
}
|
|
34908
34908
|
index++;
|
|
34909
34909
|
const formatter = createDebug.formatters[format2];
|
|
34910
34910
|
if (typeof formatter === "function") {
|
|
34911
|
-
const val =
|
|
34911
|
+
const val = args2[index];
|
|
34912
34912
|
match = formatter.call(self2, val);
|
|
34913
|
-
|
|
34913
|
+
args2.splice(index, 1);
|
|
34914
34914
|
index--;
|
|
34915
34915
|
}
|
|
34916
34916
|
return match;
|
|
34917
34917
|
});
|
|
34918
|
-
createDebug.formatArgs.call(self2,
|
|
34918
|
+
createDebug.formatArgs.call(self2, args2);
|
|
34919
34919
|
const logFn = self2.log || createDebug.log;
|
|
34920
|
-
logFn.apply(self2,
|
|
34920
|
+
logFn.apply(self2, args2);
|
|
34921
34921
|
}
|
|
34922
34922
|
debug2.namespace = namespace;
|
|
34923
34923
|
debug2.useColors = createDebug.useColors();
|
|
@@ -35139,16 +35139,16 @@ var require_browser = __commonJS({
|
|
|
35139
35139
|
typeof navigator !== "undefined" && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker
|
|
35140
35140
|
typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
|
|
35141
35141
|
}
|
|
35142
|
-
function formatArgs(
|
|
35143
|
-
|
|
35142
|
+
function formatArgs(args2) {
|
|
35143
|
+
args2[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args2[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);
|
|
35144
35144
|
if (!this.useColors) {
|
|
35145
35145
|
return;
|
|
35146
35146
|
}
|
|
35147
35147
|
const c3 = "color: " + this.color;
|
|
35148
|
-
|
|
35148
|
+
args2.splice(1, 0, c3, "color: inherit");
|
|
35149
35149
|
let index = 0;
|
|
35150
35150
|
let lastC = 0;
|
|
35151
|
-
|
|
35151
|
+
args2[0].replace(/%[a-zA-Z%]/g, (match) => {
|
|
35152
35152
|
if (match === "%%") {
|
|
35153
35153
|
return;
|
|
35154
35154
|
}
|
|
@@ -35157,7 +35157,7 @@ var require_browser = __commonJS({
|
|
|
35157
35157
|
lastC = index;
|
|
35158
35158
|
}
|
|
35159
35159
|
});
|
|
35160
|
-
|
|
35160
|
+
args2.splice(lastC, 0, c3);
|
|
35161
35161
|
}
|
|
35162
35162
|
exports.log = console.debug || console.log || (() => {
|
|
35163
35163
|
});
|
|
@@ -35438,16 +35438,16 @@ var require_node = __commonJS({
|
|
|
35438
35438
|
function useColors() {
|
|
35439
35439
|
return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty3.isatty(process.stderr.fd);
|
|
35440
35440
|
}
|
|
35441
|
-
function formatArgs(
|
|
35441
|
+
function formatArgs(args2) {
|
|
35442
35442
|
const { namespace: name, useColors: useColors2 } = this;
|
|
35443
35443
|
if (useColors2) {
|
|
35444
35444
|
const c3 = this.color;
|
|
35445
35445
|
const colorCode = "\x1B[3" + (c3 < 8 ? c3 : "8;5;" + c3);
|
|
35446
35446
|
const prefix = ` ${colorCode};1m${name} \x1B[0m`;
|
|
35447
|
-
|
|
35448
|
-
|
|
35447
|
+
args2[0] = prefix + args2[0].split("\n").join("\n" + prefix);
|
|
35448
|
+
args2.push(colorCode + "m+" + module.exports.humanize(this.diff) + "\x1B[0m");
|
|
35449
35449
|
} else {
|
|
35450
|
-
|
|
35450
|
+
args2[0] = getDate() + name + " " + args2[0];
|
|
35451
35451
|
}
|
|
35452
35452
|
}
|
|
35453
35453
|
function getDate() {
|
|
@@ -35456,8 +35456,8 @@ var require_node = __commonJS({
|
|
|
35456
35456
|
}
|
|
35457
35457
|
return (/* @__PURE__ */ new Date()).toISOString() + " ";
|
|
35458
35458
|
}
|
|
35459
|
-
function log(...
|
|
35460
|
-
return process.stderr.write(util2.formatWithOptions(exports.inspectOpts, ...
|
|
35459
|
+
function log(...args2) {
|
|
35460
|
+
return process.stderr.write(util2.formatWithOptions(exports.inspectOpts, ...args2) + "\n");
|
|
35461
35461
|
}
|
|
35462
35462
|
function save(namespaces) {
|
|
35463
35463
|
if (namespaces) {
|
|
@@ -36253,29 +36253,29 @@ function appendTaskOptions(options, commands = []) {
|
|
|
36253
36253
|
return commands2;
|
|
36254
36254
|
}, commands);
|
|
36255
36255
|
}
|
|
36256
|
-
function getTrailingOptions(
|
|
36256
|
+
function getTrailingOptions(args2, initialPrimitive = 0, objectOnly = false) {
|
|
36257
36257
|
const command = [];
|
|
36258
|
-
for (let i2 = 0, max = initialPrimitive < 0 ?
|
|
36259
|
-
if ("string|number".includes(typeof
|
|
36260
|
-
command.push(String(
|
|
36258
|
+
for (let i2 = 0, max = initialPrimitive < 0 ? args2.length : initialPrimitive; i2 < max; i2++) {
|
|
36259
|
+
if ("string|number".includes(typeof args2[i2])) {
|
|
36260
|
+
command.push(String(args2[i2]));
|
|
36261
36261
|
}
|
|
36262
36262
|
}
|
|
36263
|
-
appendTaskOptions(trailingOptionsArgument(
|
|
36263
|
+
appendTaskOptions(trailingOptionsArgument(args2), command);
|
|
36264
36264
|
if (!objectOnly) {
|
|
36265
|
-
command.push(...trailingArrayArgument(
|
|
36265
|
+
command.push(...trailingArrayArgument(args2));
|
|
36266
36266
|
}
|
|
36267
36267
|
return command;
|
|
36268
36268
|
}
|
|
36269
|
-
function trailingArrayArgument(
|
|
36270
|
-
const hasTrailingCallback = typeof last(
|
|
36271
|
-
return asStringArray(filterType(last(
|
|
36269
|
+
function trailingArrayArgument(args2) {
|
|
36270
|
+
const hasTrailingCallback = typeof last(args2) === "function";
|
|
36271
|
+
return asStringArray(filterType(last(args2, hasTrailingCallback ? 1 : 0), filterArray, []));
|
|
36272
36272
|
}
|
|
36273
|
-
function trailingOptionsArgument(
|
|
36274
|
-
const hasTrailingCallback = filterFunction(last(
|
|
36275
|
-
return filterType(last(
|
|
36273
|
+
function trailingOptionsArgument(args2) {
|
|
36274
|
+
const hasTrailingCallback = filterFunction(last(args2));
|
|
36275
|
+
return filterType(last(args2, hasTrailingCallback ? 1 : 0), filterPlainObject);
|
|
36276
36276
|
}
|
|
36277
|
-
function trailingFunctionArgument(
|
|
36278
|
-
const callback = asFunction(last(
|
|
36277
|
+
function trailingFunctionArgument(args2, includeNoop = true) {
|
|
36278
|
+
const callback = asFunction(last(args2));
|
|
36279
36279
|
return includeNoop || isUserFunction(callback) ? callback : void 0;
|
|
36280
36280
|
}
|
|
36281
36281
|
function callTaskParser(parser4, streams) {
|
|
@@ -36643,15 +36643,15 @@ function createLog() {
|
|
|
36643
36643
|
}
|
|
36644
36644
|
function prefixedLogger(to, prefix, forward) {
|
|
36645
36645
|
if (!prefix || !String(prefix).replace(/\s*/, "")) {
|
|
36646
|
-
return !forward ? to : (message, ...
|
|
36647
|
-
to(message, ...
|
|
36648
|
-
forward(message, ...
|
|
36646
|
+
return !forward ? to : (message, ...args2) => {
|
|
36647
|
+
to(message, ...args2);
|
|
36648
|
+
forward(message, ...args2);
|
|
36649
36649
|
};
|
|
36650
36650
|
}
|
|
36651
|
-
return (message, ...
|
|
36652
|
-
to(`%s ${message}`, prefix, ...
|
|
36651
|
+
return (message, ...args2) => {
|
|
36652
|
+
to(`%s ${message}`, prefix, ...args2);
|
|
36653
36653
|
if (forward) {
|
|
36654
|
-
forward(message, ...
|
|
36654
|
+
forward(message, ...args2);
|
|
36655
36655
|
}
|
|
36656
36656
|
};
|
|
36657
36657
|
}
|
|
@@ -36753,8 +36753,8 @@ function changeWorkingDirectoryTask(directory, root) {
|
|
|
36753
36753
|
return (root || instance).cwd = directory;
|
|
36754
36754
|
});
|
|
36755
36755
|
}
|
|
36756
|
-
function checkoutTask(
|
|
36757
|
-
const commands = ["checkout", ...
|
|
36756
|
+
function checkoutTask(args2) {
|
|
36757
|
+
const commands = ["checkout", ...args2];
|
|
36758
36758
|
if (commands[1] === "-b" && commands.includes("-B")) {
|
|
36759
36759
|
commands[1] = remove(commands, "-B");
|
|
36760
36760
|
}
|
|
@@ -37258,11 +37258,11 @@ function versionParser(stdOut) {
|
|
|
37258
37258
|
}
|
|
37259
37259
|
return parseStringResponse(versionResponse(0, 0, 0, stdOut), parsers7, stdOut);
|
|
37260
37260
|
}
|
|
37261
|
-
function createCloneTask(api, task, repoPath, ...
|
|
37261
|
+
function createCloneTask(api, task, repoPath, ...args2) {
|
|
37262
37262
|
if (!filterString(repoPath)) {
|
|
37263
37263
|
return configurationErrorTask(`git.${api}() requires a string 'repoPath'`);
|
|
37264
37264
|
}
|
|
37265
|
-
return task(repoPath, filterType(
|
|
37265
|
+
return task(repoPath, filterType(args2[0], filterString), getTrailingOptions(arguments));
|
|
37266
37266
|
}
|
|
37267
37267
|
function clone_default() {
|
|
37268
37268
|
return {
|
|
@@ -37610,13 +37610,13 @@ function abortPlugin(signal) {
|
|
|
37610
37610
|
function blockUnsafeOperationsPlugin(options = {}) {
|
|
37611
37611
|
return {
|
|
37612
37612
|
type: "spawn.args",
|
|
37613
|
-
action(
|
|
37614
|
-
for (const vulnerability of te2(
|
|
37613
|
+
action(args2, { env: env2 }) {
|
|
37614
|
+
for (const vulnerability of te2(args2, env2)) {
|
|
37615
37615
|
if (options[vulnerability.category] !== true) {
|
|
37616
37616
|
throw new GitPluginError(void 0, "unsafe", vulnerability.message);
|
|
37617
37617
|
}
|
|
37618
37618
|
}
|
|
37619
|
-
return
|
|
37619
|
+
return args2;
|
|
37620
37620
|
}
|
|
37621
37621
|
};
|
|
37622
37622
|
}
|
|
@@ -37782,11 +37782,11 @@ function progressMonitorPlugin(progress) {
|
|
|
37782
37782
|
};
|
|
37783
37783
|
const onArgs = {
|
|
37784
37784
|
type: "spawn.args",
|
|
37785
|
-
action(
|
|
37785
|
+
action(args2, context) {
|
|
37786
37786
|
if (!progressMethods.includes(context.method)) {
|
|
37787
|
-
return
|
|
37787
|
+
return args2;
|
|
37788
37788
|
}
|
|
37789
|
-
return including(
|
|
37789
|
+
return including(args2, progressCommand);
|
|
37790
37790
|
}
|
|
37791
37791
|
};
|
|
37792
37792
|
return [onArgs, onProgress];
|
|
@@ -37843,8 +37843,8 @@ function suffixPathsPlugin() {
|
|
|
37843
37843
|
action(data) {
|
|
37844
37844
|
const prefix = [];
|
|
37845
37845
|
let suffix;
|
|
37846
|
-
function append2(
|
|
37847
|
-
(suffix = suffix || []).push(...
|
|
37846
|
+
function append2(args2) {
|
|
37847
|
+
(suffix = suffix || []).push(...args2);
|
|
37848
37848
|
}
|
|
37849
37849
|
for (let i2 = 0; i2 < data.length; i2++) {
|
|
37850
37850
|
const param = data[i2];
|
|
@@ -38509,18 +38509,18 @@ var init_esm2 = __esm({
|
|
|
38509
38509
|
}
|
|
38510
38510
|
async attemptRemoteTask(task, logger) {
|
|
38511
38511
|
const binary = this._plugins.exec("spawn.binary", "", pluginContext(task, task.commands));
|
|
38512
|
-
const
|
|
38512
|
+
const args2 = this._plugins.exec("spawn.args", [...task.commands], {
|
|
38513
38513
|
...pluginContext(task, task.commands),
|
|
38514
38514
|
env: { ...this.env }
|
|
38515
38515
|
});
|
|
38516
38516
|
const raw = await this.gitResponse(
|
|
38517
38517
|
task,
|
|
38518
38518
|
binary,
|
|
38519
|
-
|
|
38519
|
+
args2,
|
|
38520
38520
|
this.outputHandler,
|
|
38521
38521
|
logger.step("SPAWN")
|
|
38522
38522
|
);
|
|
38523
|
-
const outputStreams = await this.handleTaskData(task,
|
|
38523
|
+
const outputStreams = await this.handleTaskData(task, args2, raw, logger.step("HANDLE"));
|
|
38524
38524
|
logger(`passing response to task's parser as a %s`, task.format);
|
|
38525
38525
|
if (isBufferTask(task)) {
|
|
38526
38526
|
return callTaskParser(task.parser, outputStreams);
|
|
@@ -38531,7 +38531,7 @@ var init_esm2 = __esm({
|
|
|
38531
38531
|
logger(`empty task bypassing child process to call to task's parser`);
|
|
38532
38532
|
return task.parser(this);
|
|
38533
38533
|
}
|
|
38534
|
-
handleTaskData(task,
|
|
38534
|
+
handleTaskData(task, args2, result, logger) {
|
|
38535
38535
|
const { exitCode, rejection, stdOut, stdErr } = result;
|
|
38536
38536
|
return new Promise((done, fail) => {
|
|
38537
38537
|
logger(`Preparing to handle process response exitCode=%d stdOut=`, exitCode);
|
|
@@ -38539,7 +38539,7 @@ var init_esm2 = __esm({
|
|
|
38539
38539
|
"task.error",
|
|
38540
38540
|
{ error: rejection },
|
|
38541
38541
|
{
|
|
38542
|
-
...pluginContext(task,
|
|
38542
|
+
...pluginContext(task, args2),
|
|
38543
38543
|
...result
|
|
38544
38544
|
}
|
|
38545
38545
|
);
|
|
@@ -38574,7 +38574,7 @@ var init_esm2 = __esm({
|
|
|
38574
38574
|
done(new GitOutputStreams(Buffer.concat(stdOut), Buffer.concat(stdErr)));
|
|
38575
38575
|
});
|
|
38576
38576
|
}
|
|
38577
|
-
async gitResponse(task, command,
|
|
38577
|
+
async gitResponse(task, command, args2, outputHandler, logger) {
|
|
38578
38578
|
const outputLogger = logger.sibling("output");
|
|
38579
38579
|
const spawnOptions = this._plugins.exec(
|
|
38580
38580
|
"spawn.options",
|
|
@@ -38588,9 +38588,9 @@ var init_esm2 = __esm({
|
|
|
38588
38588
|
return new Promise((done) => {
|
|
38589
38589
|
const stdOut = [];
|
|
38590
38590
|
const stdErr = [];
|
|
38591
|
-
logger.info(`%s %o`, command,
|
|
38591
|
+
logger.info(`%s %o`, command, args2);
|
|
38592
38592
|
logger("%O", spawnOptions);
|
|
38593
|
-
let rejection = this._beforeSpawn(task,
|
|
38593
|
+
let rejection = this._beforeSpawn(task, args2);
|
|
38594
38594
|
if (rejection) {
|
|
38595
38595
|
return done({
|
|
38596
38596
|
stdOut,
|
|
@@ -38600,12 +38600,12 @@ var init_esm2 = __esm({
|
|
|
38600
38600
|
});
|
|
38601
38601
|
}
|
|
38602
38602
|
this._plugins.exec("spawn.before", void 0, {
|
|
38603
|
-
...pluginContext(task,
|
|
38603
|
+
...pluginContext(task, args2),
|
|
38604
38604
|
kill(reason) {
|
|
38605
38605
|
rejection = reason || rejection;
|
|
38606
38606
|
}
|
|
38607
38607
|
});
|
|
38608
|
-
const spawned = spawn(command,
|
|
38608
|
+
const spawned = spawn(command, args2, spawnOptions);
|
|
38609
38609
|
spawned.stdout.on(
|
|
38610
38610
|
"data",
|
|
38611
38611
|
onDataReceived(stdOut, "stdOut", logger, outputLogger.step("stdOut"))
|
|
@@ -38617,10 +38617,10 @@ var init_esm2 = __esm({
|
|
|
38617
38617
|
spawned.on("error", onErrorReceived(stdErr, logger));
|
|
38618
38618
|
if (outputHandler) {
|
|
38619
38619
|
logger(`Passing child process stdOut/stdErr to custom outputHandler`);
|
|
38620
|
-
outputHandler(command, spawned.stdout, spawned.stderr, [...
|
|
38620
|
+
outputHandler(command, spawned.stdout, spawned.stderr, [...args2]);
|
|
38621
38621
|
}
|
|
38622
38622
|
this._plugins.exec("spawn.after", void 0, {
|
|
38623
|
-
...pluginContext(task,
|
|
38623
|
+
...pluginContext(task, args2),
|
|
38624
38624
|
spawned,
|
|
38625
38625
|
close(exitCode, reason) {
|
|
38626
38626
|
done({
|
|
@@ -38640,10 +38640,10 @@ var init_esm2 = __esm({
|
|
|
38640
38640
|
});
|
|
38641
38641
|
});
|
|
38642
38642
|
}
|
|
38643
|
-
_beforeSpawn(task,
|
|
38643
|
+
_beforeSpawn(task, args2) {
|
|
38644
38644
|
let rejection;
|
|
38645
38645
|
this._plugins.exec("spawn.before", void 0, {
|
|
38646
|
-
...pluginContext(task,
|
|
38646
|
+
...pluginContext(task, args2),
|
|
38647
38647
|
kill(reason) {
|
|
38648
38648
|
rejection = reason || rejection;
|
|
38649
38649
|
}
|
|
@@ -40226,13 +40226,13 @@ var init_esm2 = __esm({
|
|
|
40226
40226
|
Git2.prototype.submoduleAdd = function(repo, path12, then) {
|
|
40227
40227
|
return this._runTask(addSubModuleTask2(repo, path12), trailingFunctionArgument2(arguments));
|
|
40228
40228
|
};
|
|
40229
|
-
Git2.prototype.submoduleUpdate = function(
|
|
40229
|
+
Git2.prototype.submoduleUpdate = function(args2, then) {
|
|
40230
40230
|
return this._runTask(
|
|
40231
40231
|
updateSubModuleTask2(getTrailingOptions2(arguments, true)),
|
|
40232
40232
|
trailingFunctionArgument2(arguments)
|
|
40233
40233
|
);
|
|
40234
40234
|
};
|
|
40235
|
-
Git2.prototype.submoduleInit = function(
|
|
40235
|
+
Git2.prototype.submoduleInit = function(args2, then) {
|
|
40236
40236
|
return this._runTask(
|
|
40237
40237
|
initSubModuleTask2(getTrailingOptions2(arguments, true)),
|
|
40238
40238
|
trailingFunctionArgument2(arguments)
|
|
@@ -40306,10 +40306,10 @@ var init_esm2 = __esm({
|
|
|
40306
40306
|
Git2.prototype.binaryCatFile = function() {
|
|
40307
40307
|
return this._catFile("buffer", arguments);
|
|
40308
40308
|
};
|
|
40309
|
-
Git2.prototype._catFile = function(format2,
|
|
40310
|
-
var handler = trailingFunctionArgument2(
|
|
40309
|
+
Git2.prototype._catFile = function(format2, args2) {
|
|
40310
|
+
var handler = trailingFunctionArgument2(args2);
|
|
40311
40311
|
var command = ["cat-file"];
|
|
40312
|
-
var options =
|
|
40312
|
+
var options = args2[0];
|
|
40313
40313
|
if (typeof options === "string") {
|
|
40314
40314
|
return this._runTask(
|
|
40315
40315
|
configurationErrorTask2("Git.catFile: options must be supplied as an array of strings"),
|
|
@@ -43854,7 +43854,7 @@ import { readFileSync as readFileSync4 } from "node:fs";
|
|
|
43854
43854
|
import { resolve as resolve8, dirname as dirname3 } from "node:path";
|
|
43855
43855
|
import { fileURLToPath } from "node:url";
|
|
43856
43856
|
function loadVersion() {
|
|
43857
|
-
if (true) return "0.9.
|
|
43857
|
+
if (true) return "0.9.16";
|
|
43858
43858
|
const __dir = dirname3(fileURLToPath(import.meta.url));
|
|
43859
43859
|
const pkgPath = resolve8(__dir, "../package.json");
|
|
43860
43860
|
const pkg = JSON.parse(readFileSync4(pkgPath, "utf-8"));
|
|
@@ -44771,7 +44771,23 @@ var init_fixer = __esm({
|
|
|
44771
44771
|
// src/mcp/server.ts
|
|
44772
44772
|
var server_exports = {};
|
|
44773
44773
|
import * as path9 from "node:path";
|
|
44774
|
-
|
|
44774
|
+
function validateProjectPath(rawPath) {
|
|
44775
|
+
if (!rawPath) return process.cwd();
|
|
44776
|
+
if (PATH_DISALLOWED.test(rawPath)) {
|
|
44777
|
+
throw new Error("projectPath contains disallowed characters");
|
|
44778
|
+
}
|
|
44779
|
+
const resolved = path9.resolve(rawPath);
|
|
44780
|
+
if (!isDirectory(resolved)) {
|
|
44781
|
+
throw new Error("projectPath is not an existing directory");
|
|
44782
|
+
}
|
|
44783
|
+
return resolved;
|
|
44784
|
+
}
|
|
44785
|
+
function validateFilePathInput(rawPath) {
|
|
44786
|
+
if (PATH_DISALLOWED.test(rawPath)) {
|
|
44787
|
+
throw new Error("path contains disallowed characters");
|
|
44788
|
+
}
|
|
44789
|
+
}
|
|
44790
|
+
var contextCheckEnum, mcpCheckEnum, sessionCheckEnum, PATH_DISALLOWED, server, transport;
|
|
44775
44791
|
var init_server3 = __esm({
|
|
44776
44792
|
async "src/mcp/server.ts"() {
|
|
44777
44793
|
"use strict";
|
|
@@ -44791,13 +44807,14 @@ var init_server3 = __esm({
|
|
|
44791
44807
|
contextCheckEnum = external_exports3.enum(ALL_CHECKS);
|
|
44792
44808
|
mcpCheckEnum = external_exports3.enum(ALL_MCP_CHECKS);
|
|
44793
44809
|
sessionCheckEnum = external_exports3.enum(ALL_SESSION_CHECKS);
|
|
44810
|
+
PATH_DISALLOWED = /[\n\r\t;`|]|\$\(|\$\{/;
|
|
44794
44811
|
server = new McpServer({
|
|
44795
44812
|
name: "ctxlint",
|
|
44796
44813
|
version: VERSION
|
|
44797
44814
|
});
|
|
44798
44815
|
server.tool(
|
|
44799
44816
|
"ctxlint_audit",
|
|
44800
|
-
"Audit AI agent context files (CLAUDE.md, AGENTS.md, etc.) in the project. Checks for stale references, invalid commands, redundant content, contradictions, frontmatter issues, and token waste.
|
|
44817
|
+
"Audit AI agent context files (CLAUDE.md, AGENTS.md, etc.) in the project. Checks for stale references, invalid commands, redundant content, contradictions, frontmatter issues, and token waste. Scoped to context-file checks only; MCP-config and session-level checks are exposed as separate tools.",
|
|
44801
44818
|
{
|
|
44802
44819
|
projectPath: external_exports3.string().optional().describe("Path to the project root. Defaults to current working directory."),
|
|
44803
44820
|
checks: external_exports3.array(contextCheckEnum).optional().describe("Which context-file checks to run. Defaults to all.")
|
|
@@ -44809,9 +44826,9 @@ var init_server3 = __esm({
|
|
|
44809
44826
|
openWorldHint: false
|
|
44810
44827
|
},
|
|
44811
44828
|
async ({ projectPath, checks }) => {
|
|
44812
|
-
const root = path9.resolve(projectPath || process.cwd());
|
|
44813
|
-
const activeChecks = checks?.length ? checks : ALL_CHECKS;
|
|
44814
44829
|
try {
|
|
44830
|
+
const root = validateProjectPath(projectPath);
|
|
44831
|
+
const activeChecks = checks?.length ? checks : ALL_CHECKS;
|
|
44815
44832
|
const result = await runAudit(root, activeChecks);
|
|
44816
44833
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
44817
44834
|
} catch (err) {
|
|
@@ -44843,7 +44860,8 @@ var init_server3 = __esm({
|
|
|
44843
44860
|
},
|
|
44844
44861
|
async ({ path: filePath, projectPath }) => {
|
|
44845
44862
|
try {
|
|
44846
|
-
|
|
44863
|
+
validateFilePathInput(filePath);
|
|
44864
|
+
const root = validateProjectPath(projectPath);
|
|
44847
44865
|
const resolved = path9.resolve(root, filePath);
|
|
44848
44866
|
const result = {
|
|
44849
44867
|
path: filePath,
|
|
@@ -44885,8 +44903,8 @@ var init_server3 = __esm({
|
|
|
44885
44903
|
openWorldHint: false
|
|
44886
44904
|
},
|
|
44887
44905
|
async ({ projectPath }) => {
|
|
44888
|
-
const root = path9.resolve(projectPath || process.cwd());
|
|
44889
44906
|
try {
|
|
44907
|
+
const root = validateProjectPath(projectPath);
|
|
44890
44908
|
const discovered = await scanForContextFiles(root);
|
|
44891
44909
|
const parsed = discovered.map((f) => parseContextFile(f));
|
|
44892
44910
|
const files = parsed.map((f) => ({
|
|
@@ -44936,9 +44954,9 @@ var init_server3 = __esm({
|
|
|
44936
44954
|
openWorldHint: false
|
|
44937
44955
|
},
|
|
44938
44956
|
async ({ projectPath, checks }) => {
|
|
44939
|
-
const root = path9.resolve(projectPath || process.cwd());
|
|
44940
|
-
const activeChecks = checks?.length ? checks : ALL_CHECKS;
|
|
44941
44957
|
try {
|
|
44958
|
+
const root = validateProjectPath(projectPath);
|
|
44959
|
+
const activeChecks = checks?.length ? checks : ALL_CHECKS;
|
|
44942
44960
|
const result = await runAudit(root, activeChecks);
|
|
44943
44961
|
const fixSummary = applyFixes(result, { quiet: true });
|
|
44944
44962
|
return {
|
|
@@ -44986,9 +45004,9 @@ var init_server3 = __esm({
|
|
|
44986
45004
|
openWorldHint: false
|
|
44987
45005
|
},
|
|
44988
45006
|
async ({ projectPath, checks, includeGlobal }) => {
|
|
44989
|
-
const root = path9.resolve(projectPath || process.cwd());
|
|
44990
|
-
const activeChecks = checks?.length ? checks : ALL_MCP_CHECKS;
|
|
44991
45007
|
try {
|
|
45008
|
+
const root = validateProjectPath(projectPath);
|
|
45009
|
+
const activeChecks = checks?.length ? checks : ALL_MCP_CHECKS;
|
|
44992
45010
|
const result = await runAudit(root, activeChecks, {
|
|
44993
45011
|
mcp: true,
|
|
44994
45012
|
mcpOnly: true,
|
|
@@ -45023,9 +45041,9 @@ var init_server3 = __esm({
|
|
|
45023
45041
|
openWorldHint: true
|
|
45024
45042
|
},
|
|
45025
45043
|
async ({ projectPath, checks }) => {
|
|
45026
|
-
const root = path9.resolve(projectPath || process.cwd());
|
|
45027
|
-
const activeChecks = checks?.length ? checks : ALL_SESSION_CHECKS;
|
|
45028
45044
|
try {
|
|
45045
|
+
const root = validateProjectPath(projectPath);
|
|
45046
|
+
const activeChecks = checks?.length ? checks : ALL_SESSION_CHECKS;
|
|
45029
45047
|
const result = await runAudit(root, activeChecks, {
|
|
45030
45048
|
session: true,
|
|
45031
45049
|
sessionOnly: true
|
|
@@ -45342,9 +45360,9 @@ var require_help = __commonJS({
|
|
|
45342
45360
|
* @returns {string}
|
|
45343
45361
|
*/
|
|
45344
45362
|
subcommandTerm(cmd) {
|
|
45345
|
-
const
|
|
45363
|
+
const args2 = cmd.registeredArguments.map((arg) => humanReadableArgName(arg)).join(" ");
|
|
45346
45364
|
return cmd._name + (cmd._aliases[0] ? "|" + cmd._aliases[0] : "") + (cmd.options.length ? " [options]" : "") + // simplistic check for non-help option
|
|
45347
|
-
(
|
|
45365
|
+
(args2 ? " " + args2 : "");
|
|
45348
45366
|
}
|
|
45349
45367
|
/**
|
|
45350
45368
|
* Get the option term to show in the list of options.
|
|
@@ -46346,7 +46364,7 @@ var require_command = __commonJS({
|
|
|
46346
46364
|
desc = null;
|
|
46347
46365
|
}
|
|
46348
46366
|
opts = opts || {};
|
|
46349
|
-
const [, name,
|
|
46367
|
+
const [, name, args2] = nameAndArgs.match(/([^ ]+) *(.*)/);
|
|
46350
46368
|
const cmd = this.createCommand(name);
|
|
46351
46369
|
if (desc) {
|
|
46352
46370
|
cmd.description(desc);
|
|
@@ -46355,7 +46373,7 @@ var require_command = __commonJS({
|
|
|
46355
46373
|
if (opts.isDefault) this._defaultCommandName = cmd._name;
|
|
46356
46374
|
cmd._hidden = !!(opts.noHelp || opts.hidden);
|
|
46357
46375
|
cmd._executableFile = opts.executableFile || null;
|
|
46358
|
-
if (
|
|
46376
|
+
if (args2) cmd.arguments(args2);
|
|
46359
46377
|
this._registerCommand(cmd);
|
|
46360
46378
|
cmd.parent = this;
|
|
46361
46379
|
cmd.copyInheritedSettings(this);
|
|
@@ -46680,9 +46698,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
46680
46698
|
* @return {Command} `this` command for chaining
|
|
46681
46699
|
*/
|
|
46682
46700
|
action(fn) {
|
|
46683
|
-
const listener = (
|
|
46701
|
+
const listener = (args2) => {
|
|
46684
46702
|
const expectedArgsCount = this.registeredArguments.length;
|
|
46685
|
-
const actionArgs =
|
|
46703
|
+
const actionArgs = args2.slice(0, expectedArgsCount);
|
|
46686
46704
|
if (this._storeOptionsAsProperties) {
|
|
46687
46705
|
actionArgs[expectedArgsCount] = this;
|
|
46688
46706
|
} else {
|
|
@@ -47222,8 +47240,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
47222
47240
|
*
|
|
47223
47241
|
* @private
|
|
47224
47242
|
*/
|
|
47225
|
-
_executeSubCommand(subcommand,
|
|
47226
|
-
|
|
47243
|
+
_executeSubCommand(subcommand, args2) {
|
|
47244
|
+
args2 = args2.slice();
|
|
47227
47245
|
let launchWithNode = false;
|
|
47228
47246
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
47229
47247
|
function findFile(baseDir, baseName) {
|
|
@@ -47272,11 +47290,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
47272
47290
|
let proc;
|
|
47273
47291
|
if (process11.platform !== "win32") {
|
|
47274
47292
|
if (launchWithNode) {
|
|
47275
|
-
|
|
47276
|
-
|
|
47277
|
-
proc = childProcess.spawn(process11.argv[0],
|
|
47293
|
+
args2.unshift(executableFile);
|
|
47294
|
+
args2 = incrementNodeInspectorPort(process11.execArgv).concat(args2);
|
|
47295
|
+
proc = childProcess.spawn(process11.argv[0], args2, { stdio: "inherit" });
|
|
47278
47296
|
} else {
|
|
47279
|
-
proc = childProcess.spawn(executableFile,
|
|
47297
|
+
proc = childProcess.spawn(executableFile, args2, { stdio: "inherit" });
|
|
47280
47298
|
}
|
|
47281
47299
|
} else {
|
|
47282
47300
|
this._checkForMissingExecutable(
|
|
@@ -47284,9 +47302,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
47284
47302
|
executableDir,
|
|
47285
47303
|
subcommand._name
|
|
47286
47304
|
);
|
|
47287
|
-
|
|
47288
|
-
|
|
47289
|
-
proc = childProcess.spawn(process11.execPath,
|
|
47305
|
+
args2.unshift(executableFile);
|
|
47306
|
+
args2 = incrementNodeInspectorPort(process11.execArgv).concat(args2);
|
|
47307
|
+
proc = childProcess.spawn(process11.execPath, args2, { stdio: "inherit" });
|
|
47290
47308
|
}
|
|
47291
47309
|
if (!proc.killed) {
|
|
47292
47310
|
const signals2 = ["SIGUSR1", "SIGUSR2", "SIGTERM", "SIGINT", "SIGHUP"];
|
|
@@ -47669,7 +47687,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
47669
47687
|
* @param {string[]} args
|
|
47670
47688
|
* @return {{operands: string[], unknown: string[]}}
|
|
47671
47689
|
*/
|
|
47672
|
-
parseOptions(
|
|
47690
|
+
parseOptions(args2) {
|
|
47673
47691
|
const operands = [];
|
|
47674
47692
|
const unknown2 = [];
|
|
47675
47693
|
let dest = operands;
|
|
@@ -47685,12 +47703,12 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
47685
47703
|
let activeVariadicOption = null;
|
|
47686
47704
|
let activeGroup = null;
|
|
47687
47705
|
let i2 = 0;
|
|
47688
|
-
while (i2 <
|
|
47689
|
-
const arg = activeGroup ??
|
|
47706
|
+
while (i2 < args2.length || activeGroup) {
|
|
47707
|
+
const arg = activeGroup ?? args2[i2++];
|
|
47690
47708
|
activeGroup = null;
|
|
47691
47709
|
if (arg === "--") {
|
|
47692
47710
|
if (dest === unknown2) dest.push(arg);
|
|
47693
|
-
dest.push(...
|
|
47711
|
+
dest.push(...args2.slice(i2));
|
|
47694
47712
|
break;
|
|
47695
47713
|
}
|
|
47696
47714
|
if (activeVariadicOption && (!maybeOption(arg) || negativeNumberArg(arg))) {
|
|
@@ -47702,13 +47720,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
47702
47720
|
const option = this._findOption(arg);
|
|
47703
47721
|
if (option) {
|
|
47704
47722
|
if (option.required) {
|
|
47705
|
-
const value =
|
|
47723
|
+
const value = args2[i2++];
|
|
47706
47724
|
if (value === void 0) this.optionMissingArgument(option);
|
|
47707
47725
|
this.emit(`option:${option.name()}`, value);
|
|
47708
47726
|
} else if (option.optional) {
|
|
47709
47727
|
let value = null;
|
|
47710
|
-
if (i2 <
|
|
47711
|
-
value =
|
|
47728
|
+
if (i2 < args2.length && (!maybeOption(args2[i2]) || negativeNumberArg(args2[i2]))) {
|
|
47729
|
+
value = args2[i2++];
|
|
47712
47730
|
}
|
|
47713
47731
|
this.emit(`option:${option.name()}`, value);
|
|
47714
47732
|
} else {
|
|
@@ -47744,18 +47762,18 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
47744
47762
|
if ((this._enablePositionalOptions || this._passThroughOptions) && operands.length === 0 && unknown2.length === 0) {
|
|
47745
47763
|
if (this._findCommand(arg)) {
|
|
47746
47764
|
operands.push(arg);
|
|
47747
|
-
unknown2.push(...
|
|
47765
|
+
unknown2.push(...args2.slice(i2));
|
|
47748
47766
|
break;
|
|
47749
47767
|
} else if (this._getHelpCommand() && arg === this._getHelpCommand().name()) {
|
|
47750
|
-
operands.push(arg, ...
|
|
47768
|
+
operands.push(arg, ...args2.slice(i2));
|
|
47751
47769
|
break;
|
|
47752
47770
|
} else if (this._defaultCommandName) {
|
|
47753
|
-
unknown2.push(arg, ...
|
|
47771
|
+
unknown2.push(arg, ...args2.slice(i2));
|
|
47754
47772
|
break;
|
|
47755
47773
|
}
|
|
47756
47774
|
}
|
|
47757
47775
|
if (this._passThroughOptions) {
|
|
47758
|
-
dest.push(arg, ...
|
|
47776
|
+
dest.push(arg, ...args2.slice(i2));
|
|
47759
47777
|
break;
|
|
47760
47778
|
}
|
|
47761
47779
|
dest.push(arg);
|
|
@@ -48084,13 +48102,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
48084
48102
|
usage(str) {
|
|
48085
48103
|
if (str === void 0) {
|
|
48086
48104
|
if (this._usage) return this._usage;
|
|
48087
|
-
const
|
|
48105
|
+
const args2 = this.registeredArguments.map((arg) => {
|
|
48088
48106
|
return humanReadableArgName(arg);
|
|
48089
48107
|
});
|
|
48090
48108
|
return [].concat(
|
|
48091
48109
|
this.options.length || this._helpOption !== null ? "[options]" : [],
|
|
48092
48110
|
this.commands.length ? "[command]" : [],
|
|
48093
|
-
this.registeredArguments.length ?
|
|
48111
|
+
this.registeredArguments.length ? args2 : []
|
|
48094
48112
|
).join(" ");
|
|
48095
48113
|
}
|
|
48096
48114
|
this._usage = str;
|
|
@@ -48405,17 +48423,17 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
48405
48423
|
* @param {Array} args - array of options to search for help flags
|
|
48406
48424
|
* @private
|
|
48407
48425
|
*/
|
|
48408
|
-
_outputHelpIfRequested(
|
|
48426
|
+
_outputHelpIfRequested(args2) {
|
|
48409
48427
|
const helpOption = this._getHelpOption();
|
|
48410
|
-
const helpRequested = helpOption &&
|
|
48428
|
+
const helpRequested = helpOption && args2.find((arg) => helpOption.is(arg));
|
|
48411
48429
|
if (helpRequested) {
|
|
48412
48430
|
this.outputHelp();
|
|
48413
48431
|
this._exit(0, "commander.helpDisplayed", "(outputHelp)");
|
|
48414
48432
|
}
|
|
48415
48433
|
}
|
|
48416
48434
|
};
|
|
48417
|
-
function incrementNodeInspectorPort(
|
|
48418
|
-
return
|
|
48435
|
+
function incrementNodeInspectorPort(args2) {
|
|
48436
|
+
return args2.map((arg) => {
|
|
48419
48437
|
if (!arg.startsWith("--inspect")) {
|
|
48420
48438
|
return arg;
|
|
48421
48439
|
}
|
|
@@ -48805,17 +48823,17 @@ var init_mjs = __esm({
|
|
|
48805
48823
|
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
48806
48824
|
return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
|
|
48807
48825
|
}
|
|
48808
|
-
#processEmit(ev, ...
|
|
48826
|
+
#processEmit(ev, ...args2) {
|
|
48809
48827
|
const og = this.#originalProcessEmit;
|
|
48810
48828
|
if (ev === "exit" && processOk(this.#process)) {
|
|
48811
|
-
if (typeof
|
|
48812
|
-
this.#process.exitCode =
|
|
48829
|
+
if (typeof args2[0] === "number") {
|
|
48830
|
+
this.#process.exitCode = args2[0];
|
|
48813
48831
|
}
|
|
48814
|
-
const ret = og.call(this.#process, ev, ...
|
|
48832
|
+
const ret = og.call(this.#process, ev, ...args2);
|
|
48815
48833
|
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
48816
48834
|
return ret;
|
|
48817
48835
|
} else {
|
|
48818
|
-
return og.call(this.#process, ev, ...
|
|
48836
|
+
return og.call(this.#process, ev, ...args2);
|
|
48819
48837
|
}
|
|
48820
48838
|
}
|
|
48821
48839
|
};
|
|
@@ -52001,7 +52019,7 @@ async function runCli() {
|
|
|
52001
52019
|
"Lint your AI agent context files and MCP server configs against your actual codebase"
|
|
52002
52020
|
).version(VERSION).argument("[path]", "Project directory to scan", ".").option("--strict", "Exit code 1 on any warning or error (for CI)", false).option("--checks <checks>", "Comma-separated list of checks to run", "").addOption(
|
|
52003
52021
|
new Option("--format <format>", "Output format: text, json, or sarif").choices(["text", "json", "sarif"]).default("text")
|
|
52004
|
-
).option("--tokens", "Show token breakdown per file", false).option("--verbose", "Show passing checks too", false).option("--fix", "Auto-fix broken paths using git history and fuzzy matching", false).option("--fix-dry-run", "Preview --fix changes without writing", false).option("--yes", "Skip interactive confirmation prompts (required for --fix in TTY)", false).option("--follow-symlinks", "Allow --fix to write through symlinks (default: skip)", false).option("--ignore <checks>", "Comma-separated list of checks to ignore", "").option("--quiet", "Suppress all output except errors (exit code only)", false).option("--config <path>", "Path to config file (default: .ctxlintrc in project root)").option("--depth <n>", "Max subdirectory depth to scan (default: 2)", "2").option("--mcp", "Enable MCP config linting alongside context file checks", false).option("--mcp-only", "Run only MCP config checks, skip context file checks", false).option("--mcp-global", "Also scan user/global MCP config files (implies --mcp)", false).option("--mcp-server", "Start the MCP server (
|
|
52022
|
+
).option("--tokens", "Show token breakdown per file", false).option("--verbose", "Show passing checks too", false).option("--fix", "Auto-fix broken paths using git history and fuzzy matching", false).option("--fix-dry-run", "Preview --fix changes without writing", false).option("--yes", "Skip interactive confirmation prompts (required for --fix in TTY)", false).option("--follow-symlinks", "Allow --fix to write through symlinks (default: skip)", false).option("--ignore <checks>", "Comma-separated list of checks to ignore", "").option("--quiet", "Suppress all output except errors (exit code only)", false).option("--config <path>", "Path to config file (default: .ctxlintrc in project root)").option("--depth <n>", "Max subdirectory depth to scan (default: 2)", "2").option("--mcp", "Enable MCP config linting alongside context file checks", false).option("--mcp-only", "Run only MCP config checks, skip context file checks", false).option("--mcp-global", "Also scan user/global MCP config files (implies --mcp)", false).option("--mcp-server", "Start the MCP server (alias: `ctxlint serve`)").option("--session", "Run session audit checks (cross-project consistency)", false).option("--session-only", "Run only session checks, skip context and MCP checks", false).option("--watch", "Re-lint on context file changes", false).action(async (projectPath, opts) => {
|
|
52005
52023
|
const resolvedPath = path11.resolve(projectPath);
|
|
52006
52024
|
const configPath = opts.config ? path11.resolve(opts.config) : void 0;
|
|
52007
52025
|
const config2 = configPath ? loadConfigFromPath(configPath) : loadConfig(resolvedPath);
|
|
@@ -52341,7 +52359,8 @@ var init_cli = __esm({
|
|
|
52341
52359
|
});
|
|
52342
52360
|
|
|
52343
52361
|
// src/index.ts
|
|
52344
|
-
|
|
52362
|
+
var args = process.argv.slice(2);
|
|
52363
|
+
if (args[0] === "serve" || args.includes("--mcp-server")) {
|
|
52345
52364
|
await init_server3().then(() => server_exports);
|
|
52346
52365
|
} else {
|
|
52347
52366
|
const { runCli: runCli2 } = await Promise.resolve().then(() => (init_cli(), cli_exports));
|