pi-lens 4.4.8 → 4.4.10
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/CHANGELOG-USER.md +31 -0
- package/CHANGELOG.md +258 -0
- package/README.md +4 -1
- package/config/dependency-cruiser-eager-allowlist.json +1 -1
- package/dist/{chunk-6YUNI7B5.js → chunk-2ADRLTM2.js} +14 -60
- package/dist/{chunk-4B2YFN4U.js → chunk-2LVJQU3I.js} +46 -33
- package/dist/{chunk-2453RRJ2.js → chunk-3FRI5H4T.js} +72 -23
- package/dist/{chunk-7MAD5ZAY.js → chunk-3HM4BUHR.js} +14 -16
- package/dist/chunk-3QWVOBZJ.js +73 -0
- package/dist/{chunk-PIQQM32Y.js → chunk-46TQJSUE.js} +4 -2
- package/dist/{chunk-RZG472YW.js → chunk-4ITEFRDH.js} +84 -46
- package/dist/{chunk-6FIRFP6A.js → chunk-4NCDHTFI.js} +10 -12
- package/dist/{chunk-7CGIDRIK.js → chunk-6I44EDNQ.js} +14 -16
- package/dist/{chunk-2BKUFQKR.js → chunk-6MDM5MQT.js} +554 -217
- package/dist/{chunk-BBET6HD6.js → chunk-7JX3RNG4.js} +1 -1
- package/dist/{chunk-JE6HKLC7.js → chunk-7WJ55KBN.js} +2 -4
- package/dist/{chunk-4BKU7PV3.js → chunk-A5TEJZGJ.js} +2 -1
- package/dist/{chunk-7ANZ7XDD.js → chunk-ACRJ2GZ5.js} +2 -2
- package/dist/{chunk-2ZE3AUJQ.js → chunk-ALIZWXHZ.js} +13 -15
- package/dist/{chunk-BQG2QFVO.js → chunk-AON2QIJF.js} +43 -55
- package/dist/chunk-B2YUE6YD.js +23 -0
- package/dist/{chunk-L4NEVZ4T.js → chunk-B6HXETWY.js} +25 -27
- package/dist/chunk-BDR5MEZY.js +25 -0
- package/dist/{chunk-HXFUTMX2.js → chunk-BGLS5SDN.js} +2 -2
- package/dist/{chunk-ZZDIOAAJ.js → chunk-BRESRQBE.js} +6 -6
- package/dist/{chunk-WXUDRAG6.js → chunk-C6AODRNU.js} +10 -12
- package/dist/{chunk-GMROJJRN.js → chunk-CB7PEVOJ.js} +9 -1
- package/dist/{chunk-BHWW6FAX.js → chunk-CTB5BAJI.js} +53 -22
- package/dist/{chunk-VN3L2JWZ.js → chunk-CYUJB552.js} +5 -5
- package/dist/{chunk-6GMGEKQN.js → chunk-CZAWWXP6.js} +39 -12
- package/dist/{chunk-G5GV2Q7K.js → chunk-CZCAZVTD.js} +16 -2
- package/dist/chunk-DBS736MA.js +57 -0
- package/dist/{chunk-OWTG6UMO.js → chunk-DOUAWKLO.js} +75 -22
- package/dist/{chunk-BOPDQ7AZ.js → chunk-DVRJBQOJ.js} +19 -21
- package/dist/{chunk-UHHLR2VY.js → chunk-E4VXKTBR.js} +38 -41
- package/dist/{chunk-X66YJ2SS.js → chunk-F6FT6BVQ.js} +33 -34
- package/dist/{chunk-GIRBSBGL.js → chunk-FCQSZQAT.js} +3 -3
- package/dist/{chunk-X35S7HSB.js → chunk-FOEPIX76.js} +41 -30
- package/dist/{chunk-MC6VB2E5.js → chunk-GMC4ZGYR.js} +17 -5
- package/dist/{chunk-7TNILKGY.js → chunk-GTTMQ6XB.js} +1 -1
- package/dist/{chunk-HHR7WGCI.js → chunk-GUGKKGG7.js} +3 -3
- package/dist/{chunk-OZWXLJMX.js → chunk-GVWIU7M7.js} +2 -2
- package/dist/{chunk-WMDUT4KH.js → chunk-H65TYP6V.js} +94 -90
- package/dist/{chunk-5F3XF3SX.js → chunk-HILZE4BQ.js} +9 -8
- package/dist/{chunk-PKSUMEPT.js → chunk-HSYFLOZY.js} +3 -3
- package/dist/{chunk-4QG55RRC.js → chunk-I32RSMH6.js} +10 -12
- package/dist/chunk-I74RQGKA.js +88 -0
- package/dist/{chunk-G6JKM4O7.js → chunk-IDCTDKIA.js} +10 -10
- package/dist/chunk-IK4YS3KC.js +25 -0
- package/dist/{chunk-O2ARHQKF.js → chunk-IL6PIV33.js} +2 -2
- package/dist/{chunk-L3CLUGDY.js → chunk-J6BR5XN2.js} +3 -3
- package/dist/chunk-JKOZ2Z4U.js +20 -0
- package/dist/{chunk-SP4TFY5F.js → chunk-JZQGRARR.js} +11 -13
- package/dist/{chunk-CUDD35TW.js → chunk-K6WIBVMK.js} +6 -5
- package/dist/{chunk-DIWK3LBC.js → chunk-KDCIG23C.js} +8 -10
- package/dist/{chunk-4NBWFYWW.js → chunk-KFRDFAOE.js} +8 -33
- package/dist/{chunk-I22THIHI.js → chunk-KJ3AHOCK.js} +10 -12
- package/dist/{chunk-VOP4PJKA.js → chunk-KSTQ4VXT.js} +7 -9
- package/dist/{chunk-RGGH6M34.js → chunk-LT62P654.js} +1 -1
- package/dist/chunk-MAD4QJTP.js +198 -0
- package/dist/{chunk-CM73PPGD.js → chunk-MN635QYA.js} +3 -4
- package/dist/{chunk-HUAM7QG3.js → chunk-NBM7PNBP.js} +25 -23
- package/dist/{chunk-DYRZGUMA.js → chunk-NE4EFHJX.js} +2 -2
- package/dist/{chunk-SQC7K3SP.js → chunk-NL5LSKVD.js} +2 -2
- package/dist/{chunk-JZRP4DGP.js → chunk-NPNFGYLV.js} +4 -2
- package/dist/{chunk-NM2NWH55.js → chunk-NUSXS6YB.js} +6 -5
- package/dist/{chunk-ZKLTNLAW.js → chunk-OPFNQBS5.js} +6 -6
- package/dist/{chunk-PPKECBPP.js → chunk-OTSTS7L2.js} +19 -1
- package/dist/{chunk-SFLHSL5R.js → chunk-PTSA6QKL.js} +18 -7
- package/dist/{chunk-OY7WZI7Q.js → chunk-Q2VCKC3X.js} +6 -6
- package/dist/{chunk-HKIL6DCL.js → chunk-QGITU23N.js} +1 -1
- package/dist/{chunk-3O5EII3W.js → chunk-QHOTTC4A.js} +2 -2
- package/dist/{chunk-35WKJWO5.js → chunk-QL37SGTS.js} +112 -20
- package/dist/{chunk-OC7VWJBZ.js → chunk-QMV2APEH.js} +35 -37
- package/dist/{chunk-BUZIQDFS.js → chunk-QSCZAP24.js} +3 -3
- package/dist/{chunk-O4N5BQ3T.js → chunk-QUPYLQA4.js} +8 -10
- package/dist/{chunk-A5GRLYPZ.js → chunk-QUQY3IME.js} +7 -13
- package/dist/{chunk-R2QQC33W.js → chunk-QWTHFFU6.js} +12 -14
- package/dist/{chunk-TV6RXRYH.js → chunk-RQRKIRFY.js} +8 -10
- package/dist/{chunk-ZFORSIED.js → chunk-S3WFVG5P.js} +15 -42
- package/dist/{chunk-5RNB4HVK.js → chunk-SG2JQ2YP.js} +1 -1
- package/dist/{chunk-KZ4ALBCH.js → chunk-SJQUWQR6.js} +2 -2
- package/dist/{chunk-T2S3FNNJ.js → chunk-SKVNHCT5.js} +41 -42
- package/dist/{chunk-SDFKOLSF.js → chunk-TJQSYX3J.js} +8 -6
- package/dist/{chunk-IYVYZQRL.js → chunk-TLWFZ66Y.js} +5 -7
- package/dist/{chunk-5T5A6YAJ.js → chunk-TN5CWX5D.js} +33 -34
- package/dist/chunk-TQHOKMVZ.js +28 -0
- package/dist/{chunk-XOMGO63G.js → chunk-TYHOEX4V.js} +19 -21
- package/dist/{chunk-6LJOJ6EO.js → chunk-UNBRHPHJ.js} +14 -16
- package/dist/{chunk-4LL2VRNY.js → chunk-UOO4D2TK.js} +16 -18
- package/dist/{chunk-AGGUWKRK.js → chunk-UY745U35.js} +1 -1
- package/dist/{chunk-LSFXZLPW.js → chunk-V7F7JHS5.js} +218 -253
- package/dist/{chunk-VLQ7UKZH.js → chunk-VCRVNLE7.js} +135 -2
- package/dist/{chunk-JPRDTY5S.js → chunk-VGTBLTPN.js} +8 -10
- package/dist/{chunk-JBP7KESM.js → chunk-VPFRU5IG.js} +1 -1
- package/dist/chunk-VS2L7QDI.js +25 -0
- package/dist/{chunk-4W52ZKZX.js → chunk-W4CUK5G6.js} +2 -2
- package/dist/{chunk-VPLBLWFO.js → chunk-W7TY6HYX.js} +1 -1
- package/dist/{chunk-JYLOYTZD.js → chunk-WAA63ZJV.js} +5 -1
- package/dist/{chunk-WC6WRNQT.js → chunk-WS3UFJOU.js} +2 -2
- package/dist/chunk-XAFZJEXY.js +50 -0
- package/dist/{chunk-XYLC35E4.js → chunk-XPGH5O74.js} +555 -336
- package/dist/{chunk-VOXTCULR.js → chunk-XVB3Q2PG.js} +2 -4
- package/dist/{chunk-FRLAUP2B.js → chunk-Y3EHLUPL.js} +4 -4
- package/dist/{chunk-CZL44WFN.js → chunk-YF4G5NN5.js} +2 -2
- package/dist/{chunk-XWIME22V.js → chunk-YQA34KAF.js} +11 -13
- package/dist/{chunk-FHEV6T4L.js → chunk-YT2VR4SL.js} +8 -10
- package/dist/chunk-ZD4KVFXI.js +234 -0
- package/dist/{chunk-NSPVR3FN.js → chunk-ZOPXB2KK.js} +17 -19
- package/dist/chunk-ZPFLHB3R.js +28 -0
- package/dist/{chunk-R4QWJQ2H.js → chunk-ZZDVGCGG.js} +9 -11
- package/dist/index.js +5398 -4438
- package/dist/mcp/analyze-cli.js +12 -17
- package/dist/mcp/cli.js +41 -42
- package/dist/mcp/server.js +1466 -663
- package/dist/mcp/worker.js +59 -60
- package/dist/probes/installer.js +17 -19
- package/docs/agent-guide.md +2 -1
- package/docs/agent-tools.md +53 -10
- package/docs/analysisall.md +1 -1
- package/docs/ci-bot-pr-checks.md +7 -5
- package/docs/configuration.md +60 -13
- package/docs/defect-shapes.md +67 -4
- package/docs/environment-variables.md +18 -1
- package/docs/features.md +23 -6
- package/docs/globalconfig.md +24 -3
- package/docs/invariants/language-config.md +9 -1
- package/docs/invariants/lsp-trust-exec.md +9 -2
- package/docs/invariants/session-telemetry.md +2 -2
- package/docs/language-coverage.md +67 -0
- package/docs/lsp-capability-matrix.md +121 -53
- package/docs/lsp-idle-eviction.md +20 -13
- package/docs/merge-queue-rollout.md +10 -8
- package/docs/module-report-read-symbol.md +34 -23
- package/docs/pi-lens-fixer.md +19 -7
- package/docs/pi-lens-investigator.md +3 -0
- package/docs/pi-lens-merge-policy.md +20 -8
- package/docs/pi-lens-release.md +3 -2
- package/docs/pi-lens-reviewer.md +53 -12
- package/docs/pi-lens-subagent.md +13 -0
- package/docs/public-api-stability.md +39 -5
- package/docs/release-qa-baseline.md +7 -4
- package/docs/schema/pi-lens-config-v1.json +11 -2
- package/docs/servercapabilities.md +3 -1
- package/docs/settings.md +9 -6
- package/docs/usage.md +1 -0
- package/docs/word-index.md +3 -2
- package/package.json +9 -4
- package/rules/ast-grep-rules/rules/no-sql-in-code-execute-js.yml +1 -2
- package/rules/ast-grep-rules/rules/no-sql-in-code-execute.yml +1 -2
- package/scripts/download-grammars.js +13 -2
- package/scripts/grammars.lock.json +7 -0
- package/skills/pi-lens-lsp-navigation/SKILL.md +5 -1
- package/vendor/grammars/tree-sitter-groovy.wasm +0 -0
- package/dist/chunk-2TS4GLOJ.js +0 -31
- package/dist/chunk-3JAHQBSY.js +0 -27
- package/dist/chunk-447YZL4S.js +0 -25
- package/dist/chunk-565VRUP4.js +0 -136
- package/dist/chunk-57X2CDRX.js +0 -49
- package/dist/chunk-GGYOZWHW.js +0 -27
- package/dist/chunk-IE5D3RA5.js +0 -58
- package/dist/chunk-LPYTPNOJ.js +0 -22
- package/dist/chunk-OFNMHPBT.js +0 -89
- package/dist/chunk-U3AS2FR6.js +0 -106
- package/dist/chunk-W3BGKBBK.js +0 -27
- package/dist/chunk-WQV6BI4Q.js +0 -48
- package/dist/chunk-YHGYAEFH.js +0 -443
- package/dist/chunk-ZONZ6YY3.js +0 -74
- package/dist/chunk-ZSM35JF4.js +0 -30
|
@@ -5,33 +5,33 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
getUserRuleRoot,
|
|
7
7
|
ruleCorpusFingerprintForCycle
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-GUGKKGG7.js";
|
|
9
9
|
import {
|
|
10
10
|
getPackageRoot,
|
|
11
11
|
js_yaml_default,
|
|
12
12
|
resolvePackagePath
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-QGITU23N.js";
|
|
14
14
|
import {
|
|
15
15
|
EXTENSION_TO_GRAMMAR
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-OTSTS7L2.js";
|
|
17
17
|
import {
|
|
18
18
|
withTimeout
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-WAA63ZJV.js";
|
|
20
20
|
import {
|
|
21
21
|
transientRetryDelayMs
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-NPNFGYLV.js";
|
|
23
23
|
import {
|
|
24
24
|
getProjectIgnoreMatcher,
|
|
25
25
|
isExcludedDirName
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-H65TYP6V.js";
|
|
27
27
|
import {
|
|
28
28
|
notifyUserDegradation
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-FOEPIX76.js";
|
|
30
30
|
import {
|
|
31
31
|
assertInstallAllowed,
|
|
32
32
|
getProjectTrustGeneration,
|
|
33
33
|
writeFileAtomic
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-7WJ55KBN.js";
|
|
35
35
|
import {
|
|
36
36
|
compareOrdinal,
|
|
37
37
|
escapeRegExp,
|
|
@@ -39,23 +39,21 @@ import {
|
|
|
39
39
|
incrementDegradationCount,
|
|
40
40
|
recordDegradation,
|
|
41
41
|
recordDegradationOnce
|
|
42
|
-
} from "./chunk-
|
|
43
|
-
import {
|
|
44
|
-
logLatency
|
|
45
|
-
} from "./chunk-565VRUP4.js";
|
|
42
|
+
} from "./chunk-3FRI5H4T.js";
|
|
46
43
|
import {
|
|
47
44
|
createNdjsonLogger,
|
|
48
45
|
getGlobalPiLensLogDir,
|
|
49
46
|
getMaxLogSizeMB,
|
|
50
|
-
isTestMode
|
|
51
|
-
|
|
47
|
+
isTestMode,
|
|
48
|
+
logLatency
|
|
49
|
+
} from "./chunk-VCRVNLE7.js";
|
|
52
50
|
import {
|
|
53
51
|
BoundedFifoMap,
|
|
54
52
|
normalizeFilePath,
|
|
55
53
|
normalizeLoggedPath,
|
|
56
54
|
toPosix,
|
|
57
55
|
walkUpDirs
|
|
58
|
-
} from "./chunk-
|
|
56
|
+
} from "./chunk-CB7PEVOJ.js";
|
|
59
57
|
|
|
60
58
|
// dist/clients/tree-sitter-logger.js
|
|
61
59
|
import * as path from "node:path";
|
|
@@ -177,6 +175,12 @@ var VENDORED_GRAMMARS = {
|
|
|
177
175
|
commit: "dd7b90e0770ff18070c515937ba3c3d6d93db00e",
|
|
178
176
|
license: "MIT",
|
|
179
177
|
buildCommand: "npx tree-sitter-cli build --wasm"
|
|
178
|
+
},
|
|
179
|
+
"tree-sitter-groovy.wasm": {
|
|
180
|
+
repo: "https://github.com/dekobon/tree-sitter-groovy",
|
|
181
|
+
commit: "654e4c2d736571dbc512043a1dc26017c7aedc85",
|
|
182
|
+
license: "MIT OR Apache-2.0",
|
|
183
|
+
buildCommand: "npx tree-sitter-cli@0.25.10 build --wasm"
|
|
180
184
|
}
|
|
181
185
|
};
|
|
182
186
|
function isVendoredGrammar(filename) {
|
|
@@ -219,7 +223,8 @@ var LANGUAGE_TO_GRAMMAR = {
|
|
|
219
223
|
vue: "tree-sitter-vue.wasm",
|
|
220
224
|
yaml: "tree-sitter-yaml.wasm",
|
|
221
225
|
zig: "tree-sitter-zig.wasm",
|
|
222
|
-
cue: "tree-sitter-cue.wasm"
|
|
226
|
+
cue: "tree-sitter-cue.wasm",
|
|
227
|
+
groovy: "tree-sitter-groovy.wasm"
|
|
223
228
|
};
|
|
224
229
|
var GRAMMAR_FILES = [
|
|
225
230
|
...new Set(Object.values(LANGUAGE_TO_GRAMMAR))
|
|
@@ -1500,6 +1505,7 @@ function describeBundledResourceHealth(health, dir, emptyDescription = `${dir} e
|
|
|
1500
1505
|
return `cannot read ${dir} (${health.fsErrorCode})`;
|
|
1501
1506
|
case "empty":
|
|
1502
1507
|
return emptyDescription;
|
|
1508
|
+
case "healthy":
|
|
1503
1509
|
default:
|
|
1504
1510
|
return `${dir}: unexpected health status`;
|
|
1505
1511
|
}
|
|
@@ -2009,6 +2015,28 @@ var queryLoader = new TreeSitterQueryLoader();
|
|
|
2009
2015
|
var _require2 = createRequire2(import.meta.url);
|
|
2010
2016
|
var TREE_SITTER_MAX_SCAN_FILES = 2e4;
|
|
2011
2017
|
var QUERY_BATCH_MAX_LOAD_FAILURES = 3;
|
|
2018
|
+
var BATCH_IDENTITY_IGNORED_FIELDS = /* @__PURE__ */ new Set([
|
|
2019
|
+
"category",
|
|
2020
|
+
"description",
|
|
2021
|
+
"tags",
|
|
2022
|
+
"cwe",
|
|
2023
|
+
"owasp",
|
|
2024
|
+
"confidence",
|
|
2025
|
+
"predicates"
|
|
2026
|
+
]);
|
|
2027
|
+
function queryBatchIdentity(queryDefs) {
|
|
2028
|
+
const canonical = queryDefs.map((queryDef) => {
|
|
2029
|
+
const fields = [];
|
|
2030
|
+
for (const [field, value] of Object.entries(queryDef)) {
|
|
2031
|
+
if (value === void 0 || BATCH_IDENTITY_IGNORED_FIELDS.has(field)) {
|
|
2032
|
+
continue;
|
|
2033
|
+
}
|
|
2034
|
+
fields.push([field, value]);
|
|
2035
|
+
}
|
|
2036
|
+
return fields.sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0);
|
|
2037
|
+
});
|
|
2038
|
+
return crypto3.createHash("sha256").update(JSON.stringify(canonical)).digest("hex");
|
|
2039
|
+
}
|
|
2012
2040
|
var NO_NESTED_ANCHOR_VISIT_CAP = 1e4;
|
|
2013
2041
|
var PYTHON_SQL_SINK_METHODS = /* @__PURE__ */ new Set([
|
|
2014
2042
|
"execute",
|
|
@@ -3639,8 +3667,7 @@ var TreeSitterClient = class _TreeSitterClient {
|
|
|
3639
3667
|
* pattern-index → rule map. Cached per language + rule-set identity.
|
|
3640
3668
|
*/
|
|
3641
3669
|
async compileQueryBatch(queryDefs, languageId, retain = false) {
|
|
3642
|
-
const
|
|
3643
|
-
const cacheKey = this.getQueryCacheKey(`batch:${identity}`, languageId);
|
|
3670
|
+
const cacheKey = this.getQueryCacheKey(`batch:${queryBatchIdentity(queryDefs)}`, languageId);
|
|
3644
3671
|
const cached = this.queryBatchCache.get(cacheKey);
|
|
3645
3672
|
if (cached !== void 0) {
|
|
3646
3673
|
this.queryBatchCache.delete(cacheKey);
|
|
@@ -3673,8 +3700,7 @@ var TreeSitterClient = class _TreeSitterClient {
|
|
|
3673
3700
|
}
|
|
3674
3701
|
}
|
|
3675
3702
|
async compileQueryBatchOnce(queryDefs, languageId, lease) {
|
|
3676
|
-
const
|
|
3677
|
-
const cacheKey = this.getQueryCacheKey(`batch:${identity}`, languageId);
|
|
3703
|
+
const cacheKey = this.getQueryCacheKey(`batch:${queryBatchIdentity(queryDefs)}`, languageId);
|
|
3678
3704
|
const inputKeys = [
|
|
3679
3705
|
cacheKey,
|
|
3680
3706
|
...queryDefs.map((queryDef) => this.getQueryCacheKey(`raw:${queryDef.id}:${queryDef.query}`, languageId))
|
|
@@ -5814,7 +5840,11 @@ var TreeSitterClient = class _TreeSitterClient {
|
|
|
5814
5840
|
scan(rootDir);
|
|
5815
5841
|
return files;
|
|
5816
5842
|
}
|
|
5817
|
-
/**
|
|
5843
|
+
/**
|
|
5844
|
+
* Get file extensions for a language. Hand-kept sibling of the registry
|
|
5845
|
+
* (docs/invariants/language-config.md): a new row copies
|
|
5846
|
+
* `extensionsForLanguage(id)` until the table is folded onto it.
|
|
5847
|
+
*/
|
|
5818
5848
|
getExtensionsForLanguage(languageId) {
|
|
5819
5849
|
const mapping = {
|
|
5820
5850
|
typescript: [".ts", ".mts", ".cts"],
|
|
@@ -5829,7 +5859,8 @@ var TreeSitterClient = class _TreeSitterClient {
|
|
|
5829
5859
|
c: [".c", ".h"],
|
|
5830
5860
|
cpp: [".cpp", ".hpp", ".cc", ".hh"],
|
|
5831
5861
|
elixir: [".ex", ".exs"],
|
|
5832
|
-
ruby: [".rb"]
|
|
5862
|
+
ruby: [".rb"],
|
|
5863
|
+
groovy: [".groovy", ".gvy", ".gy", ".gsh"]
|
|
5833
5864
|
};
|
|
5834
5865
|
return mapping[languageId] || [];
|
|
5835
5866
|
}
|
|
@@ -3,24 +3,24 @@ import {
|
|
|
3
3
|
getSecretsLaneAllowlistPaths,
|
|
4
4
|
isUnderSecretsLaneScratchTree,
|
|
5
5
|
nestedWorktreeOffsets
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-SJQUWQR6.js";
|
|
7
7
|
import {
|
|
8
8
|
SecurityScanClient
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-VGTBLTPN.js";
|
|
10
10
|
import {
|
|
11
11
|
collectTrackedFiles,
|
|
12
12
|
collectUntrackedIgnoredIds,
|
|
13
13
|
safeSpawnAsync
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-H65TYP6V.js";
|
|
15
15
|
import {
|
|
16
16
|
escapeRegExp
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-3FRI5H4T.js";
|
|
18
18
|
import {
|
|
19
19
|
normalizeEphemeralMapKey,
|
|
20
20
|
normalizeMapKey,
|
|
21
21
|
relativeInside,
|
|
22
22
|
walkUpDirs
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-CB7PEVOJ.js";
|
|
24
24
|
|
|
25
25
|
// dist/clients/gitleaks-client.js
|
|
26
26
|
import * as fs from "node:fs";
|
|
@@ -2,21 +2,22 @@ import { createRequire as __pilensCreateRequire } from "node:module"; const requ
|
|
|
2
2
|
import {
|
|
3
3
|
hashFileBytes,
|
|
4
4
|
resolveRunnerPath
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-W7TY6HYX.js";
|
|
6
6
|
import {
|
|
7
7
|
recordDegradationOnce,
|
|
8
|
+
resolveLensToolName,
|
|
8
9
|
translateGuidanceToolNames
|
|
9
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-3FRI5H4T.js";
|
|
10
11
|
import {
|
|
11
12
|
freshnessFromMtime
|
|
12
13
|
} from "./chunk-S26LC76R.js";
|
|
13
14
|
import {
|
|
14
15
|
logLatency
|
|
15
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-VCRVNLE7.js";
|
|
16
17
|
import {
|
|
17
18
|
normalizeMapKey,
|
|
18
19
|
toProjectRelativePath
|
|
19
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-CB7PEVOJ.js";
|
|
20
21
|
|
|
21
22
|
// dist/clients/advisory-provenance.js
|
|
22
23
|
import * as fs from "node:fs";
|
|
@@ -403,6 +404,16 @@ function provenanceStamp(provenance) {
|
|
|
403
404
|
|
|
404
405
|
// dist/clients/runtime-context.js
|
|
405
406
|
var AUTOMATION_FRAMING = "[pi-lens automated check \u2014 not a user request] ";
|
|
407
|
+
var BLOCKER_REPEAT_HEADING = "Still unresolved (already reported on an earlier turn, not new):";
|
|
408
|
+
function blockerRepeatContent(blockers) {
|
|
409
|
+
return `${BLOCKER_REPEAT_HEADING}
|
|
410
|
+
|
|
411
|
+
${blockers}`;
|
|
412
|
+
}
|
|
413
|
+
function blockerRepeatPointer() {
|
|
414
|
+
const tool = resolveLensToolName("lens_diagnostics", "pi");
|
|
415
|
+
return `Every unresolved \u{1F534} blocker: ${tool} {source: "session", mode: "all", severity: "error"}`;
|
|
416
|
+
}
|
|
406
417
|
var MAX_LOGGED_REASONS = 8;
|
|
407
418
|
function boundedReasons(reasons) {
|
|
408
419
|
if (reasons.length <= MAX_LOGGED_REASONS)
|
|
@@ -475,27 +486,42 @@ function peekTurnEndFindings(cacheManager, cwd, runtime, logDelivery = false, se
|
|
|
475
486
|
]
|
|
476
487
|
};
|
|
477
488
|
}
|
|
478
|
-
function consumeTurnEndFindings(cacheManager, cwd, runtime, sessionId, address
|
|
489
|
+
function consumeTurnEndFindings(cacheManager, cwd, runtime, sessionId, address, repeat = {
|
|
490
|
+
atPromptTail: true,
|
|
491
|
+
blockersLive: true
|
|
492
|
+
}) {
|
|
479
493
|
const findings = cacheManager.readCache("turn-end-findings", cwd);
|
|
480
494
|
if (!findings?.data?.content || findings.data.consumed === true)
|
|
481
495
|
return;
|
|
482
496
|
if (addressedElsewhere(findings.data, sessionId, address) !== void 0)
|
|
483
497
|
return;
|
|
498
|
+
if (findings.data.repeat === true && !repeat.atPromptTail)
|
|
499
|
+
return;
|
|
484
500
|
const validation = validateAdvisoryProvenance(findings.data, cwd, runtime);
|
|
485
501
|
logProvenanceDecision(validation, findings.data.provenance, "turn-end", cwd);
|
|
486
|
-
|
|
487
|
-
cacheManager.writeCache("turn-end-findings", { ...findings.data, consumed: true }, cwd);
|
|
488
|
-
} else {
|
|
489
|
-
cacheManager.clearCache("turn-end-findings", cwd);
|
|
490
|
-
}
|
|
502
|
+
settleStagedTurnEnd(cacheManager, cwd, findings.data);
|
|
491
503
|
if (validation.allFilesDeleted)
|
|
492
504
|
return;
|
|
505
|
+
if (findings.data.repeat === true && !repeat.blockersLive)
|
|
506
|
+
return;
|
|
493
507
|
return {
|
|
494
508
|
messages: [
|
|
495
|
-
turnEndMessage(findings.data.
|
|
496
|
-
|
|
509
|
+
turnEndMessage(findings.data.repeat === true ? `${findings.data.content}
|
|
510
|
+
|
|
511
|
+
${blockerRepeatPointer()}` : findings.data.content, validation.status === "current", findings.data.provenance)
|
|
512
|
+
],
|
|
513
|
+
...findings.data.repeat === true && findings.data.content.startsWith(BLOCKER_REPEAT_HEADING) ? {
|
|
514
|
+
repeatBody: findings.data.content.slice(BLOCKER_REPEAT_HEADING.length + 2)
|
|
515
|
+
} : {}
|
|
497
516
|
};
|
|
498
517
|
}
|
|
518
|
+
function settleStagedTurnEnd(cacheManager, cwd, data) {
|
|
519
|
+
if (data.hasBlockers === true && typeof data.sessionId === "string") {
|
|
520
|
+
cacheManager.writeCache("turn-end-findings", { ...data, consumed: true }, cwd);
|
|
521
|
+
} else {
|
|
522
|
+
cacheManager.clearCache("turn-end-findings", cwd);
|
|
523
|
+
}
|
|
524
|
+
}
|
|
499
525
|
function peekTestFindings(cacheManager, cwd, runtime, logDelivery = false) {
|
|
500
526
|
const findings = cacheManager.readCache("test-runner-findings", cwd);
|
|
501
527
|
if (!findings?.data?.content)
|
|
@@ -585,6 +611,7 @@ export {
|
|
|
585
611
|
parseScannedAtMs,
|
|
586
612
|
gateFindingsByPathFreshness,
|
|
587
613
|
AUTOMATION_FRAMING,
|
|
614
|
+
blockerRepeatContent,
|
|
588
615
|
peekTurnEndFindings,
|
|
589
616
|
consumeTurnEndFindings,
|
|
590
617
|
peekTestFindings,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
findNearestDirWithMarker
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-NL5LSKVD.js";
|
|
5
5
|
import {
|
|
6
6
|
isWindowsPath
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-CB7PEVOJ.js";
|
|
8
8
|
|
|
9
9
|
// dist/clients/file-kinds.js
|
|
10
10
|
import { basename, extname, win32 } from "node:path";
|
|
@@ -60,6 +60,7 @@ var KIND_EXTENSIONS = {
|
|
|
60
60
|
fsharp: [".fs", ".fsi", ".fsx"],
|
|
61
61
|
gleam: [".gleam"],
|
|
62
62
|
go: [".go"],
|
|
63
|
+
groovy: [".groovy", ".gvy", ".gy", ".gsh"],
|
|
63
64
|
haskell: [".hs", ".lhs"],
|
|
64
65
|
"helm-template": [".tpl"],
|
|
65
66
|
html: [".htm", ".html"],
|
|
@@ -136,6 +137,11 @@ var DOTNET_FSHARP_ROOT_MARKERS = [
|
|
|
136
137
|
"*.fsproj",
|
|
137
138
|
"*.sln"
|
|
138
139
|
];
|
|
140
|
+
var GROOVY_FILENAMES = [
|
|
141
|
+
"Jenkinsfile",
|
|
142
|
+
"build.gradle",
|
|
143
|
+
"settings.gradle"
|
|
144
|
+
];
|
|
139
145
|
var TERRAGRUNT_FILENAMES = [
|
|
140
146
|
"terragrunt.hcl",
|
|
141
147
|
"root.hcl"
|
|
@@ -158,6 +164,10 @@ var SPECIAL_FILENAMES = [
|
|
|
158
164
|
...TERRAGRUNT_FILENAMES.map((name) => ({
|
|
159
165
|
pattern: new RegExp(`^${name.replaceAll(".", "\\.")}$`, "i"),
|
|
160
166
|
kind: "terragrunt"
|
|
167
|
+
})),
|
|
168
|
+
...GROOVY_FILENAMES.map((name) => ({
|
|
169
|
+
pattern: new RegExp(`^${name.replaceAll(".", "\\.")}$`, "i"),
|
|
170
|
+
kind: "groovy"
|
|
161
171
|
}))
|
|
162
172
|
];
|
|
163
173
|
function isHelmYamlTemplatePath(filePath) {
|
|
@@ -211,6 +221,7 @@ var CODE_KINDS = /* @__PURE__ */ new Set([
|
|
|
211
221
|
"fsharp",
|
|
212
222
|
"gleam",
|
|
213
223
|
"go",
|
|
224
|
+
"groovy",
|
|
214
225
|
"haskell",
|
|
215
226
|
"helm-template",
|
|
216
227
|
"java",
|
|
@@ -250,6 +261,7 @@ function getFileKindLabel(kind) {
|
|
|
250
261
|
jsts: "JavaScript/TypeScript",
|
|
251
262
|
python: "Python",
|
|
252
263
|
go: "Go",
|
|
264
|
+
groovy: "Groovy",
|
|
253
265
|
rust: "Rust",
|
|
254
266
|
cxx: "C/C++",
|
|
255
267
|
cmake: "CMake",
|
|
@@ -294,6 +306,7 @@ function getLanguageId(kind) {
|
|
|
294
306
|
jsts: "typescript",
|
|
295
307
|
python: "python",
|
|
296
308
|
go: "go",
|
|
309
|
+
groovy: "groovy",
|
|
297
310
|
rust: "rust",
|
|
298
311
|
cxx: "cpp",
|
|
299
312
|
cmake: "cmake",
|
|
@@ -343,6 +356,7 @@ export {
|
|
|
343
356
|
DOTNET_CSHARP_SOLUTION_MARKERS,
|
|
344
357
|
DOTNET_CSHARP_ROOT_MARKERS,
|
|
345
358
|
DOTNET_FSHARP_ROOT_MARKERS,
|
|
359
|
+
GROOVY_FILENAMES,
|
|
346
360
|
TERRAGRUNT_FILENAMES,
|
|
347
361
|
SPECIAL_FILENAMES,
|
|
348
362
|
isHelmYamlTemplatePath,
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
DependencyChecker,
|
|
4
|
+
buildMadgeArgs,
|
|
5
|
+
resetMadgeManagedPathMemo
|
|
6
|
+
} from "./chunk-KDCIG23C.js";
|
|
7
|
+
import "./chunk-S3WFVG5P.js";
|
|
8
|
+
import "./chunk-HILZE4BQ.js";
|
|
9
|
+
import {
|
|
10
|
+
mapWithConcurrency
|
|
11
|
+
} from "./chunk-XIMYZ3JA.js";
|
|
12
|
+
import "./chunk-XPGH5O74.js";
|
|
13
|
+
import "./chunk-NE4EFHJX.js";
|
|
14
|
+
import "./chunk-YT2VR4SL.js";
|
|
15
|
+
import "./chunk-LT62P654.js";
|
|
16
|
+
import "./chunk-BRESRQBE.js";
|
|
17
|
+
import "./chunk-ACRJ2GZ5.js";
|
|
18
|
+
import "./chunk-WS3UFJOU.js";
|
|
19
|
+
import "./chunk-GUGKKGG7.js";
|
|
20
|
+
import "./chunk-QGITU23N.js";
|
|
21
|
+
import "./chunk-OTSTS7L2.js";
|
|
22
|
+
import "./chunk-SG2JQ2YP.js";
|
|
23
|
+
import "./chunk-CKEQFGLT.js";
|
|
24
|
+
import "./chunk-NBM7PNBP.js";
|
|
25
|
+
import "./chunk-BGLS5SDN.js";
|
|
26
|
+
import "./chunk-WAA63ZJV.js";
|
|
27
|
+
import "./chunk-2BEMIWEW.js";
|
|
28
|
+
import "./chunk-IJYGIDF4.js";
|
|
29
|
+
import "./chunk-AON2QIJF.js";
|
|
30
|
+
import "./chunk-TLWFZ66Y.js";
|
|
31
|
+
import "./chunk-KSTQ4VXT.js";
|
|
32
|
+
import "./chunk-VPFRU5IG.js";
|
|
33
|
+
import "./chunk-UYXV5NIS.js";
|
|
34
|
+
import "./chunk-NPNFGYLV.js";
|
|
35
|
+
import "./chunk-TJQSYX3J.js";
|
|
36
|
+
import "./chunk-7JX3RNG4.js";
|
|
37
|
+
import "./chunk-IDCTDKIA.js";
|
|
38
|
+
import "./chunk-IL6PIV33.js";
|
|
39
|
+
import "./chunk-H65TYP6V.js";
|
|
40
|
+
import "./chunk-AWQWXSW4.js";
|
|
41
|
+
import "./chunk-QYF5S6P6.js";
|
|
42
|
+
import "./chunk-CZCAZVTD.js";
|
|
43
|
+
import "./chunk-FOEPIX76.js";
|
|
44
|
+
import "./chunk-NL5LSKVD.js";
|
|
45
|
+
import "./chunk-7WJ55KBN.js";
|
|
46
|
+
import "./chunk-3FRI5H4T.js";
|
|
47
|
+
import "./chunk-S26LC76R.js";
|
|
48
|
+
import "./chunk-VCRVNLE7.js";
|
|
49
|
+
import "./chunk-LJDODBBZ.js";
|
|
50
|
+
import "./chunk-CB7PEVOJ.js";
|
|
51
|
+
import "./chunk-NXL4FFQQ.js";
|
|
52
|
+
export {
|
|
53
|
+
DependencyChecker,
|
|
54
|
+
buildMadgeArgs,
|
|
55
|
+
mapWithConcurrency,
|
|
56
|
+
resetMadgeManagedPathMemo
|
|
57
|
+
};
|
|
@@ -3,47 +3,48 @@ import {
|
|
|
3
3
|
augmentPythonEnvironment,
|
|
4
4
|
detectPythonEnvironment,
|
|
5
5
|
emitBounded
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-YT2VR4SL.js";
|
|
7
|
+
import {
|
|
8
|
+
scannerReportParentDir
|
|
9
|
+
} from "./chunk-LT62P654.js";
|
|
7
10
|
import {
|
|
8
11
|
stripAnsi
|
|
9
12
|
} from "./chunk-6HWVI6MI.js";
|
|
10
13
|
import {
|
|
11
14
|
resolveToolCwd
|
|
12
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-TLWFZ66Y.js";
|
|
13
16
|
import {
|
|
14
17
|
findGlobalBinary,
|
|
15
18
|
findLocalBinAt,
|
|
16
19
|
localBinPath
|
|
17
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-KSTQ4VXT.js";
|
|
18
21
|
import {
|
|
19
22
|
getIsolatedNpxSpawnOptions
|
|
20
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-VPFRU5IG.js";
|
|
21
24
|
import {
|
|
22
25
|
resolveLanguageRootForFile
|
|
23
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-TJQSYX3J.js";
|
|
24
27
|
import {
|
|
25
28
|
resolveGitCheckout,
|
|
26
29
|
safeSpawn,
|
|
27
30
|
safeSpawnAsync
|
|
28
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-H65TYP6V.js";
|
|
29
32
|
import {
|
|
30
33
|
DOTNET_CSHARP_ROOT_MARKERS,
|
|
31
34
|
detectFileKind
|
|
32
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-CZCAZVTD.js";
|
|
33
36
|
import {
|
|
34
37
|
PathKeyedMap,
|
|
35
38
|
detectFileRole
|
|
36
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-FOEPIX76.js";
|
|
37
40
|
import {
|
|
38
41
|
findNearestDirWithAnyBasename
|
|
39
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-NL5LSKVD.js";
|
|
40
43
|
import {
|
|
41
44
|
LEDGER_FIELD_MAX,
|
|
45
|
+
createSubsystemLogger,
|
|
42
46
|
recordDegradationOnce
|
|
43
|
-
} from "./chunk-
|
|
44
|
-
import {
|
|
45
|
-
createSubsystemLogger
|
|
46
|
-
} from "./chunk-WQV6BI4Q.js";
|
|
47
|
+
} from "./chunk-3FRI5H4T.js";
|
|
47
48
|
import {
|
|
48
49
|
BoundedFifoMap,
|
|
49
50
|
direntsHaveMarkerGlobMatch,
|
|
@@ -59,7 +60,7 @@ import {
|
|
|
59
60
|
relativeInside,
|
|
60
61
|
toPosix,
|
|
61
62
|
toProjectRelativePath
|
|
62
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-CB7PEVOJ.js";
|
|
63
64
|
|
|
64
65
|
// dist/clients/test-runner-client.js
|
|
65
66
|
import { createHash } from "node:crypto";
|
|
@@ -81,6 +82,9 @@ function formatRunDurationMs(duration) {
|
|
|
81
82
|
function isRunnerErrorResult(result) {
|
|
82
83
|
return result.failed === 0 && !!result.error;
|
|
83
84
|
}
|
|
85
|
+
function isCompletedPassResult(result) {
|
|
86
|
+
return !result.error && !result.notRun && result.failed === 0 && result.passed > 0;
|
|
87
|
+
}
|
|
84
88
|
var SOURCE_TO_TEST_PATTERNS = [
|
|
85
89
|
{
|
|
86
90
|
ext: ".ts",
|
|
@@ -248,7 +252,8 @@ var RUNNERS = {
|
|
|
248
252
|
"--reporter=json",
|
|
249
253
|
"--passWithNoTests"
|
|
250
254
|
],
|
|
251
|
-
parseJson: true
|
|
255
|
+
parseJson: true,
|
|
256
|
+
reportToFile: true
|
|
252
257
|
},
|
|
253
258
|
jest: {
|
|
254
259
|
kinds: ["jsts"],
|
|
@@ -431,8 +436,9 @@ function parsePytestSummary(output) {
|
|
|
431
436
|
let passed = 0;
|
|
432
437
|
let failed = 0;
|
|
433
438
|
let skipped = 0;
|
|
439
|
+
let errors = 0;
|
|
434
440
|
if (!summaryLine)
|
|
435
|
-
return { passed, failed, skipped };
|
|
441
|
+
return { passed, failed, skipped, errors };
|
|
436
442
|
const summaryBody = summaryLine.replace(/^=+\s*|\s*=+\s*$/g, "");
|
|
437
443
|
for (const field of summaryBody.split(",")) {
|
|
438
444
|
const [countText, outcome] = field.trim().split(/\s+/, 2);
|
|
@@ -449,11 +455,15 @@ function parsePytestSummary(output) {
|
|
|
449
455
|
case "skipped":
|
|
450
456
|
skipped = count;
|
|
451
457
|
break;
|
|
458
|
+
case "error":
|
|
459
|
+
case "errors":
|
|
460
|
+
errors = count;
|
|
461
|
+
break;
|
|
452
462
|
}
|
|
453
463
|
}
|
|
454
464
|
const durationMatch = /in\s+([\d.]+)s/.exec(summaryLine);
|
|
455
465
|
const duration = durationMatch ? toMeasuredDurationMs(Number.parseFloat(durationMatch[1]) * 1e3) : void 0;
|
|
456
|
-
return { passed, failed, skipped, duration };
|
|
466
|
+
return { passed, failed, skipped, errors, duration };
|
|
457
467
|
}
|
|
458
468
|
var TestRunnerClient = class {
|
|
459
469
|
log;
|
|
@@ -1113,18 +1123,26 @@ var TestRunnerClient = class {
|
|
|
1113
1123
|
if (!fs.existsSync(absoluteTestFile)) {
|
|
1114
1124
|
return this.emptyResult(absoluteTestFile, "", runner, "Test file not found");
|
|
1115
1125
|
}
|
|
1126
|
+
let reportDir;
|
|
1116
1127
|
try {
|
|
1117
1128
|
const spawnCwd = resolveToolCwd("runner", runner, absoluteTestFile, {
|
|
1118
1129
|
cwd: path.resolve(cwd),
|
|
1119
1130
|
rootMarkers: config.spawnCwdMarkers ?? config.configFiles
|
|
1120
1131
|
}).cwd;
|
|
1121
|
-
const
|
|
1132
|
+
const resolved = await this.resolveExec(runner, config, absoluteTestFile, cwd, spawnCwd, requireOwnInstall);
|
|
1133
|
+
const { command, env, ownInstall } = resolved;
|
|
1122
1134
|
if (requireOwnInstall && !ownInstall) {
|
|
1123
1135
|
return {
|
|
1124
1136
|
...this.emptyResult(absoluteTestFile, "", runner),
|
|
1125
1137
|
notRun: "no-runner-install"
|
|
1126
1138
|
};
|
|
1127
1139
|
}
|
|
1140
|
+
let reportPath;
|
|
1141
|
+
if (config.reportToFile) {
|
|
1142
|
+
reportDir = fs.mkdtempSync(path.join(scannerReportParentDir(), "pi-lens-testreport-"));
|
|
1143
|
+
reportPath = path.join(reportDir, "report.json");
|
|
1144
|
+
}
|
|
1145
|
+
const args = reportPath === void 0 ? resolved.args : [...resolved.args, `--outputFile=${reportPath}`];
|
|
1128
1146
|
this.log(`Running (async): ${command} ${args.join(" ")} (cwd ${spawnCwd})`);
|
|
1129
1147
|
const result = await safeSpawnAsync(command, args, {
|
|
1130
1148
|
cwd: spawnCwd,
|
|
@@ -1139,6 +1157,8 @@ var TestRunnerClient = class {
|
|
|
1139
1157
|
});
|
|
1140
1158
|
const stdout = result.stdout || "";
|
|
1141
1159
|
const stderr = result.stderr || "";
|
|
1160
|
+
const reportText = reportPath !== void 0 && fs.existsSync(reportPath) ? fs.readFileSync(reportPath, "utf-8") : "";
|
|
1161
|
+
const jsonOutput = reportPath === void 0 ? stdout : reportText;
|
|
1142
1162
|
if (result.error) {
|
|
1143
1163
|
this.log(`Runner error: ${result.error.message}`);
|
|
1144
1164
|
return this.emptyResult(absoluteTestFile, "", runner, `Runner error: ${result.error.message}`);
|
|
@@ -1146,7 +1166,7 @@ var TestRunnerClient = class {
|
|
|
1146
1166
|
let parsed;
|
|
1147
1167
|
switch (runner) {
|
|
1148
1168
|
case "vitest":
|
|
1149
|
-
parsed = this.parseVitestOutput(
|
|
1169
|
+
parsed = this.parseVitestOutput(jsonOutput, stderr, absoluteTestFile, displayRoot ?? cwd, runner);
|
|
1150
1170
|
break;
|
|
1151
1171
|
case "jest":
|
|
1152
1172
|
parsed = this.parseJestOutput(stdout, stderr, absoluteTestFile, displayRoot ?? cwd, runner);
|
|
@@ -1175,6 +1195,10 @@ var TestRunnerClient = class {
|
|
|
1175
1195
|
} catch (err) {
|
|
1176
1196
|
this.log(`Run error: ${err.message}`);
|
|
1177
1197
|
return this.emptyResult(absoluteTestFile, "", runner, err.message);
|
|
1198
|
+
} finally {
|
|
1199
|
+
if (reportDir !== void 0) {
|
|
1200
|
+
fs.rmSync(reportDir, { recursive: true, force: true });
|
|
1201
|
+
}
|
|
1178
1202
|
}
|
|
1179
1203
|
}
|
|
1180
1204
|
getFailedTargets(cwd, runner, create = false) {
|
|
@@ -1373,6 +1397,9 @@ var TestRunnerClient = class {
|
|
|
1373
1397
|
parseJsonTestOutput(stdout, stderr, testFile, cwd, runner) {
|
|
1374
1398
|
try {
|
|
1375
1399
|
const json = JSON.parse(stdout);
|
|
1400
|
+
if (json === null || typeof json !== "object" || !Number.isFinite(json.numPassedTests) || !Number.isFinite(json.numFailedTests)) {
|
|
1401
|
+
throw new Error("not a test report");
|
|
1402
|
+
}
|
|
1376
1403
|
const failures = [];
|
|
1377
1404
|
for (const suite of json.testResults || []) {
|
|
1378
1405
|
if (suite.status === "failed" && suite.assertionResults) {
|
|
@@ -1388,10 +1415,15 @@ var TestRunnerClient = class {
|
|
|
1388
1415
|
}
|
|
1389
1416
|
}
|
|
1390
1417
|
}
|
|
1418
|
+
const unsuccessful = json.success === false && json.numFailedTests === 0;
|
|
1419
|
+
const unloadable = unsuccessful ? (json.testResults ?? []).find((suite) => suite.status === "failed") : void 0;
|
|
1420
|
+
const [loadMessage = ""] = (unloadable?.message ?? "the runner reported success: false").split("\n", 1);
|
|
1421
|
+
const loadError = `Test run failed without a failed test: ${loadMessage.slice(0, 300)}`;
|
|
1391
1422
|
return {
|
|
1392
1423
|
file: testFile,
|
|
1393
1424
|
sourceFile: "",
|
|
1394
1425
|
runner,
|
|
1426
|
+
...unsuccessful ? { error: loadError } : {},
|
|
1395
1427
|
passed: json.numPassedTests || 0,
|
|
1396
1428
|
failed: json.numFailedTests || 0,
|
|
1397
1429
|
// #1452: `numSkippedTests` is absent from both reporters' JSON, so
|
|
@@ -1409,7 +1441,7 @@ var TestRunnerClient = class {
|
|
|
1409
1441
|
} catch (err) {
|
|
1410
1442
|
void err;
|
|
1411
1443
|
const failed = stdout.includes("FAIL") || stderr.includes("FAIL");
|
|
1412
|
-
return this.emptyResult(testFile, "", runner, failed ? "Tests failed (could not parse output)" :
|
|
1444
|
+
return this.emptyResult(testFile, "", runner, failed ? "Tests failed (could not parse output)" : `Could not read ${runner} test output (no report)`);
|
|
1413
1445
|
}
|
|
1414
1446
|
}
|
|
1415
1447
|
/**
|
|
@@ -1500,7 +1532,7 @@ var TestRunnerClient = class {
|
|
|
1500
1532
|
const failures = [];
|
|
1501
1533
|
const output = `${stdout}
|
|
1502
1534
|
${stderr}`;
|
|
1503
|
-
const { passed, failed, skipped, duration } = parsePytestSummary(output);
|
|
1535
|
+
const { passed, failed, skipped, errors, duration } = parsePytestSummary(output);
|
|
1504
1536
|
const failureRegex = /FAILED\s+(\S+::\S+)\s*-\s*(.+?)(?:\n|$)/g;
|
|
1505
1537
|
let match;
|
|
1506
1538
|
while ((match = failureRegex.exec(output)) !== null) {
|
|
@@ -1527,7 +1559,27 @@ ${stderr}`;
|
|
|
1527
1559
|
skipped,
|
|
1528
1560
|
failures,
|
|
1529
1561
|
duration,
|
|
1530
|
-
error: exitCode === 4 ? "Pytest configuration error" : exitCode === 2 ? "Pytest interrupted" :
|
|
1562
|
+
error: exitCode === 4 ? "Pytest configuration error" : exitCode === 2 ? "Pytest interrupted" : (
|
|
1563
|
+
// #5270: the `N error(s)` term is a collection or fixture error:
|
|
1564
|
+
// that test never ran, so `1 passed, 1 error` is no pass.
|
|
1565
|
+
errors > 0 ? `Pytest reported ${errors} error${errors === 1 ? "" : "s"} (collection or fixture)` : (
|
|
1566
|
+
// #5257: any other non-zero exit with no counted pass or failure
|
|
1567
|
+
// is a run whose summary was not read (exit 3 internal error,
|
|
1568
|
+
// exit 1 with an unrecognised summary), never a clean zero. A
|
|
1569
|
+
// summary that counted passes and no failure is the run's own
|
|
1570
|
+
// threshold (`--cov-fail-under` exits 1): a pass, not a runner
|
|
1571
|
+
// error (#5276 r1). Exit 5 is pytest's own "no tests
|
|
1572
|
+
// collected", a zero-test run `isCompletedPassResult` already
|
|
1573
|
+
// refuses to count as a pass.
|
|
1574
|
+
exitCode !== 0 && exitCode !== 5 && passed === 0 && failed === 0 ? `Pytest exited with ${exitCode} (no summary read)` : (
|
|
1575
|
+
// #5270 acceptance 2 (#5276 r2): exit 3 is an internal error or
|
|
1576
|
+
// `pytest.exit(returncode=3)`. The run stopped early, so the
|
|
1577
|
+
// summary it still prints (`1 passed`) is partial, whatever it
|
|
1578
|
+
// counts. Exit 1 with passes stays the threshold case above.
|
|
1579
|
+
exitCode === 3 ? "Pytest internal error (exit 3)" : void 0
|
|
1580
|
+
)
|
|
1581
|
+
)
|
|
1582
|
+
)
|
|
1531
1583
|
};
|
|
1532
1584
|
}
|
|
1533
1585
|
// --- PHPUnit Parser (text-based, default CLI output) ---
|
|
@@ -2242,6 +2294,7 @@ ${stderr}`;
|
|
|
2242
2294
|
export {
|
|
2243
2295
|
formatRunDurationMs,
|
|
2244
2296
|
isRunnerErrorResult,
|
|
2297
|
+
isCompletedPassResult,
|
|
2245
2298
|
SOURCE_TO_TEST_PATTERNS,
|
|
2246
2299
|
TURN_END_EXCLUDED_TEST_GLOBS,
|
|
2247
2300
|
isExcludedTestTarget,
|