pi-lens 4.4.7 → 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 (186) hide show
  1. package/CHANGELOG-USER.md +31 -0
  2. package/CHANGELOG.md +327 -0
  3. package/README.md +13 -2
  4. package/config/dependency-cruiser-eager-allowlist.json +1 -1
  5. package/config/markdownlint/run-no-fix.mjs +36 -0
  6. package/dist/{chunk-4LM3VAZH.js → chunk-2VZ3VN3N.js} +2 -2
  7. package/dist/{chunk-PUZ3E2J4.js → chunk-3HTZDY3C.js} +8 -6
  8. package/dist/{chunk-RORGS5II.js → chunk-3NPWO5UO.js} +7 -13
  9. package/dist/{chunk-MNJIXFX4.js → chunk-47UCC4MM.js} +1 -1
  10. package/dist/chunk-4ENEJHF4.js +198 -0
  11. package/dist/chunk-5GEYJJHG.js +22 -0
  12. package/dist/{chunk-U6VN4NVL.js → chunk-5YSEQHJN.js} +3 -3
  13. package/dist/{chunk-6IR3ZYIB.js → chunk-6GPB3JLL.js} +3 -3
  14. package/dist/{chunk-MB6PXBUA.js → chunk-7R5GZIA6.js} +7 -15
  15. package/dist/{chunk-DH5JPM3K.js → chunk-7UTSNTWM.js} +10 -9
  16. package/dist/{chunk-24BILSZW.js → chunk-7YTRG6YW.js} +2 -2
  17. package/dist/{chunk-KW5JQPO5.js → chunk-AACN5GNE.js} +2 -2
  18. package/dist/{chunk-PKES3ISE.js → chunk-ACRJ2GZ5.js} +2 -2
  19. package/dist/{chunk-4ZYJHQMB.js → chunk-C3YRO3EU.js} +10 -12
  20. package/dist/{chunk-PQJFG24Z.js → chunk-CB7PEVOJ.js} +1300 -946
  21. package/dist/{chunk-ABPKUVA4.js → chunk-CDFJF5YD.js} +1 -1
  22. package/dist/{chunk-T7A2HK2B.js → chunk-CJS6WE66.js} +17 -18
  23. package/dist/{chunk-3YY7IXIL.js → chunk-CM6BDY4E.js} +14 -60
  24. package/dist/{chunk-RZOXUSPC.js → chunk-CZCAZVTD.js} +16 -2
  25. package/dist/chunk-DGKFWQK4.js +23 -0
  26. package/dist/{chunk-NA7SEXHE.js → chunk-E65WJVI5.js} +7 -9
  27. package/dist/{chunk-2TF6RXWB.js → chunk-EKNYSXFB.js} +8 -10
  28. package/dist/{chunk-RRV3FNNM.js → chunk-EY6LY2HO.js} +27 -30
  29. package/dist/{chunk-LBLBAFG3.js → chunk-F6BEQWAK.js} +17 -5
  30. package/dist/{chunk-4L36HG27.js → chunk-FGNSESAC.js} +12 -14
  31. package/dist/{chunk-3FRLWYBG.js → chunk-FRUBVFXV.js} +39 -42
  32. package/dist/{chunk-FB5SCCPT.js → chunk-G22UNQID.js} +14 -15
  33. package/dist/{chunk-LV4UMYVH.js → chunk-GQTQUNCG.js} +26 -27
  34. package/dist/{chunk-E7HJ56Y7.js → chunk-H3BVMK47.js} +64 -73
  35. package/dist/chunk-H6FLQ5NW.js +28 -0
  36. package/dist/{chunk-QHSNL7B2.js → chunk-HEA3EM23.js} +15 -19
  37. package/dist/{chunk-AWDSEDER.js → chunk-HSOBIN22.js} +2 -2
  38. package/dist/{chunk-EAOK7MIZ.js → chunk-HYSKJMZK.js} +17 -4
  39. package/dist/{chunk-VUZWQ7UG.js → chunk-IICERRFF.js} +46 -72
  40. package/dist/{chunk-OXOI55RU.js → chunk-IILEH3ZC.js} +8 -10
  41. package/dist/{chunk-ZKXQKGWZ.js → chunk-J3Q2NYJR.js} +4 -3
  42. package/dist/{chunk-YHC2O2WO.js → chunk-JUZ67QZQ.js} +20 -9
  43. package/dist/chunk-KR5VGMVT.js +25 -0
  44. package/dist/{chunk-F7K5IBZG.js → chunk-KV6GQOGN.js} +41 -44
  45. package/dist/{chunk-SNDXCFRS.js → chunk-KXMJLOZF.js} +25 -23
  46. package/dist/{chunk-CB4WHS4H.js → chunk-L4Y3ROKQ.js} +3 -3
  47. package/dist/{chunk-3F6BMY53.js → chunk-L6WBJGQS.js} +1 -1
  48. package/dist/{chunk-MPKRJBPK.js → chunk-L7O774U7.js} +30 -32
  49. package/dist/{chunk-URCQWAQ4.js → chunk-LAHHGNAY.js} +21 -21
  50. package/dist/{chunk-V63BC55Q.js → chunk-LT62P654.js} +1 -1
  51. package/dist/{chunk-ZMAUPOMG.js → chunk-LWOM6LVS.js} +34 -34
  52. package/dist/{chunk-HO6LWE2E.js → chunk-MKPDIAZH.js} +21 -1
  53. package/dist/{chunk-2PHMIAKO.js → chunk-MN635QYA.js} +3 -4
  54. package/dist/{chunk-KDX35VXP.js → chunk-MQ4PPCJB.js} +166 -149
  55. package/dist/{chunk-QOE342SU.js → chunk-MRLH4MYU.js} +2 -2
  56. package/dist/{chunk-CE6VMBCB.js → chunk-N56BNAA6.js} +20 -21
  57. package/dist/{chunk-L3CMBQMH.js → chunk-N5CEGQPG.js} +14 -17
  58. package/dist/{chunk-7E2563GA.js → chunk-NCLO6E6N.js} +13 -33
  59. package/dist/{chunk-J6JP25XU.js → chunk-NL5LSKVD.js} +4 -3
  60. package/dist/{chunk-U7BD2QL7.js → chunk-NMUSOZ2D.js} +10 -12
  61. package/dist/{chunk-BZARLRJW.js → chunk-NOWH2VA2.js} +8 -33
  62. package/dist/{chunk-U2SDMG7C.js → chunk-NUSXS6YB.js} +6 -5
  63. package/dist/{chunk-ZJTT47IG.js → chunk-OSEKJEUU.js} +2 -2
  64. package/dist/{chunk-FZKFVUEC.js → chunk-OUYAUXAT.js} +647 -355
  65. package/dist/{chunk-ZE3KXHS7.js → chunk-PBZNYHMM.js} +84 -4
  66. package/dist/{chunk-U5HPROLA.js → chunk-PIIUNJIT.js} +2 -4
  67. package/dist/chunk-PKLB2XJL.js +8 -0
  68. package/dist/{chunk-RC2Z6K47.js → chunk-PRHYIA6X.js} +15 -6
  69. package/dist/{chunk-RQS4QQSD.js → chunk-PXQ45SGD.js} +2 -2
  70. package/dist/chunk-Q6JQKWPK.js +25 -0
  71. package/dist/{chunk-F6X3YJWD.js → chunk-QB7T2PHK.js} +2 -2
  72. package/dist/{chunk-TIQJPRDD.js → chunk-QGITU23N.js} +3 -2
  73. package/dist/chunk-QJJKOHLH.js +57 -0
  74. package/dist/{chunk-4LOE5R5P.js → chunk-QP33NKYC.js} +18 -15
  75. package/dist/{chunk-N5WSK2K7.js → chunk-QVBOXT3L.js} +12 -17
  76. package/dist/{chunk-DPGEAHZT.js → chunk-RNJFRXEN.js} +10 -18
  77. package/dist/{chunk-EKWX4WD3.js → chunk-RNXOWDM6.js} +10 -10
  78. package/dist/{chunk-O4BJFESU.js → chunk-RTFMDIKV.js} +1 -1
  79. package/dist/{chunk-LS3QJRUB.js → chunk-SIQHOB6P.js} +11 -13
  80. package/dist/{chunk-3K2F6UDZ.js → chunk-SLSMJPEF.js} +43 -42
  81. package/dist/chunk-T5QSLSMM.js +50 -0
  82. package/dist/chunk-TGQDAG4B.js +88 -0
  83. package/dist/{chunk-4YHYPW2G.js → chunk-THYHUIDR.js} +44 -13
  84. package/dist/{chunk-YVHBNSME.js → chunk-TMNUTMT5.js} +1099 -1100
  85. package/dist/{chunk-WDBICWH3.js → chunk-TOE2RRCS.js} +1 -1
  86. package/dist/chunk-TYHPVE5H.js +25 -0
  87. package/dist/chunk-UAKO2M6B.js +73 -0
  88. package/dist/chunk-UC5AXW5Z.js +20 -0
  89. package/dist/chunk-UTJP6WOS.js +28 -0
  90. package/dist/{chunk-DQZFQSR5.js → chunk-UXTQ3QPD.js} +4 -4
  91. package/dist/chunk-UYXV5NIS.js +20 -0
  92. package/dist/{chunk-KKCK636N.js → chunk-V2WDBOLZ.js} +10 -12
  93. package/dist/{chunk-PR6PO3ES.js → chunk-V67D6TMU.js} +22 -20
  94. package/dist/{chunk-VSFLRN5Y.js → chunk-VCRVNLE7.js} +135 -2
  95. package/dist/{chunk-CPSR3AVL.js → chunk-VO4JFPTV.js} +2 -2
  96. package/dist/{chunk-XT2HTCJ5.js → chunk-VWLSU3XV.js} +6 -5
  97. package/dist/{chunk-WME2OQST.js → chunk-W5E72HJA.js} +66 -24
  98. package/dist/{chunk-LLS45EWB.js → chunk-W7TY6HYX.js} +6 -8
  99. package/dist/{chunk-CCV2EU7T.js → chunk-WSSLVMDA.js} +12 -13
  100. package/dist/{chunk-YISME6ON.js → chunk-WTB4GKMH.js} +10 -1
  101. package/dist/{chunk-KPPJTH44.js → chunk-X5BJ3G2P.js} +64 -35
  102. package/dist/{chunk-JMEKXFOL.js → chunk-XKFO2SZV.js} +39 -34
  103. package/dist/{chunk-HR3OJ3TH.js → chunk-XLAI7UYY.js} +84 -31
  104. package/dist/{chunk-H7OR7DFZ.js → chunk-XO756WE5.js} +53 -37
  105. package/dist/{chunk-F5Z6URKM.js → chunk-XVB3Q2PG.js} +2 -4
  106. package/dist/{chunk-R5MOQM2H.js → chunk-YOXCCJDF.js} +607 -366
  107. package/dist/{chunk-ZGSJDWQU.js → chunk-ZCQBNPRH.js} +2 -2
  108. package/dist/chunk-ZD4KVFXI.js +234 -0
  109. package/dist/{chunk-WGRJOXED.js → chunk-ZDMFGACN.js} +1295 -966
  110. package/dist/{chunk-OSTKYB55.js → chunk-ZMMHHXSW.js} +1 -1
  111. package/dist/{chunk-75GAYVNO.js → chunk-ZPM7ZIFL.js} +6 -6
  112. package/dist/{chunk-LUBPZN36.js → chunk-ZVCDHYWZ.js} +9 -11
  113. package/dist/{chunk-Y7F7IEE3.js → chunk-ZZN74OGD.js} +102 -7
  114. package/dist/{chunk-L5JYIU47.js → chunk-ZZSJAR76.js} +39 -20
  115. package/dist/index.js +10933 -8644
  116. package/dist/mcp/analyze-cli.js +12 -17
  117. package/dist/mcp/cli.js +43 -42
  118. package/dist/mcp/server.js +3073 -1147
  119. package/dist/mcp/worker.js +61 -61
  120. package/dist/probes/installer.js +18 -19
  121. package/docs/adr/0003-git-guard-latch-writer.md +11 -6
  122. package/docs/agent-tools.md +58 -16
  123. package/docs/alignment-families.md +29 -0
  124. package/docs/analysisall.md +1 -1
  125. package/docs/ast-grep_rules_catalog.md +6 -4
  126. package/docs/ci-bot-pr-checks.md +128 -0
  127. package/docs/configuration.md +150 -12
  128. package/docs/defect-shapes.md +107 -15
  129. package/docs/engineering-principles.md +27 -2
  130. package/docs/environment-variables.md +18 -1
  131. package/docs/features.md +14 -7
  132. package/docs/globalconfig.md +11 -3
  133. package/docs/invariants/git-guard-host.md +7 -3
  134. package/docs/invariants/language-config.md +15 -4
  135. package/docs/invariants/lsp-trust-exec.md +25 -4
  136. package/docs/invariants/paths-os.md +4 -2
  137. package/docs/invariants/session-telemetry.md +2 -2
  138. package/docs/language-coverage.md +1 -0
  139. package/docs/lsp-capability-matrix.md +167 -65
  140. package/docs/lsp-idle-eviction.md +4 -1
  141. package/docs/merge-queue-rollout.md +10 -8
  142. package/docs/module-report-read-symbol.md +34 -23
  143. package/docs/pi-lens-fixer.md +34 -17
  144. package/docs/pi-lens-investigator.md +3 -0
  145. package/docs/pi-lens-merge-policy.md +34 -17
  146. package/docs/pi-lens-monitor.md +9 -0
  147. package/docs/pi-lens-orchestration.md +4 -1
  148. package/docs/pi-lens-reviewer.md +6 -6
  149. package/docs/pi-lens-subagent.md +19 -3
  150. package/docs/public-api-stability.md +57 -7
  151. package/docs/release-qa-baseline.md +7 -4
  152. package/docs/schema/pi-lens-config-v1.json +21 -2
  153. package/docs/servercapabilities.md +3 -1
  154. package/docs/settings.md +11 -7
  155. package/docs/word-index.md +20 -7
  156. package/package.json +11 -4
  157. package/rules/ast-grep-rules/rule-tests/no-accumulating-spread-js-test.yml +37 -0
  158. package/rules/ast-grep-rules/rule-tests/ts-redundant-filter-map-test.yml +12 -1
  159. package/rules/ast-grep-rules/rule-tests-disabled/filter-then-map-js-test.yml +12 -0
  160. package/rules/ast-grep-rules/rule-tests-disabled/filter-then-map-test.yml +25 -0
  161. package/rules/ast-grep-rules/rules/no-accumulating-spread-js.yml +49 -1
  162. package/rules/ast-grep-rules/rules/no-sql-in-code-execute-js.yml +1 -2
  163. package/rules/ast-grep-rules/rules/no-sql-in-code-execute.yml +1 -2
  164. package/rules/ast-grep-rules/rules/ts-redundant-filter-map.yml +9 -1
  165. package/rules/ast-grep-rules/rules-disabled/filter-then-map-js.yml +17 -0
  166. package/rules/ast-grep-rules/rules-disabled/filter-then-map.yml +36 -0
  167. package/rules/ast-grep-rules/self-scan-baseline.json +1 -1
  168. package/scripts/download-grammars.js +3 -2
  169. package/skills/pi-lens-lsp-navigation/SKILL.md +5 -1
  170. package/dist/chunk-46TNM7XZ.js +0 -88
  171. package/dist/chunk-72OKUXSD.js +0 -31
  172. package/dist/chunk-7GLOLOSH.js +0 -57
  173. package/dist/chunk-AKUUMGD5.js +0 -26
  174. package/dist/chunk-ASUXV767.js +0 -22
  175. package/dist/chunk-CTADOKYM.js +0 -25
  176. package/dist/chunk-GNSIWBAT.js +0 -106
  177. package/dist/chunk-HWDAVBFU.js +0 -49
  178. package/dist/chunk-JJ2RRESP.js +0 -58
  179. package/dist/chunk-KXF5R4UN.js +0 -48
  180. package/dist/chunk-LSC3VADM.js +0 -23
  181. package/dist/chunk-OE5ZBP7F.js +0 -443
  182. package/dist/chunk-SHLDT3OI.js +0 -27
  183. package/dist/chunk-UF7RTZSO.js +0 -27
  184. package/dist/chunk-W4WP2ERB.js +0 -30
  185. package/dist/chunk-YES5CACN.js +0 -73
  186. package/dist/chunk-Z2XAOKHK.js +0 -136
