pi-lens 4.4.0 → 4.4.2

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 (150) hide show
  1. package/CHANGELOG.md +158 -0
  2. package/README.md +1 -0
  3. package/config/dependency-cruiser-eager-allowlist.json +3 -1
  4. package/dist/{chunk-IXEBJSUE.js → chunk-23WOO7TX.js} +11 -10
  5. package/dist/{chunk-E2WFBRHM.js → chunk-2B73ZPOK.js} +3 -3
  6. package/dist/{chunk-DQ2NZ7C4.js → chunk-2BBLFX75.js} +139 -11
  7. package/dist/{chunk-ZMOL6RQC.js → chunk-2CD5RS6M.js} +2 -2
  8. package/dist/{chunk-VD4JQCQC.js → chunk-2ZGIZPDG.js} +38 -37
  9. package/dist/{chunk-DIULIWKU.js → chunk-34WSVGEM.js} +29 -3
  10. package/dist/chunk-3JNKMP3B.js +17 -0
  11. package/dist/{chunk-HVUZXSWK.js → chunk-3UUPUE3O.js} +45 -41
  12. package/dist/{chunk-5RXBNSW2.js → chunk-3VPVG5SU.js} +16 -8
  13. package/dist/chunk-3WA4HP4I.js +55 -0
  14. package/dist/chunk-466Z26MG.js +30 -0
  15. package/dist/{chunk-34U7PLGE.js → chunk-4UNXBNE2.js} +12 -11
  16. package/dist/{chunk-E4MAEDPM.js → chunk-4W4VLAPJ.js} +12 -11
  17. package/dist/{chunk-GUOGVTCQ.js → chunk-52FUZI6K.js} +4 -2
  18. package/dist/chunk-5JM2524W.js +84 -0
  19. package/dist/{chunk-VHQLPIRJ.js → chunk-5NGR67U5.js} +2 -2
  20. package/dist/{chunk-DFVMIKMQ.js → chunk-66SXUJCA.js} +45 -9
  21. package/dist/{chunk-OQGFCZJ4.js → chunk-66VMUL7Q.js} +16 -16
  22. package/dist/{chunk-HWBZIGMJ.js → chunk-67WMNWEE.js} +9 -8
  23. package/dist/{chunk-6QIUX4EP.js → chunk-6C7JWPCP.js} +7 -7
  24. package/dist/{chunk-47D2BO4S.js → chunk-6GFRNVYR.js} +11 -10
  25. package/dist/{chunk-ZAWW3AF6.js → chunk-6SDEP3AJ.js} +9 -8
  26. package/dist/{chunk-TGPXLY2J.js → chunk-724UL2TJ.js} +38 -2
  27. package/dist/{chunk-YLF3PPT5.js → chunk-76MWC2K6.js} +3 -3
  28. package/dist/{chunk-F3P7VQ7H.js → chunk-7DYBLXYA.js} +3 -3
  29. package/dist/{chunk-AJ3QXTRQ.js → chunk-7ULNCDCO.js} +37 -35
  30. package/dist/{chunk-UK3CMEAL.js → chunk-AOHZU2BM.js} +1 -1
  31. package/dist/{chunk-F3AU2TMM.js → chunk-ARJ6PLFH.js} +44 -28
  32. package/dist/{chunk-U3VGR4VU.js → chunk-AW7R2GWG.js} +65 -8
  33. package/dist/{chunk-FJNKANOS.js → chunk-BKE7E7TC.js} +10 -9
  34. package/dist/{chunk-4W2PLC4J.js → chunk-BRGDSBJE.js} +13 -12
  35. package/dist/{chunk-VN2AXLEX.js → chunk-C34ZXZ7O.js} +102 -16
  36. package/dist/{chunk-T4ERT73Y.js → chunk-CF24OIYI.js} +21 -20
  37. package/dist/{chunk-NMABWBZN.js → chunk-CHOW74WE.js} +1 -1
  38. package/dist/{chunk-ARFCXG7S.js → chunk-CO2G5PHH.js} +2 -2
  39. package/dist/{chunk-AS44CFQ4.js → chunk-EETY4LF7.js} +24 -10
  40. package/dist/{chunk-I3R7GKDR.js → chunk-EJIUXPBX.js} +1 -1
  41. package/dist/{chunk-B3I2UUT4.js → chunk-ESBQHFMJ.js} +653 -251
  42. package/dist/{chunk-O5WILGMI.js → chunk-FLKWCIZH.js} +8 -5
  43. package/dist/{chunk-LNAKEO63.js → chunk-GAEGEPOC.js} +4 -4
  44. package/dist/{chunk-V7R425XG.js → chunk-GBPP5P7X.js} +4 -4
  45. package/dist/{chunk-XK4CIILI.js → chunk-GHB6AYCP.js} +27 -26
  46. package/dist/{chunk-7FBF7NPR.js → chunk-GOYRYZ2R.js} +29 -26
  47. package/dist/{chunk-JOLITGCC.js → chunk-GXW6K4YJ.js} +1 -1
  48. package/dist/{chunk-NXPS2L6U.js → chunk-GZYBXISR.js} +9 -9
  49. package/dist/{chunk-OAXNDZJ7.js → chunk-IBGIOBEE.js} +8 -4
  50. package/dist/{chunk-IIXOAGHR.js → chunk-IBRALRBR.js} +19 -15
  51. package/dist/{chunk-7F72PXY2.js → chunk-IXXDFY73.js} +3 -3
  52. package/dist/chunk-IZSHAIJ7.js +26 -0
  53. package/dist/{chunk-N3YQJI6O.js → chunk-JAU72XNY.js} +20 -15
  54. package/dist/chunk-JMYYOTQG.js +77 -0
  55. package/dist/{chunk-NL5GLMFI.js → chunk-JSQFTSC6.js} +12 -11
  56. package/dist/{chunk-IVP5KAB7.js → chunk-JWA5I3SR.js} +35 -21
  57. package/dist/{chunk-Y4T27COV.js → chunk-KBG47GHP.js} +4 -4
  58. package/dist/{chunk-PWFHBTSF.js → chunk-L3BLXZG7.js} +2 -2
  59. package/dist/chunk-LOP6GRPH.js +31 -0
  60. package/dist/chunk-MQLUAEOC.js +162 -0
  61. package/dist/{chunk-RPD5K5NC.js → chunk-MRXKYPCS.js} +2 -2
  62. package/dist/{chunk-Q5U6FMDI.js → chunk-N2H3ZPZY.js} +59 -7
  63. package/dist/{chunk-27BBHSZC.js → chunk-N3X6Q4YT.js} +3 -3
  64. package/dist/{chunk-UY752QSN.js → chunk-NW7BOILN.js} +19 -17
  65. package/dist/{chunk-TLGFBM3F.js → chunk-ODBNXWT4.js} +302 -113
  66. package/dist/{chunk-TT22N74J.js → chunk-OG5UUPN7.js} +13 -13
  67. package/dist/{chunk-C2AUYXQH.js → chunk-OXXKQCSV.js} +6 -6
  68. package/dist/{chunk-PAK6IDME.js → chunk-P7266HLM.js} +2 -2
  69. package/dist/{chunk-52H5B5TC.js → chunk-PFNSLWU5.js} +31 -30
  70. package/dist/{chunk-5ZEJHV35.js → chunk-PHDMFAKM.js} +12 -2
  71. package/dist/{chunk-3I5QFT3N.js → chunk-PNQDPDRC.js} +6 -3
  72. package/dist/{chunk-TVN5N6GY.js → chunk-PV6LR5P5.js} +6057 -1311
  73. package/dist/{chunk-AHDW3GPE.js → chunk-Q6ZWTCLY.js} +24 -22
  74. package/dist/{chunk-RUOG5D2C.js → chunk-Q7DUK4LX.js} +5 -5
  75. package/dist/{chunk-YSNFMJKN.js → chunk-QGQ5CCCG.js} +2 -2
  76. package/dist/{chunk-LW6XKDZQ.js → chunk-QHJ6DQ2R.js} +287 -38
  77. package/dist/{chunk-GVXA6CCE.js → chunk-QILIYSJF.js} +1 -1
  78. package/dist/{chunk-22AVIGXS.js → chunk-QOBUHWHX.js} +12 -7
  79. package/dist/{chunk-5THXD6X5.js → chunk-QQNQ7SJW.js} +2 -75
  80. package/dist/{chunk-4RERDEXR.js → chunk-QZVW3AAK.js} +50 -41
  81. package/dist/{chunk-AWE5TMPO.js → chunk-R3PCY3YS.js} +14 -13
  82. package/dist/{chunk-HHYAELLJ.js → chunk-RPLINGVB.js} +7 -7
  83. package/dist/{chunk-EOKRQ3SA.js → chunk-RWWYJ623.js} +10 -1
  84. package/dist/{chunk-YGVYKNSN.js → chunk-SAEFPSB6.js} +59 -12
  85. package/dist/{chunk-K6VYLB2U.js → chunk-TYM6OUIT.js} +13 -12
  86. package/dist/{chunk-AJXODZY6.js → chunk-UXGETRP4.js} +13 -12
  87. package/dist/{chunk-I7SPGOWI.js → chunk-UZ3TUTRV.js} +1 -1
  88. package/dist/{chunk-TO6WL3GM.js → chunk-VCHXCQFG.js} +12 -2
  89. package/dist/{chunk-BRJKOBZP.js → chunk-VITUCP5A.js} +17 -6
  90. package/dist/{chunk-WONERJTP.js → chunk-VRZP76YM.js} +1 -1
  91. package/dist/{chunk-OS32RNR2.js → chunk-VSSBEUFT.js} +16 -15
  92. package/dist/{chunk-VDBPVIKD.js → chunk-VWCXW2E7.js} +1 -1
  93. package/dist/{chunk-NKOUFPQF.js → chunk-WOA4LN2R.js} +2 -2
  94. package/dist/{chunk-RIISMHKN.js → chunk-WOKKRCJ5.js} +15 -13
  95. package/dist/{chunk-XECLWQZN.js → chunk-WU567RSC.js} +13 -10
  96. package/dist/{chunk-V5PXFSZK.js → chunk-XCJN5IJU.js} +4 -4
  97. package/dist/{chunk-ORTMY4Q4.js → chunk-XKIZ2HNN.js} +22 -14
  98. package/dist/{chunk-6VCD4VKZ.js → chunk-XMSXXAHW.js} +2 -2
  99. package/dist/chunk-XPZPXCBV.js +28 -0
  100. package/dist/{chunk-O6TQT6RI.js → chunk-XTMJ7XDT.js} +1 -1
  101. package/dist/{chunk-VNMT7C64.js → chunk-XVF2VVXP.js} +5 -3
  102. package/dist/chunk-Z527N6YQ.js +28 -0
  103. package/dist/{chunk-NTUJEGDZ.js → chunk-ZANLILYD.js} +22 -2
  104. package/dist/{chunk-6P62QVEA.js → chunk-ZGDGW2V3.js} +2 -2
  105. package/dist/{chunk-ODEEOXPH.js → chunk-ZHFZWTZV.js} +12 -11
  106. package/dist/{chunk-AJVLWNFN.js → chunk-ZXYDQ3TZ.js} +5 -5
  107. package/dist/index.js +102097 -97778
  108. package/dist/mcp/analyze-cli.js +18 -8
  109. package/dist/mcp/cli.js +48 -37
  110. package/dist/mcp/server.js +695 -426
  111. package/dist/mcp/worker.js +66 -55
  112. package/dist/probes/installer.js +20 -19
  113. package/docs/ast-grep_rules_catalog.md +2 -2
  114. package/docs/astplayground.md +1 -1
  115. package/docs/configuration.md +38 -2
  116. package/docs/custom-rules.md +25 -2
  117. package/docs/dependencies.md +3 -0
  118. package/docs/environment-variables.md +34 -6
  119. package/docs/features.md +39 -3
  120. package/docs/globalconfig.md +3 -1
  121. package/docs/language-coverage.md +2 -1
  122. package/docs/lsp-capability-matrix.md +29 -6
  123. package/docs/lsp-idle-eviction.md +38 -47
  124. package/docs/pi-lens-fixer.md +13 -5
  125. package/docs/pi-lens-merge-policy.md +48 -1
  126. package/docs/pi-lens-monitor.md +3 -1
  127. package/docs/pi-lens-retro.md +2 -1
  128. package/docs/pi-lens-reviewer.md +19 -3
  129. package/docs/pi-lens-subagent.md +2 -0
  130. package/docs/real-harness.md +17 -0
  131. package/docs/schema/pi-lens-config-v1.json +565 -0
  132. package/docs/servercapabilities.md +18 -4
  133. package/docs/settings.md +2 -1
  134. package/docs/word-index.md +6 -0
  135. package/package.json +1 -1
  136. package/rules/ast-grep-rules/rule-tests/no-identity-operator-on-literals-test.yml +12 -2
  137. package/rules/ast-grep-rules/rule-tests/throw-new-error-js-test.yml +2 -0
  138. package/rules/ast-grep-rules/rule-tests/throw-new-error-test.yml +2 -0
  139. package/rules/ast-grep-rules/rules/no-identity-operator-on-literals.yml +20 -12
  140. package/rules/ast-grep-rules/rules/throw-new-error-js.yml +2 -2
  141. package/rules/ast-grep-rules/rules/throw-new-error.yml +2 -2
  142. package/dist/chunk-54B42YRX.js +0 -27
  143. package/dist/chunk-CGGAIP7J.js +0 -29
  144. package/dist/chunk-D6QS3U6M.js +0 -30
  145. package/dist/chunk-HMFXILPV.js +0 -83
  146. package/dist/chunk-LSMJ6KBE.js +0 -4139
  147. package/dist/chunk-NTHH2J74.js +0 -27
  148. package/dist/chunk-RPD4ZSB7.js +0 -25
  149. package/dist/chunk-T6D4Q4AQ.js +0 -54
  150. package/dist/chunk-VCSRSYLF.js +0 -81
