@yawlabs/ctxlint 0.18.6 → 0.18.7
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/.pre-commit-hooks.yaml +1 -1
- package/dist/index.js +1147 -1113
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -13774,6 +13774,12 @@ function extractPathReferences(lines, sections) {
|
|
|
13774
13774
|
if (lowerProse && !PATH_FIRST_SEGMENTS.has(lowerProse[1])) {
|
|
13775
13775
|
continue;
|
|
13776
13776
|
}
|
|
13777
|
+
if (/^[a-z][\w-]*(?:\/[a-z][\w-]*){2,}$/.test(cleanValue)) continue;
|
|
13778
|
+
if (/([A-Z])\1{2,}/.test(cleanValue)) continue;
|
|
13779
|
+
if (cleanValue.includes("*")) {
|
|
13780
|
+
const anchored = /^\.{0,2}\//.test(cleanValue) || cleanValue.includes("**") || PATH_FIRST_SEGMENTS.has(cleanValue.split("/")[0]);
|
|
13781
|
+
if (!anchored) continue;
|
|
13782
|
+
}
|
|
13777
13783
|
if (/(^|\/)\.git\//.test(cleanValue) || /\.app\//.test(cleanValue)) continue;
|
|
13778
13784
|
const column = match.index + match[0].length - match[1].length + 1;
|
|
13779
13785
|
paths.push({
|
|
@@ -20505,6 +20511,7 @@ async function checkPaths(file2, projectRoot) {
|
|
|
20505
20511
|
const projectFiles = getProjectFiles(projectRoot);
|
|
20506
20512
|
const basenameIndex = getBasenameIndex(projectRoot, projectFiles);
|
|
20507
20513
|
const contextDir = path4.dirname(file2.filePath);
|
|
20514
|
+
const inRootDotConfigDir = path4.dirname(contextDir) === projectRoot && path4.basename(contextDir).startsWith(".");
|
|
20508
20515
|
const pending = [];
|
|
20509
20516
|
for (const ref of file2.references.paths) {
|
|
20510
20517
|
const rawNormalized = ref.value.replace(/\\/g, "/");
|
|
@@ -20515,7 +20522,7 @@ async function checkPaths(file2, projectRoot) {
|
|
|
20515
20522
|
continue;
|
|
20516
20523
|
}
|
|
20517
20524
|
const explicitRel = /^\.\.?\//.test(normalizedRef);
|
|
20518
|
-
const baseDirs = explicitRel
|
|
20525
|
+
const baseDirs = isImport ? [contextDir] : explicitRel ? inRootDotConfigDir ? [contextDir, projectRoot] : [contextDir] : [projectRoot, contextDir];
|
|
20519
20526
|
const primaryBase = baseDirs[0];
|
|
20520
20527
|
if (normalizedRef.includes("*")) {
|
|
20521
20528
|
let hasMatch = false;
|
|
@@ -20676,579 +20683,162 @@ var init_paths = __esm({
|
|
|
20676
20683
|
}
|
|
20677
20684
|
});
|
|
20678
20685
|
|
|
20679
|
-
//
|
|
20680
|
-
|
|
20681
|
-
|
|
20682
|
-
|
|
20683
|
-
|
|
20684
|
-
|
|
20685
|
-
|
|
20686
|
-
|
|
20687
|
-
|
|
20688
|
-
|
|
20689
|
-
|
|
20690
|
-
|
|
20691
|
-
|
|
20692
|
-
|
|
20693
|
-
|
|
20694
|
-
|
|
20695
|
-
|
|
20696
|
-
|
|
20697
|
-
|
|
20698
|
-
|
|
20699
|
-
if (v2 && !v2.startsWith("-")) return v2;
|
|
20700
|
-
continue;
|
|
20686
|
+
// node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/scanner.js
|
|
20687
|
+
function createScanner(text, ignoreTrivia = false) {
|
|
20688
|
+
const len = text.length;
|
|
20689
|
+
let pos = 0, value = "", tokenOffset = 0, token = 16, lineNumber = 0, lineStartOffset = 0, tokenLineStartOffset = 0, prevTokenLineStartOffset = 0, scanError = 0;
|
|
20690
|
+
function scanHexDigits(count, exact) {
|
|
20691
|
+
let digits = 0;
|
|
20692
|
+
let value2 = 0;
|
|
20693
|
+
while (digits < count || !exact) {
|
|
20694
|
+
let ch = text.charCodeAt(pos);
|
|
20695
|
+
if (ch >= 48 && ch <= 57) {
|
|
20696
|
+
value2 = value2 * 16 + ch - 48;
|
|
20697
|
+
} else if (ch >= 65 && ch <= 70) {
|
|
20698
|
+
value2 = value2 * 16 + ch - 65 + 10;
|
|
20699
|
+
} else if (ch >= 97 && ch <= 102) {
|
|
20700
|
+
value2 = value2 * 16 + ch - 97 + 10;
|
|
20701
|
+
} else {
|
|
20702
|
+
break;
|
|
20703
|
+
}
|
|
20704
|
+
pos++;
|
|
20705
|
+
digits++;
|
|
20701
20706
|
}
|
|
20702
|
-
if (
|
|
20703
|
-
|
|
20707
|
+
if (digits < count) {
|
|
20708
|
+
value2 = -1;
|
|
20704
20709
|
}
|
|
20705
|
-
|
|
20706
|
-
return t2;
|
|
20710
|
+
return value2;
|
|
20707
20711
|
}
|
|
20708
|
-
|
|
20709
|
-
|
|
20710
|
-
|
|
20711
|
-
|
|
20712
|
-
|
|
20713
|
-
|
|
20714
|
-
if (shorthandMatch && !isManagerBuiltin(shorthandMatch[1], shorthandMatch[2])) return true;
|
|
20715
|
-
return /^npx\b/.test(cmd) || PKG_DEPENDENT_TOOL_PATTERN.test(cmd);
|
|
20716
|
-
}
|
|
20717
|
-
async function checkCommands(file2, projectRoot) {
|
|
20718
|
-
const issues = [];
|
|
20719
|
-
const pkgJson = loadPackageJson(projectRoot);
|
|
20720
|
-
const makefile = loadMakefile(projectRoot);
|
|
20721
|
-
if (!pkgJson) {
|
|
20722
|
-
const skipped = file2.references.commands.find((ref) => wouldNeedPackageJson(ref.value));
|
|
20723
|
-
if (skipped) {
|
|
20724
|
-
issues.push({
|
|
20725
|
-
severity: "info",
|
|
20726
|
-
check: "commands",
|
|
20727
|
-
ruleId: "commands/package-json-missing",
|
|
20728
|
-
line: skipped.line,
|
|
20729
|
-
message: "package.json missing or unparseable \u2014 command checks skipped",
|
|
20730
|
-
suggestion: "Add a parseable package.json at the project root so script, npx, and tool references can be validated."
|
|
20731
|
-
});
|
|
20732
|
-
}
|
|
20712
|
+
function setPosition(newPosition) {
|
|
20713
|
+
pos = newPosition;
|
|
20714
|
+
value = "";
|
|
20715
|
+
tokenOffset = 0;
|
|
20716
|
+
token = 16;
|
|
20717
|
+
scanError = 0;
|
|
20733
20718
|
}
|
|
20734
|
-
|
|
20735
|
-
|
|
20736
|
-
|
|
20737
|
-
|
|
20738
|
-
|
|
20739
|
-
|
|
20740
|
-
|
|
20741
|
-
|
|
20742
|
-
severity: "error",
|
|
20743
|
-
check: "commands",
|
|
20744
|
-
ruleId: "commands/script-not-found",
|
|
20745
|
-
line: ref.line,
|
|
20746
|
-
message: `"${cmd}" \u2014 script "${scriptName}" not found in package.json`,
|
|
20747
|
-
suggestion: available ? `Available scripts: ${available}` : void 0
|
|
20748
|
-
});
|
|
20749
|
-
}
|
|
20750
|
-
continue;
|
|
20751
|
-
}
|
|
20752
|
-
const shorthandMatch = cmd.match(PKG_SHORTHAND_PATTERN);
|
|
20753
|
-
if (shorthandMatch && pkgJson) {
|
|
20754
|
-
const manager = shorthandMatch[1];
|
|
20755
|
-
const scriptName = shorthandMatch[2];
|
|
20756
|
-
if (isManagerBuiltin(manager, scriptName)) continue;
|
|
20757
|
-
if (pkgJson.scripts && !(scriptName in pkgJson.scripts)) {
|
|
20758
|
-
issues.push({
|
|
20759
|
-
severity: "error",
|
|
20760
|
-
check: "commands",
|
|
20761
|
-
ruleId: "commands/script-not-found",
|
|
20762
|
-
line: ref.line,
|
|
20763
|
-
message: `"${cmd}" \u2014 script "${scriptName}" not found in package.json`
|
|
20764
|
-
});
|
|
20719
|
+
function scanNumber() {
|
|
20720
|
+
let start = pos;
|
|
20721
|
+
if (text.charCodeAt(pos) === 48) {
|
|
20722
|
+
pos++;
|
|
20723
|
+
} else {
|
|
20724
|
+
pos++;
|
|
20725
|
+
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
20726
|
+
pos++;
|
|
20765
20727
|
}
|
|
20766
|
-
continue;
|
|
20767
20728
|
}
|
|
20768
|
-
if (
|
|
20769
|
-
|
|
20770
|
-
if (
|
|
20771
|
-
|
|
20772
|
-
|
|
20773
|
-
|
|
20774
|
-
...pkgJson.peerDependencies,
|
|
20775
|
-
...pkgJson.optionalDependencies
|
|
20776
|
-
};
|
|
20777
|
-
if (!(pkgName in allDeps)) {
|
|
20778
|
-
const binPath = path5.join(projectRoot, "node_modules", ".bin", pkgName);
|
|
20779
|
-
try {
|
|
20780
|
-
fs4.accessSync(binPath);
|
|
20781
|
-
} catch {
|
|
20782
|
-
issues.push({
|
|
20783
|
-
severity: "warning",
|
|
20784
|
-
check: "commands",
|
|
20785
|
-
ruleId: "commands/npx-not-in-deps",
|
|
20786
|
-
line: ref.line,
|
|
20787
|
-
message: `"${cmd}" \u2014 "${pkgName}" not found in dependencies`,
|
|
20788
|
-
suggestion: "If this is a global tool, consider adding it to devDependencies for reproducibility"
|
|
20789
|
-
});
|
|
20729
|
+
if (pos < text.length && text.charCodeAt(pos) === 46) {
|
|
20730
|
+
pos++;
|
|
20731
|
+
if (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
20732
|
+
pos++;
|
|
20733
|
+
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
20734
|
+
pos++;
|
|
20790
20735
|
}
|
|
20791
|
-
}
|
|
20792
|
-
continue;
|
|
20793
|
-
}
|
|
20794
|
-
if (MAKE_PATTERN.test(cmd)) {
|
|
20795
|
-
if (!makefile) {
|
|
20796
|
-
issues.push({
|
|
20797
|
-
severity: "error",
|
|
20798
|
-
check: "commands",
|
|
20799
|
-
ruleId: "commands/no-makefile",
|
|
20800
|
-
line: ref.line,
|
|
20801
|
-
message: `"${cmd}" \u2014 no Makefile found in project`
|
|
20802
|
-
});
|
|
20803
20736
|
} else {
|
|
20804
|
-
|
|
20805
|
-
|
|
20806
|
-
issues.push({
|
|
20807
|
-
severity: "error",
|
|
20808
|
-
check: "commands",
|
|
20809
|
-
ruleId: "commands/make-target-not-found",
|
|
20810
|
-
line: ref.line,
|
|
20811
|
-
message: `"${cmd}" \u2014 target "${target}" not found in Makefile`
|
|
20812
|
-
});
|
|
20813
|
-
}
|
|
20737
|
+
scanError = 3;
|
|
20738
|
+
return text.substring(start, pos);
|
|
20814
20739
|
}
|
|
20815
|
-
continue;
|
|
20816
20740
|
}
|
|
20817
|
-
|
|
20818
|
-
if (
|
|
20819
|
-
|
|
20820
|
-
|
|
20821
|
-
|
|
20822
|
-
|
|
20823
|
-
|
|
20824
|
-
|
|
20825
|
-
|
|
20826
|
-
|
|
20827
|
-
if (!(pkgName in allDeps)) {
|
|
20828
|
-
const binPath = path5.join(projectRoot, "node_modules", ".bin", tool);
|
|
20829
|
-
try {
|
|
20830
|
-
fs4.accessSync(binPath);
|
|
20831
|
-
} catch {
|
|
20832
|
-
issues.push({
|
|
20833
|
-
severity: "warning",
|
|
20834
|
-
check: "commands",
|
|
20835
|
-
ruleId: "commands/tool-not-found",
|
|
20836
|
-
line: ref.line,
|
|
20837
|
-
message: `"${cmd}" \u2014 "${tool}" not found in dependencies or node_modules/.bin`
|
|
20838
|
-
});
|
|
20741
|
+
let end = pos;
|
|
20742
|
+
if (pos < text.length && (text.charCodeAt(pos) === 69 || text.charCodeAt(pos) === 101)) {
|
|
20743
|
+
pos++;
|
|
20744
|
+
if (pos < text.length && text.charCodeAt(pos) === 43 || text.charCodeAt(pos) === 45) {
|
|
20745
|
+
pos++;
|
|
20746
|
+
}
|
|
20747
|
+
if (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
20748
|
+
pos++;
|
|
20749
|
+
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
20750
|
+
pos++;
|
|
20839
20751
|
}
|
|
20752
|
+
end = pos;
|
|
20753
|
+
} else {
|
|
20754
|
+
scanError = 3;
|
|
20840
20755
|
}
|
|
20841
20756
|
}
|
|
20757
|
+
return text.substring(start, end);
|
|
20842
20758
|
}
|
|
20843
|
-
|
|
20844
|
-
|
|
20845
|
-
|
|
20846
|
-
|
|
20847
|
-
|
|
20848
|
-
|
|
20849
|
-
|
|
20850
|
-
}
|
|
20851
|
-
}
|
|
20852
|
-
function extractMakeTarget(cmd) {
|
|
20853
|
-
for (const token of cmd.split(/\s+/).slice(1)) {
|
|
20854
|
-
if (token.startsWith("-")) return null;
|
|
20855
|
-
if (token.includes("=")) continue;
|
|
20856
|
-
return token;
|
|
20857
|
-
}
|
|
20858
|
-
return null;
|
|
20859
|
-
}
|
|
20860
|
-
function hasMakeTarget(makefile, target) {
|
|
20861
|
-
const escaped = target.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
20862
|
-
const pattern = new RegExp(`^${escaped}\\s*:(?!:?=)`, "m");
|
|
20863
|
-
return pattern.test(makefile);
|
|
20864
|
-
}
|
|
20865
|
-
var NPM_SCRIPT_PATTERN, MAKE_PATTERN, PM_BUILTIN_SUBCOMMANDS, PM_MANAGER_BUILTINS, PKG_DEPENDENT_TOOL_PATTERN, BIN_TO_PACKAGE, PKG_SHORTHAND_PATTERN;
|
|
20866
|
-
var init_commands = __esm({
|
|
20867
|
-
"src/core/checks/commands.ts"() {
|
|
20868
|
-
"use strict";
|
|
20869
|
-
init_define_WEB_FIRST_SEGMENTS();
|
|
20870
|
-
init_fs();
|
|
20871
|
-
NPM_SCRIPT_PATTERN = /^(?:npm\s+run|(pnpm|yarn|bun)(?:\s+(run))?)\s+(\S+)/;
|
|
20872
|
-
MAKE_PATTERN = /^make\s+\S/;
|
|
20873
|
-
PM_BUILTIN_SUBCOMMANDS = /* @__PURE__ */ new Set([
|
|
20874
|
-
"add",
|
|
20875
|
-
"approve-builds",
|
|
20876
|
-
"audit",
|
|
20877
|
-
"bin",
|
|
20878
|
-
"cache",
|
|
20879
|
-
"ci",
|
|
20880
|
-
"config",
|
|
20881
|
-
"create",
|
|
20882
|
-
"dedupe",
|
|
20883
|
-
"dlx",
|
|
20884
|
-
"doctor",
|
|
20885
|
-
"env",
|
|
20886
|
-
"exec",
|
|
20887
|
-
"fetch",
|
|
20888
|
-
"global",
|
|
20889
|
-
"help",
|
|
20890
|
-
"i",
|
|
20891
|
-
"import",
|
|
20892
|
-
"info",
|
|
20893
|
-
"init",
|
|
20894
|
-
"install",
|
|
20895
|
-
"licenses",
|
|
20896
|
-
"link",
|
|
20897
|
-
"list",
|
|
20898
|
-
"login",
|
|
20899
|
-
"logout",
|
|
20900
|
-
"ls",
|
|
20901
|
-
"node",
|
|
20902
|
-
"npm",
|
|
20903
|
-
"outdated",
|
|
20904
|
-
"pack",
|
|
20905
|
-
"patch",
|
|
20906
|
-
"patch-commit",
|
|
20907
|
-
"prune",
|
|
20908
|
-
"publish",
|
|
20909
|
-
"rebuild",
|
|
20910
|
-
"remove",
|
|
20911
|
-
"rm",
|
|
20912
|
-
"root",
|
|
20913
|
-
"run",
|
|
20914
|
-
"self-update",
|
|
20915
|
-
"set",
|
|
20916
|
-
"setup",
|
|
20917
|
-
"store",
|
|
20918
|
-
"team",
|
|
20919
|
-
"un",
|
|
20920
|
-
"uninstall",
|
|
20921
|
-
"unlink",
|
|
20922
|
-
"up",
|
|
20923
|
-
"update",
|
|
20924
|
-
"upgrade",
|
|
20925
|
-
"version",
|
|
20926
|
-
"whoami",
|
|
20927
|
-
"why",
|
|
20928
|
-
"workspace",
|
|
20929
|
-
"workspaces",
|
|
20930
|
-
"x"
|
|
20931
|
-
]);
|
|
20932
|
-
PM_MANAGER_BUILTINS = {
|
|
20933
|
-
bun: /* @__PURE__ */ new Set(["test"])
|
|
20934
|
-
};
|
|
20935
|
-
PKG_DEPENDENT_TOOL_PATTERN = /^(vitest|jest|pytest|mocha|eslint|prettier|tsc)\b/;
|
|
20936
|
-
BIN_TO_PACKAGE = {
|
|
20937
|
-
tsc: "typescript"
|
|
20938
|
-
};
|
|
20939
|
-
PKG_SHORTHAND_PATTERN = /^(npm|pnpm|yarn|bun)\s+(test|start|build|dev|lint|format|check|typecheck|clean|serve|preview|e2e)\b/;
|
|
20940
|
-
}
|
|
20941
|
-
});
|
|
20942
|
-
|
|
20943
|
-
// src/core/checks/staleness.ts
|
|
20944
|
-
import * as path6 from "node:path";
|
|
20945
|
-
async function checkStaleness(file2, projectRoot) {
|
|
20946
|
-
const issues = [];
|
|
20947
|
-
if (!await isGitRepo(projectRoot)) {
|
|
20948
|
-
return issues;
|
|
20949
|
-
}
|
|
20950
|
-
const relativePath = path6.relative(projectRoot, file2.filePath).replace(/\\/g, "/");
|
|
20951
|
-
const lastModified = await getFileLastModified(projectRoot, relativePath);
|
|
20952
|
-
if (!lastModified || isNaN(lastModified.getTime())) {
|
|
20953
|
-
return issues;
|
|
20954
|
-
}
|
|
20955
|
-
const daysSinceUpdate = Math.floor((Date.now() - lastModified.getTime()) / (1e3 * 60 * 60 * 24));
|
|
20956
|
-
if (daysSinceUpdate < INFO_DAYS) {
|
|
20957
|
-
return issues;
|
|
20958
|
-
}
|
|
20959
|
-
const referencedPaths = /* @__PURE__ */ new Set();
|
|
20960
|
-
const globByPrefix = /* @__PURE__ */ new Map();
|
|
20961
|
-
for (const ref of file2.references.paths) {
|
|
20962
|
-
const normalized = ref.value.replace(/\\/g, "/");
|
|
20963
|
-
if (normalized.includes("*")) {
|
|
20964
|
-
const staticSegments = [];
|
|
20965
|
-
for (const segment of normalized.split("/")) {
|
|
20966
|
-
if (segment === ".") continue;
|
|
20967
|
-
if (segment.includes("*")) break;
|
|
20968
|
-
staticSegments.push(segment);
|
|
20759
|
+
function scanString() {
|
|
20760
|
+
let result = "", start = pos;
|
|
20761
|
+
while (true) {
|
|
20762
|
+
if (pos >= len) {
|
|
20763
|
+
result += text.substring(start, pos);
|
|
20764
|
+
scanError = 2;
|
|
20765
|
+
break;
|
|
20969
20766
|
}
|
|
20970
|
-
const
|
|
20971
|
-
if (
|
|
20972
|
-
|
|
20973
|
-
|
|
20974
|
-
|
|
20767
|
+
const ch = text.charCodeAt(pos);
|
|
20768
|
+
if (ch === 34) {
|
|
20769
|
+
result += text.substring(start, pos);
|
|
20770
|
+
pos++;
|
|
20771
|
+
break;
|
|
20975
20772
|
}
|
|
20976
|
-
|
|
20773
|
+
if (ch === 92) {
|
|
20774
|
+
result += text.substring(start, pos);
|
|
20775
|
+
pos++;
|
|
20776
|
+
if (pos >= len) {
|
|
20777
|
+
scanError = 2;
|
|
20778
|
+
break;
|
|
20779
|
+
}
|
|
20780
|
+
const ch2 = text.charCodeAt(pos++);
|
|
20781
|
+
switch (ch2) {
|
|
20782
|
+
case 34:
|
|
20783
|
+
result += '"';
|
|
20784
|
+
break;
|
|
20785
|
+
case 92:
|
|
20786
|
+
result += "\\";
|
|
20787
|
+
break;
|
|
20788
|
+
case 47:
|
|
20789
|
+
result += "/";
|
|
20790
|
+
break;
|
|
20791
|
+
case 98:
|
|
20792
|
+
result += "\b";
|
|
20793
|
+
break;
|
|
20794
|
+
case 102:
|
|
20795
|
+
result += "\f";
|
|
20796
|
+
break;
|
|
20797
|
+
case 110:
|
|
20798
|
+
result += "\n";
|
|
20799
|
+
break;
|
|
20800
|
+
case 114:
|
|
20801
|
+
result += "\r";
|
|
20802
|
+
break;
|
|
20803
|
+
case 116:
|
|
20804
|
+
result += " ";
|
|
20805
|
+
break;
|
|
20806
|
+
case 117:
|
|
20807
|
+
const ch3 = scanHexDigits(4, true);
|
|
20808
|
+
if (ch3 >= 0) {
|
|
20809
|
+
result += String.fromCharCode(ch3);
|
|
20810
|
+
} else {
|
|
20811
|
+
scanError = 4;
|
|
20812
|
+
}
|
|
20813
|
+
break;
|
|
20814
|
+
default:
|
|
20815
|
+
scanError = 5;
|
|
20816
|
+
}
|
|
20817
|
+
start = pos;
|
|
20818
|
+
continue;
|
|
20819
|
+
}
|
|
20820
|
+
if (ch >= 0 && ch <= 31) {
|
|
20821
|
+
if (isLineBreak(ch)) {
|
|
20822
|
+
result += text.substring(start, pos);
|
|
20823
|
+
scanError = 2;
|
|
20824
|
+
break;
|
|
20825
|
+
} else {
|
|
20826
|
+
scanError = 6;
|
|
20827
|
+
}
|
|
20828
|
+
}
|
|
20829
|
+
pos++;
|
|
20977
20830
|
}
|
|
20978
|
-
|
|
20979
|
-
}
|
|
20980
|
-
if (referencedPaths.size === 0) {
|
|
20981
|
-
return issues;
|
|
20831
|
+
return result;
|
|
20982
20832
|
}
|
|
20983
|
-
|
|
20984
|
-
|
|
20985
|
-
|
|
20986
|
-
|
|
20987
|
-
|
|
20988
|
-
|
|
20989
|
-
if (
|
|
20990
|
-
|
|
20991
|
-
|
|
20992
|
-
}
|
|
20993
|
-
}
|
|
20994
|
-
if (totalCommits === 0) {
|
|
20995
|
-
return issues;
|
|
20996
|
-
}
|
|
20997
|
-
const isStale = daysSinceUpdate >= WARNING_DAYS;
|
|
20998
|
-
const severity = isStale ? "warning" : "info";
|
|
20999
|
-
const mostActiveLabel = globByPrefix.get(mostActiveRef) ?? mostActiveRef;
|
|
21000
|
-
issues.push({
|
|
21001
|
-
severity,
|
|
21002
|
-
check: "staleness",
|
|
21003
|
-
ruleId: isStale ? "staleness/stale" : "staleness/aging",
|
|
21004
|
-
line: 1,
|
|
21005
|
-
message: `Last updated ${daysSinceUpdate} days ago. ${mostActiveLabel} has ${mostActiveCommits} commits since.`,
|
|
21006
|
-
suggestion: "Review and update this context file to reflect recent changes.",
|
|
21007
|
-
detail: `${totalCommits} total commits to referenced paths since last update.`
|
|
21008
|
-
});
|
|
21009
|
-
return issues;
|
|
21010
|
-
}
|
|
21011
|
-
var WARNING_DAYS, INFO_DAYS;
|
|
21012
|
-
var init_staleness = __esm({
|
|
21013
|
-
"src/core/checks/staleness.ts"() {
|
|
21014
|
-
"use strict";
|
|
21015
|
-
init_define_WEB_FIRST_SEGMENTS();
|
|
21016
|
-
init_git();
|
|
21017
|
-
WARNING_DAYS = 30;
|
|
21018
|
-
INFO_DAYS = 14;
|
|
21019
|
-
}
|
|
21020
|
-
});
|
|
21021
|
-
|
|
21022
|
-
// src/core/checks/tokens.ts
|
|
21023
|
-
function resolveTokenThresholds(overrides) {
|
|
21024
|
-
if (!overrides) return DEFAULT_TOKEN_THRESHOLDS;
|
|
21025
|
-
const merged = { ...DEFAULT_TOKEN_THRESHOLDS, ...overrides };
|
|
21026
|
-
if (merged.info >= merged.warning || merged.warning >= merged.error) {
|
|
21027
|
-
console.error(
|
|
21028
|
-
`Warning: token thresholds should satisfy info < warning < error (got ${merged.info}, ${merged.warning}, ${merged.error}) \u2014 using defaults`
|
|
21029
|
-
);
|
|
21030
|
-
return DEFAULT_TOKEN_THRESHOLDS;
|
|
21031
|
-
}
|
|
21032
|
-
return merged;
|
|
21033
|
-
}
|
|
21034
|
-
async function checkTokens(file2, _projectRoot, thresholds = DEFAULT_TOKEN_THRESHOLDS) {
|
|
21035
|
-
const issues = [];
|
|
21036
|
-
const tokens = file2.totalTokens;
|
|
21037
|
-
if (tokens >= thresholds.error) {
|
|
21038
|
-
issues.push({
|
|
21039
|
-
severity: "error",
|
|
21040
|
-
check: "tokens",
|
|
21041
|
-
ruleId: "tokens/excessive",
|
|
21042
|
-
line: 1,
|
|
21043
|
-
message: `${tokens.toLocaleString()} tokens \u2014 consumes significant context window space`,
|
|
21044
|
-
suggestion: "Consider splitting into focused sections or removing redundant content."
|
|
21045
|
-
});
|
|
21046
|
-
} else if (tokens >= thresholds.warning) {
|
|
21047
|
-
issues.push({
|
|
21048
|
-
severity: "warning",
|
|
21049
|
-
check: "tokens",
|
|
21050
|
-
ruleId: "tokens/large",
|
|
21051
|
-
line: 1,
|
|
21052
|
-
message: `${tokens.toLocaleString()} tokens \u2014 large context file`,
|
|
21053
|
-
suggestion: "Consider trimming \u2014 research shows diminishing returns past ~300 lines."
|
|
21054
|
-
});
|
|
21055
|
-
} else if (tokens >= thresholds.info) {
|
|
21056
|
-
issues.push({
|
|
21057
|
-
severity: "info",
|
|
21058
|
-
check: "tokens",
|
|
21059
|
-
ruleId: "tokens/info",
|
|
21060
|
-
line: 1,
|
|
21061
|
-
message: `Uses ~${tokens.toLocaleString()} tokens per session`
|
|
21062
|
-
});
|
|
21063
|
-
}
|
|
21064
|
-
return issues;
|
|
21065
|
-
}
|
|
21066
|
-
function checkAggregateTokens(files, thresholds = DEFAULT_TOKEN_THRESHOLDS) {
|
|
21067
|
-
const total = files.reduce((sum, f) => sum + f.tokens, 0);
|
|
21068
|
-
if (total >= thresholds.aggregate && files.length > 1) {
|
|
21069
|
-
return {
|
|
21070
|
-
severity: "warning",
|
|
21071
|
-
check: "tokens",
|
|
21072
|
-
ruleId: "tokens/aggregate",
|
|
21073
|
-
line: 0,
|
|
21074
|
-
message: `${files.length} context files consume ${total.toLocaleString()} tokens combined`,
|
|
21075
|
-
suggestion: "Consider consolidating or trimming to reduce per-session context cost."
|
|
21076
|
-
};
|
|
21077
|
-
}
|
|
21078
|
-
return null;
|
|
21079
|
-
}
|
|
21080
|
-
var DEFAULT_TOKEN_THRESHOLDS;
|
|
21081
|
-
var init_tokens2 = __esm({
|
|
21082
|
-
"src/core/checks/tokens.ts"() {
|
|
21083
|
-
"use strict";
|
|
21084
|
-
init_define_WEB_FIRST_SEGMENTS();
|
|
21085
|
-
DEFAULT_TOKEN_THRESHOLDS = {
|
|
21086
|
-
info: 1e3,
|
|
21087
|
-
warning: 3e3,
|
|
21088
|
-
error: 8e3,
|
|
21089
|
-
aggregate: 5e3,
|
|
21090
|
-
tierBreakdown: 1e3,
|
|
21091
|
-
tierAggregate: 4e3
|
|
21092
|
-
};
|
|
21093
|
-
}
|
|
21094
|
-
});
|
|
21095
|
-
|
|
21096
|
-
// node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/scanner.js
|
|
21097
|
-
function createScanner(text, ignoreTrivia = false) {
|
|
21098
|
-
const len = text.length;
|
|
21099
|
-
let pos = 0, value = "", tokenOffset = 0, token = 16, lineNumber = 0, lineStartOffset = 0, tokenLineStartOffset = 0, prevTokenLineStartOffset = 0, scanError = 0;
|
|
21100
|
-
function scanHexDigits(count, exact) {
|
|
21101
|
-
let digits = 0;
|
|
21102
|
-
let value2 = 0;
|
|
21103
|
-
while (digits < count || !exact) {
|
|
21104
|
-
let ch = text.charCodeAt(pos);
|
|
21105
|
-
if (ch >= 48 && ch <= 57) {
|
|
21106
|
-
value2 = value2 * 16 + ch - 48;
|
|
21107
|
-
} else if (ch >= 65 && ch <= 70) {
|
|
21108
|
-
value2 = value2 * 16 + ch - 65 + 10;
|
|
21109
|
-
} else if (ch >= 97 && ch <= 102) {
|
|
21110
|
-
value2 = value2 * 16 + ch - 97 + 10;
|
|
21111
|
-
} else {
|
|
21112
|
-
break;
|
|
21113
|
-
}
|
|
21114
|
-
pos++;
|
|
21115
|
-
digits++;
|
|
21116
|
-
}
|
|
21117
|
-
if (digits < count) {
|
|
21118
|
-
value2 = -1;
|
|
21119
|
-
}
|
|
21120
|
-
return value2;
|
|
21121
|
-
}
|
|
21122
|
-
function setPosition(newPosition) {
|
|
21123
|
-
pos = newPosition;
|
|
21124
|
-
value = "";
|
|
21125
|
-
tokenOffset = 0;
|
|
21126
|
-
token = 16;
|
|
21127
|
-
scanError = 0;
|
|
21128
|
-
}
|
|
21129
|
-
function scanNumber() {
|
|
21130
|
-
let start = pos;
|
|
21131
|
-
if (text.charCodeAt(pos) === 48) {
|
|
21132
|
-
pos++;
|
|
21133
|
-
} else {
|
|
21134
|
-
pos++;
|
|
21135
|
-
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
21136
|
-
pos++;
|
|
21137
|
-
}
|
|
21138
|
-
}
|
|
21139
|
-
if (pos < text.length && text.charCodeAt(pos) === 46) {
|
|
21140
|
-
pos++;
|
|
21141
|
-
if (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
21142
|
-
pos++;
|
|
21143
|
-
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
21144
|
-
pos++;
|
|
21145
|
-
}
|
|
21146
|
-
} else {
|
|
21147
|
-
scanError = 3;
|
|
21148
|
-
return text.substring(start, pos);
|
|
21149
|
-
}
|
|
21150
|
-
}
|
|
21151
|
-
let end = pos;
|
|
21152
|
-
if (pos < text.length && (text.charCodeAt(pos) === 69 || text.charCodeAt(pos) === 101)) {
|
|
21153
|
-
pos++;
|
|
21154
|
-
if (pos < text.length && text.charCodeAt(pos) === 43 || text.charCodeAt(pos) === 45) {
|
|
21155
|
-
pos++;
|
|
21156
|
-
}
|
|
21157
|
-
if (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
21158
|
-
pos++;
|
|
21159
|
-
while (pos < text.length && isDigit(text.charCodeAt(pos))) {
|
|
21160
|
-
pos++;
|
|
21161
|
-
}
|
|
21162
|
-
end = pos;
|
|
21163
|
-
} else {
|
|
21164
|
-
scanError = 3;
|
|
21165
|
-
}
|
|
21166
|
-
}
|
|
21167
|
-
return text.substring(start, end);
|
|
21168
|
-
}
|
|
21169
|
-
function scanString() {
|
|
21170
|
-
let result = "", start = pos;
|
|
21171
|
-
while (true) {
|
|
21172
|
-
if (pos >= len) {
|
|
21173
|
-
result += text.substring(start, pos);
|
|
21174
|
-
scanError = 2;
|
|
21175
|
-
break;
|
|
21176
|
-
}
|
|
21177
|
-
const ch = text.charCodeAt(pos);
|
|
21178
|
-
if (ch === 34) {
|
|
21179
|
-
result += text.substring(start, pos);
|
|
21180
|
-
pos++;
|
|
21181
|
-
break;
|
|
21182
|
-
}
|
|
21183
|
-
if (ch === 92) {
|
|
21184
|
-
result += text.substring(start, pos);
|
|
21185
|
-
pos++;
|
|
21186
|
-
if (pos >= len) {
|
|
21187
|
-
scanError = 2;
|
|
21188
|
-
break;
|
|
21189
|
-
}
|
|
21190
|
-
const ch2 = text.charCodeAt(pos++);
|
|
21191
|
-
switch (ch2) {
|
|
21192
|
-
case 34:
|
|
21193
|
-
result += '"';
|
|
21194
|
-
break;
|
|
21195
|
-
case 92:
|
|
21196
|
-
result += "\\";
|
|
21197
|
-
break;
|
|
21198
|
-
case 47:
|
|
21199
|
-
result += "/";
|
|
21200
|
-
break;
|
|
21201
|
-
case 98:
|
|
21202
|
-
result += "\b";
|
|
21203
|
-
break;
|
|
21204
|
-
case 102:
|
|
21205
|
-
result += "\f";
|
|
21206
|
-
break;
|
|
21207
|
-
case 110:
|
|
21208
|
-
result += "\n";
|
|
21209
|
-
break;
|
|
21210
|
-
case 114:
|
|
21211
|
-
result += "\r";
|
|
21212
|
-
break;
|
|
21213
|
-
case 116:
|
|
21214
|
-
result += " ";
|
|
21215
|
-
break;
|
|
21216
|
-
case 117:
|
|
21217
|
-
const ch3 = scanHexDigits(4, true);
|
|
21218
|
-
if (ch3 >= 0) {
|
|
21219
|
-
result += String.fromCharCode(ch3);
|
|
21220
|
-
} else {
|
|
21221
|
-
scanError = 4;
|
|
21222
|
-
}
|
|
21223
|
-
break;
|
|
21224
|
-
default:
|
|
21225
|
-
scanError = 5;
|
|
21226
|
-
}
|
|
21227
|
-
start = pos;
|
|
21228
|
-
continue;
|
|
21229
|
-
}
|
|
21230
|
-
if (ch >= 0 && ch <= 31) {
|
|
21231
|
-
if (isLineBreak(ch)) {
|
|
21232
|
-
result += text.substring(start, pos);
|
|
21233
|
-
scanError = 2;
|
|
21234
|
-
break;
|
|
21235
|
-
} else {
|
|
21236
|
-
scanError = 6;
|
|
21237
|
-
}
|
|
21238
|
-
}
|
|
21239
|
-
pos++;
|
|
21240
|
-
}
|
|
21241
|
-
return result;
|
|
21242
|
-
}
|
|
21243
|
-
function scanNext() {
|
|
21244
|
-
value = "";
|
|
21245
|
-
scanError = 0;
|
|
21246
|
-
tokenOffset = pos;
|
|
21247
|
-
lineStartOffset = lineNumber;
|
|
21248
|
-
prevTokenLineStartOffset = tokenLineStartOffset;
|
|
21249
|
-
if (pos >= len) {
|
|
21250
|
-
tokenOffset = len;
|
|
21251
|
-
return token = 17;
|
|
20833
|
+
function scanNext() {
|
|
20834
|
+
value = "";
|
|
20835
|
+
scanError = 0;
|
|
20836
|
+
tokenOffset = pos;
|
|
20837
|
+
lineStartOffset = lineNumber;
|
|
20838
|
+
prevTokenLineStartOffset = tokenLineStartOffset;
|
|
20839
|
+
if (pos >= len) {
|
|
20840
|
+
tokenOffset = len;
|
|
20841
|
+
return token = 17;
|
|
21252
20842
|
}
|
|
21253
20843
|
let code = text.charCodeAt(pos);
|
|
21254
20844
|
if (isWhiteSpace(code)) {
|
|
@@ -21552,621 +21142,1065 @@ var init_string_intern = __esm({
|
|
|
21552
21142
|
return "\r\n" + " ".repeat(index);
|
|
21553
21143
|
})
|
|
21554
21144
|
}
|
|
21555
|
-
};
|
|
21556
|
-
}
|
|
21557
|
-
});
|
|
21558
|
-
|
|
21559
|
-
// node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/format.js
|
|
21560
|
-
var init_format = __esm({
|
|
21561
|
-
"node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/format.js"() {
|
|
21562
|
-
"use strict";
|
|
21563
|
-
init_define_WEB_FIRST_SEGMENTS();
|
|
21564
|
-
init_scanner2();
|
|
21565
|
-
init_string_intern();
|
|
21145
|
+
};
|
|
21146
|
+
}
|
|
21147
|
+
});
|
|
21148
|
+
|
|
21149
|
+
// node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/format.js
|
|
21150
|
+
var init_format = __esm({
|
|
21151
|
+
"node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/format.js"() {
|
|
21152
|
+
"use strict";
|
|
21153
|
+
init_define_WEB_FIRST_SEGMENTS();
|
|
21154
|
+
init_scanner2();
|
|
21155
|
+
init_string_intern();
|
|
21156
|
+
}
|
|
21157
|
+
});
|
|
21158
|
+
|
|
21159
|
+
// node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/parser.js
|
|
21160
|
+
function parse(text, errors = [], options = ParseOptions.DEFAULT) {
|
|
21161
|
+
let currentProperty = null;
|
|
21162
|
+
let currentParent = [];
|
|
21163
|
+
const previousParents = [];
|
|
21164
|
+
function onValue(value) {
|
|
21165
|
+
if (Array.isArray(currentParent)) {
|
|
21166
|
+
currentParent.push(value);
|
|
21167
|
+
} else if (currentProperty !== null) {
|
|
21168
|
+
currentParent[currentProperty] = value;
|
|
21169
|
+
}
|
|
21170
|
+
}
|
|
21171
|
+
const visitor = {
|
|
21172
|
+
onObjectBegin: () => {
|
|
21173
|
+
const object3 = {};
|
|
21174
|
+
onValue(object3);
|
|
21175
|
+
previousParents.push(currentParent);
|
|
21176
|
+
currentParent = object3;
|
|
21177
|
+
currentProperty = null;
|
|
21178
|
+
},
|
|
21179
|
+
onObjectProperty: (name) => {
|
|
21180
|
+
currentProperty = name;
|
|
21181
|
+
},
|
|
21182
|
+
onObjectEnd: () => {
|
|
21183
|
+
currentParent = previousParents.pop();
|
|
21184
|
+
},
|
|
21185
|
+
onArrayBegin: () => {
|
|
21186
|
+
const array2 = [];
|
|
21187
|
+
onValue(array2);
|
|
21188
|
+
previousParents.push(currentParent);
|
|
21189
|
+
currentParent = array2;
|
|
21190
|
+
currentProperty = null;
|
|
21191
|
+
},
|
|
21192
|
+
onArrayEnd: () => {
|
|
21193
|
+
currentParent = previousParents.pop();
|
|
21194
|
+
},
|
|
21195
|
+
onLiteralValue: onValue,
|
|
21196
|
+
onError: (error52, offset, length) => {
|
|
21197
|
+
errors.push({ error: error52, offset, length });
|
|
21198
|
+
}
|
|
21199
|
+
};
|
|
21200
|
+
visit(text, visitor, options);
|
|
21201
|
+
return currentParent[0];
|
|
21202
|
+
}
|
|
21203
|
+
function parseTree(text, errors = [], options = ParseOptions.DEFAULT) {
|
|
21204
|
+
let currentParent = { type: "array", offset: -1, length: -1, children: [], parent: void 0 };
|
|
21205
|
+
function ensurePropertyComplete(endOffset) {
|
|
21206
|
+
if (currentParent.type === "property") {
|
|
21207
|
+
currentParent.length = endOffset - currentParent.offset;
|
|
21208
|
+
currentParent = currentParent.parent;
|
|
21209
|
+
}
|
|
21210
|
+
}
|
|
21211
|
+
function onValue(valueNode) {
|
|
21212
|
+
currentParent.children.push(valueNode);
|
|
21213
|
+
return valueNode;
|
|
21214
|
+
}
|
|
21215
|
+
const visitor = {
|
|
21216
|
+
onObjectBegin: (offset) => {
|
|
21217
|
+
currentParent = onValue({ type: "object", offset, length: -1, parent: currentParent, children: [] });
|
|
21218
|
+
},
|
|
21219
|
+
onObjectProperty: (name, offset, length) => {
|
|
21220
|
+
currentParent = onValue({ type: "property", offset, length: -1, parent: currentParent, children: [] });
|
|
21221
|
+
currentParent.children.push({ type: "string", value: name, offset, length, parent: currentParent });
|
|
21222
|
+
},
|
|
21223
|
+
onObjectEnd: (offset, length) => {
|
|
21224
|
+
ensurePropertyComplete(offset + length);
|
|
21225
|
+
currentParent.length = offset + length - currentParent.offset;
|
|
21226
|
+
currentParent = currentParent.parent;
|
|
21227
|
+
ensurePropertyComplete(offset + length);
|
|
21228
|
+
},
|
|
21229
|
+
onArrayBegin: (offset, length) => {
|
|
21230
|
+
currentParent = onValue({ type: "array", offset, length: -1, parent: currentParent, children: [] });
|
|
21231
|
+
},
|
|
21232
|
+
onArrayEnd: (offset, length) => {
|
|
21233
|
+
currentParent.length = offset + length - currentParent.offset;
|
|
21234
|
+
currentParent = currentParent.parent;
|
|
21235
|
+
ensurePropertyComplete(offset + length);
|
|
21236
|
+
},
|
|
21237
|
+
onLiteralValue: (value, offset, length) => {
|
|
21238
|
+
onValue({ type: getNodeType(value), offset, length, parent: currentParent, value });
|
|
21239
|
+
ensurePropertyComplete(offset + length);
|
|
21240
|
+
},
|
|
21241
|
+
onSeparator: (sep2, offset, length) => {
|
|
21242
|
+
if (currentParent.type === "property") {
|
|
21243
|
+
if (sep2 === ":") {
|
|
21244
|
+
currentParent.colonOffset = offset;
|
|
21245
|
+
} else if (sep2 === ",") {
|
|
21246
|
+
ensurePropertyComplete(offset);
|
|
21247
|
+
}
|
|
21248
|
+
}
|
|
21249
|
+
},
|
|
21250
|
+
onError: (error52, offset, length) => {
|
|
21251
|
+
errors.push({ error: error52, offset, length });
|
|
21252
|
+
}
|
|
21253
|
+
};
|
|
21254
|
+
visit(text, visitor, options);
|
|
21255
|
+
const result = currentParent.children[0];
|
|
21256
|
+
if (result) {
|
|
21257
|
+
delete result.parent;
|
|
21258
|
+
}
|
|
21259
|
+
return result;
|
|
21260
|
+
}
|
|
21261
|
+
function findNodeAtLocation(root, path20) {
|
|
21262
|
+
if (!root) {
|
|
21263
|
+
return void 0;
|
|
21264
|
+
}
|
|
21265
|
+
let node = root;
|
|
21266
|
+
for (let segment of path20) {
|
|
21267
|
+
if (typeof segment === "string") {
|
|
21268
|
+
if (node.type !== "object" || !Array.isArray(node.children)) {
|
|
21269
|
+
return void 0;
|
|
21270
|
+
}
|
|
21271
|
+
let found = false;
|
|
21272
|
+
for (const propertyNode of node.children) {
|
|
21273
|
+
if (Array.isArray(propertyNode.children) && propertyNode.children[0].value === segment && propertyNode.children.length === 2) {
|
|
21274
|
+
node = propertyNode.children[1];
|
|
21275
|
+
found = true;
|
|
21276
|
+
break;
|
|
21277
|
+
}
|
|
21278
|
+
}
|
|
21279
|
+
if (!found) {
|
|
21280
|
+
return void 0;
|
|
21281
|
+
}
|
|
21282
|
+
} else {
|
|
21283
|
+
const index = segment;
|
|
21284
|
+
if (node.type !== "array" || index < 0 || !Array.isArray(node.children) || index >= node.children.length) {
|
|
21285
|
+
return void 0;
|
|
21286
|
+
}
|
|
21287
|
+
node = node.children[index];
|
|
21288
|
+
}
|
|
21289
|
+
}
|
|
21290
|
+
return node;
|
|
21291
|
+
}
|
|
21292
|
+
function getNodeValue(node) {
|
|
21293
|
+
switch (node.type) {
|
|
21294
|
+
case "array":
|
|
21295
|
+
return node.children.map(getNodeValue);
|
|
21296
|
+
case "object":
|
|
21297
|
+
const obj = /* @__PURE__ */ Object.create(null);
|
|
21298
|
+
for (let prop of node.children) {
|
|
21299
|
+
const valueNode = prop.children[1];
|
|
21300
|
+
if (valueNode) {
|
|
21301
|
+
obj[prop.children[0].value] = getNodeValue(valueNode);
|
|
21302
|
+
}
|
|
21303
|
+
}
|
|
21304
|
+
return obj;
|
|
21305
|
+
case "null":
|
|
21306
|
+
case "string":
|
|
21307
|
+
case "number":
|
|
21308
|
+
case "boolean":
|
|
21309
|
+
return node.value;
|
|
21310
|
+
default:
|
|
21311
|
+
return void 0;
|
|
21312
|
+
}
|
|
21313
|
+
}
|
|
21314
|
+
function visit(text, visitor, options = ParseOptions.DEFAULT) {
|
|
21315
|
+
const _scanner = createScanner(text, false);
|
|
21316
|
+
const _jsonPath = [];
|
|
21317
|
+
let suppressedCallbacks = 0;
|
|
21318
|
+
function toNoArgVisit(visitFunction) {
|
|
21319
|
+
return visitFunction ? () => suppressedCallbacks === 0 && visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;
|
|
21320
|
+
}
|
|
21321
|
+
function toOneArgVisit(visitFunction) {
|
|
21322
|
+
return visitFunction ? (arg) => suppressedCallbacks === 0 && visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;
|
|
21323
|
+
}
|
|
21324
|
+
function toOneArgVisitWithPath(visitFunction) {
|
|
21325
|
+
return visitFunction ? (arg) => suppressedCallbacks === 0 && visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice()) : () => true;
|
|
21326
|
+
}
|
|
21327
|
+
function toBeginVisit(visitFunction) {
|
|
21328
|
+
return visitFunction ? () => {
|
|
21329
|
+
if (suppressedCallbacks > 0) {
|
|
21330
|
+
suppressedCallbacks++;
|
|
21331
|
+
} else {
|
|
21332
|
+
let cbReturn = visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice());
|
|
21333
|
+
if (cbReturn === false) {
|
|
21334
|
+
suppressedCallbacks = 1;
|
|
21335
|
+
}
|
|
21336
|
+
}
|
|
21337
|
+
} : () => true;
|
|
21338
|
+
}
|
|
21339
|
+
function toEndVisit(visitFunction) {
|
|
21340
|
+
return visitFunction ? () => {
|
|
21341
|
+
if (suppressedCallbacks > 0) {
|
|
21342
|
+
suppressedCallbacks--;
|
|
21343
|
+
}
|
|
21344
|
+
if (suppressedCallbacks === 0) {
|
|
21345
|
+
visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter());
|
|
21346
|
+
}
|
|
21347
|
+
} : () => true;
|
|
21348
|
+
}
|
|
21349
|
+
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);
|
|
21350
|
+
const disallowComments = options && options.disallowComments;
|
|
21351
|
+
const allowTrailingComma = options && options.allowTrailingComma;
|
|
21352
|
+
function scanNext() {
|
|
21353
|
+
while (true) {
|
|
21354
|
+
const token = _scanner.scan();
|
|
21355
|
+
switch (_scanner.getTokenError()) {
|
|
21356
|
+
case 4:
|
|
21357
|
+
handleError(
|
|
21358
|
+
14
|
|
21359
|
+
/* ParseErrorCode.InvalidUnicode */
|
|
21360
|
+
);
|
|
21361
|
+
break;
|
|
21362
|
+
case 5:
|
|
21363
|
+
handleError(
|
|
21364
|
+
15
|
|
21365
|
+
/* ParseErrorCode.InvalidEscapeCharacter */
|
|
21366
|
+
);
|
|
21367
|
+
break;
|
|
21368
|
+
case 3:
|
|
21369
|
+
handleError(
|
|
21370
|
+
13
|
|
21371
|
+
/* ParseErrorCode.UnexpectedEndOfNumber */
|
|
21372
|
+
);
|
|
21373
|
+
break;
|
|
21374
|
+
case 1:
|
|
21375
|
+
if (!disallowComments) {
|
|
21376
|
+
handleError(
|
|
21377
|
+
11
|
|
21378
|
+
/* ParseErrorCode.UnexpectedEndOfComment */
|
|
21379
|
+
);
|
|
21380
|
+
}
|
|
21381
|
+
break;
|
|
21382
|
+
case 2:
|
|
21383
|
+
handleError(
|
|
21384
|
+
12
|
|
21385
|
+
/* ParseErrorCode.UnexpectedEndOfString */
|
|
21386
|
+
);
|
|
21387
|
+
break;
|
|
21388
|
+
case 6:
|
|
21389
|
+
handleError(
|
|
21390
|
+
16
|
|
21391
|
+
/* ParseErrorCode.InvalidCharacter */
|
|
21392
|
+
);
|
|
21393
|
+
break;
|
|
21394
|
+
}
|
|
21395
|
+
switch (token) {
|
|
21396
|
+
case 12:
|
|
21397
|
+
case 13:
|
|
21398
|
+
if (disallowComments) {
|
|
21399
|
+
handleError(
|
|
21400
|
+
10
|
|
21401
|
+
/* ParseErrorCode.InvalidCommentToken */
|
|
21402
|
+
);
|
|
21403
|
+
} else {
|
|
21404
|
+
onComment();
|
|
21405
|
+
}
|
|
21406
|
+
break;
|
|
21407
|
+
case 16:
|
|
21408
|
+
handleError(
|
|
21409
|
+
1
|
|
21410
|
+
/* ParseErrorCode.InvalidSymbol */
|
|
21411
|
+
);
|
|
21412
|
+
break;
|
|
21413
|
+
case 15:
|
|
21414
|
+
case 14:
|
|
21415
|
+
break;
|
|
21416
|
+
default:
|
|
21417
|
+
return token;
|
|
21418
|
+
}
|
|
21419
|
+
}
|
|
21566
21420
|
}
|
|
21567
|
-
|
|
21568
|
-
|
|
21569
|
-
|
|
21570
|
-
|
|
21571
|
-
|
|
21572
|
-
|
|
21573
|
-
|
|
21574
|
-
|
|
21575
|
-
|
|
21576
|
-
|
|
21577
|
-
|
|
21578
|
-
|
|
21421
|
+
function handleError(error52, skipUntilAfter = [], skipUntil = []) {
|
|
21422
|
+
onError2(error52);
|
|
21423
|
+
if (skipUntilAfter.length + skipUntil.length > 0) {
|
|
21424
|
+
let token = _scanner.getToken();
|
|
21425
|
+
while (token !== 17) {
|
|
21426
|
+
if (skipUntilAfter.indexOf(token) !== -1) {
|
|
21427
|
+
scanNext();
|
|
21428
|
+
break;
|
|
21429
|
+
} else if (skipUntil.indexOf(token) !== -1) {
|
|
21430
|
+
break;
|
|
21431
|
+
}
|
|
21432
|
+
token = scanNext();
|
|
21433
|
+
}
|
|
21579
21434
|
}
|
|
21580
21435
|
}
|
|
21581
|
-
|
|
21582
|
-
|
|
21583
|
-
|
|
21584
|
-
|
|
21585
|
-
|
|
21586
|
-
|
|
21587
|
-
|
|
21588
|
-
},
|
|
21589
|
-
onObjectProperty: (name) => {
|
|
21590
|
-
currentProperty = name;
|
|
21591
|
-
},
|
|
21592
|
-
onObjectEnd: () => {
|
|
21593
|
-
currentParent = previousParents.pop();
|
|
21594
|
-
},
|
|
21595
|
-
onArrayBegin: () => {
|
|
21596
|
-
const array2 = [];
|
|
21597
|
-
onValue(array2);
|
|
21598
|
-
previousParents.push(currentParent);
|
|
21599
|
-
currentParent = array2;
|
|
21600
|
-
currentProperty = null;
|
|
21601
|
-
},
|
|
21602
|
-
onArrayEnd: () => {
|
|
21603
|
-
currentParent = previousParents.pop();
|
|
21604
|
-
},
|
|
21605
|
-
onLiteralValue: onValue,
|
|
21606
|
-
onError: (error52, offset, length) => {
|
|
21607
|
-
errors.push({ error: error52, offset, length });
|
|
21436
|
+
function parseString(isValue) {
|
|
21437
|
+
const value = _scanner.getTokenValue();
|
|
21438
|
+
if (isValue) {
|
|
21439
|
+
onLiteralValue(value);
|
|
21440
|
+
} else {
|
|
21441
|
+
onObjectProperty(value);
|
|
21442
|
+
_jsonPath.push(value);
|
|
21608
21443
|
}
|
|
21609
|
-
|
|
21610
|
-
|
|
21611
|
-
|
|
21612
|
-
|
|
21613
|
-
|
|
21614
|
-
|
|
21615
|
-
|
|
21616
|
-
|
|
21617
|
-
|
|
21618
|
-
|
|
21444
|
+
scanNext();
|
|
21445
|
+
return true;
|
|
21446
|
+
}
|
|
21447
|
+
function parseLiteral() {
|
|
21448
|
+
switch (_scanner.getToken()) {
|
|
21449
|
+
case 11:
|
|
21450
|
+
const tokenValue = _scanner.getTokenValue();
|
|
21451
|
+
let value = Number(tokenValue);
|
|
21452
|
+
if (isNaN(value)) {
|
|
21453
|
+
handleError(
|
|
21454
|
+
2
|
|
21455
|
+
/* ParseErrorCode.InvalidNumberFormat */
|
|
21456
|
+
);
|
|
21457
|
+
value = 0;
|
|
21458
|
+
}
|
|
21459
|
+
onLiteralValue(value);
|
|
21460
|
+
break;
|
|
21461
|
+
case 7:
|
|
21462
|
+
onLiteralValue(null);
|
|
21463
|
+
break;
|
|
21464
|
+
case 8:
|
|
21465
|
+
onLiteralValue(true);
|
|
21466
|
+
break;
|
|
21467
|
+
case 9:
|
|
21468
|
+
onLiteralValue(false);
|
|
21469
|
+
break;
|
|
21470
|
+
default:
|
|
21471
|
+
return false;
|
|
21619
21472
|
}
|
|
21473
|
+
scanNext();
|
|
21474
|
+
return true;
|
|
21620
21475
|
}
|
|
21621
|
-
function
|
|
21622
|
-
|
|
21623
|
-
|
|
21476
|
+
function parseProperty() {
|
|
21477
|
+
if (_scanner.getToken() !== 10) {
|
|
21478
|
+
handleError(3, [], [
|
|
21479
|
+
2,
|
|
21480
|
+
5
|
|
21481
|
+
/* SyntaxKind.CommaToken */
|
|
21482
|
+
]);
|
|
21483
|
+
return false;
|
|
21484
|
+
}
|
|
21485
|
+
parseString(false);
|
|
21486
|
+
if (_scanner.getToken() === 6) {
|
|
21487
|
+
onSeparator(":");
|
|
21488
|
+
scanNext();
|
|
21489
|
+
if (!parseValue()) {
|
|
21490
|
+
handleError(4, [], [
|
|
21491
|
+
2,
|
|
21492
|
+
5
|
|
21493
|
+
/* SyntaxKind.CommaToken */
|
|
21494
|
+
]);
|
|
21495
|
+
}
|
|
21496
|
+
} else {
|
|
21497
|
+
handleError(5, [], [
|
|
21498
|
+
2,
|
|
21499
|
+
5
|
|
21500
|
+
/* SyntaxKind.CommaToken */
|
|
21501
|
+
]);
|
|
21502
|
+
}
|
|
21503
|
+
_jsonPath.pop();
|
|
21504
|
+
return true;
|
|
21624
21505
|
}
|
|
21625
|
-
|
|
21626
|
-
onObjectBegin
|
|
21627
|
-
|
|
21628
|
-
|
|
21629
|
-
|
|
21630
|
-
|
|
21631
|
-
|
|
21632
|
-
|
|
21633
|
-
|
|
21634
|
-
|
|
21635
|
-
|
|
21636
|
-
|
|
21637
|
-
|
|
21638
|
-
},
|
|
21639
|
-
onArrayBegin: (offset, length) => {
|
|
21640
|
-
currentParent = onValue({ type: "array", offset, length: -1, parent: currentParent, children: [] });
|
|
21641
|
-
},
|
|
21642
|
-
onArrayEnd: (offset, length) => {
|
|
21643
|
-
currentParent.length = offset + length - currentParent.offset;
|
|
21644
|
-
currentParent = currentParent.parent;
|
|
21645
|
-
ensurePropertyComplete(offset + length);
|
|
21646
|
-
},
|
|
21647
|
-
onLiteralValue: (value, offset, length) => {
|
|
21648
|
-
onValue({ type: getNodeType(value), offset, length, parent: currentParent, value });
|
|
21649
|
-
ensurePropertyComplete(offset + length);
|
|
21650
|
-
},
|
|
21651
|
-
onSeparator: (sep2, offset, length) => {
|
|
21652
|
-
if (currentParent.type === "property") {
|
|
21653
|
-
if (sep2 === ":") {
|
|
21654
|
-
currentParent.colonOffset = offset;
|
|
21655
|
-
} else if (sep2 === ",") {
|
|
21656
|
-
ensurePropertyComplete(offset);
|
|
21506
|
+
function parseObject() {
|
|
21507
|
+
onObjectBegin();
|
|
21508
|
+
scanNext();
|
|
21509
|
+
let needsComma = false;
|
|
21510
|
+
while (_scanner.getToken() !== 2 && _scanner.getToken() !== 17) {
|
|
21511
|
+
if (_scanner.getToken() === 5) {
|
|
21512
|
+
if (!needsComma) {
|
|
21513
|
+
handleError(4, [], []);
|
|
21514
|
+
}
|
|
21515
|
+
onSeparator(",");
|
|
21516
|
+
scanNext();
|
|
21517
|
+
if (_scanner.getToken() === 2 && allowTrailingComma) {
|
|
21518
|
+
break;
|
|
21657
21519
|
}
|
|
21520
|
+
} else if (needsComma) {
|
|
21521
|
+
handleError(6, [], []);
|
|
21658
21522
|
}
|
|
21659
|
-
|
|
21660
|
-
|
|
21661
|
-
|
|
21523
|
+
if (!parseProperty()) {
|
|
21524
|
+
handleError(4, [], [
|
|
21525
|
+
2,
|
|
21526
|
+
5
|
|
21527
|
+
/* SyntaxKind.CommaToken */
|
|
21528
|
+
]);
|
|
21529
|
+
}
|
|
21530
|
+
needsComma = true;
|
|
21662
21531
|
}
|
|
21663
|
-
|
|
21664
|
-
|
|
21665
|
-
|
|
21666
|
-
|
|
21667
|
-
|
|
21668
|
-
|
|
21669
|
-
|
|
21670
|
-
|
|
21671
|
-
|
|
21672
|
-
|
|
21673
|
-
return void 0;
|
|
21532
|
+
onObjectEnd();
|
|
21533
|
+
if (_scanner.getToken() !== 2) {
|
|
21534
|
+
handleError(7, [
|
|
21535
|
+
2
|
|
21536
|
+
/* SyntaxKind.CloseBraceToken */
|
|
21537
|
+
], []);
|
|
21538
|
+
} else {
|
|
21539
|
+
scanNext();
|
|
21540
|
+
}
|
|
21541
|
+
return true;
|
|
21674
21542
|
}
|
|
21675
|
-
|
|
21676
|
-
|
|
21677
|
-
|
|
21678
|
-
|
|
21679
|
-
|
|
21680
|
-
|
|
21681
|
-
|
|
21682
|
-
|
|
21683
|
-
|
|
21684
|
-
|
|
21685
|
-
|
|
21543
|
+
function parseArray() {
|
|
21544
|
+
onArrayBegin();
|
|
21545
|
+
scanNext();
|
|
21546
|
+
let isFirstElement = true;
|
|
21547
|
+
let needsComma = false;
|
|
21548
|
+
while (_scanner.getToken() !== 4 && _scanner.getToken() !== 17) {
|
|
21549
|
+
if (_scanner.getToken() === 5) {
|
|
21550
|
+
if (!needsComma) {
|
|
21551
|
+
handleError(4, [], []);
|
|
21552
|
+
}
|
|
21553
|
+
onSeparator(",");
|
|
21554
|
+
scanNext();
|
|
21555
|
+
if (_scanner.getToken() === 4 && allowTrailingComma) {
|
|
21686
21556
|
break;
|
|
21687
21557
|
}
|
|
21558
|
+
} else if (needsComma) {
|
|
21559
|
+
handleError(6, [], []);
|
|
21688
21560
|
}
|
|
21689
|
-
if (
|
|
21690
|
-
|
|
21561
|
+
if (isFirstElement) {
|
|
21562
|
+
_jsonPath.push(0);
|
|
21563
|
+
isFirstElement = false;
|
|
21564
|
+
} else {
|
|
21565
|
+
_jsonPath[_jsonPath.length - 1]++;
|
|
21691
21566
|
}
|
|
21692
|
-
|
|
21693
|
-
|
|
21694
|
-
|
|
21695
|
-
|
|
21567
|
+
if (!parseValue()) {
|
|
21568
|
+
handleError(4, [], [
|
|
21569
|
+
4,
|
|
21570
|
+
5
|
|
21571
|
+
/* SyntaxKind.CommaToken */
|
|
21572
|
+
]);
|
|
21696
21573
|
}
|
|
21697
|
-
|
|
21574
|
+
needsComma = true;
|
|
21575
|
+
}
|
|
21576
|
+
onArrayEnd();
|
|
21577
|
+
if (!isFirstElement) {
|
|
21578
|
+
_jsonPath.pop();
|
|
21579
|
+
}
|
|
21580
|
+
if (_scanner.getToken() !== 4) {
|
|
21581
|
+
handleError(8, [
|
|
21582
|
+
4
|
|
21583
|
+
/* SyntaxKind.CloseBracketToken */
|
|
21584
|
+
], []);
|
|
21585
|
+
} else {
|
|
21586
|
+
scanNext();
|
|
21698
21587
|
}
|
|
21588
|
+
return true;
|
|
21699
21589
|
}
|
|
21700
|
-
|
|
21701
|
-
|
|
21702
|
-
|
|
21703
|
-
|
|
21704
|
-
|
|
21705
|
-
|
|
21706
|
-
|
|
21707
|
-
|
|
21708
|
-
|
|
21709
|
-
|
|
21710
|
-
|
|
21711
|
-
obj[prop.children[0].value] = getNodeValue(valueNode);
|
|
21712
|
-
}
|
|
21713
|
-
}
|
|
21714
|
-
return obj;
|
|
21715
|
-
case "null":
|
|
21716
|
-
case "string":
|
|
21717
|
-
case "number":
|
|
21718
|
-
case "boolean":
|
|
21719
|
-
return node.value;
|
|
21720
|
-
default:
|
|
21721
|
-
return void 0;
|
|
21590
|
+
function parseValue() {
|
|
21591
|
+
switch (_scanner.getToken()) {
|
|
21592
|
+
case 3:
|
|
21593
|
+
return parseArray();
|
|
21594
|
+
case 1:
|
|
21595
|
+
return parseObject();
|
|
21596
|
+
case 10:
|
|
21597
|
+
return parseString(true);
|
|
21598
|
+
default:
|
|
21599
|
+
return parseLiteral();
|
|
21600
|
+
}
|
|
21722
21601
|
}
|
|
21723
|
-
|
|
21724
|
-
|
|
21725
|
-
|
|
21726
|
-
|
|
21727
|
-
|
|
21728
|
-
|
|
21729
|
-
return
|
|
21602
|
+
scanNext();
|
|
21603
|
+
if (_scanner.getToken() === 17) {
|
|
21604
|
+
if (options.allowEmptyContent) {
|
|
21605
|
+
return true;
|
|
21606
|
+
}
|
|
21607
|
+
handleError(4, [], []);
|
|
21608
|
+
return false;
|
|
21730
21609
|
}
|
|
21731
|
-
|
|
21732
|
-
|
|
21610
|
+
if (!parseValue()) {
|
|
21611
|
+
handleError(4, [], []);
|
|
21612
|
+
return false;
|
|
21733
21613
|
}
|
|
21734
|
-
|
|
21735
|
-
|
|
21614
|
+
if (_scanner.getToken() !== 17) {
|
|
21615
|
+
handleError(9, [], []);
|
|
21736
21616
|
}
|
|
21737
|
-
|
|
21738
|
-
|
|
21739
|
-
|
|
21740
|
-
|
|
21741
|
-
|
|
21742
|
-
|
|
21743
|
-
|
|
21744
|
-
|
|
21745
|
-
|
|
21617
|
+
return true;
|
|
21618
|
+
}
|
|
21619
|
+
function getNodeType(value) {
|
|
21620
|
+
switch (typeof value) {
|
|
21621
|
+
case "boolean":
|
|
21622
|
+
return "boolean";
|
|
21623
|
+
case "number":
|
|
21624
|
+
return "number";
|
|
21625
|
+
case "string":
|
|
21626
|
+
return "string";
|
|
21627
|
+
case "object": {
|
|
21628
|
+
if (!value) {
|
|
21629
|
+
return "null";
|
|
21630
|
+
} else if (Array.isArray(value)) {
|
|
21631
|
+
return "array";
|
|
21746
21632
|
}
|
|
21747
|
-
|
|
21633
|
+
return "object";
|
|
21634
|
+
}
|
|
21635
|
+
default:
|
|
21636
|
+
return "null";
|
|
21748
21637
|
}
|
|
21749
|
-
|
|
21750
|
-
|
|
21751
|
-
|
|
21752
|
-
|
|
21753
|
-
|
|
21754
|
-
|
|
21755
|
-
|
|
21756
|
-
|
|
21757
|
-
|
|
21638
|
+
}
|
|
21639
|
+
var ParseOptions;
|
|
21640
|
+
var init_parser2 = __esm({
|
|
21641
|
+
"node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/parser.js"() {
|
|
21642
|
+
"use strict";
|
|
21643
|
+
init_define_WEB_FIRST_SEGMENTS();
|
|
21644
|
+
init_scanner2();
|
|
21645
|
+
(function(ParseOptions2) {
|
|
21646
|
+
ParseOptions2.DEFAULT = {
|
|
21647
|
+
allowTrailingComma: false
|
|
21648
|
+
};
|
|
21649
|
+
})(ParseOptions || (ParseOptions = {}));
|
|
21758
21650
|
}
|
|
21759
|
-
|
|
21760
|
-
|
|
21761
|
-
|
|
21762
|
-
|
|
21763
|
-
|
|
21764
|
-
|
|
21765
|
-
|
|
21766
|
-
|
|
21767
|
-
|
|
21768
|
-
|
|
21769
|
-
|
|
21770
|
-
|
|
21771
|
-
|
|
21772
|
-
|
|
21773
|
-
|
|
21774
|
-
|
|
21775
|
-
|
|
21776
|
-
|
|
21777
|
-
|
|
21778
|
-
|
|
21779
|
-
|
|
21780
|
-
|
|
21781
|
-
|
|
21782
|
-
|
|
21783
|
-
|
|
21784
|
-
|
|
21785
|
-
|
|
21786
|
-
|
|
21787
|
-
|
|
21788
|
-
|
|
21789
|
-
|
|
21790
|
-
|
|
21791
|
-
|
|
21792
|
-
|
|
21793
|
-
|
|
21794
|
-
|
|
21795
|
-
|
|
21796
|
-
|
|
21797
|
-
|
|
21798
|
-
|
|
21799
|
-
|
|
21800
|
-
|
|
21801
|
-
|
|
21802
|
-
|
|
21803
|
-
|
|
21804
|
-
|
|
21805
|
-
|
|
21806
|
-
case 12:
|
|
21807
|
-
case 13:
|
|
21808
|
-
if (disallowComments) {
|
|
21809
|
-
handleError(
|
|
21810
|
-
10
|
|
21811
|
-
/* ParseErrorCode.InvalidCommentToken */
|
|
21812
|
-
);
|
|
21813
|
-
} else {
|
|
21814
|
-
onComment();
|
|
21815
|
-
}
|
|
21816
|
-
break;
|
|
21817
|
-
case 16:
|
|
21818
|
-
handleError(
|
|
21819
|
-
1
|
|
21820
|
-
/* ParseErrorCode.InvalidSymbol */
|
|
21821
|
-
);
|
|
21822
|
-
break;
|
|
21823
|
-
case 15:
|
|
21824
|
-
case 14:
|
|
21825
|
-
break;
|
|
21826
|
-
default:
|
|
21827
|
-
return token;
|
|
21828
|
-
}
|
|
21829
|
-
}
|
|
21651
|
+
});
|
|
21652
|
+
|
|
21653
|
+
// node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/edit.js
|
|
21654
|
+
var init_edit = __esm({
|
|
21655
|
+
"node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/edit.js"() {
|
|
21656
|
+
"use strict";
|
|
21657
|
+
init_define_WEB_FIRST_SEGMENTS();
|
|
21658
|
+
init_format();
|
|
21659
|
+
init_parser2();
|
|
21660
|
+
}
|
|
21661
|
+
});
|
|
21662
|
+
|
|
21663
|
+
// node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/main.js
|
|
21664
|
+
function printParseErrorCode(code) {
|
|
21665
|
+
switch (code) {
|
|
21666
|
+
case 1:
|
|
21667
|
+
return "InvalidSymbol";
|
|
21668
|
+
case 2:
|
|
21669
|
+
return "InvalidNumberFormat";
|
|
21670
|
+
case 3:
|
|
21671
|
+
return "PropertyNameExpected";
|
|
21672
|
+
case 4:
|
|
21673
|
+
return "ValueExpected";
|
|
21674
|
+
case 5:
|
|
21675
|
+
return "ColonExpected";
|
|
21676
|
+
case 6:
|
|
21677
|
+
return "CommaExpected";
|
|
21678
|
+
case 7:
|
|
21679
|
+
return "CloseBraceExpected";
|
|
21680
|
+
case 8:
|
|
21681
|
+
return "CloseBracketExpected";
|
|
21682
|
+
case 9:
|
|
21683
|
+
return "EndOfFileExpected";
|
|
21684
|
+
case 10:
|
|
21685
|
+
return "InvalidCommentToken";
|
|
21686
|
+
case 11:
|
|
21687
|
+
return "UnexpectedEndOfComment";
|
|
21688
|
+
case 12:
|
|
21689
|
+
return "UnexpectedEndOfString";
|
|
21690
|
+
case 13:
|
|
21691
|
+
return "UnexpectedEndOfNumber";
|
|
21692
|
+
case 14:
|
|
21693
|
+
return "InvalidUnicode";
|
|
21694
|
+
case 15:
|
|
21695
|
+
return "InvalidEscapeCharacter";
|
|
21696
|
+
case 16:
|
|
21697
|
+
return "InvalidCharacter";
|
|
21830
21698
|
}
|
|
21831
|
-
|
|
21832
|
-
|
|
21833
|
-
|
|
21834
|
-
|
|
21835
|
-
|
|
21836
|
-
|
|
21837
|
-
|
|
21838
|
-
|
|
21839
|
-
|
|
21840
|
-
|
|
21841
|
-
|
|
21842
|
-
|
|
21843
|
-
|
|
21844
|
-
|
|
21699
|
+
return "<unknown ParseErrorCode>";
|
|
21700
|
+
}
|
|
21701
|
+
var ScanError, SyntaxKind, parse2, parseTree2, findNodeAtLocation2, getNodeValue2, ParseErrorCode;
|
|
21702
|
+
var init_main3 = __esm({
|
|
21703
|
+
"node_modules/.pnpm/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/main.js"() {
|
|
21704
|
+
"use strict";
|
|
21705
|
+
init_define_WEB_FIRST_SEGMENTS();
|
|
21706
|
+
init_format();
|
|
21707
|
+
init_edit();
|
|
21708
|
+
init_scanner2();
|
|
21709
|
+
init_parser2();
|
|
21710
|
+
(function(ScanError2) {
|
|
21711
|
+
ScanError2[ScanError2["None"] = 0] = "None";
|
|
21712
|
+
ScanError2[ScanError2["UnexpectedEndOfComment"] = 1] = "UnexpectedEndOfComment";
|
|
21713
|
+
ScanError2[ScanError2["UnexpectedEndOfString"] = 2] = "UnexpectedEndOfString";
|
|
21714
|
+
ScanError2[ScanError2["UnexpectedEndOfNumber"] = 3] = "UnexpectedEndOfNumber";
|
|
21715
|
+
ScanError2[ScanError2["InvalidUnicode"] = 4] = "InvalidUnicode";
|
|
21716
|
+
ScanError2[ScanError2["InvalidEscapeCharacter"] = 5] = "InvalidEscapeCharacter";
|
|
21717
|
+
ScanError2[ScanError2["InvalidCharacter"] = 6] = "InvalidCharacter";
|
|
21718
|
+
})(ScanError || (ScanError = {}));
|
|
21719
|
+
(function(SyntaxKind2) {
|
|
21720
|
+
SyntaxKind2[SyntaxKind2["OpenBraceToken"] = 1] = "OpenBraceToken";
|
|
21721
|
+
SyntaxKind2[SyntaxKind2["CloseBraceToken"] = 2] = "CloseBraceToken";
|
|
21722
|
+
SyntaxKind2[SyntaxKind2["OpenBracketToken"] = 3] = "OpenBracketToken";
|
|
21723
|
+
SyntaxKind2[SyntaxKind2["CloseBracketToken"] = 4] = "CloseBracketToken";
|
|
21724
|
+
SyntaxKind2[SyntaxKind2["CommaToken"] = 5] = "CommaToken";
|
|
21725
|
+
SyntaxKind2[SyntaxKind2["ColonToken"] = 6] = "ColonToken";
|
|
21726
|
+
SyntaxKind2[SyntaxKind2["NullKeyword"] = 7] = "NullKeyword";
|
|
21727
|
+
SyntaxKind2[SyntaxKind2["TrueKeyword"] = 8] = "TrueKeyword";
|
|
21728
|
+
SyntaxKind2[SyntaxKind2["FalseKeyword"] = 9] = "FalseKeyword";
|
|
21729
|
+
SyntaxKind2[SyntaxKind2["StringLiteral"] = 10] = "StringLiteral";
|
|
21730
|
+
SyntaxKind2[SyntaxKind2["NumericLiteral"] = 11] = "NumericLiteral";
|
|
21731
|
+
SyntaxKind2[SyntaxKind2["LineCommentTrivia"] = 12] = "LineCommentTrivia";
|
|
21732
|
+
SyntaxKind2[SyntaxKind2["BlockCommentTrivia"] = 13] = "BlockCommentTrivia";
|
|
21733
|
+
SyntaxKind2[SyntaxKind2["LineBreakTrivia"] = 14] = "LineBreakTrivia";
|
|
21734
|
+
SyntaxKind2[SyntaxKind2["Trivia"] = 15] = "Trivia";
|
|
21735
|
+
SyntaxKind2[SyntaxKind2["Unknown"] = 16] = "Unknown";
|
|
21736
|
+
SyntaxKind2[SyntaxKind2["EOF"] = 17] = "EOF";
|
|
21737
|
+
})(SyntaxKind || (SyntaxKind = {}));
|
|
21738
|
+
parse2 = parse;
|
|
21739
|
+
parseTree2 = parseTree;
|
|
21740
|
+
findNodeAtLocation2 = findNodeAtLocation;
|
|
21741
|
+
getNodeValue2 = getNodeValue;
|
|
21742
|
+
(function(ParseErrorCode2) {
|
|
21743
|
+
ParseErrorCode2[ParseErrorCode2["InvalidSymbol"] = 1] = "InvalidSymbol";
|
|
21744
|
+
ParseErrorCode2[ParseErrorCode2["InvalidNumberFormat"] = 2] = "InvalidNumberFormat";
|
|
21745
|
+
ParseErrorCode2[ParseErrorCode2["PropertyNameExpected"] = 3] = "PropertyNameExpected";
|
|
21746
|
+
ParseErrorCode2[ParseErrorCode2["ValueExpected"] = 4] = "ValueExpected";
|
|
21747
|
+
ParseErrorCode2[ParseErrorCode2["ColonExpected"] = 5] = "ColonExpected";
|
|
21748
|
+
ParseErrorCode2[ParseErrorCode2["CommaExpected"] = 6] = "CommaExpected";
|
|
21749
|
+
ParseErrorCode2[ParseErrorCode2["CloseBraceExpected"] = 7] = "CloseBraceExpected";
|
|
21750
|
+
ParseErrorCode2[ParseErrorCode2["CloseBracketExpected"] = 8] = "CloseBracketExpected";
|
|
21751
|
+
ParseErrorCode2[ParseErrorCode2["EndOfFileExpected"] = 9] = "EndOfFileExpected";
|
|
21752
|
+
ParseErrorCode2[ParseErrorCode2["InvalidCommentToken"] = 10] = "InvalidCommentToken";
|
|
21753
|
+
ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfComment"] = 11] = "UnexpectedEndOfComment";
|
|
21754
|
+
ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfString"] = 12] = "UnexpectedEndOfString";
|
|
21755
|
+
ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfNumber"] = 13] = "UnexpectedEndOfNumber";
|
|
21756
|
+
ParseErrorCode2[ParseErrorCode2["InvalidUnicode"] = 14] = "InvalidUnicode";
|
|
21757
|
+
ParseErrorCode2[ParseErrorCode2["InvalidEscapeCharacter"] = 15] = "InvalidEscapeCharacter";
|
|
21758
|
+
ParseErrorCode2[ParseErrorCode2["InvalidCharacter"] = 16] = "InvalidCharacter";
|
|
21759
|
+
})(ParseErrorCode || (ParseErrorCode = {}));
|
|
21845
21760
|
}
|
|
21846
|
-
|
|
21847
|
-
|
|
21848
|
-
|
|
21849
|
-
|
|
21850
|
-
|
|
21851
|
-
|
|
21852
|
-
|
|
21761
|
+
});
|
|
21762
|
+
|
|
21763
|
+
// src/core/checks/commands.ts
|
|
21764
|
+
import * as fs4 from "node:fs";
|
|
21765
|
+
import * as path5 from "node:path";
|
|
21766
|
+
function isManagerBuiltin(manager, sub) {
|
|
21767
|
+
return PM_MANAGER_BUILTINS[manager]?.has(sub) ?? false;
|
|
21768
|
+
}
|
|
21769
|
+
function scriptNameFromMatch(match) {
|
|
21770
|
+
const [, manager, explicitRun, name] = match;
|
|
21771
|
+
if (name.startsWith("-")) return null;
|
|
21772
|
+
if (manager && !explicitRun && PM_BUILTIN_SUBCOMMANDS.has(name)) return null;
|
|
21773
|
+
if (manager && !explicitRun && isManagerBuiltin(manager, name)) return null;
|
|
21774
|
+
return name;
|
|
21775
|
+
}
|
|
21776
|
+
function extractNpxPackage(cmd) {
|
|
21777
|
+
if (!/^npx\b/.test(cmd)) return null;
|
|
21778
|
+
const tokens = cmd.split(/\s+/).slice(1);
|
|
21779
|
+
for (let i2 = 0; i2 < tokens.length; i2++) {
|
|
21780
|
+
const t2 = tokens[i2];
|
|
21781
|
+
if (t2 === "-p" || t2 === "--package") {
|
|
21782
|
+
const v2 = tokens[i2 + 1];
|
|
21783
|
+
if (v2 && !v2.startsWith("-")) return v2;
|
|
21784
|
+
continue;
|
|
21853
21785
|
}
|
|
21854
|
-
|
|
21855
|
-
|
|
21856
|
-
}
|
|
21857
|
-
function parseLiteral() {
|
|
21858
|
-
switch (_scanner.getToken()) {
|
|
21859
|
-
case 11:
|
|
21860
|
-
const tokenValue = _scanner.getTokenValue();
|
|
21861
|
-
let value = Number(tokenValue);
|
|
21862
|
-
if (isNaN(value)) {
|
|
21863
|
-
handleError(
|
|
21864
|
-
2
|
|
21865
|
-
/* ParseErrorCode.InvalidNumberFormat */
|
|
21866
|
-
);
|
|
21867
|
-
value = 0;
|
|
21868
|
-
}
|
|
21869
|
-
onLiteralValue(value);
|
|
21870
|
-
break;
|
|
21871
|
-
case 7:
|
|
21872
|
-
onLiteralValue(null);
|
|
21873
|
-
break;
|
|
21874
|
-
case 8:
|
|
21875
|
-
onLiteralValue(true);
|
|
21876
|
-
break;
|
|
21877
|
-
case 9:
|
|
21878
|
-
onLiteralValue(false);
|
|
21879
|
-
break;
|
|
21880
|
-
default:
|
|
21881
|
-
return false;
|
|
21786
|
+
if (t2.startsWith("-p=") || t2.startsWith("--package=")) {
|
|
21787
|
+
return t2.slice(t2.indexOf("=") + 1) || null;
|
|
21882
21788
|
}
|
|
21883
|
-
|
|
21884
|
-
return
|
|
21789
|
+
if (t2.startsWith("-")) continue;
|
|
21790
|
+
return t2;
|
|
21885
21791
|
}
|
|
21886
|
-
|
|
21887
|
-
|
|
21888
|
-
|
|
21889
|
-
|
|
21890
|
-
|
|
21891
|
-
|
|
21892
|
-
|
|
21893
|
-
|
|
21792
|
+
return null;
|
|
21793
|
+
}
|
|
21794
|
+
function wouldNeedPackageJson(cmd) {
|
|
21795
|
+
const scriptMatch = cmd.match(NPM_SCRIPT_PATTERN);
|
|
21796
|
+
if (scriptMatch && scriptNameFromMatch(scriptMatch) !== null) return true;
|
|
21797
|
+
const shorthandMatch = cmd.match(PKG_SHORTHAND_PATTERN);
|
|
21798
|
+
if (shorthandMatch && !isManagerBuiltin(shorthandMatch[1], shorthandMatch[2])) return true;
|
|
21799
|
+
return /^npx\b/.test(cmd) || PKG_DEPENDENT_TOOL_PATTERN.test(cmd);
|
|
21800
|
+
}
|
|
21801
|
+
function loadDeniedCommandPrefixes(projectRoot) {
|
|
21802
|
+
const prefixes = [];
|
|
21803
|
+
for (const rel of ["settings.json", "settings.local.json"]) {
|
|
21804
|
+
let content;
|
|
21805
|
+
try {
|
|
21806
|
+
content = stripBom(fs4.readFileSync(path5.join(projectRoot, ".claude", rel), "utf-8"));
|
|
21807
|
+
} catch {
|
|
21808
|
+
continue;
|
|
21894
21809
|
}
|
|
21895
|
-
|
|
21896
|
-
|
|
21897
|
-
|
|
21898
|
-
|
|
21899
|
-
if (
|
|
21900
|
-
|
|
21901
|
-
|
|
21902
|
-
|
|
21903
|
-
/* SyntaxKind.CommaToken */
|
|
21904
|
-
]);
|
|
21905
|
-
}
|
|
21906
|
-
} else {
|
|
21907
|
-
handleError(5, [], [
|
|
21908
|
-
2,
|
|
21909
|
-
5
|
|
21910
|
-
/* SyntaxKind.CommaToken */
|
|
21911
|
-
]);
|
|
21810
|
+
const data = parse2(content, [], { allowTrailingComma: true });
|
|
21811
|
+
const deny = data?.permissions?.deny;
|
|
21812
|
+
if (!Array.isArray(deny)) continue;
|
|
21813
|
+
for (const entry of deny) {
|
|
21814
|
+
if (typeof entry !== "string") continue;
|
|
21815
|
+
const inner = entry.replace(/^[A-Za-z]+\((.*)\)$/, "$1");
|
|
21816
|
+
const prefix = inner.replace(/:?\*+$/, "").trim();
|
|
21817
|
+
if (prefix) prefixes.push(prefix);
|
|
21912
21818
|
}
|
|
21913
|
-
_jsonPath.pop();
|
|
21914
|
-
return true;
|
|
21915
21819
|
}
|
|
21916
|
-
|
|
21917
|
-
|
|
21918
|
-
|
|
21919
|
-
|
|
21920
|
-
|
|
21921
|
-
|
|
21922
|
-
|
|
21923
|
-
|
|
21924
|
-
|
|
21925
|
-
|
|
21926
|
-
|
|
21927
|
-
|
|
21928
|
-
|
|
21929
|
-
|
|
21930
|
-
|
|
21931
|
-
|
|
21820
|
+
return prefixes;
|
|
21821
|
+
}
|
|
21822
|
+
function isDeniedCommand(cmd, deniedPrefixes) {
|
|
21823
|
+
return deniedPrefixes.some((p2) => cmd === p2 || cmd.startsWith(`${p2} `));
|
|
21824
|
+
}
|
|
21825
|
+
async function checkCommands(file2, projectRoot) {
|
|
21826
|
+
const issues = [];
|
|
21827
|
+
const pkgJson = loadPackageJson(projectRoot);
|
|
21828
|
+
const makefile = loadMakefile(projectRoot);
|
|
21829
|
+
const deniedPrefixes = loadDeniedCommandPrefixes(projectRoot);
|
|
21830
|
+
if (!pkgJson) {
|
|
21831
|
+
const skipped = file2.references.commands.find((ref) => wouldNeedPackageJson(ref.value));
|
|
21832
|
+
if (skipped) {
|
|
21833
|
+
issues.push({
|
|
21834
|
+
severity: "info",
|
|
21835
|
+
check: "commands",
|
|
21836
|
+
ruleId: "commands/package-json-missing",
|
|
21837
|
+
line: skipped.line,
|
|
21838
|
+
message: "package.json missing or unparseable \u2014 command checks skipped",
|
|
21839
|
+
suggestion: "Add a parseable package.json at the project root so script, npx, and tool references can be validated."
|
|
21840
|
+
});
|
|
21841
|
+
}
|
|
21842
|
+
}
|
|
21843
|
+
for (const ref of file2.references.commands) {
|
|
21844
|
+
const cmd = ref.value;
|
|
21845
|
+
const scriptMatch = cmd.match(NPM_SCRIPT_PATTERN);
|
|
21846
|
+
if (scriptMatch && pkgJson) {
|
|
21847
|
+
const scriptName = scriptNameFromMatch(scriptMatch);
|
|
21848
|
+
if (scriptName && pkgJson.scripts && !(scriptName in pkgJson.scripts)) {
|
|
21849
|
+
const available = Object.keys(pkgJson.scripts).join(", ");
|
|
21850
|
+
issues.push({
|
|
21851
|
+
severity: "error",
|
|
21852
|
+
check: "commands",
|
|
21853
|
+
ruleId: "commands/script-not-found",
|
|
21854
|
+
line: ref.line,
|
|
21855
|
+
message: `"${cmd}" \u2014 script "${scriptName}" not found in package.json`,
|
|
21856
|
+
suggestion: available ? `Available scripts: ${available}` : void 0
|
|
21857
|
+
});
|
|
21932
21858
|
}
|
|
21933
|
-
|
|
21934
|
-
|
|
21935
|
-
|
|
21936
|
-
|
|
21937
|
-
|
|
21938
|
-
|
|
21859
|
+
continue;
|
|
21860
|
+
}
|
|
21861
|
+
const shorthandMatch = cmd.match(PKG_SHORTHAND_PATTERN);
|
|
21862
|
+
if (shorthandMatch && pkgJson) {
|
|
21863
|
+
const manager = shorthandMatch[1];
|
|
21864
|
+
const scriptName = shorthandMatch[2];
|
|
21865
|
+
if (isManagerBuiltin(manager, scriptName)) continue;
|
|
21866
|
+
if (pkgJson.scripts && !(scriptName in pkgJson.scripts)) {
|
|
21867
|
+
issues.push({
|
|
21868
|
+
severity: "error",
|
|
21869
|
+
check: "commands",
|
|
21870
|
+
ruleId: "commands/script-not-found",
|
|
21871
|
+
line: ref.line,
|
|
21872
|
+
message: `"${cmd}" \u2014 script "${scriptName}" not found in package.json`
|
|
21873
|
+
});
|
|
21939
21874
|
}
|
|
21940
|
-
|
|
21941
|
-
}
|
|
21942
|
-
onObjectEnd();
|
|
21943
|
-
if (_scanner.getToken() !== 2) {
|
|
21944
|
-
handleError(7, [
|
|
21945
|
-
2
|
|
21946
|
-
/* SyntaxKind.CloseBraceToken */
|
|
21947
|
-
], []);
|
|
21948
|
-
} else {
|
|
21949
|
-
scanNext();
|
|
21875
|
+
continue;
|
|
21950
21876
|
}
|
|
21951
|
-
|
|
21952
|
-
|
|
21953
|
-
|
|
21954
|
-
|
|
21955
|
-
|
|
21956
|
-
|
|
21957
|
-
|
|
21958
|
-
|
|
21959
|
-
|
|
21960
|
-
|
|
21961
|
-
|
|
21962
|
-
|
|
21963
|
-
|
|
21964
|
-
|
|
21965
|
-
|
|
21966
|
-
|
|
21877
|
+
if (/^npx\b/.test(cmd) && pkgJson) {
|
|
21878
|
+
const pkgName = extractNpxPackage(cmd);
|
|
21879
|
+
if (!pkgName) continue;
|
|
21880
|
+
const allDeps = {
|
|
21881
|
+
...pkgJson.dependencies,
|
|
21882
|
+
...pkgJson.devDependencies,
|
|
21883
|
+
...pkgJson.peerDependencies,
|
|
21884
|
+
...pkgJson.optionalDependencies
|
|
21885
|
+
};
|
|
21886
|
+
if (!(pkgName in allDeps)) {
|
|
21887
|
+
if (isDeniedCommand(cmd, deniedPrefixes)) continue;
|
|
21888
|
+
const binPath = path5.join(projectRoot, "node_modules", ".bin", pkgName);
|
|
21889
|
+
try {
|
|
21890
|
+
fs4.accessSync(binPath);
|
|
21891
|
+
} catch {
|
|
21892
|
+
issues.push({
|
|
21893
|
+
severity: "warning",
|
|
21894
|
+
check: "commands",
|
|
21895
|
+
ruleId: "commands/npx-not-in-deps",
|
|
21896
|
+
line: ref.line,
|
|
21897
|
+
message: `"${cmd}" \u2014 "${pkgName}" not found in dependencies`,
|
|
21898
|
+
suggestion: "If this is a global tool, consider adding it to devDependencies for reproducibility"
|
|
21899
|
+
});
|
|
21967
21900
|
}
|
|
21968
|
-
} else if (needsComma) {
|
|
21969
|
-
handleError(6, [], []);
|
|
21970
21901
|
}
|
|
21971
|
-
|
|
21972
|
-
|
|
21973
|
-
|
|
21902
|
+
continue;
|
|
21903
|
+
}
|
|
21904
|
+
if (MAKE_PATTERN.test(cmd)) {
|
|
21905
|
+
if (!makefile) {
|
|
21906
|
+
issues.push({
|
|
21907
|
+
severity: "error",
|
|
21908
|
+
check: "commands",
|
|
21909
|
+
ruleId: "commands/no-makefile",
|
|
21910
|
+
line: ref.line,
|
|
21911
|
+
message: `"${cmd}" \u2014 no Makefile found in project`
|
|
21912
|
+
});
|
|
21974
21913
|
} else {
|
|
21975
|
-
|
|
21976
|
-
|
|
21977
|
-
|
|
21978
|
-
|
|
21979
|
-
|
|
21980
|
-
|
|
21981
|
-
|
|
21982
|
-
|
|
21914
|
+
const target = extractMakeTarget(cmd);
|
|
21915
|
+
if (target && !hasMakeTarget(makefile, target)) {
|
|
21916
|
+
issues.push({
|
|
21917
|
+
severity: "error",
|
|
21918
|
+
check: "commands",
|
|
21919
|
+
ruleId: "commands/make-target-not-found",
|
|
21920
|
+
line: ref.line,
|
|
21921
|
+
message: `"${cmd}" \u2014 target "${target}" not found in Makefile`
|
|
21922
|
+
});
|
|
21923
|
+
}
|
|
21983
21924
|
}
|
|
21984
|
-
|
|
21925
|
+
continue;
|
|
21985
21926
|
}
|
|
21986
|
-
|
|
21987
|
-
if (
|
|
21988
|
-
|
|
21927
|
+
const toolMatch = cmd.match(PKG_DEPENDENT_TOOL_PATTERN);
|
|
21928
|
+
if (toolMatch && pkgJson) {
|
|
21929
|
+
const tool = toolMatch[1];
|
|
21930
|
+
const pkgName = BIN_TO_PACKAGE[tool] ?? tool;
|
|
21931
|
+
const allDeps = {
|
|
21932
|
+
...pkgJson.dependencies,
|
|
21933
|
+
...pkgJson.devDependencies,
|
|
21934
|
+
...pkgJson.peerDependencies,
|
|
21935
|
+
...pkgJson.optionalDependencies
|
|
21936
|
+
};
|
|
21937
|
+
if (!(pkgName in allDeps)) {
|
|
21938
|
+
const binPath = path5.join(projectRoot, "node_modules", ".bin", tool);
|
|
21939
|
+
try {
|
|
21940
|
+
fs4.accessSync(binPath);
|
|
21941
|
+
} catch {
|
|
21942
|
+
issues.push({
|
|
21943
|
+
severity: "warning",
|
|
21944
|
+
check: "commands",
|
|
21945
|
+
ruleId: "commands/tool-not-found",
|
|
21946
|
+
line: ref.line,
|
|
21947
|
+
message: `"${cmd}" \u2014 "${tool}" not found in dependencies or node_modules/.bin`
|
|
21948
|
+
});
|
|
21949
|
+
}
|
|
21950
|
+
}
|
|
21989
21951
|
}
|
|
21990
|
-
|
|
21991
|
-
|
|
21992
|
-
|
|
21993
|
-
|
|
21994
|
-
|
|
21995
|
-
|
|
21996
|
-
|
|
21952
|
+
}
|
|
21953
|
+
return issues;
|
|
21954
|
+
}
|
|
21955
|
+
function loadMakefile(projectRoot) {
|
|
21956
|
+
try {
|
|
21957
|
+
return stripBom(fs4.readFileSync(path5.join(projectRoot, "Makefile"), "utf-8"));
|
|
21958
|
+
} catch {
|
|
21959
|
+
return null;
|
|
21960
|
+
}
|
|
21961
|
+
}
|
|
21962
|
+
function extractMakeTarget(cmd) {
|
|
21963
|
+
for (const token of cmd.split(/\s+/).slice(1)) {
|
|
21964
|
+
if (token.startsWith("-")) return null;
|
|
21965
|
+
if (token.includes("=")) continue;
|
|
21966
|
+
return token;
|
|
21967
|
+
}
|
|
21968
|
+
return null;
|
|
21969
|
+
}
|
|
21970
|
+
function hasMakeTarget(makefile, target) {
|
|
21971
|
+
const escaped = target.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
21972
|
+
const pattern = new RegExp(`^${escaped}\\s*:(?!:?=)`, "m");
|
|
21973
|
+
return pattern.test(makefile);
|
|
21974
|
+
}
|
|
21975
|
+
var NPM_SCRIPT_PATTERN, MAKE_PATTERN, PM_BUILTIN_SUBCOMMANDS, PM_MANAGER_BUILTINS, PKG_DEPENDENT_TOOL_PATTERN, BIN_TO_PACKAGE, PKG_SHORTHAND_PATTERN;
|
|
21976
|
+
var init_commands = __esm({
|
|
21977
|
+
"src/core/checks/commands.ts"() {
|
|
21978
|
+
"use strict";
|
|
21979
|
+
init_define_WEB_FIRST_SEGMENTS();
|
|
21980
|
+
init_main3();
|
|
21981
|
+
init_fs();
|
|
21982
|
+
NPM_SCRIPT_PATTERN = /^(?:npm\s+run|(pnpm|yarn|bun)(?:\s+(run))?)\s+(\S+)/;
|
|
21983
|
+
MAKE_PATTERN = /^make\s+\S/;
|
|
21984
|
+
PM_BUILTIN_SUBCOMMANDS = /* @__PURE__ */ new Set([
|
|
21985
|
+
"add",
|
|
21986
|
+
"approve-builds",
|
|
21987
|
+
"audit",
|
|
21988
|
+
"bin",
|
|
21989
|
+
"cache",
|
|
21990
|
+
"ci",
|
|
21991
|
+
"config",
|
|
21992
|
+
"create",
|
|
21993
|
+
"dedupe",
|
|
21994
|
+
"dlx",
|
|
21995
|
+
"doctor",
|
|
21996
|
+
"env",
|
|
21997
|
+
"exec",
|
|
21998
|
+
"fetch",
|
|
21999
|
+
"global",
|
|
22000
|
+
"help",
|
|
22001
|
+
"i",
|
|
22002
|
+
"import",
|
|
22003
|
+
"info",
|
|
22004
|
+
"init",
|
|
22005
|
+
"install",
|
|
22006
|
+
"licenses",
|
|
22007
|
+
"link",
|
|
22008
|
+
"list",
|
|
22009
|
+
"login",
|
|
22010
|
+
"logout",
|
|
22011
|
+
"ls",
|
|
22012
|
+
"node",
|
|
22013
|
+
"npm",
|
|
22014
|
+
"outdated",
|
|
22015
|
+
"pack",
|
|
22016
|
+
"patch",
|
|
22017
|
+
"patch-commit",
|
|
22018
|
+
"prune",
|
|
22019
|
+
"publish",
|
|
22020
|
+
"rebuild",
|
|
22021
|
+
"remove",
|
|
22022
|
+
"rm",
|
|
22023
|
+
"root",
|
|
22024
|
+
"run",
|
|
22025
|
+
"self-update",
|
|
22026
|
+
"set",
|
|
22027
|
+
"setup",
|
|
22028
|
+
"store",
|
|
22029
|
+
"team",
|
|
22030
|
+
"un",
|
|
22031
|
+
"uninstall",
|
|
22032
|
+
"unlink",
|
|
22033
|
+
"up",
|
|
22034
|
+
"update",
|
|
22035
|
+
"upgrade",
|
|
22036
|
+
"version",
|
|
22037
|
+
"whoami",
|
|
22038
|
+
"why",
|
|
22039
|
+
"workspace",
|
|
22040
|
+
"workspaces",
|
|
22041
|
+
"x"
|
|
22042
|
+
]);
|
|
22043
|
+
PM_MANAGER_BUILTINS = {
|
|
22044
|
+
bun: /* @__PURE__ */ new Set(["test"])
|
|
22045
|
+
};
|
|
22046
|
+
PKG_DEPENDENT_TOOL_PATTERN = /^(vitest|jest|pytest|mocha|eslint|prettier|tsc)\b/;
|
|
22047
|
+
BIN_TO_PACKAGE = {
|
|
22048
|
+
tsc: "typescript"
|
|
22049
|
+
};
|
|
22050
|
+
PKG_SHORTHAND_PATTERN = /^(npm|pnpm|yarn|bun)\s+(test|start|build|dev|lint|format|check|typecheck|clean|serve|preview|e2e)\b/;
|
|
22051
|
+
}
|
|
22052
|
+
});
|
|
22053
|
+
|
|
22054
|
+
// src/core/checks/staleness.ts
|
|
22055
|
+
import * as path6 from "node:path";
|
|
22056
|
+
async function checkStaleness(file2, projectRoot) {
|
|
22057
|
+
const issues = [];
|
|
22058
|
+
if (!await isGitRepo(projectRoot)) {
|
|
22059
|
+
return issues;
|
|
22060
|
+
}
|
|
22061
|
+
const relativePath = path6.relative(projectRoot, file2.filePath).replace(/\\/g, "/");
|
|
22062
|
+
const lastModified = await getFileLastModified(projectRoot, relativePath);
|
|
22063
|
+
if (!lastModified || isNaN(lastModified.getTime())) {
|
|
22064
|
+
return issues;
|
|
22065
|
+
}
|
|
22066
|
+
const daysSinceUpdate = Math.floor((Date.now() - lastModified.getTime()) / (1e3 * 60 * 60 * 24));
|
|
22067
|
+
if (daysSinceUpdate < INFO_DAYS) {
|
|
22068
|
+
return issues;
|
|
22069
|
+
}
|
|
22070
|
+
const referencedPaths = /* @__PURE__ */ new Set();
|
|
22071
|
+
const globByPrefix = /* @__PURE__ */ new Map();
|
|
22072
|
+
for (const ref of file2.references.paths) {
|
|
22073
|
+
const normalized = ref.value.replace(/\\/g, "/");
|
|
22074
|
+
if (normalized.includes("*")) {
|
|
22075
|
+
const staticSegments = [];
|
|
22076
|
+
for (const segment of normalized.split("/")) {
|
|
22077
|
+
if (segment === ".") continue;
|
|
22078
|
+
if (segment.includes("*")) break;
|
|
22079
|
+
staticSegments.push(segment);
|
|
22080
|
+
}
|
|
22081
|
+
const prefix = staticSegments.join("/");
|
|
22082
|
+
if (prefix) {
|
|
22083
|
+
const key = `${prefix}/`;
|
|
22084
|
+
referencedPaths.add(key);
|
|
22085
|
+
if (!globByPrefix.has(key)) globByPrefix.set(key, ref.value);
|
|
22086
|
+
}
|
|
22087
|
+
continue;
|
|
21997
22088
|
}
|
|
21998
|
-
|
|
22089
|
+
referencedPaths.add(ref.value);
|
|
21999
22090
|
}
|
|
22000
|
-
|
|
22001
|
-
|
|
22002
|
-
case 3:
|
|
22003
|
-
return parseArray();
|
|
22004
|
-
case 1:
|
|
22005
|
-
return parseObject();
|
|
22006
|
-
case 10:
|
|
22007
|
-
return parseString(true);
|
|
22008
|
-
default:
|
|
22009
|
-
return parseLiteral();
|
|
22010
|
-
}
|
|
22091
|
+
if (referencedPaths.size === 0) {
|
|
22092
|
+
return issues;
|
|
22011
22093
|
}
|
|
22012
|
-
|
|
22013
|
-
|
|
22014
|
-
|
|
22015
|
-
|
|
22094
|
+
const counts = await getCommitsSinceBatch(projectRoot, [...referencedPaths], lastModified);
|
|
22095
|
+
let totalCommits = 0;
|
|
22096
|
+
let mostActiveRef = "";
|
|
22097
|
+
let mostActiveCommits = 0;
|
|
22098
|
+
for (const [refPath, commits] of counts) {
|
|
22099
|
+
totalCommits += commits;
|
|
22100
|
+
if (commits > mostActiveCommits) {
|
|
22101
|
+
mostActiveCommits = commits;
|
|
22102
|
+
mostActiveRef = refPath;
|
|
22016
22103
|
}
|
|
22017
|
-
handleError(4, [], []);
|
|
22018
|
-
return false;
|
|
22019
|
-
}
|
|
22020
|
-
if (!parseValue()) {
|
|
22021
|
-
handleError(4, [], []);
|
|
22022
|
-
return false;
|
|
22023
|
-
}
|
|
22024
|
-
if (_scanner.getToken() !== 17) {
|
|
22025
|
-
handleError(9, [], []);
|
|
22026
22104
|
}
|
|
22027
|
-
|
|
22028
|
-
|
|
22029
|
-
function getNodeType(value) {
|
|
22030
|
-
switch (typeof value) {
|
|
22031
|
-
case "boolean":
|
|
22032
|
-
return "boolean";
|
|
22033
|
-
case "number":
|
|
22034
|
-
return "number";
|
|
22035
|
-
case "string":
|
|
22036
|
-
return "string";
|
|
22037
|
-
case "object": {
|
|
22038
|
-
if (!value) {
|
|
22039
|
-
return "null";
|
|
22040
|
-
} else if (Array.isArray(value)) {
|
|
22041
|
-
return "array";
|
|
22042
|
-
}
|
|
22043
|
-
return "object";
|
|
22044
|
-
}
|
|
22045
|
-
default:
|
|
22046
|
-
return "null";
|
|
22105
|
+
if (totalCommits === 0) {
|
|
22106
|
+
return issues;
|
|
22047
22107
|
}
|
|
22108
|
+
const isStale = daysSinceUpdate >= WARNING_DAYS;
|
|
22109
|
+
const severity = isStale ? "warning" : "info";
|
|
22110
|
+
const mostActiveLabel = globByPrefix.get(mostActiveRef) ?? mostActiveRef;
|
|
22111
|
+
issues.push({
|
|
22112
|
+
severity,
|
|
22113
|
+
check: "staleness",
|
|
22114
|
+
ruleId: isStale ? "staleness/stale" : "staleness/aging",
|
|
22115
|
+
line: 1,
|
|
22116
|
+
message: `Last updated ${daysSinceUpdate} days ago. ${mostActiveLabel} has ${mostActiveCommits} commits since.`,
|
|
22117
|
+
suggestion: "Review and update this context file to reflect recent changes.",
|
|
22118
|
+
detail: `${totalCommits} total commits to referenced paths since last update.`
|
|
22119
|
+
});
|
|
22120
|
+
return issues;
|
|
22048
22121
|
}
|
|
22049
|
-
var
|
|
22050
|
-
var
|
|
22051
|
-
"
|
|
22122
|
+
var WARNING_DAYS, INFO_DAYS;
|
|
22123
|
+
var init_staleness = __esm({
|
|
22124
|
+
"src/core/checks/staleness.ts"() {
|
|
22052
22125
|
"use strict";
|
|
22053
22126
|
init_define_WEB_FIRST_SEGMENTS();
|
|
22054
|
-
|
|
22055
|
-
|
|
22056
|
-
|
|
22057
|
-
allowTrailingComma: false
|
|
22058
|
-
};
|
|
22059
|
-
})(ParseOptions || (ParseOptions = {}));
|
|
22127
|
+
init_git();
|
|
22128
|
+
WARNING_DAYS = 30;
|
|
22129
|
+
INFO_DAYS = 14;
|
|
22060
22130
|
}
|
|
22061
22131
|
});
|
|
22062
22132
|
|
|
22063
|
-
//
|
|
22064
|
-
|
|
22065
|
-
|
|
22066
|
-
|
|
22067
|
-
|
|
22068
|
-
|
|
22069
|
-
|
|
22133
|
+
// src/core/checks/tokens.ts
|
|
22134
|
+
function resolveTokenThresholds(overrides) {
|
|
22135
|
+
if (!overrides) return DEFAULT_TOKEN_THRESHOLDS;
|
|
22136
|
+
const merged = { ...DEFAULT_TOKEN_THRESHOLDS, ...overrides };
|
|
22137
|
+
if (merged.info >= merged.warning || merged.warning >= merged.error) {
|
|
22138
|
+
console.error(
|
|
22139
|
+
`Warning: token thresholds should satisfy info < warning < error (got ${merged.info}, ${merged.warning}, ${merged.error}) \u2014 using defaults`
|
|
22140
|
+
);
|
|
22141
|
+
return DEFAULT_TOKEN_THRESHOLDS;
|
|
22070
22142
|
}
|
|
22071
|
-
|
|
22072
|
-
|
|
22073
|
-
|
|
22074
|
-
|
|
22075
|
-
|
|
22076
|
-
|
|
22077
|
-
|
|
22078
|
-
|
|
22079
|
-
|
|
22080
|
-
|
|
22081
|
-
|
|
22082
|
-
|
|
22083
|
-
|
|
22084
|
-
|
|
22085
|
-
|
|
22086
|
-
|
|
22087
|
-
|
|
22088
|
-
|
|
22089
|
-
|
|
22090
|
-
|
|
22091
|
-
|
|
22092
|
-
|
|
22093
|
-
|
|
22094
|
-
|
|
22095
|
-
|
|
22096
|
-
|
|
22097
|
-
|
|
22098
|
-
|
|
22099
|
-
|
|
22100
|
-
|
|
22101
|
-
|
|
22102
|
-
case 14:
|
|
22103
|
-
return "InvalidUnicode";
|
|
22104
|
-
case 15:
|
|
22105
|
-
return "InvalidEscapeCharacter";
|
|
22106
|
-
case 16:
|
|
22107
|
-
return "InvalidCharacter";
|
|
22143
|
+
return merged;
|
|
22144
|
+
}
|
|
22145
|
+
async function checkTokens(file2, _projectRoot, thresholds = DEFAULT_TOKEN_THRESHOLDS) {
|
|
22146
|
+
const issues = [];
|
|
22147
|
+
const tokens = file2.totalTokens;
|
|
22148
|
+
if (tokens >= thresholds.error) {
|
|
22149
|
+
issues.push({
|
|
22150
|
+
severity: "error",
|
|
22151
|
+
check: "tokens",
|
|
22152
|
+
ruleId: "tokens/excessive",
|
|
22153
|
+
line: 1,
|
|
22154
|
+
message: `${tokens.toLocaleString()} tokens \u2014 consumes significant context window space`,
|
|
22155
|
+
suggestion: "Consider splitting into focused sections or removing redundant content."
|
|
22156
|
+
});
|
|
22157
|
+
} else if (tokens >= thresholds.warning) {
|
|
22158
|
+
issues.push({
|
|
22159
|
+
severity: "warning",
|
|
22160
|
+
check: "tokens",
|
|
22161
|
+
ruleId: "tokens/large",
|
|
22162
|
+
line: 1,
|
|
22163
|
+
message: `${tokens.toLocaleString()} tokens \u2014 large context file`,
|
|
22164
|
+
suggestion: "Consider trimming \u2014 research shows diminishing returns past ~300 lines."
|
|
22165
|
+
});
|
|
22166
|
+
} else if (tokens >= thresholds.info) {
|
|
22167
|
+
issues.push({
|
|
22168
|
+
severity: "info",
|
|
22169
|
+
check: "tokens",
|
|
22170
|
+
ruleId: "tokens/info",
|
|
22171
|
+
line: 1,
|
|
22172
|
+
message: `Uses ~${tokens.toLocaleString()} tokens per session`
|
|
22173
|
+
});
|
|
22108
22174
|
}
|
|
22109
|
-
return
|
|
22175
|
+
return issues;
|
|
22110
22176
|
}
|
|
22111
|
-
|
|
22112
|
-
|
|
22113
|
-
|
|
22177
|
+
function checkAggregateTokens(files, thresholds = DEFAULT_TOKEN_THRESHOLDS) {
|
|
22178
|
+
const total = files.reduce((sum, f) => sum + f.tokens, 0);
|
|
22179
|
+
if (total >= thresholds.aggregate && files.length > 1) {
|
|
22180
|
+
return {
|
|
22181
|
+
severity: "warning",
|
|
22182
|
+
check: "tokens",
|
|
22183
|
+
ruleId: "tokens/aggregate",
|
|
22184
|
+
line: 0,
|
|
22185
|
+
message: `${files.length} context files consume ${total.toLocaleString()} tokens combined`,
|
|
22186
|
+
suggestion: "Consider consolidating or trimming to reduce per-session context cost."
|
|
22187
|
+
};
|
|
22188
|
+
}
|
|
22189
|
+
return null;
|
|
22190
|
+
}
|
|
22191
|
+
var DEFAULT_TOKEN_THRESHOLDS;
|
|
22192
|
+
var init_tokens2 = __esm({
|
|
22193
|
+
"src/core/checks/tokens.ts"() {
|
|
22114
22194
|
"use strict";
|
|
22115
22195
|
init_define_WEB_FIRST_SEGMENTS();
|
|
22116
|
-
|
|
22117
|
-
|
|
22118
|
-
|
|
22119
|
-
|
|
22120
|
-
|
|
22121
|
-
|
|
22122
|
-
|
|
22123
|
-
|
|
22124
|
-
ScanError2[ScanError2["UnexpectedEndOfNumber"] = 3] = "UnexpectedEndOfNumber";
|
|
22125
|
-
ScanError2[ScanError2["InvalidUnicode"] = 4] = "InvalidUnicode";
|
|
22126
|
-
ScanError2[ScanError2["InvalidEscapeCharacter"] = 5] = "InvalidEscapeCharacter";
|
|
22127
|
-
ScanError2[ScanError2["InvalidCharacter"] = 6] = "InvalidCharacter";
|
|
22128
|
-
})(ScanError || (ScanError = {}));
|
|
22129
|
-
(function(SyntaxKind2) {
|
|
22130
|
-
SyntaxKind2[SyntaxKind2["OpenBraceToken"] = 1] = "OpenBraceToken";
|
|
22131
|
-
SyntaxKind2[SyntaxKind2["CloseBraceToken"] = 2] = "CloseBraceToken";
|
|
22132
|
-
SyntaxKind2[SyntaxKind2["OpenBracketToken"] = 3] = "OpenBracketToken";
|
|
22133
|
-
SyntaxKind2[SyntaxKind2["CloseBracketToken"] = 4] = "CloseBracketToken";
|
|
22134
|
-
SyntaxKind2[SyntaxKind2["CommaToken"] = 5] = "CommaToken";
|
|
22135
|
-
SyntaxKind2[SyntaxKind2["ColonToken"] = 6] = "ColonToken";
|
|
22136
|
-
SyntaxKind2[SyntaxKind2["NullKeyword"] = 7] = "NullKeyword";
|
|
22137
|
-
SyntaxKind2[SyntaxKind2["TrueKeyword"] = 8] = "TrueKeyword";
|
|
22138
|
-
SyntaxKind2[SyntaxKind2["FalseKeyword"] = 9] = "FalseKeyword";
|
|
22139
|
-
SyntaxKind2[SyntaxKind2["StringLiteral"] = 10] = "StringLiteral";
|
|
22140
|
-
SyntaxKind2[SyntaxKind2["NumericLiteral"] = 11] = "NumericLiteral";
|
|
22141
|
-
SyntaxKind2[SyntaxKind2["LineCommentTrivia"] = 12] = "LineCommentTrivia";
|
|
22142
|
-
SyntaxKind2[SyntaxKind2["BlockCommentTrivia"] = 13] = "BlockCommentTrivia";
|
|
22143
|
-
SyntaxKind2[SyntaxKind2["LineBreakTrivia"] = 14] = "LineBreakTrivia";
|
|
22144
|
-
SyntaxKind2[SyntaxKind2["Trivia"] = 15] = "Trivia";
|
|
22145
|
-
SyntaxKind2[SyntaxKind2["Unknown"] = 16] = "Unknown";
|
|
22146
|
-
SyntaxKind2[SyntaxKind2["EOF"] = 17] = "EOF";
|
|
22147
|
-
})(SyntaxKind || (SyntaxKind = {}));
|
|
22148
|
-
parse2 = parse;
|
|
22149
|
-
parseTree2 = parseTree;
|
|
22150
|
-
findNodeAtLocation2 = findNodeAtLocation;
|
|
22151
|
-
getNodeValue2 = getNodeValue;
|
|
22152
|
-
(function(ParseErrorCode2) {
|
|
22153
|
-
ParseErrorCode2[ParseErrorCode2["InvalidSymbol"] = 1] = "InvalidSymbol";
|
|
22154
|
-
ParseErrorCode2[ParseErrorCode2["InvalidNumberFormat"] = 2] = "InvalidNumberFormat";
|
|
22155
|
-
ParseErrorCode2[ParseErrorCode2["PropertyNameExpected"] = 3] = "PropertyNameExpected";
|
|
22156
|
-
ParseErrorCode2[ParseErrorCode2["ValueExpected"] = 4] = "ValueExpected";
|
|
22157
|
-
ParseErrorCode2[ParseErrorCode2["ColonExpected"] = 5] = "ColonExpected";
|
|
22158
|
-
ParseErrorCode2[ParseErrorCode2["CommaExpected"] = 6] = "CommaExpected";
|
|
22159
|
-
ParseErrorCode2[ParseErrorCode2["CloseBraceExpected"] = 7] = "CloseBraceExpected";
|
|
22160
|
-
ParseErrorCode2[ParseErrorCode2["CloseBracketExpected"] = 8] = "CloseBracketExpected";
|
|
22161
|
-
ParseErrorCode2[ParseErrorCode2["EndOfFileExpected"] = 9] = "EndOfFileExpected";
|
|
22162
|
-
ParseErrorCode2[ParseErrorCode2["InvalidCommentToken"] = 10] = "InvalidCommentToken";
|
|
22163
|
-
ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfComment"] = 11] = "UnexpectedEndOfComment";
|
|
22164
|
-
ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfString"] = 12] = "UnexpectedEndOfString";
|
|
22165
|
-
ParseErrorCode2[ParseErrorCode2["UnexpectedEndOfNumber"] = 13] = "UnexpectedEndOfNumber";
|
|
22166
|
-
ParseErrorCode2[ParseErrorCode2["InvalidUnicode"] = 14] = "InvalidUnicode";
|
|
22167
|
-
ParseErrorCode2[ParseErrorCode2["InvalidEscapeCharacter"] = 15] = "InvalidEscapeCharacter";
|
|
22168
|
-
ParseErrorCode2[ParseErrorCode2["InvalidCharacter"] = 16] = "InvalidCharacter";
|
|
22169
|
-
})(ParseErrorCode || (ParseErrorCode = {}));
|
|
22196
|
+
DEFAULT_TOKEN_THRESHOLDS = {
|
|
22197
|
+
info: 1e3,
|
|
22198
|
+
warning: 3e3,
|
|
22199
|
+
error: 8e3,
|
|
22200
|
+
aggregate: 5e3,
|
|
22201
|
+
tierBreakdown: 1e3,
|
|
22202
|
+
tierAggregate: 4e3
|
|
22203
|
+
};
|
|
22170
22204
|
}
|
|
22171
22205
|
});
|
|
22172
22206
|
|
|
@@ -27805,7 +27839,7 @@ import { readFileSync as readFileSync7 } from "node:fs";
|
|
|
27805
27839
|
import { resolve as resolve14, dirname as dirname6 } from "node:path";
|
|
27806
27840
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
27807
27841
|
function loadVersion() {
|
|
27808
|
-
if (true) return "0.18.
|
|
27842
|
+
if (true) return "0.18.6";
|
|
27809
27843
|
try {
|
|
27810
27844
|
const __dir = dirname6(fileURLToPath2(import.meta.url));
|
|
27811
27845
|
const pkgPath = resolve14(__dir, "../package.json");
|