@@ -3,51 +3,53 @@ import {
3
3
  augmentPythonEnvironment,
4
4
  detectPythonEnvironment,
5
5
  emitBounded
6
- } from "./chunk-PR6PO3ES.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-DPGEAHZT.js";
15
+ } from "./chunk-RNJFRXEN.js";
13
16
  import {
14
17
  findGlobalBinary,
15
18
  findLocalBinAt,
16
19
  localBinPath
17
- } from "./chunk-NA7SEXHE.js";
20
+ } from "./chunk-E65WJVI5.js";
18
21
  import {
19
22
  getIsolatedNpxSpawnOptions
20
- } from "./chunk-3F6BMY53.js";
23
+ } from "./chunk-L6WBJGQS.js";
21
24
  import {
22
25
  resolveLanguageRootForFile
23
- } from "./chunk-PUZ3E2J4.js";
26
+ } from "./chunk-3HTZDY3C.js";
24
27
  import {
25
28
  resolveGitCheckout,
26
29
  safeSpawn,
27
30
  safeSpawnAsync
28
- } from "./chunk-YVHBNSME.js";
31
+ } from "./chunk-TMNUTMT5.js";
29
32
  import {
30
33
  DOTNET_CSHARP_ROOT_MARKERS,
31
34
  detectFileKind
32
- } from "./chunk-RZOXUSPC.js";
35
+ } from "./chunk-CZCAZVTD.js";
33
36
  import {
34
37
  PathKeyedMap,
35
38
  detectFileRole
36
- } from "./chunk-KPPJTH44.js";
39
+ } from "./chunk-X5BJ3G2P.js";
37
40
  import {
38
41
  findNearestDirWithAnyBasename
39
- } from "./chunk-J6JP25XU.js";
42
+ } from "./chunk-NL5LSKVD.js";
40
43
  import {
41
44
  LEDGER_FIELD_MAX,
45
+ createSubsystemLogger,
42
46
  recordDegradationOnce
43
- } from "./chunk-WME2OQST.js";
44
- import {
45
- createSubsystemLogger
46
- } from "./chunk-KXF5R4UN.js";
47
+ } from "./chunk-W5E72HJA.js";
47
48
  import {
48
49
  BoundedFifoMap,
49
50
  direntsHaveMarkerGlobMatch,
50
51
  findNearestMarkerRootDetailed,
52
+ isAbsoluteFilePath,
51
53
  isRealGitMarker,
52
54
  isUnderDir,
53
55
  minimatch,
@@ -55,8 +57,10 @@ import {
55
57
  normalizeMapKey,
56
58
  pathsEqual,
57
59
  realpathOrResolve,
58
- toPosix
59
- } from "./chunk-PQJFG24Z.js";
60
+ relativeInside,
61
+ toPosix,
62
+ toProjectRelativePath
63
+ } from "./chunk-CB7PEVOJ.js";
60
64
 
