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
@@ -2,7 +2,7 @@ import { createRequire as __pilensCreateRequire } from "node:module"; const requ
2
2
  import {
3
3
  collectSourceFiles,
4
4
  collectSourceFilesAsync
5
- } from "./chunk-6QIUX4EP.js";
5
+ } from "./chunk-6C7JWPCP.js";
6
6
 
7
7
  // dist/clients/scan-utils.js
8
8
  function getSourceFiles(dir, _isTsProject) {
@@ -1,33 +1,34 @@
1
1
  import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
2
  import {
3
3
  getSourceFiles
4
- } from "./chunk-GVXA6CCE.js";
4
+ } from "./chunk-QILIYSJF.js";
5
5
  import {
6
6
  readDirEntriesSafe,
7
7
  shouldRecurseIntoDir
8
- } from "./chunk-VHQLPIRJ.js";
8
+ } from "./chunk-5NGR67U5.js";
9
9
  import {
10
10
  getProjectIgnoreMatcher
11
- } from "./chunk-VN2AXLEX.js";
11
+ } from "./chunk-C34ZXZ7O.js";
12
12
  import {
13
13
  CODE_KINDS,
14
14
  DOTNET_CSHARP_ROOT_MARKERS,
15
15
  DOTNET_FSHARP_ROOT_MARKERS,
16
16
  KIND_EXTENSIONS,
17
+ LEAN_ROOT_MARKERS,
17
18
  TERRAGRUNT_FILENAMES,
18
19
  detectFileKind
19
- } from "./chunk-5ZEJHV35.js";
20
+ } from "./chunk-PHDMFAKM.js";
20
21
  import {
21
22
  findNearestDirWithAnyBasename,
22
23
  registerWorkspaceTopologyReset
23
- } from "./chunk-VNMT7C64.js";
24
+ } from "./chunk-XVF2VVXP.js";
24
25
  import {
25
26
  BoundedLruCache
26
27
  } from "./chunk-ABBOA7UD.js";
27
28
  import {
28
29
  direntsHaveMarkerGlobMatch,
29
30
  normalizeMapKey
30
- } from "./chunk-Q5U6FMDI.js";
31
+ } from "./chunk-N2H3ZPZY.js";
31
32
 
32
33
  // dist/clients/language-profile.js
33
34
  import * as fs from "node:fs";