@@ -1,21 +1,22 @@
1
1
  import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
2
  import {
3
3
  collectSourceFiles
4
- } from "./chunk-6QIUX4EP.js";
5
- import "./chunk-VHQLPIRJ.js";
6
- import "./chunk-VN2AXLEX.js";
4
+ } from "./chunk-6C7JWPCP.js";
5
+ import "./chunk-5NGR67U5.js";
6
+ import "./chunk-C34ZXZ7O.js";
7
7
  import "./chunk-QYF5S6P6.js";
8
- import "./chunk-5ZEJHV35.js";
9
- import "./chunk-DQ2NZ7C4.js";
10
- import "./chunk-VNMT7C64.js";
8
+ import "./chunk-PHDMFAKM.js";
9
+ import "./chunk-2BBLFX75.js";
10
+ import "./chunk-XVF2VVXP.js";
11
11
  import "./chunk-2EECBNC5.js";
12
- import "./chunk-N3YQJI6O.js";
13
- import "./chunk-O6TQT6RI.js";
14
- import "./chunk-5THXD6X5.js";
15
- import "./chunk-UK3CMEAL.js";
12
+ import "./chunk-JAU72XNY.js";
13
+ import "./chunk-XTMJ7XDT.js";
14
+ import "./chunk-JMYYOTQG.js";
15
+ import "./chunk-QQNQ7SJW.js";
16
+ import "./chunk-AOHZU2BM.js";
16
17
  import "./chunk-LJDODBBZ.js";
