@yawlabs/ctxlint 0.9.16 → 0.9.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -41,6 +41,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
41
41
  isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
42
42
  mod
43
43
  ));
44
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
44
45
 
45
46
  // node_modules/.pnpm/zod@4.3.6/node_modules/zod/v3/helpers/util.js
46
47
  var util, objectUtil, ZodParsedType, getParsedType;
@@ -447,8 +448,8 @@ var init_parseUtil = __esm({
447
448
  init_errors();
448
449
  init_en();
449
450
  makeIssue = (params) => {
450
- const { data, path: path12, errorMaps, issueData } = params;
451
- const fullPath = [...path12, ...issueData.path || []];
451
+ const { data, path: path13, errorMaps, issueData } = params;
452
+ const fullPath = [...path13, ...issueData.path || []];
452
453
  const fullIssue = {
453
454
  ...issueData,
454
455
  path: fullPath
@@ -728,11 +729,11 @@ var init_types = __esm({
728
729
  init_parseUtil();
729
730
  init_util();
730
731
  ParseInputLazyPath = class {
731
- constructor(parent, value, path12, key) {
732
+ constructor(parent, value, path13, key) {
732
733
  this._cachedPath = [];
733
734
  this.parent = parent;
734
735
  this.data = value;
735
- this._path = path12;
736
+ this._path = path13;
736
737
  this._key = key;
737
738
  }
738
739
  get path() {
@@ -4237,10 +4238,10 @@ function mergeDefs(...defs) {
4237
4238
  function cloneDef(schema) {
4238
4239
  return mergeDefs(schema._zod.def);
4239
4240
  }
4240
- function getElementAtPath(obj, path12) {
4241
- if (!path12)
4241
+ function getElementAtPath(obj, path13) {
4242
+ if (!path13)
4242
4243
  return obj;
4243
- return path12.reduce((acc, key) => acc?.[key], obj);
4244
+ return path13.reduce((acc, key) => acc?.[key], obj);
4244
4245
  }
4245
4246
  function promiseAllObject(promisesObj) {
4246
4247
  const keys = Object.keys(promisesObj);
@@ -4552,11 +4553,11 @@ function aborted(x3, startIndex = 0) {
4552
4553
  }
4553
4554
  return false;
4554
4555
  }
4555
- function prefixIssues(path12, issues) {
4556
+ function prefixIssues(path13, issues) {
4556
4557
  return issues.map((iss) => {
4557
4558
  var _a3;
4558
4559
  (_a3 = iss).path ?? (_a3.path = []);
4559
- iss.path.unshift(path12);
4560
+ iss.path.unshift(path13);
4560
4561
  return iss;
4561
4562
  });
4562
4563
  }
@@ -4798,7 +4799,7 @@ function formatError(error49, mapper = (issue2) => issue2.message) {
4798
4799
  }
4799
4800
  function treeifyError(error49, mapper = (issue2) => issue2.message) {
4800
4801
  const result = { errors: [] };
4801
- const processError = (error50, path12 = []) => {
4802
+ const processError = (error50, path13 = []) => {
4802
4803
  var _a3, _b;
4803
4804
  for (const issue2 of error50.issues) {
4804
4805
  if (issue2.code === "invalid_union" && issue2.errors.length) {
@@ -4808,7 +4809,7 @@ function treeifyError(error49, mapper = (issue2) => issue2.message) {
4808
4809
  } else if (issue2.code === "invalid_element") {
4809
4810
  processError({ issues: issue2.issues }, issue2.path);
4810
4811
  } else {
4811
- const fullpath = [...path12, ...issue2.path];
4812
+ const fullpath = [...path13, ...issue2.path];
4812
4813
  if (fullpath.length === 0) {
4813
4814
  result.errors.push(mapper(issue2));
4814
4815
  continue;
@@ -4840,8 +4841,8 @@ function treeifyError(error49, mapper = (issue2) => issue2.message) {
4840
4841
  }
4841
4842
  function toDotPath(_path) {
4842
4843
  const segs = [];
4843
- const path12 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
4844
- for (const seg of path12) {
4844
+ const path13 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
4845
+ for (const seg of path13) {
4845
4846
  if (typeof seg === "number")
4846
4847
  segs.push(`[${seg}]`);
4847
4848
  else if (typeof seg === "symbol")
@@ -14735,13 +14736,13 @@ function _stringbool(Classes, _params) {
14735
14736
  return codec2;
14736
14737
  }
14737
14738
  // @__NO_SIDE_EFFECTS__
14738
- function _stringFormat(Class2, format2, fnOrRegex, _params = {}) {
14739
+ function _stringFormat(Class2, format3, fnOrRegex, _params = {}) {
14739
14740
  const params = normalizeParams(_params);
14740
14741
  const def = {
14741
14742
  ...normalizeParams(_params),
14742
14743
  check: "string_format",
14743
14744
  type: "string",
14744
- format: format2,
14745
+ format: format3,
14745
14746
  fn: typeof fnOrRegex === "function" ? fnOrRegex : (val) => fnOrRegex.test(val),
14746
14747
  ...params
14747
14748
  };
@@ -15177,16 +15178,16 @@ var init_json_schema_processors = __esm({
15177
15178
  stringProcessor = (schema, ctx, _json, _params) => {
15178
15179
  const json2 = _json;
15179
15180
  json2.type = "string";
15180
- const { minimum, maximum, format: format2, patterns, contentEncoding } = schema._zod.bag;
15181
+ const { minimum, maximum, format: format3, patterns, contentEncoding } = schema._zod.bag;
15181
15182
  if (typeof minimum === "number")
15182
15183
  json2.minLength = minimum;
15183
15184
  if (typeof maximum === "number")
15184
15185
  json2.maxLength = maximum;
15185
- if (format2) {
15186
- json2.format = formatMap[format2] ?? format2;
15186
+ if (format3) {
15187
+ json2.format = formatMap[format3] ?? format3;
15187
15188
  if (json2.format === "")
15188
15189
  delete json2.format;
15189
- if (format2 === "time") {
15190
+ if (format3 === "time") {
15190
15191
  delete json2.format;
15191
15192
  }
15192
15193
  }
@@ -15208,8 +15209,8 @@ var init_json_schema_processors = __esm({
15208
15209
  };
15209
15210
  numberProcessor = (schema, ctx, _json, _params) => {
15210
15211
  const json2 = _json;
15211
- const { minimum, maximum, format: format2, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
15212
- if (typeof format2 === "string" && format2.includes("int"))
15212
+ const { minimum, maximum, format: format3, multipleOf, exclusiveMaximum, exclusiveMinimum } = schema._zod.bag;
15213
+ if (typeof format3 === "string" && format3.includes("int"))
15213
15214
  json2.type = "integer";
15214
15215
  else
15215
15216
  json2.type = "number";
@@ -16730,8 +16731,8 @@ function e1642(params) {
16730
16731
  function jwt(params) {
16731
16732
  return _jwt(ZodJWT, params);
16732
16733
  }
16733
- function stringFormat(format2, fnOrRegex, _params = {}) {
16734
- return _stringFormat(ZodCustomStringFormat, format2, fnOrRegex, _params);
16734
+ function stringFormat(format3, fnOrRegex, _params = {}) {
16735
+ return _stringFormat(ZodCustomStringFormat, format3, fnOrRegex, _params);
16735
16736
  }
16736
16737
  function hostname2(_params) {
16737
16738
  return _stringFormat(ZodCustomStringFormat, "hostname", regexes_exports.hostname, _params);
@@ -16741,11 +16742,11 @@ function hex2(_params) {
16741
16742
  }
16742
16743
  function hash(alg, params) {
16743
16744
  const enc = params?.enc ?? "hex";
16744
- const format2 = `${alg}_${enc}`;
16745
- const regex2 = regexes_exports[format2];
16745
+ const format3 = `${alg}_${enc}`;
16746
+ const regex2 = regexes_exports[format3];
16746
16747
  if (!regex2)
16747
- throw new Error(`Unrecognized hash format: ${format2}`);
16748
- return _stringFormat(ZodCustomStringFormat, format2, regex2, params);
16748
+ throw new Error(`Unrecognized hash format: ${format3}`);
16749
+ return _stringFormat(ZodCustomStringFormat, format3, regex2, params);
16749
16750
  }
16750
16751
  function number2(params) {
16751
16752
  return _number(ZodNumber2, params);
@@ -17791,13 +17792,13 @@ function resolveRef(ref, ctx) {
17791
17792
  if (!ref.startsWith("#")) {
17792
17793
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
17793
17794
  }
17794
- const path12 = ref.slice(1).split("/").filter(Boolean);
17795
- if (path12.length === 0) {
17795
+ const path13 = ref.slice(1).split("/").filter(Boolean);
17796
+ if (path13.length === 0) {
17796
17797
  return ctx.rootSchema;
17797
17798
  }
17798
17799
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
17799
- if (path12[0] === defsKey) {
17800
- const key = path12[1];
17800
+ if (path13[0] === defsKey) {
17801
+ const key = path13[1];
17801
17802
  if (!key || !ctx.defs[key]) {
17802
17803
  throw new Error(`Reference not found: ${ref}`);
17803
17804
  }
@@ -17889,52 +17890,52 @@ function convertBaseSchema(schema, ctx) {
17889
17890
  case "string": {
17890
17891
  let stringSchema = z.string();
17891
17892
  if (schema.format) {
17892
- const format2 = schema.format;
17893
- if (format2 === "email") {
17893
+ const format3 = schema.format;
17894
+ if (format3 === "email") {
17894
17895
  stringSchema = stringSchema.check(z.email());
17895
- } else if (format2 === "uri" || format2 === "uri-reference") {
17896
+ } else if (format3 === "uri" || format3 === "uri-reference") {
17896
17897
  stringSchema = stringSchema.check(z.url());
17897
- } else if (format2 === "uuid" || format2 === "guid") {
17898
+ } else if (format3 === "uuid" || format3 === "guid") {
17898
17899
  stringSchema = stringSchema.check(z.uuid());
17899
- } else if (format2 === "date-time") {
17900
+ } else if (format3 === "date-time") {
17900
17901
  stringSchema = stringSchema.check(z.iso.datetime());
17901
- } else if (format2 === "date") {
17902
+ } else if (format3 === "date") {
17902
17903
  stringSchema = stringSchema.check(z.iso.date());
17903
- } else if (format2 === "time") {
17904
+ } else if (format3 === "time") {
17904
17905
  stringSchema = stringSchema.check(z.iso.time());
17905
- } else if (format2 === "duration") {
17906
+ } else if (format3 === "duration") {
17906
17907
  stringSchema = stringSchema.check(z.iso.duration());
17907
- } else if (format2 === "ipv4") {
17908
+ } else if (format3 === "ipv4") {
17908
17909
  stringSchema = stringSchema.check(z.ipv4());
17909
- } else if (format2 === "ipv6") {
17910
+ } else if (format3 === "ipv6") {
17910
17911
  stringSchema = stringSchema.check(z.ipv6());
17911
- } else if (format2 === "mac") {
17912
+ } else if (format3 === "mac") {
17912
17913
  stringSchema = stringSchema.check(z.mac());
17913
- } else if (format2 === "cidr") {
17914
+ } else if (format3 === "cidr") {
17914
17915
  stringSchema = stringSchema.check(z.cidrv4());
17915
- } else if (format2 === "cidr-v6") {
17916
+ } else if (format3 === "cidr-v6") {
17916
17917
  stringSchema = stringSchema.check(z.cidrv6());
17917
- } else if (format2 === "base64") {
17918
+ } else if (format3 === "base64") {
17918
17919
  stringSchema = stringSchema.check(z.base64());
17919
- } else if (format2 === "base64url") {
17920
+ } else if (format3 === "base64url") {
17920
17921
  stringSchema = stringSchema.check(z.base64url());
17921
- } else if (format2 === "e164") {
17922
+ } else if (format3 === "e164") {
17922
17923
  stringSchema = stringSchema.check(z.e164());
17923
- } else if (format2 === "jwt") {
17924
+ } else if (format3 === "jwt") {
17924
17925
  stringSchema = stringSchema.check(z.jwt());
17925
- } else if (format2 === "emoji") {
17926
+ } else if (format3 === "emoji") {
17926
17927
  stringSchema = stringSchema.check(z.emoji());
17927
- } else if (format2 === "nanoid") {
17928
+ } else if (format3 === "nanoid") {
17928
17929
  stringSchema = stringSchema.check(z.nanoid());
17929
- } else if (format2 === "cuid") {
17930
+ } else if (format3 === "cuid") {
17930
17931
  stringSchema = stringSchema.check(z.cuid());
17931
- } else if (format2 === "cuid2") {
17932
+ } else if (format3 === "cuid2") {
17932
17933
  stringSchema = stringSchema.check(z.cuid2());
17933
- } else if (format2 === "ulid") {
17934
+ } else if (format3 === "ulid") {
17934
17935
  stringSchema = stringSchema.check(z.ulid());
17935
- } else if (format2 === "xid") {
17936
+ } else if (format3 === "xid") {
17936
17937
  stringSchema = stringSchema.check(z.xid());
17937
- } else if (format2 === "ksuid") {
17938
+ } else if (format3 === "ksuid") {
17938
17939
  stringSchema = stringSchema.check(z.ksuid());
17939
17940
  }
17940
17941
  }
@@ -25887,8 +25888,8 @@ var require_utils = __commonJS({
25887
25888
  }
25888
25889
  return ind;
25889
25890
  }
25890
- function removeDotSegments(path12) {
25891
- let input = path12;
25891
+ function removeDotSegments(path13) {
25892
+ let input = path13;
25892
25893
  const output = [];
25893
25894
  let nextSlash = -1;
25894
25895
  let len = 0;
@@ -26087,8 +26088,8 @@ var require_schemes = __commonJS({
26087
26088
  wsComponent.secure = void 0;
26088
26089
  }
26089
26090
  if (wsComponent.resourceName) {
26090
- const [path12, query] = wsComponent.resourceName.split("?");
26091
- wsComponent.path = path12 && path12 !== "/" ? path12 : void 0;
26091
+ const [path13, query] = wsComponent.resourceName.split("?");
26092
+ wsComponent.path = path13 && path13 !== "/" ? path13 : void 0;
26092
26093
  wsComponent.query = query;
26093
26094
  wsComponent.resourceName = void 0;
26094
26095
  }
@@ -26240,24 +26241,24 @@ var require_fast_uri = __commonJS({
26240
26241
  function normalize3(uri, options) {
26241
26242
  if (typeof uri === "string") {
26242
26243
  uri = /** @type {T} */
26243
- serialize(parse3(uri, options), options);
26244
+ serialize(parse4(uri, options), options);
26244
26245
  } else if (typeof uri === "object") {
26245
26246
  uri = /** @type {T} */
26246
- parse3(serialize(uri, options), options);
26247
+ parse4(serialize(uri, options), options);
26247
26248
  }
26248
26249
  return uri;
26249
26250
  }
26250
26251
  function resolve11(baseURI, relativeURI, options) {
26251
26252
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
26252
- const resolved = resolveComponent(parse3(baseURI, schemelessOptions), parse3(relativeURI, schemelessOptions), schemelessOptions, true);
26253
+ const resolved = resolveComponent(parse4(baseURI, schemelessOptions), parse4(relativeURI, schemelessOptions), schemelessOptions, true);
26253
26254
  schemelessOptions.skipEscape = true;
26254
26255
  return serialize(resolved, schemelessOptions);
26255
26256
  }
26256
26257
  function resolveComponent(base, relative4, options, skipNormalization) {
26257
26258
  const target = {};
26258
26259
  if (!skipNormalization) {
26259
- base = parse3(serialize(base, options), options);
26260
- relative4 = parse3(serialize(relative4, options), options);
26260
+ base = parse4(serialize(base, options), options);
26261
+ relative4 = parse4(serialize(relative4, options), options);
26261
26262
  }
26262
26263
  options = options || {};
26263
26264
  if (!options.tolerant && relative4.scheme) {
@@ -26309,13 +26310,13 @@ var require_fast_uri = __commonJS({
26309
26310
  function equal(uriA, uriB, options) {
26310
26311
  if (typeof uriA === "string") {
26311
26312
  uriA = unescape(uriA);
26312
- uriA = serialize(normalizeComponentEncoding(parse3(uriA, options), true), { ...options, skipEscape: true });
26313
+ uriA = serialize(normalizeComponentEncoding(parse4(uriA, options), true), { ...options, skipEscape: true });
26313
26314
  } else if (typeof uriA === "object") {
26314
26315
  uriA = serialize(normalizeComponentEncoding(uriA, true), { ...options, skipEscape: true });
26315
26316
  }
26316
26317
  if (typeof uriB === "string") {
26317
26318
  uriB = unescape(uriB);
26318
- uriB = serialize(normalizeComponentEncoding(parse3(uriB, options), true), { ...options, skipEscape: true });
26319
+ uriB = serialize(normalizeComponentEncoding(parse4(uriB, options), true), { ...options, skipEscape: true });
26319
26320
  } else if (typeof uriB === "object") {
26320
26321
  uriB = serialize(normalizeComponentEncoding(uriB, true), { ...options, skipEscape: true });
26321
26322
  }
@@ -26384,7 +26385,7 @@ var require_fast_uri = __commonJS({
26384
26385
  return uriTokens.join("");
26385
26386
  }
26386
26387
  var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
26387
- function parse3(uri, opts) {
26388
+ function parse4(uri, opts) {
26388
26389
  const options = Object.assign({}, opts);
26389
26390
  const parsed = {
26390
26391
  scheme: void 0,
@@ -26478,7 +26479,7 @@ var require_fast_uri = __commonJS({
26478
26479
  resolveComponent,
26479
26480
  equal,
26480
26481
  serialize,
26481
- parse: parse3
26482
+ parse: parse4
26482
26483
  };
26483
26484
  module.exports = fastUri;
26484
26485
  module.exports.default = fastUri;
@@ -26880,10 +26881,10 @@ var require_core = __commonJS({
26880
26881
  return this;
26881
26882
  }
26882
26883
  // Add format
26883
- addFormat(name, format2) {
26884
- if (typeof format2 == "string")
26885
- format2 = new RegExp(format2);
26886
- this.formats[name] = format2;
26884
+ addFormat(name, format3) {
26885
+ if (typeof format3 == "string")
26886
+ format3 = new RegExp(format3);
26887
+ this.formats[name] = format3;
26887
26888
  return this;
26888
26889
  }
26889
26890
  errorsText(errors = this.errors, { separator = ", ", dataVar = "data" } = {}) {
@@ -27001,9 +27002,9 @@ var require_core = __commonJS({
27001
27002
  }
27002
27003
  function addInitialFormats() {
27003
27004
  for (const name in this.opts.formats) {
27004
- const format2 = this.opts.formats[name];
27005
- if (format2)
27006
- this.addFormat(name, format2);
27005
+ const format3 = this.opts.formats[name];
27006
+ if (format3)
27007
+ this.addFormat(name, format3);
27007
27008
  }
27008
27009
  }
27009
27010
  function addInitialKeywords(defs) {
@@ -28686,18 +28687,18 @@ var require_format = __commonJS({
28686
28687
  });
28687
28688
  const fDef = gen.const("fDef", (0, codegen_1._)`${fmts}[${schemaCode}]`);
28688
28689
  const fType = gen.let("fType");
28689
- const format2 = gen.let("format");
28690
- gen.if((0, codegen_1._)`typeof ${fDef} == "object" && !(${fDef} instanceof RegExp)`, () => gen.assign(fType, (0, codegen_1._)`${fDef}.type || "string"`).assign(format2, (0, codegen_1._)`${fDef}.validate`), () => gen.assign(fType, (0, codegen_1._)`"string"`).assign(format2, fDef));
28690
+ const format3 = gen.let("format");
28691
+ gen.if((0, codegen_1._)`typeof ${fDef} == "object" && !(${fDef} instanceof RegExp)`, () => gen.assign(fType, (0, codegen_1._)`${fDef}.type || "string"`).assign(format3, (0, codegen_1._)`${fDef}.validate`), () => gen.assign(fType, (0, codegen_1._)`"string"`).assign(format3, fDef));
28691
28692
  cxt.fail$data((0, codegen_1.or)(unknownFmt(), invalidFmt()));
28692
28693
  function unknownFmt() {
28693
28694
  if (opts.strictSchema === false)
28694
28695
  return codegen_1.nil;
28695
- return (0, codegen_1._)`${schemaCode} && !${format2}`;
28696
+ return (0, codegen_1._)`${schemaCode} && !${format3}`;
28696
28697
  }
28697
28698
  function invalidFmt() {
28698
- const callFormat = schemaEnv.$async ? (0, codegen_1._)`(${fDef}.async ? await ${format2}(${data}) : ${format2}(${data}))` : (0, codegen_1._)`${format2}(${data})`;
28699
- const validData = (0, codegen_1._)`(typeof ${format2} == "function" ? ${callFormat} : ${format2}.test(${data}))`;
28700
- return (0, codegen_1._)`${format2} && ${format2} !== true && ${fType} === ${ruleType} && !${validData}`;
28699
+ const callFormat = schemaEnv.$async ? (0, codegen_1._)`(${fDef}.async ? await ${format3}(${data}) : ${format3}(${data}))` : (0, codegen_1._)`${format3}(${data})`;
28700
+ const validData = (0, codegen_1._)`(typeof ${format3} == "function" ? ${callFormat} : ${format3}.test(${data}))`;
28701
+ return (0, codegen_1._)`${format3} && ${format3} !== true && ${fType} === ${ruleType} && !${validData}`;
28701
28702
  }
28702
28703
  }
28703
28704
  function validateFormat() {
@@ -28708,7 +28709,7 @@ var require_format = __commonJS({
28708
28709
  }
28709
28710
  if (formatDef === true)
28710
28711
  return;
28711
- const [fmtType, format2, fmtRef] = getFormat(formatDef);
28712
+ const [fmtType, format3, fmtRef] = getFormat(formatDef);
28712
28713
  if (fmtType === ruleType)
28713
28714
  cxt.pass(validCondition());
28714
28715
  function unknownFormat() {
@@ -28735,7 +28736,7 @@ var require_format = __commonJS({
28735
28736
  throw new Error("async format in sync schema");
28736
28737
  return (0, codegen_1._)`await ${fmtRef}(${data})`;
28737
28738
  }
28738
- return typeof format2 == "function" ? (0, codegen_1._)`${fmtRef}(${data})` : (0, codegen_1._)`${fmtRef}.test(${data})`;
28739
+ return typeof format3 == "function" ? (0, codegen_1._)`${fmtRef}(${data})` : (0, codegen_1._)`${fmtRef}.test(${data})`;
28739
28740
  }
28740
28741
  }
28741
28742
  }
@@ -28750,8 +28751,8 @@ var require_format2 = __commonJS({
28750
28751
  "use strict";
28751
28752
  Object.defineProperty(exports, "__esModule", { value: true });
28752
28753
  var format_1 = require_format();
28753
- var format2 = [format_1.default];
28754
- exports.default = format2;
28754
+ var format3 = [format_1.default];
28755
+ exports.default = format3;
28755
28756
  }
28756
28757
  });
28757
28758
 
@@ -29393,17 +29394,17 @@ var require_limit = __commonJS({
29393
29394
  cxt.fail$data((0, codegen_1.or)((0, codegen_1._)`typeof ${fmt} != "object"`, (0, codegen_1._)`${fmt} instanceof RegExp`, (0, codegen_1._)`typeof ${fmt}.compare != "function"`, compareCode(fmt)));
29394
29395
  }
29395
29396
  function validateFormat() {
29396
- const format2 = fCxt.schema;
29397
- const fmtDef = self2.formats[format2];
29397
+ const format3 = fCxt.schema;
29398
+ const fmtDef = self2.formats[format3];
29398
29399
  if (!fmtDef || fmtDef === true)
29399
29400
  return;
29400
29401
  if (typeof fmtDef != "object" || fmtDef instanceof RegExp || typeof fmtDef.compare != "function") {
29401
- throw new Error(`"${keyword}": format "${format2}" does not define "compare" function`);
29402
+ throw new Error(`"${keyword}": format "${format3}" does not define "compare" function`);
29402
29403
  }
29403
29404
  const fmt = gen.scopeValue("formats", {
29404
- key: format2,
29405
+ key: format3,
29405
29406
  ref: fmtDef,
29406
- code: opts.code.formats ? (0, codegen_1._)`${opts.code.formats}${(0, codegen_1.getProperty)(format2)}` : void 0
29407
+ code: opts.code.formats ? (0, codegen_1._)`${opts.code.formats}${(0, codegen_1.getProperty)(format3)}` : void 0
29407
29408
  });
29408
29409
  cxt.fail$data(compareCode(fmt));
29409
29410
  }
@@ -34372,6 +34373,54 @@ async function scanForMcpConfigs(projectRoot) {
34372
34373
  }
34373
34374
  return found.sort((a, b2) => a.relativePath.localeCompare(b2.relativePath));
34374
34375
  }
34376
+ async function scanForMcphConfigs(projectRoot) {
34377
+ const found = [];
34378
+ const seen = /* @__PURE__ */ new Set();
34379
+ for (const pattern of MCPH_CONFIG_PATTERNS) {
34380
+ const matches = await Ze(pattern, {
34381
+ cwd: projectRoot,
34382
+ absolute: true,
34383
+ nodir: true,
34384
+ dot: true
34385
+ });
34386
+ for (const match of matches) {
34387
+ const normalized = path2.normalize(match);
34388
+ if (seen.has(normalized)) continue;
34389
+ seen.add(normalized);
34390
+ const relativePath = path2.relative(projectRoot, normalized);
34391
+ const symlink = isSymlink(normalized);
34392
+ const target = symlink ? readSymlinkTarget(normalized) : void 0;
34393
+ found.push({
34394
+ absolutePath: normalized,
34395
+ relativePath: relativePath.replace(/\\/g, "/"),
34396
+ isSymlink: symlink,
34397
+ symlinkTarget: target,
34398
+ type: "mcph-config"
34399
+ });
34400
+ }
34401
+ }
34402
+ return found.sort((a, b2) => a.relativePath.localeCompare(b2.relativePath));
34403
+ }
34404
+ async function scanGlobalMcphConfigs() {
34405
+ const found = [];
34406
+ const home2 = process.env.HOME || process.env.USERPROFILE || "";
34407
+ const filePath = path2.normalize(path2.join(home2, ".mcph.json"));
34408
+ try {
34409
+ fs3.accessSync(filePath);
34410
+ } catch {
34411
+ return found;
34412
+ }
34413
+ const symlink = isSymlink(filePath);
34414
+ const target = symlink ? readSymlinkTarget(filePath) : void 0;
34415
+ found.push({
34416
+ absolutePath: filePath,
34417
+ relativePath: "~/.mcph.json",
34418
+ isSymlink: symlink,
34419
+ symlinkTarget: target,
34420
+ type: "mcph-config"
34421
+ });
34422
+ return found;
34423
+ }
34375
34424
  async function scanGlobalMcpConfigs() {
34376
34425
  const found = [];
34377
34426
  const seen = /* @__PURE__ */ new Set();
@@ -34412,7 +34461,7 @@ async function scanGlobalMcpConfigs() {
34412
34461
  }
34413
34462
  return found.sort((a, b2) => a.relativePath.localeCompare(b2.relativePath));
34414
34463
  }
34415
- var CONTEXT_FILE_PATTERNS, IGNORED_DIRS2, MCP_CONFIG_PATTERNS;
34464
+ var CONTEXT_FILE_PATTERNS, IGNORED_DIRS2, MCP_CONFIG_PATTERNS, MCPH_CONFIG_PATTERNS;
34416
34465
  var init_scanner = __esm({
34417
34466
  "src/core/scanner.ts"() {
34418
34467
  "use strict";
@@ -34474,6 +34523,7 @@ var init_scanner = __esm({
34474
34523
  ".amazonq/mcp.json",
34475
34524
  ".continue/mcpServers/*.json"
34476
34525
  ];
34526
+ MCPH_CONFIG_PATTERNS = [".mcph.json", ".mcph.local.json"];
34477
34527
  }
34478
34528
  });
34479
34529
 
@@ -34750,7 +34800,7 @@ var require_ms = __commonJS({
34750
34800
  options = options || {};
34751
34801
  var type = typeof val;
34752
34802
  if (type === "string" && val.length > 0) {
34753
- return parse3(val);
34803
+ return parse4(val);
34754
34804
  } else if (type === "number" && isFinite(val)) {
34755
34805
  return options.long ? fmtLong(val) : fmtShort(val);
34756
34806
  }
@@ -34758,7 +34808,7 @@ var require_ms = __commonJS({
34758
34808
  "val is not a non-empty string or a valid number. val=" + JSON.stringify(val)
34759
34809
  );
34760
34810
  };
34761
- function parse3(str) {
34811
+ function parse4(str) {
34762
34812
  str = String(str);
34763
34813
  if (str.length > 100) {
34764
34814
  return;
@@ -34901,12 +34951,12 @@ var require_common = __commonJS({
34901
34951
  args2.unshift("%O");
34902
34952
  }
34903
34953
  let index = 0;
34904
- args2[0] = args2[0].replace(/%([a-zA-Z%])/g, (match, format2) => {
34954
+ args2[0] = args2[0].replace(/%([a-zA-Z%])/g, (match, format3) => {
34905
34955
  if (match === "%%") {
34906
34956
  return "%";
34907
34957
  }
34908
34958
  index++;
34909
- const formatter = createDebug.formatters[format2];
34959
+ const formatter = createDebug.formatters[format3];
34910
34960
  if (typeof formatter === "function") {
34911
34961
  const val = args2[index];
34912
34962
  match = formatter.call(self2, val);
@@ -35511,10 +35561,10 @@ var require_src2 = __commonJS({
35511
35561
  var fs_1 = __require("fs");
35512
35562
  var debug_1 = __importDefault(require_src());
35513
35563
  var log = debug_1.default("@kwsites/file-exists");
35514
- function check2(path12, isFile, isDirectory2) {
35515
- log(`checking %s`, path12);
35564
+ function check2(path13, isFile, isDirectory2) {
35565
+ log(`checking %s`, path13);
35516
35566
  try {
35517
- const stat3 = fs_1.statSync(path12);
35567
+ const stat3 = fs_1.statSync(path13);
35518
35568
  if (stat3.isFile() && isFile) {
35519
35569
  log(`[OK] path represents a file`);
35520
35570
  return true;
@@ -35534,8 +35584,8 @@ var require_src2 = __commonJS({
35534
35584
  throw e;
35535
35585
  }
35536
35586
  }
35537
- function exists2(path12, type = exports.READABLE) {
35538
- return check2(path12, (type & exports.FILE) > 0, (type & exports.FOLDER) > 0);
35587
+ function exists2(path13, type = exports.READABLE) {
35588
+ return check2(path13, (type & exports.FILE) > 0, (type & exports.FOLDER) > 0);
35539
35589
  }
35540
35590
  exports.exists = exists2;
35541
35591
  exports.FILE = 1;
@@ -36124,8 +36174,8 @@ function toLinesWithContent(input = "", trimmed2 = true, separator = "\n") {
36124
36174
  function forEachLineWithContent(input, callback) {
36125
36175
  return toLinesWithContent(input, true).map((line) => callback(line));
36126
36176
  }
36127
- function folderExists(path12) {
36128
- return (0, import_file_exists.exists)(path12, import_file_exists.FOLDER);
36177
+ function folderExists(path13) {
36178
+ return (0, import_file_exists.exists)(path13, import_file_exists.FOLDER);
36129
36179
  }
36130
36180
  function append(target, item) {
36131
36181
  if (Array.isArray(target)) {
@@ -36290,7 +36340,7 @@ function parseStringResponse(result, parsers12, texts, trim = true) {
36290
36340
  }
36291
36341
  return lines[i2 + offset];
36292
36342
  };
36293
- parsers12.some(({ parse: parse3 }) => parse3(line, result));
36343
+ parsers12.some(({ parse: parse4 }) => parse4(line, result));
36294
36344
  }
36295
36345
  });
36296
36346
  return result;
@@ -36316,8 +36366,8 @@ function checkIsRepoRootTask() {
36316
36366
  commands,
36317
36367
  format: "utf-8",
36318
36368
  onError,
36319
- parser(path12) {
36320
- return /^\.(git)?$/.test(path12.trim());
36369
+ parser(path13) {
36370
+ return /^\.(git)?$/.test(path13.trim());
36321
36371
  }
36322
36372
  };
36323
36373
  }
@@ -36573,11 +36623,11 @@ function parseGrep(grep) {
36573
36623
  const paths = /* @__PURE__ */ new Set();
36574
36624
  const results = {};
36575
36625
  forEachLineWithContent(grep, (input) => {
36576
- const [path12, line, preview] = input.split(NULL);
36577
- paths.add(path12);
36578
- (results[path12] = results[path12] || []).push({
36626
+ const [path13, line, preview] = input.split(NULL);
36627
+ paths.add(path13);
36628
+ (results[path13] = results[path13] || []).push({
36579
36629
  line: asNumber(line),
36580
- path: path12,
36630
+ path: path13,
36581
36631
  preview
36582
36632
  });
36583
36633
  });
@@ -36874,14 +36924,14 @@ function hashObjectTask(filePath, write) {
36874
36924
  }
36875
36925
  return straightThroughStringTask(commands, true);
36876
36926
  }
36877
- function parseInit(bare, path12, text) {
36927
+ function parseInit(bare, path13, text) {
36878
36928
  const response = String(text).trim();
36879
36929
  let result;
36880
36930
  if (result = initResponseRegex.exec(response)) {
36881
- return new InitSummary(bare, path12, false, result[1]);
36931
+ return new InitSummary(bare, path13, false, result[1]);
36882
36932
  }
36883
36933
  if (result = reInitResponseRegex.exec(response)) {
36884
- return new InitSummary(bare, path12, true, result[1]);
36934
+ return new InitSummary(bare, path13, true, result[1]);
36885
36935
  }
36886
36936
  let gitDir = "";
36887
36937
  const tokens = response.split(" ");
@@ -36892,12 +36942,12 @@ function parseInit(bare, path12, text) {
36892
36942
  break;
36893
36943
  }
36894
36944
  }
36895
- return new InitSummary(bare, path12, /^re/i.test(response), gitDir);
36945
+ return new InitSummary(bare, path13, /^re/i.test(response), gitDir);
36896
36946
  }
36897
36947
  function hasBareCommand(command) {
36898
36948
  return command.includes(bareCommand);
36899
36949
  }
36900
- function initTask(bare = false, path12, customArgs) {
36950
+ function initTask(bare = false, path13, customArgs) {
36901
36951
  const commands = ["init", ...customArgs];
36902
36952
  if (bare && !hasBareCommand(commands)) {
36903
36953
  commands.splice(1, 0, bareCommand);
@@ -36906,15 +36956,15 @@ function initTask(bare = false, path12, customArgs) {
36906
36956
  commands,
36907
36957
  format: "utf-8",
36908
36958
  parser(text) {
36909
- return parseInit(commands.includes("--bare"), path12, text);
36959
+ return parseInit(commands.includes("--bare"), path13, text);
36910
36960
  }
36911
36961
  };
36912
36962
  }
36913
36963
  function logFormatFromCommand(customArgs) {
36914
36964
  for (let i2 = 0; i2 < customArgs.length; i2++) {
36915
- const format2 = logFormatRegex.exec(customArgs[i2]);
36916
- if (format2) {
36917
- return `--${format2[1]}`;
36965
+ const format3 = logFormatRegex.exec(customArgs[i2]);
36966
+ if (format3) {
36967
+ return `--${format3[1]}`;
36918
36968
  }
36919
36969
  }
36920
36970
  return "";
@@ -36922,8 +36972,8 @@ function logFormatFromCommand(customArgs) {
36922
36972
  function isLogFormat(customArg) {
36923
36973
  return logFormatRegex.test(customArg);
36924
36974
  }
36925
- function getDiffParser(format2 = "") {
36926
- const parser4 = diffSummaryParsers[format2];
36975
+ function getDiffParser(format3 = "") {
36976
+ const parser4 = diffSummaryParsers[format3];
36927
36977
  return (stdOut) => parseStringResponse(new DiffSummary(), parser4, stdOut, false);
36928
36978
  }
36929
36979
  function lineBuilder(tokens, fields) {
@@ -36984,12 +37034,12 @@ function validateLogFormatConfig(customArgs) {
36984
37034
  );
36985
37035
  }
36986
37036
  }
36987
- function prettyFormat(format2, splitter) {
37037
+ function prettyFormat(format3, splitter) {
36988
37038
  const fields = [];
36989
37039
  const formatStr = [];
36990
- Object.keys(format2).forEach((field) => {
37040
+ Object.keys(format3).forEach((field) => {
36991
37041
  fields.push(field);
36992
- formatStr.push(String(format2[field]));
37042
+ formatStr.push(String(format3[field]));
36993
37043
  });
36994
37044
  return [fields, formatStr.join(splitter)];
36995
37045
  }
@@ -37003,7 +37053,7 @@ function userOptions(input) {
37003
37053
  }
37004
37054
  function parseLogOptions(opt = {}, customArgs = []) {
37005
37055
  const splitter = filterType(opt.splitter, filterString, SPLITTER);
37006
- const format2 = filterPlainObject(opt.format) ? opt.format : {
37056
+ const format3 = filterPlainObject(opt.format) ? opt.format : {
37007
37057
  hash: "%H",
37008
37058
  date: opt.strictDate === false ? "%ai" : "%aI",
37009
37059
  message: "%s",
@@ -37012,7 +37062,7 @@ function parseLogOptions(opt = {}, customArgs = []) {
37012
37062
  author_name: opt.mailMap !== false ? "%aN" : "%an",
37013
37063
  author_email: opt.mailMap !== false ? "%aE" : "%ae"
37014
37064
  };
37015
- const [fields, formatStr] = prettyFormat(format2, splitter);
37065
+ const [fields, formatStr] = prettyFormat(format3, splitter);
37016
37066
  const suffix = [];
37017
37067
  const command = [
37018
37068
  `--pretty=format:${START_BOUNDARY}${formatStr}${COMMIT_BOUNDARY}`,
@@ -37185,14 +37235,14 @@ function splitLine(result, lineStr) {
37185
37235
  default:
37186
37236
  return;
37187
37237
  }
37188
- function data(index, workingDir, path12) {
37238
+ function data(index, workingDir, path13) {
37189
37239
  const raw = `${index}${workingDir}`;
37190
37240
  const handler = parsers6.get(raw);
37191
37241
  if (handler) {
37192
- handler(result, path12);
37242
+ handler(result, path13);
37193
37243
  }
37194
37244
  if (raw !== "##" && raw !== "!!") {
37195
- result.files.push(new FileStatusSummary(path12, index, workingDir));
37245
+ result.files.push(new FileStatusSummary(path13, index, workingDir));
37196
37246
  }
37197
37247
  }
37198
37248
  }
@@ -37379,8 +37429,8 @@ function deleteBranchTask(branch, forceDelete = false) {
37379
37429
  return task;
37380
37430
  }
37381
37431
  function toPath(input) {
37382
- const path12 = input.trim().replace(/^["']|["']$/g, "");
37383
- return path12 && normalize2(path12);
37432
+ const path13 = input.trim().replace(/^["']|["']$/g, "");
37433
+ return path13 && normalize2(path13);
37384
37434
  }
37385
37435
  function checkIgnoreTask(paths) {
37386
37436
  return {
@@ -37519,8 +37569,8 @@ function stashListTask(opt = {}, customArgs) {
37519
37569
  parser: parser4
37520
37570
  };
37521
37571
  }
37522
- function addSubModuleTask(repo, path12) {
37523
- return subModuleTask(["add", repo, path12]);
37572
+ function addSubModuleTask(repo, path13) {
37573
+ return subModuleTask(["add", repo, path13]);
37524
37574
  }
37525
37575
  function initSubModuleTask(customArgs) {
37526
37576
  return subModuleTask(["init", ...customArgs]);
@@ -37891,7 +37941,7 @@ function gitInstanceFactory(baseDir, options) {
37891
37941
  customBinaryPlugin(plugins, config2.binary, config2.unsafe?.allowUnsafeCustomBinary);
37892
37942
  return new Git(config2, plugins);
37893
37943
  }
37894
- var import_file_exists, import_debug, import_promise_deferred, import_promise_deferred2, __defProp2, __getOwnPropDesc2, __getOwnPropNames2, __hasOwnProp2, __esm2, __commonJS2, __export2, __copyProps2, __toCommonJS, GitError, init_git_error, GitResponseError, init_git_response_error, TaskConfigurationError, init_task_configuration_error, NULL, NOOP, objectToString, init_util3, filterArray, filterNumber, filterString, filterStringOrStringArray, filterHasLength, init_argument_filters, ExitCodes, init_exit_codes, GitOutputStreams, init_git_output_streams, LineParser, RemoteLineParser, init_line_parser, defaultOptions2, init_simple_git_options, init_task_options, init_task_parser, utils_exports, init_utils, check_is_repo_exports, CheckRepoActions, onError, parser, init_check_is_repo, CleanResponse, removalRegexp, dryRunRemovalRegexp, isFolderRegexp, init_CleanSummary, task_exports, EMPTY_COMMANDS, init_task, clean_exports, CONFIG_ERROR_INTERACTIVE_MODE, CONFIG_ERROR_MODE_REQUIRED, CONFIG_ERROR_UNKNOWN_OPTION, CleanOptions, CleanOptionValues, init_clean, ConfigList, init_ConfigList, GitConfigScope, init_config, DiffNameStatus, diffNameStatus, init_diff_name_status, disallowedOptions, Query, _a2, GrepQuery, init_grep, reset_exports, ResetMode, validResetModes, init_reset, init_git_logger, TasksPendingQueue, init_tasks_pending_queue, GitExecutorChain, init_git_executor_chain, git_executor_exports, GitExecutor, init_git_executor, init_task_callback, init_change_working_directory, init_checkout, parser2, init_count_objects, parsers, init_parse_commit, init_commit, init_first_commit, init_hash_object, InitSummary, initResponseRegex, reInitResponseRegex, init_InitSummary, bareCommand, init_init, logFormatRegex, init_log_format, DiffSummary, init_DiffSummary, statParser, numStatParser, nameOnlyParser, nameStatusParser, diffSummaryParsers, init_parse_diff_summary, START_BOUNDARY, COMMIT_BOUNDARY, SPLITTER, defaultFieldNames, init_parse_list_log_summary, diff_exports, init_diff, excludeOptions, init_log, MergeSummaryConflict, MergeSummaryDetail, init_MergeSummary, PullSummary, PullFailedSummary, init_PullSummary, remoteMessagesObjectParsers, init_parse_remote_objects, parsers2, RemoteMessageSummary, init_parse_remote_messages, FILE_UPDATE_REGEX, SUMMARY_REGEX, ACTION_REGEX, parsers3, errorParsers, parsePullDetail, parsePullResult, init_parse_pull, parsers4, parseMergeResult, parseMergeDetail, init_parse_merge, init_merge, parsers5, parsePushResult, parsePushDetail, init_parse_push, push_exports, init_push, init_show, fromPathRegex, FileStatusSummary, init_FileStatusSummary, StatusSummary, parsers6, parseStatusSummary, init_StatusSummary, ignoredOptions, init_status, NOT_INSTALLED, parsers7, init_version, cloneTask, cloneMirrorTask, init_clone, simple_git_api_exports, SimpleGitApi, init_simple_git_api, scheduler_exports, createScheduledTask, Scheduler, init_scheduler, apply_patch_exports, init_apply_patch, BranchDeletionBatch, init_BranchDeleteSummary, deleteSuccessRegex, deleteErrorRegex, parsers8, parseBranchDeletions, init_parse_branch_delete, BranchSummaryResult, init_BranchSummary, parsers9, currentBranchParser, init_parse_branch, branch_exports, init_branch, parseCheckIgnore, init_CheckIgnore, check_ignore_exports, init_check_ignore, parsers10, init_parse_fetch, fetch_exports, init_fetch, parsers11, init_parse_move, move_exports, init_move, pull_exports, init_pull, init_GetRemoteSummary, remote_exports, init_remote, stash_list_exports, init_stash_list, sub_module_exports, init_sub_module, TagList, parseTagList, init_TagList, tag_exports, init_tag, require_git, GitConstructError, GitPluginError, never2, WRONG_NUMBER_ERR, WRONG_CHARS_ERR, PluginStore, Git, simpleGit, esm_default;
37944
+ var import_file_exists, import_debug, import_promise_deferred, import_promise_deferred2, __defProp2, __getOwnPropDesc2, __getOwnPropNames2, __hasOwnProp2, __esm2, __commonJS2, __export2, __copyProps2, __toCommonJS2, GitError, init_git_error, GitResponseError, init_git_response_error, TaskConfigurationError, init_task_configuration_error, NULL, NOOP, objectToString, init_util3, filterArray, filterNumber, filterString, filterStringOrStringArray, filterHasLength, init_argument_filters, ExitCodes, init_exit_codes, GitOutputStreams, init_git_output_streams, LineParser, RemoteLineParser, init_line_parser, defaultOptions2, init_simple_git_options, init_task_options, init_task_parser, utils_exports, init_utils, check_is_repo_exports, CheckRepoActions, onError, parser, init_check_is_repo, CleanResponse, removalRegexp, dryRunRemovalRegexp, isFolderRegexp, init_CleanSummary, task_exports, EMPTY_COMMANDS, init_task, clean_exports, CONFIG_ERROR_INTERACTIVE_MODE, CONFIG_ERROR_MODE_REQUIRED, CONFIG_ERROR_UNKNOWN_OPTION, CleanOptions, CleanOptionValues, init_clean, ConfigList, init_ConfigList, GitConfigScope, init_config, DiffNameStatus, diffNameStatus, init_diff_name_status, disallowedOptions, Query, _a2, GrepQuery, init_grep, reset_exports, ResetMode, validResetModes, init_reset, init_git_logger, TasksPendingQueue, init_tasks_pending_queue, GitExecutorChain, init_git_executor_chain, git_executor_exports, GitExecutor, init_git_executor, init_task_callback, init_change_working_directory, init_checkout, parser2, init_count_objects, parsers, init_parse_commit, init_commit, init_first_commit, init_hash_object, InitSummary, initResponseRegex, reInitResponseRegex, init_InitSummary, bareCommand, init_init, logFormatRegex, init_log_format, DiffSummary, init_DiffSummary, statParser, numStatParser, nameOnlyParser, nameStatusParser, diffSummaryParsers, init_parse_diff_summary, START_BOUNDARY, COMMIT_BOUNDARY, SPLITTER, defaultFieldNames, init_parse_list_log_summary, diff_exports, init_diff, excludeOptions, init_log, MergeSummaryConflict, MergeSummaryDetail, init_MergeSummary, PullSummary, PullFailedSummary, init_PullSummary, remoteMessagesObjectParsers, init_parse_remote_objects, parsers2, RemoteMessageSummary, init_parse_remote_messages, FILE_UPDATE_REGEX, SUMMARY_REGEX, ACTION_REGEX, parsers3, errorParsers, parsePullDetail, parsePullResult, init_parse_pull, parsers4, parseMergeResult, parseMergeDetail, init_parse_merge, init_merge, parsers5, parsePushResult, parsePushDetail, init_parse_push, push_exports, init_push, init_show, fromPathRegex, FileStatusSummary, init_FileStatusSummary, StatusSummary, parsers6, parseStatusSummary, init_StatusSummary, ignoredOptions, init_status, NOT_INSTALLED, parsers7, init_version, cloneTask, cloneMirrorTask, init_clone, simple_git_api_exports, SimpleGitApi, init_simple_git_api, scheduler_exports, createScheduledTask, Scheduler, init_scheduler, apply_patch_exports, init_apply_patch, BranchDeletionBatch, init_BranchDeleteSummary, deleteSuccessRegex, deleteErrorRegex, parsers8, parseBranchDeletions, init_parse_branch_delete, BranchSummaryResult, init_BranchSummary, parsers9, currentBranchParser, init_parse_branch, branch_exports, init_branch, parseCheckIgnore, init_CheckIgnore, check_ignore_exports, init_check_ignore, parsers10, init_parse_fetch, fetch_exports, init_fetch, parsers11, init_parse_move, move_exports, init_move, pull_exports, init_pull, init_GetRemoteSummary, remote_exports, init_remote, stash_list_exports, init_stash_list, sub_module_exports, init_sub_module, TagList, parseTagList, init_TagList, tag_exports, init_tag, require_git, GitConstructError, GitPluginError, never2, WRONG_NUMBER_ERR, WRONG_CHARS_ERR, PluginStore, Git, simpleGit, esm_default;
37895
37945
  var init_esm2 = __esm({
37896
37946
  "node_modules/.pnpm/simple-git@3.36.0/node_modules/simple-git/dist/esm/index.js"() {
37897
37947
  import_file_exists = __toESM(require_dist2(), 1);
@@ -37927,7 +37977,7 @@ var init_esm2 = __esm({
37927
37977
  }
37928
37978
  return to;
37929
37979
  };
37930
- __toCommonJS = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
37980
+ __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
37931
37981
  init_git_error = __esm2({
37932
37982
  "src/lib/errors/git-error.ts"() {
37933
37983
  "use strict";
@@ -38782,9 +38832,9 @@ var init_esm2 = __esm({
38782
38832
  "src/lib/responses/InitSummary.ts"() {
38783
38833
  "use strict";
38784
38834
  InitSummary = class {
38785
- constructor(bare, path12, existing, gitDir) {
38835
+ constructor(bare, path13, existing, gitDir) {
38786
38836
  this.bare = bare;
38787
- this.path = path12;
38837
+ this.path = path13;
38788
38838
  this.existing = existing;
38789
38839
  this.gitDir = gitDir;
38790
38840
  }
@@ -39317,12 +39367,12 @@ var init_esm2 = __esm({
39317
39367
  "use strict";
39318
39368
  fromPathRegex = /^(.+)\0(.+)$/;
39319
39369
  FileStatusSummary = class {
39320
- constructor(path12, index, working_dir) {
39321
- this.path = path12;
39370
+ constructor(path13, index, working_dir) {
39371
+ this.path = path13;
39322
39372
  this.index = index;
39323
39373
  this.working_dir = working_dir;
39324
39374
  if (index === "R" || working_dir === "R") {
39325
- const detail = fromPathRegex.exec(path12) || [null, path12, path12];
39375
+ const detail = fromPathRegex.exec(path13) || [null, path13, path13];
39326
39376
  this.from = detail[2] || "";
39327
39377
  this.path = detail[1] || "";
39328
39378
  }
@@ -39584,9 +39634,9 @@ var init_esm2 = __esm({
39584
39634
  next
39585
39635
  );
39586
39636
  }
39587
- hashObject(path12, write) {
39637
+ hashObject(path13, write) {
39588
39638
  return this._runTask(
39589
- hashObjectTask(path12, write === true),
39639
+ hashObjectTask(path13, write === true),
39590
39640
  trailingFunctionArgument(arguments)
39591
39641
  );
39592
39642
  }
@@ -40027,10 +40077,10 @@ var init_esm2 = __esm({
40027
40077
  require_git = __commonJS2({
40028
40078
  "src/git.js"(exports, module) {
40029
40079
  "use strict";
40030
- var { GitExecutor: GitExecutor2 } = (init_git_executor(), __toCommonJS(git_executor_exports));
40031
- var { SimpleGitApi: SimpleGitApi2 } = (init_simple_git_api(), __toCommonJS(simple_git_api_exports));
40032
- var { Scheduler: Scheduler2 } = (init_scheduler(), __toCommonJS(scheduler_exports));
40033
- var { adhocExecTask: adhocExecTask2, configurationErrorTask: configurationErrorTask2 } = (init_task(), __toCommonJS(task_exports));
40080
+ var { GitExecutor: GitExecutor2 } = (init_git_executor(), __toCommonJS2(git_executor_exports));
40081
+ var { SimpleGitApi: SimpleGitApi2 } = (init_simple_git_api(), __toCommonJS2(simple_git_api_exports));
40082
+ var { Scheduler: Scheduler2 } = (init_scheduler(), __toCommonJS2(scheduler_exports));
40083
+ var { adhocExecTask: adhocExecTask2, configurationErrorTask: configurationErrorTask2 } = (init_task(), __toCommonJS2(task_exports));
40034
40084
  var {
40035
40085
  asArray: asArray2,
40036
40086
  filterArray: filterArray2,
@@ -40041,39 +40091,39 @@ var init_esm2 = __esm({
40041
40091
  getTrailingOptions: getTrailingOptions2,
40042
40092
  trailingFunctionArgument: trailingFunctionArgument2,
40043
40093
  trailingOptionsArgument: trailingOptionsArgument2
40044
- } = (init_utils(), __toCommonJS(utils_exports));
40045
- var { applyPatchTask: applyPatchTask2 } = (init_apply_patch(), __toCommonJS(apply_patch_exports));
40094
+ } = (init_utils(), __toCommonJS2(utils_exports));
40095
+ var { applyPatchTask: applyPatchTask2 } = (init_apply_patch(), __toCommonJS2(apply_patch_exports));
40046
40096
  var {
40047
40097
  branchTask: branchTask2,
40048
40098
  branchLocalTask: branchLocalTask2,
40049
40099
  deleteBranchesTask: deleteBranchesTask2,
40050
40100
  deleteBranchTask: deleteBranchTask2
40051
- } = (init_branch(), __toCommonJS(branch_exports));
40052
- var { checkIgnoreTask: checkIgnoreTask2 } = (init_check_ignore(), __toCommonJS(check_ignore_exports));
40053
- var { checkIsRepoTask: checkIsRepoTask2 } = (init_check_is_repo(), __toCommonJS(check_is_repo_exports));
40054
- var { cleanWithOptionsTask: cleanWithOptionsTask2, isCleanOptionsArray: isCleanOptionsArray2 } = (init_clean(), __toCommonJS(clean_exports));
40055
- var { diffSummaryTask: diffSummaryTask2 } = (init_diff(), __toCommonJS(diff_exports));
40056
- var { fetchTask: fetchTask2 } = (init_fetch(), __toCommonJS(fetch_exports));
40057
- var { moveTask: moveTask2 } = (init_move(), __toCommonJS(move_exports));
40058
- var { pullTask: pullTask2 } = (init_pull(), __toCommonJS(pull_exports));
40059
- var { pushTagsTask: pushTagsTask2 } = (init_push(), __toCommonJS(push_exports));
40101
+ } = (init_branch(), __toCommonJS2(branch_exports));
40102
+ var { checkIgnoreTask: checkIgnoreTask2 } = (init_check_ignore(), __toCommonJS2(check_ignore_exports));
40103
+ var { checkIsRepoTask: checkIsRepoTask2 } = (init_check_is_repo(), __toCommonJS2(check_is_repo_exports));
40104
+ var { cleanWithOptionsTask: cleanWithOptionsTask2, isCleanOptionsArray: isCleanOptionsArray2 } = (init_clean(), __toCommonJS2(clean_exports));
40105
+ var { diffSummaryTask: diffSummaryTask2 } = (init_diff(), __toCommonJS2(diff_exports));
40106
+ var { fetchTask: fetchTask2 } = (init_fetch(), __toCommonJS2(fetch_exports));
40107
+ var { moveTask: moveTask2 } = (init_move(), __toCommonJS2(move_exports));
40108
+ var { pullTask: pullTask2 } = (init_pull(), __toCommonJS2(pull_exports));
40109
+ var { pushTagsTask: pushTagsTask2 } = (init_push(), __toCommonJS2(push_exports));
40060
40110
  var {
40061
40111
  addRemoteTask: addRemoteTask2,
40062
40112
  getRemotesTask: getRemotesTask2,
40063
40113
  listRemotesTask: listRemotesTask2,
40064
40114
  remoteTask: remoteTask2,
40065
40115
  removeRemoteTask: removeRemoteTask2
40066
- } = (init_remote(), __toCommonJS(remote_exports));
40067
- var { getResetMode: getResetMode2, resetTask: resetTask2 } = (init_reset(), __toCommonJS(reset_exports));
40068
- var { stashListTask: stashListTask2 } = (init_stash_list(), __toCommonJS(stash_list_exports));
40116
+ } = (init_remote(), __toCommonJS2(remote_exports));
40117
+ var { getResetMode: getResetMode2, resetTask: resetTask2 } = (init_reset(), __toCommonJS2(reset_exports));
40118
+ var { stashListTask: stashListTask2 } = (init_stash_list(), __toCommonJS2(stash_list_exports));
40069
40119
  var {
40070
40120
  addSubModuleTask: addSubModuleTask2,
40071
40121
  initSubModuleTask: initSubModuleTask2,
40072
40122
  subModuleTask: subModuleTask2,
40073
40123
  updateSubModuleTask: updateSubModuleTask2
40074
- } = (init_sub_module(), __toCommonJS(sub_module_exports));
40075
- var { addAnnotatedTagTask: addAnnotatedTagTask2, addTagTask: addTagTask2, tagListTask: tagListTask2 } = (init_tag(), __toCommonJS(tag_exports));
40076
- var { straightThroughBufferTask: straightThroughBufferTask2, straightThroughStringTask: straightThroughStringTask2 } = (init_task(), __toCommonJS(task_exports));
40124
+ } = (init_sub_module(), __toCommonJS2(sub_module_exports));
40125
+ var { addAnnotatedTagTask: addAnnotatedTagTask2, addTagTask: addTagTask2, tagListTask: tagListTask2 } = (init_tag(), __toCommonJS2(tag_exports));
40126
+ var { straightThroughBufferTask: straightThroughBufferTask2, straightThroughStringTask: straightThroughStringTask2 } = (init_task(), __toCommonJS2(task_exports));
40077
40127
  function Git2(options, plugins) {
40078
40128
  this._plugins = plugins;
40079
40129
  this._executor = new GitExecutor2(
@@ -40223,8 +40273,8 @@ var init_esm2 = __esm({
40223
40273
  }
40224
40274
  return this._runTask(straightThroughStringTask2(command, this._trimmed), next);
40225
40275
  };
40226
- Git2.prototype.submoduleAdd = function(repo, path12, then) {
40227
- return this._runTask(addSubModuleTask2(repo, path12), trailingFunctionArgument2(arguments));
40276
+ Git2.prototype.submoduleAdd = function(repo, path13, then) {
40277
+ return this._runTask(addSubModuleTask2(repo, path13), trailingFunctionArgument2(arguments));
40228
40278
  };
40229
40279
  Git2.prototype.submoduleUpdate = function(args2, then) {
40230
40280
  return this._runTask(
@@ -40306,7 +40356,7 @@ var init_esm2 = __esm({
40306
40356
  Git2.prototype.binaryCatFile = function() {
40307
40357
  return this._catFile("buffer", arguments);
40308
40358
  };
40309
- Git2.prototype._catFile = function(format2, args2) {
40359
+ Git2.prototype._catFile = function(format3, args2) {
40310
40360
  var handler = trailingFunctionArgument2(args2);
40311
40361
  var command = ["cat-file"];
40312
40362
  var options = args2[0];
@@ -40319,7 +40369,7 @@ var init_esm2 = __esm({
40319
40369
  if (Array.isArray(options)) {
40320
40370
  command.push.apply(command, options);
40321
40371
  }
40322
- const task = format2 === "buffer" ? straightThroughBufferTask2(command) : straightThroughStringTask2(command);
40372
+ const task = format3 === "buffer" ? straightThroughBufferTask2(command) : straightThroughStringTask2(command);
40323
40373
  return this._runTask(task, handler);
40324
40374
  };
40325
40375
  Git2.prototype.diff = function(options, then) {
@@ -40567,21 +40617,24 @@ async function findRenames(projectRoot, filePath) {
40567
40617
  filePath
40568
40618
  ]);
40569
40619
  if (!result.trim()) return null;
40620
+ let currentHash = "unknown";
40621
+ let currentDateStr;
40570
40622
  const lines = result.trim().split("\n");
40571
- for (let i2 = 0; i2 < lines.length; i2++) {
40572
- const line = lines[i2];
40623
+ for (const line of lines) {
40624
+ const headerMatch = line.match(/^([a-f0-9]{7,40})\s+(.+)$/);
40625
+ if (headerMatch) {
40626
+ currentHash = headerMatch[1].substring(0, 7);
40627
+ currentDateStr = headerMatch[2];
40628
+ continue;
40629
+ }
40573
40630
  if (line.startsWith("R")) {
40574
40631
  const parts = line.split(" ");
40575
40632
  if (parts.length >= 3) {
40576
- const hashLine = lines[i2 - 1] || "";
40577
- const hashMatch = hashLine.match(/^([a-f0-9]+)\s+(.+)/);
40578
- const commitHash = hashMatch?.[1]?.substring(0, 7) || "unknown";
40579
- const dateStr = hashMatch?.[2];
40580
- const daysAgo = dateStr ? Math.floor((Date.now() - new Date(dateStr).getTime()) / (1e3 * 60 * 60 * 24)) : 0;
40633
+ const daysAgo = currentDateStr ? Math.floor((Date.now() - new Date(currentDateStr).getTime()) / (1e3 * 60 * 60 * 24)) : 0;
40581
40634
  return {
40582
40635
  oldPath: parts[1],
40583
40636
  newPath: parts[2],
40584
- commitHash,
40637
+ commitHash: currentHash,
40585
40638
  daysAgo
40586
40639
  };
40587
40640
  }
@@ -40734,27 +40787,1128 @@ var init_mcp_parser = __esm({
40734
40787
  }
40735
40788
  });
40736
40789
 
40737
- // node_modules/.pnpm/fastest-levenshtein@1.0.16/node_modules/fastest-levenshtein/mod.js
40738
- var require_mod = __commonJS({
40739
- "node_modules/.pnpm/fastest-levenshtein@1.0.16/node_modules/fastest-levenshtein/mod.js"(exports) {
40790
+ // node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/scanner.js
40791
+ function createScanner(text, ignoreTrivia = false) {
40792
+ const len = text.length;
40793
+ let pos = 0, value = "", tokenOffset = 0, token = 16, lineNumber = 0, lineStartOffset = 0, tokenLineStartOffset = 0, prevTokenLineStartOffset = 0, scanError = 0;
40794
+ function scanHexDigits(count, exact) {
40795
+ let digits = 0;
40796
+ let value2 = 0;
40797
+ while (digits < count || !exact) {
40798
+ let ch = text.charCodeAt(pos);
40799
+ if (ch >= 48 && ch <= 57) {
40800
+ value2 = value2 * 16 + ch - 48;
40801
+ } else if (ch >= 65 && ch <= 70) {
40802
+ value2 = value2 * 16 + ch - 65 + 10;
40803
+ } else if (ch >= 97 && ch <= 102) {
40804
+ value2 = value2 * 16 + ch - 97 + 10;
40805
+ } else {
40806
+ break;
40807
+ }
40808
+ pos++;
40809
+ digits++;
40810
+ }
40811
+ if (digits < count) {
40812
+ value2 = -1;
40813
+ }
40814
+ return value2;
40815
+ }
40816
+ function setPosition(newPosition) {
40817
+ pos = newPosition;
40818
+ value = "";
40819
+ tokenOffset = 0;
40820
+ token = 16;
40821
+ scanError = 0;
40822
+ }
40823
+ function scanNumber() {
40824
+ let start = pos;
40825
+ if (text.charCodeAt(pos) === 48) {
40826
+ pos++;
40827
+ } else {
40828
+ pos++;
40829
+ while (pos < text.length && isDigit(text.charCodeAt(pos))) {
40830
+ pos++;
40831
+ }
40832
+ }
40833
+ if (pos < text.length && text.charCodeAt(pos) === 46) {
40834
+ pos++;
40835
+ if (pos < text.length && isDigit(text.charCodeAt(pos))) {
40836
+ pos++;
40837
+ while (pos < text.length && isDigit(text.charCodeAt(pos))) {
40838
+ pos++;
40839
+ }
40840
+ } else {
40841
+ scanError = 3;
40842
+ return text.substring(start, pos);
40843
+ }
40844
+ }
40845
+ let end = pos;
40846
+ if (pos < text.length && (text.charCodeAt(pos) === 69 || text.charCodeAt(pos) === 101)) {
40847
+ pos++;
40848
+ if (pos < text.length && text.charCodeAt(pos) === 43 || text.charCodeAt(pos) === 45) {
40849
+ pos++;
40850
+ }
40851
+ if (pos < text.length && isDigit(text.charCodeAt(pos))) {
40852
+ pos++;
40853
+ while (pos < text.length && isDigit(text.charCodeAt(pos))) {
40854
+ pos++;
40855
+ }
40856
+ end = pos;
40857
+ } else {
40858
+ scanError = 3;
40859
+ }
40860
+ }
40861
+ return text.substring(start, end);
40862
+ }
40863
+ function scanString() {
40864
+ let result = "", start = pos;
40865
+ while (true) {
40866
+ if (pos >= len) {
40867
+ result += text.substring(start, pos);
40868
+ scanError = 2;
40869
+ break;
40870
+ }
40871
+ const ch = text.charCodeAt(pos);
40872
+ if (ch === 34) {
40873
+ result += text.substring(start, pos);
40874
+ pos++;
40875
+ break;
40876
+ }
40877
+ if (ch === 92) {
40878
+ result += text.substring(start, pos);
40879
+ pos++;
40880
+ if (pos >= len) {
40881
+ scanError = 2;
40882
+ break;
40883
+ }
40884
+ const ch2 = text.charCodeAt(pos++);
40885
+ switch (ch2) {
40886
+ case 34:
40887
+ result += '"';
40888
+ break;
40889
+ case 92:
40890
+ result += "\\";
40891
+ break;
40892
+ case 47:
40893
+ result += "/";
40894
+ break;
40895
+ case 98:
40896
+ result += "\b";
40897
+ break;
40898
+ case 102:
40899
+ result += "\f";
40900
+ break;
40901
+ case 110:
40902
+ result += "\n";
40903
+ break;
40904
+ case 114:
40905
+ result += "\r";
40906
+ break;
40907
+ case 116:
40908
+ result += " ";
40909
+ break;
40910
+ case 117:
40911
+ const ch3 = scanHexDigits(4, true);
40912
+ if (ch3 >= 0) {
40913
+ result += String.fromCharCode(ch3);
40914
+ } else {
40915
+ scanError = 4;
40916
+ }
40917
+ break;
40918
+ default:
40919
+ scanError = 5;
40920
+ }
40921
+ start = pos;
40922
+ continue;
40923
+ }
40924
+ if (ch >= 0 && ch <= 31) {
40925
+ if (isLineBreak(ch)) {
40926
+ result += text.substring(start, pos);
40927
+ scanError = 2;
40928
+ break;
40929
+ } else {
40930
+ scanError = 6;
40931
+ }
40932
+ }
40933
+ pos++;
40934
+ }
40935
+ return result;
40936
+ }
40937
+ function scanNext() {
40938
+ value = "";
40939
+ scanError = 0;
40940
+ tokenOffset = pos;
40941
+ lineStartOffset = lineNumber;
40942
+ prevTokenLineStartOffset = tokenLineStartOffset;
40943
+ if (pos >= len) {
40944
+ tokenOffset = len;
40945
+ return token = 17;
40946
+ }
40947
+ let code = text.charCodeAt(pos);
40948
+ if (isWhiteSpace(code)) {
40949
+ do {
40950
+ pos++;
40951
+ value += String.fromCharCode(code);
40952
+ code = text.charCodeAt(pos);
40953
+ } while (isWhiteSpace(code));
40954
+ return token = 15;
40955
+ }
40956
+ if (isLineBreak(code)) {
40957
+ pos++;
40958
+ value += String.fromCharCode(code);
40959
+ if (code === 13 && text.charCodeAt(pos) === 10) {
40960
+ pos++;
40961
+ value += "\n";
40962
+ }
40963
+ lineNumber++;
40964
+ tokenLineStartOffset = pos;
40965
+ return token = 14;
40966
+ }
40967
+ switch (code) {
40968
+ // tokens: []{}:,
40969
+ case 123:
40970
+ pos++;
40971
+ return token = 1;
40972
+ case 125:
40973
+ pos++;
40974
+ return token = 2;
40975
+ case 91:
40976
+ pos++;
40977
+ return token = 3;
40978
+ case 93:
40979
+ pos++;
40980
+ return token = 4;
40981
+ case 58:
40982
+ pos++;
40983
+ return token = 6;
40984
+ case 44:
40985
+ pos++;
40986
+ return token = 5;
40987
+ // strings
40988
+ case 34:
40989
+ pos++;
40990
+ value = scanString();
40991
+ return token = 10;
40992
+ // comments
40993
+ case 47:
40994
+ const start = pos - 1;
40995
+ if (text.charCodeAt(pos + 1) === 47) {
40996
+ pos += 2;
40997
+ while (pos < len) {
40998
+ if (isLineBreak(text.charCodeAt(pos))) {
40999
+ break;
41000
+ }
41001
+ pos++;
41002
+ }
41003
+ value = text.substring(start, pos);
41004
+ return token = 12;
41005
+ }
41006
+ if (text.charCodeAt(pos + 1) === 42) {
41007
+ pos += 2;
41008
+ const safeLength = len - 1;
41009
+ let commentClosed = false;
41010
+ while (pos < safeLength) {
41011
+ const ch = text.charCodeAt(pos);
41012
+ if (ch === 42 && text.charCodeAt(pos + 1) === 47) {
41013
+ pos += 2;
41014
+ commentClosed = true;
41015
+ break;
41016
+ }
41017
+ pos++;
41018
+ if (isLineBreak(ch)) {
41019
+ if (ch === 13 && text.charCodeAt(pos) === 10) {
41020
+ pos++;
41021
+ }
41022
+ lineNumber++;
41023
+ tokenLineStartOffset = pos;
41024
+ }
41025
+ }
41026
+ if (!commentClosed) {
41027
+ pos++;
41028
+ scanError = 1;
41029
+ }
41030
+ value = text.substring(start, pos);
41031
+ return token = 13;
41032
+ }
41033
+ value += String.fromCharCode(code);
41034
+ pos++;
41035
+ return token = 16;
41036
+ // numbers
41037
+ case 45:
41038
+ value += String.fromCharCode(code);
41039
+ pos++;
41040
+ if (pos === len || !isDigit(text.charCodeAt(pos))) {
41041
+ return token = 16;
41042
+ }
41043
+ // found a minus, followed by a number so
41044
+ // we fall through to proceed with scanning
41045
+ // numbers
41046
+ case 48:
41047
+ case 49:
41048
+ case 50:
41049
+ case 51:
41050
+ case 52:
41051
+ case 53:
41052
+ case 54:
41053
+ case 55:
41054
+ case 56:
41055
+ case 57:
41056
+ value += scanNumber();
41057
+ return token = 11;
41058
+ // literals and unknown symbols
41059
+ default:
41060
+ while (pos < len && isUnknownContentCharacter(code)) {
41061
+ pos++;
41062
+ code = text.charCodeAt(pos);
41063
+ }
41064
+ if (tokenOffset !== pos) {
41065
+ value = text.substring(tokenOffset, pos);
41066
+ switch (value) {
41067
+ case "true":
41068
+ return token = 8;
41069
+ case "false":
41070
+ return token = 9;
41071
+ case "null":
41072
+ return token = 7;
41073
+ }
41074
+ return token = 16;
41075
+ }
41076
+ value += String.fromCharCode(code);
41077
+ pos++;
41078
+ return token = 16;
41079
+ }
41080
+ }
41081
+ function isUnknownContentCharacter(code) {
41082
+ if (isWhiteSpace(code) || isLineBreak(code)) {
41083
+ return false;
41084
+ }
41085
+ switch (code) {
41086
+ case 125:
41087
+ case 93:
41088
+ case 123:
41089
+ case 91:
41090
+ case 34:
41091
+ case 58:
41092
+ case 44:
41093
+ case 47:
41094
+ return false;
41095
+ }
41096
+ return true;
41097
+ }
41098
+ function scanNextNonTrivia() {
41099
+ let result;
41100
+ do {
41101
+ result = scanNext();
41102
+ } while (result >= 12 && result <= 15);
41103
+ return result;
41104
+ }
41105
+ return {
41106
+ setPosition,
41107
+ getPosition: () => pos,
41108
+ scan: ignoreTrivia ? scanNextNonTrivia : scanNext,
41109
+ getToken: () => token,
41110
+ getTokenValue: () => value,
41111
+ getTokenOffset: () => tokenOffset,
41112
+ getTokenLength: () => pos - tokenOffset,
41113
+ getTokenStartLine: () => lineStartOffset,
41114
+ getTokenStartCharacter: () => tokenOffset - prevTokenLineStartOffset,
41115
+ getTokenError: () => scanError
41116
+ };
41117
+ }
41118
+ function isWhiteSpace(ch) {
41119
+ return ch === 32 || ch === 9;
41120
+ }
41121
+ function isLineBreak(ch) {
41122
+ return ch === 10 || ch === 13;
41123
+ }
41124
+ function isDigit(ch) {
41125
+ return ch >= 48 && ch <= 57;
41126
+ }
41127
+ var CharacterCodes;
41128
+ var init_scanner2 = __esm({
41129
+ "node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/scanner.js"() {
40740
41130
  "use strict";
40741
- exports.__esModule = true;
40742
- exports.distance = exports.closest = void 0;
40743
- var peq = new Uint32Array(65536);
40744
- var myers_32 = function(a, b2) {
40745
- var n7 = a.length;
40746
- var m = b2.length;
40747
- var lst = 1 << n7 - 1;
40748
- var pv = -1;
40749
- var mv = 0;
40750
- var sc = n7;
40751
- var i2 = n7;
41131
+ (function(CharacterCodes2) {
41132
+ CharacterCodes2[CharacterCodes2["lineFeed"] = 10] = "lineFeed";
41133
+ CharacterCodes2[CharacterCodes2["carriageReturn"] = 13] = "carriageReturn";
41134
+ CharacterCodes2[CharacterCodes2["space"] = 32] = "space";
41135
+ CharacterCodes2[CharacterCodes2["_0"] = 48] = "_0";
41136
+ CharacterCodes2[CharacterCodes2["_1"] = 49] = "_1";
41137
+ CharacterCodes2[CharacterCodes2["_2"] = 50] = "_2";
41138
+ CharacterCodes2[CharacterCodes2["_3"] = 51] = "_3";
41139
+ CharacterCodes2[CharacterCodes2["_4"] = 52] = "_4";
41140
+ CharacterCodes2[CharacterCodes2["_5"] = 53] = "_5";
41141
+ CharacterCodes2[CharacterCodes2["_6"] = 54] = "_6";
41142
+ CharacterCodes2[CharacterCodes2["_7"] = 55] = "_7";
41143
+ CharacterCodes2[CharacterCodes2["_8"] = 56] = "_8";
41144
+ CharacterCodes2[CharacterCodes2["_9"] = 57] = "_9";
41145
+ CharacterCodes2[CharacterCodes2["a"] = 97] = "a";
41146
+ CharacterCodes2[CharacterCodes2["b"] = 98] = "b";
41147
+ CharacterCodes2[CharacterCodes2["c"] = 99] = "c";
41148
+ CharacterCodes2[CharacterCodes2["d"] = 100] = "d";
41149
+ CharacterCodes2[CharacterCodes2["e"] = 101] = "e";
41150
+ CharacterCodes2[CharacterCodes2["f"] = 102] = "f";
41151
+ CharacterCodes2[CharacterCodes2["g"] = 103] = "g";
41152
+ CharacterCodes2[CharacterCodes2["h"] = 104] = "h";
41153
+ CharacterCodes2[CharacterCodes2["i"] = 105] = "i";
41154
+ CharacterCodes2[CharacterCodes2["j"] = 106] = "j";
41155
+ CharacterCodes2[CharacterCodes2["k"] = 107] = "k";
41156
+ CharacterCodes2[CharacterCodes2["l"] = 108] = "l";
41157
+ CharacterCodes2[CharacterCodes2["m"] = 109] = "m";
41158
+ CharacterCodes2[CharacterCodes2["n"] = 110] = "n";
41159
+ CharacterCodes2[CharacterCodes2["o"] = 111] = "o";
41160
+ CharacterCodes2[CharacterCodes2["p"] = 112] = "p";
41161
+ CharacterCodes2[CharacterCodes2["q"] = 113] = "q";
41162
+ CharacterCodes2[CharacterCodes2["r"] = 114] = "r";
41163
+ CharacterCodes2[CharacterCodes2["s"] = 115] = "s";
41164
+ CharacterCodes2[CharacterCodes2["t"] = 116] = "t";
41165
+ CharacterCodes2[CharacterCodes2["u"] = 117] = "u";
41166
+ CharacterCodes2[CharacterCodes2["v"] = 118] = "v";
41167
+ CharacterCodes2[CharacterCodes2["w"] = 119] = "w";
41168
+ CharacterCodes2[CharacterCodes2["x"] = 120] = "x";
41169
+ CharacterCodes2[CharacterCodes2["y"] = 121] = "y";
41170
+ CharacterCodes2[CharacterCodes2["z"] = 122] = "z";
41171
+ CharacterCodes2[CharacterCodes2["A"] = 65] = "A";
41172
+ CharacterCodes2[CharacterCodes2["B"] = 66] = "B";
41173
+ CharacterCodes2[CharacterCodes2["C"] = 67] = "C";
41174
+ CharacterCodes2[CharacterCodes2["D"] = 68] = "D";
41175
+ CharacterCodes2[CharacterCodes2["E"] = 69] = "E";
41176
+ CharacterCodes2[CharacterCodes2["F"] = 70] = "F";
41177
+ CharacterCodes2[CharacterCodes2["G"] = 71] = "G";
41178
+ CharacterCodes2[CharacterCodes2["H"] = 72] = "H";
41179
+ CharacterCodes2[CharacterCodes2["I"] = 73] = "I";
41180
+ CharacterCodes2[CharacterCodes2["J"] = 74] = "J";
41181
+ CharacterCodes2[CharacterCodes2["K"] = 75] = "K";
41182
+ CharacterCodes2[CharacterCodes2["L"] = 76] = "L";
41183
+ CharacterCodes2[CharacterCodes2["M"] = 77] = "M";
41184
+ CharacterCodes2[CharacterCodes2["N"] = 78] = "N";
41185
+ CharacterCodes2[CharacterCodes2["O"] = 79] = "O";
41186
+ CharacterCodes2[CharacterCodes2["P"] = 80] = "P";
41187
+ CharacterCodes2[CharacterCodes2["Q"] = 81] = "Q";
41188
+ CharacterCodes2[CharacterCodes2["R"] = 82] = "R";
41189
+ CharacterCodes2[CharacterCodes2["S"] = 83] = "S";
41190
+ CharacterCodes2[CharacterCodes2["T"] = 84] = "T";
41191
+ CharacterCodes2[CharacterCodes2["U"] = 85] = "U";
41192
+ CharacterCodes2[CharacterCodes2["V"] = 86] = "V";
41193
+ CharacterCodes2[CharacterCodes2["W"] = 87] = "W";
41194
+ CharacterCodes2[CharacterCodes2["X"] = 88] = "X";
41195
+ CharacterCodes2[CharacterCodes2["Y"] = 89] = "Y";
41196
+ CharacterCodes2[CharacterCodes2["Z"] = 90] = "Z";
41197
+ CharacterCodes2[CharacterCodes2["asterisk"] = 42] = "asterisk";
41198
+ CharacterCodes2[CharacterCodes2["backslash"] = 92] = "backslash";
41199
+ CharacterCodes2[CharacterCodes2["closeBrace"] = 125] = "closeBrace";
41200
+ CharacterCodes2[CharacterCodes2["closeBracket"] = 93] = "closeBracket";
41201
+ CharacterCodes2[CharacterCodes2["colon"] = 58] = "colon";
41202
+ CharacterCodes2[CharacterCodes2["comma"] = 44] = "comma";
41203
+ CharacterCodes2[CharacterCodes2["dot"] = 46] = "dot";
41204
+ CharacterCodes2[CharacterCodes2["doubleQuote"] = 34] = "doubleQuote";
41205
+ CharacterCodes2[CharacterCodes2["minus"] = 45] = "minus";
41206
+ CharacterCodes2[CharacterCodes2["openBrace"] = 123] = "openBrace";
41207
+ CharacterCodes2[CharacterCodes2["openBracket"] = 91] = "openBracket";
41208
+ CharacterCodes2[CharacterCodes2["plus"] = 43] = "plus";
41209
+ CharacterCodes2[CharacterCodes2["slash"] = 47] = "slash";
41210
+ CharacterCodes2[CharacterCodes2["formFeed"] = 12] = "formFeed";
41211
+ CharacterCodes2[CharacterCodes2["tab"] = 9] = "tab";
41212
+ })(CharacterCodes || (CharacterCodes = {}));
41213
+ }
41214
+ });
41215
+
41216
+ // node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/string-intern.js
41217
+ var cachedSpaces, maxCachedValues, cachedBreakLinesWithSpaces;
41218
+ var init_string_intern = __esm({
41219
+ "node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/string-intern.js"() {
41220
+ cachedSpaces = new Array(20).fill(0).map((_3, index) => {
41221
+ return " ".repeat(index);
41222
+ });
41223
+ maxCachedValues = 200;
41224
+ cachedBreakLinesWithSpaces = {
41225
+ " ": {
41226
+ "\n": new Array(maxCachedValues).fill(0).map((_3, index) => {
41227
+ return "\n" + " ".repeat(index);
41228
+ }),
41229
+ "\r": new Array(maxCachedValues).fill(0).map((_3, index) => {
41230
+ return "\r" + " ".repeat(index);
41231
+ }),
41232
+ "\r\n": new Array(maxCachedValues).fill(0).map((_3, index) => {
41233
+ return "\r\n" + " ".repeat(index);
41234
+ })
41235
+ },
41236
+ " ": {
41237
+ "\n": new Array(maxCachedValues).fill(0).map((_3, index) => {
41238
+ return "\n" + " ".repeat(index);
41239
+ }),
41240
+ "\r": new Array(maxCachedValues).fill(0).map((_3, index) => {
41241
+ return "\r" + " ".repeat(index);
41242
+ }),
41243
+ "\r\n": new Array(maxCachedValues).fill(0).map((_3, index) => {
41244
+ return "\r\n" + " ".repeat(index);
41245
+ })
41246
+ }
41247
+ };
41248
+ }
41249
+ });
41250
+
41251
+ // node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/format.js
41252
+ var init_format = __esm({
41253
+ "node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/format.js"() {
41254
+ "use strict";
41255
+ init_scanner2();
41256
+ init_string_intern();
41257
+ }
41258
+ });
41259
+
41260
+ // node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/parser.js
41261
+ function parseTree(text, errors = [], options = ParseOptions.DEFAULT) {
41262
+ let currentParent = { type: "array", offset: -1, length: -1, children: [], parent: void 0 };
41263
+ function ensurePropertyComplete(endOffset) {
41264
+ if (currentParent.type === "property") {
41265
+ currentParent.length = endOffset - currentParent.offset;
41266
+ currentParent = currentParent.parent;
41267
+ }
41268
+ }
41269
+ function onValue(valueNode) {
41270
+ currentParent.children.push(valueNode);
41271
+ return valueNode;
41272
+ }
41273
+ const visitor = {
41274
+ onObjectBegin: (offset) => {
41275
+ currentParent = onValue({ type: "object", offset, length: -1, parent: currentParent, children: [] });
41276
+ },
41277
+ onObjectProperty: (name, offset, length) => {
41278
+ currentParent = onValue({ type: "property", offset, length: -1, parent: currentParent, children: [] });
41279
+ currentParent.children.push({ type: "string", value: name, offset, length, parent: currentParent });
41280
+ },
41281
+ onObjectEnd: (offset, length) => {
41282
+ ensurePropertyComplete(offset + length);
41283
+ currentParent.length = offset + length - currentParent.offset;
41284
+ currentParent = currentParent.parent;
41285
+ ensurePropertyComplete(offset + length);
41286
+ },
41287
+ onArrayBegin: (offset, length) => {
41288
+ currentParent = onValue({ type: "array", offset, length: -1, parent: currentParent, children: [] });
41289
+ },
41290
+ onArrayEnd: (offset, length) => {
41291
+ currentParent.length = offset + length - currentParent.offset;
41292
+ currentParent = currentParent.parent;
41293
+ ensurePropertyComplete(offset + length);
41294
+ },
41295
+ onLiteralValue: (value, offset, length) => {
41296
+ onValue({ type: getNodeType(value), offset, length, parent: currentParent, value });
41297
+ ensurePropertyComplete(offset + length);
41298
+ },
41299
+ onSeparator: (sep, offset, length) => {
41300
+ if (currentParent.type === "property") {
41301
+ if (sep === ":") {
41302
+ currentParent.colonOffset = offset;
41303
+ } else if (sep === ",") {
41304
+ ensurePropertyComplete(offset);
41305
+ }
41306
+ }
41307
+ },
41308
+ onError: (error49, offset, length) => {
41309
+ errors.push({ error: error49, offset, length });
41310
+ }
41311
+ };
41312
+ visit(text, visitor, options);
41313
+ const result = currentParent.children[0];
41314
+ if (result) {
41315
+ delete result.parent;
41316
+ }
41317
+ return result;
41318
+ }
41319
+ function visit(text, visitor, options = ParseOptions.DEFAULT) {
41320
+ const _scanner = createScanner(text, false);
41321
+ const _jsonPath = [];
41322
+ let suppressedCallbacks = 0;
41323
+ function toNoArgVisit(visitFunction) {
41324
+ return visitFunction ? () => suppressedCallbacks === 0 && visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;
41325
+ }
41326
+ function toOneArgVisit(visitFunction) {
41327
+ return visitFunction ? (arg) => suppressedCallbacks === 0 && visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;
41328
+ }
41329
+ function toOneArgVisitWithPath(visitFunction) {
41330
+ return visitFunction ? (arg) => suppressedCallbacks === 0 && visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice()) : () => true;
41331
+ }
41332
+ function toBeginVisit(visitFunction) {
41333
+ return visitFunction ? () => {
41334
+ if (suppressedCallbacks > 0) {
41335
+ suppressedCallbacks++;
41336
+ } else {
41337
+ let cbReturn = visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice());
41338
+ if (cbReturn === false) {
41339
+ suppressedCallbacks = 1;
41340
+ }
41341
+ }
41342
+ } : () => true;
41343
+ }
41344
+ function toEndVisit(visitFunction) {
41345
+ return visitFunction ? () => {
41346
+ if (suppressedCallbacks > 0) {
41347
+ suppressedCallbacks--;
41348
+ }
41349
+ if (suppressedCallbacks === 0) {
41350
+ visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter());
41351
+ }
41352
+ } : () => true;
41353
+ }
41354
+ const onObjectBegin = toBeginVisit(visitor.onObjectBegin), onObjectProperty = toOneArgVisitWithPath(visitor.onObjectProperty), onObjectEnd = toEndVisit(visitor.onObjectEnd), onArrayBegin = toBeginVisit(visitor.onArrayBegin), onArrayEnd = toEndVisit(visitor.onArrayEnd), onLiteralValue = toOneArgVisitWithPath(visitor.onLiteralValue), onSeparator = toOneArgVisit(visitor.onSeparator), onComment = toNoArgVisit(visitor.onComment), onError2 = toOneArgVisit(visitor.onError);
41355
+ const disallowComments = options && options.disallowComments;
41356
+ const allowTrailingComma = options && options.allowTrailingComma;
41357
+ function scanNext() {
41358
+ while (true) {
41359
+ const token = _scanner.scan();
41360
+ switch (_scanner.getTokenError()) {
41361
+ case 4:
41362
+ handleError(
41363
+ 14
41364
+ /* ParseErrorCode.InvalidUnicode */
41365
+ );
41366
+ break;
41367
+ case 5:
41368
+ handleError(
41369
+ 15
41370
+ /* ParseErrorCode.InvalidEscapeCharacter */
41371
+ );
41372
+ break;
41373
+ case 3:
41374
+ handleError(
41375
+ 13
41376
+ /* ParseErrorCode.UnexpectedEndOfNumber */
41377
+ );
41378
+ break;
41379
+ case 1:
41380
+ if (!disallowComments) {
41381
+ handleError(
41382
+ 11
41383
+ /* ParseErrorCode.UnexpectedEndOfComment */
41384
+ );
41385
+ }
41386
+ break;
41387
+ case 2:
41388
+ handleError(
41389
+ 12
41390
+ /* ParseErrorCode.UnexpectedEndOfString */
41391
+ );
41392
+ break;
41393
+ case 6:
41394
+ handleError(
41395
+ 16
41396
+ /* ParseErrorCode.InvalidCharacter */
41397
+ );
41398
+ break;
41399
+ }
41400
+ switch (token) {
41401
+ case 12:
41402
+ case 13:
41403
+ if (disallowComments) {
41404
+ handleError(
41405
+ 10
41406
+ /* ParseErrorCode.InvalidCommentToken */
41407
+ );
41408
+ } else {
41409
+ onComment();
41410
+ }
41411
+ break;
41412
+ case 16:
41413
+ handleError(
41414
+ 1
41415
+ /* ParseErrorCode.InvalidSymbol */
41416
+ );
41417
+ break;
41418
+ case 15:
41419
+ case 14:
41420
+ break;
41421
+ default:
41422
+ return token;
41423
+ }
41424
+ }
41425
+ }
41426
+ function handleError(error49, skipUntilAfter = [], skipUntil = []) {
41427
+ onError2(error49);
41428
+ if (skipUntilAfter.length + skipUntil.length > 0) {
41429
+ let token = _scanner.getToken();
41430
+ while (token !== 17) {
41431
+ if (skipUntilAfter.indexOf(token) !== -1) {
41432
+ scanNext();
41433
+ break;
41434
+ } else if (skipUntil.indexOf(token) !== -1) {
41435
+ break;
41436
+ }
41437
+ token = scanNext();
41438
+ }
41439
+ }
41440
+ }
41441
+ function parseString(isValue) {
41442
+ const value = _scanner.getTokenValue();
41443
+ if (isValue) {
41444
+ onLiteralValue(value);
41445
+ } else {
41446
+ onObjectProperty(value);
41447
+ _jsonPath.push(value);
41448
+ }
41449
+ scanNext();
41450
+ return true;
41451
+ }
41452
+ function parseLiteral() {
41453
+ switch (_scanner.getToken()) {
41454
+ case 11:
41455
+ const tokenValue = _scanner.getTokenValue();
41456
+ let value = Number(tokenValue);
41457
+ if (isNaN(value)) {
41458
+ handleError(
41459
+ 2
41460
+ /* ParseErrorCode.InvalidNumberFormat */
41461
+ );
41462
+ value = 0;
41463
+ }
41464
+ onLiteralValue(value);
41465
+ break;
41466
+ case 7:
41467
+ onLiteralValue(null);
41468
+ break;
41469
+ case 8:
41470
+ onLiteralValue(true);
41471
+ break;
41472
+ case 9:
41473
+ onLiteralValue(false);
41474
+ break;
41475
+ default:
41476
+ return false;
41477
+ }
41478
+ scanNext();
41479
+ return true;
41480
+ }
41481
+ function parseProperty() {
41482
+ if (_scanner.getToken() !== 10) {
41483
+ handleError(3, [], [
41484
+ 2,
41485
+ 5
41486
+ /* SyntaxKind.CommaToken */
41487
+ ]);
41488
+ return false;
41489
+ }
41490
+ parseString(false);
41491
+ if (_scanner.getToken() === 6) {
41492
+ onSeparator(":");
41493
+ scanNext();
41494
+ if (!parseValue()) {
41495
+ handleError(4, [], [
41496
+ 2,
41497
+ 5
41498
+ /* SyntaxKind.CommaToken */
41499
+ ]);
41500
+ }
41501
+ } else {
41502
+ handleError(5, [], [
41503
+ 2,
41504
+ 5
41505
+ /* SyntaxKind.CommaToken */
41506
+ ]);
41507
+ }
41508
+ _jsonPath.pop();
41509
+ return true;
41510
+ }
41511
+ function parseObject() {
41512
+ onObjectBegin();
41513
+ scanNext();
41514
+ let needsComma = false;
41515
+ while (_scanner.getToken() !== 2 && _scanner.getToken() !== 17) {
41516
+ if (_scanner.getToken() === 5) {
41517
+ if (!needsComma) {
41518
+ handleError(4, [], []);
41519
+ }
41520
+ onSeparator(",");
41521
+ scanNext();
41522
+ if (_scanner.getToken() === 2 && allowTrailingComma) {
41523
+ break;
41524
+ }
41525
+ } else if (needsComma) {
41526
+ handleError(6, [], []);
41527
+ }
41528
+ if (!parseProperty()) {
41529
+ handleError(4, [], [
41530
+ 2,
41531
+ 5
41532
+ /* SyntaxKind.CommaToken */
41533
+ ]);
41534
+ }
41535
+ needsComma = true;
41536
+ }
41537
+ onObjectEnd();
41538
+ if (_scanner.getToken() !== 2) {
41539
+ handleError(7, [
41540
+ 2
41541
+ /* SyntaxKind.CloseBraceToken */
41542
+ ], []);
41543
+ } else {
41544
+ scanNext();
41545
+ }
41546
+ return true;
41547
+ }
41548
+ function parseArray() {
41549
+ onArrayBegin();
41550
+ scanNext();
41551
+ let isFirstElement = true;
41552
+ let needsComma = false;
41553
+ while (_scanner.getToken() !== 4 && _scanner.getToken() !== 17) {
41554
+ if (_scanner.getToken() === 5) {
41555
+ if (!needsComma) {
41556
+ handleError(4, [], []);
41557
+ }
41558
+ onSeparator(",");
41559
+ scanNext();
41560
+ if (_scanner.getToken() === 4 && allowTrailingComma) {
41561
+ break;
41562
+ }
41563
+ } else if (needsComma) {
41564
+ handleError(6, [], []);
41565
+ }
41566
+ if (isFirstElement) {
41567
+ _jsonPath.push(0);
41568
+ isFirstElement = false;
41569
+ } else {
41570
+ _jsonPath[_jsonPath.length - 1]++;
41571
+ }
41572
+ if (!parseValue()) {
41573
+ handleError(4, [], [
41574
+ 4,
41575
+ 5
41576
+ /* SyntaxKind.CommaToken */
41577
+ ]);
41578
+ }
41579
+ needsComma = true;
41580
+ }
41581
+ onArrayEnd();
41582
+ if (!isFirstElement) {
41583
+ _jsonPath.pop();
41584
+ }
41585
+ if (_scanner.getToken() !== 4) {
41586
+ handleError(8, [
41587
+ 4
41588
+ /* SyntaxKind.CloseBracketToken */
41589
+ ], []);
41590
+ } else {
41591
+ scanNext();
41592
+ }
41593
+ return true;
41594
+ }
41595
+ function parseValue() {
41596
+ switch (_scanner.getToken()) {
41597
+ case 3:
41598
+ return parseArray();
41599
+ case 1:
41600
+ return parseObject();
41601
+ case 10:
41602
+ return parseString(true);
41603
+ default:
41604
+ return parseLiteral();
41605
+ }
41606
+ }
41607
+ scanNext();
41608
+ if (_scanner.getToken() === 17) {
41609
+ if (options.allowEmptyContent) {
41610
+ return true;
41611
+ }
41612
+ handleError(4, [], []);
41613
+ return false;
41614
+ }
41615
+ if (!parseValue()) {
41616
+ handleError(4, [], []);
41617
+ return false;
41618
+ }
41619
+ if (_scanner.getToken() !== 17) {
41620
+ handleError(9, [], []);
41621
+ }
41622
+ return true;
41623
+ }
41624
+ function getNodeType(value) {
41625
+ switch (typeof value) {
41626
+ case "boolean":
41627
+ return "boolean";
41628
+ case "number":
41629
+ return "number";
41630
+ case "string":
41631
+ return "string";
41632
+ case "object": {
41633
+ if (!value) {
41634
+ return "null";
41635
+ } else if (Array.isArray(value)) {
41636
+ return "array";
41637
+ }
41638
+ return "object";
41639
+ }
41640
+ default:
41641
+ return "null";
41642
+ }
41643
+ }
41644
+ var ParseOptions;
41645
+ var init_parser2 = __esm({
41646
+ "node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/parser.js"() {
41647
+ "use strict";
41648
+ init_scanner2();
41649
+ (function(ParseOptions2) {
41650
+ ParseOptions2.DEFAULT = {
41651
+ allowTrailingComma: false
41652
+ };
41653
+ })(ParseOptions || (ParseOptions = {}));
41654
+ }
41655
+ });
41656
+
41657
+ // node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/edit.js
41658
+ var init_edit = __esm({
41659
+ "node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/edit.js"() {
41660
+ "use strict";
41661
+ init_format();
41662
+ init_parser2();
41663
+ }
41664
+ });
41665
+
41666
+ // node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/main.js
41667
+ var ScanError, SyntaxKind, parseTree2, ParseErrorCode;
41668
+ var init_main = __esm({
41669
+ "node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/main.js"() {
41670
+ "use strict";
41671
+ init_format();
41672
+ init_edit();
41673
+ init_scanner2();
41674
+ init_parser2();
41675
+ (function(ScanError2) {
41676
+ ScanError2[ScanError2["None"] = 0] = "None";
41677
+ ScanError2[ScanError2["UnexpectedEndOfComment"] = 1] = "UnexpectedEndOfComment";
41678
+ ScanError2[ScanError2["UnexpectedEndOfString"] = 2] = "UnexpectedEndOfString";
41679
+ ScanError2[ScanError2["UnexpectedEndOfNumber"] = 3] = "UnexpectedEndOfNumber";
41680
+ ScanError2[ScanError2["InvalidUnicode"] = 4] = "InvalidUnicode";
41681
+ ScanError2[ScanError2["InvalidEscapeCharacter"] = 5] = "InvalidEscapeCharacter";
41682
+ ScanError2[ScanError2["InvalidCharacter"] = 6] = "InvalidCharacter";
41683
+ })(ScanError || (ScanError = {}));
41684
+ (function(SyntaxKind2) {
41685
+ SyntaxKind2[SyntaxKind2["OpenBraceToken"] = 1] = "OpenBraceToken";
41686
+ SyntaxKind2[SyntaxKind2["CloseBraceToken"] = 2] = "CloseBraceToken";
41687
+ SyntaxKind2[SyntaxKind2["OpenBracketToken"] = 3] = "OpenBracketToken";
41688
+ SyntaxKind2[SyntaxKind2["CloseBracketToken"] = 4] = "CloseBracketToken";
41689
+ SyntaxKind2[SyntaxKind2["CommaToken"] = 5] = "CommaToken";
41690
+ SyntaxKind2[SyntaxKind2["ColonToken"] = 6] = "ColonToken";
41691
+ SyntaxKind2[SyntaxKind2["NullKeyword"] = 7] = "NullKeyword";
41692
+ SyntaxKind2[SyntaxKind2["TrueKeyword"] = 8] = "TrueKeyword";
41693
+ SyntaxKind2[SyntaxKind2["FalseKeyword"] = 9] = "FalseKeyword";
41694
+ SyntaxKind2[SyntaxKind2["StringLiteral"] = 10] = "StringLiteral";
41695
+ SyntaxKind2[SyntaxKind2["NumericLiteral"] = 11] = "NumericLiteral";
41696
+ SyntaxKind2[SyntaxKind2["LineCommentTrivia"] = 12] = "LineCommentTrivia";
41697
+ SyntaxKind2[SyntaxKind2["BlockCommentTrivia"] = 13] = "BlockCommentTrivia";
41698
+ SyntaxKind2[SyntaxKind2["LineBreakTrivia"] = 14] = "LineBreakTrivia";
41699
+ SyntaxKind2[SyntaxKind2["Trivia"] = 15] = "Trivia";
41700
+ SyntaxKind2[SyntaxKind2["Unknown"] = 16] = "Unknown";
41701
+ SyntaxKind2[SyntaxKind2["EOF"] = 17] = "EOF";
41702
+ })(SyntaxKind || (SyntaxKind = {}));
41703
+ parseTree2 = parseTree;
41704
+ (function(ParseErrorCode2) {
41705
+ ParseErrorCode2[ParseErrorCode2["InvalidSymbol"] = 1] = "InvalidSymbol";
41706
+ ParseErrorCode2[ParseErrorCode2["InvalidNumberFormat"] = 2] = "InvalidNumberFormat";
41707
+ ParseErrorCode2[ParseErrorCode2["PropertyNameExpected"] = 3] = "PropertyNameExpected";
41708
+ ParseErrorCode2[ParseErrorCode2["ValueExpected"] = 4] = "ValueExpected";
41709
+ ParseErrorCode2[ParseErrorCode2["ColonExpected"] = 5] = "ColonExpected";
41710
+ ParseErrorCode2[ParseErrorCode2["CommaExpected"] = 6] = "CommaExpected";
41711
+ ParseErrorCode2[ParseErrorCode2["CloseBraceExpected"] = 7] = "CloseBraceExpected";
41712
+ ParseErrorCode2[ParseErrorCode2["CloseBracketExpected"] = 8] = "CloseBracketExpected";
41713
+ ParseErrorCode2[ParseErrorCode2["EndOfFileExpected"] = 9] = "EndOfFileExpected";
41714
+ ParseErrorCode2[ParseErrorCode2["InvalidCommentToken"] = 10] = "InvalidCommentToken";
41715
+ ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfComment"] = 11] = "UnexpectedEndOfComment";
41716
+ ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfString"] = 12] = "UnexpectedEndOfString";
41717
+ ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfNumber"] = 13] = "UnexpectedEndOfNumber";
41718
+ ParseErrorCode2[ParseErrorCode2["InvalidUnicode"] = 14] = "InvalidUnicode";
41719
+ ParseErrorCode2[ParseErrorCode2["InvalidEscapeCharacter"] = 15] = "InvalidEscapeCharacter";
41720
+ ParseErrorCode2[ParseErrorCode2["InvalidCharacter"] = 16] = "InvalidCharacter";
41721
+ })(ParseErrorCode || (ParseErrorCode = {}));
41722
+ }
41723
+ });
41724
+
41725
+ // src/core/mcph-parser.ts
41726
+ async function parseMchpConfig(file2, projectRoot, scopeOverride) {
41727
+ const content = readFileContent(file2.absolutePath);
41728
+ const scope = scopeOverride ?? detectScope2(file2.relativePath);
41729
+ const isGitTracked = await checkGitTracked2(file2.absolutePath, projectRoot);
41730
+ const isGitignored = await checkGitignored(file2.absolutePath, projectRoot);
41731
+ const result = {
41732
+ filePath: file2.absolutePath,
41733
+ relativePath: file2.relativePath,
41734
+ scope,
41735
+ content,
41736
+ parseErrors: [],
41737
+ isGitTracked,
41738
+ isGitignored,
41739
+ raw: null,
41740
+ positions: {},
41741
+ listEntries: { servers: [], blocked: [] },
41742
+ unknownFields: []
41743
+ };
41744
+ const errors = [];
41745
+ const tree = parseTree2(content, errors, { allowTrailingComma: true });
41746
+ if (errors.length > 0 || !tree) {
41747
+ for (const e of errors) {
41748
+ const { line, column } = offsetToPosition(content, e.offset);
41749
+ result.parseErrors.push(`Parse error at ${line}:${column} (code ${e.error})`);
41750
+ }
41751
+ return result;
41752
+ }
41753
+ if (tree.type !== "object") {
41754
+ result.parseErrors.push(".mcph.json must be a JSON object at the root");
41755
+ return result;
41756
+ }
41757
+ try {
41758
+ result.raw = JSON.parse(stripComments2(content));
41759
+ } catch {
41760
+ return result;
41761
+ }
41762
+ const rootProps = tree.children ?? [];
41763
+ for (const prop of rootProps) {
41764
+ if (prop.type !== "property" || !prop.children || prop.children.length < 2) continue;
41765
+ const keyNode = prop.children[0];
41766
+ const valueNode = prop.children[1];
41767
+ if (keyNode.type !== "string" || typeof keyNode.value !== "string") continue;
41768
+ const name = keyNode.value;
41769
+ const position = nodePosition(content, keyNode);
41770
+ if (KNOWN_FIELDS.has(name)) {
41771
+ result.positions[name] = position;
41772
+ if (name === "servers" || name === "blocked") {
41773
+ if (valueNode.type === "array" && valueNode.children) {
41774
+ for (const item of valueNode.children) {
41775
+ if (item.type === "string" && typeof item.value === "string") {
41776
+ result.listEntries[name].push({
41777
+ value: item.value,
41778
+ position: nodePosition(content, item)
41779
+ });
41780
+ }
41781
+ }
41782
+ }
41783
+ }
41784
+ } else {
41785
+ result.unknownFields.push({ name, position });
41786
+ }
41787
+ }
41788
+ return result;
41789
+ }
41790
+ function detectScope2(relativePath) {
41791
+ const normalized = relativePath.replace(/\\/g, "/");
41792
+ if (normalized.startsWith("~/")) return "global";
41793
+ if (normalized.endsWith(".mcph.local.json")) return "project-local";
41794
+ return "project";
41795
+ }
41796
+ function nodePosition(content, node) {
41797
+ const start = offsetToPosition(content, node.offset);
41798
+ const end = offsetToPosition(content, node.offset + node.length);
41799
+ return {
41800
+ line: start.line,
41801
+ column: start.column,
41802
+ endLine: end.line,
41803
+ endColumn: end.column
41804
+ };
41805
+ }
41806
+ function offsetToPosition(content, offset) {
41807
+ let line = 1;
41808
+ let column = 1;
41809
+ for (let i2 = 0; i2 < offset && i2 < content.length; i2++) {
41810
+ if (content[i2] === "\n") {
41811
+ line++;
41812
+ column = 1;
41813
+ } else {
41814
+ column++;
41815
+ }
41816
+ }
41817
+ return { line, column };
41818
+ }
41819
+ function stripComments2(src) {
41820
+ let out = "";
41821
+ let i2 = 0;
41822
+ let inString = false;
41823
+ let escape2 = false;
41824
+ while (i2 < src.length) {
41825
+ const ch = src[i2];
41826
+ if (inString) {
41827
+ out += ch;
41828
+ if (escape2) {
41829
+ escape2 = false;
41830
+ } else if (ch === "\\") {
41831
+ escape2 = true;
41832
+ } else if (ch === '"') {
41833
+ inString = false;
41834
+ }
41835
+ i2++;
41836
+ continue;
41837
+ }
41838
+ if (ch === '"') {
41839
+ inString = true;
41840
+ out += ch;
41841
+ i2++;
41842
+ continue;
41843
+ }
41844
+ if (ch === "/" && src[i2 + 1] === "/") {
41845
+ while (i2 < src.length && src[i2] !== "\n") i2++;
41846
+ continue;
41847
+ }
41848
+ if (ch === "/" && src[i2 + 1] === "*") {
41849
+ i2 += 2;
41850
+ while (i2 < src.length && !(src[i2] === "*" && src[i2 + 1] === "/")) i2++;
41851
+ i2 += 2;
41852
+ continue;
41853
+ }
41854
+ out += ch;
41855
+ i2++;
41856
+ }
41857
+ return out;
41858
+ }
41859
+ async function checkGitTracked2(filePath, projectRoot) {
41860
+ try {
41861
+ const git = getGit(projectRoot);
41862
+ const result = await git.raw(["ls-files", "--error-unmatch", filePath]);
41863
+ return result.trim().length > 0;
41864
+ } catch {
41865
+ return false;
41866
+ }
41867
+ }
41868
+ async function checkGitignored(filePath, projectRoot) {
41869
+ try {
41870
+ const git = getGit(projectRoot);
41871
+ const result = await git.raw(["check-ignore", "--", filePath]);
41872
+ return result.trim().length > 0;
41873
+ } catch {
41874
+ return false;
41875
+ }
41876
+ }
41877
+ var KNOWN_FIELDS;
41878
+ var init_mcph_parser = __esm({
41879
+ "src/core/mcph-parser.ts"() {
41880
+ "use strict";
41881
+ init_main();
41882
+ init_fs();
41883
+ init_git();
41884
+ KNOWN_FIELDS = /* @__PURE__ */ new Set(["$schema", "version", "token", "apiBase", "servers", "blocked"]);
41885
+ }
41886
+ });
41887
+
41888
+ // node_modules/.pnpm/fastest-levenshtein@1.0.16/node_modules/fastest-levenshtein/esm/mod.js
41889
+ var mod_exports = {};
41890
+ __export(mod_exports, {
41891
+ closest: () => closest,
41892
+ distance: () => distance
41893
+ });
41894
+ var peq, myers_32, myers_x, distance, closest;
41895
+ var init_mod = __esm({
41896
+ "node_modules/.pnpm/fastest-levenshtein@1.0.16/node_modules/fastest-levenshtein/esm/mod.js"() {
41897
+ peq = new Uint32Array(65536);
41898
+ myers_32 = (a, b2) => {
41899
+ const n7 = a.length;
41900
+ const m = b2.length;
41901
+ const lst = 1 << n7 - 1;
41902
+ let pv = -1;
41903
+ let mv = 0;
41904
+ let sc = n7;
41905
+ let i2 = n7;
40752
41906
  while (i2--) {
40753
41907
  peq[a.charCodeAt(i2)] |= 1 << i2;
40754
41908
  }
40755
41909
  for (i2 = 0; i2 < m; i2++) {
40756
- var eq = peq[b2.charCodeAt(i2)];
40757
- var xv = eq | mv;
41910
+ let eq = peq[b2.charCodeAt(i2)];
41911
+ const xv = eq | mv;
40758
41912
  eq |= (eq & pv) + pv ^ pv;
40759
41913
  mv |= ~(eq | pv);
40760
41914
  pv &= eq;
@@ -40774,34 +41928,34 @@ var require_mod = __commonJS({
40774
41928
  }
40775
41929
  return sc;
40776
41930
  };
40777
- var myers_x = function(b2, a) {
40778
- var n7 = a.length;
40779
- var m = b2.length;
40780
- var mhc = [];
40781
- var phc = [];
40782
- var hsize = Math.ceil(n7 / 32);
40783
- var vsize = Math.ceil(m / 32);
40784
- for (var i2 = 0; i2 < hsize; i2++) {
41931
+ myers_x = (b2, a) => {
41932
+ const n7 = a.length;
41933
+ const m = b2.length;
41934
+ const mhc = [];
41935
+ const phc = [];
41936
+ const hsize = Math.ceil(n7 / 32);
41937
+ const vsize = Math.ceil(m / 32);
41938
+ for (let i2 = 0; i2 < hsize; i2++) {
40785
41939
  phc[i2] = -1;
40786
41940
  mhc[i2] = 0;
40787
41941
  }
40788
- var j3 = 0;
41942
+ let j3 = 0;
40789
41943
  for (; j3 < vsize - 1; j3++) {
40790
- var mv_1 = 0;
40791
- var pv_1 = -1;
40792
- var start_1 = j3 * 32;
40793
- var vlen_1 = Math.min(32, m) + start_1;
40794
- for (var k3 = start_1; k3 < vlen_1; k3++) {
41944
+ let mv2 = 0;
41945
+ let pv2 = -1;
41946
+ const start2 = j3 * 32;
41947
+ const vlen2 = Math.min(32, m) + start2;
41948
+ for (let k3 = start2; k3 < vlen2; k3++) {
40795
41949
  peq[b2.charCodeAt(k3)] |= 1 << k3;
40796
41950
  }
40797
- for (var i2 = 0; i2 < n7; i2++) {
40798
- var eq = peq[a.charCodeAt(i2)];
40799
- var pb = phc[i2 / 32 | 0] >>> i2 & 1;
40800
- var mb = mhc[i2 / 32 | 0] >>> i2 & 1;
40801
- var xv = eq | mv_1;
40802
- var xh = ((eq | mb) & pv_1) + pv_1 ^ pv_1 | eq | mb;
40803
- var ph = mv_1 | ~(xh | pv_1);
40804
- var mh = pv_1 & xh;
41951
+ for (let i2 = 0; i2 < n7; i2++) {
41952
+ const eq = peq[a.charCodeAt(i2)];
41953
+ const pb = phc[i2 / 32 | 0] >>> i2 & 1;
41954
+ const mb = mhc[i2 / 32 | 0] >>> i2 & 1;
41955
+ const xv = eq | mv2;
41956
+ const xh = ((eq | mb) & pv2) + pv2 ^ pv2 | eq | mb;
41957
+ let ph = mv2 | ~(xh | pv2);
41958
+ let mh = pv2 & xh;
40805
41959
  if (ph >>> 31 ^ pb) {
40806
41960
  phc[i2 / 32 | 0] ^= 1 << i2;
40807
41961
  }
@@ -40810,29 +41964,29 @@ var require_mod = __commonJS({
40810
41964
  }
40811
41965
  ph = ph << 1 | pb;
40812
41966
  mh = mh << 1 | mb;
40813
- pv_1 = mh | ~(xv | ph);
40814
- mv_1 = ph & xv;
41967
+ pv2 = mh | ~(xv | ph);
41968
+ mv2 = ph & xv;
40815
41969
  }
40816
- for (var k3 = start_1; k3 < vlen_1; k3++) {
41970
+ for (let k3 = start2; k3 < vlen2; k3++) {
40817
41971
  peq[b2.charCodeAt(k3)] = 0;
40818
41972
  }
40819
41973
  }
40820
- var mv = 0;
40821
- var pv = -1;
40822
- var start = j3 * 32;
40823
- var vlen = Math.min(32, m - start) + start;
40824
- for (var k3 = start; k3 < vlen; k3++) {
41974
+ let mv = 0;
41975
+ let pv = -1;
41976
+ const start = j3 * 32;
41977
+ const vlen = Math.min(32, m - start) + start;
41978
+ for (let k3 = start; k3 < vlen; k3++) {
40825
41979
  peq[b2.charCodeAt(k3)] |= 1 << k3;
40826
41980
  }
40827
- var score = m;
40828
- for (var i2 = 0; i2 < n7; i2++) {
40829
- var eq = peq[a.charCodeAt(i2)];
40830
- var pb = phc[i2 / 32 | 0] >>> i2 & 1;
40831
- var mb = mhc[i2 / 32 | 0] >>> i2 & 1;
40832
- var xv = eq | mv;
40833
- var xh = ((eq | mb) & pv) + pv ^ pv | eq | mb;
40834
- var ph = mv | ~(xh | pv);
40835
- var mh = pv & xh;
41981
+ let score = m;
41982
+ for (let i2 = 0; i2 < n7; i2++) {
41983
+ const eq = peq[a.charCodeAt(i2)];
41984
+ const pb = phc[i2 / 32 | 0] >>> i2 & 1;
41985
+ const mb = mhc[i2 / 32 | 0] >>> i2 & 1;
41986
+ const xv = eq | mv;
41987
+ const xh = ((eq | mb) & pv) + pv ^ pv | eq | mb;
41988
+ let ph = mv | ~(xh | pv);
41989
+ let mh = pv & xh;
40836
41990
  score += ph >>> m - 1 & 1;
40837
41991
  score -= mh >>> m - 1 & 1;
40838
41992
  if (ph >>> 31 ^ pb) {
@@ -40846,14 +42000,14 @@ var require_mod = __commonJS({
40846
42000
  pv = mh | ~(xv | ph);
40847
42001
  mv = ph & xv;
40848
42002
  }
40849
- for (var k3 = start; k3 < vlen; k3++) {
42003
+ for (let k3 = start; k3 < vlen; k3++) {
40850
42004
  peq[b2.charCodeAt(k3)] = 0;
40851
42005
  }
40852
42006
  return score;
40853
42007
  };
40854
- var distance = function(a, b2) {
42008
+ distance = (a, b2) => {
40855
42009
  if (a.length < b2.length) {
40856
- var tmp = b2;
42010
+ const tmp = b2;
40857
42011
  b2 = a;
40858
42012
  a = tmp;
40859
42013
  }
@@ -40865,12 +42019,11 @@ var require_mod = __commonJS({
40865
42019
  }
40866
42020
  return myers_x(a, b2);
40867
42021
  };
40868
- exports.distance = distance;
40869
- var closest = function(str, arr) {
40870
- var min_distance = Infinity;
40871
- var min_index = 0;
40872
- for (var i2 = 0; i2 < arr.length; i2++) {
40873
- var dist = distance(str, arr[i2]);
42022
+ closest = (str, arr) => {
42023
+ let min_distance = Infinity;
42024
+ let min_index = 0;
42025
+ for (let i2 = 0; i2 < arr.length; i2++) {
42026
+ const dist = distance(str, arr[i2]);
40874
42027
  if (dist < min_distance) {
40875
42028
  min_distance = dist;
40876
42029
  min_index = i2;
@@ -40878,7 +42031,6 @@ var require_mod = __commonJS({
40878
42031
  }
40879
42032
  return arr[min_index];
40880
42033
  };
40881
- exports.closest = closest;
40882
42034
  }
40883
42035
  });
40884
42036
 
@@ -40893,7 +42045,7 @@ var require_levenshtein = __commonJS({
40893
42045
  } catch (err) {
40894
42046
  console.log("Collator could not be initialized and wouldn't be used");
40895
42047
  }
40896
- var levenshtein3 = require_mod();
42048
+ var levenshtein3 = (init_mod(), __toCommonJS(mod_exports));
40897
42049
  var prevRow = [], str2Char = [];
40898
42050
  var Levenshtein = {
40899
42051
  /**
@@ -41383,8 +42535,8 @@ function isAlwaysLoaded(file2) {
41383
42535
  if (rel.includes("/rules/")) {
41384
42536
  return !hasPathsFrontmatter(file2.content);
41385
42537
  }
41386
- const basename3 = rel.split("/").pop() ?? "";
41387
- return ALWAYS_LOADED_BASENAMES.has(basename3);
42538
+ const basename4 = rel.split("/").pop() ?? "";
42539
+ return ALWAYS_LOADED_BASENAMES.has(basename4);
41388
42540
  }
41389
42541
  function computeSectionCosts(file2) {
41390
42542
  if (file2.sections.length === 0) return [];
@@ -42672,17 +43824,19 @@ async function checkMcpEnv(config2, _projectRoot) {
42672
43824
  }
42673
43825
  }
42674
43826
  }
42675
- for (const value of allValues) {
42676
- const refs = extractEnvVarRefs(value);
42677
- for (const ref of refs) {
42678
- if (!(ref.varName in process.env)) {
42679
- issues.push({
42680
- severity: "info",
42681
- check: "mcp-env",
42682
- ruleId: "unset-variable",
42683
- line: server2.line,
42684
- message: `Server "${server2.name}": environment variable "${ref.varName}" is not set`
42685
- });
43827
+ if (config2.client !== "continue") {
43828
+ for (const value of allValues) {
43829
+ const refs = extractEnvVarRefs(value);
43830
+ for (const ref of refs) {
43831
+ if (!(ref.varName in process.env)) {
43832
+ issues.push({
43833
+ severity: "info",
43834
+ check: "mcp-env",
43835
+ ruleId: "unset-variable",
43836
+ line: server2.line,
43837
+ message: `Server "${server2.name}": environment variable "${ref.varName}" is not set`
43838
+ });
43839
+ }
42686
43840
  }
42687
43841
  }
42688
43842
  }
@@ -42986,6 +44140,230 @@ var init_redundancy2 = __esm({
42986
44140
  }
42987
44141
  });
42988
44142
 
44143
+ // src/core/checks/mcph/token-security.ts
44144
+ async function checkMcphTokenSecurity(config2, _projectRoot, options = {}) {
44145
+ const issues = [];
44146
+ if (config2.parseErrors.length > 0) return issues;
44147
+ const tokenPos = config2.positions.token;
44148
+ const tokenValue = typeof config2.raw?.token === "string" ? config2.raw.token : null;
44149
+ if (tokenPos && tokenValue !== null && !TOKEN_PATTERN.test(tokenValue)) {
44150
+ issues.push({
44151
+ severity: "error",
44152
+ check: "mcph-token-security",
44153
+ ruleId: "mcph-config/invalid-token-format",
44154
+ line: tokenPos.line,
44155
+ message: `"token" does not match expected format ^mcp_pat_[A-Za-z0-9_-]+$`,
44156
+ suggestion: `Check that the token was copied in full. A valid mcp.hosting PAT looks like: mcp_pat_aBcDeFg123...
44157
+ If the token was truncated or wrapped in quotes elsewhere, re-issue it from https://mcp.hosting/settings/tokens.`
44158
+ });
44159
+ }
44160
+ if (tokenPos && tokenValue !== null && config2.scope === "project" && config2.isGitTracked) {
44161
+ issues.push({
44162
+ severity: "error",
44163
+ check: "mcph-token-security",
44164
+ ruleId: "mcph-config/token-in-project-scope",
44165
+ line: tokenPos.line,
44166
+ message: `"token" in a git-tracked project-scope .mcph.json \u2014 PAT will leak via git history`,
44167
+ suggestion: `Delete line ${tokenPos.line} (the "token" field) from ${config2.relativePath}.
44168
+ Then pick one:
44169
+ \u2022 user-global: move it to ~/.mcph.json instead
44170
+ \u2022 machine-local: move it to .mcph.local.json (and add that file to .gitignore)
44171
+ \u2022 env var: export MCPH_TOKEN in your shell \u2014 the mcph CLI reads it automatically
44172
+ If this token was already committed, ROTATE it now: https://mcp.hosting/settings/tokens
44173
+ (Deleting the line does not purge the value from git history.)`
44174
+ });
44175
+ }
44176
+ const alreadyFlaggedAsProjectLeak = tokenPos && tokenValue !== null && config2.scope === "project" && config2.isGitTracked;
44177
+ if (tokenPos && tokenValue !== null && !alreadyFlaggedAsProjectLeak) {
44178
+ const severity = options.strictEnvToken ? "error" : "warning";
44179
+ issues.push({
44180
+ severity,
44181
+ check: "mcph-token-security",
44182
+ ruleId: "mcph-config/prefer-env-token",
44183
+ line: tokenPos.line,
44184
+ message: `prefer MCPH_TOKEN env var over a file-stored token in ${config2.relativePath}`,
44185
+ suggestion: `Delete line ${tokenPos.line} (the "token" field) and export instead:
44186
+ ` + EXPORT_EXAMPLES + `
44187
+ Tokens in files survive backups, screen shares, cloud sync (Time Machine, Dropbox, OneDrive), and editor indexing.`
44188
+ });
44189
+ }
44190
+ return issues;
44191
+ }
44192
+ var TOKEN_PATTERN, EXPORT_EXAMPLES;
44193
+ var init_token_security = __esm({
44194
+ "src/core/checks/mcph/token-security.ts"() {
44195
+ "use strict";
44196
+ TOKEN_PATTERN = /^mcp_pat_[A-Za-z0-9_-]+$/;
44197
+ EXPORT_EXAMPLES = [
44198
+ ' bash/zsh: export MCPH_TOKEN="mcp_pat_***"',
44199
+ ' fish: set -x MCPH_TOKEN "mcp_pat_***"',
44200
+ ' PowerShell: $env:MCPH_TOKEN = "mcp_pat_***"',
44201
+ " direnv: echo 'export MCPH_TOKEN=mcp_pat_***' >> .envrc"
44202
+ ].join("\n");
44203
+ }
44204
+ });
44205
+
44206
+ // src/core/checks/mcph/apibase.ts
44207
+ function isPrivateHost(hostname3) {
44208
+ return PRIVATE_HOST_PATTERNS.some((p2) => p2.test(hostname3));
44209
+ }
44210
+ async function checkMcphApibase(config2, _projectRoot) {
44211
+ const issues = [];
44212
+ if (config2.parseErrors.length > 0) return issues;
44213
+ const pos = config2.positions.apiBase;
44214
+ const value = typeof config2.raw?.apiBase === "string" ? config2.raw.apiBase : null;
44215
+ if (!pos || value === null) return issues;
44216
+ let parsed;
44217
+ try {
44218
+ parsed = new URL(value);
44219
+ } catch {
44220
+ issues.push({
44221
+ severity: "error",
44222
+ check: "mcph-apibase",
44223
+ ruleId: "mcph-config/invalid-apibase",
44224
+ line: pos.line,
44225
+ message: `"apiBase" is not a valid URL: ${value}`,
44226
+ suggestion: `Use an absolute http(s) URL, e.g. "https://mcp.hosting".`
44227
+ });
44228
+ return issues;
44229
+ }
44230
+ if (parsed.protocol === "http:" && !isPrivateHost(parsed.hostname)) {
44231
+ issues.push({
44232
+ severity: "warning",
44233
+ check: "mcph-apibase",
44234
+ ruleId: "mcph-config/insecure-apibase",
44235
+ line: pos.line,
44236
+ message: `"apiBase" uses plaintext HTTP to a public host (${parsed.hostname})`,
44237
+ suggestion: `Use https:// instead. Plaintext HTTP exposes your MCPH_TOKEN on the wire.
44238
+ Private hosts (localhost, 10.*, 192.168.*, 172.16-31.*, *.local, *.internal) are allowed without TLS for dev workflows.`
44239
+ });
44240
+ }
44241
+ return issues;
44242
+ }
44243
+ var PRIVATE_HOST_PATTERNS;
44244
+ var init_apibase = __esm({
44245
+ "src/core/checks/mcph/apibase.ts"() {
44246
+ "use strict";
44247
+ PRIVATE_HOST_PATTERNS = [
44248
+ /^localhost$/i,
44249
+ /^127\./,
44250
+ /^::1$/,
44251
+ /^10\./,
44252
+ /^192\.168\./,
44253
+ /^172\.(1[6-9]|2\d|3[01])\./,
44254
+ /\.local$/i,
44255
+ /\.internal$/i,
44256
+ /\.test$/i,
44257
+ /\.example$/i
44258
+ ];
44259
+ }
44260
+ });
44261
+
44262
+ // src/core/checks/mcph/schema-conformance.ts
44263
+ async function checkMcphSchemaConformance(config2, _projectRoot) {
44264
+ const issues = [];
44265
+ if (config2.parseErrors.length > 0) return issues;
44266
+ for (const field of config2.unknownFields) {
44267
+ issues.push({
44268
+ severity: "warning",
44269
+ check: "mcph-schema-conformance",
44270
+ ruleId: "mcph-config/unknown-field",
44271
+ line: field.position.line,
44272
+ message: `unknown field "${field.name}" \u2014 not in the mcph config schema`,
44273
+ suggestion: `Known fields: $schema, version, token, apiBase, servers, blocked. Check for typos (e.g. "tokens" vs "token", "blockList" vs "blocked").`
44274
+ });
44275
+ }
44276
+ const versionPos = config2.positions.version;
44277
+ const version2 = typeof config2.raw?.version === "number" ? config2.raw.version : void 0;
44278
+ if (versionPos && typeof version2 === "number" && version2 < CURRENT_SCHEMA_VERSION) {
44279
+ issues.push({
44280
+ severity: "info",
44281
+ check: "mcph-schema-conformance",
44282
+ ruleId: "mcph-config/stale-version",
44283
+ line: versionPos.line,
44284
+ message: `"version": ${version2} is older than the current schema version (${CURRENT_SCHEMA_VERSION})`,
44285
+ suggestion: `Update to "version": ${CURRENT_SCHEMA_VERSION}. Older versions continue to load but may miss newer fields.`
44286
+ });
44287
+ }
44288
+ return issues;
44289
+ }
44290
+ var CURRENT_SCHEMA_VERSION;
44291
+ var init_schema_conformance = __esm({
44292
+ "src/core/checks/mcph/schema-conformance.ts"() {
44293
+ "use strict";
44294
+ CURRENT_SCHEMA_VERSION = 1;
44295
+ }
44296
+ });
44297
+
44298
+ // src/core/checks/mcph/lists.ts
44299
+ async function checkMcphLists(config2, _projectRoot) {
44300
+ const issues = [];
44301
+ if (config2.parseErrors.length > 0) return issues;
44302
+ const servers = config2.listEntries.servers;
44303
+ const blocked = config2.listEntries.blocked;
44304
+ const blockedSet = new Set(blocked.map((e) => e.value));
44305
+ for (const entry of servers) {
44306
+ if (blockedSet.has(entry.value)) {
44307
+ issues.push({
44308
+ severity: "warning",
44309
+ check: "mcph-lists",
44310
+ ruleId: "mcph-config/allowlist-denylist-conflict",
44311
+ line: entry.position.line,
44312
+ message: `server "${entry.value}" is in both "servers" (allow-list) and "blocked" (deny-list)`,
44313
+ suggestion: `Remove "${entry.value}" from one of the two lists. "blocked" wins in practice (deny > allow), so the allow-list entry is dead weight.`
44314
+ });
44315
+ }
44316
+ }
44317
+ for (const listName of ["servers", "blocked"]) {
44318
+ const entries = config2.listEntries[listName];
44319
+ const seen = /* @__PURE__ */ new Map();
44320
+ for (const entry of entries) {
44321
+ const prevLine = seen.get(entry.value);
44322
+ if (prevLine !== void 0) {
44323
+ issues.push({
44324
+ severity: "info",
44325
+ check: "mcph-lists",
44326
+ ruleId: "mcph-config/duplicate-entries",
44327
+ line: entry.position.line,
44328
+ message: `"${entry.value}" appears multiple times in "${listName}" (first at line ${prevLine})`,
44329
+ suggestion: `Remove the duplicate entry at line ${entry.position.line}.`
44330
+ });
44331
+ } else {
44332
+ seen.set(entry.value, entry.position.line);
44333
+ }
44334
+ }
44335
+ }
44336
+ return issues;
44337
+ }
44338
+ var init_lists = __esm({
44339
+ "src/core/checks/mcph/lists.ts"() {
44340
+ "use strict";
44341
+ }
44342
+ });
44343
+
44344
+ // src/core/checks/mcph/gitignore.ts
44345
+ import * as path9 from "node:path";
44346
+ async function checkMcphGitignore(config2, _projectRoot) {
44347
+ const issues = [];
44348
+ if (config2.scope === "project-local" && !config2.isGitignored) {
44349
+ const basename4 = path9.basename(config2.filePath);
44350
+ issues.push({
44351
+ severity: "error",
44352
+ check: "mcph-gitignore",
44353
+ ruleId: "mcph-config/local-file-not-gitignored",
44354
+ line: 1,
44355
+ message: `${basename4} is not covered by .gitignore \u2014 machine-local overrides can leak via git`,
44356
+ suggestion: `Add "${basename4}" to .gitignore in your project root.`
44357
+ });
44358
+ }
44359
+ return issues;
44360
+ }
44361
+ var init_gitignore = __esm({
44362
+ "src/core/checks/mcph/gitignore.ts"() {
44363
+ "use strict";
44364
+ }
44365
+ });
44366
+
42989
44367
  // src/core/session-parser.ts
42990
44368
  import { readFile } from "node:fs/promises";
42991
44369
  function encodeProjectDir(fsPath) {
@@ -43262,7 +44640,7 @@ var init_session_scanner = __esm({
43262
44640
  });
43263
44641
 
43264
44642
  // src/core/checks/session/missing-secret.ts
43265
- import { resolve as resolve5, basename as basename2 } from "node:path";
44643
+ import { resolve as resolve5, basename as basename3 } from "node:path";
43266
44644
  function normalizePath(p2) {
43267
44645
  return resolve5(p2).replace(/\\/g, "/").toLowerCase();
43268
44646
  }
@@ -43286,7 +44664,7 @@ async function checkMissingSecret(ctx) {
43286
44664
  if (s.repo) byName.get(s.name).add(s.repo);
43287
44665
  }
43288
44666
  const currentNorm = normalizePath(ctx.currentProject);
43289
- const currentBase = basename2(currentNorm);
44667
+ const currentBase = basename3(currentNorm);
43290
44668
  for (const [secretName, projects] of byName) {
43291
44669
  const normalizedProjects = [...projects].map(normalizePath);
43292
44670
  const currentHas = normalizedProjects.some((p2) => {
@@ -43297,7 +44675,7 @@ async function checkMissingSecret(ctx) {
43297
44675
  if (currentHas) continue;
43298
44676
  const siblingMatches = ctx.siblings.filter((sib) => {
43299
44677
  const sibNorm = normalizePath(sib.path);
43300
- const sibBase = basename2(sibNorm);
44678
+ const sibBase = basename3(sibNorm);
43301
44679
  return normalizedProjects.some((p2) => {
43302
44680
  if (p2 === sibNorm) return true;
43303
44681
  const lastSegment = p2.split("/").pop() || "";
@@ -43333,17 +44711,20 @@ import { readFile as readFile2 } from "node:fs/promises";
43333
44711
  import { join as join6 } from "node:path";
43334
44712
  import { existsSync as existsSync2 } from "node:fs";
43335
44713
  function calculateOverlap(a, b2) {
43336
- const linesA = a.split("\n").map((l) => l.trim()).filter((l) => l.length > 3);
44714
+ const linesA = new Set(
44715
+ a.split("\n").map((l) => l.trim()).filter((l) => l.length > 3)
44716
+ );
43337
44717
  const linesB = new Set(
43338
44718
  b2.split("\n").map((l) => l.trim()).filter((l) => l.length > 3)
43339
44719
  );
43340
- if (linesA.length === 0 && linesB.size === 0) return 1;
43341
- if (linesA.length === 0 || linesB.size === 0) return 0;
43342
- let matches = 0;
44720
+ if (linesA.size === 0 && linesB.size === 0) return 1;
44721
+ if (linesA.size === 0 || linesB.size === 0) return 0;
44722
+ let intersection2 = 0;
43343
44723
  for (const line of linesA) {
43344
- if (linesB.has(line)) matches++;
44724
+ if (linesB.has(line)) intersection2++;
43345
44725
  }
43346
- return matches / Math.max(linesA.length, linesB.size);
44726
+ const unionSize = linesA.size + linesB.size - intersection2;
44727
+ return intersection2 / unionSize;
43347
44728
  }
43348
44729
  async function checkDivergedFile(ctx) {
43349
44730
  const issues = [];
@@ -43507,16 +44888,19 @@ var init_stale_memory = __esm({
43507
44888
 
43508
44889
  // src/core/checks/session/duplicate-memory.ts
43509
44890
  function calculateLineOverlap2(a, b2) {
43510
- const linesA = a.split("\n").map((l) => l.trim()).filter((l) => l.length > 5);
44891
+ const linesA = new Set(
44892
+ a.split("\n").map((l) => l.trim()).filter((l) => l.length > 5)
44893
+ );
43511
44894
  const linesB = new Set(
43512
44895
  b2.split("\n").map((l) => l.trim()).filter((l) => l.length > 5)
43513
44896
  );
43514
- if (linesA.length === 0 || linesB.size === 0) return 0;
43515
- let matches = 0;
44897
+ if (linesA.size === 0 || linesB.size === 0) return 0;
44898
+ let intersection2 = 0;
43516
44899
  for (const line of linesA) {
43517
- if (linesB.has(line)) matches++;
44900
+ if (linesB.has(line)) intersection2++;
43518
44901
  }
43519
- return matches / Math.max(linesA.length, linesB.size);
44902
+ const unionSize = linesA.size + linesB.size - intersection2;
44903
+ return intersection2 / unionSize;
43520
44904
  }
43521
44905
  async function checkDuplicateMemory(ctx) {
43522
44906
  const issues = [];
@@ -43526,6 +44910,9 @@ async function checkDuplicateMemory(ctx) {
43526
44910
  const a = ctx.memories[i2];
43527
44911
  const b2 = ctx.memories[j3];
43528
44912
  if (a.projectDir === b2.projectDir) continue;
44913
+ const aIsCurrent = projectDirMatchesPath(a.projectDir, ctx.currentProject);
44914
+ const bIsCurrent = projectDirMatchesPath(b2.projectDir, ctx.currentProject);
44915
+ if (!aIsCurrent && !bIsCurrent) continue;
43529
44916
  if (a.content.length < 50 || b2.content.length < 50) continue;
43530
44917
  const overlap = calculateLineOverlap2(a.content, b2.content);
43531
44918
  if (overlap < 0.6) continue;
@@ -43552,6 +44939,7 @@ async function checkDuplicateMemory(ctx) {
43552
44939
  var init_duplicate_memory = __esm({
43553
44940
  "src/core/checks/session/duplicate-memory.ts"() {
43554
44941
  "use strict";
44942
+ init_session_parser();
43555
44943
  }
43556
44944
  });
43557
44945
 
@@ -43623,7 +45011,7 @@ async function checkLoopDetection(ctx) {
43623
45011
  }
43624
45012
  const cycles = findCyclicPatterns(displays);
43625
45013
  for (const { cycle, repeats: reps } of cycles) {
43626
- const cycleStr = cycle.map((c3) => c3.length > 40 ? c3.slice(0, 37) + "..." : c3).join(" \u2192 ");
45014
+ const cycleStr = cycle.map((c3) => c3.length > 40 ? c3.slice(0, 37) + "..." : c3).join(" -> ");
43627
45015
  issues.push({
43628
45016
  severity: "warning",
43629
45017
  check: "session-loop-detection",
@@ -43810,7 +45198,7 @@ async function findSecretUsages(projectRoot) {
43810
45198
  }
43811
45199
  function contextMentionsSecret(files, secretName) {
43812
45200
  const escaped = secretName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
43813
- const pattern = new RegExp(escaped.replace(/_/g, "[_\\s-]?"), "i");
45201
+ const pattern = new RegExp(`\\b${escaped.replace(/_/g, "[_\\s-]")}\\b`, "i");
43814
45202
  return files.some((f) => pattern.test(f.content));
43815
45203
  }
43816
45204
  async function checkCiSecrets(files, projectRoot) {
@@ -43854,7 +45242,7 @@ import { readFileSync as readFileSync4 } from "node:fs";
43854
45242
  import { resolve as resolve8, dirname as dirname3 } from "node:path";
43855
45243
  import { fileURLToPath } from "node:url";
43856
45244
  function loadVersion() {
43857
- if (true) return "0.9.16";
45245
+ if (true) return "0.9.18";
43858
45246
  const __dir = dirname3(fileURLToPath(import.meta.url));
43859
45247
  const pkgPath = resolve8(__dir, "../package.json");
43860
45248
  const pkg = JSON.parse(readFileSync4(pkgPath, "utf-8"));
@@ -43872,13 +45260,17 @@ var init_version2 = __esm({
43872
45260
  function hasMcpChecks(checks) {
43873
45261
  return checks.some((c3) => c3.startsWith("mcp-"));
43874
45262
  }
45263
+ function hasMcphChecks(checks) {
45264
+ return checks.some((c3) => c3.startsWith("mcph-"));
45265
+ }
43875
45266
  function hasSessionChecks(checks) {
43876
45267
  return checks.some((c3) => c3.startsWith("session-"));
43877
45268
  }
43878
45269
  async function runAudit(projectRoot, activeChecks, options = {}) {
43879
45270
  const fileResults = [];
43880
- const shouldRunContextChecks = !options.mcpOnly && !options.sessionOnly;
45271
+ const shouldRunContextChecks = !options.mcpOnly && !options.mcphOnly && !options.sessionOnly;
43881
45272
  const shouldRunMcpChecks = options.mcp || options.mcpGlobal || options.mcpOnly || hasMcpChecks(activeChecks);
45273
+ const shouldRunMcphChecks = options.mcph || options.mcphGlobal || options.mcphOnly || hasMcphChecks(activeChecks);
43882
45274
  const shouldRunSessionChecks = options.session || options.sessionOnly || hasSessionChecks(activeChecks);
43883
45275
  if (shouldRunContextChecks) {
43884
45276
  const discovered = await scanForContextFiles(projectRoot, {
@@ -43997,6 +45389,68 @@ async function runAudit(projectRoot, activeChecks, options = {}) {
43997
45389
  });
43998
45390
  }
43999
45391
  }
45392
+ if (shouldRunMcphChecks) {
45393
+ const projectMcphFiles = await scanForMcphConfigs(projectRoot);
45394
+ const mcphConfigs = await Promise.all(
45395
+ projectMcphFiles.map(
45396
+ (f) => parseMchpConfig(
45397
+ f,
45398
+ projectRoot,
45399
+ f.relativePath.endsWith(".mcph.local.json") ? "project-local" : "project"
45400
+ )
45401
+ )
45402
+ );
45403
+ if (options.mcphGlobal) {
45404
+ const globalMcphFiles = await scanGlobalMcphConfigs();
45405
+ const globalMcphConfigs = await Promise.all(
45406
+ globalMcphFiles.map((f) => parseMchpConfig(f, projectRoot, "global"))
45407
+ );
45408
+ mcphConfigs.push(...globalMcphConfigs);
45409
+ }
45410
+ const activeMcphChecks = activeChecks.filter((c3) => c3.startsWith("mcph-"));
45411
+ const mcphChecksToRun = activeMcphChecks.length > 0 ? activeMcphChecks : options.mcph || options.mcphGlobal || options.mcphOnly ? ALL_MCPH_CHECKS : [];
45412
+ for (const config2 of mcphConfigs) {
45413
+ const checkPromises = [];
45414
+ if (mcphChecksToRun.includes("mcph-token-security")) {
45415
+ checkPromises.push(
45416
+ checkMcphTokenSecurity(config2, projectRoot, {
45417
+ strictEnvToken: options.mcphStrictEnvToken
45418
+ })
45419
+ );
45420
+ }
45421
+ if (mcphChecksToRun.includes("mcph-apibase")) {
45422
+ checkPromises.push(checkMcphApibase(config2, projectRoot));
45423
+ }
45424
+ if (mcphChecksToRun.includes("mcph-schema-conformance")) {
45425
+ checkPromises.push(checkMcphSchemaConformance(config2, projectRoot));
45426
+ }
45427
+ if (mcphChecksToRun.includes("mcph-lists")) {
45428
+ checkPromises.push(checkMcphLists(config2, projectRoot));
45429
+ }
45430
+ if (mcphChecksToRun.includes("mcph-gitignore")) {
45431
+ checkPromises.push(checkMcphGitignore(config2, projectRoot));
45432
+ }
45433
+ const results = await Promise.all(checkPromises);
45434
+ const issues = results.flat();
45435
+ for (const err of config2.parseErrors) {
45436
+ issues.push({
45437
+ severity: "error",
45438
+ check: "mcph-schema-conformance",
45439
+ ruleId: "mcph-config/parse-error",
45440
+ line: 1,
45441
+ message: err
45442
+ });
45443
+ }
45444
+ const lines = config2.content.split("\n").length;
45445
+ fileResults.push({
45446
+ path: config2.relativePath,
45447
+ isSymlink: false,
45448
+ tokens: countTokens(config2.content),
45449
+ lines,
45450
+ issues
45451
+ });
45452
+ }
45453
+ }
44000
45454
  if (shouldRunSessionChecks) {
44001
45455
  const activeSessionChecks = activeChecks.filter(
44002
45456
  (c3) => c3.startsWith("session-")
@@ -44064,13 +45518,14 @@ async function runAudit(projectRoot, activeChecks, options = {}) {
44064
45518
  }
44065
45519
  };
44066
45520
  }
44067
- var ALL_CHECKS, ALL_MCP_CHECKS, ALL_SESSION_CHECKS;
45521
+ var ALL_CHECKS, ALL_MCP_CHECKS, ALL_MCPH_CHECKS, ALL_SESSION_CHECKS;
44068
45522
  var init_audit = __esm({
44069
45523
  "src/core/audit.ts"() {
44070
45524
  "use strict";
44071
45525
  init_scanner();
44072
45526
  init_parser();
44073
45527
  init_mcp_parser();
45528
+ init_mcph_parser();
44074
45529
  init_tokens();
44075
45530
  init_paths();
44076
45531
  init_commands();
@@ -44088,6 +45543,11 @@ var init_audit = __esm({
44088
45543
  init_urls();
44089
45544
  init_consistency();
44090
45545
  init_redundancy2();
45546
+ init_token_security();
45547
+ init_apibase();
45548
+ init_schema_conformance();
45549
+ init_lists();
45550
+ init_gitignore();
44091
45551
  init_session_scanner();
44092
45552
  init_missing_secret();
44093
45553
  init_diverged_file();
@@ -44121,6 +45581,13 @@ var init_audit = __esm({
44121
45581
  "mcp-consistency",
44122
45582
  "mcp-redundancy"
44123
45583
  ];
45584
+ ALL_MCPH_CHECKS = [
45585
+ "mcph-token-security",
45586
+ "mcph-apibase",
45587
+ "mcph-schema-conformance",
45588
+ "mcph-lists",
45589
+ "mcph-gitignore"
45590
+ ];
44124
45591
  ALL_SESSION_CHECKS = [
44125
45592
  "session-missing-secret",
44126
45593
  "session-diverged-file",
@@ -44717,9 +46184,8 @@ function applyFixes(result, options = {}) {
44717
46184
  const content = fs7.readFileSync(filePath, "utf-8");
44718
46185
  const lines = content.split("\n");
44719
46186
  let modified = false;
44720
- const sortedFixes = [...fixes].sort((a, b2) => b2.line - a.line);
44721
46187
  const fixesByLine = /* @__PURE__ */ new Map();
44722
- for (const fix of sortedFixes) {
46188
+ for (const fix of fixes) {
44723
46189
  const existing = fixesByLine.get(fix.line) || [];
44724
46190
  existing.push(fix);
44725
46191
  fixesByLine.set(fix.line, existing);
@@ -44734,7 +46200,7 @@ function applyFixes(result, options = {}) {
44734
46200
  totalFixes++;
44735
46201
  const prefix = dryRun ? source_default.cyan(" Would fix") : source_default.green(" Fixed");
44736
46202
  log(
44737
- prefix + ` Line ${fix.line}: ${source_default.dim(fix.oldText)} ${source_default.dim("\u2192")} ${fix.newText}`
46203
+ prefix + ` Line ${fix.line}: ${source_default.dim(fix.oldText)} ${source_default.dim("->")} ${fix.newText}`
44738
46204
  );
44739
46205
  }
44740
46206
  }
@@ -44770,13 +46236,13 @@ var init_fixer = __esm({
44770
46236
 
44771
46237
  // src/mcp/server.ts
44772
46238
  var server_exports = {};
44773
- import * as path9 from "node:path";
46239
+ import * as path10 from "node:path";
44774
46240
  function validateProjectPath(rawPath) {
44775
46241
  if (!rawPath) return process.cwd();
44776
46242
  if (PATH_DISALLOWED.test(rawPath)) {
44777
46243
  throw new Error("projectPath contains disallowed characters");
44778
46244
  }
44779
- const resolved = path9.resolve(rawPath);
46245
+ const resolved = path10.resolve(rawPath);
44780
46246
  if (!isDirectory(resolved)) {
44781
46247
  throw new Error("projectPath is not an existing directory");
44782
46248
  }
@@ -44862,7 +46328,7 @@ var init_server3 = __esm({
44862
46328
  try {
44863
46329
  validateFilePathInput(filePath);
44864
46330
  const root = validateProjectPath(projectPath);
44865
- const resolved = path9.resolve(root, filePath);
46331
+ const resolved = path10.resolve(root, filePath);
44866
46332
  const result = {
44867
46333
  path: filePath,
44868
46334
  exists: fileExists(resolved) || isDirectory(resolved)
@@ -46197,14 +47663,14 @@ var require_suggestSimilar = __commonJS({
46197
47663
  const minSimilarity = 0.4;
46198
47664
  candidates.forEach((candidate) => {
46199
47665
  if (candidate.length <= 1) return;
46200
- const distance = editDistance(word, candidate);
47666
+ const distance2 = editDistance(word, candidate);
46201
47667
  const length = Math.max(word.length, candidate.length);
46202
- const similarity = (length - distance) / length;
47668
+ const similarity = (length - distance2) / length;
46203
47669
  if (similarity > minSimilarity) {
46204
- if (distance < bestDistance) {
46205
- bestDistance = distance;
47670
+ if (distance2 < bestDistance) {
47671
+ bestDistance = distance2;
46206
47672
  similar = [candidate];
46207
- } else if (distance === bestDistance) {
47673
+ } else if (distance2 === bestDistance) {
46208
47674
  similar.push(candidate);
46209
47675
  }
46210
47676
  }
@@ -46232,7 +47698,7 @@ var require_command = __commonJS({
46232
47698
  "node_modules/.pnpm/commander@14.0.3/node_modules/commander/lib/command.js"(exports) {
46233
47699
  var EventEmitter2 = __require("node:events").EventEmitter;
46234
47700
  var childProcess = __require("node:child_process");
46235
- var path12 = __require("node:path");
47701
+ var path13 = __require("node:path");
46236
47702
  var fs10 = __require("node:fs");
46237
47703
  var process11 = __require("node:process");
46238
47704
  var { Argument: Argument2, humanReadableArgName } = require_argument();
@@ -47245,9 +48711,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
47245
48711
  let launchWithNode = false;
47246
48712
  const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
47247
48713
  function findFile(baseDir, baseName) {
47248
- const localBin = path12.resolve(baseDir, baseName);
48714
+ const localBin = path13.resolve(baseDir, baseName);
47249
48715
  if (fs10.existsSync(localBin)) return localBin;
47250
- if (sourceExt.includes(path12.extname(baseName))) return void 0;
48716
+ if (sourceExt.includes(path13.extname(baseName))) return void 0;
47251
48717
  const foundExt = sourceExt.find(
47252
48718
  (ext) => fs10.existsSync(`${localBin}${ext}`)
47253
48719
  );
@@ -47265,17 +48731,17 @@ Expecting one of '${allowedValues.join("', '")}'`);
47265
48731
  } catch {
47266
48732
  resolvedScriptPath = this._scriptPath;
47267
48733
  }
47268
- executableDir = path12.resolve(
47269
- path12.dirname(resolvedScriptPath),
48734
+ executableDir = path13.resolve(
48735
+ path13.dirname(resolvedScriptPath),
47270
48736
  executableDir
47271
48737
  );
47272
48738
  }
47273
48739
  if (executableDir) {
47274
48740
  let localFile = findFile(executableDir, executableFile);
47275
48741
  if (!localFile && !subcommand._executableFile && this._scriptPath) {
47276
- const legacyName = path12.basename(
48742
+ const legacyName = path13.basename(
47277
48743
  this._scriptPath,
47278
- path12.extname(this._scriptPath)
48744
+ path13.extname(this._scriptPath)
47279
48745
  );
47280
48746
  if (legacyName !== this._name) {
47281
48747
  localFile = findFile(
@@ -47286,7 +48752,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
47286
48752
  }
47287
48753
  executableFile = localFile || executableFile;
47288
48754
  }
47289
- launchWithNode = sourceExt.includes(path12.extname(executableFile));
48755
+ launchWithNode = sourceExt.includes(path13.extname(executableFile));
47290
48756
  let proc;
47291
48757
  if (process11.platform !== "win32") {
47292
48758
  if (launchWithNode) {
@@ -48201,7 +49667,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
48201
49667
  * @return {Command}
48202
49668
  */
48203
49669
  nameFromFilename(filename) {
48204
- this._name = path12.basename(filename, path12.extname(filename));
49670
+ this._name = path13.basename(filename, path13.extname(filename));
48205
49671
  return this;
48206
49672
  }
48207
49673
  /**
@@ -48215,9 +49681,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
48215
49681
  * @param {string} [path]
48216
49682
  * @return {(string|null|Command)}
48217
49683
  */
48218
- executableDir(path13) {
48219
- if (path13 === void 0) return this._executableDir;
48220
- this._executableDir = path13;
49684
+ executableDir(path14) {
49685
+ if (path14 === void 0) return this._executableDir;
49686
+ this._executableDir = path14;
48221
49687
  return this;
48222
49688
  }
48223
49689
  /**
@@ -50646,11 +52112,11 @@ var init_cli_spinners = __esm({
50646
52112
 
50647
52113
  // node_modules/.pnpm/yoctocolors@2.1.2/node_modules/yoctocolors/base.js
50648
52114
  import tty2 from "node:tty";
50649
- var hasColors, format, reset, bold, dim, italic, underline, overline, inverse, hidden, strikethrough, black, red, green, yellow, blue, magenta, cyan, white, gray, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bgGray, redBright, greenBright, yellowBright, blueBright, magentaBright, cyanBright, whiteBright, bgRedBright, bgGreenBright, bgYellowBright, bgBlueBright, bgMagentaBright, bgCyanBright, bgWhiteBright;
52115
+ var hasColors, format2, reset, bold, dim, italic, underline, overline, inverse, hidden, strikethrough, black, red, green, yellow, blue, magenta, cyan, white, gray, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bgGray, redBright, greenBright, yellowBright, blueBright, magentaBright, cyanBright, whiteBright, bgRedBright, bgGreenBright, bgYellowBright, bgBlueBright, bgMagentaBright, bgCyanBright, bgWhiteBright;
50650
52116
  var init_base = __esm({
50651
52117
  "node_modules/.pnpm/yoctocolors@2.1.2/node_modules/yoctocolors/base.js"() {
50652
52118
  hasColors = tty2?.WriteStream?.prototype?.hasColors?.() ?? false;
50653
- format = (open, close) => {
52119
+ format2 = (open, close) => {
50654
52120
  if (!hasColors) {
50655
52121
  return (input) => input;
50656
52122
  }
@@ -50675,47 +52141,47 @@ var init_base = __esm({
50675
52141
  return result;
50676
52142
  };
50677
52143
  };
50678
- reset = format(0, 0);
50679
- bold = format(1, 22);
50680
- dim = format(2, 22);
50681
- italic = format(3, 23);
50682
- underline = format(4, 24);
50683
- overline = format(53, 55);
50684
- inverse = format(7, 27);
50685
- hidden = format(8, 28);
50686
- strikethrough = format(9, 29);
50687
- black = format(30, 39);
50688
- red = format(31, 39);
50689
- green = format(32, 39);
50690
- yellow = format(33, 39);
50691
- blue = format(34, 39);
50692
- magenta = format(35, 39);
50693
- cyan = format(36, 39);
50694
- white = format(37, 39);
50695
- gray = format(90, 39);
50696
- bgBlack = format(40, 49);
50697
- bgRed = format(41, 49);
50698
- bgGreen = format(42, 49);
50699
- bgYellow = format(43, 49);
50700
- bgBlue = format(44, 49);
50701
- bgMagenta = format(45, 49);
50702
- bgCyan = format(46, 49);
50703
- bgWhite = format(47, 49);
50704
- bgGray = format(100, 49);
50705
- redBright = format(91, 39);
50706
- greenBright = format(92, 39);
50707
- yellowBright = format(93, 39);
50708
- blueBright = format(94, 39);
50709
- magentaBright = format(95, 39);
50710
- cyanBright = format(96, 39);
50711
- whiteBright = format(97, 39);
50712
- bgRedBright = format(101, 49);
50713
- bgGreenBright = format(102, 49);
50714
- bgYellowBright = format(103, 49);
50715
- bgBlueBright = format(104, 49);
50716
- bgMagentaBright = format(105, 49);
50717
- bgCyanBright = format(106, 49);
50718
- bgWhiteBright = format(107, 49);
52144
+ reset = format2(0, 0);
52145
+ bold = format2(1, 22);
52146
+ dim = format2(2, 22);
52147
+ italic = format2(3, 23);
52148
+ underline = format2(4, 24);
52149
+ overline = format2(53, 55);
52150
+ inverse = format2(7, 27);
52151
+ hidden = format2(8, 28);
52152
+ strikethrough = format2(9, 29);
52153
+ black = format2(30, 39);
52154
+ red = format2(31, 39);
52155
+ green = format2(32, 39);
52156
+ yellow = format2(33, 39);
52157
+ blue = format2(34, 39);
52158
+ magenta = format2(35, 39);
52159
+ cyan = format2(36, 39);
52160
+ white = format2(37, 39);
52161
+ gray = format2(90, 39);
52162
+ bgBlack = format2(40, 49);
52163
+ bgRed = format2(41, 49);
52164
+ bgGreen = format2(42, 49);
52165
+ bgYellow = format2(43, 49);
52166
+ bgBlue = format2(44, 49);
52167
+ bgMagenta = format2(45, 49);
52168
+ bgCyan = format2(46, 49);
52169
+ bgWhite = format2(47, 49);
52170
+ bgGray = format2(100, 49);
52171
+ redBright = format2(91, 39);
52172
+ greenBright = format2(92, 39);
52173
+ yellowBright = format2(93, 39);
52174
+ blueBright = format2(94, 39);
52175
+ magentaBright = format2(95, 39);
52176
+ cyanBright = format2(96, 39);
52177
+ whiteBright = format2(97, 39);
52178
+ bgRedBright = format2(101, 49);
52179
+ bgGreenBright = format2(102, 49);
52180
+ bgYellowBright = format2(103, 49);
52181
+ bgBlueBright = format2(104, 49);
52182
+ bgMagentaBright = format2(105, 49);
52183
+ bgCyanBright = format2(106, 49);
52184
+ bgWhiteBright = format2(107, 49);
50719
52185
  }
50720
52186
  });
50721
52187
 
@@ -51560,7 +53026,7 @@ function formatText(result, verbose = false) {
51560
53026
  for (const file2 of contextFiles) {
51561
53027
  let desc = ` ${file2.path} (${file2.tokens.toLocaleString()} tokens, ${file2.lines} lines)`;
51562
53028
  if (file2.isSymlink && file2.symlinkTarget) {
51563
- desc = ` ${file2.path} ${source_default.dim(`\u2192 ${file2.symlinkTarget} (symlink)`)}`;
53029
+ desc = ` ${file2.path} ${source_default.dim(`-> ${file2.symlinkTarget} (symlink)`)}`;
51564
53030
  }
51565
53031
  lines.push(desc);
51566
53032
  }
@@ -51582,7 +53048,7 @@ function formatText(result, verbose = false) {
51582
53048
  if (fileIssues.length === 0 && !verbose) continue;
51583
53049
  lines.push(source_default.underline(file2.path));
51584
53050
  if (fileIssues.length === 0) {
51585
- lines.push(source_default.green(" \u2713 All checks passed"));
53051
+ lines.push(source_default.green(" [ok] All checks passed"));
51586
53052
  } else {
51587
53053
  for (const issue2 of fileIssues) {
51588
53054
  lines.push(formatIssue(issue2));
@@ -51637,13 +53103,13 @@ function formatTokenReport(result) {
51637
53103
  lines.push(
51638
53104
  ` ${source_default.dim("File".padEnd(maxPathLen))} ${source_default.dim("Tokens".padStart(8))} ${source_default.dim("Lines".padStart(6))}`
51639
53105
  );
51640
- lines.push(` ${"\u2500".repeat(maxPathLen)} ${"\u2500".repeat(8)} ${"\u2500".repeat(6)}`);
53106
+ lines.push(` ${"-".repeat(maxPathLen)} ${"-".repeat(8)} ${"-".repeat(6)}`);
51641
53107
  for (const file2 of result.files) {
51642
53108
  const tokenStr = file2.tokens.toLocaleString().padStart(8);
51643
53109
  const lineStr = file2.lines.toString().padStart(6);
51644
53110
  lines.push(` ${file2.path.padEnd(maxPathLen)} ${tokenStr} ${lineStr}`);
51645
53111
  }
51646
- lines.push(` ${"\u2500".repeat(maxPathLen)} ${"\u2500".repeat(8)} ${"\u2500".repeat(6)}`);
53112
+ lines.push(` ${"-".repeat(maxPathLen)} ${"-".repeat(8)} ${"-".repeat(6)}`);
51647
53113
  lines.push(
51648
53114
  ` ${"Total".padEnd(maxPathLen)} ${result.summary.totalTokens.toLocaleString().padStart(8)}`
51649
53115
  );
@@ -51856,12 +53322,12 @@ function buildRuleDescriptors() {
51856
53322
  ];
51857
53323
  }
51858
53324
  function formatIssue(issue2) {
51859
- const icon = issue2.severity === "error" ? source_default.red("\u2717") : issue2.severity === "warning" ? source_default.yellow("\u26A0") : source_default.blue("\u2139");
53325
+ const icon = issue2.severity === "error" ? source_default.red("x") : issue2.severity === "warning" ? source_default.yellow("!") : source_default.blue("i");
51860
53326
  const lineRef = issue2.line > 0 ? `Line ${issue2.line}: ` : "";
51861
53327
  let line = ` ${icon} ${lineRef}${issue2.message}`;
51862
53328
  if (issue2.suggestion) {
51863
53329
  line += `
51864
- ${source_default.dim("\u2192")} ${source_default.dim(issue2.suggestion)}`;
53330
+ ${source_default.dim("->")} ${source_default.dim(issue2.suggestion)}`;
51865
53331
  }
51866
53332
  if (issue2.detail) {
51867
53333
  line += `
@@ -51878,7 +53344,7 @@ var init_reporter = __esm({
51878
53344
 
51879
53345
  // src/core/config.ts
51880
53346
  import * as fs8 from "node:fs";
51881
- import * as path10 from "node:path";
53347
+ import * as path11 from "node:path";
51882
53348
  function formatJsonError(content, err) {
51883
53349
  const msg = err instanceof Error ? err.message : String(err);
51884
53350
  const posMatch = msg.match(/position (\d+)/);
@@ -51949,33 +53415,46 @@ function warnUnknownKeys(config2, source) {
51949
53415
  console.error(`Warning: unknown config key "${k3}" in ${source}${suggestion}`);
51950
53416
  }
51951
53417
  }
53418
+ function parseConfigContent(content, source) {
53419
+ let parsed;
53420
+ try {
53421
+ parsed = JSON.parse(content);
53422
+ } catch (err) {
53423
+ throw new Error(`Invalid JSON in ${source}: ${formatJsonError(content, err)}`, {
53424
+ cause: err
53425
+ });
53426
+ }
53427
+ if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
53428
+ throw new Error(
53429
+ `Invalid config in ${source}: expected a JSON object at the root, got ${Array.isArray(parsed) ? "an array" : typeof parsed}`
53430
+ );
53431
+ }
53432
+ warnUnknownKeys(parsed, source);
53433
+ return parsed;
53434
+ }
51952
53435
  function loadConfig(projectRoot) {
51953
53436
  for (const filename of CONFIG_FILENAMES) {
51954
- const filePath = path10.join(projectRoot, filename);
53437
+ const filePath = path11.join(projectRoot, filename);
51955
53438
  let content;
51956
53439
  try {
51957
53440
  content = fs8.readFileSync(filePath, "utf-8");
51958
53441
  } catch {
51959
53442
  continue;
51960
53443
  }
51961
- let parsed;
51962
- try {
51963
- parsed = JSON.parse(content);
51964
- } catch (err) {
51965
- throw new Error(`Invalid JSON in ${filePath}: ${formatJsonError(content, err)}`, {
51966
- cause: err
51967
- });
51968
- }
51969
- if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) {
51970
- throw new Error(
51971
- `Invalid config in ${filePath}: expected a JSON object at the root, got ${Array.isArray(parsed) ? "an array" : typeof parsed}`
51972
- );
51973
- }
51974
- warnUnknownKeys(parsed, filePath);
51975
- return parsed;
53444
+ return parseConfigContent(content, filePath);
51976
53445
  }
51977
53446
  return null;
51978
53447
  }
53448
+ function loadConfigFromExplicitPath(configPath) {
53449
+ let content;
53450
+ try {
53451
+ content = fs8.readFileSync(configPath, "utf-8");
53452
+ } catch (err) {
53453
+ const detail = err instanceof Error ? err.message : String(err);
53454
+ throw new Error(`could not load config from ${configPath}: ${detail}`, { cause: err });
53455
+ }
53456
+ return parseConfigContent(content, configPath);
53457
+ }
51979
53458
  var import_fast_levenshtein2, levenshtein2, KNOWN_CONFIG_KEYS, CONFIG_FILENAMES;
51980
53459
  var init_config2 = __esm({
51981
53460
  "src/core/config.ts"() {
@@ -51989,7 +53468,14 @@ var init_config2 = __esm({
51989
53468
  "tokenThresholds",
51990
53469
  "contextFiles",
51991
53470
  "mcp",
51992
- "mcpGlobal"
53471
+ "mcpOnly",
53472
+ "mcpGlobal",
53473
+ "mcph",
53474
+ "mcphOnly",
53475
+ "mcphGlobal",
53476
+ "mcphStrictEnvToken",
53477
+ "session",
53478
+ "sessionOnly"
51993
53479
  ];
51994
53480
  CONFIG_FILENAMES = [".ctxlintrc", ".ctxlintrc.json"];
51995
53481
  }
@@ -52001,7 +53487,7 @@ __export(cli_exports, {
52001
53487
  runCli: () => runCli
52002
53488
  });
52003
53489
  import * as fs9 from "node:fs";
52004
- import * as path11 from "node:path";
53490
+ import * as path12 from "node:path";
52005
53491
  function validateCheckNames(names, source) {
52006
53492
  const invalid = names.filter((n7) => n7 && !VALID_CHECKS.has(n7));
52007
53493
  if (invalid.length > 0) {
@@ -52019,23 +53505,33 @@ async function runCli() {
52019
53505
  "Lint your AI agent context files and MCP server configs against your actual codebase"
52020
53506
  ).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(
52021
53507
  new Option("--format <format>", "Output format: text, json, or sarif").choices(["text", "json", "sarif"]).default("text")
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) => {
52023
- const resolvedPath = path11.resolve(projectPath);
52024
- const configPath = opts.config ? path11.resolve(opts.config) : void 0;
53508
+ ).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("--mcph", "Enable .mcph.json (mcp.hosting CLI config) linting", false).option("--mcph-only", "Run only mcph config checks", false).option("--mcph-global", "Also scan ~/.mcph.json (implies --mcph)", false).option(
53509
+ "--mcph-strict-env-token",
53510
+ "Upgrade mcph-config/prefer-env-token from warning to error (strict env-var-only posture)",
53511
+ false
53512
+ ).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) => {
53513
+ const resolvedPath = path12.resolve(projectPath);
53514
+ const configPath = opts.config ? path12.resolve(opts.config) : void 0;
52025
53515
  const config2 = configPath ? loadConfigFromPath(configPath) : loadConfig(resolvedPath);
52026
- const mcpGlobal = opts.mcpGlobal || false;
52027
- const mcpOnly = opts.mcpOnly || false;
53516
+ const mcpGlobal = opts.mcpGlobal || config2?.mcpGlobal || false;
53517
+ const mcpOnly = opts.mcpOnly || config2?.mcpOnly || false;
52028
53518
  const mcpFlag = opts.mcp || mcpGlobal || mcpOnly || config2?.mcp || false;
52029
- const sessionFlag = opts.session || false;
52030
- const sessionOnly = opts.sessionOnly || false;
53519
+ const mcphGlobal = opts.mcphGlobal || config2?.mcphGlobal || false;
53520
+ const mcphOnly = opts.mcphOnly || config2?.mcphOnly || false;
53521
+ const mcphFlag = opts.mcph || mcphGlobal || mcphOnly || config2?.mcph || false;
53522
+ const mcphStrictEnvToken = opts.mcphStrictEnvToken || config2?.mcphStrictEnvToken || false;
53523
+ const sessionOnly = opts.sessionOnly || config2?.sessionOnly || false;
53524
+ const sessionFlag = opts.session || sessionOnly || config2?.session || false;
52031
53525
  let explicitChecks = opts.checks ? validateCheckNames(
52032
53526
  opts.checks.split(",").map((c3) => c3.trim()),
52033
53527
  "--checks"
52034
53528
  ) : null;
52035
53529
  if (explicitChecks?.length === 0) explicitChecks = null;
52036
53530
  const hasMcpInChecks = explicitChecks?.some((c3) => c3.startsWith("mcp-")) || false;
53531
+ const hasMcphInChecks = explicitChecks?.some((c3) => c3.startsWith("mcph-")) || false;
52037
53532
  const hasSessionInChecks = explicitChecks?.some((c3) => c3.startsWith("session-")) || false;
52038
53533
  const effectiveMcp = mcpFlag || hasMcpInChecks;
53534
+ const effectiveMcph = mcphFlag || hasMcphInChecks;
52039
53535
  const effectiveSession = sessionFlag || sessionOnly || hasSessionInChecks;
52040
53536
  let checks;
52041
53537
  if (explicitChecks) {
@@ -52044,11 +53540,14 @@ async function runCli() {
52044
53540
  checks = ALL_SESSION_CHECKS;
52045
53541
  } else if (mcpOnly) {
52046
53542
  checks = ALL_MCP_CHECKS;
53543
+ } else if (mcphOnly) {
53544
+ checks = ALL_MCPH_CHECKS;
52047
53545
  } else {
52048
53546
  const base = config2?.checks || ALL_CHECKS;
52049
53547
  checks = [
52050
53548
  ...base,
52051
53549
  ...effectiveMcp ? ALL_MCP_CHECKS : [],
53550
+ ...effectiveMcph ? ALL_MCPH_CHECKS : [],
52052
53551
  ...effectiveSession ? ALL_SESSION_CHECKS : []
52053
53552
  ];
52054
53553
  }
@@ -52068,7 +53567,11 @@ async function runCli() {
52068
53567
  depth: Math.max(0, Math.min(parseInt(opts.depth, 10) || 2, 10)),
52069
53568
  mcp: effectiveMcp,
52070
53569
  mcpOnly,
52071
- mcpGlobal: mcpGlobal || config2?.mcpGlobal || false,
53570
+ mcpGlobal,
53571
+ mcph: effectiveMcph,
53572
+ mcphOnly,
53573
+ mcphGlobal,
53574
+ mcphStrictEnvToken,
52072
53575
  session: effectiveSession,
52073
53576
  sessionOnly
52074
53577
  };
@@ -52085,6 +53588,10 @@ async function runCli() {
52085
53588
  mcp: options.mcp,
52086
53589
  mcpGlobal: options.mcpGlobal,
52087
53590
  mcpOnly: options.mcpOnly,
53591
+ mcph: options.mcph,
53592
+ mcphGlobal: options.mcphGlobal,
53593
+ mcphOnly: options.mcphOnly,
53594
+ mcphStrictEnvToken: options.mcphStrictEnvToken,
52088
53595
  session: options.session,
52089
53596
  sessionOnly: options.sessionOnly
52090
53597
  });
@@ -52185,34 +53692,34 @@ Fixed ${applied.totalFixes} issue${applied.totalFixes !== 1 ? "s" : ""} in ${app
52185
53692
  const chalk2 = (await Promise.resolve().then(() => (init_source(), source_exports))).default;
52186
53693
  console.log(chalk2.dim("\nWatching for changes... (Ctrl+C to stop)\n"));
52187
53694
  const watchPaths = [
52188
- path11.join(resolvedPath, "CLAUDE.md"),
52189
- path11.join(resolvedPath, "CLAUDE.local.md"),
52190
- path11.join(resolvedPath, "AGENTS.md"),
52191
- path11.join(resolvedPath, "AGENT.md"),
52192
- path11.join(resolvedPath, ".cursorrules"),
52193
- path11.join(resolvedPath, ".windsurfrules"),
52194
- path11.join(resolvedPath, ".clinerules"),
52195
- path11.join(resolvedPath, ".aiderules"),
52196
- path11.join(resolvedPath, ".continuerules"),
52197
- path11.join(resolvedPath, ".rules"),
52198
- path11.join(resolvedPath, ".goosehints"),
52199
- path11.join(resolvedPath, "GEMINI.md"),
52200
- path11.join(resolvedPath, "replit.md"),
52201
- path11.join(resolvedPath, "package.json"),
52202
- path11.join(resolvedPath, ".mcp.json")
53695
+ path12.join(resolvedPath, "CLAUDE.md"),
53696
+ path12.join(resolvedPath, "CLAUDE.local.md"),
53697
+ path12.join(resolvedPath, "AGENTS.md"),
53698
+ path12.join(resolvedPath, "AGENT.md"),
53699
+ path12.join(resolvedPath, ".cursorrules"),
53700
+ path12.join(resolvedPath, ".windsurfrules"),
53701
+ path12.join(resolvedPath, ".clinerules"),
53702
+ path12.join(resolvedPath, ".aiderules"),
53703
+ path12.join(resolvedPath, ".continuerules"),
53704
+ path12.join(resolvedPath, ".rules"),
53705
+ path12.join(resolvedPath, ".goosehints"),
53706
+ path12.join(resolvedPath, "GEMINI.md"),
53707
+ path12.join(resolvedPath, "replit.md"),
53708
+ path12.join(resolvedPath, "package.json"),
53709
+ path12.join(resolvedPath, ".mcp.json")
52203
53710
  ];
52204
53711
  const watchDirs = [
52205
- path11.join(resolvedPath, ".claude"),
52206
- path11.join(resolvedPath, ".cursor"),
52207
- path11.join(resolvedPath, ".github"),
52208
- path11.join(resolvedPath, ".windsurf"),
52209
- path11.join(resolvedPath, ".aide"),
52210
- path11.join(resolvedPath, ".amazonq"),
52211
- path11.join(resolvedPath, ".goose"),
52212
- path11.join(resolvedPath, ".junie"),
52213
- path11.join(resolvedPath, ".aiassistant"),
52214
- path11.join(resolvedPath, ".continue"),
52215
- path11.join(resolvedPath, ".vscode")
53712
+ path12.join(resolvedPath, ".claude"),
53713
+ path12.join(resolvedPath, ".cursor"),
53714
+ path12.join(resolvedPath, ".github"),
53715
+ path12.join(resolvedPath, ".windsurf"),
53716
+ path12.join(resolvedPath, ".aide"),
53717
+ path12.join(resolvedPath, ".amazonq"),
53718
+ path12.join(resolvedPath, ".goose"),
53719
+ path12.join(resolvedPath, ".junie"),
53720
+ path12.join(resolvedPath, ".aiassistant"),
53721
+ path12.join(resolvedPath, ".continue"),
53722
+ path12.join(resolvedPath, ".vscode")
52216
53723
  ];
52217
53724
  const watchers = [];
52218
53725
  let debounceTimer = null;
@@ -52227,6 +53734,10 @@ Fixed ${applied.totalFixes} issue${applied.totalFixes !== 1 ? "s" : ""} in ${app
52227
53734
  mcp: options.mcp,
52228
53735
  mcpGlobal: options.mcpGlobal,
52229
53736
  mcpOnly: options.mcpOnly,
53737
+ mcph: options.mcph,
53738
+ mcphGlobal: options.mcphGlobal,
53739
+ mcphOnly: options.mcphOnly,
53740
+ mcphStrictEnvToken: options.mcphStrictEnvToken,
52230
53741
  session: options.session,
52231
53742
  sessionOnly: options.sessionOnly
52232
53743
  });
@@ -52283,9 +53794,9 @@ Fixed ${applied.totalFixes} issue${applied.totalFixes !== 1 ? "s" : ""} in ${app
52283
53794
  }
52284
53795
  });
52285
53796
  program2.command("init").description("Set up a git pre-commit hook that runs ctxlint --strict").argument("[path]", "Project directory", ".").action(async (projectPath) => {
52286
- const resolvedRoot = path11.resolve(projectPath);
52287
- const gitDir = path11.join(resolvedRoot, ".git");
52288
- const hooksDir = path11.join(gitDir, "hooks");
53797
+ const resolvedRoot = path12.resolve(projectPath);
53798
+ const gitDir = path12.join(resolvedRoot, ".git");
53799
+ const hooksDir = path12.join(gitDir, "hooks");
52289
53800
  if (!fs9.existsSync(gitDir)) {
52290
53801
  console.error('Error: not a git repository. Run "git init" first.');
52291
53802
  process.exit(1);
@@ -52293,7 +53804,7 @@ Fixed ${applied.totalFixes} issue${applied.totalFixes !== 1 ? "s" : ""} in ${app
52293
53804
  if (!fs9.existsSync(hooksDir)) {
52294
53805
  fs9.mkdirSync(hooksDir, { recursive: true });
52295
53806
  }
52296
- const hookPath = path11.join(hooksDir, "pre-commit");
53807
+ const hookPath = path12.join(hooksDir, "pre-commit");
52297
53808
  const fullHookContent = `#!/bin/sh
52298
53809
  # ctxlint pre-commit hook
52299
53810
  npx @yawlabs/ctxlint@${VERSION} --strict
@@ -52330,11 +53841,10 @@ async function promptYesNo(question) {
52330
53841
  }
52331
53842
  function loadConfigFromPath(configPath) {
52332
53843
  try {
52333
- const content = fs9.readFileSync(configPath, "utf-8");
52334
- return JSON.parse(content);
53844
+ return loadConfigFromExplicitPath(configPath);
52335
53845
  } catch (err) {
52336
53846
  const detail = err instanceof Error ? err.message : String(err);
52337
- console.error(`Error: could not load config from ${configPath}: ${detail}`);
53847
+ console.error(`Error: ${detail}`);
52338
53848
  process.exit(2);
52339
53849
  }
52340
53850
  }
@@ -52354,7 +53864,12 @@ var init_cli = __esm({
52354
53864
  init_config2();
52355
53865
  init_audit();
52356
53866
  init_version2();
52357
- VALID_CHECKS = /* @__PURE__ */ new Set([...ALL_CHECKS, ...ALL_MCP_CHECKS, ...ALL_SESSION_CHECKS]);
53867
+ VALID_CHECKS = /* @__PURE__ */ new Set([
53868
+ ...ALL_CHECKS,
53869
+ ...ALL_MCP_CHECKS,
53870
+ ...ALL_MCPH_CHECKS,
53871
+ ...ALL_SESSION_CHECKS
53872
+ ]);
52358
53873
  }
52359
53874
  });
52360
53875