@@ -87,6 +88,7 @@ var LANGUAGE_POLICY = {
87
88
  fsharp: { lspCapable: true },
88
89
  java: { lspCapable: true },
89
90
  kotlin: { lspCapable: true, startup: { defaults: ["ktlint"] } },
91
+ lean: { lspCapable: true },
90
92
  swift: { lspCapable: true },
91
93
  dart: { lspCapable: true },
92
94
  lua: { lspCapable: true },
@@ -205,6 +207,7 @@ var PRIMARY_DISPATCH_GROUPS = {
205
207
  runnerIds: ["lsp", "ktlint"],
206
208
  filterKinds: ["kotlin"]
207
209
  },
210
+ lean: { mode: "fallback", runnerIds: ["lsp"], filterKinds: ["lean"] },
208
211
  swift: {
209
212
  mode: "all",
210
213
  runnerIds: ["lsp", "swiftlint"],
@@ -313,6 +316,7 @@ var PROJECT_MARKERS_BY_KIND = {
313
316
  // spellings; java listed only the Groovy one.
314
317
  java: ["pom.xml", "build.gradle", "build.gradle.kts", ".classpath"],
315
318
  kotlin: ["build.gradle.kts", "build.gradle", "pom.xml"],
319
+ lean: LEAN_ROOT_MARKERS,
316
320
  swift: ["Package.swift"],
317
321
  dart: ["pubspec.yaml"],
318
322
  elixir: ["mix.exs"],
@@ -365,6 +369,7 @@ var ROOT_MARKERS_BY_KIND = {
365
369
  // workspace root.
366
370
  java: ["pom.xml", "build.gradle", "build.gradle.kts", ".classpath"],
367
371
  kotlin: ["build.gradle.kts", "build.gradle", "pom.xml"],
372
+ lean: LEAN_ROOT_MARKERS,
368
373
  swift: ["Package.swift"],
369
374
  dart: ["pubspec.yaml"],
370
375
  elixir: ["mix.exs"],
@@ -488,7 +493,7 @@ function resolveLanguageRootForFile(filePath, workspaceRoot) {
488
493
  }
489
494
  var WARMUP_SOURCE_EXTS = new Set(SUPPORTED_FILE_KINDS.flatMap((kind) => KIND_EXTENSIONS[kind]));
490
495
  var WARMUP_CODE_EXTS = new Set(SUPPORTED_FILE_KINDS.filter((kind) => CODE_KINDS.has(kind)).flatMap((kind) => KIND_EXTENSIONS[kind]));
491
- var MAX_WARMUP_SOURCE_FILES = 2e3;
496
+ var MAX_WARMUP_SOURCE_FILES = 2500;
492
497
  var MATCHED_FILES_CEILING_FACTOR = 10;
493
498
  async function collectSourceFilesForWarmup(rootDir, maxFiles = MAX_WARMUP_SOURCE_FILES, yieldEvery = 100) {
494
499
  const root = path.resolve(rootDir);
@@ -5,10 +5,10 @@ import {
5
5
  getMaxLogSizeMB,
6
6
  getTurnId,
7
7
  isTestMode
8
- } from "./chunk-UK3CMEAL.js";
8
+ } from "./chunk-AOHZU2BM.js";
9
9
  import {
10
10
  normalizeLoggedPath
11
- } from "./chunk-Q5U6FMDI.js";
11
+ } from "./chunk-N2H3ZPZY.js";
12
12
 
13
13
  // dist/clients/latency-logger.js
14
14
  import * as path from "node:path";
@@ -118,80 +118,7 @@ function logLatency(entry) {
118
118
  });
119
119
  }
120
120
 
121
- // dist/clients/config-diagnostic-codes.js
122
- var STABILITY_TIER_KEY = "x-stability";
123
- var CONFIG_SCHEMA_ID = "https://raw.githubusercontent.com/apmantza/pi-lens/master/docs/schema/pi-lens-config-v1.json";
124
- var CONFIG_SCHEMA_ANCHOR_KEY = "$schema";
125
- function configDiagnosticMarker(code) {
126
- return `[${code}]`;
127
- }
128
- function withConfigDiagnosticCode(message, code) {
129
- const marker = configDiagnosticMarker(code);
130
- return message.includes(marker) ? message : `${message} ${marker}`;
131
- }
132
- var LSP_DEPRECATION_WINDOW = {
133
- deprecatedSince: "4.1.4",
134
- removeNotBefore: "5.0.0"
135
- };
136
- var LEGACY_KEY = {
137
- kind: "key",
138
- code: "PILENS_CFG_0002",
139
- ...LSP_DEPRECATION_WINDOW
140
- };
141
- var LEGACY_FILE = {
142
- kind: "file",
143
- code: "PILENS_CFG_0003",
144
- ...LSP_DEPRECATION_WINDOW
145
- };
146
- var DEPRECATED_CONFIG_SURFACES = [
147
- {
148
- ...LEGACY_KEY,
149
- surface: "servers",
150
- reason: "custom-server definitions move to the unified catalog schema; the bare string command + args form is replaced by the trust-gated ProcessSpec (#2416)."
151
- },
152
- {
153
- ...LEGACY_KEY,
154
- surface: "serverOverrides",
155
- reason: "per-server initializationOptions overrides fold into the catalog's field-wise merge, keyed by the same public server IDs (#2416)."
156
- },
157
- {
158
- ...LEGACY_KEY,
159
- surface: "disabledServers",
160
- reason: "replaced by the catalog's per-entry `enabled: false`, which carries monotonic deny precedence (#1416/#2415)."
161
- },
162
- {
163
- ...LEGACY_KEY,
164
- surface: "warmFiles",
165
- reason: "session warm-up seeds become a per-server catalog field rather than a config-root list (#2416)."
166
- },
167
- {
168
- ...LEGACY_FILE,
169
- surface: ".pi-lens/lsp.json",
170
- reason: "project LSP settings consolidate into `.pi-lens.json` under the unified envelope (#2426)."
171
- },
172
- {
173
- ...LEGACY_FILE,
174
- surface: "pi-lsp.json",
175
- reason: "pre-rename project location; superseded by `.pi-lens.json` (#2426)."
176
- },
177
- {
178
- ...LEGACY_FILE,
179
- surface: "pi-lens.json",
180
- reason: "undotted project-config basename; superseded by `.pi-lens.json` (#2426)."
181
- },
182
- {
183
- ...LEGACY_FILE,
184
- surface: "~/.pi-lens/lsp.json",
185
- reason: "global LSP settings consolidate into `~/.pi-lens/config.json` (#2426)."
186
- }
187
- ];
188
-
189
121
  export {
190
- STABILITY_TIER_KEY,
191
- CONFIG_SCHEMA_ID,
192
- CONFIG_SCHEMA_ANCHOR_KEY,
193
- withConfigDiagnosticCode,
194
- DEPRECATED_CONFIG_SURFACES,
195
122
  phaseStarted,
196
123
  phaseFinished,
197
124
  currentSessionRecordId,
@@ -1,67 +1,71 @@
1
1
  import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
2
  import {
3
3
  resolveManagedToolClient
4
- } from "./chunk-7FBF7NPR.js";
4
+ } from "./chunk-GOYRYZ2R.js";
5
5
  import {
6
6
  biomeConfigArgs
7
- } from "./chunk-HHYAELLJ.js";
8
- import "./chunk-B3I2UUT4.js";
9
- import "./chunk-DIULIWKU.js";
10
- import "./chunk-VDBPVIKD.js";
11
- import "./chunk-TGPXLY2J.js";
7
+ } from "./chunk-RPLINGVB.js";
8
+ import "./chunk-ESBQHFMJ.js";
9
+ import "./chunk-34WSVGEM.js";
10
+ import "./chunk-VWCXW2E7.js";
11
+ import "./chunk-ZXYDQ3TZ.js";
12
+ import "./chunk-724UL2TJ.js";
12
13
  import "./chunk-QOZXJ4NA.js";