17
18
  import "./chunk-ABBOA7UD.js";
18
- import "./chunk-Q5U6FMDI.js";
19
+ import "./chunk-N2H3ZPZY.js";
19
20
  import "./chunk-NXL4FFQQ.js";
20
21
 
21
22
  // dist/clients/todo-scanner.js
@@ -2,48 +2,53 @@ import { createRequire as __pilensCreateRequire } from "node:module"; const requ
2
2
  import {
3
3
  stripAnsi
4
4
  } from "./chunk-FC4RP4I2.js";
5
- import {
6
- resolveGitCheckout
7
- } from "./chunk-3I5QFT3N.js";
8
5
  import {
9
6
  emitBounded
10
- } from "./chunk-ARFCXG7S.js";
7
+ } from "./chunk-CO2G5PHH.js";
8
+ import {
9
+ resolveGitCheckout
10
+ } from "./chunk-PNQDPDRC.js";
11
11
  import {
12
12
  augmentPythonEnvironment,
13
13
  detectPythonEnvironment
14
- } from "./chunk-DIULIWKU.js";
14
+ } from "./chunk-34WSVGEM.js";
15
15
  import {
16
16
  PathKeyedMap
17
17
  } from "./chunk-Z3CCVDUB.js";
18
18
  import {
19
19
  resolveToolCwd
20
- } from "./chunk-RUOG5D2C.js";
20
+ } from "./chunk-Q7DUK4LX.js";
21
+ import {
22
+ findGlobalBinary,
23
+ findLocalBinAt,
24
+ localBinPath
25
+ } from "./chunk-AW7R2GWG.js";
21
26
  import {
22
- findGlobalBinary
23
- } from "./chunk-U3VGR4VU.js";
27
+ getIsolatedNpxSpawnOptions
28
+ } from "./chunk-RWWYJ623.js";
24
29
  import {
25
30
  resolveLanguageRootForFile
26
- } from "./chunk-22AVIGXS.js";
31
+ } from "./chunk-QOBUHWHX.js";
27
32
  import {
28
33
  safeSpawn,
29
34
  safeSpawnAsync
30
- } from "./chunk-VN2AXLEX.js";
35
+ } from "./chunk-C34ZXZ7O.js";
31
36
  import {
32
37
  detectFileKind
33
- } from "./chunk-5ZEJHV35.js";
38
+ } from "./chunk-PHDMFAKM.js";
34
39
  import {
35
40
  detectFileRole
36
- } from "./chunk-DQ2NZ7C4.js";
41
+ } from "./chunk-2BBLFX75.js";
37
42
  import {
38
43
  findNearestDirWithAnyBasename
39
- } from "./chunk-VNMT7C64.js";
44
+ } from "./chunk-XVF2VVXP.js";
40
45
  import {
41
46
  LEDGER_FIELD_MAX,
42
47
  recordDegradationOnce
43
- } from "./chunk-N3YQJI6O.js";
48
+ } from "./chunk-JAU72XNY.js";
44
49
  import {
45
50
  createSubsystemLogger
46
- } from "./chunk-O6TQT6RI.js";
51
+ } from "./chunk-XTMJ7XDT.js";
47
52
  import {
48
53
  BoundedFifoMap
49
54
  } from "./chunk-ABBOA7UD.js";