61
65
  // dist/clients/test-runner-client.js
62
66
  import { createHash } from "node:crypto";
@@ -78,6 +82,9 @@ function formatRunDurationMs(duration) {
78
82
  function isRunnerErrorResult(result) {
79
83
  return result.failed === 0 && !!result.error;
80
84
  }
85
+ function isCompletedPassResult(result) {
86
+ return !result.error && !result.notRun && result.failed === 0 && result.passed > 0;
87
+ }
81
88
  var SOURCE_TO_TEST_PATTERNS = [
82
89
  {
83
90
  ext: ".ts",
@@ -207,8 +214,8 @@ function sharesCommonDir(cwd, checkoutRoot) {
207
214
  }
208
215
  function isExcludedTestTarget(testFilePath, cwd) {
209
216
  const absolute = path.resolve(cwd, toPosix(testFilePath));
210
- let rel = toPosix(path.relative(cwd, absolute));
211
- if (rel === "" || rel === ".." || rel.startsWith("../") || path.isAbsolute(rel)) {
217
+ let rel = relativeInside(cwd, absolute);
218
+ if (!rel) {
212
219
  const realTarget = canonicalFailedPath(absolute);
213
220
  const realCwd = canonicalFailedPath(cwd);
214
221
  if (pathsEqual(realTarget, realCwd) || !isUnderDir(realTarget, realCwd))
@@ -245,7 +252,8 @@ var RUNNERS = {
245
252
  "--reporter=json",
246
253
  "--passWithNoTests"
247
254
  ],
248
- parseJson: true
255
+ parseJson: true,
256
+ reportToFile: true
249
257
  },
250
258
  jest: {
251
259
  kinds: ["jsts"],
@@ -428,8 +436,9 @@ function parsePytestSummary(output) {
428
436
  let passed = 0;
429
437
  let failed = 0;
430
438
  let skipped = 0;
439
+ let errors = 0;
431
440
  if (!summaryLine)
432
- return { passed, failed, skipped };
441
+ return { passed, failed, skipped, errors };
433
442
  const summaryBody = summaryLine.replace(/^=+\s*|\s*=+\s*$/g, "");
434
443
  for (const field of summaryBody.split(",")) {
435
444
  const [countText, outcome] = field.trim().split(/\s+/, 2);
@@ -446,11 +455,15 @@ function parsePytestSummary(output) {
446
455
  case "skipped":
447
456
  skipped = count;
448
457
  break;
458
+ case "error":
459
+ case "errors":
460
+ errors = count;
461
+ break;
449
462
  }
450
463
  }
451
464
  const durationMatch = /in\s+([\d.]+)s/.exec(summaryLine);
452
465
  const duration = durationMatch ? toMeasuredDurationMs(Number.parseFloat(durationMatch[1]) * 1e3) : void 0;
453
- return { passed, failed, skipped, duration };
466
+ return { passed, failed, skipped, errors, duration };
454
467
  }
455
468
  var TestRunnerClient = class {
456
469
  log;
@@ -780,11 +793,8 @@ var TestRunnerClient = class {
780
793
  */
781
794
  relativeSourceDir(sourceFilePath, cwd) {
782
795
  const dir = path.dirname(sourceFilePath);
783
- const relDir = path.relative(cwd, path.resolve(cwd, dir));
784
- if (!relDir || relDir === "." || relDir.startsWith("..") || path.isAbsolute(relDir)) {
785
- return null;
786
- }
787
- return relDir;
796
+ const relDir = toProjectRelativePath(path.resolve(cwd, dir), cwd);
797
+ return isAbsoluteFilePath(relDir) ? null : relDir;
788
798
  }
789
799
  /**
790
800
  * Best-effort, text-only scrape of a vitest config's `test.include` /
@@ -911,7 +921,7 @@ var TestRunnerClient = class {
911
921
  if (runner === "vitest") {
912
922
  const globs = this.parseVitestTestGlobs(cwd);
913
923
  if (globs) {
914
- const rel = path.relative(cwd, path.resolve(cwd, sourceFilePath)).replace(/\\/g, "/");
924
+ const rel = toPosix(path.relative(cwd, path.resolve(cwd, sourceFilePath)));
915
925
  const matches = (globs_, filter) => !!globs_?.some((g) => (!filter || filter(g)) && minimatch(rel, g, { dot: true }));
916
926
  if (matches(globs.exclude)) {
917
927
  result = false;
@@ -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,
@@ -3,14 +3,19 @@ import {
3
3
  buildSymbolId
4
4
  } from "./chunk-3MED75HT.js";
5
5
  import {
6
+ UNRESOLVED_NAME_NODE_PREFIX
7
+ } from "./chunk-PKLB2XJL.js";
8
+ import {
9
+ LspRequestTimeoutError,
6
10
  buildReverseDependencyIndexFromGraph,
7
11
  getLSPService,
12
+ isLspRequestTimeoutError,
8
13
  rankFilesByReverseDependencyCentrality
9
- } from "./chunk-FZKFVUEC.js";
14
+ } from "./chunk-OUYAUXAT.js";
10
15
  import {
11
16
  notePersistWorkerMessageFault,
12
17
  readWorkerHeapStatistics
13
- } from "./chunk-RC2Z6K47.js";
18
+ } from "./chunk-PRHYIA6X.js";
14
19
  import {
15
20
  buildQualifiedName,
16
21
  findOwnerName
@@ -26,59 +31,60 @@ import {
26
31
  resolveProjectReferenceImport,
27
32
  resolveWorkspacePackageImport,
28
33
  symbolExtractionGrammar
29
- } from "./chunk-MPKRJBPK.js";
34
+ } from "./chunk-L7O774U7.js";
30
35
  import {
31
36
  classifyTreeSitterWasmError,
32
37
  getSharedTreeSitterClient,
33
38
  logTreeSitterCacheStats,
34
39
  withTreeSitterRoot
35
- } from "./chunk-L5JYIU47.js";
40
+ } from "./chunk-ZZSJAR76.js";
36
41
  import {
37
42
  getReviewGraphMaxFilesDerived
38
- } from "./chunk-QOE342SU.js";
43
+ } from "./chunk-MRLH4MYU.js";
44
+ import {
45
+ withBudget
46
+ } from "./chunk-MKPDIAZH.js";
39
47
  import {
40
48
  readGzipStageWorkerResult,
41
49
  reapStageFile
42
50
  } from "./chunk-IJYGIDF4.js";
43
51
  import {
44
52
  collectSourceFilesWithBudgetAsync
45
- } from "./chunk-EKWX4WD3.js";
53
+ } from "./chunk-RNXOWDM6.js";
46
54
  import {
47
55
  collectUntrackedIgnoredIds,
48
56
  createGitIdentityResolver,
49
57
  getProjectDataDir,
50
58
  isStaleStageFile,
51
59
  resolveGitIdentity
52
- } from "./chunk-YVHBNSME.js";
60
+ } from "./chunk-TMNUTMT5.js";
53
61
  import {
54
62
  KIND_EXTENSIONS,
55
63
  detectFileKind
56
- } from "./chunk-RZOXUSPC.js";
64
+ } from "./chunk-CZCAZVTD.js";
57
65
  import {
58
66
  detectFileRole
59
- } from "./chunk-KPPJTH44.js";
67
+ } from "./chunk-X5BJ3G2P.js";
60
68
  import {
61
69
  writeFileAtomic
62
- } from "./chunk-U5HPROLA.js";
70
+ } from "./chunk-PIIUNJIT.js";
63
71
  import {
64
72
  compareOrdinal,
65
73
  escapeRegExp,
66
74
  incrementDegradationCount
67
- } from "./chunk-WME2OQST.js";
68
- import {
69
- logLatency
70
- } from "./chunk-Z2XAOKHK.js";
75
+ } from "./chunk-W5E72HJA.js";
71
76
  import {
72
77
  createNdjsonLogger,
73
78
  getGlobalPiLensLogDir,
74
79
  getMaxLogSizeMB,
75
80
  getTurnId,
76
81
  isTestMode,
77
- lazyEnvNumber
78
- } from "./chunk-VSFLRN5Y.js";
82
+ lazyEnvNumber,
83
+ logLatency
84
+ } from "./chunk-VCRVNLE7.js";
79
85
  import {
80
86
  FactStore
81
- } from "./chunk-OSTKYB55.js";
87
+ } from "./chunk-ZMMHHXSW.js";
82
88
  import {
83
89
  BoundedFifoMap,
84
90
  BoundedLruCache,
@@ -87,8 +93,9 @@ import {
87
93
  normalizeFilePath,
88
94
  normalizeMapKey,
89
95
  realpathOrResolve,
96
+ toPosix,
90
97
  toProjectRelativePath
91
- } from "./chunk-PQJFG24Z.js";
98
+ } from "./chunk-CB7PEVOJ.js";
92
99
 
93
100
  // dist/clients/review-graph/builder.js
94
101
  import { createHash as createHash2 } from "node:crypto";
@@ -121,7 +128,7 @@ var fileContentProvider = {
121
128
 
122
129
  // dist/clients/feature-hints.js
123
130
  function normalizeHintInput(value) {
124
- return value.replace(/\\/g, "/");
131
+ return toPosix(value);
125
132
  }
126
133
  function hasHintToken(value, tokens) {
127
134
  const escaped = tokens.map((token) => escapeRegExp(token));
@@ -246,19 +253,17 @@ async function getOpenDocumentSymbols(filePath, timeoutMs = LSP_DOCUMENT_SYMBOL_
246
253
  if (!spawned || !spawned.client.isDocumentOpen(filePath) || !spawned.client.getOperationSupport().documentSymbol) {
247
254
  return void 0;
248
255
  }
249
- let timer;
250
256
  try {
251
- return await Promise.race([
252
- spawned.client.documentSymbol(filePath),
253
- new Promise((resolve2) => {
254
- timer = setTimeout(() => resolve2(void 0), timeoutMs);
255
- })
256
- ]);
257
- } catch {
257
+ const startedAt = Date.now();
258
+ const symbols = await withBudget(spawned.client.documentSymbol(filePath), timeoutMs);
259
+ if (symbols === void 0) {
260
+ throw new LspRequestTimeoutError("textDocument/documentSymbol", timeoutMs, Date.now() - startedAt);
261
+ }
262
+ return symbols;
263
+ } catch (err) {
264
+ if (isLspRequestTimeoutError(err))
265
+ throw err;
258
266
  return void 0;
259
- } finally {
260
- if (timer)
261
- clearTimeout(timer);
262
267
  }
263
268
  }
264
269
  function containerNameChain(symbol, allSymbols) {
@@ -2480,8 +2485,8 @@ async function ensureReviewGraphFacts(filePath, cwd, facts, contentOverride) {
2480
2485
  }
2481
2486
  try {
2482
2487
  const [{ importFactProvider }, { functionFactProvider }] = await Promise.all([
2483
- import("./chunk-W4WP2ERB.js"),
2484
- import("./chunk-72OKUXSD.js")
2488
+ import("./chunk-H6FLQ5NW.js"),
2489
+ import("./chunk-UTJP6WOS.js")
2485
2490
  ]);
2486
2491
  await importFactProvider.run(ctx, facts);
2487
2492
  await functionFactProvider.run(ctx, facts);
@@ -2656,7 +2661,7 @@ function addJsTsFile(graph, cwd, filePath, facts, ignoredIds) {
2656
2661
  for (const callee of fn.outgoingCalls) {
2657
2662
  if (memberCallTexts.has(callee))
2658
2663
  continue;
2659
- const targetId = callee.includes(".") ? `external:${callee}` : `symbol-name:${callee}`;
2664
+ const targetId = callee.includes(".") ? `external:${callee}` : `${UNRESOLVED_NAME_NODE_PREFIX}${callee}`;
2660
2665
  if (!graph.nodes.has(targetId)) {
2661
2666
  addNode(graph, {
2662
2667
  id: targetId,
@@ -2855,7 +2860,7 @@ function addTreeSitterFile(graph, cwd, filePath, languageId, extracted, ignoredI
2855
2860
  }
2856
2861
  for (const ref of extracted.refs) {
2857
2862
  const refName = ref.symbolName ?? ref.symbolId;
2858
- const targetId = `symbol-name:${refName}`;
2863
+ const targetId = `${UNRESOLVED_NAME_NODE_PREFIX}${refName}`;
2859
2864
  if (!graph.nodes.has(targetId)) {
2860
2865
  addNode(graph, {
2861
2866
  id: targetId,
@@ -3143,12 +3148,23 @@ async function addFileToGraph(graph, cwd, file, ignoredIds, contentOverride) {
3143
3148
  _wasmTrappedFiles.delete(file);
3144
3149
  addTreeSitterFile(graph, cwd, file, languageId, extracted, ignoredIds);
3145
3150
  if (extracted.symbols.length === 0) {
3146
- const lspSymbols = await getOpenDocumentSymbols(file);
3151
+ let lspSymbols;
3152
+ let lspSymbolTimedOut = false;
3153
+ let lspSymbolError;
3154
+ try {
3155
+ lspSymbols = await getOpenDocumentSymbols(file);
3156
+ } catch (err) {
3157
+ if (isLspRequestTimeoutError(err))
3158
+ lspSymbolTimedOut = true;
3159
+ else
3160
+ lspSymbolError = String(err instanceof Error ? err.message : err).slice(0, 512);
3161
+ }
3147
3162
  const added = lspSymbols ? addLspFallbackSymbols(graph, file, languageId, lspSymbols) : 0;
3148
3163
  logReviewGraph({
3149
3164
  phase: "lsp_symbol_fallback",
3150
3165
  cwd,
3151
- reason: lspSymbols ? added > 0 ? "added" : "empty-response" : "unavailable-or-failed",
3166
+ reason: lspSymbolTimedOut ? "timeout" : lspSymbols ? added > 0 ? "added" : "empty-response" : lspSymbolError !== void 0 ? "failed" : "unavailable",
3167
+ ...lspSymbolError !== void 0 && { error: lspSymbolError },
3152
3168
  nodes: added
3153
3169
  });
3154
3170
  }
@@ -4106,7 +4122,7 @@ function extractSymbolsAndRefsFromGraph(graph) {
4106
4122
  const referenceKind = edge.kind === "calls" ? "call" : metadata.referenceKind === "call" ? "call" : metadata.referenceKind === "type" ? "type" : "unknown";
4107
4123
  const resolution = edge.resolution ?? (targetNode && !targetNode.metadata?.unresolvedName ? "exact" : "unresolved");
4108
4124
  const targetSymbol = nodeSymbols.get(edge.to);
4109
- const targetName = targetNode?.symbolName ?? (edge.to.startsWith("symbol-name:") ? edge.to.slice("symbol-name:".length) : void 0);
4125
+ const targetName = targetNode?.symbolName ?? (edge.to.startsWith(UNRESOLVED_NAME_NODE_PREFIX) ? edge.to.slice(UNRESOLVED_NAME_NODE_PREFIX.length) : void 0);
4110
4126
  const line = typeof metadata.line === "number" ? metadata.line : numberMetadata(fromNode, "line") ?? 1;
4111
4127
  const column = typeof metadata.column === "number" ? metadata.column : numberMetadata(fromNode, "column") ?? 1;
4112
4128
  addRef({
@@ -1,10 +1,8 @@
1
1
  import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
2
  import {
3
+ getProcessSingleton,
3
4
  logLatency
4
- } from "./chunk-Z2XAOKHK.js";
5
- import {
6
- getProcessSingleton
7
- } from "./chunk-VSFLRN5Y.js";
5
+ } from "./chunk-VCRVNLE7.js";
8
6
 
9
7
  // dist/clients/lsp/workspace-sweep-hold.js
10
8
  var SWEEP_IDLE_SAFETY_MARGIN_MS = 6e4;