13
- import "./chunk-PAK6IDME.js";
14
- import "./chunk-GUOGVTCQ.js";
15
- import "./chunk-AJVLWNFN.js";
16
- import "./chunk-YGVYKNSN.js";
17
- import "./chunk-LNAKEO63.js";
14
+ import "./chunk-P7266HLM.js";
15
+ import "./chunk-52FUZI6K.js";
16
+ import "./chunk-SAEFPSB6.js";
17
+ import "./chunk-GAEGEPOC.js";
18
18
  import "./chunk-Z3CCVDUB.js";
19
19
  import "./chunk-2BEMIWEW.js";
20
- import "./chunk-OQGFCZJ4.js";
20
+ import "./chunk-66VMUL7Q.js";
21
21
  import {
22
22
  resolveToolCwd
23
- } from "./chunk-RUOG5D2C.js";
23
+ } from "./chunk-Q7DUK4LX.js";
24
24
  import {
25
- findGlobalBinary
26
- } from "./chunk-U3VGR4VU.js";
27
- import "./chunk-NTUJEGDZ.js";
25
+ findGlobalBinary,
26
+ findLocalBinAt,
27
+ localBinPath
28
+ } from "./chunk-AW7R2GWG.js";
28
29
  import {
30
+ getIsolatedNpxSpawnOptions,
29
31
  probeToolAsync
30
- } from "./chunk-EOKRQ3SA.js";
32
+ } from "./chunk-RWWYJ623.js";
31
33
  import {
32
34
  classifyProbeFailure,
33
35
  createAvailabilityLatch,
34
36
  describeInstallAttempt,
35
37
  logAvailabilityDecision,
36
38
  startHostStallSampler
37
- } from "./chunk-WONERJTP.js";
38
- import "./chunk-22AVIGXS.js";
39
- import "./chunk-GVXA6CCE.js";
40
- import "./chunk-6QIUX4EP.js";
41
- import "./chunk-VHQLPIRJ.js";
39
+ } from "./chunk-VRZP76YM.js";
40
+ import "./chunk-QOBUHWHX.js";
41
+ import "./chunk-QILIYSJF.js";
42
+ import "./chunk-6C7JWPCP.js";
43
+ import "./chunk-5NGR67U5.js";
42
44
  import {
43
45
  getGlobalPiLensDir,
44
46
  safeSpawnAsync
45
- } from "./chunk-VN2AXLEX.js";
47
+ } from "./chunk-C34ZXZ7O.js";
46
48
  import {
47
49
  createSingleFlight
48
50
  } from "./chunk-BW5KFIQC.js";