@@ -56,7 +61,7 @@ import {
56
61
  normalizeMapKey,
57
62
  pathsEqual,
58
63
  toPosix
59
- } from "./chunk-Q5U6FMDI.js";
64
+ } from "./chunk-N2H3ZPZY.js";
60
65
 
61
66
  // dist/clients/test-runner-client.js
62
67
  import { createHash } from "node:crypto";
@@ -1137,6 +1142,9 @@ var TestRunnerClient = class {
1137
1142
  cwd: spawnCwd,
1138
1143
  timeout: 6e4,
1139
1144
  env,
1145
+ // ONE neutral-cwd seam for npx/bunx fallbacks (#4193, #4268
1146
+ // acceptance 3); a resolved runner binary keeps the project cwd.
1147
+ ...command === "npx" || command === "bunx" ? getIsolatedNpxSpawnOptions() : {},
1140
1148
  // #2522 R2 F1. `safeSpawnAsync` resolves `options.signal ?? ambient`,
1141
1149
  // so an absent batch signal keeps the pre-#2522 ambient behaviour.
1142
1150
  signal
@@ -1516,7 +1524,7 @@ ${stderr}`;
1516
1524
  ...location === void 0 ? {} : { location }
1517
1525
  });
1518
1526
  }
1519
- const tracebackRegex = /_{10,}\s*\n\s*(\w+Error:\s*.+?)(?:\n|$)/gs;
1527
+ const tracebackRegex = /(?<!_)_{10,}[^\S\n]*\n\s*(\w+Error:\s*.+?)(?:\n|$)/gs;
1520
1528
  while ((match = tracebackRegex.exec(output)) !== null) {
1521
1529
  if (failures.length > 0 && !failures[failures.length - 1].stack) {
1522
1530
  failures[failures.length - 1].stack = match[1].trim().slice(0, 1e3);
@@ -2135,8 +2143,11 @@ ${stderr}`;
2135
2143
  }
