@yawlabs/ctxlint 0.9.15 → 0.9.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -1
- package/dist/index.js +1953 -439
- package/mcph-config-lint-rules.json +151 -0
- package/package.json +3 -1
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:
|
|
451
|
-
const fullPath = [...
|
|
451
|
+
const { data, path: path14, errorMaps, issueData } = params;
|
|
452
|
+
const fullPath = [...path14, ...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,
|
|
732
|
+
constructor(parent, value, path14, key) {
|
|
732
733
|
this._cachedPath = [];
|
|
733
734
|
this.parent = parent;
|
|
734
735
|
this.data = value;
|
|
735
|
-
this._path =
|
|
736
|
+
this._path = path14;
|
|
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,
|
|
4241
|
-
if (!
|
|
4241
|
+
function getElementAtPath(obj, path14) {
|
|
4242
|
+
if (!path14)
|
|
4242
4243
|
return obj;
|
|
4243
|
-
return
|
|
4244
|
+
return path14.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(
|
|
4556
|
+
function prefixIssues(path14, issues) {
|
|
4556
4557
|
return issues.map((iss) => {
|
|
4557
4558
|
var _a3;
|
|
4558
4559
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
4559
|
-
iss.path.unshift(
|
|
4560
|
+
iss.path.unshift(path14);
|
|
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,
|
|
4802
|
+
const processError = (error50, path14 = []) => {
|
|
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 = [...
|
|
4812
|
+
const fullpath = [...path14, ...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
|
|
4844
|
-
for (const seg of
|
|
4844
|
+
const path14 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
4845
|
+
for (const seg of path14) {
|
|
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,
|
|
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:
|
|
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:
|
|
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 (
|
|
15186
|
-
json2.format = formatMap[
|
|
15186
|
+
if (format3) {
|
|
15187
|
+
json2.format = formatMap[format3] ?? format3;
|
|
15187
15188
|
if (json2.format === "")
|
|
15188
15189
|
delete json2.format;
|
|
15189
|
-
if (
|
|
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:
|
|
15212
|
-
if (typeof
|
|
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(
|
|
16734
|
-
return _stringFormat(ZodCustomStringFormat,
|
|
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
|
|
16745
|
-
const regex2 = regexes_exports[
|
|
16745
|
+
const format3 = `${alg}_${enc}`;
|
|
16746
|
+
const regex2 = regexes_exports[format3];
|
|
16746
16747
|
if (!regex2)
|
|
16747
|
-
throw new Error(`Unrecognized hash format: ${
|
|
16748
|
-
return _stringFormat(ZodCustomStringFormat,
|
|
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
|
|
17795
|
-
if (
|
|
17795
|
+
const path14 = ref.slice(1).split("/").filter(Boolean);
|
|
17796
|
+
if (path14.length === 0) {
|
|
17796
17797
|
return ctx.rootSchema;
|
|
17797
17798
|
}
|
|
17798
17799
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
17799
|
-
if (
|
|
17800
|
-
const key =
|
|
17800
|
+
if (path14[0] === defsKey) {
|
|
17801
|
+
const key = path14[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
|
|
17893
|
-
if (
|
|
17893
|
+
const format3 = schema.format;
|
|
17894
|
+
if (format3 === "email") {
|
|
17894
17895
|
stringSchema = stringSchema.check(z.email());
|
|
17895
|
-
} else if (
|
|
17896
|
+
} else if (format3 === "uri" || format3 === "uri-reference") {
|
|
17896
17897
|
stringSchema = stringSchema.check(z.url());
|
|
17897
|
-
} else if (
|
|
17898
|
+
} else if (format3 === "uuid" || format3 === "guid") {
|
|
17898
17899
|
stringSchema = stringSchema.check(z.uuid());
|
|
17899
|
-
} else if (
|
|
17900
|
+
} else if (format3 === "date-time") {
|
|
17900
17901
|
stringSchema = stringSchema.check(z.iso.datetime());
|
|
17901
|
-
} else if (
|
|
17902
|
+
} else if (format3 === "date") {
|
|
17902
17903
|
stringSchema = stringSchema.check(z.iso.date());
|
|
17903
|
-
} else if (
|
|
17904
|
+
} else if (format3 === "time") {
|
|
17904
17905
|
stringSchema = stringSchema.check(z.iso.time());
|
|
17905
|
-
} else if (
|
|
17906
|
+
} else if (format3 === "duration") {
|
|
17906
17907
|
stringSchema = stringSchema.check(z.iso.duration());
|
|
17907
|
-
} else if (
|
|
17908
|
+
} else if (format3 === "ipv4") {
|
|
17908
17909
|
stringSchema = stringSchema.check(z.ipv4());
|
|
17909
|
-
} else if (
|
|
17910
|
+
} else if (format3 === "ipv6") {
|
|
17910
17911
|
stringSchema = stringSchema.check(z.ipv6());
|
|
17911
|
-
} else if (
|
|
17912
|
+
} else if (format3 === "mac") {
|
|
17912
17913
|
stringSchema = stringSchema.check(z.mac());
|
|
17913
|
-
} else if (
|
|
17914
|
+
} else if (format3 === "cidr") {
|
|
17914
17915
|
stringSchema = stringSchema.check(z.cidrv4());
|
|
17915
|
-
} else if (
|
|
17916
|
+
} else if (format3 === "cidr-v6") {
|
|
17916
17917
|
stringSchema = stringSchema.check(z.cidrv6());
|
|
17917
|
-
} else if (
|
|
17918
|
+
} else if (format3 === "base64") {
|
|
17918
17919
|
stringSchema = stringSchema.check(z.base64());
|
|
17919
|
-
} else if (
|
|
17920
|
+
} else if (format3 === "base64url") {
|
|
17920
17921
|
stringSchema = stringSchema.check(z.base64url());
|
|
17921
|
-
} else if (
|
|
17922
|
+
} else if (format3 === "e164") {
|
|
17922
17923
|
stringSchema = stringSchema.check(z.e164());
|
|
17923
|
-
} else if (
|
|
17924
|
+
} else if (format3 === "jwt") {
|
|
17924
17925
|
stringSchema = stringSchema.check(z.jwt());
|
|
17925
|
-
} else if (
|
|
17926
|
+
} else if (format3 === "emoji") {
|
|
17926
17927
|
stringSchema = stringSchema.check(z.emoji());
|
|
17927
|
-
} else if (
|
|
17928
|
+
} else if (format3 === "nanoid") {
|
|
17928
17929
|
stringSchema = stringSchema.check(z.nanoid());
|
|
17929
|
-
} else if (
|
|
17930
|
+
} else if (format3 === "cuid") {
|
|
17930
17931
|
stringSchema = stringSchema.check(z.cuid());
|
|
17931
|
-
} else if (
|
|
17932
|
+
} else if (format3 === "cuid2") {
|
|
17932
17933
|
stringSchema = stringSchema.check(z.cuid2());
|
|
17933
|
-
} else if (
|
|
17934
|
+
} else if (format3 === "ulid") {
|
|
17934
17935
|
stringSchema = stringSchema.check(z.ulid());
|
|
17935
|
-
} else if (
|
|
17936
|
+
} else if (format3 === "xid") {
|
|
17936
17937
|
stringSchema = stringSchema.check(z.xid());
|
|
17937
|
-
} else if (
|
|
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(
|
|
25891
|
-
let input =
|
|
25891
|
+
function removeDotSegments(path14) {
|
|
25892
|
+
let input = path14;
|
|
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 [
|
|
26091
|
-
wsComponent.path =
|
|
26091
|
+
const [path14, query] = wsComponent.resourceName.split("?");
|
|
26092
|
+
wsComponent.path = path14 && path14 !== "/" ? path14 : 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(
|
|
26244
|
+
serialize(parse4(uri, options), options);
|
|
26244
26245
|
} else if (typeof uri === "object") {
|
|
26245
26246
|
uri = /** @type {T} */
|
|
26246
|
-
|
|
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(
|
|
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 =
|
|
26260
|
-
relative4 =
|
|
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(
|
|
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(
|
|
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
|
|
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:
|
|
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,
|
|
26884
|
-
if (typeof
|
|
26885
|
-
|
|
26886
|
-
this.formats[name] =
|
|
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
|
|
27005
|
-
if (
|
|
27006
|
-
this.addFormat(name,
|
|
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
|
|
28690
|
-
gen.if((0, codegen_1._)`typeof ${fDef} == "object" && !(${fDef} instanceof RegExp)`, () => gen.assign(fType, (0, codegen_1._)`${fDef}.type || "string"`).assign(
|
|
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} && !${
|
|
28696
|
+
return (0, codegen_1._)`${schemaCode} && !${format3}`;
|
|
28696
28697
|
}
|
|
28697
28698
|
function invalidFmt() {
|
|
28698
|
-
const callFormat = schemaEnv.$async ? (0, codegen_1._)`(${fDef}.async ? await ${
|
|
28699
|
-
const validData = (0, codegen_1._)`(typeof ${
|
|
28700
|
-
return (0, codegen_1._)`${
|
|
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,
|
|
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
|
|
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
|
|
28754
|
-
exports.default =
|
|
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
|
|
29397
|
-
const fmtDef = self2.formats[
|
|
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 "${
|
|
29402
|
+
throw new Error(`"${keyword}": format "${format3}" does not define "compare" function`);
|
|
29402
29403
|
}
|
|
29403
29404
|
const fmt = gen.scopeValue("formats", {
|
|
29404
|
-
key:
|
|
29405
|
+
key: format3,
|
|
29405
29406
|
ref: fmtDef,
|
|
29406
|
-
code: opts.code.formats ? (0, codegen_1._)`${opts.code.formats}${(0, codegen_1.getProperty)(
|
|
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
|
}
|
|
@@ -29450,12 +29451,12 @@ var require_dist = __commonJS({
|
|
|
29450
29451
|
throw new Error(`Unknown format "${name}"`);
|
|
29451
29452
|
return f;
|
|
29452
29453
|
};
|
|
29453
|
-
function addFormats(ajv, list,
|
|
29454
|
+
function addFormats(ajv, list, fs11, exportName) {
|
|
29454
29455
|
var _a3;
|
|
29455
29456
|
var _b;
|
|
29456
29457
|
(_a3 = (_b = ajv.opts.code).formats) !== null && _a3 !== void 0 ? _a3 : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
|
|
29457
29458
|
for (const f of list)
|
|
29458
|
-
ajv.addFormat(f,
|
|
29459
|
+
ajv.addFormat(f, fs11[f]);
|
|
29459
29460
|
}
|
|
29460
29461
|
module.exports = exports = formatsPlugin;
|
|
29461
29462
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -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
|
|
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
|
|
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,
|
|
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[
|
|
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(
|
|
35515
|
-
log(`checking %s`,
|
|
35564
|
+
function check2(path14, isFile, isDirectory2) {
|
|
35565
|
+
log(`checking %s`, path14);
|
|
35516
35566
|
try {
|
|
35517
|
-
const stat3 = fs_1.statSync(
|
|
35567
|
+
const stat3 = fs_1.statSync(path14);
|
|
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(
|
|
35538
|
-
return check2(
|
|
35587
|
+
function exists2(path14, type = exports.READABLE) {
|
|
35588
|
+
return check2(path14, (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(
|
|
36128
|
-
return (0, import_file_exists.exists)(
|
|
36177
|
+
function folderExists(path14) {
|
|
36178
|
+
return (0, import_file_exists.exists)(path14, 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:
|
|
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(
|
|
36320
|
-
return /^\.(git)?$/.test(
|
|
36369
|
+
parser(path14) {
|
|
36370
|
+
return /^\.(git)?$/.test(path14.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 [
|
|
36577
|
-
paths.add(
|
|
36578
|
-
(results[
|
|
36626
|
+
const [path14, line, preview] = input.split(NULL);
|
|
36627
|
+
paths.add(path14);
|
|
36628
|
+
(results[path14] = results[path14] || []).push({
|
|
36579
36629
|
line: asNumber(line),
|
|
36580
|
-
path:
|
|
36630
|
+
path: path14,
|
|
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,
|
|
36927
|
+
function parseInit(bare, path14, text) {
|
|
36878
36928
|
const response = String(text).trim();
|
|
36879
36929
|
let result;
|
|
36880
36930
|
if (result = initResponseRegex.exec(response)) {
|
|
36881
|
-
return new InitSummary(bare,
|
|
36931
|
+
return new InitSummary(bare, path14, false, result[1]);
|
|
36882
36932
|
}
|
|
36883
36933
|
if (result = reInitResponseRegex.exec(response)) {
|
|
36884
|
-
return new InitSummary(bare,
|
|
36934
|
+
return new InitSummary(bare, path14, 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,
|
|
36945
|
+
return new InitSummary(bare, path14, /^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,
|
|
36950
|
+
function initTask(bare = false, path14, 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"),
|
|
36959
|
+
return parseInit(commands.includes("--bare"), path14, text);
|
|
36910
36960
|
}
|
|
36911
36961
|
};
|
|
36912
36962
|
}
|
|
36913
36963
|
function logFormatFromCommand(customArgs) {
|
|
36914
36964
|
for (let i2 = 0; i2 < customArgs.length; i2++) {
|
|
36915
|
-
const
|
|
36916
|
-
if (
|
|
36917
|
-
return `--${
|
|
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(
|
|
36926
|
-
const parser4 = diffSummaryParsers[
|
|
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(
|
|
37037
|
+
function prettyFormat(format3, splitter) {
|
|
36988
37038
|
const fields = [];
|
|
36989
37039
|
const formatStr = [];
|
|
36990
|
-
Object.keys(
|
|
37040
|
+
Object.keys(format3).forEach((field) => {
|
|
36991
37041
|
fields.push(field);
|
|
36992
|
-
formatStr.push(String(
|
|
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
|
|
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(
|
|
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,
|
|
37238
|
+
function data(index, workingDir, path14) {
|
|
37189
37239
|
const raw = `${index}${workingDir}`;
|
|
37190
37240
|
const handler = parsers6.get(raw);
|
|
37191
37241
|
if (handler) {
|
|
37192
|
-
handler(result,
|
|
37242
|
+
handler(result, path14);
|
|
37193
37243
|
}
|
|
37194
37244
|
if (raw !== "##" && raw !== "!!") {
|
|
37195
|
-
result.files.push(new FileStatusSummary(
|
|
37245
|
+
result.files.push(new FileStatusSummary(path14, 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
|
|
37383
|
-
return
|
|
37432
|
+
const path14 = input.trim().replace(/^["']|["']$/g, "");
|
|
37433
|
+
return path14 && normalize2(path14);
|
|
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,
|
|
37523
|
-
return subModuleTask(["add", repo,
|
|
37572
|
+
function addSubModuleTask(repo, path14) {
|
|
37573
|
+
return subModuleTask(["add", repo, path14]);
|
|
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,
|
|
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
|
-
|
|
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,
|
|
38835
|
+
constructor(bare, path14, existing, gitDir) {
|
|
38786
38836
|
this.bare = bare;
|
|
38787
|
-
this.path =
|
|
38837
|
+
this.path = path14;
|
|
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(
|
|
39321
|
-
this.path =
|
|
39370
|
+
constructor(path14, index, working_dir) {
|
|
39371
|
+
this.path = path14;
|
|
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(
|
|
39375
|
+
const detail = fromPathRegex.exec(path14) || [null, path14, path14];
|
|
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(
|
|
39637
|
+
hashObject(path14, write) {
|
|
39588
39638
|
return this._runTask(
|
|
39589
|
-
hashObjectTask(
|
|
39639
|
+
hashObjectTask(path14, 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(),
|
|
40031
|
-
var { SimpleGitApi: SimpleGitApi2 } = (init_simple_git_api(),
|
|
40032
|
-
var { Scheduler: Scheduler2 } = (init_scheduler(),
|
|
40033
|
-
var { adhocExecTask: adhocExecTask2, configurationErrorTask: configurationErrorTask2 } = (init_task(),
|
|
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(),
|
|
40045
|
-
var { applyPatchTask: applyPatchTask2 } = (init_apply_patch(),
|
|
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(),
|
|
40052
|
-
var { checkIgnoreTask: checkIgnoreTask2 } = (init_check_ignore(),
|
|
40053
|
-
var { checkIsRepoTask: checkIsRepoTask2 } = (init_check_is_repo(),
|
|
40054
|
-
var { cleanWithOptionsTask: cleanWithOptionsTask2, isCleanOptionsArray: isCleanOptionsArray2 } = (init_clean(),
|
|
40055
|
-
var { diffSummaryTask: diffSummaryTask2 } = (init_diff(),
|
|
40056
|
-
var { fetchTask: fetchTask2 } = (init_fetch(),
|
|
40057
|
-
var { moveTask: moveTask2 } = (init_move(),
|
|
40058
|
-
var { pullTask: pullTask2 } = (init_pull(),
|
|
40059
|
-
var { pushTagsTask: pushTagsTask2 } = (init_push(),
|
|
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(),
|
|
40067
|
-
var { getResetMode: getResetMode2, resetTask: resetTask2 } = (init_reset(),
|
|
40068
|
-
var { stashListTask: stashListTask2 } = (init_stash_list(),
|
|
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(),
|
|
40075
|
-
var { addAnnotatedTagTask: addAnnotatedTagTask2, addTagTask: addTagTask2, tagListTask: tagListTask2 } = (init_tag(),
|
|
40076
|
-
var { straightThroughBufferTask: straightThroughBufferTask2, straightThroughStringTask: straightThroughStringTask2 } = (init_task(),
|
|
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,
|
|
40227
|
-
return this._runTask(addSubModuleTask2(repo,
|
|
40276
|
+
Git2.prototype.submoduleAdd = function(repo, path14, then) {
|
|
40277
|
+
return this._runTask(addSubModuleTask2(repo, path14), 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(
|
|
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 =
|
|
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) {
|
|
@@ -40734,27 +40784,1133 @@ var init_mcp_parser = __esm({
|
|
|
40734
40784
|
}
|
|
40735
40785
|
});
|
|
40736
40786
|
|
|
40737
|
-
// node_modules/.pnpm/
|
|
40738
|
-
|
|
40739
|
-
|
|
40787
|
+
// node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/scanner.js
|
|
40788
|
+
function createScanner(text, ignoreTrivia = false) {
|
|
40789
|
+
const len = text.length;
|
|
40790
|
+
let pos = 0, value = "", tokenOffset = 0, token = 16, lineNumber = 0, lineStartOffset = 0, tokenLineStartOffset = 0, prevTokenLineStartOffset = 0, scanError = 0;
|
|
40791
|
+
function scanHexDigits(count, exact) {
|
|
40792
|
+
let digits = 0;
|
|
40793
|
+
let value2 = 0;
|
|
40794
|
+
while (digits < count || !exact) {
|
|
40795
|
+
let ch = text.charCodeAt(pos);
|
|
40796
|
+
if (ch >= 48 && ch <= 57) {
|
|
40797
|
+
value2 = value2 * 16 + ch - 48;
|
|
40798
|
+
} else if (ch >= 65 && ch <= 70) {
|
|
40799
|
+
value2 = value2 * 16 + ch - 65 + 10;
|
|
40800
|
+
} else if (ch >= 97 && ch <= 102) {
|
|
40801
|
+
value2 = value2 * 16 + ch - 97 + 10;
|
|
40802
|
+
} else {
|
|
40803
|
+
break;
|
|
40804
|
+
}
|
|
40805
|
+
pos++;
|
|
40806
|
+
digits++;
|
|
40807
|
+
}
|
|
40808
|
+
if (digits < count) {
|
|
40809
|
+
value2 = -1;
|
|
40810
|
+
}
|
|
40811
|
+
return value2;
|
|
40812
|
+
}
|
|
40813
|
+
function setPosition(newPosition) {
|
|
40814
|
+
pos = newPosition;
|
|
40815
|
+
value = "";
|
|
40816
|
+
tokenOffset = 0;
|
|
40817
|
+
token = 16;
|
|
40818
|
+
scanError = 0;
|
|
40819
|
+
}
|
|
40820
|
+
function scanNumber() {
|
|
40821
|
+
let start = pos;
|
|
40822
|
+
if (text.charCodeAt(pos) === 48) {
|
|
40823
|
+
pos++;
|
|
40824
|
+
} else {
|
|
40825
|
+
pos++;
|
|
40826
|
+
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
40827
|
+
pos++;
|
|
40828
|
+
}
|
|
40829
|
+
}
|
|
40830
|
+
if (pos < text.length && text.charCodeAt(pos) === 46) {
|
|
40831
|
+
pos++;
|
|
40832
|
+
if (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
40833
|
+
pos++;
|
|
40834
|
+
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
40835
|
+
pos++;
|
|
40836
|
+
}
|
|
40837
|
+
} else {
|
|
40838
|
+
scanError = 3;
|
|
40839
|
+
return text.substring(start, pos);
|
|
40840
|
+
}
|
|
40841
|
+
}
|
|
40842
|
+
let end = pos;
|
|
40843
|
+
if (pos < text.length && (text.charCodeAt(pos) === 69 || text.charCodeAt(pos) === 101)) {
|
|
40844
|
+
pos++;
|
|
40845
|
+
if (pos < text.length && text.charCodeAt(pos) === 43 || text.charCodeAt(pos) === 45) {
|
|
40846
|
+
pos++;
|
|
40847
|
+
}
|
|
40848
|
+
if (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
40849
|
+
pos++;
|
|
40850
|
+
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
40851
|
+
pos++;
|
|
40852
|
+
}
|
|
40853
|
+
end = pos;
|
|
40854
|
+
} else {
|
|
40855
|
+
scanError = 3;
|
|
40856
|
+
}
|
|
40857
|
+
}
|
|
40858
|
+
return text.substring(start, end);
|
|
40859
|
+
}
|
|
40860
|
+
function scanString() {
|
|
40861
|
+
let result = "", start = pos;
|
|
40862
|
+
while (true) {
|
|
40863
|
+
if (pos >= len) {
|
|
40864
|
+
result += text.substring(start, pos);
|
|
40865
|
+
scanError = 2;
|
|
40866
|
+
break;
|
|
40867
|
+
}
|
|
40868
|
+
const ch = text.charCodeAt(pos);
|
|
40869
|
+
if (ch === 34) {
|
|
40870
|
+
result += text.substring(start, pos);
|
|
40871
|
+
pos++;
|
|
40872
|
+
break;
|
|
40873
|
+
}
|
|
40874
|
+
if (ch === 92) {
|
|
40875
|
+
result += text.substring(start, pos);
|
|
40876
|
+
pos++;
|
|
40877
|
+
if (pos >= len) {
|
|
40878
|
+
scanError = 2;
|
|
40879
|
+
break;
|
|
40880
|
+
}
|
|
40881
|
+
const ch2 = text.charCodeAt(pos++);
|
|
40882
|
+
switch (ch2) {
|
|
40883
|
+
case 34:
|
|
40884
|
+
result += '"';
|
|
40885
|
+
break;
|
|
40886
|
+
case 92:
|
|
40887
|
+
result += "\\";
|
|
40888
|
+
break;
|
|
40889
|
+
case 47:
|
|
40890
|
+
result += "/";
|
|
40891
|
+
break;
|
|
40892
|
+
case 98:
|
|
40893
|
+
result += "\b";
|
|
40894
|
+
break;
|
|
40895
|
+
case 102:
|
|
40896
|
+
result += "\f";
|
|
40897
|
+
break;
|
|
40898
|
+
case 110:
|
|
40899
|
+
result += "\n";
|
|
40900
|
+
break;
|
|
40901
|
+
case 114:
|
|
40902
|
+
result += "\r";
|
|
40903
|
+
break;
|
|
40904
|
+
case 116:
|
|
40905
|
+
result += " ";
|
|
40906
|
+
break;
|
|
40907
|
+
case 117:
|
|
40908
|
+
const ch3 = scanHexDigits(4, true);
|
|
40909
|
+
if (ch3 >= 0) {
|
|
40910
|
+
result += String.fromCharCode(ch3);
|
|
40911
|
+
} else {
|
|
40912
|
+
scanError = 4;
|
|
40913
|
+
}
|
|
40914
|
+
break;
|
|
40915
|
+
default:
|
|
40916
|
+
scanError = 5;
|
|
40917
|
+
}
|
|
40918
|
+
start = pos;
|
|
40919
|
+
continue;
|
|
40920
|
+
}
|
|
40921
|
+
if (ch >= 0 && ch <= 31) {
|
|
40922
|
+
if (isLineBreak(ch)) {
|
|
40923
|
+
result += text.substring(start, pos);
|
|
40924
|
+
scanError = 2;
|
|
40925
|
+
break;
|
|
40926
|
+
} else {
|
|
40927
|
+
scanError = 6;
|
|
40928
|
+
}
|
|
40929
|
+
}
|
|
40930
|
+
pos++;
|
|
40931
|
+
}
|
|
40932
|
+
return result;
|
|
40933
|
+
}
|
|
40934
|
+
function scanNext() {
|
|
40935
|
+
value = "";
|
|
40936
|
+
scanError = 0;
|
|
40937
|
+
tokenOffset = pos;
|
|
40938
|
+
lineStartOffset = lineNumber;
|
|
40939
|
+
prevTokenLineStartOffset = tokenLineStartOffset;
|
|
40940
|
+
if (pos >= len) {
|
|
40941
|
+
tokenOffset = len;
|
|
40942
|
+
return token = 17;
|
|
40943
|
+
}
|
|
40944
|
+
let code = text.charCodeAt(pos);
|
|
40945
|
+
if (isWhiteSpace(code)) {
|
|
40946
|
+
do {
|
|
40947
|
+
pos++;
|
|
40948
|
+
value += String.fromCharCode(code);
|
|
40949
|
+
code = text.charCodeAt(pos);
|
|
40950
|
+
} while (isWhiteSpace(code));
|
|
40951
|
+
return token = 15;
|
|
40952
|
+
}
|
|
40953
|
+
if (isLineBreak(code)) {
|
|
40954
|
+
pos++;
|
|
40955
|
+
value += String.fromCharCode(code);
|
|
40956
|
+
if (code === 13 && text.charCodeAt(pos) === 10) {
|
|
40957
|
+
pos++;
|
|
40958
|
+
value += "\n";
|
|
40959
|
+
}
|
|
40960
|
+
lineNumber++;
|
|
40961
|
+
tokenLineStartOffset = pos;
|
|
40962
|
+
return token = 14;
|
|
40963
|
+
}
|
|
40964
|
+
switch (code) {
|
|
40965
|
+
// tokens: []{}:,
|
|
40966
|
+
case 123:
|
|
40967
|
+
pos++;
|
|
40968
|
+
return token = 1;
|
|
40969
|
+
case 125:
|
|
40970
|
+
pos++;
|
|
40971
|
+
return token = 2;
|
|
40972
|
+
case 91:
|
|
40973
|
+
pos++;
|
|
40974
|
+
return token = 3;
|
|
40975
|
+
case 93:
|
|
40976
|
+
pos++;
|
|
40977
|
+
return token = 4;
|
|
40978
|
+
case 58:
|
|
40979
|
+
pos++;
|
|
40980
|
+
return token = 6;
|
|
40981
|
+
case 44:
|
|
40982
|
+
pos++;
|
|
40983
|
+
return token = 5;
|
|
40984
|
+
// strings
|
|
40985
|
+
case 34:
|
|
40986
|
+
pos++;
|
|
40987
|
+
value = scanString();
|
|
40988
|
+
return token = 10;
|
|
40989
|
+
// comments
|
|
40990
|
+
case 47:
|
|
40991
|
+
const start = pos - 1;
|
|
40992
|
+
if (text.charCodeAt(pos + 1) === 47) {
|
|
40993
|
+
pos += 2;
|
|
40994
|
+
while (pos < len) {
|
|
40995
|
+
if (isLineBreak(text.charCodeAt(pos))) {
|
|
40996
|
+
break;
|
|
40997
|
+
}
|
|
40998
|
+
pos++;
|
|
40999
|
+
}
|
|
41000
|
+
value = text.substring(start, pos);
|
|
41001
|
+
return token = 12;
|
|
41002
|
+
}
|
|
41003
|
+
if (text.charCodeAt(pos + 1) === 42) {
|
|
41004
|
+
pos += 2;
|
|
41005
|
+
const safeLength = len - 1;
|
|
41006
|
+
let commentClosed = false;
|
|
41007
|
+
while (pos < safeLength) {
|
|
41008
|
+
const ch = text.charCodeAt(pos);
|
|
41009
|
+
if (ch === 42 && text.charCodeAt(pos + 1) === 47) {
|
|
41010
|
+
pos += 2;
|
|
41011
|
+
commentClosed = true;
|
|
41012
|
+
break;
|
|
41013
|
+
}
|
|
41014
|
+
pos++;
|
|
41015
|
+
if (isLineBreak(ch)) {
|
|
41016
|
+
if (ch === 13 && text.charCodeAt(pos) === 10) {
|
|
41017
|
+
pos++;
|
|
41018
|
+
}
|
|
41019
|
+
lineNumber++;
|
|
41020
|
+
tokenLineStartOffset = pos;
|
|
41021
|
+
}
|
|
41022
|
+
}
|
|
41023
|
+
if (!commentClosed) {
|
|
41024
|
+
pos++;
|
|
41025
|
+
scanError = 1;
|
|
41026
|
+
}
|
|
41027
|
+
value = text.substring(start, pos);
|
|
41028
|
+
return token = 13;
|
|
41029
|
+
}
|
|
41030
|
+
value += String.fromCharCode(code);
|
|
41031
|
+
pos++;
|
|
41032
|
+
return token = 16;
|
|
41033
|
+
// numbers
|
|
41034
|
+
case 45:
|
|
41035
|
+
value += String.fromCharCode(code);
|
|
41036
|
+
pos++;
|
|
41037
|
+
if (pos === len || !isDigit(text.charCodeAt(pos))) {
|
|
41038
|
+
return token = 16;
|
|
41039
|
+
}
|
|
41040
|
+
// found a minus, followed by a number so
|
|
41041
|
+
// we fall through to proceed with scanning
|
|
41042
|
+
// numbers
|
|
41043
|
+
case 48:
|
|
41044
|
+
case 49:
|
|
41045
|
+
case 50:
|
|
41046
|
+
case 51:
|
|
41047
|
+
case 52:
|
|
41048
|
+
case 53:
|
|
41049
|
+
case 54:
|
|
41050
|
+
case 55:
|
|
41051
|
+
case 56:
|
|
41052
|
+
case 57:
|
|
41053
|
+
value += scanNumber();
|
|
41054
|
+
return token = 11;
|
|
41055
|
+
// literals and unknown symbols
|
|
41056
|
+
default:
|
|
41057
|
+
while (pos < len && isUnknownContentCharacter(code)) {
|
|
41058
|
+
pos++;
|
|
41059
|
+
code = text.charCodeAt(pos);
|
|
41060
|
+
}
|
|
41061
|
+
if (tokenOffset !== pos) {
|
|
41062
|
+
value = text.substring(tokenOffset, pos);
|
|
41063
|
+
switch (value) {
|
|
41064
|
+
case "true":
|
|
41065
|
+
return token = 8;
|
|
41066
|
+
case "false":
|
|
41067
|
+
return token = 9;
|
|
41068
|
+
case "null":
|
|
41069
|
+
return token = 7;
|
|
41070
|
+
}
|
|
41071
|
+
return token = 16;
|
|
41072
|
+
}
|
|
41073
|
+
value += String.fromCharCode(code);
|
|
41074
|
+
pos++;
|
|
41075
|
+
return token = 16;
|
|
41076
|
+
}
|
|
41077
|
+
}
|
|
41078
|
+
function isUnknownContentCharacter(code) {
|
|
41079
|
+
if (isWhiteSpace(code) || isLineBreak(code)) {
|
|
41080
|
+
return false;
|
|
41081
|
+
}
|
|
41082
|
+
switch (code) {
|
|
41083
|
+
case 125:
|
|
41084
|
+
case 93:
|
|
41085
|
+
case 123:
|
|
41086
|
+
case 91:
|
|
41087
|
+
case 34:
|
|
41088
|
+
case 58:
|
|
41089
|
+
case 44:
|
|
41090
|
+
case 47:
|
|
41091
|
+
return false;
|
|
41092
|
+
}
|
|
41093
|
+
return true;
|
|
41094
|
+
}
|
|
41095
|
+
function scanNextNonTrivia() {
|
|
41096
|
+
let result;
|
|
41097
|
+
do {
|
|
41098
|
+
result = scanNext();
|
|
41099
|
+
} while (result >= 12 && result <= 15);
|
|
41100
|
+
return result;
|
|
41101
|
+
}
|
|
41102
|
+
return {
|
|
41103
|
+
setPosition,
|
|
41104
|
+
getPosition: () => pos,
|
|
41105
|
+
scan: ignoreTrivia ? scanNextNonTrivia : scanNext,
|
|
41106
|
+
getToken: () => token,
|
|
41107
|
+
getTokenValue: () => value,
|
|
41108
|
+
getTokenOffset: () => tokenOffset,
|
|
41109
|
+
getTokenLength: () => pos - tokenOffset,
|
|
41110
|
+
getTokenStartLine: () => lineStartOffset,
|
|
41111
|
+
getTokenStartCharacter: () => tokenOffset - prevTokenLineStartOffset,
|
|
41112
|
+
getTokenError: () => scanError
|
|
41113
|
+
};
|
|
41114
|
+
}
|
|
41115
|
+
function isWhiteSpace(ch) {
|
|
41116
|
+
return ch === 32 || ch === 9;
|
|
41117
|
+
}
|
|
41118
|
+
function isLineBreak(ch) {
|
|
41119
|
+
return ch === 10 || ch === 13;
|
|
41120
|
+
}
|
|
41121
|
+
function isDigit(ch) {
|
|
41122
|
+
return ch >= 48 && ch <= 57;
|
|
41123
|
+
}
|
|
41124
|
+
var CharacterCodes;
|
|
41125
|
+
var init_scanner2 = __esm({
|
|
41126
|
+
"node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/scanner.js"() {
|
|
41127
|
+
"use strict";
|
|
41128
|
+
(function(CharacterCodes2) {
|
|
41129
|
+
CharacterCodes2[CharacterCodes2["lineFeed"] = 10] = "lineFeed";
|
|
41130
|
+
CharacterCodes2[CharacterCodes2["carriageReturn"] = 13] = "carriageReturn";
|
|
41131
|
+
CharacterCodes2[CharacterCodes2["space"] = 32] = "space";
|
|
41132
|
+
CharacterCodes2[CharacterCodes2["_0"] = 48] = "_0";
|
|
41133
|
+
CharacterCodes2[CharacterCodes2["_1"] = 49] = "_1";
|
|
41134
|
+
CharacterCodes2[CharacterCodes2["_2"] = 50] = "_2";
|
|
41135
|
+
CharacterCodes2[CharacterCodes2["_3"] = 51] = "_3";
|
|
41136
|
+
CharacterCodes2[CharacterCodes2["_4"] = 52] = "_4";
|
|
41137
|
+
CharacterCodes2[CharacterCodes2["_5"] = 53] = "_5";
|
|
41138
|
+
CharacterCodes2[CharacterCodes2["_6"] = 54] = "_6";
|
|
41139
|
+
CharacterCodes2[CharacterCodes2["_7"] = 55] = "_7";
|
|
41140
|
+
CharacterCodes2[CharacterCodes2["_8"] = 56] = "_8";
|
|
41141
|
+
CharacterCodes2[CharacterCodes2["_9"] = 57] = "_9";
|
|
41142
|
+
CharacterCodes2[CharacterCodes2["a"] = 97] = "a";
|
|
41143
|
+
CharacterCodes2[CharacterCodes2["b"] = 98] = "b";
|
|
41144
|
+
CharacterCodes2[CharacterCodes2["c"] = 99] = "c";
|
|
41145
|
+
CharacterCodes2[CharacterCodes2["d"] = 100] = "d";
|
|
41146
|
+
CharacterCodes2[CharacterCodes2["e"] = 101] = "e";
|
|
41147
|
+
CharacterCodes2[CharacterCodes2["f"] = 102] = "f";
|
|
41148
|
+
CharacterCodes2[CharacterCodes2["g"] = 103] = "g";
|
|
41149
|
+
CharacterCodes2[CharacterCodes2["h"] = 104] = "h";
|
|
41150
|
+
CharacterCodes2[CharacterCodes2["i"] = 105] = "i";
|
|
41151
|
+
CharacterCodes2[CharacterCodes2["j"] = 106] = "j";
|
|
41152
|
+
CharacterCodes2[CharacterCodes2["k"] = 107] = "k";
|
|
41153
|
+
CharacterCodes2[CharacterCodes2["l"] = 108] = "l";
|
|
41154
|
+
CharacterCodes2[CharacterCodes2["m"] = 109] = "m";
|
|
41155
|
+
CharacterCodes2[CharacterCodes2["n"] = 110] = "n";
|
|
41156
|
+
CharacterCodes2[CharacterCodes2["o"] = 111] = "o";
|
|
41157
|
+
CharacterCodes2[CharacterCodes2["p"] = 112] = "p";
|
|
41158
|
+
CharacterCodes2[CharacterCodes2["q"] = 113] = "q";
|
|
41159
|
+
CharacterCodes2[CharacterCodes2["r"] = 114] = "r";
|
|
41160
|
+
CharacterCodes2[CharacterCodes2["s"] = 115] = "s";
|
|
41161
|
+
CharacterCodes2[CharacterCodes2["t"] = 116] = "t";
|
|
41162
|
+
CharacterCodes2[CharacterCodes2["u"] = 117] = "u";
|
|
41163
|
+
CharacterCodes2[CharacterCodes2["v"] = 118] = "v";
|
|
41164
|
+
CharacterCodes2[CharacterCodes2["w"] = 119] = "w";
|
|
41165
|
+
CharacterCodes2[CharacterCodes2["x"] = 120] = "x";
|
|
41166
|
+
CharacterCodes2[CharacterCodes2["y"] = 121] = "y";
|
|
41167
|
+
CharacterCodes2[CharacterCodes2["z"] = 122] = "z";
|
|
41168
|
+
CharacterCodes2[CharacterCodes2["A"] = 65] = "A";
|
|
41169
|
+
CharacterCodes2[CharacterCodes2["B"] = 66] = "B";
|
|
41170
|
+
CharacterCodes2[CharacterCodes2["C"] = 67] = "C";
|
|
41171
|
+
CharacterCodes2[CharacterCodes2["D"] = 68] = "D";
|
|
41172
|
+
CharacterCodes2[CharacterCodes2["E"] = 69] = "E";
|
|
41173
|
+
CharacterCodes2[CharacterCodes2["F"] = 70] = "F";
|
|
41174
|
+
CharacterCodes2[CharacterCodes2["G"] = 71] = "G";
|
|
41175
|
+
CharacterCodes2[CharacterCodes2["H"] = 72] = "H";
|
|
41176
|
+
CharacterCodes2[CharacterCodes2["I"] = 73] = "I";
|
|
41177
|
+
CharacterCodes2[CharacterCodes2["J"] = 74] = "J";
|
|
41178
|
+
CharacterCodes2[CharacterCodes2["K"] = 75] = "K";
|
|
41179
|
+
CharacterCodes2[CharacterCodes2["L"] = 76] = "L";
|
|
41180
|
+
CharacterCodes2[CharacterCodes2["M"] = 77] = "M";
|
|
41181
|
+
CharacterCodes2[CharacterCodes2["N"] = 78] = "N";
|
|
41182
|
+
CharacterCodes2[CharacterCodes2["O"] = 79] = "O";
|
|
41183
|
+
CharacterCodes2[CharacterCodes2["P"] = 80] = "P";
|
|
41184
|
+
CharacterCodes2[CharacterCodes2["Q"] = 81] = "Q";
|
|
41185
|
+
CharacterCodes2[CharacterCodes2["R"] = 82] = "R";
|
|
41186
|
+
CharacterCodes2[CharacterCodes2["S"] = 83] = "S";
|
|
41187
|
+
CharacterCodes2[CharacterCodes2["T"] = 84] = "T";
|
|
41188
|
+
CharacterCodes2[CharacterCodes2["U"] = 85] = "U";
|
|
41189
|
+
CharacterCodes2[CharacterCodes2["V"] = 86] = "V";
|
|
41190
|
+
CharacterCodes2[CharacterCodes2["W"] = 87] = "W";
|
|
41191
|
+
CharacterCodes2[CharacterCodes2["X"] = 88] = "X";
|
|
41192
|
+
CharacterCodes2[CharacterCodes2["Y"] = 89] = "Y";
|
|
41193
|
+
CharacterCodes2[CharacterCodes2["Z"] = 90] = "Z";
|
|
41194
|
+
CharacterCodes2[CharacterCodes2["asterisk"] = 42] = "asterisk";
|
|
41195
|
+
CharacterCodes2[CharacterCodes2["backslash"] = 92] = "backslash";
|
|
41196
|
+
CharacterCodes2[CharacterCodes2["closeBrace"] = 125] = "closeBrace";
|
|
41197
|
+
CharacterCodes2[CharacterCodes2["closeBracket"] = 93] = "closeBracket";
|
|
41198
|
+
CharacterCodes2[CharacterCodes2["colon"] = 58] = "colon";
|
|
41199
|
+
CharacterCodes2[CharacterCodes2["comma"] = 44] = "comma";
|
|
41200
|
+
CharacterCodes2[CharacterCodes2["dot"] = 46] = "dot";
|
|
41201
|
+
CharacterCodes2[CharacterCodes2["doubleQuote"] = 34] = "doubleQuote";
|
|
41202
|
+
CharacterCodes2[CharacterCodes2["minus"] = 45] = "minus";
|
|
41203
|
+
CharacterCodes2[CharacterCodes2["openBrace"] = 123] = "openBrace";
|
|
41204
|
+
CharacterCodes2[CharacterCodes2["openBracket"] = 91] = "openBracket";
|
|
41205
|
+
CharacterCodes2[CharacterCodes2["plus"] = 43] = "plus";
|
|
41206
|
+
CharacterCodes2[CharacterCodes2["slash"] = 47] = "slash";
|
|
41207
|
+
CharacterCodes2[CharacterCodes2["formFeed"] = 12] = "formFeed";
|
|
41208
|
+
CharacterCodes2[CharacterCodes2["tab"] = 9] = "tab";
|
|
41209
|
+
})(CharacterCodes || (CharacterCodes = {}));
|
|
41210
|
+
}
|
|
41211
|
+
});
|
|
41212
|
+
|
|
41213
|
+
// node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/string-intern.js
|
|
41214
|
+
var cachedSpaces, maxCachedValues, cachedBreakLinesWithSpaces;
|
|
41215
|
+
var init_string_intern = __esm({
|
|
41216
|
+
"node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/string-intern.js"() {
|
|
41217
|
+
cachedSpaces = new Array(20).fill(0).map((_3, index) => {
|
|
41218
|
+
return " ".repeat(index);
|
|
41219
|
+
});
|
|
41220
|
+
maxCachedValues = 200;
|
|
41221
|
+
cachedBreakLinesWithSpaces = {
|
|
41222
|
+
" ": {
|
|
41223
|
+
"\n": new Array(maxCachedValues).fill(0).map((_3, index) => {
|
|
41224
|
+
return "\n" + " ".repeat(index);
|
|
41225
|
+
}),
|
|
41226
|
+
"\r": new Array(maxCachedValues).fill(0).map((_3, index) => {
|
|
41227
|
+
return "\r" + " ".repeat(index);
|
|
41228
|
+
}),
|
|
41229
|
+
"\r\n": new Array(maxCachedValues).fill(0).map((_3, index) => {
|
|
41230
|
+
return "\r\n" + " ".repeat(index);
|
|
41231
|
+
})
|
|
41232
|
+
},
|
|
41233
|
+
" ": {
|
|
41234
|
+
"\n": new Array(maxCachedValues).fill(0).map((_3, index) => {
|
|
41235
|
+
return "\n" + " ".repeat(index);
|
|
41236
|
+
}),
|
|
41237
|
+
"\r": new Array(maxCachedValues).fill(0).map((_3, index) => {
|
|
41238
|
+
return "\r" + " ".repeat(index);
|
|
41239
|
+
}),
|
|
41240
|
+
"\r\n": new Array(maxCachedValues).fill(0).map((_3, index) => {
|
|
41241
|
+
return "\r\n" + " ".repeat(index);
|
|
41242
|
+
})
|
|
41243
|
+
}
|
|
41244
|
+
};
|
|
41245
|
+
}
|
|
41246
|
+
});
|
|
41247
|
+
|
|
41248
|
+
// node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/format.js
|
|
41249
|
+
var init_format = __esm({
|
|
41250
|
+
"node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/format.js"() {
|
|
41251
|
+
"use strict";
|
|
41252
|
+
init_scanner2();
|
|
41253
|
+
init_string_intern();
|
|
41254
|
+
}
|
|
41255
|
+
});
|
|
41256
|
+
|
|
41257
|
+
// node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/parser.js
|
|
41258
|
+
function parseTree(text, errors = [], options = ParseOptions.DEFAULT) {
|
|
41259
|
+
let currentParent = { type: "array", offset: -1, length: -1, children: [], parent: void 0 };
|
|
41260
|
+
function ensurePropertyComplete(endOffset) {
|
|
41261
|
+
if (currentParent.type === "property") {
|
|
41262
|
+
currentParent.length = endOffset - currentParent.offset;
|
|
41263
|
+
currentParent = currentParent.parent;
|
|
41264
|
+
}
|
|
41265
|
+
}
|
|
41266
|
+
function onValue(valueNode) {
|
|
41267
|
+
currentParent.children.push(valueNode);
|
|
41268
|
+
return valueNode;
|
|
41269
|
+
}
|
|
41270
|
+
const visitor = {
|
|
41271
|
+
onObjectBegin: (offset) => {
|
|
41272
|
+
currentParent = onValue({ type: "object", offset, length: -1, parent: currentParent, children: [] });
|
|
41273
|
+
},
|
|
41274
|
+
onObjectProperty: (name, offset, length) => {
|
|
41275
|
+
currentParent = onValue({ type: "property", offset, length: -1, parent: currentParent, children: [] });
|
|
41276
|
+
currentParent.children.push({ type: "string", value: name, offset, length, parent: currentParent });
|
|
41277
|
+
},
|
|
41278
|
+
onObjectEnd: (offset, length) => {
|
|
41279
|
+
ensurePropertyComplete(offset + length);
|
|
41280
|
+
currentParent.length = offset + length - currentParent.offset;
|
|
41281
|
+
currentParent = currentParent.parent;
|
|
41282
|
+
ensurePropertyComplete(offset + length);
|
|
41283
|
+
},
|
|
41284
|
+
onArrayBegin: (offset, length) => {
|
|
41285
|
+
currentParent = onValue({ type: "array", offset, length: -1, parent: currentParent, children: [] });
|
|
41286
|
+
},
|
|
41287
|
+
onArrayEnd: (offset, length) => {
|
|
41288
|
+
currentParent.length = offset + length - currentParent.offset;
|
|
41289
|
+
currentParent = currentParent.parent;
|
|
41290
|
+
ensurePropertyComplete(offset + length);
|
|
41291
|
+
},
|
|
41292
|
+
onLiteralValue: (value, offset, length) => {
|
|
41293
|
+
onValue({ type: getNodeType(value), offset, length, parent: currentParent, value });
|
|
41294
|
+
ensurePropertyComplete(offset + length);
|
|
41295
|
+
},
|
|
41296
|
+
onSeparator: (sep, offset, length) => {
|
|
41297
|
+
if (currentParent.type === "property") {
|
|
41298
|
+
if (sep === ":") {
|
|
41299
|
+
currentParent.colonOffset = offset;
|
|
41300
|
+
} else if (sep === ",") {
|
|
41301
|
+
ensurePropertyComplete(offset);
|
|
41302
|
+
}
|
|
41303
|
+
}
|
|
41304
|
+
},
|
|
41305
|
+
onError: (error49, offset, length) => {
|
|
41306
|
+
errors.push({ error: error49, offset, length });
|
|
41307
|
+
}
|
|
41308
|
+
};
|
|
41309
|
+
visit(text, visitor, options);
|
|
41310
|
+
const result = currentParent.children[0];
|
|
41311
|
+
if (result) {
|
|
41312
|
+
delete result.parent;
|
|
41313
|
+
}
|
|
41314
|
+
return result;
|
|
41315
|
+
}
|
|
41316
|
+
function visit(text, visitor, options = ParseOptions.DEFAULT) {
|
|
41317
|
+
const _scanner = createScanner(text, false);
|
|
41318
|
+
const _jsonPath = [];
|
|
41319
|
+
let suppressedCallbacks = 0;
|
|
41320
|
+
function toNoArgVisit(visitFunction) {
|
|
41321
|
+
return visitFunction ? () => suppressedCallbacks === 0 && visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;
|
|
41322
|
+
}
|
|
41323
|
+
function toOneArgVisit(visitFunction) {
|
|
41324
|
+
return visitFunction ? (arg) => suppressedCallbacks === 0 && visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;
|
|
41325
|
+
}
|
|
41326
|
+
function toOneArgVisitWithPath(visitFunction) {
|
|
41327
|
+
return visitFunction ? (arg) => suppressedCallbacks === 0 && visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice()) : () => true;
|
|
41328
|
+
}
|
|
41329
|
+
function toBeginVisit(visitFunction) {
|
|
41330
|
+
return visitFunction ? () => {
|
|
41331
|
+
if (suppressedCallbacks > 0) {
|
|
41332
|
+
suppressedCallbacks++;
|
|
41333
|
+
} else {
|
|
41334
|
+
let cbReturn = visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice());
|
|
41335
|
+
if (cbReturn === false) {
|
|
41336
|
+
suppressedCallbacks = 1;
|
|
41337
|
+
}
|
|
41338
|
+
}
|
|
41339
|
+
} : () => true;
|
|
41340
|
+
}
|
|
41341
|
+
function toEndVisit(visitFunction) {
|
|
41342
|
+
return visitFunction ? () => {
|
|
41343
|
+
if (suppressedCallbacks > 0) {
|
|
41344
|
+
suppressedCallbacks--;
|
|
41345
|
+
}
|
|
41346
|
+
if (suppressedCallbacks === 0) {
|
|
41347
|
+
visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter());
|
|
41348
|
+
}
|
|
41349
|
+
} : () => true;
|
|
41350
|
+
}
|
|
41351
|
+
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);
|
|
41352
|
+
const disallowComments = options && options.disallowComments;
|
|
41353
|
+
const allowTrailingComma = options && options.allowTrailingComma;
|
|
41354
|
+
function scanNext() {
|
|
41355
|
+
while (true) {
|
|
41356
|
+
const token = _scanner.scan();
|
|
41357
|
+
switch (_scanner.getTokenError()) {
|
|
41358
|
+
case 4:
|
|
41359
|
+
handleError(
|
|
41360
|
+
14
|
|
41361
|
+
/* ParseErrorCode.InvalidUnicode */
|
|
41362
|
+
);
|
|
41363
|
+
break;
|
|
41364
|
+
case 5:
|
|
41365
|
+
handleError(
|
|
41366
|
+
15
|
|
41367
|
+
/* ParseErrorCode.InvalidEscapeCharacter */
|
|
41368
|
+
);
|
|
41369
|
+
break;
|
|
41370
|
+
case 3:
|
|
41371
|
+
handleError(
|
|
41372
|
+
13
|
|
41373
|
+
/* ParseErrorCode.UnexpectedEndOfNumber */
|
|
41374
|
+
);
|
|
41375
|
+
break;
|
|
41376
|
+
case 1:
|
|
41377
|
+
if (!disallowComments) {
|
|
41378
|
+
handleError(
|
|
41379
|
+
11
|
|
41380
|
+
/* ParseErrorCode.UnexpectedEndOfComment */
|
|
41381
|
+
);
|
|
41382
|
+
}
|
|
41383
|
+
break;
|
|
41384
|
+
case 2:
|
|
41385
|
+
handleError(
|
|
41386
|
+
12
|
|
41387
|
+
/* ParseErrorCode.UnexpectedEndOfString */
|
|
41388
|
+
);
|
|
41389
|
+
break;
|
|
41390
|
+
case 6:
|
|
41391
|
+
handleError(
|
|
41392
|
+
16
|
|
41393
|
+
/* ParseErrorCode.InvalidCharacter */
|
|
41394
|
+
);
|
|
41395
|
+
break;
|
|
41396
|
+
}
|
|
41397
|
+
switch (token) {
|
|
41398
|
+
case 12:
|
|
41399
|
+
case 13:
|
|
41400
|
+
if (disallowComments) {
|
|
41401
|
+
handleError(
|
|
41402
|
+
10
|
|
41403
|
+
/* ParseErrorCode.InvalidCommentToken */
|
|
41404
|
+
);
|
|
41405
|
+
} else {
|
|
41406
|
+
onComment();
|
|
41407
|
+
}
|
|
41408
|
+
break;
|
|
41409
|
+
case 16:
|
|
41410
|
+
handleError(
|
|
41411
|
+
1
|
|
41412
|
+
/* ParseErrorCode.InvalidSymbol */
|
|
41413
|
+
);
|
|
41414
|
+
break;
|
|
41415
|
+
case 15:
|
|
41416
|
+
case 14:
|
|
41417
|
+
break;
|
|
41418
|
+
default:
|
|
41419
|
+
return token;
|
|
41420
|
+
}
|
|
41421
|
+
}
|
|
41422
|
+
}
|
|
41423
|
+
function handleError(error49, skipUntilAfter = [], skipUntil = []) {
|
|
41424
|
+
onError2(error49);
|
|
41425
|
+
if (skipUntilAfter.length + skipUntil.length > 0) {
|
|
41426
|
+
let token = _scanner.getToken();
|
|
41427
|
+
while (token !== 17) {
|
|
41428
|
+
if (skipUntilAfter.indexOf(token) !== -1) {
|
|
41429
|
+
scanNext();
|
|
41430
|
+
break;
|
|
41431
|
+
} else if (skipUntil.indexOf(token) !== -1) {
|
|
41432
|
+
break;
|
|
41433
|
+
}
|
|
41434
|
+
token = scanNext();
|
|
41435
|
+
}
|
|
41436
|
+
}
|
|
41437
|
+
}
|
|
41438
|
+
function parseString(isValue) {
|
|
41439
|
+
const value = _scanner.getTokenValue();
|
|
41440
|
+
if (isValue) {
|
|
41441
|
+
onLiteralValue(value);
|
|
41442
|
+
} else {
|
|
41443
|
+
onObjectProperty(value);
|
|
41444
|
+
_jsonPath.push(value);
|
|
41445
|
+
}
|
|
41446
|
+
scanNext();
|
|
41447
|
+
return true;
|
|
41448
|
+
}
|
|
41449
|
+
function parseLiteral() {
|
|
41450
|
+
switch (_scanner.getToken()) {
|
|
41451
|
+
case 11:
|
|
41452
|
+
const tokenValue = _scanner.getTokenValue();
|
|
41453
|
+
let value = Number(tokenValue);
|
|
41454
|
+
if (isNaN(value)) {
|
|
41455
|
+
handleError(
|
|
41456
|
+
2
|
|
41457
|
+
/* ParseErrorCode.InvalidNumberFormat */
|
|
41458
|
+
);
|
|
41459
|
+
value = 0;
|
|
41460
|
+
}
|
|
41461
|
+
onLiteralValue(value);
|
|
41462
|
+
break;
|
|
41463
|
+
case 7:
|
|
41464
|
+
onLiteralValue(null);
|
|
41465
|
+
break;
|
|
41466
|
+
case 8:
|
|
41467
|
+
onLiteralValue(true);
|
|
41468
|
+
break;
|
|
41469
|
+
case 9:
|
|
41470
|
+
onLiteralValue(false);
|
|
41471
|
+
break;
|
|
41472
|
+
default:
|
|
41473
|
+
return false;
|
|
41474
|
+
}
|
|
41475
|
+
scanNext();
|
|
41476
|
+
return true;
|
|
41477
|
+
}
|
|
41478
|
+
function parseProperty() {
|
|
41479
|
+
if (_scanner.getToken() !== 10) {
|
|
41480
|
+
handleError(3, [], [
|
|
41481
|
+
2,
|
|
41482
|
+
5
|
|
41483
|
+
/* SyntaxKind.CommaToken */
|
|
41484
|
+
]);
|
|
41485
|
+
return false;
|
|
41486
|
+
}
|
|
41487
|
+
parseString(false);
|
|
41488
|
+
if (_scanner.getToken() === 6) {
|
|
41489
|
+
onSeparator(":");
|
|
41490
|
+
scanNext();
|
|
41491
|
+
if (!parseValue()) {
|
|
41492
|
+
handleError(4, [], [
|
|
41493
|
+
2,
|
|
41494
|
+
5
|
|
41495
|
+
/* SyntaxKind.CommaToken */
|
|
41496
|
+
]);
|
|
41497
|
+
}
|
|
41498
|
+
} else {
|
|
41499
|
+
handleError(5, [], [
|
|
41500
|
+
2,
|
|
41501
|
+
5
|
|
41502
|
+
/* SyntaxKind.CommaToken */
|
|
41503
|
+
]);
|
|
41504
|
+
}
|
|
41505
|
+
_jsonPath.pop();
|
|
41506
|
+
return true;
|
|
41507
|
+
}
|
|
41508
|
+
function parseObject() {
|
|
41509
|
+
onObjectBegin();
|
|
41510
|
+
scanNext();
|
|
41511
|
+
let needsComma = false;
|
|
41512
|
+
while (_scanner.getToken() !== 2 && _scanner.getToken() !== 17) {
|
|
41513
|
+
if (_scanner.getToken() === 5) {
|
|
41514
|
+
if (!needsComma) {
|
|
41515
|
+
handleError(4, [], []);
|
|
41516
|
+
}
|
|
41517
|
+
onSeparator(",");
|
|
41518
|
+
scanNext();
|
|
41519
|
+
if (_scanner.getToken() === 2 && allowTrailingComma) {
|
|
41520
|
+
break;
|
|
41521
|
+
}
|
|
41522
|
+
} else if (needsComma) {
|
|
41523
|
+
handleError(6, [], []);
|
|
41524
|
+
}
|
|
41525
|
+
if (!parseProperty()) {
|
|
41526
|
+
handleError(4, [], [
|
|
41527
|
+
2,
|
|
41528
|
+
5
|
|
41529
|
+
/* SyntaxKind.CommaToken */
|
|
41530
|
+
]);
|
|
41531
|
+
}
|
|
41532
|
+
needsComma = true;
|
|
41533
|
+
}
|
|
41534
|
+
onObjectEnd();
|
|
41535
|
+
if (_scanner.getToken() !== 2) {
|
|
41536
|
+
handleError(7, [
|
|
41537
|
+
2
|
|
41538
|
+
/* SyntaxKind.CloseBraceToken */
|
|
41539
|
+
], []);
|
|
41540
|
+
} else {
|
|
41541
|
+
scanNext();
|
|
41542
|
+
}
|
|
41543
|
+
return true;
|
|
41544
|
+
}
|
|
41545
|
+
function parseArray() {
|
|
41546
|
+
onArrayBegin();
|
|
41547
|
+
scanNext();
|
|
41548
|
+
let isFirstElement = true;
|
|
41549
|
+
let needsComma = false;
|
|
41550
|
+
while (_scanner.getToken() !== 4 && _scanner.getToken() !== 17) {
|
|
41551
|
+
if (_scanner.getToken() === 5) {
|
|
41552
|
+
if (!needsComma) {
|
|
41553
|
+
handleError(4, [], []);
|
|
41554
|
+
}
|
|
41555
|
+
onSeparator(",");
|
|
41556
|
+
scanNext();
|
|
41557
|
+
if (_scanner.getToken() === 4 && allowTrailingComma) {
|
|
41558
|
+
break;
|
|
41559
|
+
}
|
|
41560
|
+
} else if (needsComma) {
|
|
41561
|
+
handleError(6, [], []);
|
|
41562
|
+
}
|
|
41563
|
+
if (isFirstElement) {
|
|
41564
|
+
_jsonPath.push(0);
|
|
41565
|
+
isFirstElement = false;
|
|
41566
|
+
} else {
|
|
41567
|
+
_jsonPath[_jsonPath.length - 1]++;
|
|
41568
|
+
}
|
|
41569
|
+
if (!parseValue()) {
|
|
41570
|
+
handleError(4, [], [
|
|
41571
|
+
4,
|
|
41572
|
+
5
|
|
41573
|
+
/* SyntaxKind.CommaToken */
|
|
41574
|
+
]);
|
|
41575
|
+
}
|
|
41576
|
+
needsComma = true;
|
|
41577
|
+
}
|
|
41578
|
+
onArrayEnd();
|
|
41579
|
+
if (!isFirstElement) {
|
|
41580
|
+
_jsonPath.pop();
|
|
41581
|
+
}
|
|
41582
|
+
if (_scanner.getToken() !== 4) {
|
|
41583
|
+
handleError(8, [
|
|
41584
|
+
4
|
|
41585
|
+
/* SyntaxKind.CloseBracketToken */
|
|
41586
|
+
], []);
|
|
41587
|
+
} else {
|
|
41588
|
+
scanNext();
|
|
41589
|
+
}
|
|
41590
|
+
return true;
|
|
41591
|
+
}
|
|
41592
|
+
function parseValue() {
|
|
41593
|
+
switch (_scanner.getToken()) {
|
|
41594
|
+
case 3:
|
|
41595
|
+
return parseArray();
|
|
41596
|
+
case 1:
|
|
41597
|
+
return parseObject();
|
|
41598
|
+
case 10:
|
|
41599
|
+
return parseString(true);
|
|
41600
|
+
default:
|
|
41601
|
+
return parseLiteral();
|
|
41602
|
+
}
|
|
41603
|
+
}
|
|
41604
|
+
scanNext();
|
|
41605
|
+
if (_scanner.getToken() === 17) {
|
|
41606
|
+
if (options.allowEmptyContent) {
|
|
41607
|
+
return true;
|
|
41608
|
+
}
|
|
41609
|
+
handleError(4, [], []);
|
|
41610
|
+
return false;
|
|
41611
|
+
}
|
|
41612
|
+
if (!parseValue()) {
|
|
41613
|
+
handleError(4, [], []);
|
|
41614
|
+
return false;
|
|
41615
|
+
}
|
|
41616
|
+
if (_scanner.getToken() !== 17) {
|
|
41617
|
+
handleError(9, [], []);
|
|
41618
|
+
}
|
|
41619
|
+
return true;
|
|
41620
|
+
}
|
|
41621
|
+
function getNodeType(value) {
|
|
41622
|
+
switch (typeof value) {
|
|
41623
|
+
case "boolean":
|
|
41624
|
+
return "boolean";
|
|
41625
|
+
case "number":
|
|
41626
|
+
return "number";
|
|
41627
|
+
case "string":
|
|
41628
|
+
return "string";
|
|
41629
|
+
case "object": {
|
|
41630
|
+
if (!value) {
|
|
41631
|
+
return "null";
|
|
41632
|
+
} else if (Array.isArray(value)) {
|
|
41633
|
+
return "array";
|
|
41634
|
+
}
|
|
41635
|
+
return "object";
|
|
41636
|
+
}
|
|
41637
|
+
default:
|
|
41638
|
+
return "null";
|
|
41639
|
+
}
|
|
41640
|
+
}
|
|
41641
|
+
var ParseOptions;
|
|
41642
|
+
var init_parser2 = __esm({
|
|
41643
|
+
"node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/parser.js"() {
|
|
41644
|
+
"use strict";
|
|
41645
|
+
init_scanner2();
|
|
41646
|
+
(function(ParseOptions2) {
|
|
41647
|
+
ParseOptions2.DEFAULT = {
|
|
41648
|
+
allowTrailingComma: false
|
|
41649
|
+
};
|
|
41650
|
+
})(ParseOptions || (ParseOptions = {}));
|
|
41651
|
+
}
|
|
41652
|
+
});
|
|
41653
|
+
|
|
41654
|
+
// node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/edit.js
|
|
41655
|
+
var init_edit = __esm({
|
|
41656
|
+
"node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/edit.js"() {
|
|
41657
|
+
"use strict";
|
|
41658
|
+
init_format();
|
|
41659
|
+
init_parser2();
|
|
41660
|
+
}
|
|
41661
|
+
});
|
|
41662
|
+
|
|
41663
|
+
// node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/main.js
|
|
41664
|
+
var ScanError, SyntaxKind, parseTree2, ParseErrorCode;
|
|
41665
|
+
var init_main = __esm({
|
|
41666
|
+
"node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/main.js"() {
|
|
40740
41667
|
"use strict";
|
|
40741
|
-
|
|
40742
|
-
|
|
40743
|
-
|
|
40744
|
-
|
|
40745
|
-
|
|
40746
|
-
|
|
40747
|
-
|
|
40748
|
-
|
|
40749
|
-
|
|
40750
|
-
|
|
40751
|
-
|
|
41668
|
+
init_format();
|
|
41669
|
+
init_edit();
|
|
41670
|
+
init_scanner2();
|
|
41671
|
+
init_parser2();
|
|
41672
|
+
(function(ScanError2) {
|
|
41673
|
+
ScanError2[ScanError2["None"] = 0] = "None";
|
|
41674
|
+
ScanError2[ScanError2["UnexpectedEndOfComment"] = 1] = "UnexpectedEndOfComment";
|
|
41675
|
+
ScanError2[ScanError2["UnexpectedEndOfString"] = 2] = "UnexpectedEndOfString";
|
|
41676
|
+
ScanError2[ScanError2["UnexpectedEndOfNumber"] = 3] = "UnexpectedEndOfNumber";
|
|
41677
|
+
ScanError2[ScanError2["InvalidUnicode"] = 4] = "InvalidUnicode";
|
|
41678
|
+
ScanError2[ScanError2["InvalidEscapeCharacter"] = 5] = "InvalidEscapeCharacter";
|
|
41679
|
+
ScanError2[ScanError2["InvalidCharacter"] = 6] = "InvalidCharacter";
|
|
41680
|
+
})(ScanError || (ScanError = {}));
|
|
41681
|
+
(function(SyntaxKind2) {
|
|
41682
|
+
SyntaxKind2[SyntaxKind2["OpenBraceToken"] = 1] = "OpenBraceToken";
|
|
41683
|
+
SyntaxKind2[SyntaxKind2["CloseBraceToken"] = 2] = "CloseBraceToken";
|
|
41684
|
+
SyntaxKind2[SyntaxKind2["OpenBracketToken"] = 3] = "OpenBracketToken";
|
|
41685
|
+
SyntaxKind2[SyntaxKind2["CloseBracketToken"] = 4] = "CloseBracketToken";
|
|
41686
|
+
SyntaxKind2[SyntaxKind2["CommaToken"] = 5] = "CommaToken";
|
|
41687
|
+
SyntaxKind2[SyntaxKind2["ColonToken"] = 6] = "ColonToken";
|
|
41688
|
+
SyntaxKind2[SyntaxKind2["NullKeyword"] = 7] = "NullKeyword";
|
|
41689
|
+
SyntaxKind2[SyntaxKind2["TrueKeyword"] = 8] = "TrueKeyword";
|
|
41690
|
+
SyntaxKind2[SyntaxKind2["FalseKeyword"] = 9] = "FalseKeyword";
|
|
41691
|
+
SyntaxKind2[SyntaxKind2["StringLiteral"] = 10] = "StringLiteral";
|
|
41692
|
+
SyntaxKind2[SyntaxKind2["NumericLiteral"] = 11] = "NumericLiteral";
|
|
41693
|
+
SyntaxKind2[SyntaxKind2["LineCommentTrivia"] = 12] = "LineCommentTrivia";
|
|
41694
|
+
SyntaxKind2[SyntaxKind2["BlockCommentTrivia"] = 13] = "BlockCommentTrivia";
|
|
41695
|
+
SyntaxKind2[SyntaxKind2["LineBreakTrivia"] = 14] = "LineBreakTrivia";
|
|
41696
|
+
SyntaxKind2[SyntaxKind2["Trivia"] = 15] = "Trivia";
|
|
41697
|
+
SyntaxKind2[SyntaxKind2["Unknown"] = 16] = "Unknown";
|
|
41698
|
+
SyntaxKind2[SyntaxKind2["EOF"] = 17] = "EOF";
|
|
41699
|
+
})(SyntaxKind || (SyntaxKind = {}));
|
|
41700
|
+
parseTree2 = parseTree;
|
|
41701
|
+
(function(ParseErrorCode2) {
|
|
41702
|
+
ParseErrorCode2[ParseErrorCode2["InvalidSymbol"] = 1] = "InvalidSymbol";
|
|
41703
|
+
ParseErrorCode2[ParseErrorCode2["InvalidNumberFormat"] = 2] = "InvalidNumberFormat";
|
|
41704
|
+
ParseErrorCode2[ParseErrorCode2["PropertyNameExpected"] = 3] = "PropertyNameExpected";
|
|
41705
|
+
ParseErrorCode2[ParseErrorCode2["ValueExpected"] = 4] = "ValueExpected";
|
|
41706
|
+
ParseErrorCode2[ParseErrorCode2["ColonExpected"] = 5] = "ColonExpected";
|
|
41707
|
+
ParseErrorCode2[ParseErrorCode2["CommaExpected"] = 6] = "CommaExpected";
|
|
41708
|
+
ParseErrorCode2[ParseErrorCode2["CloseBraceExpected"] = 7] = "CloseBraceExpected";
|
|
41709
|
+
ParseErrorCode2[ParseErrorCode2["CloseBracketExpected"] = 8] = "CloseBracketExpected";
|
|
41710
|
+
ParseErrorCode2[ParseErrorCode2["EndOfFileExpected"] = 9] = "EndOfFileExpected";
|
|
41711
|
+
ParseErrorCode2[ParseErrorCode2["InvalidCommentToken"] = 10] = "InvalidCommentToken";
|
|
41712
|
+
ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfComment"] = 11] = "UnexpectedEndOfComment";
|
|
41713
|
+
ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfString"] = 12] = "UnexpectedEndOfString";
|
|
41714
|
+
ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfNumber"] = 13] = "UnexpectedEndOfNumber";
|
|
41715
|
+
ParseErrorCode2[ParseErrorCode2["InvalidUnicode"] = 14] = "InvalidUnicode";
|
|
41716
|
+
ParseErrorCode2[ParseErrorCode2["InvalidEscapeCharacter"] = 15] = "InvalidEscapeCharacter";
|
|
41717
|
+
ParseErrorCode2[ParseErrorCode2["InvalidCharacter"] = 16] = "InvalidCharacter";
|
|
41718
|
+
})(ParseErrorCode || (ParseErrorCode = {}));
|
|
41719
|
+
}
|
|
41720
|
+
});
|
|
41721
|
+
|
|
41722
|
+
// src/core/mcph-parser.ts
|
|
41723
|
+
import * as fs4 from "node:fs";
|
|
41724
|
+
import * as path3 from "node:path";
|
|
41725
|
+
async function parseMchpConfig(file2, projectRoot, scopeOverride) {
|
|
41726
|
+
const content = readFileContent(file2.absolutePath);
|
|
41727
|
+
const scope = scopeOverride ?? detectScope2(file2.relativePath);
|
|
41728
|
+
const isGitTracked = await checkGitTracked2(file2.absolutePath, projectRoot);
|
|
41729
|
+
const isGitignored = checkGitignored(file2.absolutePath, projectRoot);
|
|
41730
|
+
const result = {
|
|
41731
|
+
filePath: file2.absolutePath,
|
|
41732
|
+
relativePath: file2.relativePath,
|
|
41733
|
+
scope,
|
|
41734
|
+
content,
|
|
41735
|
+
parseErrors: [],
|
|
41736
|
+
isGitTracked,
|
|
41737
|
+
isGitignored,
|
|
41738
|
+
raw: null,
|
|
41739
|
+
positions: {},
|
|
41740
|
+
listEntries: { servers: [], blocked: [] },
|
|
41741
|
+
unknownFields: []
|
|
41742
|
+
};
|
|
41743
|
+
const errors = [];
|
|
41744
|
+
const tree = parseTree2(content, errors, { allowTrailingComma: true });
|
|
41745
|
+
if (errors.length > 0 || !tree) {
|
|
41746
|
+
for (const e of errors) {
|
|
41747
|
+
const { line, column } = offsetToPosition(content, e.offset);
|
|
41748
|
+
result.parseErrors.push(`Parse error at ${line}:${column} (code ${e.error})`);
|
|
41749
|
+
}
|
|
41750
|
+
return result;
|
|
41751
|
+
}
|
|
41752
|
+
if (tree.type !== "object") {
|
|
41753
|
+
result.parseErrors.push(".mcph.json must be a JSON object at the root");
|
|
41754
|
+
return result;
|
|
41755
|
+
}
|
|
41756
|
+
try {
|
|
41757
|
+
result.raw = JSON.parse(stripComments2(content));
|
|
41758
|
+
} catch {
|
|
41759
|
+
return result;
|
|
41760
|
+
}
|
|
41761
|
+
const rootProps = tree.children ?? [];
|
|
41762
|
+
for (const prop of rootProps) {
|
|
41763
|
+
if (prop.type !== "property" || !prop.children || prop.children.length < 2) continue;
|
|
41764
|
+
const keyNode = prop.children[0];
|
|
41765
|
+
const valueNode = prop.children[1];
|
|
41766
|
+
if (keyNode.type !== "string" || typeof keyNode.value !== "string") continue;
|
|
41767
|
+
const name = keyNode.value;
|
|
41768
|
+
const position = nodePosition(content, keyNode);
|
|
41769
|
+
if (KNOWN_FIELDS.has(name)) {
|
|
41770
|
+
result.positions[name] = position;
|
|
41771
|
+
if (name === "servers" || name === "blocked") {
|
|
41772
|
+
if (valueNode.type === "array" && valueNode.children) {
|
|
41773
|
+
for (const item of valueNode.children) {
|
|
41774
|
+
if (item.type === "string" && typeof item.value === "string") {
|
|
41775
|
+
result.listEntries[name].push({
|
|
41776
|
+
value: item.value,
|
|
41777
|
+
position: nodePosition(content, item)
|
|
41778
|
+
});
|
|
41779
|
+
}
|
|
41780
|
+
}
|
|
41781
|
+
}
|
|
41782
|
+
}
|
|
41783
|
+
} else {
|
|
41784
|
+
result.unknownFields.push({ name, position });
|
|
41785
|
+
}
|
|
41786
|
+
}
|
|
41787
|
+
return result;
|
|
41788
|
+
}
|
|
41789
|
+
function detectScope2(relativePath) {
|
|
41790
|
+
const normalized = relativePath.replace(/\\/g, "/");
|
|
41791
|
+
if (normalized.startsWith("~/")) return "global";
|
|
41792
|
+
if (normalized.endsWith(".mcph.local.json")) return "project-local";
|
|
41793
|
+
return "project";
|
|
41794
|
+
}
|
|
41795
|
+
function nodePosition(content, node) {
|
|
41796
|
+
const start = offsetToPosition(content, node.offset);
|
|
41797
|
+
const end = offsetToPosition(content, node.offset + node.length);
|
|
41798
|
+
return {
|
|
41799
|
+
line: start.line,
|
|
41800
|
+
column: start.column,
|
|
41801
|
+
endLine: end.line,
|
|
41802
|
+
endColumn: end.column
|
|
41803
|
+
};
|
|
41804
|
+
}
|
|
41805
|
+
function offsetToPosition(content, offset) {
|
|
41806
|
+
let line = 1;
|
|
41807
|
+
let column = 1;
|
|
41808
|
+
for (let i2 = 0; i2 < offset && i2 < content.length; i2++) {
|
|
41809
|
+
if (content[i2] === "\n") {
|
|
41810
|
+
line++;
|
|
41811
|
+
column = 1;
|
|
41812
|
+
} else {
|
|
41813
|
+
column++;
|
|
41814
|
+
}
|
|
41815
|
+
}
|
|
41816
|
+
return { line, column };
|
|
41817
|
+
}
|
|
41818
|
+
function stripComments2(src) {
|
|
41819
|
+
let out = "";
|
|
41820
|
+
let i2 = 0;
|
|
41821
|
+
let inString = false;
|
|
41822
|
+
let escape2 = false;
|
|
41823
|
+
while (i2 < src.length) {
|
|
41824
|
+
const ch = src[i2];
|
|
41825
|
+
if (inString) {
|
|
41826
|
+
out += ch;
|
|
41827
|
+
if (escape2) {
|
|
41828
|
+
escape2 = false;
|
|
41829
|
+
} else if (ch === "\\") {
|
|
41830
|
+
escape2 = true;
|
|
41831
|
+
} else if (ch === '"') {
|
|
41832
|
+
inString = false;
|
|
41833
|
+
}
|
|
41834
|
+
i2++;
|
|
41835
|
+
continue;
|
|
41836
|
+
}
|
|
41837
|
+
if (ch === '"') {
|
|
41838
|
+
inString = true;
|
|
41839
|
+
out += ch;
|
|
41840
|
+
i2++;
|
|
41841
|
+
continue;
|
|
41842
|
+
}
|
|
41843
|
+
if (ch === "/" && src[i2 + 1] === "/") {
|
|
41844
|
+
while (i2 < src.length && src[i2] !== "\n") i2++;
|
|
41845
|
+
continue;
|
|
41846
|
+
}
|
|
41847
|
+
if (ch === "/" && src[i2 + 1] === "*") {
|
|
41848
|
+
i2 += 2;
|
|
41849
|
+
while (i2 < src.length && !(src[i2] === "*" && src[i2 + 1] === "/")) i2++;
|
|
41850
|
+
i2 += 2;
|
|
41851
|
+
continue;
|
|
41852
|
+
}
|
|
41853
|
+
out += ch;
|
|
41854
|
+
i2++;
|
|
41855
|
+
}
|
|
41856
|
+
return out;
|
|
41857
|
+
}
|
|
41858
|
+
async function checkGitTracked2(filePath, projectRoot) {
|
|
41859
|
+
try {
|
|
41860
|
+
const git = getGit(projectRoot);
|
|
41861
|
+
const result = await git.raw(["ls-files", "--error-unmatch", filePath]);
|
|
41862
|
+
return result.trim().length > 0;
|
|
41863
|
+
} catch {
|
|
41864
|
+
return false;
|
|
41865
|
+
}
|
|
41866
|
+
}
|
|
41867
|
+
function checkGitignored(filePath, projectRoot) {
|
|
41868
|
+
const gitignorePath = path3.join(projectRoot, ".gitignore");
|
|
41869
|
+
let content;
|
|
41870
|
+
try {
|
|
41871
|
+
content = fs4.readFileSync(gitignorePath, "utf-8");
|
|
41872
|
+
} catch {
|
|
41873
|
+
return false;
|
|
41874
|
+
}
|
|
41875
|
+
const basename5 = path3.basename(filePath);
|
|
41876
|
+
const patterns = content.split(/\r?\n/).map((l) => l.trim()).filter((l) => l && !l.startsWith("#"));
|
|
41877
|
+
return patterns.some((p2) => p2 === basename5 || p2 === `/${basename5}` || p2 === `./${basename5}`);
|
|
41878
|
+
}
|
|
41879
|
+
var KNOWN_FIELDS;
|
|
41880
|
+
var init_mcph_parser = __esm({
|
|
41881
|
+
"src/core/mcph-parser.ts"() {
|
|
41882
|
+
"use strict";
|
|
41883
|
+
init_main();
|
|
41884
|
+
init_fs();
|
|
41885
|
+
init_git();
|
|
41886
|
+
KNOWN_FIELDS = /* @__PURE__ */ new Set(["$schema", "version", "token", "apiBase", "servers", "blocked"]);
|
|
41887
|
+
}
|
|
41888
|
+
});
|
|
41889
|
+
|
|
41890
|
+
// node_modules/.pnpm/fastest-levenshtein@1.0.16/node_modules/fastest-levenshtein/esm/mod.js
|
|
41891
|
+
var mod_exports = {};
|
|
41892
|
+
__export(mod_exports, {
|
|
41893
|
+
closest: () => closest,
|
|
41894
|
+
distance: () => distance
|
|
41895
|
+
});
|
|
41896
|
+
var peq, myers_32, myers_x, distance, closest;
|
|
41897
|
+
var init_mod = __esm({
|
|
41898
|
+
"node_modules/.pnpm/fastest-levenshtein@1.0.16/node_modules/fastest-levenshtein/esm/mod.js"() {
|
|
41899
|
+
peq = new Uint32Array(65536);
|
|
41900
|
+
myers_32 = (a, b2) => {
|
|
41901
|
+
const n7 = a.length;
|
|
41902
|
+
const m = b2.length;
|
|
41903
|
+
const lst = 1 << n7 - 1;
|
|
41904
|
+
let pv = -1;
|
|
41905
|
+
let mv = 0;
|
|
41906
|
+
let sc = n7;
|
|
41907
|
+
let i2 = n7;
|
|
40752
41908
|
while (i2--) {
|
|
40753
41909
|
peq[a.charCodeAt(i2)] |= 1 << i2;
|
|
40754
41910
|
}
|
|
40755
41911
|
for (i2 = 0; i2 < m; i2++) {
|
|
40756
|
-
|
|
40757
|
-
|
|
41912
|
+
let eq = peq[b2.charCodeAt(i2)];
|
|
41913
|
+
const xv = eq | mv;
|
|
40758
41914
|
eq |= (eq & pv) + pv ^ pv;
|
|
40759
41915
|
mv |= ~(eq | pv);
|
|
40760
41916
|
pv &= eq;
|
|
@@ -40774,34 +41930,34 @@ var require_mod = __commonJS({
|
|
|
40774
41930
|
}
|
|
40775
41931
|
return sc;
|
|
40776
41932
|
};
|
|
40777
|
-
|
|
40778
|
-
|
|
40779
|
-
|
|
40780
|
-
|
|
40781
|
-
|
|
40782
|
-
|
|
40783
|
-
|
|
40784
|
-
for (
|
|
41933
|
+
myers_x = (b2, a) => {
|
|
41934
|
+
const n7 = a.length;
|
|
41935
|
+
const m = b2.length;
|
|
41936
|
+
const mhc = [];
|
|
41937
|
+
const phc = [];
|
|
41938
|
+
const hsize = Math.ceil(n7 / 32);
|
|
41939
|
+
const vsize = Math.ceil(m / 32);
|
|
41940
|
+
for (let i2 = 0; i2 < hsize; i2++) {
|
|
40785
41941
|
phc[i2] = -1;
|
|
40786
41942
|
mhc[i2] = 0;
|
|
40787
41943
|
}
|
|
40788
|
-
|
|
41944
|
+
let j3 = 0;
|
|
40789
41945
|
for (; j3 < vsize - 1; j3++) {
|
|
40790
|
-
|
|
40791
|
-
|
|
40792
|
-
|
|
40793
|
-
|
|
40794
|
-
for (
|
|
41946
|
+
let mv2 = 0;
|
|
41947
|
+
let pv2 = -1;
|
|
41948
|
+
const start2 = j3 * 32;
|
|
41949
|
+
const vlen2 = Math.min(32, m) + start2;
|
|
41950
|
+
for (let k3 = start2; k3 < vlen2; k3++) {
|
|
40795
41951
|
peq[b2.charCodeAt(k3)] |= 1 << k3;
|
|
40796
41952
|
}
|
|
40797
|
-
for (
|
|
40798
|
-
|
|
40799
|
-
|
|
40800
|
-
|
|
40801
|
-
|
|
40802
|
-
|
|
40803
|
-
|
|
40804
|
-
|
|
41953
|
+
for (let i2 = 0; i2 < n7; i2++) {
|
|
41954
|
+
const eq = peq[a.charCodeAt(i2)];
|
|
41955
|
+
const pb = phc[i2 / 32 | 0] >>> i2 & 1;
|
|
41956
|
+
const mb = mhc[i2 / 32 | 0] >>> i2 & 1;
|
|
41957
|
+
const xv = eq | mv2;
|
|
41958
|
+
const xh = ((eq | mb) & pv2) + pv2 ^ pv2 | eq | mb;
|
|
41959
|
+
let ph = mv2 | ~(xh | pv2);
|
|
41960
|
+
let mh = pv2 & xh;
|
|
40805
41961
|
if (ph >>> 31 ^ pb) {
|
|
40806
41962
|
phc[i2 / 32 | 0] ^= 1 << i2;
|
|
40807
41963
|
}
|
|
@@ -40810,29 +41966,29 @@ var require_mod = __commonJS({
|
|
|
40810
41966
|
}
|
|
40811
41967
|
ph = ph << 1 | pb;
|
|
40812
41968
|
mh = mh << 1 | mb;
|
|
40813
|
-
|
|
40814
|
-
|
|
41969
|
+
pv2 = mh | ~(xv | ph);
|
|
41970
|
+
mv2 = ph & xv;
|
|
40815
41971
|
}
|
|
40816
|
-
for (
|
|
41972
|
+
for (let k3 = start2; k3 < vlen2; k3++) {
|
|
40817
41973
|
peq[b2.charCodeAt(k3)] = 0;
|
|
40818
41974
|
}
|
|
40819
41975
|
}
|
|
40820
|
-
|
|
40821
|
-
|
|
40822
|
-
|
|
40823
|
-
|
|
40824
|
-
for (
|
|
41976
|
+
let mv = 0;
|
|
41977
|
+
let pv = -1;
|
|
41978
|
+
const start = j3 * 32;
|
|
41979
|
+
const vlen = Math.min(32, m - start) + start;
|
|
41980
|
+
for (let k3 = start; k3 < vlen; k3++) {
|
|
40825
41981
|
peq[b2.charCodeAt(k3)] |= 1 << k3;
|
|
40826
41982
|
}
|
|
40827
|
-
|
|
40828
|
-
for (
|
|
40829
|
-
|
|
40830
|
-
|
|
40831
|
-
|
|
40832
|
-
|
|
40833
|
-
|
|
40834
|
-
|
|
40835
|
-
|
|
41983
|
+
let score = m;
|
|
41984
|
+
for (let i2 = 0; i2 < n7; i2++) {
|
|
41985
|
+
const eq = peq[a.charCodeAt(i2)];
|
|
41986
|
+
const pb = phc[i2 / 32 | 0] >>> i2 & 1;
|
|
41987
|
+
const mb = mhc[i2 / 32 | 0] >>> i2 & 1;
|
|
41988
|
+
const xv = eq | mv;
|
|
41989
|
+
const xh = ((eq | mb) & pv) + pv ^ pv | eq | mb;
|
|
41990
|
+
let ph = mv | ~(xh | pv);
|
|
41991
|
+
let mh = pv & xh;
|
|
40836
41992
|
score += ph >>> m - 1 & 1;
|
|
40837
41993
|
score -= mh >>> m - 1 & 1;
|
|
40838
41994
|
if (ph >>> 31 ^ pb) {
|
|
@@ -40846,14 +42002,14 @@ var require_mod = __commonJS({
|
|
|
40846
42002
|
pv = mh | ~(xv | ph);
|
|
40847
42003
|
mv = ph & xv;
|
|
40848
42004
|
}
|
|
40849
|
-
for (
|
|
42005
|
+
for (let k3 = start; k3 < vlen; k3++) {
|
|
40850
42006
|
peq[b2.charCodeAt(k3)] = 0;
|
|
40851
42007
|
}
|
|
40852
42008
|
return score;
|
|
40853
42009
|
};
|
|
40854
|
-
|
|
42010
|
+
distance = (a, b2) => {
|
|
40855
42011
|
if (a.length < b2.length) {
|
|
40856
|
-
|
|
42012
|
+
const tmp = b2;
|
|
40857
42013
|
b2 = a;
|
|
40858
42014
|
a = tmp;
|
|
40859
42015
|
}
|
|
@@ -40865,12 +42021,11 @@ var require_mod = __commonJS({
|
|
|
40865
42021
|
}
|
|
40866
42022
|
return myers_x(a, b2);
|
|
40867
42023
|
};
|
|
40868
|
-
|
|
40869
|
-
|
|
40870
|
-
|
|
40871
|
-
|
|
40872
|
-
|
|
40873
|
-
var dist = distance(str, arr[i2]);
|
|
42024
|
+
closest = (str, arr) => {
|
|
42025
|
+
let min_distance = Infinity;
|
|
42026
|
+
let min_index = 0;
|
|
42027
|
+
for (let i2 = 0; i2 < arr.length; i2++) {
|
|
42028
|
+
const dist = distance(str, arr[i2]);
|
|
40874
42029
|
if (dist < min_distance) {
|
|
40875
42030
|
min_distance = dist;
|
|
40876
42031
|
min_index = i2;
|
|
@@ -40878,7 +42033,6 @@ var require_mod = __commonJS({
|
|
|
40878
42033
|
}
|
|
40879
42034
|
return arr[min_index];
|
|
40880
42035
|
};
|
|
40881
|
-
exports.closest = closest;
|
|
40882
42036
|
}
|
|
40883
42037
|
});
|
|
40884
42038
|
|
|
@@ -40893,7 +42047,7 @@ var require_levenshtein = __commonJS({
|
|
|
40893
42047
|
} catch (err) {
|
|
40894
42048
|
console.log("Collator could not be initialized and wouldn't be used");
|
|
40895
42049
|
}
|
|
40896
|
-
var levenshtein3 =
|
|
42050
|
+
var levenshtein3 = (init_mod(), __toCommonJS(mod_exports));
|
|
40897
42051
|
var prevRow = [], str2Char = [];
|
|
40898
42052
|
var Levenshtein = {
|
|
40899
42053
|
/**
|
|
@@ -40957,7 +42111,7 @@ var require_levenshtein = __commonJS({
|
|
|
40957
42111
|
});
|
|
40958
42112
|
|
|
40959
42113
|
// src/core/checks/paths.ts
|
|
40960
|
-
import * as
|
|
42114
|
+
import * as path4 from "node:path";
|
|
40961
42115
|
function getProjectFiles(projectRoot) {
|
|
40962
42116
|
if (cachedProjectFiles?.root === projectRoot) return cachedProjectFiles.files;
|
|
40963
42117
|
const files = getAllProjectFiles(projectRoot);
|
|
@@ -40970,10 +42124,10 @@ function resetPathsCache() {
|
|
|
40970
42124
|
async function checkPaths(file2, projectRoot) {
|
|
40971
42125
|
const issues = [];
|
|
40972
42126
|
const projectFiles = getProjectFiles(projectRoot);
|
|
40973
|
-
const contextDir =
|
|
42127
|
+
const contextDir = path4.dirname(file2.filePath);
|
|
40974
42128
|
for (const ref of file2.references.paths) {
|
|
40975
42129
|
const baseDir = ref.value.startsWith("./") || ref.value.startsWith("../") ? contextDir : projectRoot;
|
|
40976
|
-
const resolvedPath =
|
|
42130
|
+
const resolvedPath = path4.resolve(baseDir, ref.value);
|
|
40977
42131
|
const normalizedRef = ref.value.replace(/\\/g, "/");
|
|
40978
42132
|
if (normalizedRef.includes("*")) {
|
|
40979
42133
|
const matches = await Ze(normalizedRef, { cwd: baseDir, nodir: false });
|
|
@@ -40991,7 +42145,7 @@ async function checkPaths(file2, projectRoot) {
|
|
|
40991
42145
|
}
|
|
40992
42146
|
const isDir = normalizedRef.endsWith("/");
|
|
40993
42147
|
if (isDir) {
|
|
40994
|
-
const dirPath =
|
|
42148
|
+
const dirPath = path4.resolve(baseDir, normalizedRef);
|
|
40995
42149
|
if (!isDirectory(dirPath)) {
|
|
40996
42150
|
issues.push({
|
|
40997
42151
|
severity: "error",
|
|
@@ -41036,12 +42190,12 @@ async function checkPaths(file2, projectRoot) {
|
|
|
41036
42190
|
}
|
|
41037
42191
|
function findClosestMatch(target, files) {
|
|
41038
42192
|
const targetNorm = target.replace(/\\/g, "/");
|
|
41039
|
-
const targetBase =
|
|
42193
|
+
const targetBase = path4.basename(targetNorm);
|
|
41040
42194
|
let bestMatch = null;
|
|
41041
42195
|
let bestDistance = Infinity;
|
|
41042
42196
|
for (const file2 of files) {
|
|
41043
42197
|
const fileNorm = file2.replace(/\\/g, "/");
|
|
41044
|
-
if (
|
|
42198
|
+
if (path4.basename(fileNorm) === targetBase && fileNorm !== targetNorm) {
|
|
41045
42199
|
const dist = levenshtein(targetNorm, fileNorm);
|
|
41046
42200
|
if (dist < bestDistance) {
|
|
41047
42201
|
bestDistance = dist;
|
|
@@ -41075,8 +42229,8 @@ var init_paths = __esm({
|
|
|
41075
42229
|
});
|
|
41076
42230
|
|
|
41077
42231
|
// src/core/checks/commands.ts
|
|
41078
|
-
import * as
|
|
41079
|
-
import * as
|
|
42232
|
+
import * as fs5 from "node:fs";
|
|
42233
|
+
import * as path5 from "node:path";
|
|
41080
42234
|
async function checkCommands(file2, projectRoot) {
|
|
41081
42235
|
const issues = [];
|
|
41082
42236
|
const pkgJson = loadPackageJson(projectRoot);
|
|
@@ -41126,9 +42280,9 @@ async function checkCommands(file2, projectRoot) {
|
|
|
41126
42280
|
...pkgJson.optionalDependencies
|
|
41127
42281
|
};
|
|
41128
42282
|
if (!(pkgName in allDeps)) {
|
|
41129
|
-
const binPath =
|
|
42283
|
+
const binPath = path5.join(projectRoot, "node_modules", ".bin", pkgName);
|
|
41130
42284
|
try {
|
|
41131
|
-
|
|
42285
|
+
fs5.accessSync(binPath);
|
|
41132
42286
|
} catch {
|
|
41133
42287
|
issues.push({
|
|
41134
42288
|
severity: "warning",
|
|
@@ -41174,9 +42328,9 @@ async function checkCommands(file2, projectRoot) {
|
|
|
41174
42328
|
...pkgJson.optionalDependencies
|
|
41175
42329
|
};
|
|
41176
42330
|
if (!(tool in allDeps)) {
|
|
41177
|
-
const binPath =
|
|
42331
|
+
const binPath = path5.join(projectRoot, "node_modules", ".bin", tool);
|
|
41178
42332
|
try {
|
|
41179
|
-
|
|
42333
|
+
fs5.accessSync(binPath);
|
|
41180
42334
|
} catch {
|
|
41181
42335
|
issues.push({
|
|
41182
42336
|
severity: "warning",
|
|
@@ -41193,7 +42347,7 @@ async function checkCommands(file2, projectRoot) {
|
|
|
41193
42347
|
}
|
|
41194
42348
|
function loadMakefile(projectRoot) {
|
|
41195
42349
|
try {
|
|
41196
|
-
return
|
|
42350
|
+
return fs5.readFileSync(path5.join(projectRoot, "Makefile"), "utf-8");
|
|
41197
42351
|
} catch {
|
|
41198
42352
|
return null;
|
|
41199
42353
|
}
|
|
@@ -41214,13 +42368,13 @@ var init_commands = __esm({
|
|
|
41214
42368
|
});
|
|
41215
42369
|
|
|
41216
42370
|
// src/core/checks/staleness.ts
|
|
41217
|
-
import * as
|
|
42371
|
+
import * as path6 from "node:path";
|
|
41218
42372
|
async function checkStaleness(file2, projectRoot) {
|
|
41219
42373
|
const issues = [];
|
|
41220
42374
|
if (!await isGitRepo(projectRoot)) {
|
|
41221
42375
|
return issues;
|
|
41222
42376
|
}
|
|
41223
|
-
const relativePath =
|
|
42377
|
+
const relativePath = path6.relative(projectRoot, file2.filePath).replace(/\\/g, "/");
|
|
41224
42378
|
const lastModified = await getFileLastModified(projectRoot, relativePath);
|
|
41225
42379
|
if (!lastModified || isNaN(lastModified.getTime())) {
|
|
41226
42380
|
return issues;
|
|
@@ -41353,8 +42507,8 @@ var init_tokens2 = __esm({
|
|
|
41353
42507
|
});
|
|
41354
42508
|
|
|
41355
42509
|
// src/core/checks/tier-tokens.ts
|
|
41356
|
-
import * as
|
|
41357
|
-
import * as
|
|
42510
|
+
import * as fs6 from "node:fs";
|
|
42511
|
+
import * as path7 from "node:path";
|
|
41358
42512
|
function hasPathsFrontmatter(content) {
|
|
41359
42513
|
const lines = content.split("\n");
|
|
41360
42514
|
if (lines[0]?.trim() !== "---") return false;
|
|
@@ -41383,8 +42537,8 @@ function isAlwaysLoaded(file2) {
|
|
|
41383
42537
|
if (rel.includes("/rules/")) {
|
|
41384
42538
|
return !hasPathsFrontmatter(file2.content);
|
|
41385
42539
|
}
|
|
41386
|
-
const
|
|
41387
|
-
return ALWAYS_LOADED_BASENAMES.has(
|
|
42540
|
+
const basename5 = rel.split("/").pop() ?? "";
|
|
42541
|
+
return ALWAYS_LOADED_BASENAMES.has(basename5);
|
|
41388
42542
|
}
|
|
41389
42543
|
function computeSectionCosts(file2) {
|
|
41390
42544
|
if (file2.sections.length === 0) return [];
|
|
@@ -41399,14 +42553,14 @@ function computeSectionCosts(file2) {
|
|
|
41399
42553
|
function loadSettingsSources(projectRoot) {
|
|
41400
42554
|
const sources = [];
|
|
41401
42555
|
const candidates = [
|
|
41402
|
-
|
|
41403
|
-
|
|
41404
|
-
|
|
42556
|
+
path7.join(projectRoot, ".claude", "settings.json"),
|
|
42557
|
+
path7.join(projectRoot, ".claude", "settings.local.json"),
|
|
42558
|
+
path7.join(process.env.HOME || process.env.USERPROFILE || "", ".claude", "settings.json")
|
|
41405
42559
|
];
|
|
41406
42560
|
for (const p2 of candidates) {
|
|
41407
42561
|
let content;
|
|
41408
42562
|
try {
|
|
41409
|
-
content =
|
|
42563
|
+
content = fs6.readFileSync(p2, "utf-8");
|
|
41410
42564
|
} catch {
|
|
41411
42565
|
continue;
|
|
41412
42566
|
}
|
|
@@ -41533,7 +42687,7 @@ var init_tier_tokens = __esm({
|
|
|
41533
42687
|
});
|
|
41534
42688
|
|
|
41535
42689
|
// src/core/checks/redundancy.ts
|
|
41536
|
-
import * as
|
|
42690
|
+
import * as path8 from "node:path";
|
|
41537
42691
|
function compilePatterns(allDeps) {
|
|
41538
42692
|
const compiled = [];
|
|
41539
42693
|
for (const [pkg, mentions] of Object.entries(PACKAGE_TECH_MAP)) {
|
|
@@ -41598,7 +42752,7 @@ async function checkRedundancy(file2, projectRoot) {
|
|
|
41598
42752
|
);
|
|
41599
42753
|
if (dirMatch) {
|
|
41600
42754
|
const dir = dirMatch[1].replace(/[`"]/g, "");
|
|
41601
|
-
const fullPath =
|
|
42755
|
+
const fullPath = path8.resolve(projectRoot, dir);
|
|
41602
42756
|
if (isDirectory(fullPath)) {
|
|
41603
42757
|
issues.push({
|
|
41604
42758
|
severity: "info",
|
|
@@ -42467,8 +43621,8 @@ var init_security = __esm({
|
|
|
42467
43621
|
});
|
|
42468
43622
|
|
|
42469
43623
|
// src/core/checks/mcp/commands.ts
|
|
42470
|
-
import * as
|
|
42471
|
-
import * as
|
|
43624
|
+
import * as fs7 from "node:fs";
|
|
43625
|
+
import * as path9 from "node:path";
|
|
42472
43626
|
async function checkMcpCommands(config2, projectRoot) {
|
|
42473
43627
|
const issues = [];
|
|
42474
43628
|
if (config2.parseErrors.length > 0) return issues;
|
|
@@ -42485,7 +43639,7 @@ async function checkMcpCommands(config2, projectRoot) {
|
|
|
42485
43639
|
});
|
|
42486
43640
|
}
|
|
42487
43641
|
if (LOCAL_PATH_PATTERN.test(server2.command)) {
|
|
42488
|
-
const resolved =
|
|
43642
|
+
const resolved = path9.resolve(projectRoot, server2.command);
|
|
42489
43643
|
if (!fileExistsSafe(resolved)) {
|
|
42490
43644
|
issues.push({
|
|
42491
43645
|
severity: "warning",
|
|
@@ -42500,7 +43654,7 @@ async function checkMcpCommands(config2, projectRoot) {
|
|
|
42500
43654
|
for (const arg of server2.args) {
|
|
42501
43655
|
if (URL_PREFIX.test(arg)) continue;
|
|
42502
43656
|
if (LOCAL_PATH_PATTERN.test(arg) || FILE_PATH_PATTERN.test(arg)) {
|
|
42503
|
-
const resolved =
|
|
43657
|
+
const resolved = path9.resolve(projectRoot, arg);
|
|
42504
43658
|
if (!fileExistsSafe(resolved)) {
|
|
42505
43659
|
issues.push({
|
|
42506
43660
|
severity: "warning",
|
|
@@ -42518,7 +43672,7 @@ async function checkMcpCommands(config2, projectRoot) {
|
|
|
42518
43672
|
}
|
|
42519
43673
|
function fileExistsSafe(filePath) {
|
|
42520
43674
|
try {
|
|
42521
|
-
|
|
43675
|
+
fs7.accessSync(filePath);
|
|
42522
43676
|
return true;
|
|
42523
43677
|
} catch {
|
|
42524
43678
|
return false;
|
|
@@ -42986,6 +44140,239 @@ 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 path10 from "node:path";
|
|
44346
|
+
async function checkMcphGitignore(config2, _projectRoot) {
|
|
44347
|
+
const issues = [];
|
|
44348
|
+
if (config2.scope === "project-local" && !config2.isGitignored) {
|
|
44349
|
+
const basename5 = path10.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: `${basename5} is not covered by .gitignore \u2014 machine-local overrides can leak via git`,
|
|
44356
|
+
suggestion: `Add "${basename5}" to .gitignore in your project root.`,
|
|
44357
|
+
fix: {
|
|
44358
|
+
file: path10.join(path10.dirname(config2.filePath), ".gitignore"),
|
|
44359
|
+
line: 0,
|
|
44360
|
+
oldText: "",
|
|
44361
|
+
newText: `
|
|
44362
|
+
# mcph CLI local overrides (machine-specific, never commit)
|
|
44363
|
+
${basename5}
|
|
44364
|
+
`
|
|
44365
|
+
}
|
|
44366
|
+
});
|
|
44367
|
+
}
|
|
44368
|
+
return issues;
|
|
44369
|
+
}
|
|
44370
|
+
var init_gitignore = __esm({
|
|
44371
|
+
"src/core/checks/mcph/gitignore.ts"() {
|
|
44372
|
+
"use strict";
|
|
44373
|
+
}
|
|
44374
|
+
});
|
|
44375
|
+
|
|
42989
44376
|
// src/core/session-parser.ts
|
|
42990
44377
|
import { readFile } from "node:fs/promises";
|
|
42991
44378
|
function encodeProjectDir(fsPath) {
|
|
@@ -43057,7 +44444,7 @@ var init_session_parser = __esm({
|
|
|
43057
44444
|
import { readdir, stat } from "node:fs/promises";
|
|
43058
44445
|
import { createReadStream } from "node:fs";
|
|
43059
44446
|
import { createInterface } from "node:readline";
|
|
43060
|
-
import { dirname as
|
|
44447
|
+
import { dirname as dirname3, join as join7, resolve as resolve4 } from "node:path";
|
|
43061
44448
|
import { existsSync } from "node:fs";
|
|
43062
44449
|
function detectProviders() {
|
|
43063
44450
|
if (!home) return [];
|
|
@@ -43082,7 +44469,7 @@ async function parseJsonlFiltered(filePath, filter) {
|
|
|
43082
44469
|
return results;
|
|
43083
44470
|
}
|
|
43084
44471
|
async function readClaudeHistory() {
|
|
43085
|
-
const historyPath =
|
|
44472
|
+
const historyPath = join7(home, ".claude", "history.jsonl");
|
|
43086
44473
|
return parseJsonlFiltered(historyPath, (entry) => {
|
|
43087
44474
|
if (!entry.display || !entry.project) return null;
|
|
43088
44475
|
return {
|
|
@@ -43095,7 +44482,7 @@ async function readClaudeHistory() {
|
|
|
43095
44482
|
});
|
|
43096
44483
|
}
|
|
43097
44484
|
async function readCodexHistory() {
|
|
43098
|
-
const historyPath =
|
|
44485
|
+
const historyPath = join7(home, ".codex", "history.jsonl");
|
|
43099
44486
|
return parseJsonlFiltered(historyPath, (entry) => {
|
|
43100
44487
|
if (!entry.display && !entry.command) return null;
|
|
43101
44488
|
return {
|
|
@@ -43108,18 +44495,18 @@ async function readCodexHistory() {
|
|
|
43108
44495
|
});
|
|
43109
44496
|
}
|
|
43110
44497
|
async function readClaudeMemories() {
|
|
43111
|
-
const projectsDir =
|
|
44498
|
+
const projectsDir = join7(home, ".claude", "projects");
|
|
43112
44499
|
if (!existsSync(projectsDir)) return [];
|
|
43113
44500
|
const memories = [];
|
|
43114
44501
|
const projectDirs = await readdir(projectsDir).catch(() => []);
|
|
43115
44502
|
for (const projDir of projectDirs) {
|
|
43116
|
-
const memoryDir =
|
|
44503
|
+
const memoryDir = join7(projectsDir, projDir, "memory");
|
|
43117
44504
|
if (!existsSync(memoryDir)) continue;
|
|
43118
44505
|
const files = await readdir(memoryDir).catch(() => []);
|
|
43119
44506
|
for (const file2 of files) {
|
|
43120
44507
|
if (!file2.endsWith(".md") || file2 === "MEMORY.md") continue;
|
|
43121
44508
|
try {
|
|
43122
|
-
const entry = await parseMemoryFile(
|
|
44509
|
+
const entry = await parseMemoryFile(join7(memoryDir, file2), projDir);
|
|
43123
44510
|
memories.push(entry);
|
|
43124
44511
|
} catch {
|
|
43125
44512
|
}
|
|
@@ -43129,14 +44516,14 @@ async function readClaudeMemories() {
|
|
|
43129
44516
|
}
|
|
43130
44517
|
function detectAiderInSiblings(siblings) {
|
|
43131
44518
|
for (const sib of siblings) {
|
|
43132
|
-
if (existsSync(
|
|
44519
|
+
if (existsSync(join7(sib.path, ".aider.chat.history.md"))) {
|
|
43133
44520
|
return "aider";
|
|
43134
44521
|
}
|
|
43135
44522
|
}
|
|
43136
44523
|
return null;
|
|
43137
44524
|
}
|
|
43138
44525
|
async function detectSiblings(projectRoot) {
|
|
43139
|
-
const parentDir =
|
|
44526
|
+
const parentDir = dirname3(resolve4(projectRoot));
|
|
43140
44527
|
let entries;
|
|
43141
44528
|
try {
|
|
43142
44529
|
entries = await readdir(parentDir);
|
|
@@ -43146,7 +44533,7 @@ async function detectSiblings(projectRoot) {
|
|
|
43146
44533
|
const candidates = [];
|
|
43147
44534
|
for (const entry of entries) {
|
|
43148
44535
|
if (entry.startsWith(".") || entry === "node_modules") continue;
|
|
43149
|
-
const fullPath =
|
|
44536
|
+
const fullPath = join7(parentDir, entry);
|
|
43150
44537
|
const entryPath = resolve4(fullPath);
|
|
43151
44538
|
if (entryPath === resolve4(projectRoot)) continue;
|
|
43152
44539
|
try {
|
|
@@ -43155,7 +44542,7 @@ async function detectSiblings(projectRoot) {
|
|
|
43155
44542
|
} catch {
|
|
43156
44543
|
continue;
|
|
43157
44544
|
}
|
|
43158
|
-
const isProject = existsSync(
|
|
44545
|
+
const isProject = existsSync(join7(fullPath, ".git")) || existsSync(join7(fullPath, "package.json")) || existsSync(join7(fullPath, "Cargo.toml")) || existsSync(join7(fullPath, "go.mod")) || existsSync(join7(fullPath, "pyproject.toml"));
|
|
43159
44546
|
if (!isProject) continue;
|
|
43160
44547
|
candidates.push({ fullPath, entryPath, name: entry });
|
|
43161
44548
|
}
|
|
@@ -43169,7 +44556,7 @@ async function detectSiblings(projectRoot) {
|
|
|
43169
44556
|
if (orgMatch) currentOrg = orgMatch[1];
|
|
43170
44557
|
} catch {
|
|
43171
44558
|
}
|
|
43172
|
-
const gitCandidates = candidates.filter((c3) => existsSync(
|
|
44559
|
+
const gitCandidates = candidates.filter((c3) => existsSync(join7(c3.fullPath, ".git")));
|
|
43173
44560
|
const results = await Promise.all(
|
|
43174
44561
|
gitCandidates.map(async (c3) => {
|
|
43175
44562
|
const sibling = { path: c3.entryPath.replace(/\\/g, "/"), name: c3.name };
|
|
@@ -43241,28 +44628,28 @@ var init_session_scanner = __esm({
|
|
|
43241
44628
|
init_session_parser();
|
|
43242
44629
|
home = process.env.HOME || process.env.USERPROFILE || "";
|
|
43243
44630
|
AGENT_DIRS = [
|
|
43244
|
-
{ provider: "claude-code", dir:
|
|
43245
|
-
{ provider: "codex-cli", dir:
|
|
43246
|
-
{ provider: "vibe-cli", dir:
|
|
44631
|
+
{ provider: "claude-code", dir: join7(home, ".claude"), historyFile: "history.jsonl" },
|
|
44632
|
+
{ provider: "codex-cli", dir: join7(home, ".codex"), historyFile: "history.jsonl" },
|
|
44633
|
+
{ provider: "vibe-cli", dir: join7(home, ".vibe") },
|
|
43247
44634
|
{
|
|
43248
44635
|
provider: "amazon-q",
|
|
43249
|
-
dir:
|
|
44636
|
+
dir: join7(home, ".aws", "amazonq")
|
|
43250
44637
|
},
|
|
43251
44638
|
{
|
|
43252
44639
|
provider: "goose",
|
|
43253
|
-
dir: process.platform === "win32" ?
|
|
44640
|
+
dir: process.platform === "win32" ? join7(process.env.APPDATA || "", "Block", "goose") : join7(home, ".config", "goose")
|
|
43254
44641
|
},
|
|
43255
|
-
{ provider: "continue", dir:
|
|
44642
|
+
{ provider: "continue", dir: join7(home, ".continue") },
|
|
43256
44643
|
{
|
|
43257
44644
|
provider: "windsurf",
|
|
43258
|
-
dir:
|
|
44645
|
+
dir: join7(home, ".windsurf")
|
|
43259
44646
|
}
|
|
43260
44647
|
];
|
|
43261
44648
|
}
|
|
43262
44649
|
});
|
|
43263
44650
|
|
|
43264
44651
|
// src/core/checks/session/missing-secret.ts
|
|
43265
|
-
import { resolve as resolve5, basename as
|
|
44652
|
+
import { resolve as resolve5, basename as basename4 } from "node:path";
|
|
43266
44653
|
function normalizePath(p2) {
|
|
43267
44654
|
return resolve5(p2).replace(/\\/g, "/").toLowerCase();
|
|
43268
44655
|
}
|
|
@@ -43286,7 +44673,7 @@ async function checkMissingSecret(ctx) {
|
|
|
43286
44673
|
if (s.repo) byName.get(s.name).add(s.repo);
|
|
43287
44674
|
}
|
|
43288
44675
|
const currentNorm = normalizePath(ctx.currentProject);
|
|
43289
|
-
const currentBase =
|
|
44676
|
+
const currentBase = basename4(currentNorm);
|
|
43290
44677
|
for (const [secretName, projects] of byName) {
|
|
43291
44678
|
const normalizedProjects = [...projects].map(normalizePath);
|
|
43292
44679
|
const currentHas = normalizedProjects.some((p2) => {
|
|
@@ -43297,7 +44684,7 @@ async function checkMissingSecret(ctx) {
|
|
|
43297
44684
|
if (currentHas) continue;
|
|
43298
44685
|
const siblingMatches = ctx.siblings.filter((sib) => {
|
|
43299
44686
|
const sibNorm = normalizePath(sib.path);
|
|
43300
|
-
const sibBase =
|
|
44687
|
+
const sibBase = basename4(sibNorm);
|
|
43301
44688
|
return normalizedProjects.some((p2) => {
|
|
43302
44689
|
if (p2 === sibNorm) return true;
|
|
43303
44690
|
const lastSegment = p2.split("/").pop() || "";
|
|
@@ -43330,7 +44717,7 @@ var init_missing_secret = __esm({
|
|
|
43330
44717
|
|
|
43331
44718
|
// src/core/checks/session/diverged-file.ts
|
|
43332
44719
|
import { readFile as readFile2 } from "node:fs/promises";
|
|
43333
|
-
import { join as
|
|
44720
|
+
import { join as join8 } from "node:path";
|
|
43334
44721
|
import { existsSync as existsSync2 } from "node:fs";
|
|
43335
44722
|
function calculateOverlap(a, b2) {
|
|
43336
44723
|
const linesA = a.split("\n").map((l) => l.trim()).filter((l) => l.length > 3);
|
|
@@ -43348,7 +44735,7 @@ function calculateOverlap(a, b2) {
|
|
|
43348
44735
|
async function checkDivergedFile(ctx) {
|
|
43349
44736
|
const issues = [];
|
|
43350
44737
|
for (const fileName of CANONICAL_FILES) {
|
|
43351
|
-
const currentPath =
|
|
44738
|
+
const currentPath = join8(ctx.currentProject, fileName);
|
|
43352
44739
|
if (!existsSync2(currentPath)) continue;
|
|
43353
44740
|
let currentContent;
|
|
43354
44741
|
try {
|
|
@@ -43358,7 +44745,7 @@ async function checkDivergedFile(ctx) {
|
|
|
43358
44745
|
}
|
|
43359
44746
|
const diverged = [];
|
|
43360
44747
|
for (const sib of ctx.siblings) {
|
|
43361
|
-
const sibPath =
|
|
44748
|
+
const sibPath = join8(sib.path, fileName);
|
|
43362
44749
|
if (!existsSync2(sibPath)) continue;
|
|
43363
44750
|
try {
|
|
43364
44751
|
const sibContent = await readFile2(sibPath, "utf-8");
|
|
@@ -43404,12 +44791,12 @@ var init_diverged_file = __esm({
|
|
|
43404
44791
|
|
|
43405
44792
|
// src/core/checks/session/missing-workflow.ts
|
|
43406
44793
|
import { readdir as readdir2 } from "node:fs/promises";
|
|
43407
|
-
import { join as
|
|
44794
|
+
import { join as join9 } from "node:path";
|
|
43408
44795
|
import { existsSync as existsSync3 } from "node:fs";
|
|
43409
44796
|
async function checkMissingWorkflow(ctx) {
|
|
43410
44797
|
const issues = [];
|
|
43411
|
-
const currentWorkflowDir =
|
|
43412
|
-
if (!existsSync3(
|
|
44798
|
+
const currentWorkflowDir = join9(ctx.currentProject, ".github", "workflows");
|
|
44799
|
+
if (!existsSync3(join9(ctx.currentProject, ".github"))) return issues;
|
|
43413
44800
|
const currentWorkflows = /* @__PURE__ */ new Set();
|
|
43414
44801
|
if (existsSync3(currentWorkflowDir)) {
|
|
43415
44802
|
try {
|
|
@@ -43422,7 +44809,7 @@ async function checkMissingWorkflow(ctx) {
|
|
|
43422
44809
|
}
|
|
43423
44810
|
const workflowMap = /* @__PURE__ */ new Map();
|
|
43424
44811
|
for (const sib of ctx.siblings) {
|
|
43425
|
-
const sibWorkflowDir =
|
|
44812
|
+
const sibWorkflowDir = join9(sib.path, ".github", "workflows");
|
|
43426
44813
|
if (!existsSync3(sibWorkflowDir)) continue;
|
|
43427
44814
|
try {
|
|
43428
44815
|
const files = await readdir2(sibWorkflowDir);
|
|
@@ -43647,12 +45034,12 @@ var init_loop_detection = __esm({
|
|
|
43647
45034
|
|
|
43648
45035
|
// src/core/checks/session/memory-index-overflow.ts
|
|
43649
45036
|
import { readFile as readFile3, stat as stat2 } from "node:fs/promises";
|
|
43650
|
-
import { join as
|
|
45037
|
+
import { join as join10 } from "node:path";
|
|
43651
45038
|
async function checkMemoryIndexOverflow(ctx) {
|
|
43652
45039
|
const home2 = process.env.HOME || process.env.USERPROFILE || "";
|
|
43653
45040
|
if (!home2) return [];
|
|
43654
45041
|
const encoded = encodeProjectDir(ctx.currentProject);
|
|
43655
|
-
const memoryFile =
|
|
45042
|
+
const memoryFile = join10(home2, ".claude", "projects", encoded, "memory", "MEMORY.md");
|
|
43656
45043
|
let stats;
|
|
43657
45044
|
try {
|
|
43658
45045
|
stats = await stat2(memoryFile);
|
|
@@ -43703,10 +45090,10 @@ var init_memory_index_overflow = __esm({
|
|
|
43703
45090
|
|
|
43704
45091
|
// src/core/checks/ci-coverage.ts
|
|
43705
45092
|
import { readdir as readdir3, readFile as readFile4 } from "node:fs/promises";
|
|
43706
|
-
import { join as
|
|
45093
|
+
import { join as join11 } from "node:path";
|
|
43707
45094
|
import { existsSync as existsSync5 } from "node:fs";
|
|
43708
45095
|
async function findReleaseWorkflows(projectRoot) {
|
|
43709
|
-
const workflowDir =
|
|
45096
|
+
const workflowDir = join11(projectRoot, ".github", "workflows");
|
|
43710
45097
|
if (!existsSync5(workflowDir)) return [];
|
|
43711
45098
|
let files;
|
|
43712
45099
|
try {
|
|
@@ -43722,7 +45109,7 @@ async function findReleaseWorkflows(projectRoot) {
|
|
|
43722
45109
|
continue;
|
|
43723
45110
|
}
|
|
43724
45111
|
try {
|
|
43725
|
-
const content = await readFile4(
|
|
45112
|
+
const content = await readFile4(join11(workflowDir, f), "utf-8");
|
|
43726
45113
|
const nameMatch = content.match(/^name:\s*(.+)$/m);
|
|
43727
45114
|
if (nameMatch && RELEASE_FILENAME_PATTERNS.some((p2) => p2.test(nameMatch[1]))) {
|
|
43728
45115
|
releaseWorkflows.push(f);
|
|
@@ -43777,10 +45164,10 @@ var init_ci_coverage = __esm({
|
|
|
43777
45164
|
|
|
43778
45165
|
// src/core/checks/ci-secrets.ts
|
|
43779
45166
|
import { readdir as readdir4, readFile as readFile5 } from "node:fs/promises";
|
|
43780
|
-
import { join as
|
|
45167
|
+
import { join as join12 } from "node:path";
|
|
43781
45168
|
import { existsSync as existsSync6 } from "node:fs";
|
|
43782
45169
|
async function findSecretUsages(projectRoot) {
|
|
43783
|
-
const workflowDir =
|
|
45170
|
+
const workflowDir = join12(projectRoot, ".github", "workflows");
|
|
43784
45171
|
if (!existsSync6(workflowDir)) return [];
|
|
43785
45172
|
let files;
|
|
43786
45173
|
try {
|
|
@@ -43793,7 +45180,7 @@ async function findSecretUsages(projectRoot) {
|
|
|
43793
45180
|
if (!(f.endsWith(".yml") || f.endsWith(".yaml"))) continue;
|
|
43794
45181
|
let content;
|
|
43795
45182
|
try {
|
|
43796
|
-
content = await readFile5(
|
|
45183
|
+
content = await readFile5(join12(workflowDir, f), "utf-8");
|
|
43797
45184
|
} catch {
|
|
43798
45185
|
continue;
|
|
43799
45186
|
}
|
|
@@ -43850,14 +45237,14 @@ var init_ci_secrets = __esm({
|
|
|
43850
45237
|
});
|
|
43851
45238
|
|
|
43852
45239
|
// src/version.ts
|
|
43853
|
-
import { readFileSync as
|
|
43854
|
-
import { resolve as resolve8, dirname as
|
|
45240
|
+
import { readFileSync as readFileSync5 } from "node:fs";
|
|
45241
|
+
import { resolve as resolve8, dirname as dirname4 } from "node:path";
|
|
43855
45242
|
import { fileURLToPath } from "node:url";
|
|
43856
45243
|
function loadVersion() {
|
|
43857
|
-
if (true) return "0.9.
|
|
43858
|
-
const __dir =
|
|
45244
|
+
if (true) return "0.9.17";
|
|
45245
|
+
const __dir = dirname4(fileURLToPath(import.meta.url));
|
|
43859
45246
|
const pkgPath = resolve8(__dir, "../package.json");
|
|
43860
|
-
const pkg = JSON.parse(
|
|
45247
|
+
const pkg = JSON.parse(readFileSync5(pkgPath, "utf-8"));
|
|
43861
45248
|
return pkg.version;
|
|
43862
45249
|
}
|
|
43863
45250
|
var VERSION;
|
|
@@ -43872,13 +45259,17 @@ var init_version2 = __esm({
|
|
|
43872
45259
|
function hasMcpChecks(checks) {
|
|
43873
45260
|
return checks.some((c3) => c3.startsWith("mcp-"));
|
|
43874
45261
|
}
|
|
45262
|
+
function hasMcphChecks(checks) {
|
|
45263
|
+
return checks.some((c3) => c3.startsWith("mcph-"));
|
|
45264
|
+
}
|
|
43875
45265
|
function hasSessionChecks(checks) {
|
|
43876
45266
|
return checks.some((c3) => c3.startsWith("session-"));
|
|
43877
45267
|
}
|
|
43878
45268
|
async function runAudit(projectRoot, activeChecks, options = {}) {
|
|
43879
45269
|
const fileResults = [];
|
|
43880
|
-
const shouldRunContextChecks = !options.mcpOnly && !options.sessionOnly;
|
|
45270
|
+
const shouldRunContextChecks = !options.mcpOnly && !options.mcphOnly && !options.sessionOnly;
|
|
43881
45271
|
const shouldRunMcpChecks = options.mcp || options.mcpGlobal || options.mcpOnly || hasMcpChecks(activeChecks);
|
|
45272
|
+
const shouldRunMcphChecks = options.mcph || options.mcphGlobal || options.mcphOnly || hasMcphChecks(activeChecks);
|
|
43882
45273
|
const shouldRunSessionChecks = options.session || options.sessionOnly || hasSessionChecks(activeChecks);
|
|
43883
45274
|
if (shouldRunContextChecks) {
|
|
43884
45275
|
const discovered = await scanForContextFiles(projectRoot, {
|
|
@@ -43997,6 +45388,68 @@ async function runAudit(projectRoot, activeChecks, options = {}) {
|
|
|
43997
45388
|
});
|
|
43998
45389
|
}
|
|
43999
45390
|
}
|
|
45391
|
+
if (shouldRunMcphChecks) {
|
|
45392
|
+
const projectMcphFiles = await scanForMcphConfigs(projectRoot);
|
|
45393
|
+
const mcphConfigs = await Promise.all(
|
|
45394
|
+
projectMcphFiles.map(
|
|
45395
|
+
(f) => parseMchpConfig(
|
|
45396
|
+
f,
|
|
45397
|
+
projectRoot,
|
|
45398
|
+
f.relativePath.endsWith(".mcph.local.json") ? "project-local" : "project"
|
|
45399
|
+
)
|
|
45400
|
+
)
|
|
45401
|
+
);
|
|
45402
|
+
if (options.mcphGlobal) {
|
|
45403
|
+
const globalMcphFiles = await scanGlobalMcphConfigs();
|
|
45404
|
+
const globalMcphConfigs = await Promise.all(
|
|
45405
|
+
globalMcphFiles.map((f) => parseMchpConfig(f, projectRoot, "global"))
|
|
45406
|
+
);
|
|
45407
|
+
mcphConfigs.push(...globalMcphConfigs);
|
|
45408
|
+
}
|
|
45409
|
+
const activeMcphChecks = activeChecks.filter((c3) => c3.startsWith("mcph-"));
|
|
45410
|
+
const mcphChecksToRun = activeMcphChecks.length > 0 ? activeMcphChecks : options.mcph || options.mcphGlobal || options.mcphOnly ? ALL_MCPH_CHECKS : [];
|
|
45411
|
+
for (const config2 of mcphConfigs) {
|
|
45412
|
+
const checkPromises = [];
|
|
45413
|
+
if (mcphChecksToRun.includes("mcph-token-security")) {
|
|
45414
|
+
checkPromises.push(
|
|
45415
|
+
checkMcphTokenSecurity(config2, projectRoot, {
|
|
45416
|
+
strictEnvToken: options.mcphStrictEnvToken
|
|
45417
|
+
})
|
|
45418
|
+
);
|
|
45419
|
+
}
|
|
45420
|
+
if (mcphChecksToRun.includes("mcph-apibase")) {
|
|
45421
|
+
checkPromises.push(checkMcphApibase(config2, projectRoot));
|
|
45422
|
+
}
|
|
45423
|
+
if (mcphChecksToRun.includes("mcph-schema-conformance")) {
|
|
45424
|
+
checkPromises.push(checkMcphSchemaConformance(config2, projectRoot));
|
|
45425
|
+
}
|
|
45426
|
+
if (mcphChecksToRun.includes("mcph-lists")) {
|
|
45427
|
+
checkPromises.push(checkMcphLists(config2, projectRoot));
|
|
45428
|
+
}
|
|
45429
|
+
if (mcphChecksToRun.includes("mcph-gitignore")) {
|
|
45430
|
+
checkPromises.push(checkMcphGitignore(config2, projectRoot));
|
|
45431
|
+
}
|
|
45432
|
+
const results = await Promise.all(checkPromises);
|
|
45433
|
+
const issues = results.flat();
|
|
45434
|
+
for (const err of config2.parseErrors) {
|
|
45435
|
+
issues.push({
|
|
45436
|
+
severity: "error",
|
|
45437
|
+
check: "mcph-schema-conformance",
|
|
45438
|
+
ruleId: "mcph-config/parse-error",
|
|
45439
|
+
line: 1,
|
|
45440
|
+
message: err
|
|
45441
|
+
});
|
|
45442
|
+
}
|
|
45443
|
+
const lines = config2.content.split("\n").length;
|
|
45444
|
+
fileResults.push({
|
|
45445
|
+
path: config2.relativePath,
|
|
45446
|
+
isSymlink: false,
|
|
45447
|
+
tokens: countTokens(config2.content),
|
|
45448
|
+
lines,
|
|
45449
|
+
issues
|
|
45450
|
+
});
|
|
45451
|
+
}
|
|
45452
|
+
}
|
|
44000
45453
|
if (shouldRunSessionChecks) {
|
|
44001
45454
|
const activeSessionChecks = activeChecks.filter(
|
|
44002
45455
|
(c3) => c3.startsWith("session-")
|
|
@@ -44064,13 +45517,14 @@ async function runAudit(projectRoot, activeChecks, options = {}) {
|
|
|
44064
45517
|
}
|
|
44065
45518
|
};
|
|
44066
45519
|
}
|
|
44067
|
-
var ALL_CHECKS, ALL_MCP_CHECKS, ALL_SESSION_CHECKS;
|
|
45520
|
+
var ALL_CHECKS, ALL_MCP_CHECKS, ALL_MCPH_CHECKS, ALL_SESSION_CHECKS;
|
|
44068
45521
|
var init_audit = __esm({
|
|
44069
45522
|
"src/core/audit.ts"() {
|
|
44070
45523
|
"use strict";
|
|
44071
45524
|
init_scanner();
|
|
44072
45525
|
init_parser();
|
|
44073
45526
|
init_mcp_parser();
|
|
45527
|
+
init_mcph_parser();
|
|
44074
45528
|
init_tokens();
|
|
44075
45529
|
init_paths();
|
|
44076
45530
|
init_commands();
|
|
@@ -44088,6 +45542,11 @@ var init_audit = __esm({
|
|
|
44088
45542
|
init_urls();
|
|
44089
45543
|
init_consistency();
|
|
44090
45544
|
init_redundancy2();
|
|
45545
|
+
init_token_security();
|
|
45546
|
+
init_apibase();
|
|
45547
|
+
init_schema_conformance();
|
|
45548
|
+
init_lists();
|
|
45549
|
+
init_gitignore();
|
|
44091
45550
|
init_session_scanner();
|
|
44092
45551
|
init_missing_secret();
|
|
44093
45552
|
init_diverged_file();
|
|
@@ -44121,6 +45580,13 @@ var init_audit = __esm({
|
|
|
44121
45580
|
"mcp-consistency",
|
|
44122
45581
|
"mcp-redundancy"
|
|
44123
45582
|
];
|
|
45583
|
+
ALL_MCPH_CHECKS = [
|
|
45584
|
+
"mcph-token-security",
|
|
45585
|
+
"mcph-apibase",
|
|
45586
|
+
"mcph-schema-conformance",
|
|
45587
|
+
"mcph-lists",
|
|
45588
|
+
"mcph-gitignore"
|
|
45589
|
+
];
|
|
44124
45590
|
ALL_SESSION_CHECKS = [
|
|
44125
45591
|
"session-missing-secret",
|
|
44126
45592
|
"session-diverged-file",
|
|
@@ -44672,7 +46138,7 @@ var init_source = __esm({
|
|
|
44672
46138
|
});
|
|
44673
46139
|
|
|
44674
46140
|
// src/core/fixer.ts
|
|
44675
|
-
import * as
|
|
46141
|
+
import * as fs8 from "node:fs";
|
|
44676
46142
|
function applyFixes(result, options = {}) {
|
|
44677
46143
|
const log = options.quiet ? () => {
|
|
44678
46144
|
} : console.log.bind(console);
|
|
@@ -44714,7 +46180,7 @@ function applyFixes(result, options = {}) {
|
|
|
44714
46180
|
let totalFixes = 0;
|
|
44715
46181
|
const filesModified = [];
|
|
44716
46182
|
for (const [filePath, fixes] of fixesByFile) {
|
|
44717
|
-
const content =
|
|
46183
|
+
const content = fs8.readFileSync(filePath, "utf-8");
|
|
44718
46184
|
const lines = content.split("\n");
|
|
44719
46185
|
let modified = false;
|
|
44720
46186
|
const sortedFixes = [...fixes].sort((a, b2) => b2.line - a.line);
|
|
@@ -44754,7 +46220,7 @@ function applyFixes(result, options = {}) {
|
|
|
44754
46220
|
}
|
|
44755
46221
|
}
|
|
44756
46222
|
if (!dryRun) {
|
|
44757
|
-
|
|
46223
|
+
fs8.writeFileSync(filePath, newContent, "utf-8");
|
|
44758
46224
|
}
|
|
44759
46225
|
filesModified.push(filePath);
|
|
44760
46226
|
}
|
|
@@ -44770,8 +46236,24 @@ var init_fixer = __esm({
|
|
|
44770
46236
|
|
|
44771
46237
|
// src/mcp/server.ts
|
|
44772
46238
|
var server_exports = {};
|
|
44773
|
-
import * as
|
|
44774
|
-
|
|
46239
|
+
import * as path11 from "node:path";
|
|
46240
|
+
function validateProjectPath(rawPath) {
|
|
46241
|
+
if (!rawPath) return process.cwd();
|
|
46242
|
+
if (PATH_DISALLOWED.test(rawPath)) {
|
|
46243
|
+
throw new Error("projectPath contains disallowed characters");
|
|
46244
|
+
}
|
|
46245
|
+
const resolved = path11.resolve(rawPath);
|
|
46246
|
+
if (!isDirectory(resolved)) {
|
|
46247
|
+
throw new Error("projectPath is not an existing directory");
|
|
46248
|
+
}
|
|
46249
|
+
return resolved;
|
|
46250
|
+
}
|
|
46251
|
+
function validateFilePathInput(rawPath) {
|
|
46252
|
+
if (PATH_DISALLOWED.test(rawPath)) {
|
|
46253
|
+
throw new Error("path contains disallowed characters");
|
|
46254
|
+
}
|
|
46255
|
+
}
|
|
46256
|
+
var contextCheckEnum, mcpCheckEnum, sessionCheckEnum, PATH_DISALLOWED, server, transport;
|
|
44775
46257
|
var init_server3 = __esm({
|
|
44776
46258
|
async "src/mcp/server.ts"() {
|
|
44777
46259
|
"use strict";
|
|
@@ -44791,13 +46273,14 @@ var init_server3 = __esm({
|
|
|
44791
46273
|
contextCheckEnum = external_exports3.enum(ALL_CHECKS);
|
|
44792
46274
|
mcpCheckEnum = external_exports3.enum(ALL_MCP_CHECKS);
|
|
44793
46275
|
sessionCheckEnum = external_exports3.enum(ALL_SESSION_CHECKS);
|
|
46276
|
+
PATH_DISALLOWED = /[\n\r\t;`|]|\$\(|\$\{/;
|
|
44794
46277
|
server = new McpServer({
|
|
44795
46278
|
name: "ctxlint",
|
|
44796
46279
|
version: VERSION
|
|
44797
46280
|
});
|
|
44798
46281
|
server.tool(
|
|
44799
46282
|
"ctxlint_audit",
|
|
44800
|
-
"Audit AI agent context files (CLAUDE.md, AGENTS.md, etc.) in the project. Checks for stale references, invalid commands, redundant content, contradictions, frontmatter issues, and token waste.
|
|
46283
|
+
"Audit AI agent context files (CLAUDE.md, AGENTS.md, etc.) in the project. Checks for stale references, invalid commands, redundant content, contradictions, frontmatter issues, and token waste. Scoped to context-file checks only; MCP-config and session-level checks are exposed as separate tools.",
|
|
44801
46284
|
{
|
|
44802
46285
|
projectPath: external_exports3.string().optional().describe("Path to the project root. Defaults to current working directory."),
|
|
44803
46286
|
checks: external_exports3.array(contextCheckEnum).optional().describe("Which context-file checks to run. Defaults to all.")
|
|
@@ -44809,9 +46292,9 @@ var init_server3 = __esm({
|
|
|
44809
46292
|
openWorldHint: false
|
|
44810
46293
|
},
|
|
44811
46294
|
async ({ projectPath, checks }) => {
|
|
44812
|
-
const root = path9.resolve(projectPath || process.cwd());
|
|
44813
|
-
const activeChecks = checks?.length ? checks : ALL_CHECKS;
|
|
44814
46295
|
try {
|
|
46296
|
+
const root = validateProjectPath(projectPath);
|
|
46297
|
+
const activeChecks = checks?.length ? checks : ALL_CHECKS;
|
|
44815
46298
|
const result = await runAudit(root, activeChecks);
|
|
44816
46299
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
44817
46300
|
} catch (err) {
|
|
@@ -44843,8 +46326,9 @@ var init_server3 = __esm({
|
|
|
44843
46326
|
},
|
|
44844
46327
|
async ({ path: filePath, projectPath }) => {
|
|
44845
46328
|
try {
|
|
44846
|
-
|
|
44847
|
-
const
|
|
46329
|
+
validateFilePathInput(filePath);
|
|
46330
|
+
const root = validateProjectPath(projectPath);
|
|
46331
|
+
const resolved = path11.resolve(root, filePath);
|
|
44848
46332
|
const result = {
|
|
44849
46333
|
path: filePath,
|
|
44850
46334
|
exists: fileExists(resolved) || isDirectory(resolved)
|
|
@@ -44885,8 +46369,8 @@ var init_server3 = __esm({
|
|
|
44885
46369
|
openWorldHint: false
|
|
44886
46370
|
},
|
|
44887
46371
|
async ({ projectPath }) => {
|
|
44888
|
-
const root = path9.resolve(projectPath || process.cwd());
|
|
44889
46372
|
try {
|
|
46373
|
+
const root = validateProjectPath(projectPath);
|
|
44890
46374
|
const discovered = await scanForContextFiles(root);
|
|
44891
46375
|
const parsed = discovered.map((f) => parseContextFile(f));
|
|
44892
46376
|
const files = parsed.map((f) => ({
|
|
@@ -44936,9 +46420,9 @@ var init_server3 = __esm({
|
|
|
44936
46420
|
openWorldHint: false
|
|
44937
46421
|
},
|
|
44938
46422
|
async ({ projectPath, checks }) => {
|
|
44939
|
-
const root = path9.resolve(projectPath || process.cwd());
|
|
44940
|
-
const activeChecks = checks?.length ? checks : ALL_CHECKS;
|
|
44941
46423
|
try {
|
|
46424
|
+
const root = validateProjectPath(projectPath);
|
|
46425
|
+
const activeChecks = checks?.length ? checks : ALL_CHECKS;
|
|
44942
46426
|
const result = await runAudit(root, activeChecks);
|
|
44943
46427
|
const fixSummary = applyFixes(result, { quiet: true });
|
|
44944
46428
|
return {
|
|
@@ -44986,9 +46470,9 @@ var init_server3 = __esm({
|
|
|
44986
46470
|
openWorldHint: false
|
|
44987
46471
|
},
|
|
44988
46472
|
async ({ projectPath, checks, includeGlobal }) => {
|
|
44989
|
-
const root = path9.resolve(projectPath || process.cwd());
|
|
44990
|
-
const activeChecks = checks?.length ? checks : ALL_MCP_CHECKS;
|
|
44991
46473
|
try {
|
|
46474
|
+
const root = validateProjectPath(projectPath);
|
|
46475
|
+
const activeChecks = checks?.length ? checks : ALL_MCP_CHECKS;
|
|
44992
46476
|
const result = await runAudit(root, activeChecks, {
|
|
44993
46477
|
mcp: true,
|
|
44994
46478
|
mcpOnly: true,
|
|
@@ -45023,9 +46507,9 @@ var init_server3 = __esm({
|
|
|
45023
46507
|
openWorldHint: true
|
|
45024
46508
|
},
|
|
45025
46509
|
async ({ projectPath, checks }) => {
|
|
45026
|
-
const root = path9.resolve(projectPath || process.cwd());
|
|
45027
|
-
const activeChecks = checks?.length ? checks : ALL_SESSION_CHECKS;
|
|
45028
46510
|
try {
|
|
46511
|
+
const root = validateProjectPath(projectPath);
|
|
46512
|
+
const activeChecks = checks?.length ? checks : ALL_SESSION_CHECKS;
|
|
45029
46513
|
const result = await runAudit(root, activeChecks, {
|
|
45030
46514
|
session: true,
|
|
45031
46515
|
sessionOnly: true
|
|
@@ -46179,14 +47663,14 @@ var require_suggestSimilar = __commonJS({
|
|
|
46179
47663
|
const minSimilarity = 0.4;
|
|
46180
47664
|
candidates.forEach((candidate) => {
|
|
46181
47665
|
if (candidate.length <= 1) return;
|
|
46182
|
-
const
|
|
47666
|
+
const distance2 = editDistance(word, candidate);
|
|
46183
47667
|
const length = Math.max(word.length, candidate.length);
|
|
46184
|
-
const similarity = (length -
|
|
47668
|
+
const similarity = (length - distance2) / length;
|
|
46185
47669
|
if (similarity > minSimilarity) {
|
|
46186
|
-
if (
|
|
46187
|
-
bestDistance =
|
|
47670
|
+
if (distance2 < bestDistance) {
|
|
47671
|
+
bestDistance = distance2;
|
|
46188
47672
|
similar = [candidate];
|
|
46189
|
-
} else if (
|
|
47673
|
+
} else if (distance2 === bestDistance) {
|
|
46190
47674
|
similar.push(candidate);
|
|
46191
47675
|
}
|
|
46192
47676
|
}
|
|
@@ -46214,8 +47698,8 @@ var require_command = __commonJS({
|
|
|
46214
47698
|
"node_modules/.pnpm/commander@14.0.3/node_modules/commander/lib/command.js"(exports) {
|
|
46215
47699
|
var EventEmitter2 = __require("node:events").EventEmitter;
|
|
46216
47700
|
var childProcess = __require("node:child_process");
|
|
46217
|
-
var
|
|
46218
|
-
var
|
|
47701
|
+
var path14 = __require("node:path");
|
|
47702
|
+
var fs11 = __require("node:fs");
|
|
46219
47703
|
var process11 = __require("node:process");
|
|
46220
47704
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
46221
47705
|
var { CommanderError: CommanderError2 } = require_error();
|
|
@@ -47209,7 +48693,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
47209
48693
|
* @param {string} subcommandName
|
|
47210
48694
|
*/
|
|
47211
48695
|
_checkForMissingExecutable(executableFile, executableDir, subcommandName) {
|
|
47212
|
-
if (
|
|
48696
|
+
if (fs11.existsSync(executableFile)) return;
|
|
47213
48697
|
const executableDirMessage = executableDir ? `searched for local subcommand relative to directory '${executableDir}'` : "no directory for search for local subcommand, use .executableDir() to supply a custom directory";
|
|
47214
48698
|
const executableMissing = `'${executableFile}' does not exist
|
|
47215
48699
|
- if '${subcommandName}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
@@ -47227,11 +48711,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
47227
48711
|
let launchWithNode = false;
|
|
47228
48712
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
47229
48713
|
function findFile(baseDir, baseName) {
|
|
47230
|
-
const localBin =
|
|
47231
|
-
if (
|
|
47232
|
-
if (sourceExt.includes(
|
|
48714
|
+
const localBin = path14.resolve(baseDir, baseName);
|
|
48715
|
+
if (fs11.existsSync(localBin)) return localBin;
|
|
48716
|
+
if (sourceExt.includes(path14.extname(baseName))) return void 0;
|
|
47233
48717
|
const foundExt = sourceExt.find(
|
|
47234
|
-
(ext) =>
|
|
48718
|
+
(ext) => fs11.existsSync(`${localBin}${ext}`)
|
|
47235
48719
|
);
|
|
47236
48720
|
if (foundExt) return `${localBin}${foundExt}`;
|
|
47237
48721
|
return void 0;
|
|
@@ -47243,21 +48727,21 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
47243
48727
|
if (this._scriptPath) {
|
|
47244
48728
|
let resolvedScriptPath;
|
|
47245
48729
|
try {
|
|
47246
|
-
resolvedScriptPath =
|
|
48730
|
+
resolvedScriptPath = fs11.realpathSync(this._scriptPath);
|
|
47247
48731
|
} catch {
|
|
47248
48732
|
resolvedScriptPath = this._scriptPath;
|
|
47249
48733
|
}
|
|
47250
|
-
executableDir =
|
|
47251
|
-
|
|
48734
|
+
executableDir = path14.resolve(
|
|
48735
|
+
path14.dirname(resolvedScriptPath),
|
|
47252
48736
|
executableDir
|
|
47253
48737
|
);
|
|
47254
48738
|
}
|
|
47255
48739
|
if (executableDir) {
|
|
47256
48740
|
let localFile = findFile(executableDir, executableFile);
|
|
47257
48741
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
47258
|
-
const legacyName =
|
|
48742
|
+
const legacyName = path14.basename(
|
|
47259
48743
|
this._scriptPath,
|
|
47260
|
-
|
|
48744
|
+
path14.extname(this._scriptPath)
|
|
47261
48745
|
);
|
|
47262
48746
|
if (legacyName !== this._name) {
|
|
47263
48747
|
localFile = findFile(
|
|
@@ -47268,7 +48752,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
47268
48752
|
}
|
|
47269
48753
|
executableFile = localFile || executableFile;
|
|
47270
48754
|
}
|
|
47271
|
-
launchWithNode = sourceExt.includes(
|
|
48755
|
+
launchWithNode = sourceExt.includes(path14.extname(executableFile));
|
|
47272
48756
|
let proc;
|
|
47273
48757
|
if (process11.platform !== "win32") {
|
|
47274
48758
|
if (launchWithNode) {
|
|
@@ -48183,7 +49667,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
48183
49667
|
* @return {Command}
|
|
48184
49668
|
*/
|
|
48185
49669
|
nameFromFilename(filename) {
|
|
48186
|
-
this._name =
|
|
49670
|
+
this._name = path14.basename(filename, path14.extname(filename));
|
|
48187
49671
|
return this;
|
|
48188
49672
|
}
|
|
48189
49673
|
/**
|
|
@@ -48197,9 +49681,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
48197
49681
|
* @param {string} [path]
|
|
48198
49682
|
* @return {(string|null|Command)}
|
|
48199
49683
|
*/
|
|
48200
|
-
executableDir(
|
|
48201
|
-
if (
|
|
48202
|
-
this._executableDir =
|
|
49684
|
+
executableDir(path15) {
|
|
49685
|
+
if (path15 === void 0) return this._executableDir;
|
|
49686
|
+
this._executableDir = path15;
|
|
48203
49687
|
return this;
|
|
48204
49688
|
}
|
|
48205
49689
|
/**
|
|
@@ -50628,11 +52112,11 @@ var init_cli_spinners = __esm({
|
|
|
50628
52112
|
|
|
50629
52113
|
// node_modules/.pnpm/yoctocolors@2.1.2/node_modules/yoctocolors/base.js
|
|
50630
52114
|
import tty2 from "node:tty";
|
|
50631
|
-
var hasColors,
|
|
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;
|
|
50632
52116
|
var init_base = __esm({
|
|
50633
52117
|
"node_modules/.pnpm/yoctocolors@2.1.2/node_modules/yoctocolors/base.js"() {
|
|
50634
52118
|
hasColors = tty2?.WriteStream?.prototype?.hasColors?.() ?? false;
|
|
50635
|
-
|
|
52119
|
+
format2 = (open, close) => {
|
|
50636
52120
|
if (!hasColors) {
|
|
50637
52121
|
return (input) => input;
|
|
50638
52122
|
}
|
|
@@ -50657,47 +52141,47 @@ var init_base = __esm({
|
|
|
50657
52141
|
return result;
|
|
50658
52142
|
};
|
|
50659
52143
|
};
|
|
50660
|
-
reset =
|
|
50661
|
-
bold =
|
|
50662
|
-
dim =
|
|
50663
|
-
italic =
|
|
50664
|
-
underline =
|
|
50665
|
-
overline =
|
|
50666
|
-
inverse =
|
|
50667
|
-
hidden =
|
|
50668
|
-
strikethrough =
|
|
50669
|
-
black =
|
|
50670
|
-
red =
|
|
50671
|
-
green =
|
|
50672
|
-
yellow =
|
|
50673
|
-
blue =
|
|
50674
|
-
magenta =
|
|
50675
|
-
cyan =
|
|
50676
|
-
white =
|
|
50677
|
-
gray =
|
|
50678
|
-
bgBlack =
|
|
50679
|
-
bgRed =
|
|
50680
|
-
bgGreen =
|
|
50681
|
-
bgYellow =
|
|
50682
|
-
bgBlue =
|
|
50683
|
-
bgMagenta =
|
|
50684
|
-
bgCyan =
|
|
50685
|
-
bgWhite =
|
|
50686
|
-
bgGray =
|
|
50687
|
-
redBright =
|
|
50688
|
-
greenBright =
|
|
50689
|
-
yellowBright =
|
|
50690
|
-
blueBright =
|
|
50691
|
-
magentaBright =
|
|
50692
|
-
cyanBright =
|
|
50693
|
-
whiteBright =
|
|
50694
|
-
bgRedBright =
|
|
50695
|
-
bgGreenBright =
|
|
50696
|
-
bgYellowBright =
|
|
50697
|
-
bgBlueBright =
|
|
50698
|
-
bgMagentaBright =
|
|
50699
|
-
bgCyanBright =
|
|
50700
|
-
bgWhiteBright =
|
|
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);
|
|
50701
52185
|
}
|
|
50702
52186
|
});
|
|
50703
52187
|
|
|
@@ -51859,8 +53343,8 @@ var init_reporter = __esm({
|
|
|
51859
53343
|
});
|
|
51860
53344
|
|
|
51861
53345
|
// src/core/config.ts
|
|
51862
|
-
import * as
|
|
51863
|
-
import * as
|
|
53346
|
+
import * as fs9 from "node:fs";
|
|
53347
|
+
import * as path12 from "node:path";
|
|
51864
53348
|
function formatJsonError(content, err) {
|
|
51865
53349
|
const msg = err instanceof Error ? err.message : String(err);
|
|
51866
53350
|
const posMatch = msg.match(/position (\d+)/);
|
|
@@ -51933,10 +53417,10 @@ function warnUnknownKeys(config2, source) {
|
|
|
51933
53417
|
}
|
|
51934
53418
|
function loadConfig(projectRoot) {
|
|
51935
53419
|
for (const filename of CONFIG_FILENAMES) {
|
|
51936
|
-
const filePath =
|
|
53420
|
+
const filePath = path12.join(projectRoot, filename);
|
|
51937
53421
|
let content;
|
|
51938
53422
|
try {
|
|
51939
|
-
content =
|
|
53423
|
+
content = fs9.readFileSync(filePath, "utf-8");
|
|
51940
53424
|
} catch {
|
|
51941
53425
|
continue;
|
|
51942
53426
|
}
|
|
@@ -51982,8 +53466,8 @@ var cli_exports = {};
|
|
|
51982
53466
|
__export(cli_exports, {
|
|
51983
53467
|
runCli: () => runCli
|
|
51984
53468
|
});
|
|
51985
|
-
import * as
|
|
51986
|
-
import * as
|
|
53469
|
+
import * as fs10 from "node:fs";
|
|
53470
|
+
import * as path13 from "node:path";
|
|
51987
53471
|
function validateCheckNames(names, source) {
|
|
51988
53472
|
const invalid = names.filter((n7) => n7 && !VALID_CHECKS.has(n7));
|
|
51989
53473
|
if (invalid.length > 0) {
|
|
@@ -52001,13 +53485,21 @@ async function runCli() {
|
|
|
52001
53485
|
"Lint your AI agent context files and MCP server configs against your actual codebase"
|
|
52002
53486
|
).version(VERSION).argument("[path]", "Project directory to scan", ".").option("--strict", "Exit code 1 on any warning or error (for CI)", false).option("--checks <checks>", "Comma-separated list of checks to run", "").addOption(
|
|
52003
53487
|
new Option("--format <format>", "Output format: text, json, or sarif").choices(["text", "json", "sarif"]).default("text")
|
|
52004
|
-
).option("--tokens", "Show token breakdown per file", false).option("--verbose", "Show passing checks too", false).option("--fix", "Auto-fix broken paths using git history and fuzzy matching", false).option("--fix-dry-run", "Preview --fix changes without writing", false).option("--yes", "Skip interactive confirmation prompts (required for --fix in TTY)", false).option("--follow-symlinks", "Allow --fix to write through symlinks (default: skip)", false).option("--ignore <checks>", "Comma-separated list of checks to ignore", "").option("--quiet", "Suppress all output except errors (exit code only)", false).option("--config <path>", "Path to config file (default: .ctxlintrc in project root)").option("--depth <n>", "Max subdirectory depth to scan (default: 2)", "2").option("--mcp", "Enable MCP config linting alongside context file checks", false).option("--mcp-only", "Run only MCP config checks, skip context file checks", false).option("--mcp-global", "Also scan user/global MCP config files (implies --mcp)", false).option("--mcp-server", "Start the MCP server (alias: `ctxlint serve`)").option("--
|
|
52005
|
-
|
|
52006
|
-
|
|
53488
|
+
).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(
|
|
53489
|
+
"--mcph-strict-env-token",
|
|
53490
|
+
"Upgrade mcph-config/prefer-env-token from warning to error (strict env-var-only posture)",
|
|
53491
|
+
false
|
|
53492
|
+
).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) => {
|
|
53493
|
+
const resolvedPath = path13.resolve(projectPath);
|
|
53494
|
+
const configPath = opts.config ? path13.resolve(opts.config) : void 0;
|
|
52007
53495
|
const config2 = configPath ? loadConfigFromPath(configPath) : loadConfig(resolvedPath);
|
|
52008
53496
|
const mcpGlobal = opts.mcpGlobal || false;
|
|
52009
53497
|
const mcpOnly = opts.mcpOnly || false;
|
|
52010
53498
|
const mcpFlag = opts.mcp || mcpGlobal || mcpOnly || config2?.mcp || false;
|
|
53499
|
+
const mcphGlobal = opts.mcphGlobal || false;
|
|
53500
|
+
const mcphOnly = opts.mcphOnly || false;
|
|
53501
|
+
const mcphFlag = opts.mcph || mcphGlobal || mcphOnly || false;
|
|
53502
|
+
const mcphStrictEnvToken = opts.mcphStrictEnvToken || false;
|
|
52011
53503
|
const sessionFlag = opts.session || false;
|
|
52012
53504
|
const sessionOnly = opts.sessionOnly || false;
|
|
52013
53505
|
let explicitChecks = opts.checks ? validateCheckNames(
|
|
@@ -52016,8 +53508,10 @@ async function runCli() {
|
|
|
52016
53508
|
) : null;
|
|
52017
53509
|
if (explicitChecks?.length === 0) explicitChecks = null;
|
|
52018
53510
|
const hasMcpInChecks = explicitChecks?.some((c3) => c3.startsWith("mcp-")) || false;
|
|
53511
|
+
const hasMcphInChecks = explicitChecks?.some((c3) => c3.startsWith("mcph-")) || false;
|
|
52019
53512
|
const hasSessionInChecks = explicitChecks?.some((c3) => c3.startsWith("session-")) || false;
|
|
52020
53513
|
const effectiveMcp = mcpFlag || hasMcpInChecks;
|
|
53514
|
+
const effectiveMcph = mcphFlag || hasMcphInChecks;
|
|
52021
53515
|
const effectiveSession = sessionFlag || sessionOnly || hasSessionInChecks;
|
|
52022
53516
|
let checks;
|
|
52023
53517
|
if (explicitChecks) {
|
|
@@ -52026,11 +53520,14 @@ async function runCli() {
|
|
|
52026
53520
|
checks = ALL_SESSION_CHECKS;
|
|
52027
53521
|
} else if (mcpOnly) {
|
|
52028
53522
|
checks = ALL_MCP_CHECKS;
|
|
53523
|
+
} else if (mcphOnly) {
|
|
53524
|
+
checks = ALL_MCPH_CHECKS;
|
|
52029
53525
|
} else {
|
|
52030
53526
|
const base = config2?.checks || ALL_CHECKS;
|
|
52031
53527
|
checks = [
|
|
52032
53528
|
...base,
|
|
52033
53529
|
...effectiveMcp ? ALL_MCP_CHECKS : [],
|
|
53530
|
+
...effectiveMcph ? ALL_MCPH_CHECKS : [],
|
|
52034
53531
|
...effectiveSession ? ALL_SESSION_CHECKS : []
|
|
52035
53532
|
];
|
|
52036
53533
|
}
|
|
@@ -52051,6 +53548,10 @@ async function runCli() {
|
|
|
52051
53548
|
mcp: effectiveMcp,
|
|
52052
53549
|
mcpOnly,
|
|
52053
53550
|
mcpGlobal: mcpGlobal || config2?.mcpGlobal || false,
|
|
53551
|
+
mcph: effectiveMcph,
|
|
53552
|
+
mcphOnly,
|
|
53553
|
+
mcphGlobal,
|
|
53554
|
+
mcphStrictEnvToken,
|
|
52054
53555
|
session: effectiveSession,
|
|
52055
53556
|
sessionOnly
|
|
52056
53557
|
};
|
|
@@ -52067,6 +53568,10 @@ async function runCli() {
|
|
|
52067
53568
|
mcp: options.mcp,
|
|
52068
53569
|
mcpGlobal: options.mcpGlobal,
|
|
52069
53570
|
mcpOnly: options.mcpOnly,
|
|
53571
|
+
mcph: options.mcph,
|
|
53572
|
+
mcphGlobal: options.mcphGlobal,
|
|
53573
|
+
mcphOnly: options.mcphOnly,
|
|
53574
|
+
mcphStrictEnvToken: options.mcphStrictEnvToken,
|
|
52070
53575
|
session: options.session,
|
|
52071
53576
|
sessionOnly: options.sessionOnly
|
|
52072
53577
|
});
|
|
@@ -52167,34 +53672,34 @@ Fixed ${applied.totalFixes} issue${applied.totalFixes !== 1 ? "s" : ""} in ${app
|
|
|
52167
53672
|
const chalk2 = (await Promise.resolve().then(() => (init_source(), source_exports))).default;
|
|
52168
53673
|
console.log(chalk2.dim("\nWatching for changes... (Ctrl+C to stop)\n"));
|
|
52169
53674
|
const watchPaths = [
|
|
52170
|
-
|
|
52171
|
-
|
|
52172
|
-
|
|
52173
|
-
|
|
52174
|
-
|
|
52175
|
-
|
|
52176
|
-
|
|
52177
|
-
|
|
52178
|
-
|
|
52179
|
-
|
|
52180
|
-
|
|
52181
|
-
|
|
52182
|
-
|
|
52183
|
-
|
|
52184
|
-
|
|
53675
|
+
path13.join(resolvedPath, "CLAUDE.md"),
|
|
53676
|
+
path13.join(resolvedPath, "CLAUDE.local.md"),
|
|
53677
|
+
path13.join(resolvedPath, "AGENTS.md"),
|
|
53678
|
+
path13.join(resolvedPath, "AGENT.md"),
|
|
53679
|
+
path13.join(resolvedPath, ".cursorrules"),
|
|
53680
|
+
path13.join(resolvedPath, ".windsurfrules"),
|
|
53681
|
+
path13.join(resolvedPath, ".clinerules"),
|
|
53682
|
+
path13.join(resolvedPath, ".aiderules"),
|
|
53683
|
+
path13.join(resolvedPath, ".continuerules"),
|
|
53684
|
+
path13.join(resolvedPath, ".rules"),
|
|
53685
|
+
path13.join(resolvedPath, ".goosehints"),
|
|
53686
|
+
path13.join(resolvedPath, "GEMINI.md"),
|
|
53687
|
+
path13.join(resolvedPath, "replit.md"),
|
|
53688
|
+
path13.join(resolvedPath, "package.json"),
|
|
53689
|
+
path13.join(resolvedPath, ".mcp.json")
|
|
52185
53690
|
];
|
|
52186
53691
|
const watchDirs = [
|
|
52187
|
-
|
|
52188
|
-
|
|
52189
|
-
|
|
52190
|
-
|
|
52191
|
-
|
|
52192
|
-
|
|
52193
|
-
|
|
52194
|
-
|
|
52195
|
-
|
|
52196
|
-
|
|
52197
|
-
|
|
53692
|
+
path13.join(resolvedPath, ".claude"),
|
|
53693
|
+
path13.join(resolvedPath, ".cursor"),
|
|
53694
|
+
path13.join(resolvedPath, ".github"),
|
|
53695
|
+
path13.join(resolvedPath, ".windsurf"),
|
|
53696
|
+
path13.join(resolvedPath, ".aide"),
|
|
53697
|
+
path13.join(resolvedPath, ".amazonq"),
|
|
53698
|
+
path13.join(resolvedPath, ".goose"),
|
|
53699
|
+
path13.join(resolvedPath, ".junie"),
|
|
53700
|
+
path13.join(resolvedPath, ".aiassistant"),
|
|
53701
|
+
path13.join(resolvedPath, ".continue"),
|
|
53702
|
+
path13.join(resolvedPath, ".vscode")
|
|
52198
53703
|
];
|
|
52199
53704
|
const watchers = [];
|
|
52200
53705
|
let debounceTimer = null;
|
|
@@ -52209,6 +53714,10 @@ Fixed ${applied.totalFixes} issue${applied.totalFixes !== 1 ? "s" : ""} in ${app
|
|
|
52209
53714
|
mcp: options.mcp,
|
|
52210
53715
|
mcpGlobal: options.mcpGlobal,
|
|
52211
53716
|
mcpOnly: options.mcpOnly,
|
|
53717
|
+
mcph: options.mcph,
|
|
53718
|
+
mcphGlobal: options.mcphGlobal,
|
|
53719
|
+
mcphOnly: options.mcphOnly,
|
|
53720
|
+
mcphStrictEnvToken: options.mcphStrictEnvToken,
|
|
52212
53721
|
session: options.session,
|
|
52213
53722
|
sessionOnly: options.sessionOnly
|
|
52214
53723
|
});
|
|
@@ -52238,13 +53747,13 @@ Fixed ${applied.totalFixes} issue${applied.totalFixes !== 1 ? "s" : ""} in ${app
|
|
|
52238
53747
|
};
|
|
52239
53748
|
for (const filePath of watchPaths) {
|
|
52240
53749
|
try {
|
|
52241
|
-
watchers.push(
|
|
53750
|
+
watchers.push(fs10.watch(filePath, rerun));
|
|
52242
53751
|
} catch {
|
|
52243
53752
|
}
|
|
52244
53753
|
}
|
|
52245
53754
|
for (const dir of watchDirs) {
|
|
52246
53755
|
try {
|
|
52247
|
-
watchers.push(
|
|
53756
|
+
watchers.push(fs10.watch(dir, { recursive: true }, rerun));
|
|
52248
53757
|
} catch {
|
|
52249
53758
|
}
|
|
52250
53759
|
}
|
|
@@ -52265,17 +53774,17 @@ Fixed ${applied.totalFixes} issue${applied.totalFixes !== 1 ? "s" : ""} in ${app
|
|
|
52265
53774
|
}
|
|
52266
53775
|
});
|
|
52267
53776
|
program2.command("init").description("Set up a git pre-commit hook that runs ctxlint --strict").argument("[path]", "Project directory", ".").action(async (projectPath) => {
|
|
52268
|
-
const resolvedRoot =
|
|
52269
|
-
const gitDir =
|
|
52270
|
-
const hooksDir =
|
|
52271
|
-
if (!
|
|
53777
|
+
const resolvedRoot = path13.resolve(projectPath);
|
|
53778
|
+
const gitDir = path13.join(resolvedRoot, ".git");
|
|
53779
|
+
const hooksDir = path13.join(gitDir, "hooks");
|
|
53780
|
+
if (!fs10.existsSync(gitDir)) {
|
|
52272
53781
|
console.error('Error: not a git repository. Run "git init" first.');
|
|
52273
53782
|
process.exit(1);
|
|
52274
53783
|
}
|
|
52275
|
-
if (!
|
|
52276
|
-
|
|
53784
|
+
if (!fs10.existsSync(hooksDir)) {
|
|
53785
|
+
fs10.mkdirSync(hooksDir, { recursive: true });
|
|
52277
53786
|
}
|
|
52278
|
-
const hookPath =
|
|
53787
|
+
const hookPath = path13.join(hooksDir, "pre-commit");
|
|
52279
53788
|
const fullHookContent = `#!/bin/sh
|
|
52280
53789
|
# ctxlint pre-commit hook
|
|
52281
53790
|
npx @yawlabs/ctxlint@${VERSION} --strict
|
|
@@ -52284,16 +53793,16 @@ npx @yawlabs/ctxlint@${VERSION} --strict
|
|
|
52284
53793
|
# ctxlint pre-commit hook
|
|
52285
53794
|
npx @yawlabs/ctxlint@${VERSION} --strict
|
|
52286
53795
|
`;
|
|
52287
|
-
if (
|
|
52288
|
-
const existing =
|
|
53796
|
+
if (fs10.existsSync(hookPath)) {
|
|
53797
|
+
const existing = fs10.readFileSync(hookPath, "utf-8");
|
|
52289
53798
|
if (existing.includes("ctxlint")) {
|
|
52290
53799
|
console.log("Pre-commit hook already includes ctxlint.");
|
|
52291
53800
|
return;
|
|
52292
53801
|
}
|
|
52293
|
-
|
|
53802
|
+
fs10.appendFileSync(hookPath, appendHookContent);
|
|
52294
53803
|
console.log("Added ctxlint to existing pre-commit hook.");
|
|
52295
53804
|
} else {
|
|
52296
|
-
|
|
53805
|
+
fs10.writeFileSync(hookPath, fullHookContent, { mode: 493 });
|
|
52297
53806
|
console.log("Created pre-commit hook at .git/hooks/pre-commit");
|
|
52298
53807
|
}
|
|
52299
53808
|
console.log("ctxlint will now run automatically before each commit.");
|
|
@@ -52312,7 +53821,7 @@ async function promptYesNo(question) {
|
|
|
52312
53821
|
}
|
|
52313
53822
|
function loadConfigFromPath(configPath) {
|
|
52314
53823
|
try {
|
|
52315
|
-
const content =
|
|
53824
|
+
const content = fs10.readFileSync(configPath, "utf-8");
|
|
52316
53825
|
return JSON.parse(content);
|
|
52317
53826
|
} catch (err) {
|
|
52318
53827
|
const detail = err instanceof Error ? err.message : String(err);
|
|
@@ -52336,7 +53845,12 @@ var init_cli = __esm({
|
|
|
52336
53845
|
init_config2();
|
|
52337
53846
|
init_audit();
|
|
52338
53847
|
init_version2();
|
|
52339
|
-
VALID_CHECKS = /* @__PURE__ */ new Set([
|
|
53848
|
+
VALID_CHECKS = /* @__PURE__ */ new Set([
|
|
53849
|
+
...ALL_CHECKS,
|
|
53850
|
+
...ALL_MCP_CHECKS,
|
|
53851
|
+
...ALL_MCPH_CHECKS,
|
|
53852
|
+
...ALL_SESSION_CHECKS
|
|
53853
|
+
]);
|
|
52340
53854
|
}
|
|
52341
53855
|
});
|
|
52342
53856
|
|