49
51
  import "./chunk-QYF5S6P6.js";
50
52
  import {
51
53
  isFileKind
52
- } from "./chunk-5ZEJHV35.js";
53
- import "./chunk-DQ2NZ7C4.js";
54
- import "./chunk-VNMT7C64.js";
54
+ } from "./chunk-PHDMFAKM.js";
55
+ import "./chunk-2BBLFX75.js";
56
+ import "./chunk-XVF2VVXP.js";
57
+ import "./chunk-ZANLILYD.js";
55
58
  import "./chunk-2EECBNC5.js";
56
- import "./chunk-N3YQJI6O.js";
59
+ import "./chunk-JAU72XNY.js";
57
60
  import {
58
61
  createSubsystemLogger
59
- } from "./chunk-O6TQT6RI.js";
60
- import "./chunk-5THXD6X5.js";
61
- import "./chunk-UK3CMEAL.js";
62
+ } from "./chunk-XTMJ7XDT.js";
63
+ import "./chunk-JMYYOTQG.js";
64
+ import "./chunk-QQNQ7SJW.js";
65
+ import "./chunk-AOHZU2BM.js";
62
66
  import "./chunk-LJDODBBZ.js";
63
67
  import "./chunk-ABBOA7UD.js";
64
- import "./chunk-Q5U6FMDI.js";
68
+ import "./chunk-N2H3ZPZY.js";
65
69
  import "./chunk-NXL4FFQQ.js";
66
70
 
67
71
  // dist/clients/biome-client.js