2136
2144
  if (runner === "phpunit") {
2137
2145
  const suffix2 = process.platform === "win32" ? ".bat" : "";
2138
- const vendorBin = path.join(cwd, "vendor", "bin", `phpunit${suffix2}`);
2139
- if (fs.existsSync(vendorBin)) {
2146
+ const vendorBin = localBinPath(findLocalBinAt("phpunit", cwd, {
2147
+ windowsExt: suffix2,
2148
+ binDirs: [path.join("vendor", "bin")]
2149
+ }));
2150
+ if (vendorBin) {
2140
2151
  return {
2141
2152
  command: vendorBin,
2142
2153
  args: config.args(testFile, spawnCwd),
@@ -2151,8 +2162,11 @@ ${stderr}`;
2151
2162
  }
2152
2163
  const binName = config.binName ?? runner;
2153
2164
  const suffix = process.platform === "win32" ? ".cmd" : "";
2154
- const localBin = path.join(cwd, "node_modules", ".bin", binName + suffix);
2155
- if (fs.existsSync(localBin)) {
2165
+ const localBin = localBinPath(findLocalBinAt(binName, cwd, {
2166
+ windowsExt: suffix,
2167
+ binDirs: [path.join("node_modules", ".bin")]
2168
+ }));
2169
+ if (localBin) {
2156
2170
  return {
2157
2171
  command: localBin,
2158
2172
  args: stripWrapperArgs(binName, config.args(testFile, spawnCwd)),
@@ -2,17 +2,17 @@ import { createRequire as __pilensCreateRequire } from "node:module"; const requ
2
2
  import {
3
3
  freshnessFromMtime,
4
4
  resolveRunnerPath
5
- } from "./chunk-PWFHBTSF.js";
5
+ } from "./chunk-L3BLXZG7.js";
6
6
  import {
7
7
  translateGuidanceToolNames
8
- } from "./chunk-N3YQJI6O.js";
8
+ } from "./chunk-JAU72XNY.js";
9
9
  import {
10
10
  logLatency
11
- } from "./chunk-5THXD6X5.js";
11
+ } from "./chunk-QQNQ7SJW.js";
12
12
  import {
13
13
  normalizeMapKey,
14
14
  toProjectRelativePath
15
- } from "./chunk-Q5U6FMDI.js";
15
+ } from "./chunk-N2H3ZPZY.js";
16
16
 
17
17
  // dist/clients/advisory-provenance.js
18
18
  import { createHash } from "node:crypto";
@@ -5,10 +5,10 @@ import {
5
5
  } from "./chunk-2EECBNC5.js";
6
6
  import {
7
7
  incrementDegradationCount
8
- } from "./chunk-N3YQJI6O.js";
8
+ } from "./chunk-JAU72XNY.js";
9
9
  import {
10
10
  normalizeMapKey
11
- } from "./chunk-Q5U6FMDI.js";
11
+ } from "./chunk-N2H3ZPZY.js";
12
12
 
13
13
  // dist/clients/mcp/ipc.js
14
14
  import * as crypto from "node:crypto";
@@ -0,0 +1,31 @@
1
+ import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
+ import {
3
+ calcCyclomaticComplexity,
4
+ functionFactProvider
5
+ } from "./chunk-76MWC2K6.js";
6
+ import "./chunk-GXW6K4YJ.js";
7
+ import "./chunk-5W3R6LFT.js";
8
+ import "./chunk-QHJ6DQ2R.js";
9
+ import "./chunk-Z54ZSOBZ.js";
10
+ import "./chunk-724UL2TJ.js";
11
+ import "./chunk-QOZXJ4NA.js";
12
+ import "./chunk-VRZP76YM.js";
13
+ import "./chunk-C34ZXZ7O.js";
14
+ import "./chunk-PHDMFAKM.js";
15
+ import "./chunk-2BBLFX75.js";
16
+ import "./chunk-XVF2VVXP.js";
17
+ import "./chunk-ZANLILYD.js";
18
+ import "./chunk-2EECBNC5.js";
19
+ import "./chunk-JAU72XNY.js";
20
+ import "./chunk-XTMJ7XDT.js";
21
+ import "./chunk-JMYYOTQG.js";
22
+ import "./chunk-QQNQ7SJW.js";
23
+ import "./chunk-AOHZU2BM.js";
24
+ import "./chunk-LJDODBBZ.js";
25
+ import "./chunk-ABBOA7UD.js";
26
+ import "./chunk-N2H3ZPZY.js";
27
+ import "./chunk-NXL4FFQQ.js";
28
+ export {
29
+ calcCyclomaticComplexity,
30
+ functionFactProvider
31
+ };
@@ -0,0 +1,162 @@
1
+ import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
+ import {
3
+ logLatency
4
+ } from "./chunk-QQNQ7SJW.js";
5
+ import {
6
+ getProcessSingleton
7
+ } from "./chunk-AOHZU2BM.js";
8
+
9
+ // dist/clients/lsp/workspace-sweep-hold.js
10
+ var SWEEP_IDLE_SAFETY_MARGIN_MS = 6e4;
11
+ var WORKSPACE_SWEEP_HOLD_FAMILY = "lsp.workspace-sweep-hold";
12
+ var WORKSPACE_SWEEP_HOLD_VERSION = 1;
13
+ function state() {
14
+ return getProcessSingleton(WORKSPACE_SWEEP_HOLD_FAMILY, WORKSPACE_SWEEP_HOLD_VERSION, () => ({ holds: /* @__PURE__ */ new Map(), nextHoldId: 1, idleWaiters: [] }));
15
+ }
16
+ function flushIdleWaitersIfEmpty() {
17
+ const current = state();
18
+ if (current.holds.size > 0)
19
+ return;
20
+ if (current.idleWaiters.length === 0)
21
+ return;
22
+ const waiters = current.idleWaiters;
23
+ current.idleWaiters = [];
24
+ for (const waiter of waiters) {
25
+ try {
26
+ waiter();
27
+ } catch {
28
+ }
29
+ }
30
+ }
31
+ function getWorkspaceSweepMaxHoldAgeMs() {
32
+ return getFullScanWallClockMs() + SWEEP_IDLE_SAFETY_MARGIN_MS;
33
+ }
34
+ function reapStaleHolds() {
35
+ const current = state();
36
+ if (current.holds.size === 0)
37
+ return;
38
+ const maxAgeMs = getWorkspaceSweepMaxHoldAgeMs();
39
+ const now = Date.now();
40
+ for (const [holdId, acquiredAt] of current.holds) {
41
+ const ageMs = now - acquiredAt;
42
+ if (ageMs <= maxAgeMs)
43
+ continue;
44
+ current.holds.delete(holdId);
45
+ logLatency({
46
+ type: "phase",
47
+ phase: "lsp_workspace_sweep_hold_force_released",
48
+ filePath: "",
49
+ durationMs: ageMs,
50
+ metadata: { holdId, maxHoldAgeMs: maxAgeMs }
51
+ });
52
+ }
53
+ flushIdleWaitersIfEmpty();
54
+ }
55
+ function acquireWorkspaceSweepHold() {
56
+ const current = state();
57
+ const holdId = current.nextHoldId++;
58
+ current.holds.set(holdId, Date.now());
59
+ return () => {
60
+ if (!state().holds.delete(holdId))
61
+ return;
62
+ flushIdleWaitersIfEmpty();
63
+ };
64
+ }
65
+ function isWorkspaceSweepActive() {
66
+ reapStaleHolds();
67
+ return state().holds.size > 0;
68
+ }
69
+ function runWhenWorkspaceSweepIdle(cb) {
70
+ reapStaleHolds();
71
+ const current = state();
72
+ if (current.holds.size === 0) {
73
+ cb();
74
+ return;
75
+ }
76
+ current.idleWaiters.push(cb);
77
+ }
78
+ function clearWorkspaceSweepHoldForSessionStart() {
79
+ const current = state();
80
+ if (current.holds.size === 0)
81
+ return;
82
+ logLatency({
83
+ type: "phase",
84
+ phase: "lsp_workspace_sweep_hold_session_reset",
85
+ filePath: "",
86
+ durationMs: 0,
87
+ metadata: { clearedHolds: current.holds.size }
88
+ });
89
+ current.holds.clear();
90
+ flushIdleWaitersIfEmpty();
91
+ }
92
+ function getFullScanWallClockMs() {
93
+ const raw = Number(process.env.PI_LENS_LENS_DIAGNOSTICS_FULL_TIMEOUT_MS);
94
+ return Number.isFinite(raw) && raw > 0 ? raw : 3e5;
95
+ }
96
+
97
+ // dist/clients/lsp/service-singleton.js
98
+ var LSP_SERVICE_FAMILY = "lsp.service";
99
+ var LSP_SERVICE_VERSION = 2;
100
+ function state2() {
101
+ return getProcessSingleton(LSP_SERVICE_FAMILY, LSP_SERVICE_VERSION, () => ({
102
+ service: null,
103
+ generationHandoff: void 0,
104
+ lifecycle: void 0
105
+ }), (value) => {
106
+ const previous = value;
107
+ const service = previous.service;
108
+ if (!service || typeof service.shutdown !== "function")
109
+ return;
110
+ void Promise.resolve(service.shutdown({
111
+ fast: true,
112
+ reason: "process_singleton_reset"
113
+ })).catch(() => void 0);
114
+ });
115
+ }
116
+ function configureLspServiceLifecycle(lifecycle) {
117
+ state2().lifecycle = lifecycle;
118
+ }
119
+ function getOwnedLspService() {
120
+ const current = state2();
121
+ if (!current.lifecycle) {
122
+ throw new Error("LSP service lifecycle is not configured");
123
+ }
124
+ if (!current.service) {
125
+ current.service = current.lifecycle.create(current.generationHandoff);
126
+ }
127
+ return current.service;
128
+ }
129
+ function peekOwnedLspService() {
130
+ return state2().service ?? void 0;
131
+ }
132
+ function resetOwnedLspService(options = {}) {
133
+ const current = state2();
134
+ if (options.reason === "session_start") {
135
+ clearWorkspaceSweepHoldForSessionStart();
136
+ }
137
+ current.lifecycle?.beforeReset(options);
138
+ const retiringService = current.service;
139
+ current.service = null;
140
+ if (!retiringService || !current.lifecycle)
141
+ return;
142
+ const teardown = current.lifecycle.destroy(retiringService, options);
143
+ const pending = current.generationHandoff ? [current.generationHandoff, teardown] : [teardown];
144
+ const handoff = Promise.allSettled(pending).then(() => void 0);
145
+ current.generationHandoff = handoff;
146
+ void handoff.then(() => {
147
+ if (current.generationHandoff === handoff)
148
+ current.generationHandoff = void 0;
149
+ });
150
+ }
151
+
152
+ export {
153
+ SWEEP_IDLE_SAFETY_MARGIN_MS,
154
+ acquireWorkspaceSweepHold,
155
+ isWorkspaceSweepActive,
156
+ runWhenWorkspaceSweepIdle,
157
+ getFullScanWallClockMs,
158
+ configureLspServiceLifecycle,
159
+ getOwnedLspService,
160
+ peekOwnedLspService,
161
+ resetOwnedLspService
162
+ };
@@ -1,10 +1,10 @@
1
1
  import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
2
  import {
3
3
  createToolchainAvailability
4
- } from "./chunk-F3P7VQ7H.js";
4
+ } from "./chunk-7DYBLXYA.js";
5
5
  import {
6
6
  createSubsystemLogger
7
- } from "./chunk-O6TQT6RI.js";
7
+ } from "./chunk-XTMJ7XDT.js";
8
8
 
9
9
  // dist/clients/rust-client.js
10
10
  import * as path from "node:path";
@@ -2148,20 +2148,26 @@ function isUnderDir(child, parent) {
2148
2148
  const parentPrefix = normParent.endsWith("/") ? normParent : `${normParent}/`;
2149
2149
  return normChild === normParent || normChild.startsWith(parentPrefix);
2150
2150
  }
2151
+ function isOutsideProjectRoot(filePath, projectRoot) {
2152
+ return !isUnderDir(filePath, projectRoot);
2153
+ }
2151
2154
  var VENDOR_DIR_NAMES = /* @__PURE__ */ new Set([
2152
2155
  "node_modules",
2153
2156
  "vendor",
2154
2157
  "vendors",
2155
2158
  "third_party",
2156
- "third-party"
2159
+ "third-party",
2160
+ ".venv",
2161
+ "site-packages",
2162
+ "bower_components"
2157
2163
  ]);
2164
+ function isVendorPath(filePath) {
2165
+ return normalizeFilePath(filePath).split("/").some((segment) => VENDOR_DIR_NAMES.has(segment.toLowerCase()));
2166
+ }
2158
2167
  function isExternalOrVendorFile(filePath, projectRoot) {
2159
- if (!isUnderDir(filePath, projectRoot))
2168
+ if (isOutsideProjectRoot(filePath, projectRoot))
2160
2169
  return true;
2161
- const normalized = normalizeFilePath(filePath);
2162
- const rootNorm = normalizeFilePath(projectRoot);
2163
- const rel = normalized.startsWith(rootNorm + "/") ? normalized.slice(rootNorm.length + 1) : normalized;
2164
- return rel.split("/").some((seg) => VENDOR_DIR_NAMES.has(seg));
2170
+ return isVendorPath(filePath);
2165
2171
  }
2166
2172
  function nameMatchesMarkerGlob(name, pattern) {
2167
2173
  return minimatch(name, pattern, {
@@ -2315,6 +2321,50 @@ function matchesWorkspaceMemberPattern(pattern, relativePath, dialect, onCap) {
2315
2321
  const steps = compileWorkspaceMemberPattern(normalized, dialect);
2316
2322
  return steps !== void 0 && matchesWorkspaceMemberSteps(steps, relativePath, onCap);
2317
2323
  }
2324
+ var HOST_UNICODE_SPACES = /[\u00A0\u2000-\u200A\u202F\u205F\u3000]/g;
2325
+ function hostNormalizeWindowsShellPath(filePath) {
2326
+ if (!filePath.startsWith("/") || filePath.startsWith("//") || filePath.includes("\\")) {
2327
+ return filePath;
2328
+ }
2329
+ const match2 = filePath.match(/^\/(?:mnt\/|cygdrive\/)?([a-z])(?:\/(.*))?$/i);
2330
+ if (!match2)
2331
+ return filePath;
2332
+ const suffix = match2[2]?.replaceAll("/", "\\");
2333
+ return `${match2[1].toUpperCase()}:\\${suffix ?? ""}`;
2334
+ }
2335
+ function normalizeHostToolPath(input, options = {}) {
2336
+ let normalized = input;
2337
+ if (options.normalizeUnicodeSpaces) {
2338
+ normalized = normalized.replace(HOST_UNICODE_SPACES, " ");
2339
+ }
2340
+ if (options.stripAtPrefix && normalized.startsWith("@")) {
2341
+ normalized = normalized.slice(1);
2342
+ }
2343
+ if (process.platform === "win32") {
2344
+ normalized = hostNormalizeWindowsShellPath(normalized);
2345
+ }
2346
+ if (normalized === "~")
2347
+ return os.homedir();
2348
+ if (normalized.startsWith("~/") || process.platform === "win32" && normalized.startsWith("~\\")) {
2349
+ return path2.join(os.homedir(), normalized.slice(2));
2350
+ }
2351
+ if (normalized.startsWith("file://")) {
2352
+ try {
2353
+ return fileURLToPath(normalized);
2354
+ } catch {
2355
+ return normalized;
2356
+ }
2357
+ }
2358
+ return normalized;
2359
+ }
2360
+ function resolveHostToolPath(input, baseDir) {
2361
+ const normalized = normalizeHostToolPath(input, {
2362
+ normalizeUnicodeSpaces: true,
2363
+ stripAtPrefix: true
2364
+ });
2365
+ const normalizedBaseDir = normalizeHostToolPath(baseDir);
2366
+ return path2.isAbsolute(normalized) ? path2.resolve(normalized) : path2.resolve(normalizedBaseDir, normalized);
2367
+ }
2318
2368
 
2319
2369
  export {
2320
2370
  minimatch,
@@ -2342,11 +2392,13 @@ export {
2342
2392
  isAtOrAboveHomeDir,
2343
2393
  homeRelativePath,
2344
2394
  isUnderDir,
2395
+ isVendorPath,
2345
2396
  isExternalOrVendorFile,
2346
2397
  nameMatchesMarkerGlob,
2347
2398
  direntsHaveMarkerGlobMatch,
2348
2399
  CARGO_WORKSPACE_MEMBER_DIALECT,
2349
2400
  UV_WORKSPACE_MEMBERS_DIALECT,
2350
2401
  UV_WORKSPACE_EXCLUDE_DIALECT,
2351
- matchesWorkspaceMemberPattern
2402
+ matchesWorkspaceMemberPattern,
2403
+ resolveHostToolPath
2352
2404
  };
@@ -1,9 +1,9 @@
1
1
  import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
2
  import {
3
3
  createSubsystemLogger
4
- } from "./chunk-O6TQT6RI.js";
5
- import "./chunk-UK3CMEAL.js";
6
- import "./chunk-Q5U6FMDI.js";
4
+ } from "./chunk-XTMJ7XDT.js";
5
+ import "./chunk-AOHZU2BM.js";
6
+ import "./chunk-N2H3ZPZY.js";
7
7
  import "./chunk-NXL4FFQQ.js";
8
8
 
9
9
  // dist/clients/metrics-client.js
@@ -9,28 +9,30 @@ import {
9
9
  getDeadCodeClients,
10
10
  parseVultureOutput,
11
11
  stableFindingKey
12
- } from "./chunk-TT22N74J.js";
12
+ } from "./chunk-OG5UUPN7.js";
13
13
  import "./chunk-7U2IDNXN.js";
14
- import "./chunk-TO6WL3GM.js";
15
- import "./chunk-ZMOL6RQC.js";
16
- import "./chunk-I7SPGOWI.js";
17
- import "./chunk-3I5QFT3N.js";
18
- import "./chunk-PAK6IDME.js";
19
- import "./chunk-U3VGR4VU.js";
20
- import "./chunk-EOKRQ3SA.js";
21
- import "./chunk-WONERJTP.js";
22
- import "./chunk-VN2AXLEX.js";
14
+ import "./chunk-VCHXCQFG.js";
15
+ import "./chunk-2CD5RS6M.js";
16
+ import "./chunk-UZ3TUTRV.js";
17
+ import "./chunk-PNQDPDRC.js";
18
+ import "./chunk-P7266HLM.js";
19
+ import "./chunk-AW7R2GWG.js";
20
+ import "./chunk-RWWYJ623.js";
21
+ import "./chunk-VRZP76YM.js";
22
+ import "./chunk-C34ZXZ7O.js";
23
23
  import "./chunk-BW5KFIQC.js";
24
- import "./chunk-DQ2NZ7C4.js";
25
- import "./chunk-VNMT7C64.js";
24
+ import "./chunk-2BBLFX75.js";
25
+ import "./chunk-XVF2VVXP.js";
26
+ import "./chunk-ZANLILYD.js";
26
27
  import "./chunk-2EECBNC5.js";
27
- import "./chunk-N3YQJI6O.js";
28
- import "./chunk-O6TQT6RI.js";
29
- import "./chunk-5THXD6X5.js";
30
- import "./chunk-UK3CMEAL.js";
28
+ import "./chunk-JAU72XNY.js";
29
+ import "./chunk-XTMJ7XDT.js";
30
+ import "./chunk-JMYYOTQG.js";
31
+ import "./chunk-QQNQ7SJW.js";
32
+ import "./chunk-AOHZU2BM.js";
31
33
  import "./chunk-LJDODBBZ.js";
32
34
  import "./chunk-ABBOA7UD.js";
33
- import "./chunk-Q5U6FMDI.js";
35
+ import "./chunk-N2H3ZPZY.js";
34
36
  import "./chunk-NXL4FFQQ.js";
35
37
  export {
36
38
  DEAD_CODE_DELTA_MAX_SHOWN,