pi-lens 4.4.8 → 4.4.9

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.
Files changed (163) hide show
  1. package/CHANGELOG-USER.md +31 -0
  2. package/CHANGELOG.md +178 -0
  3. package/README.md +2 -1
  4. package/config/dependency-cruiser-eager-allowlist.json +1 -1
  5. package/dist/{chunk-3O5EII3W.js → chunk-2VZ3VN3N.js} +2 -2
  6. package/dist/{chunk-SDFKOLSF.js → chunk-3HTZDY3C.js} +8 -6
  7. package/dist/{chunk-A5GRLYPZ.js → chunk-3NPWO5UO.js} +7 -13
  8. package/dist/{chunk-AGGUWKRK.js → chunk-47UCC4MM.js} +1 -1
  9. package/dist/chunk-4ENEJHF4.js +198 -0
  10. package/dist/{chunk-WXUDRAG6.js → chunk-5GEYJJHG.js} +10 -12
  11. package/dist/{chunk-HHR7WGCI.js → chunk-5YSEQHJN.js} +3 -3
  12. package/dist/{chunk-L3CLUGDY.js → chunk-6GPB3JLL.js} +3 -3
  13. package/dist/{chunk-5F3XF3SX.js → chunk-7R5GZIA6.js} +6 -6
  14. package/dist/{chunk-CUDD35TW.js → chunk-7UTSNTWM.js} +4 -4
  15. package/dist/{chunk-DYRZGUMA.js → chunk-7YTRG6YW.js} +2 -2
  16. package/dist/{chunk-JZRP4DGP.js → chunk-AACN5GNE.js} +2 -2
  17. package/dist/{chunk-7ANZ7XDD.js → chunk-ACRJ2GZ5.js} +2 -2
  18. package/dist/{chunk-6FIRFP6A.js → chunk-C3YRO3EU.js} +10 -12
  19. package/dist/{chunk-GMROJJRN.js → chunk-CB7PEVOJ.js} +9 -1
  20. package/dist/{chunk-BBET6HD6.js → chunk-CDFJF5YD.js} +1 -1
  21. package/dist/{chunk-NSPVR3FN.js → chunk-CJS6WE66.js} +17 -19
  22. package/dist/{chunk-6YUNI7B5.js → chunk-CM6BDY4E.js} +14 -60
  23. package/dist/{chunk-G5GV2Q7K.js → chunk-CZCAZVTD.js} +16 -2
  24. package/dist/chunk-DGKFWQK4.js +23 -0
  25. package/dist/{chunk-VOP4PJKA.js → chunk-E65WJVI5.js} +7 -9
  26. package/dist/{chunk-TV6RXRYH.js → chunk-EKNYSXFB.js} +8 -10
  27. package/dist/{chunk-4LL2VRNY.js → chunk-EY6LY2HO.js} +16 -18
  28. package/dist/{chunk-MC6VB2E5.js → chunk-F6BEQWAK.js} +17 -5
  29. package/dist/{chunk-R2QQC33W.js → chunk-FGNSESAC.js} +12 -14
  30. package/dist/{chunk-OC7VWJBZ.js → chunk-FRUBVFXV.js} +35 -37
  31. package/dist/{chunk-7CGIDRIK.js → chunk-G22UNQID.js} +14 -16
  32. package/dist/{chunk-L4NEVZ4T.js → chunk-GQTQUNCG.js} +25 -27
  33. package/dist/{chunk-ZKLTNLAW.js → chunk-H3BVMK47.js} +6 -6
  34. package/dist/chunk-H6FLQ5NW.js +28 -0
  35. package/dist/{chunk-2ZE3AUJQ.js → chunk-HEA3EM23.js} +13 -15
  36. package/dist/{chunk-CZL44WFN.js → chunk-HSOBIN22.js} +2 -2
  37. package/dist/{chunk-PKSUMEPT.js → chunk-HYSKJMZK.js} +3 -3
  38. package/dist/{chunk-VN3L2JWZ.js → chunk-IICERRFF.js} +5 -5
  39. package/dist/{chunk-O4N5BQ3T.js → chunk-IILEH3ZC.js} +8 -10
  40. package/dist/{chunk-WC6WRNQT.js → chunk-J3Q2NYJR.js} +2 -2
  41. package/dist/{chunk-SFLHSL5R.js → chunk-JUZ67QZQ.js} +18 -7
  42. package/dist/chunk-KR5VGMVT.js +25 -0
  43. package/dist/{chunk-UHHLR2VY.js → chunk-KV6GQOGN.js} +38 -41
  44. package/dist/{chunk-HUAM7QG3.js → chunk-KXMJLOZF.js} +25 -23
  45. package/dist/{chunk-BUZIQDFS.js → chunk-L4Y3ROKQ.js} +3 -3
  46. package/dist/{chunk-JBP7KESM.js → chunk-L6WBJGQS.js} +1 -1
  47. package/dist/{chunk-35WKJWO5.js → chunk-L7O774U7.js} +14 -14
  48. package/dist/{chunk-BOPDQ7AZ.js → chunk-LAHHGNAY.js} +19 -21
  49. package/dist/{chunk-RGGH6M34.js → chunk-LT62P654.js} +1 -1
  50. package/dist/{chunk-5T5A6YAJ.js → chunk-LWOM6LVS.js} +33 -34
  51. package/dist/{chunk-JYLOYTZD.js → chunk-MKPDIAZH.js} +5 -1
  52. package/dist/{chunk-CM73PPGD.js → chunk-MN635QYA.js} +3 -4
  53. package/dist/{chunk-BQG2QFVO.js → chunk-MQ4PPCJB.js} +21 -29
  54. package/dist/{chunk-HXFUTMX2.js → chunk-MRLH4MYU.js} +2 -2
  55. package/dist/{chunk-XOMGO63G.js → chunk-N56BNAA6.js} +19 -21
  56. package/dist/{chunk-7MAD5ZAY.js → chunk-N5CEGQPG.js} +14 -16
  57. package/dist/{chunk-ZFORSIED.js → chunk-NCLO6E6N.js} +13 -33
  58. package/dist/{chunk-SQC7K3SP.js → chunk-NL5LSKVD.js} +2 -2
  59. package/dist/{chunk-I22THIHI.js → chunk-NMUSOZ2D.js} +10 -12
  60. package/dist/{chunk-4NBWFYWW.js → chunk-NOWH2VA2.js} +8 -33
  61. package/dist/{chunk-NM2NWH55.js → chunk-NUSXS6YB.js} +6 -5
  62. package/dist/{chunk-OZWXLJMX.js → chunk-OSEKJEUU.js} +2 -2
  63. package/dist/{chunk-2BKUFQKR.js → chunk-OUYAUXAT.js} +405 -181
  64. package/dist/{chunk-JPRDTY5S.js → chunk-PBZNYHMM.js} +8 -10
  65. package/dist/{chunk-JE6HKLC7.js → chunk-PIIUNJIT.js} +2 -4
  66. package/dist/{chunk-ZZDIOAAJ.js → chunk-PRHYIA6X.js} +6 -6
  67. package/dist/{chunk-4W52ZKZX.js → chunk-PXQ45SGD.js} +2 -2
  68. package/dist/chunk-Q6JQKWPK.js +25 -0
  69. package/dist/{chunk-PIQQM32Y.js → chunk-QB7T2PHK.js} +2 -2
  70. package/dist/{chunk-HKIL6DCL.js → chunk-QGITU23N.js} +1 -1
  71. package/dist/chunk-QJJKOHLH.js +57 -0
  72. package/dist/{chunk-6LJOJ6EO.js → chunk-QP33NKYC.js} +14 -16
  73. package/dist/{chunk-DIWK3LBC.js → chunk-QVBOXT3L.js} +8 -10
  74. package/dist/{chunk-IYVYZQRL.js → chunk-RNJFRXEN.js} +5 -7
  75. package/dist/{chunk-G6JKM4O7.js → chunk-RNXOWDM6.js} +10 -10
  76. package/dist/{chunk-5RNB4HVK.js → chunk-RTFMDIKV.js} +1 -1
  77. package/dist/{chunk-XWIME22V.js → chunk-SIQHOB6P.js} +11 -13
  78. package/dist/{chunk-T2S3FNNJ.js → chunk-SLSMJPEF.js} +41 -42
  79. package/dist/chunk-T5QSLSMM.js +50 -0
  80. package/dist/chunk-TGQDAG4B.js +88 -0
  81. package/dist/{chunk-6GMGEKQN.js → chunk-THYHUIDR.js} +39 -12
  82. package/dist/{chunk-WMDUT4KH.js → chunk-TMNUTMT5.js} +72 -89
  83. package/dist/{chunk-7TNILKGY.js → chunk-TOE2RRCS.js} +1 -1
  84. package/dist/chunk-TYHPVE5H.js +25 -0
  85. package/dist/chunk-UAKO2M6B.js +73 -0
  86. package/dist/chunk-UC5AXW5Z.js +20 -0
  87. package/dist/chunk-UTJP6WOS.js +28 -0
  88. package/dist/{chunk-FRLAUP2B.js → chunk-UXTQ3QPD.js} +4 -4
  89. package/dist/{chunk-4QG55RRC.js → chunk-V2WDBOLZ.js} +10 -12
  90. package/dist/{chunk-FHEV6T4L.js → chunk-V67D6TMU.js} +8 -10
  91. package/dist/{chunk-VLQ7UKZH.js → chunk-VCRVNLE7.js} +135 -2
  92. package/dist/{chunk-KZ4ALBCH.js → chunk-VO4JFPTV.js} +2 -2
  93. package/dist/{chunk-GIRBSBGL.js → chunk-VWLSU3XV.js} +3 -3
  94. package/dist/{chunk-2453RRJ2.js → chunk-W5E72HJA.js} +59 -22
  95. package/dist/{chunk-VPLBLWFO.js → chunk-W7TY6HYX.js} +1 -1
  96. package/dist/{chunk-SP4TFY5F.js → chunk-WSSLVMDA.js} +11 -13
  97. package/dist/{chunk-PPKECBPP.js → chunk-WTB4GKMH.js} +10 -1
  98. package/dist/{chunk-X35S7HSB.js → chunk-X5BJ3G2P.js} +41 -30
  99. package/dist/{chunk-X66YJ2SS.js → chunk-XKFO2SZV.js} +33 -34
  100. package/dist/{chunk-OWTG6UMO.js → chunk-XLAI7UYY.js} +75 -22
  101. package/dist/{chunk-4B2YFN4U.js → chunk-XO756WE5.js} +45 -33
  102. package/dist/{chunk-VOXTCULR.js → chunk-XVB3Q2PG.js} +2 -4
  103. package/dist/{chunk-XYLC35E4.js → chunk-YOXCCJDF.js} +517 -308
  104. package/dist/{chunk-O2ARHQKF.js → chunk-ZCQBNPRH.js} +2 -2
  105. package/dist/chunk-ZD4KVFXI.js +234 -0
  106. package/dist/{chunk-LSFXZLPW.js → chunk-ZDMFGACN.js} +184 -235
  107. package/dist/{chunk-4BKU7PV3.js → chunk-ZMMHHXSW.js} +1 -1
  108. package/dist/{chunk-OY7WZI7Q.js → chunk-ZPM7ZIFL.js} +6 -6
  109. package/dist/{chunk-R4QWJQ2H.js → chunk-ZVCDHYWZ.js} +9 -11
  110. package/dist/{chunk-RZG472YW.js → chunk-ZZN74OGD.js} +83 -46
  111. package/dist/{chunk-BHWW6FAX.js → chunk-ZZSJAR76.js} +37 -19
  112. package/dist/index.js +4910 -4218
  113. package/dist/mcp/analyze-cli.js +12 -17
  114. package/dist/mcp/cli.js +41 -42
  115. package/dist/mcp/server.js +1451 -648
  116. package/dist/mcp/worker.js +59 -60
  117. package/dist/probes/installer.js +17 -19
  118. package/docs/agent-tools.md +40 -8
  119. package/docs/analysisall.md +1 -1
  120. package/docs/ci-bot-pr-checks.md +7 -5
  121. package/docs/configuration.md +51 -9
  122. package/docs/defect-shapes.md +52 -3
  123. package/docs/environment-variables.md +18 -1
  124. package/docs/features.md +12 -5
  125. package/docs/globalconfig.md +11 -3
  126. package/docs/invariants/lsp-trust-exec.md +9 -2
  127. package/docs/invariants/session-telemetry.md +2 -2
  128. package/docs/language-coverage.md +1 -0
  129. package/docs/lsp-capability-matrix.md +57 -35
  130. package/docs/lsp-idle-eviction.md +4 -1
  131. package/docs/merge-queue-rollout.md +10 -8
  132. package/docs/module-report-read-symbol.md +34 -23
  133. package/docs/pi-lens-fixer.md +11 -1
  134. package/docs/pi-lens-investigator.md +3 -0
  135. package/docs/pi-lens-merge-policy.md +15 -7
  136. package/docs/pi-lens-reviewer.md +1 -1
  137. package/docs/pi-lens-subagent.md +13 -0
  138. package/docs/public-api-stability.md +39 -5
  139. package/docs/release-qa-baseline.md +7 -4
  140. package/docs/schema/pi-lens-config-v1.json +11 -2
  141. package/docs/servercapabilities.md +3 -1
  142. package/docs/settings.md +2 -2
  143. package/docs/word-index.md +3 -2
  144. package/package.json +8 -3
  145. package/rules/ast-grep-rules/rules/no-sql-in-code-execute-js.yml +1 -2
  146. package/rules/ast-grep-rules/rules/no-sql-in-code-execute.yml +1 -2
  147. package/scripts/download-grammars.js +3 -2
  148. package/skills/pi-lens-lsp-navigation/SKILL.md +5 -1
  149. package/dist/chunk-2TS4GLOJ.js +0 -31
  150. package/dist/chunk-3JAHQBSY.js +0 -27
  151. package/dist/chunk-447YZL4S.js +0 -25
  152. package/dist/chunk-565VRUP4.js +0 -136
  153. package/dist/chunk-57X2CDRX.js +0 -49
  154. package/dist/chunk-GGYOZWHW.js +0 -27
  155. package/dist/chunk-IE5D3RA5.js +0 -58
  156. package/dist/chunk-LPYTPNOJ.js +0 -22
  157. package/dist/chunk-OFNMHPBT.js +0 -89
  158. package/dist/chunk-U3AS2FR6.js +0 -106
  159. package/dist/chunk-W3BGKBBK.js +0 -27
  160. package/dist/chunk-WQV6BI4Q.js +0 -48
  161. package/dist/chunk-YHGYAEFH.js +0 -443
  162. package/dist/chunk-ZONZ6YY3.js +0 -74
  163. package/dist/chunk-ZSM35JF4.js +0 -30