@@ -126,15 +130,13 @@ var BiomeClient = class {
126
130
  return { cmd: cached, args: [] };
127
131
  const isWin = process.platform === "win32";
128
132
  const piLensBin = path.join(getGlobalPiLensDir(), "tools", "node_modules", ".bin");
129
- const candidates = isWin ? [
130
- path.join(resolveCwd, "node_modules", ".bin", "biome.cmd"),
131
- path.join(resolveCwd, "node_modules", ".bin", "biome")
132
- ] : [path.join(resolveCwd, "node_modules", ".bin", "biome")];
133
- for (const p of candidates) {
134
- if (fs.existsSync(p)) {
135
- this.localBinaryByCwd.set(resolveCwd, p);
136
- return { cmd: p, args: [] };
137
- }
133
+ const localBiome = localBinPath(findLocalBinAt("biome", resolveCwd, {
134
+ windowsExt: ".cmd",
135
+ isWindows: isWin
136
+ }));
137
+ if (localBiome) {
138
+ this.localBinaryByCwd.set(resolveCwd, localBiome);
139
+ return { cmd: localBiome, args: [] };
138
140
  }
139
141
  if (this.autoInstalledBinaryPath) {
140
142
  return { cmd: this.autoInstalledBinaryPath, args: [] };
@@ -155,7 +157,14 @@ var BiomeClient = class {
155
157
  }
156
158
  async spawnBiomeAsync(args, timeout = 15e3, cwd) {
157
159
  const { cmd, args: prefix } = await this.getBiomeBinary(cwd);
158
- return safeSpawnAsync(cmd, [...prefix, ...args], { timeout, cwd });
160
+ return safeSpawnAsync(cmd, [...prefix, ...args], {
161
+ timeout,
162
+ cwd,
163
+ // ONE neutral-cwd seam for npx/bunx fallbacks (#4193, #4268 acceptance 3),
164
+ // so a project `.npmrc` is never read; a resolved binary keeps the
165
+ // project cwd it was given (biome.json discovery).
166
+ ...cmd === "npx" || cmd === "bunx" ? getIsolatedNpxSpawnOptions() : {}
167
+ });
159
168
  }
160
169
  /**
161
170
  * Ensure Biome is available, auto-installing if necessary.
@@ -8,23 +8,24 @@ import {
8
8
  getDefaultStartupTools,
9
9
  resolveLanguageRootForFile,
10
10
  rootMarkersForFile
11
- } from "./chunk-22AVIGXS.js";
12
- import "./chunk-GVXA6CCE.js";
13
- import "./chunk-6QIUX4EP.js";
14
- import "./chunk-VHQLPIRJ.js";
15
- import "./chunk-VN2AXLEX.js";
11
+ } from "./chunk-QOBUHWHX.js";
12
+ import "./chunk-QILIYSJF.js";
13
+ import "./chunk-6C7JWPCP.js";
14
+ import "./chunk-5NGR67U5.js";
15
+ import "./chunk-C34ZXZ7O.js";
16
16
  import "./chunk-QYF5S6P6.js";
17
- import "./chunk-5ZEJHV35.js";
18
- import "./chunk-DQ2NZ7C4.js";
19
- import "./chunk-VNMT7C64.js";
17
+ import "./chunk-PHDMFAKM.js";
18
+ import "./chunk-2BBLFX75.js";
19
+ import "./chunk-XVF2VVXP.js";
20
20
  import "./chunk-2EECBNC5.js";
21
- import "./chunk-N3YQJI6O.js";
22
- import "./chunk-O6TQT6RI.js";
23
- import "./chunk-5THXD6X5.js";
24
- import "./chunk-UK3CMEAL.js";
21
+ import "./chunk-JAU72XNY.js";
22
+ import "./chunk-XTMJ7XDT.js";
23
+ import "./chunk-JMYYOTQG.js";
24
+ import "./chunk-QQNQ7SJW.js";
25
+ import "./chunk-AOHZU2BM.js";
25
26
  import "./chunk-LJDODBBZ.js";
26
27
  import "./chunk-ABBOA7UD.js";
27
- import "./chunk-Q5U6FMDI.js";
28
+ import "./chunk-N2H3ZPZY.js";
28
29
  import "./chunk-NXL4FFQQ.js";
29
30
  export {
30
31
  SUPPORTED_FILE_KINDS,
@@ -1,24 +1,24 @@
1
1
  import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
+ import {
3
+ loadProjectSnapshotWithoutWordIndex
4
+ } from "./chunk-ZXYDQ3TZ.js";
2
5
  import {
3
6
  resolvePackagePath
4
7
  } from "./chunk-QOZXJ4NA.js";
5
- import {
6
- loadProjectSnapshotWithoutWordIndex
7
- } from "./chunk-AJVLWNFN.js";
8
8
  import {
9
9
  TERRAGRUNT_FILENAMES
10
- } from "./chunk-5ZEJHV35.js";
10
+ } from "./chunk-PHDMFAKM.js";
11
11
  import {
12
12
  recordDegradationOnce
13
- } from "./chunk-N3YQJI6O.js";
13
+ } from "./chunk-JAU72XNY.js";
14
14
  import {
15
15
  logLatency
16
- } from "./chunk-5THXD6X5.js";
16
+ } from "./chunk-QQNQ7SJW.js";
17
17
  import {
18
18
  findNearestContaining,
19
19
  normalizeMapKey,
20
20
  walkUpDirs
21
- } from "./chunk-Q5U6FMDI.js";
21
+ } from "./chunk-N2H3ZPZY.js";
22
22
 
23
23
  // dist/clients/tool-policy.js
24
24
  import * as fs from "node:fs";
@@ -1,12 +1,20 @@
1
1
  import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
2
  import {
3
+ getGlobalPiLensDir,
3
4
  safeSpawnAsync
4
- } from "./chunk-VN2AXLEX.js";
5
+ } from "./chunk-C34ZXZ7O.js";
5
6
  import {
6
7
  createSingleFlight
7
8
  } from "./chunk-BW5KFIQC.js";
8
9
 
9
10
  // dist/clients/tool-probe.js
11
+ import * as fs from "node:fs";
12
+ import { join } from "node:path";
13
+ function getIsolatedNpxSpawnOptions() {
14
+ const cwd = join(getGlobalPiLensDir(), "tools");
15
+ fs.mkdirSync(cwd, { recursive: true });
16
+ return { cwd, stripNpmConfig: true };
17
+ }
10
18
  async function probeToolAsync(command, args, options) {
11
19
  const { cwd: _strippedCwd, ...rest } = options ?? {};
12
20
  return safeSpawnAsync(command, [...args], { ...rest });
@@ -25,6 +33,7 @@ function createAvailabilityProbeFlight(options = {}) {
25
33
  }
26
34
 
27
35
  export {
36
+ getIsolatedNpxSpawnOptions,
28
37
  probeToolAsync,
29
38
  createAvailabilityProbeFlight
30
39
  };
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
2
  import {
3
3
  getWordIndexMaxFilesDerived
4
- } from "./chunk-LNAKEO63.js";
4
+ } from "./chunk-GAEGEPOC.js";
5
5
  import {
6
6
  PathKeyedMap
7
7
  } from "./chunk-Z3CCVDUB.js";
@@ -15,24 +15,27 @@ import {
15
15
  } from "./chunk-QYF5S6P6.js";
16
16
  import {
17
17
  KIND_EXTENSIONS
18
- } from "./chunk-5ZEJHV35.js";
18
+ } from "./chunk-PHDMFAKM.js";
19
19
  import {
20
20
  isTestFileName
21
- } from "./chunk-DQ2NZ7C4.js";
21
+ } from "./chunk-2BBLFX75.js";
22
22
  import {
23
23
  incrementDegradationCount
24
- } from "./chunk-N3YQJI6O.js";
24
+ } from "./chunk-JAU72XNY.js";
25
+ import {
26
+ logLatency
27
+ } from "./chunk-QQNQ7SJW.js";
25
28
  import {
26
29
  createNdjsonLogger,
27
30
  getGlobalPiLensLogDir,
28
31
  getMaxLogSizeMB,
29
32
  isTestMode
30
- } from "./chunk-UK3CMEAL.js";
33
+ } from "./chunk-AOHZU2BM.js";
31
34
  import {
32
35
  isAtOrAboveHomeDir,
33
36
  normalizeEphemeralMapKey,
34
37
  normalizeFilePath
35
- } from "./chunk-Q5U6FMDI.js";
38
+ } from "./chunk-N2H3ZPZY.js";
36
39
 
37
40
  // dist/clients/word-index.js
38
41
  import * as fs from "node:fs";
@@ -858,7 +861,7 @@ async function updateWordIndexDocumentAsyncUnsafe(index, doc, shouldContinue) {
858
861
  }
859
862
  var WORD_INDEX_MAX_BYTES = 512 * 1024;
860
863
  async function collectWordIndexDocs(root, shouldContinue = () => true, preflightFiles) {
861
- const { collectSourceFilesAsync } = await import("./chunk-E4MAEDPM.js");
864
+ const { collectSourceFilesAsync } = await import("./chunk-4W4VLAPJ.js");
862
865
  const maxFiles = preflightFiles?.length ?? getWordIndexMaxFilesDerived(root);
863
866
  const files = preflightFiles ? preflightFiles.map((file) => file.path) : await collectSourceFilesAsync(root, {
864
867
  maxFiles,
@@ -907,7 +910,7 @@ async function refreshWordIndexIncrementally(index, root, shouldContinue = () =>
907
910
  timings: { sourceWalkMs: 0, statWalkMs: 0, refreshReadsMs: 0 }
908
911
  };
909
912
  }
910
- const { collectSourceFilesAsync } = await import("./chunk-E4MAEDPM.js");
913
+ const { collectSourceFilesAsync } = await import("./chunk-4W4VLAPJ.js");
911
914
  const maxFiles = getWordIndexMaxFilesDerived(root);
912
915
  const sourceWalkStartMs = Date.now();
913
916
  const walked = await collectSourceFilesAsync(root, {
@@ -1270,6 +1273,44 @@ function recordPersistedWordIndexWireBytes(serialized, wireBytes) {
1270
1273
  if (cache?.serialized === serialized)
1271
1274
  cache.wireBytes = wireBytes;
1272
1275
  }
1276
+ var DEFAULT_WORD_INDEX_MEMO_BACKSTOP_MS = 10 * 6e4;
1277
+ var MAX_TIMER_DELAY_MS = 2147483647;
1278
+ function wordIndexMemoBackstopMs() {
1279
+ const raw = Number(process.env.PI_LENS_WORD_INDEX_MEMO_BACKSTOP_MS);
1280
+ return Number.isFinite(raw) && raw > 0 ? Math.min(raw, MAX_TIMER_DELAY_MS) : DEFAULT_WORD_INDEX_MEMO_BACKSTOP_MS;
1281
+ }
1282
+ function retainSerializedWordIndex(index, entry) {
1283
+ const prior = serializedWordIndexCaches.get(index);
1284
+ if (prior)
1285
+ clearTimeout(prior.backstopTimer);
1286
+ serializedWordIndexCaches.set(index, entry);
1287
+ const ref = new WeakRef(index);
1288
+ const timer = setTimeout(() => {
1289
+ const target = ref.deref();
1290
+ if (target)
1291
+ releaseWordIndexMemo(target, "backstop");
1292
+ }, wordIndexMemoBackstopMs());
1293
+ timer.unref?.();
1294
+ entry.backstopTimer = timer;
1295
+ }
1296
+ function releaseWordIndexMemo(index, trigger) {
1297
+ const memo = serializedWordIndexCaches.get(index);
1298
+ if (!memo)
1299
+ return;
1300
+ clearTimeout(memo.backstopTimer);
1301
+ serializedWordIndexCaches.delete(index);
1302
+ logLatency({
1303
+ type: "phase",
1304
+ phase: "word_index_memo_released",
1305
+ filePath: "<pi-lens>",
1306
+ durationMs: 0,
1307
+ metadata: { trigger, files: memo.serialized.files.length }
1308
+ });
1309
+ }
1310
+ function releaseWordIndexMemoAtSettle(index) {
1311
+ releaseWordIndexMemo(index, "settle");
1312
+ index.releaseMemoAfterPersist = true;
1313
+ }
1273
1314
  var _lastSerializeWork;
1274
1315
  function getLastWordIndexSerializeWork() {
1275
1316
  return _lastSerializeWork;
@@ -1431,7 +1472,7 @@ function serializeWordIndexIncrementally(index, cache) {
1431
1472
  function serializeWordIndex(index) {
1432
1473
  const prior = serializedWordIndexCaches.get(index);
1433
1474
  const cache = prior ? serializeWordIndexIncrementally(index, prior) : serializeWordIndexFull(index);
1434
- serializedWordIndexCaches.set(index, cache);
1475
+ retainSerializedWordIndex(index, cache);
1435
1476
  serializedWordIndexSources.set(cache.serialized, index);
1436
1477
  index.dirtyFiles?.clear();
1437
1478
  return cache.serialized;
@@ -1663,7 +1704,7 @@ function deserializeWordIndex(data) {
1663
1704
  }
1664
1705
  }
1665
1706
  if (canonical) {
1666
- serializedWordIndexCaches.set(index, {
1707
+ retainSerializedWordIndex(index, {
1667
1708
  serialized: data,
1668
1709
  slotByFileId,
1669
1710
  tokensByFile,
@@ -1702,7 +1743,7 @@ function triggerBackgroundWordIndexBuild(cwd, dbg, options = {}) {
1702
1743
  void (async () => {
1703
1744
  const startMs = Date.now();
1704
1745
  try {
1705
- const { loadProjectSnapshot, saveProjectSnapshot, PROJECT_SNAPSHOT_VERSION } = await import("./chunk-AJXODZY6.js");
1746
+ const { loadProjectSnapshot, saveProjectSnapshot, PROJECT_SNAPSHOT_VERSION } = await import("./chunk-UXGETRP4.js");
1706
1747
  const docs = await collectWordIndexDocs(key);
1707
1748
  const index = await buildWordIndexAsync(docs);
1708
1749
  const existing = loadProjectSnapshot(key);
@@ -1768,7 +1809,7 @@ function getWordIndexPersistScheduler() {
1768
1809
  async function writeWordIndexSnapshot(cwd, index, dbg) {
1769
1810
  const persistStartedAt = Date.now();
1770
1811
  try {
1771
- const { loadProjectSnapshot, saveProjectSnapshot, PROJECT_SNAPSHOT_VERSION } = await import("./chunk-AJXODZY6.js");
1812
+ const { loadProjectSnapshot, saveProjectSnapshot, PROJECT_SNAPSHOT_VERSION } = await import("./chunk-UXGETRP4.js");
1772
1813
  const existing = loadProjectSnapshot(cwd);
1773
1814
  const snapshot = existing ?? {
1774
1815
  version: PROJECT_SNAPSHOT_VERSION,
@@ -1785,6 +1826,10 @@ async function writeWordIndexSnapshot(cwd, index, dbg) {
1785
1826
  snapshot.wordIndex = serializeWordIndex(index);
1786
1827
  const serializeMs = performance.now() - serializeStartedAt;
1787
1828
  saveProjectSnapshot(cwd, snapshot);
1829
+ if (index.releaseMemoAfterPersist) {
1830
+ index.releaseMemoAfterPersist = false;
1831
+ releaseWordIndexMemo(index, "post_settle_persist");
1832
+ }
1788
1833
  const writeMs = performance.now() - serializeStartedAt - serializeMs;
1789
1834
  dbg?.(`word-index persist: ${index.docCount} files, ${index.postings.size} tokens`);
1790
1835
  logWordIndex({
@@ -1816,6 +1861,7 @@ async function writeWordIndexSnapshot(cwd, index, dbg) {
1816
1861
  }
1817
1862
  function scheduleWordIndexPersist(cwd, index, dbg) {
1818
1863
  const key = path2.resolve(cwd);
1864
+ index.releaseMemoAfterPersist = false;
1819
1865
  getWordIndexPersistScheduler().schedule(key, { cwd: key, index, dbg });
1820
1866
  }
1821
1867
  function flushWordIndexPersistsForTests() {
@@ -1849,6 +1895,7 @@ export {
1849
1895
  WORD_INDEX_FORMAT_VERSION,
1850
1896
  getWordIndexWireBytes,
1851
1897
  recordPersistedWordIndexWireBytes,
1898
+ releaseWordIndexMemoAtSettle,
1852
1899
  getLastWordIndexSerializeWork,
1853
1900
  serializeWordIndex,
1854
1901
  deserializeWordIndex,
@@ -1,33 +1,34 @@
1
1
  import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
2
  import {
3
3
  parseSymbolKey
4
- } from "./chunk-NKOUFPQF.js";
4
+ } from "./chunk-WOA4LN2R.js";
5
5
  import "./chunk-3MED75HT.js";
6
6
  import {
7
7
  isBuildArtifact
8
- } from "./chunk-6QIUX4EP.js";
9
- import "./chunk-VHQLPIRJ.js";
8
+ } from "./chunk-6C7JWPCP.js";
9
+ import "./chunk-5NGR67U5.js";
10
10
  import {
11
11
  getProjectDataDir
12
- } from "./chunk-VN2AXLEX.js";
12
+ } from "./chunk-C34ZXZ7O.js";
13
13
  import "./chunk-QYF5S6P6.js";
14
- import "./chunk-5ZEJHV35.js";
14
+ import "./chunk-PHDMFAKM.js";
15
15
  import {
16
16
  detectFileRole
17
- } from "./chunk-DQ2NZ7C4.js";
18
- import "./chunk-VNMT7C64.js";
17
+ } from "./chunk-2BBLFX75.js";
18
+ import "./chunk-XVF2VVXP.js";
19
19
  import {
20
20
  writeFileAtomic
21
21
  } from "./chunk-2EECBNC5.js";
22
- import "./chunk-N3YQJI6O.js";
23
- import "./chunk-O6TQT6RI.js";
24
- import "./chunk-5THXD6X5.js";
25
- import "./chunk-UK3CMEAL.js";
22
+ import "./chunk-JAU72XNY.js";
23
+ import "./chunk-XTMJ7XDT.js";
24
+ import "./chunk-JMYYOTQG.js";
25
+ import "./chunk-QQNQ7SJW.js";
26
+ import "./chunk-AOHZU2BM.js";
26
27
  import "./chunk-LJDODBBZ.js";
27
28
  import "./chunk-ABBOA7UD.js";
28
29
  import {
29
30
  isExternalOrVendorFile
30
- } from "./chunk-Q5U6FMDI.js";
31
+ } from "./chunk-N2H3ZPZY.js";
31
32
  import "./chunk-NXL4FFQQ.js";
32
33
 
33
34
  // dist/clients/codebase-model.js