@@ -14,7 +14,7 @@ import {
14
14
  findPiLensConfigMarkerInDir,
15
15
  getPiLensGlobalConfigPath,
16
16
  isResolvedGlobalConfigPath
17
- } from "./chunk-SQC7K3SP.js";
17
+ } from "./chunk-NL5LSKVD.js";
18
18
  import {
19
19
  DEGRADATION_ENTRIES_PER_KIND,
20
20
  GLOBAL_NON_FLAG_CONFIG_SECTIONS,
@@ -28,13 +28,11 @@ import {
28
28
  assignFlagConfigSection,
29
29
  flagConfigSectionKeys,
30
30
  hasFlagConfigPath,
31
+ logExtension,
31
32
  readFlagConfigValue,
32
33
  readToolConfig,
33
34
  recordDegradationOnce
34
- } from "./chunk-2453RRJ2.js";
35
- import {
36
- logExtension
37
- } from "./chunk-WQV6BI4Q.js";
35
+ } from "./chunk-W5E72HJA.js";
38
36
  import {
39
37
  CONFIG_SCHEMA_ANCHOR_KEY,
40
38
  CONFIG_SCHEMA_ID,
@@ -45,7 +43,7 @@ import {
45
43
  import {
46
44
  redactSecrets,
47
45
  toPositiveFinite
48
- } from "./chunk-VLQ7UKZH.js";
46
+ } from "./chunk-VCRVNLE7.js";
49
47
  import {
50
48
  BoundedFifoMap,
51
49
  BoundedLruCache,
@@ -55,7 +53,7 @@ import {
55
53
  realpathOrResolve,
56
54
  toPosix,
57
55
  walkUpDirs
58
- } from "./chunk-GMROJJRN.js";
56
+ } from "./chunk-CB7PEVOJ.js";
59
57
 
60
58
  // dist/clients/generated-artifacts.js
61
59
  import * as fs from "node:fs";
@@ -1575,10 +1573,23 @@ function rulePolicyEntryNode() {
1575
1573
  additionalProperties: true,
1576
1574
  properties: {
1577
1575
  threshold: { type: "number", [STABILITY_TIER_KEY]: "experimental" },
1578
- // These two legacy fields remain opaque so the project compatibility
1579
- // parser can preserve its established field-specific diagnostics.
1580
- disable: opaque("experimental"),
1581
- select: opaque("experimental"),
1576
+ // `disable` is a denial: the union of every tier, so a nearer config
1577
+ // adds rules and never re-enables one (#5232, #2415 AC3).
1578
+ disable: {
1579
+ type: "array",
1580
+ items: { type: "string", [STABILITY_TIER_KEY]: "experimental" },
1581
+ [DENY_KEY]: "array-union",
1582
+ [STABILITY_TIER_KEY]: "experimental"
1583
+ },
1584
+ // `select` is a typed list, so a non-string member is dropped as in
1585
+ // `disable` (#5250); a project file notices only a non-array or an
1586
+ // all-dropped list. It is not a denial: the nearest tier that sets a
1587
+ // key's list replaces it (the #5232 decision).
1588
+ select: {
1589
+ type: "array",
1590
+ items: { type: "string", [STABILITY_TIER_KEY]: "experimental" },
1591
+ [STABILITY_TIER_KEY]: "experimental"
1592
+ },
1582
1593
  ignorePaths: {
1583
1594
  type: "array",
1584
1595
  items: {
@@ -2029,7 +2040,7 @@ function reportPiLensConfigRecords(records) {
2029
2040
  }
2030
2041
  function ignoredRecordCollector(configPath, tier) {
2031
2042
  const noted = [];
2032
- const note = (reason, code = "PILENS_CFG_0001") => {
2043
+ const note = (reason, code) => {
2033
2044
  let notedRecord = {
2034
2045
  code: "PILENS_CFG_0001",
2035
2046
  file: configPath,
@@ -2265,7 +2276,7 @@ function bearingDirMtimes(dirMtimes, info) {
2265
2276
  }
2266
2277
  function parseRulePolicyList(note, ruleId, key, value) {
2267
2278
  if (!Array.isArray(value)) {
2268
- note(`rules.${ruleId}.${key} must be an array of strings`);
2279
+ note(`rules.${ruleId}.${key} must be an array of strings`, "PILENS_CFG_0005");
2269
2280
  return { list: [], invalid: true };
2270
2281
  }
2271
2282
  const list = [];
@@ -2278,7 +2289,7 @@ function parseRulePolicyList(note, ruleId, key, value) {
2278
2289
  }
2279
2290
  if (list.length === 0) {
2280
2291
  if (value.length > 0) {
2281
- note(`rules.${ruleId}.${key} must contain at least one non-empty string`);
2292
+ note(`rules.${ruleId}.${key} must contain at least one non-empty string`, "PILENS_CFG_0005");
2282
2293
  return { list: [], invalid: true };
2283
2294
  }
2284
2295
  return { list: [], invalid: false };
@@ -2287,12 +2298,12 @@ function parseRulePolicyList(note, ruleId, key, value) {
2287
2298
  }
2288
2299
  function parseRulePathList(note, ruleId, value) {
2289
2300
  if (!Array.isArray(value)) {
2290
- note(`rules.${ruleId}.ignorePaths must be an array of strings`);
2301
+ note(`rules.${ruleId}.ignorePaths must be an array of strings`, "PILENS_CFG_0005");
2291
2302
  return void 0;
2292
2303
  }
2293
2304
  const paths = value.filter((entry) => typeof entry === "string" && entry.trim().length > 0).map((entry) => entry.trim());
2294
2305
  if (value.length > 0 && paths.length === 0) {
2295
- note(`rules.${ruleId}.ignorePaths must contain a non-empty string`);
2306
+ note(`rules.${ruleId}.ignorePaths must contain a non-empty string`, "PILENS_CFG_0005");
2296
2307
  return void 0;
2297
2308
  }
2298
2309
  return paths;
@@ -2302,7 +2313,7 @@ function parseConfigFile(configPath) {
2302
2313
  const { note, records: ignoredRecords } = ignoredRecordCollector(configPath, "project");
2303
2314
  const outcome = readConfigDocument(configPath);
2304
2315
  if (outcome.status === "error") {
2305
- note({ parseError: outcome.error, sourceText: outcome.sourceText });
2316
+ note({ parseError: outcome.error, sourceText: outcome.sourceText }, "PILENS_CFG_0001");
2306
2317
  return {
2307
2318
  config: EMPTY_PROJECT_CONFIG,
2308
2319
  records: NO_RECORDS,
@@ -2317,7 +2328,7 @@ function parseConfigFile(configPath) {
2317
2328
  };
2318
2329
  }
2319
2330
  if (!outcome.value || typeof outcome.value !== "object" || Array.isArray(outcome.value)) {
2320
- note("top-level value must be an object");
2331
+ note("top-level value must be an object", "PILENS_CFG_0001");
2321
2332
  return {
2322
2333
  config: EMPTY_PROJECT_CONFIG,
2323
2334
  records: NO_RECORDS,
@@ -2347,7 +2358,7 @@ function parseConfigFile(configPath) {
2347
2358
  const rawRules = obj.rules;
2348
2359
  for (const [ruleId, ruleCfg] of Object.entries(rawRules)) {
2349
2360
  if (!ruleCfg || typeof ruleCfg !== "object" || Array.isArray(ruleCfg)) {
2350
- note(`rules.${ruleId} must be an object with threshold, disable, or select; ignored`);
2361
+ note(`rules.${ruleId} must be an object with threshold, disable, or select; ignored`, "PILENS_CFG_0005");
2351
2362
  continue;
2352
2363
  }
2353
2364
  const r = ruleCfg;
@@ -2355,7 +2366,7 @@ function parseConfigFile(configPath) {
2355
2366
  if (typeof r.threshold === "number" && Number.isFinite(r.threshold) && r.threshold > 0) {
2356
2367
  entry.threshold = r.threshold;
2357
2368
  } else if ("threshold" in r) {
2358
- note(`rules.${ruleId}.threshold must be a positive finite number`);
2369
+ note(`rules.${ruleId}.threshold must be a positive finite number`, "PILENS_CFG_0005");
2359
2370
  }
2360
2371
  if ("disable" in r) {
2361
2372
  const parsed = parseRulePolicyList(note, ruleId, "disable", r.disable);
@@ -2375,7 +2386,7 @@ function parseConfigFile(configPath) {
2375
2386
  if (entry.threshold !== void 0 || entry.disable || entry.select || entry.ignorePaths) {
2376
2387
  rules[ruleId] = entry;
2377
2388
  } else if (!("threshold" in r) && !("disable" in r) && !("select" in r) && !("ignorePaths" in r)) {
2378
- note(`rules.${ruleId} has no recognized setting (threshold, disable, select); ignored`);
2389
+ note(`rules.${ruleId} has no recognized setting (threshold, disable, select); ignored`, "PILENS_CFG_0004");
2379
2390
  }
2380
2391
  }
2381
2392
  }
@@ -2384,13 +2395,13 @@ function parseConfigFile(configPath) {
2384
2395
  if (typeof obj.maxProjectFiles === "number" && Number.isFinite(obj.maxProjectFiles) && obj.maxProjectFiles > 0) {
2385
2396
  maxProjectFiles = obj.maxProjectFiles;
2386
2397
  } else {
2387
- note("maxProjectFiles must be a positive finite number");
2398
+ note("maxProjectFiles must be a positive finite number", "PILENS_CFG_0005");
2388
2399
  }
2389
2400
  }
2390
2401
  let reviewGraph;
2391
2402
  if (obj.reviewGraph !== void 0) {
2392
2403
  if (!obj.reviewGraph || typeof obj.reviewGraph !== "object" || Array.isArray(obj.reviewGraph)) {
2393
- note("reviewGraph must be an object");
2404
+ note("reviewGraph must be an object", "PILENS_CFG_0005");
2394
2405
  } else {
2395
2406
  const rg = obj.reviewGraph;
2396
2407
  if ("maxFiles" in rg) {
@@ -2399,7 +2410,7 @@ function parseConfigFile(configPath) {
2399
2410
  const clamped = Math.min(REVIEW_GRAPH_MAX_FILES_MAX, Math.max(REVIEW_GRAPH_MAX_FILES_MIN, Math.floor(parsed)));
2400
2411
  reviewGraph = { maxFiles: clamped };
2401
2412
  } else {
2402
- note("reviewGraph.maxFiles must be a positive finite number");
2413
+ note("reviewGraph.maxFiles must be a positive finite number", "PILENS_CFG_0005");
2403
2414
  }
2404
2415
  }
2405
2416
  }
@@ -2407,24 +2418,24 @@ function parseConfigFile(configPath) {
2407
2418
  let startup;
2408
2419
  if (obj.startup !== void 0) {
2409
2420
  if (!obj.startup || typeof obj.startup !== "object" || Array.isArray(obj.startup)) {
2410
- note("startup must be an object");
2421
+ note("startup must be an object", "PILENS_CFG_0005");
2411
2422
  } else {
2412
2423
  const section = obj.startup;
2413
2424
  if (section.mode === "quick" || section.mode === "full" || section.mode === "minimal") {
2414
2425
  startup = { mode: section.mode };
2415
2426
  } else if ("mode" in section) {
2416
- note('startup.mode must be "quick", "full", or "minimal"');
2427
+ note('startup.mode must be "quick", "full", or "minimal"', "PILENS_CFG_0005");
2417
2428
  }
2418
2429
  if (section.scans !== void 0) {
2419
2430
  if (!section.scans || typeof section.scans !== "object" || Array.isArray(section.scans)) {
2420
- note("startup.scans must be an object");
2431
+ note("startup.scans must be an object", "PILENS_CFG_0005");
2421
2432
  } else if (typeof section.scans.enabled === "boolean") {
2422
2433
  startup ??= {};
2423
2434
  startup.scans = {
2424
2435
  enabled: section.scans.enabled
2425
2436
  };
2426
2437
  } else if ("enabled" in section.scans) {
2427
- note("startup.scans.enabled must be a boolean");
2438
+ note("startup.scans.enabled must be a boolean", "PILENS_CFG_0005");
2428
2439
  }
2429
2440
  }
2430
2441
  }
@@ -2447,12 +2458,12 @@ function parseConfigFile(configPath) {
2447
2458
  const globalConfigLabel = homeRelativePath(getPiLensGlobalConfigPath(), os2.homedir());
2448
2459
  const warnUnhonoredKey = (label, globalOnly) => {
2449
2460
  if (!globalOnly) {
2450
- note(`unknown key "${label}" is not a recognized pi-lens setting (check for a typo); ignored`);
2461
+ note(`unknown key "${label}" is not a recognized pi-lens setting (check for a typo); ignored`, "PILENS_CFG_0004");
2451
2462
  return;
2452
2463
  }
2453
2464
  const hasCliFlag = LENS_FLAGS.some(({ configKey }) => configKey === label || configKey.startsWith(`${label}.`));
2454
2465
  const cliClause = hasCliFlag ? " or pass the matching CLI flag" : "";
2455
- note(`"${label}" is a global-only pi-lens setting and is not honored in a project .pi-lens.json (set it in ${globalConfigLabel}${cliClause}); ignored`);
2466
+ note(`"${label}" is a global-only pi-lens setting and is not honored in a project .pi-lens.json (set it in ${globalConfigLabel}${cliClause}); ignored`, "PILENS_CFG_0004");
2456
2467
  };
2457
2468
  for (const key of Object.keys(obj)) {
2458
2469
  if (knownProjectKeys.has(key))
@@ -2,60 +2,59 @@ import { createRequire as __pilensCreateRequire } from "node:module"; const requ
2
2
  import {
3
3
  createAvailabilityChecker,
4
4
  resolveAvailableOrInstall
5
- } from "./chunk-ZFORSIED.js";
5
+ } from "./chunk-NCLO6E6N.js";
6
6
  import {
7
7
  ruffConfigArgs
8
- } from "./chunk-5F3XF3SX.js";
9
- import "./chunk-XYLC35E4.js";
10
- import "./chunk-DYRZGUMA.js";
11
- import "./chunk-FHEV6T4L.js";
12
- import "./chunk-ZZDIOAAJ.js";
13
- import "./chunk-7ANZ7XDD.js";
14
- import "./chunk-WC6WRNQT.js";
15
- import "./chunk-HHR7WGCI.js";
16
- import "./chunk-HKIL6DCL.js";
17
- import "./chunk-PPKECBPP.js";
18
- import "./chunk-5RNB4HVK.js";
8
+ } from "./chunk-7R5GZIA6.js";
9
+ import "./chunk-YOXCCJDF.js";
10
+ import "./chunk-7YTRG6YW.js";
11
+ import "./chunk-V67D6TMU.js";
12
+ import "./chunk-LT62P654.js";
13
+ import "./chunk-PRHYIA6X.js";
14
+ import "./chunk-ACRJ2GZ5.js";
15
+ import "./chunk-J3Q2NYJR.js";
16
+ import "./chunk-5YSEQHJN.js";
17
+ import "./chunk-QGITU23N.js";
18
+ import "./chunk-WTB4GKMH.js";
19
+ import "./chunk-RTFMDIKV.js";
19
20
  import "./chunk-CKEQFGLT.js";
20
- import "./chunk-JYLOYTZD.js";
21
- import "./chunk-HUAM7QG3.js";
22
- import "./chunk-HXFUTMX2.js";
21
+ import "./chunk-KXMJLOZF.js";
22
+ import "./chunk-MRLH4MYU.js";
23
+ import "./chunk-MKPDIAZH.js";
23
24
  import "./chunk-2BEMIWEW.js";
24
25
  import "./chunk-IJYGIDF4.js";
25
- import "./chunk-BQG2QFVO.js";
26
+ import "./chunk-MQ4PPCJB.js";
26
27
  import {
27
28
  resolveToolCwd
28
- } from "./chunk-IYVYZQRL.js";
29
- import "./chunk-VOP4PJKA.js";
30
- import "./chunk-JBP7KESM.js";
29
+ } from "./chunk-RNJFRXEN.js";
30
+ import "./chunk-E65WJVI5.js";
31
+ import "./chunk-L6WBJGQS.js";
31
32
  import "./chunk-UYXV5NIS.js";
32
- import "./chunk-JZRP4DGP.js";
33
- import "./chunk-SDFKOLSF.js";
34
- import "./chunk-BBET6HD6.js";
35
- import "./chunk-G6JKM4O7.js";
36
- import "./chunk-O2ARHQKF.js";
33
+ import "./chunk-AACN5GNE.js";
34
+ import "./chunk-3HTZDY3C.js";
35
+ import "./chunk-CDFJF5YD.js";
36
+ import "./chunk-RNXOWDM6.js";
37
+ import "./chunk-ZCQBNPRH.js";
37
38
  import {
38
39
  safeSpawnAsync
39
- } from "./chunk-WMDUT4KH.js";
40
+ } from "./chunk-TMNUTMT5.js";
40
41
  import "./chunk-AWQWXSW4.js";
41
42
  import "./chunk-QYF5S6P6.js";
42
43
  import {
43
44
  isFileKind
44
- } from "./chunk-G5GV2Q7K.js";
45
- import "./chunk-X35S7HSB.js";
46
- import "./chunk-SQC7K3SP.js";
47
- import "./chunk-JE6HKLC7.js";
48
- import "./chunk-2453RRJ2.js";
45
+ } from "./chunk-CZCAZVTD.js";
46
+ import "./chunk-X5BJ3G2P.js";
47
+ import "./chunk-NL5LSKVD.js";
48
+ import "./chunk-PIIUNJIT.js";
49
49
  import {
50
50
  createSubsystemLogger
51
- } from "./chunk-WQV6BI4Q.js";
51
+ } from "./chunk-W5E72HJA.js";
52
52
  import "./chunk-S26LC76R.js";
53
- import "./chunk-565VRUP4.js";
54
- import "./chunk-VLQ7UKZH.js";
53
+ import "./chunk-VCRVNLE7.js";
55
54
  import "./chunk-LJDODBBZ.js";
56
55
  import {
57
56
  pathsEqual
58
- } from "./chunk-GMROJJRN.js";
57
+ } from "./chunk-CB7PEVOJ.js";
59
58
  import "./chunk-NXL4FFQQ.js";
60
59
 
61
60
  // dist/clients/ruff-client.js
@@ -3,47 +3,48 @@ import {
3
3
  augmentPythonEnvironment,
4
4
  detectPythonEnvironment,
5
5
  emitBounded
6
- } from "./chunk-FHEV6T4L.js";
6
+ } from "./chunk-V67D6TMU.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-IYVYZQRL.js";
15
+ } from "./chunk-RNJFRXEN.js";
13
16
  import {
14
17
  findGlobalBinary,
15
18
  findLocalBinAt,
16
19
  localBinPath
17
- } from "./chunk-VOP4PJKA.js";
20
+ } from "./chunk-E65WJVI5.js";
18
21
  import {
19
22
  getIsolatedNpxSpawnOptions
20
- } from "./chunk-JBP7KESM.js";
23
+ } from "./chunk-L6WBJGQS.js";
21
24
  import {
22
25
  resolveLanguageRootForFile
23
- } from "./chunk-SDFKOLSF.js";
26
+ } from "./chunk-3HTZDY3C.js";
24
27
  import {
25
28
  resolveGitCheckout,
26
29
  safeSpawn,
27
30
  safeSpawnAsync
28
- } from "./chunk-WMDUT4KH.js";
31
+ } from "./chunk-TMNUTMT5.js";
29
32
  import {
30
33
  DOTNET_CSHARP_ROOT_MARKERS,
31
34
  detectFileKind
32
- } from "./chunk-G5GV2Q7K.js";
35
+ } from "./chunk-CZCAZVTD.js";
33
36
  import {
34
37
  PathKeyedMap,
35
38
  detectFileRole
36
- } from "./chunk-X35S7HSB.js";
39
+ } from "./chunk-X5BJ3G2P.js";
37
40
  import {
38
41
  findNearestDirWithAnyBasename
39
- } from "./chunk-SQC7K3SP.js";
42
+ } from "./chunk-NL5LSKVD.js";
40
43
  import {
41
44
  LEDGER_FIELD_MAX,
45
+ createSubsystemLogger,
42
46
  recordDegradationOnce
43
- } from "./chunk-2453RRJ2.js";
44
- import {
45
- createSubsystemLogger
46
- } from "./chunk-WQV6BI4Q.js";
47
+ } from "./chunk-W5E72HJA.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-GMROJJRN.js";
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 { command, args, env, ownInstall } = await this.resolveExec(runner, config, absoluteTestFile, cwd, spawnCwd, requireOwnInstall);
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(stdout, stderr, absoluteTestFile, displayRoot ?? cwd, runner);
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)" : void 0);
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" : void 0
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,