pi-lens 4.4.6 → 4.4.8

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 (174) hide show
  1. package/CHANGELOG.md +232 -0
  2. package/README.md +17 -3
  3. package/config/markdownlint/run-no-fix.mjs +36 -0
  4. package/dist/{chunk-ZQ6NZZTB.js → chunk-2453RRJ2.js} +44 -6
  5. package/dist/{chunk-GZE7WOI4.js → chunk-2BKUFQKR.js} +696 -330
  6. package/dist/chunk-2TS4GLOJ.js +31 -0
  7. package/dist/{chunk-2DMLM3ZO.js → chunk-2ZE3AUJQ.js} +12 -14
  8. package/dist/{chunk-OJLTLYHB.js → chunk-35WKJWO5.js} +51 -33
  9. package/dist/chunk-3JAHQBSY.js +27 -0
  10. package/dist/{chunk-PO45POGF.js → chunk-3O5EII3W.js} +2 -2
  11. package/dist/chunk-447YZL4S.js +25 -0
  12. package/dist/{chunk-TIYGSODX.js → chunk-4B2YFN4U.js} +28 -22
  13. package/dist/{chunk-OSTKYB55.js → chunk-4BKU7PV3.js} +1 -1
  14. package/dist/{chunk-XQCSWV2G.js → chunk-4LL2VRNY.js} +27 -28
  15. package/dist/{chunk-MA77RSFN.js → chunk-4NBWFYWW.js} +9 -9
  16. package/dist/{chunk-75SY4F24.js → chunk-4QG55RRC.js} +12 -12
  17. package/dist/{chunk-K2YGBXOA.js → chunk-4W52ZKZX.js} +2 -2
  18. package/dist/{chunk-Z2XAOKHK.js → chunk-565VRUP4.js} +2 -2
  19. package/dist/{chunk-CFRQMBGP.js → chunk-57X2CDRX.js} +23 -23
  20. package/dist/{chunk-XAIT2YGS.js → chunk-5F3XF3SX.js} +7 -15
  21. package/dist/{chunk-UHGF5UT5.js → chunk-5RNB4HVK.js} +1 -1
  22. package/dist/{chunk-Q4EMRFNA.js → chunk-5T5A6YAJ.js} +35 -34
  23. package/dist/{chunk-W5LGKNET.js → chunk-6FIRFP6A.js} +12 -12
  24. package/dist/{chunk-KLQVC3XC.js → chunk-6GMGEKQN.js} +36 -9
  25. package/dist/{chunk-UN4TEBWN.js → chunk-6LJOJ6EO.js} +20 -15
  26. package/dist/{chunk-HK6JVFZC.js → chunk-6YUNI7B5.js} +3 -3
  27. package/dist/{chunk-PKES3ISE.js → chunk-7ANZ7XDD.js} +2 -2
  28. package/dist/{chunk-VQH24FIP.js → chunk-7CGIDRIK.js} +16 -15
  29. package/dist/{chunk-SCIUNBPF.js → chunk-7MAD5ZAY.js} +16 -17
  30. package/dist/{chunk-OOU2WZZE.js → chunk-7TNILKGY.js} +1 -1
  31. package/dist/{chunk-LEJOJDXL.js → chunk-A5GRLYPZ.js} +9 -9
  32. package/dist/{chunk-AE37FEGH.js → chunk-AGGUWKRK.js} +1 -1
  33. package/dist/{chunk-BWYQUPOS.js → chunk-BBET6HD6.js} +1 -1
  34. package/dist/{chunk-GAACZY6R.js → chunk-BHWW6FAX.js} +14 -13
  35. package/dist/{chunk-A3YNG5KP.js → chunk-BOPDQ7AZ.js} +23 -21
  36. package/dist/{chunk-MKVZQUEG.js → chunk-BQG2QFVO.js} +215 -134
  37. package/dist/{chunk-EVDGNG4F.js → chunk-BUZIQDFS.js} +3 -3
  38. package/dist/{chunk-2PHMIAKO.js → chunk-CM73PPGD.js} +4 -4
  39. package/dist/{chunk-63RIVFQI.js → chunk-CUDD35TW.js} +10 -9
  40. package/dist/{chunk-BM5GS6ZH.js → chunk-CZL44WFN.js} +2 -2
  41. package/dist/{chunk-QGSTQH4D.js → chunk-DIWK3LBC.js} +12 -15
  42. package/dist/{chunk-JL6CXUMW.js → chunk-DYRZGUMA.js} +2 -2
  43. package/dist/{chunk-NDMCVUYK.js → chunk-FHEV6T4L.js} +22 -18
  44. package/dist/{chunk-4PCQCU47.js → chunk-FRLAUP2B.js} +4 -4
  45. package/dist/{chunk-RZOXUSPC.js → chunk-G5GV2Q7K.js} +2 -2
  46. package/dist/{chunk-2RLWJO5K.js → chunk-G6JKM4O7.js} +7 -7
  47. package/dist/chunk-GGYOZWHW.js +27 -0
  48. package/dist/{chunk-DC4CFXM5.js → chunk-GIRBSBGL.js} +6 -5
  49. package/dist/{chunk-PQJFG24Z.js → chunk-GMROJJRN.js} +1292 -946
  50. package/dist/{chunk-ZUUI3ZSA.js → chunk-HHR7WGCI.js} +3 -3
  51. package/dist/{chunk-TIQJPRDD.js → chunk-HKIL6DCL.js} +3 -2
  52. package/dist/{chunk-VPBIMOAQ.js → chunk-HUAM7QG3.js} +15 -13
  53. package/dist/{chunk-ZYNI26MI.js → chunk-HXFUTMX2.js} +2 -2
  54. package/dist/{chunk-W5R5SABV.js → chunk-I22THIHI.js} +12 -12
  55. package/dist/chunk-IE5D3RA5.js +58 -0
  56. package/dist/{chunk-MT6BVNFW.js → chunk-IYVYZQRL.js} +10 -16
  57. package/dist/{chunk-ARD426WI.js → chunk-JBP7KESM.js} +1 -1
  58. package/dist/{chunk-MN7MHUXQ.js → chunk-JE6HKLC7.js} +2 -2
  59. package/dist/{chunk-3MYEA7QD.js → chunk-JPRDTY5S.js} +85 -3
  60. package/dist/{chunk-CJYKEW2L.js → chunk-JYLOYTZD.js} +17 -1
  61. package/dist/{chunk-5APMQ2IJ.js → chunk-JZRP4DGP.js} +2 -2
  62. package/dist/{chunk-AMXIUN2R.js → chunk-KZ4ALBCH.js} +2 -2
  63. package/dist/{chunk-W2V54OCL.js → chunk-L3CLUGDY.js} +3 -3
  64. package/dist/{chunk-DMSLNKF7.js → chunk-L4NEVZ4T.js} +28 -27
  65. package/dist/chunk-LPYTPNOJ.js +22 -0
  66. package/dist/{chunk-BI5LAQ3Y.js → chunk-LSFXZLPW.js} +2071 -1725
  67. package/dist/{chunk-2DDDCJDL.js → chunk-MC6VB2E5.js} +4 -4
  68. package/dist/{chunk-U2SDMG7C.js → chunk-NM2NWH55.js} +5 -5
  69. package/dist/{chunk-Q4FCYCRE.js → chunk-NSPVR3FN.js} +19 -18
  70. package/dist/{chunk-VG5JS5SW.js → chunk-O2ARHQKF.js} +2 -2
  71. package/dist/{chunk-KSR7RGQY.js → chunk-O4N5BQ3T.js} +10 -10
  72. package/dist/{chunk-5ZR3APIM.js → chunk-OC7VWJBZ.js} +39 -40
  73. package/dist/chunk-OFNMHPBT.js +89 -0
  74. package/dist/{chunk-YSBHPOY6.js → chunk-OWTG6UMO.js} +21 -21
  75. package/dist/{chunk-7RQXA5GG.js → chunk-OY7WZI7Q.js} +13 -12
  76. package/dist/{chunk-5CV5ITZF.js → chunk-OZWXLJMX.js} +2 -2
  77. package/dist/{chunk-F6X3YJWD.js → chunk-PIQQM32Y.js} +2 -2
  78. package/dist/chunk-PKLB2XJL.js +8 -0
  79. package/dist/{chunk-DQXSPYRI.js → chunk-PKSUMEPT.js} +17 -4
  80. package/dist/{chunk-YISME6ON.js → chunk-PPKECBPP.js} +1 -1
  81. package/dist/{chunk-4AVZ3TG7.js → chunk-R2QQC33W.js} +14 -14
  82. package/dist/{chunk-GMTFDAOK.js → chunk-R4QWJQ2H.js} +11 -11
  83. package/dist/{chunk-V63BC55Q.js → chunk-RGGH6M34.js} +1 -1
  84. package/dist/{chunk-SJJYRZB4.js → chunk-RZG472YW.js} +116 -26
  85. package/dist/{chunk-NIU2IPC5.js → chunk-SDFKOLSF.js} +6 -6
  86. package/dist/{chunk-H7HTEQUZ.js → chunk-SFLHSL5R.js} +9 -9
  87. package/dist/{chunk-FA5LDARD.js → chunk-SP4TFY5F.js} +14 -13
  88. package/dist/{chunk-J6JP25XU.js → chunk-SQC7K3SP.js} +4 -3
  89. package/dist/{chunk-T7FTXGS3.js → chunk-T2S3FNNJ.js} +44 -42
  90. package/dist/{chunk-S67UJDGQ.js → chunk-TV6RXRYH.js} +10 -10
  91. package/dist/{chunk-GNSIWBAT.js → chunk-U3AS2FR6.js} +3 -3
  92. package/dist/{chunk-WIZWZR4C.js → chunk-UHHLR2VY.js} +43 -41
  93. package/dist/chunk-UYXV5NIS.js +20 -0
  94. package/dist/{chunk-VSFLRN5Y.js → chunk-VLQ7UKZH.js} +1 -1
  95. package/dist/{chunk-FFL3A2VP.js → chunk-VN3L2JWZ.js} +46 -72
  96. package/dist/{chunk-Z7IGUAXL.js → chunk-VOP4PJKA.js} +12 -8
  97. package/dist/{chunk-F5Z6URKM.js → chunk-VOXTCULR.js} +2 -2
  98. package/dist/{chunk-NNKXDXXS.js → chunk-VPLBLWFO.js} +14 -8
  99. package/dist/chunk-W3BGKBBK.js +27 -0
  100. package/dist/{chunk-ZKXQKGWZ.js → chunk-WC6WRNQT.js} +4 -3
  101. package/dist/{chunk-Q3UZHW6N.js → chunk-WMDUT4KH.js} +1150 -1138
  102. package/dist/{chunk-KXF5R4UN.js → chunk-WQV6BI4Q.js} +1 -1
  103. package/dist/chunk-WXUDRAG6.js +24 -0
  104. package/dist/{chunk-OLAWH5UQ.js → chunk-X35S7HSB.js} +29 -10
  105. package/dist/{chunk-YBSONGSZ.js → chunk-X66YJ2SS.js} +40 -34
  106. package/dist/{chunk-U6OC3QEM.js → chunk-XOMGO63G.js} +22 -21
  107. package/dist/{chunk-WQOIR3QY.js → chunk-XWIME22V.js} +13 -13
  108. package/dist/{chunk-3WEPUD2V.js → chunk-XYLC35E4.js} +202 -103
  109. package/dist/{chunk-UCGQT677.js → chunk-YHGYAEFH.js} +18 -18
  110. package/dist/{chunk-V3APN3DY.js → chunk-ZFORSIED.js} +13 -13
  111. package/dist/{chunk-BHUWL2Y3.js → chunk-ZKLTNLAW.js} +64 -73
  112. package/dist/chunk-ZONZ6YY3.js +74 -0
  113. package/dist/chunk-ZSM35JF4.js +30 -0
  114. package/dist/{chunk-PPIBVH4R.js → chunk-ZZDIOAAJ.js} +15 -6
  115. package/dist/index.js +8817 -6239
  116. package/dist/mcp/analyze-cli.js +10 -10
  117. package/dist/mcp/cli.js +44 -42
  118. package/dist/mcp/server.js +2236 -861
  119. package/dist/mcp/worker.js +62 -61
  120. package/dist/probes/installer.js +20 -19
  121. package/docs/adr/0003-git-guard-latch-writer.md +11 -6
  122. package/docs/agent-tools.md +29 -11
  123. package/docs/alignment-families.md +29 -0
  124. package/docs/ast-grep_rules_catalog.md +6 -4
  125. package/docs/ci-bot-pr-checks.md +126 -0
  126. package/docs/configuration.md +99 -3
  127. package/docs/defect-shapes.md +68 -11
  128. package/docs/dependencies.md +1 -0
  129. package/docs/engineering-principles.md +27 -2
  130. package/docs/environment-variables.md +14 -0
  131. package/docs/features.md +13 -3
  132. package/docs/globalconfig.md +12 -1
  133. package/docs/invariants/git-guard-host.md +38 -0
  134. package/docs/invariants/language-config.md +15 -4
  135. package/docs/invariants/lsp-trust-exec.md +22 -2
  136. package/docs/invariants/paths-os.md +4 -2
  137. package/docs/invariants/session-telemetry.md +42 -2
  138. package/docs/lsp-capability-matrix.md +208 -84
  139. package/docs/lsp-idle-eviction.md +3 -5
  140. package/docs/merge-queue-rollout.md +1 -1
  141. package/docs/pi-lens-fixer.md +31 -17
  142. package/docs/pi-lens-merge-policy.md +27 -15
  143. package/docs/pi-lens-monitor.md +9 -0
  144. package/docs/pi-lens-orchestration.md +4 -1
  145. package/docs/pi-lens-reviewer.md +5 -5
  146. package/docs/pi-lens-subagent.md +13 -7
  147. package/docs/public-api-stability.md +18 -2
  148. package/docs/schema/pi-lens-config-v1.json +33 -0
  149. package/docs/servercapabilities.md +1 -1
  150. package/docs/settings.md +15 -6
  151. package/docs/usage.md +5 -0
  152. package/docs/word-index.md +17 -5
  153. package/package.json +5 -3
  154. package/rules/ast-grep-rules/rule-tests/no-accumulating-spread-js-test.yml +37 -0
  155. package/rules/ast-grep-rules/rule-tests/ts-redundant-filter-map-test.yml +12 -1
  156. package/rules/ast-grep-rules/rule-tests-disabled/filter-then-map-js-test.yml +12 -0
  157. package/rules/ast-grep-rules/rule-tests-disabled/filter-then-map-test.yml +25 -0
  158. package/rules/ast-grep-rules/rules/no-accumulating-spread-js.yml +49 -1
  159. package/rules/ast-grep-rules/rules/ts-redundant-filter-map.yml +9 -1
  160. package/rules/ast-grep-rules/rules-disabled/filter-then-map-js.yml +17 -0
  161. package/rules/ast-grep-rules/rules-disabled/filter-then-map.yml +36 -0
  162. package/rules/ast-grep-rules/self-scan-baseline.json +1 -1
  163. package/dist/chunk-2F47TQOA.js +0 -73
  164. package/dist/chunk-2X4VLOCC.js +0 -55
  165. package/dist/chunk-4WX4CTUE.js +0 -57
  166. package/dist/chunk-FJIVKLPH.js +0 -31
  167. package/dist/chunk-G2B7F6ZU.js +0 -88
  168. package/dist/chunk-GTAI2J6U.js +0 -27
  169. package/dist/chunk-IPDG45G5.js +0 -26
  170. package/dist/chunk-P4QNXS6I.js +0 -27
  171. package/dist/chunk-Q6D6VMI4.js +0 -22
  172. package/dist/chunk-SXGD4ANG.js +0 -25
  173. package/dist/chunk-XCUHKYCQ.js +0 -23
  174. package/dist/chunk-YRD4ISED.js +0 -30
@@ -1,23 +1,26 @@
1
1
  import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
2
  import {
3
3
  resolveToolCwd
4
- } from "./chunk-MT6BVNFW.js";
4
+ } from "./chunk-IYVYZQRL.js";
5
5
  import {
6
6
  allAvailableGlobalBinDirs,
7
7
  installArgs,
8
8
  pmBinary,
9
9
  resolveNodePackageManager
10
- } from "./chunk-Z7IGUAXL.js";
10
+ } from "./chunk-VOP4PJKA.js";
11
11
  import {
12
12
  probeToolAsync
13
- } from "./chunk-ARD426WI.js";
13
+ } from "./chunk-JBP7KESM.js";
14
+ import {
15
+ registerBackgroundWriteDrain
16
+ } from "./chunk-UYXV5NIS.js";
14
17
  import {
15
18
  TRANSIENT_MAX_COOLDOWN_MS,
16
19
  classifyProbeFailure,
17
20
  createAvailabilityLatch,
18
21
  logAvailabilityDecision,
19
22
  startHostStallSampler
20
- } from "./chunk-5APMQ2IJ.js";
23
+ } from "./chunk-JZRP4DGP.js";
21
24
  import {
22
25
  acquireBoundedPidFileLock,
23
26
  acquireQuarantinePidFileLock,
@@ -34,56 +37,88 @@ import {
34
37
  resetSafeSpawnWindowsCommandCache,
35
38
  safeSpawnAsync,
36
39
  startGenerationHeartbeat,
37
- tryAcquireGeneration
38
- } from "./chunk-Q3UZHW6N.js";
40
+ tryAcquireGeneration,
41
+ windowsExe
42
+ } from "./chunk-WMDUT4KH.js";
39
43
  import {
40
44
  assertInstallAllowed,
41
45
  getProjectTrustGeneration,
42
46
  projectTrustDenialReason,
43
47
  writeFileAtomic,
44
48
  writeFileAtomicAsync
45
- } from "./chunk-MN7MHUXQ.js";
49
+ } from "./chunk-JE6HKLC7.js";
46
50
  import {
47
51
  getDegradationLedgerGeneration,
48
52
  incrementDegradationCount,
49
53
  recordDegradationOnce
50
- } from "./chunk-ZQ6NZZTB.js";
54
+ } from "./chunk-2453RRJ2.js";
51
55
  import {
52
56
  logExtension
53
- } from "./chunk-KXF5R4UN.js";
57
+ } from "./chunk-WQV6BI4Q.js";
54
58
  import {
55
59
  createNdjsonLogger,
56
60
  getGlobalPiLensLogDir,
57
61
  getMaxLogSizeMB,
58
62
  isTestMode
59
- } from "./chunk-VSFLRN5Y.js";
63
+ } from "./chunk-VLQ7UKZH.js";
60
64
  import {
61
65
  BoundedLruCache,
62
66
  findLocalToolConfig,
63
67
  isFullyQualified,
64
68
  isUnderDir,
65
- realpathOrResolve
66
- } from "./chunk-PQJFG24Z.js";
69
+ realpathOrResolve,
70
+ toPosix
71
+ } from "./chunk-GMROJJRN.js";
67
72
  import {
68
73
  __require
69
74
  } from "./chunk-NXL4FFQQ.js";
70
75
 
71
76
  // dist/clients/installer/index.js
72
- import { existsSync, readFileSync as readFileSync2, statSync, unlinkSync, writeFileSync } from "node:fs";
77
+ import { existsSync, readFileSync as readFileSync2, statSync as statSync2, unlinkSync, writeFileSync } from "node:fs";
73
78
  import fs2 from "node:fs/promises";
74
79
  import { createHash, randomUUID } from "node:crypto";
75
80
  import https from "node:https";
76
81
  import { createRequire } from "node:module";
77
82
  import os from "node:os";
78
- import path3 from "node:path";
83
+ import path4 from "node:path";
84
+
85
+ // dist/clients/command-path.js
86
+ import { statSync } from "node:fs";
87
+ import * as path from "node:path";
88
+ function findCommandOnPath(command, isWindows) {
89
+ const pathEnv = process.env.PATH || process.env.Path || process.env.path || "";
90
+ const dirs = pathEnv.split(path.delimiter);
91
+ const names = isWindows ? [command, `${command}.exe`, `${command}.cmd`, `${command}.bat`] : [command];
92
+ for (const dir of dirs) {
93
+ if (!dir)
94
+ continue;
95
+ for (const name of names) {
96
+ const candidate = isWindows ? path.join(dir, name) : `${dir}${path.sep}${name}`;
97
+ try {
98
+ const stat = statSync(candidate);
99
+ if (!stat.isFile() || stat.size === 0)
100
+ continue;
101
+ if (isUntrustedProjectPath(candidate)) {
102
+ recordProjectCommandRefusal(candidate);
103
+ continue;
104
+ }
105
+ return candidate;
106
+ } catch {
107
+ }
108
+ }
109
+ }
110
+ return null;
111
+ }
112
+
113
+ // dist/clients/installer/index.js
79
114
  import { createGunzip } from "node:zlib";
80
115
 
81
116
  // dist/clients/durable-store.js
82
117
  import * as fs from "node:fs";
83
118
  import fsp from "node:fs/promises";
84
- function readLocked(path4) {
119
+ function readLocked(path5) {
85
120
  try {
86
- return fs.readFileSync(path4, "utf8");
121
+ return fs.readFileSync(path5, "utf8");
87
122
  } catch {
88
123
  return void 0;
89
124
  }
@@ -116,9 +151,9 @@ function commitDurableStore(options) {
116
151
  }
117
152
  return committed;
118
153
  }
119
- async function readLockedAsync(path4) {
154
+ async function readLockedAsync(path5) {
120
155
  try {
121
- return await fsp.readFile(path4, "utf8");
156
+ return await fsp.readFile(path5, "utf8");
122
157
  } catch (error) {
123
158
  if (error.code === "ENOENT")
124
159
  return void 0;
@@ -156,8 +191,8 @@ async function commitDurableStoreAsync(options) {
156
191
  }
157
192
 
158
193
  // dist/clients/sessionstart-logger.js
159
- import * as path from "node:path";
160
- var SESSIONSTART_LOG_FILE = path.join(getGlobalPiLensLogDir(), "sessionstart.log");
194
+ import * as path2 from "node:path";
195
+ var SESSIONSTART_LOG_FILE = path2.join(getGlobalPiLensLogDir(), "sessionstart.log");
161
196
  var writer = createNdjsonLogger({
162
197
  filePath: SESSIONSTART_LOG_FILE,
163
198
  maxBytes: getMaxLogSizeMB() * 1024 * 1024,
@@ -170,10 +205,10 @@ function logSessionStart(message) {
170
205
  }
171
206
 
172
207
  // dist/clients/zizmor-config.js
173
- import * as path2 from "node:path";
208
+ import * as path3 from "node:path";
174
209
  var LOCAL_ZIZMOR_CONFIG_NAMES = [
175
- path2.join(".github", "zizmor.yml"),
176
- path2.join(".github", "zizmor.yaml"),
210
+ path3.join(".github", "zizmor.yml"),
211
+ path3.join(".github", "zizmor.yaml"),
177
212
  "zizmor.yml",
178
213
  "zizmor.yaml"
179
214
  ];
@@ -181,8 +216,8 @@ function findLocalZizmorConfig(startDir) {
181
216
  return findLocalToolConfig(startDir, LOCAL_ZIZMOR_CONFIG_NAMES);
182
217
  }
183
218
  function isZizmorAuditTarget(filePath) {
184
- const normalized = filePath.replace(/\\/g, "/");
185
- const base = path2.basename(normalized).toLowerCase();
219
+ const normalized = toPosix(filePath);
220
+ const base = path3.basename(normalized).toLowerCase();
186
221
  if (/(^|\/)\.github\/workflows\/[^/]+\.ya?ml$/i.test(normalized))
187
222
  return true;
188
223
  if (base === "action.yml" || base === "action.yaml")
@@ -328,10 +363,10 @@ async function resolveGitHubToken(envKeys = ["GITHUB_TOKEN", "GH_TOKEN"], option
328
363
 
329
364
  // dist/clients/installer/index.js
330
365
  var _installerRequire = createRequire(import.meta.url);
331
- var TOOLS_DIR = path3.join(getGlobalPiLensDir(), "tools");
366
+ var TOOLS_DIR = path4.join(getGlobalPiLensDir(), "tools");
332
367
  var USER_BASE_PROBE_TIMEOUT_MS = 5e3;
333
368
  var ARCHIVE_COMMAND_TIMEOUT_MS = 12e4;
334
- var INSTALL_LOCK_PATH = path3.join(TOOLS_DIR, ".install.lock");
369
+ var INSTALL_LOCK_PATH = path4.join(TOOLS_DIR, ".install.lock");
335
370
  var INSTALL_LOCK_GENERATIONS = `${INSTALL_LOCK_PATH}s`;
336
371
  var activeInstallLocks = /* @__PURE__ */ new Set();
337
372
  var installLockExitCleanupRegistered = false;
@@ -356,7 +391,7 @@ function legacyInstallLockIsStale(maxAgeMs) {
356
391
  return expired || Number.isInteger(owner.pid) && owner.pid > 0 && !isProcessAlive(owner.pid);
357
392
  } catch {
358
393
  try {
359
- return Date.now() - statSync(INSTALL_LOCK_PATH).mtimeMs > maxAgeMs;
394
+ return Date.now() - statSync2(INSTALL_LOCK_PATH).mtimeMs > maxAgeMs;
360
395
  } catch {
361
396
  return false;
362
397
  }
@@ -466,7 +501,7 @@ async function acquireInstallLock() {
466
501
  };
467
502
  }
468
503
  var GLOBAL_HOME_DIR = getGlobalPiLensDir();
469
- var GITHUB_BIN_DIR = path3.join(GLOBAL_HOME_DIR, "bin");
504
+ var GITHUB_BIN_DIR = path4.join(GLOBAL_HOME_DIR, "bin");
470
505
  var GITHUB_BIN_DIR_PINNED = Boolean(process.env.PI_LENS_HOME?.trim());
471
506
  function assertManagedBinDirInsidePinnedHome(toolId) {
472
507
  if (!GITHUB_BIN_DIR_PINNED)
@@ -1472,6 +1507,54 @@ var TOOLS = [
1472
1507
  binaryInArchive: "typos-lsp"
1473
1508
  }
1474
1509
  },
1510
+ {
1511
+ // fallow-lsp (#4929): the TS/JS dead-code, duplication and cycle analyzer's
1512
+ // LSP server, an OPT-IN language-scoped auxiliary (`--lens-fallow`). One
1513
+ // release archive per target holds four sibling binaries (`fallow`,
1514
+ // `fallow-lsp`, `fallow-mcp`, `fallow-similar-code`) at the archive root
1515
+ // (verified on the 3.37.0 tar.gz and zip listings), so this is a native TREE
1516
+ // BUNDLE like clangd and FallowServer launches `<bundle>/fallow-lsp`. The
1517
+ // version is pinned and every archive is checked against its sha256 before
1518
+ // extraction (a mismatch or an unpinned URL refuses the install). The
1519
+ // release's `SHA256SUMS` lists only the VS Code extension files, so the pins
1520
+ // are the per-asset digests GitHub publishes (`gh api
1521
+ // repos/fallow-rs/fallow/releases/tags/v3.37.0 --jq
1522
+ // '.assets[]|[.name,.digest]|@tsv'`), each re-computed here from the
1523
+ // downloaded bytes. The tree marker is the `fallow-lsp` binary itself
1524
+ // (`fallow-lsp.exe` on Windows). Linux uses the gnu build (needs glibc 2.30);
1525
+ // Windows arm64 has its own build.
1526
+ id: "fallow-lsp",
1527
+ name: "fallow-lsp",
1528
+ checkCommand: "fallow-lsp",
1529
+ checkArgs: ["--version"],
1530
+ installStrategy: "archive",
1531
+ binaryName: "fallow-lsp",
1532
+ archive: {
1533
+ url: (platform, arch) => {
1534
+ const base = "https://github.com/fallow-rs/fallow/releases/download/v3.37.0";
1535
+ if (arch !== "x64" && arch !== "arm64")
1536
+ return void 0;
1537
+ if (platform === "linux")
1538
+ return arch === "arm64" ? `${base}/fallow-aarch64-unknown-linux-gnu.tar.gz` : `${base}/fallow-x86_64-unknown-linux-gnu.tar.gz`;
1539
+ if (platform === "darwin")
1540
+ return arch === "arm64" ? `${base}/fallow-aarch64-apple-darwin.tar.gz` : `${base}/fallow-x86_64-apple-darwin.tar.gz`;
1541
+ if (platform === "win32")
1542
+ return arch === "arm64" ? `${base}/fallow-aarch64-pc-windows-msvc.zip` : `${base}/fallow-x86_64-pc-windows-msvc.zip`;
1543
+ return void 0;
1544
+ },
1545
+ kind: (platform) => platform === "win32" ? "zip" : "tgz",
1546
+ stripComponents: 0,
1547
+ treeMarker: (platform) => platform === "win32" ? "fallow-lsp.exe" : "fallow-lsp",
1548
+ sha256: {
1549
+ "https://github.com/fallow-rs/fallow/releases/download/v3.37.0/fallow-aarch64-unknown-linux-gnu.tar.gz": "cbbf98681687fd2f43be852f15aab8ad34fb51cf6f7e354d3bdc1a9b7cba9c5a",
1550
+ "https://github.com/fallow-rs/fallow/releases/download/v3.37.0/fallow-x86_64-unknown-linux-gnu.tar.gz": "7c09d9b7812be030951f75ebfdd98a4e23ecaee6260c34d7e7f3a6c28a0c3cf0",
1551
+ "https://github.com/fallow-rs/fallow/releases/download/v3.37.0/fallow-aarch64-apple-darwin.tar.gz": "02caed6d3da52ea5ffff84b8619bc399a9302c5c6748633177db64005895a159",
1552
+ "https://github.com/fallow-rs/fallow/releases/download/v3.37.0/fallow-x86_64-apple-darwin.tar.gz": "abf1897d6521dbd8fbfb01a4add5070538fdb7cde049090f991780fd3576acc6",
1553
+ "https://github.com/fallow-rs/fallow/releases/download/v3.37.0/fallow-aarch64-pc-windows-msvc.zip": "26529ecf3a031c01d13adbdbf831ba627c20cf5e4ff95000a1b6ec1497513c83",
1554
+ "https://github.com/fallow-rs/fallow/releases/download/v3.37.0/fallow-x86_64-pc-windows-msvc.zip": "f20ad53eb2190e9ab04288a58068f568699757744fccf5adca216a5250789134"
1555
+ }
1556
+ }
1557
+ },
1475
1558
  {
1476
1559
  id: "tflint",
1477
1560
  name: "tflint",
@@ -1838,7 +1921,7 @@ var resolvedPathCache = new BoundedLruCache(256);
1838
1921
  function resetResolvedPathCache() {
1839
1922
  resolvedPathCache.clear();
1840
1923
  }
1841
- var PROBE_CACHE_PATH = path3.join(getGlobalPiLensDir(), "probe-cache.json");
1924
+ var PROBE_CACHE_PATH = path4.join(getGlobalPiLensDir(), "probe-cache.json");
1842
1925
  var PROBE_CACHE_LOCK_STALE_MS = 18e4;
1843
1926
  var PROBE_CACHE_TTL_MS = 24 * 60 * 60 * 1e3;
1844
1927
  var PROBE_CACHE_TRANSIENT_COOLDOWN_MS = TRANSIENT_MAX_COOLDOWN_MS;
@@ -2004,6 +2087,17 @@ async function flushProbeCache() {
2004
2087
  _probeCacheWriteInFlight = null;
2005
2088
  }
2006
2089
  }
2090
+ async function settleProbeCacheForTests() {
2091
+ const result = await flushProbeCache();
2092
+ if (result === "idle" || result === "written")
2093
+ return void 0;
2094
+ if (_probeCacheFlushTimer !== null) {
2095
+ clearTimeout(_probeCacheFlushTimer);
2096
+ _probeCacheFlushTimer = null;
2097
+ }
2098
+ return `probe-cache flush did not land (${result})`;
2099
+ }
2100
+ registerBackgroundWriteDrain(settleProbeCacheForTests);
2007
2101
  function isAstGrepVersionOutput(output) {
2008
2102
  return /\bast[- ]grep\b/i.test(output);
2009
2103
  }
@@ -2100,35 +2194,13 @@ function resetPathWalkMemo() {
2100
2194
  pathWalkMemo.clear();
2101
2195
  }
2102
2196
  async function isCommandAvailable(command, _args) {
2103
- const isWindows = installerPlatform() === "win32";
2104
- const pathEnv = process.env.PATH || process.env.Path || process.env.path || "";
2105
- const dirs = pathEnv.split(path3.delimiter);
2106
- const names = isWindows ? [command, `${command}.exe`, `${command}.cmd`, `${command}.bat`] : [command];
2107
- for (const dir of dirs) {
2108
- if (!dir)
2109
- continue;
2110
- for (const name of names) {
2111
- const candidate = isWindows ? path3.join(dir, name) : `${dir}${path3.sep}${name}`;
2112
- try {
2113
- const stat = statSync(candidate);
2114
- if (!stat.isFile() || stat.size === 0)
2115
- continue;
2116
- if (isUntrustedProjectPath(candidate)) {
2117
- recordProjectCommandRefusal(candidate);
2118
- continue;
2119
- }
2120
- return true;
2121
- } catch {
2122
- }
2123
- }
2124
- }
2125
- return false;
2197
+ return findCommandOnPath(command, installerPlatform() === "win32") !== null;
2126
2198
  }
2127
2199
  async function isSpawnableCommand(command) {
2128
2200
  const namesPath = installerPlatform() === "win32" ? /[\\/]/.test(command) : command.includes("/");
2129
2201
  if (namesPath) {
2130
2202
  try {
2131
- const stat = statSync(command);
2203
+ const stat = statSync2(command);
2132
2204
  return stat.isFile() && stat.size > 0;
2133
2205
  } catch {
2134
2206
  return false;
@@ -2159,17 +2231,17 @@ function packageEntryVerification(tool) {
2159
2231
  return tool.verification === "package-entry" ? tool.packageName : void 0;
2160
2232
  }
2161
2233
  async function verifyNpmPackageEntry(binPath, packageName) {
2162
- const nodeModulesDir = path3.dirname(path3.dirname(binPath));
2234
+ const nodeModulesDir = path4.dirname(path4.dirname(binPath));
2163
2235
  const pinned = parsePinnedVersion(packageName);
2164
2236
  const bareName = pinned ? packageName.slice(0, -(pinned.length + 1)) : packageName;
2165
- const packageDir = path3.join(nodeModulesDir, ...bareName.split("/"));
2166
- const shimName = path3.basename(binPath).replace(/\.(cmd|exe|ps1|bat)$/i, "").toLowerCase();
2237
+ const packageDir = path4.join(nodeModulesDir, ...bareName.split("/"));
2238
+ const shimName = path4.basename(binPath).replace(/\.(cmd|exe|ps1|bat)$/i, "").toLowerCase();
2167
2239
  const fail = (reason) => {
2168
2240
  logSessionStart(`auto-install verify: failed for ${binPath} (check=package-entry, kind=${reason})`);
2169
2241
  return false;
2170
2242
  };
2171
2243
  try {
2172
- const shim = statSync(binPath);
2244
+ const shim = statSync2(binPath);
2173
2245
  if (!shim.isFile() || shim.size === 0)
2174
2246
  return fail("shim-not-a-file");
2175
2247
  } catch {
@@ -2177,7 +2249,7 @@ async function verifyNpmPackageEntry(binPath, packageName) {
2177
2249
  }
2178
2250
  let manifest;
2179
2251
  try {
2180
- manifest = JSON.parse(await fs2.readFile(path3.join(packageDir, "package.json"), "utf8"));
2252
+ manifest = JSON.parse(await fs2.readFile(path4.join(packageDir, "package.json"), "utf8"));
2181
2253
  } catch {
2182
2254
  return fail("package-json-unreadable");
2183
2255
  }
@@ -2195,7 +2267,7 @@ async function verifyNpmPackageEntry(binPath, packageName) {
2195
2267
  return fail("package-json-no-entry");
2196
2268
  }
2197
2269
  try {
2198
- const stat = statSync(path3.join(packageDir, entry));
2270
+ const stat = statSync2(path4.join(packageDir, entry));
2199
2271
  if (!stat.isFile() || stat.size === 0)
2200
2272
  return fail("entry-not-a-file");
2201
2273
  } catch {
@@ -2266,9 +2338,12 @@ ${result.stderr}`;
2266
2338
  return false;
2267
2339
  }
2268
2340
  }
2269
- async function getAllToolStatuses() {
2341
+ async function getAllToolStatuses(toolIds) {
2270
2342
  const statuses = [];
2343
+ const only = toolIds ? new Set(toolIds) : void 0;
2271
2344
  for (const tool of TOOLS) {
2345
+ if (only && !only.has(tool.id))
2346
+ continue;
2272
2347
  const status = {
2273
2348
  id: tool.id,
2274
2349
  name: tool.name,
@@ -2329,7 +2404,7 @@ async function getAllToolStatuses() {
2329
2404
  continue;
2330
2405
  }
2331
2406
  }
2332
- const localBase = path3.join(TOOLS_DIR, "node_modules", ".bin", tool.binaryName || tool.id);
2407
+ const localBase = path4.join(TOOLS_DIR, "node_modules", ".bin", tool.binaryName || tool.id);
2333
2408
  const localPath = installerPlatform() === "win32" ? `${localBase}.cmd` : localBase;
2334
2409
  try {
2335
2410
  await fs2.access(localPath);
@@ -2356,8 +2431,9 @@ async function getArchiveTreeBundlePath(tool) {
2356
2431
  if (tool.installStrategy !== "archive" || tool.archive?.launcher) {
2357
2432
  return void 0;
2358
2433
  }
2359
- const extractDir = path3.join(TOOLS_DIR, tool.id);
2360
- const marker = tool.archive?.treeMarker ? path3.join(extractDir, ...tool.archive.treeMarker.split("/")) : extractDir;
2434
+ const extractDir = path4.join(TOOLS_DIR, tool.id);
2435
+ const treeMarker = tool.archive && resolveTreeMarker(tool.archive);
2436
+ const marker = treeMarker ? path4.join(extractDir, ...treeMarker.split("/")) : extractDir;
2361
2437
  try {
2362
2438
  await fs2.access(marker);
2363
2439
  return extractDir;
@@ -2378,14 +2454,14 @@ function resolvePlatformPackageBinary(tool) {
2378
2454
  const fromMain = createRequire(mainPkgJson);
2379
2455
  let pkgDir;
2380
2456
  try {
2381
- pkgDir = path3.dirname(fromMain.resolve(`${platformPkg}/package.json`));
2457
+ pkgDir = path4.dirname(fromMain.resolve(`${platformPkg}/package.json`));
2382
2458
  } catch {
2383
- pkgDir = path3.dirname(_installerRequire.resolve(`${platformPkg}/package.json`));
2459
+ pkgDir = path4.dirname(_installerRequire.resolve(`${platformPkg}/package.json`));
2384
2460
  }
2385
2461
  const isWin = installerPlatform() === "win32";
2386
2462
  for (const bin of spec.binaries) {
2387
2463
  for (const name of isWin ? [`${bin}.exe`, bin] : [bin]) {
2388
- const candidate = path3.join(pkgDir, name);
2464
+ const candidate = path4.join(pkgDir, name);
2389
2465
  if (existsSync(candidate))
2390
2466
  return candidate;
2391
2467
  }
@@ -2423,7 +2499,7 @@ async function getToolPathResolved(toolId, onTransient, storeOnly) {
2423
2499
  if (seen)
2424
2500
  lastManagedInstallVersion.set(toolId, seen);
2425
2501
  } : void 0;
2426
- const localBase = path3.join(TOOLS_DIR, "node_modules", ".bin", tool.binaryName || tool.id);
2502
+ const localBase = path4.join(TOOLS_DIR, "node_modules", ".bin", tool.binaryName || tool.id);
2427
2503
  if (installerPlatform() === "win32") {
2428
2504
  const cmdPath = `${localBase}.cmd`;
2429
2505
  try {
@@ -2508,11 +2584,11 @@ async function getToolPathResolved(toolId, onTransient, storeOnly) {
2508
2584
  async function findGitHubToolPath(binaryName) {
2509
2585
  const isWindows = process.platform === "win32";
2510
2586
  const candidates = isWindows ? [
2511
- path3.join(GITHUB_BIN_DIR, `${binaryName}.exe`),
2512
- path3.join(GITHUB_BIN_DIR, `${binaryName}.bat`),
2513
- path3.join(GITHUB_BIN_DIR, `${binaryName}.cmd`),
2514
- path3.join(GITHUB_BIN_DIR, binaryName)
2515
- ] : [path3.join(GITHUB_BIN_DIR, binaryName)];
2587
+ path4.join(GITHUB_BIN_DIR, `${binaryName}.exe`),
2588
+ path4.join(GITHUB_BIN_DIR, `${binaryName}.bat`),
2589
+ path4.join(GITHUB_BIN_DIR, `${binaryName}.cmd`),
2590
+ path4.join(GITHUB_BIN_DIR, binaryName)
2591
+ ] : [path4.join(GITHUB_BIN_DIR, binaryName)];
2516
2592
  for (const candidate of candidates) {
2517
2593
  try {
2518
2594
  await fs2.access(candidate);
@@ -2573,9 +2649,9 @@ async function findNpmGlobalToolPath(binaryName, onTransient, verificationArgs =
2573
2649
  const binDirs = await getNpmGlobalBinCandidates(onTransient);
2574
2650
  for (const dir of binDirs) {
2575
2651
  const candidates = isWindows ? [
2576
- path3.join(dir, `${binaryName}.cmd`),
2577
- path3.join(dir, `${binaryName}.exe`)
2578
- ] : [path3.join(dir, binaryName)];
2652
+ path4.join(dir, `${binaryName}.cmd`),
2653
+ path4.join(dir, `${binaryName}.exe`)
2654
+ ] : [path4.join(dir, binaryName)];
2579
2655
  for (const candidate of candidates) {
2580
2656
  try {
2581
2657
  await fs2.access(candidate);
@@ -2598,7 +2674,7 @@ async function getNpmGlobalBinCandidates(onTransient) {
2598
2674
  const add = (value) => {
2599
2675
  if (!value)
2600
2676
  return;
2601
- const normalized = path3.resolve(value.trim());
2677
+ const normalized = path4.resolve(value.trim());
2602
2678
  if (!normalized)
2603
2679
  return;
2604
2680
  if (seen.has(normalized))
@@ -2607,9 +2683,9 @@ async function getNpmGlobalBinCandidates(onTransient) {
2607
2683
  dirs.push(normalized);
2608
2684
  };
2609
2685
  if (process.platform === "win32") {
2610
- add(path3.join(process.env.APPDATA || "", "npm"));
2686
+ add(path4.join(process.env.APPDATA || "", "npm"));
2611
2687
  } else {
2612
- add(path3.join(os.homedir(), ".npm-global", "bin"));
2688
+ add(path4.join(os.homedir(), ".npm-global", "bin"));
2613
2689
  }
2614
2690
  for (const dir of await allAvailableGlobalBinDirs(onTransient)) {
2615
2691
  add(dir);
@@ -2619,8 +2695,8 @@ async function getNpmGlobalBinCandidates(onTransient) {
2619
2695
  async function findPipUserToolPath(binaryName, onTransient, verificationArgs = ["--version"], verificationTimeoutMs = 1e4, piLensPrefixesOnly = false) {
2620
2696
  const isWindows = installerPlatform() === "win32";
2621
2697
  const userBaseCandidates = [
2622
- path3.join(getGlobalPiLensDir(), "pip-tools"),
2623
- path3.join(getGlobalPiLensDir(), "pip-user"),
2698
+ path4.join(getGlobalPiLensDir(), "pip-tools"),
2699
+ path4.join(getGlobalPiLensDir(), "pip-user"),
2624
2700
  ...piLensPrefixesOnly ? [] : await getPythonUserBaseCandidates()
2625
2701
  ];
2626
2702
  for (const userBase of userBaseCandidates) {
@@ -2633,17 +2709,17 @@ async function findPipUserToolPath(binaryName, onTransient, verificationArgs = [
2633
2709
  continue;
2634
2710
  if (!/^python\d+$/i.test(entry.name))
2635
2711
  continue;
2636
- scriptDirs.push(path3.join(userBase, entry.name, "Scripts"));
2712
+ scriptDirs.push(path4.join(userBase, entry.name, "Scripts"));
2637
2713
  }
2638
2714
  } catch {
2639
2715
  }
2640
2716
  }
2641
2717
  for (const dir of scriptDirs) {
2642
2718
  const candidates = isWindows ? [
2643
- path3.join(dir, `${binaryName}.exe`),
2644
- path3.join(dir, `${binaryName}.cmd`),
2645
- path3.join(dir, binaryName)
2646
- ] : [path3.join(dir, binaryName)];
2719
+ path4.join(dir, `${binaryName}.exe`),
2720
+ path4.join(dir, `${binaryName}.cmd`),
2721
+ path4.join(dir, binaryName)
2722
+ ] : [path4.join(dir, binaryName)];
2647
2723
  for (const candidate of candidates) {
2648
2724
  try {
2649
2725
  await fs2.access(candidate);
@@ -2689,7 +2765,7 @@ async function getPythonUserBaseCandidates() {
2689
2765
  candidates.push(normalized);
2690
2766
  };
2691
2767
  if (process.platform === "win32") {
2692
- add(path3.join(process.env.APPDATA || "", "Python"));
2768
+ add(path4.join(process.env.APPDATA || "", "Python"));
2693
2769
  }
2694
2770
  const probes = process.platform === "win32" ? [
2695
2771
  { command: "py", args: ["-m", "site", "--user-base"] },
@@ -2848,7 +2924,7 @@ async function installGitHubTool(tool, prefetchedRelease) {
2848
2924
  const binaryName = tool.binaryName ?? tool.id;
2849
2925
  const isWindows = platform === "win32";
2850
2926
  const finalBinaryName = getGitHubInstalledBinaryName(binaryName, platform, asset.name);
2851
- let destPath = path3.join(GITHUB_BIN_DIR, finalBinaryName);
2927
+ let destPath = path4.join(GITHUB_BIN_DIR, finalBinaryName);
2852
2928
  const assetName = asset.name;
2853
2929
  const launcherRuntime = launcherForGitHubAsset(spec, assetName);
2854
2930
  if (launcherRuntime && !await isCommandAvailable(launcherRuntime, ["--version"])) {
@@ -2858,13 +2934,13 @@ async function installGitHubTool(tool, prefetchedRelease) {
2858
2934
  try {
2859
2935
  assertManagedBinDirInsidePinnedHome(tool.id);
2860
2936
  if (launcherRuntime) {
2861
- const assetPath = path3.join(GITHUB_BIN_DIR, `${tool.id}${assetName.endsWith(".phar") ? ".phar" : ".jar"}`);
2937
+ const assetPath = path4.join(GITHUB_BIN_DIR, `${tool.id}${assetName.endsWith(".phar") ? ".phar" : ".jar"}`);
2862
2938
  await writeFileAtomicAsync(assetPath, assetBuffer, {
2863
2939
  bestEffort: false,
2864
2940
  mode: 488
2865
2941
  });
2866
2942
  const launcherName = isWindows ? `${binaryName}.bat` : binaryName;
2867
- destPath = path3.join(GITHUB_BIN_DIR, launcherName);
2943
+ destPath = path4.join(GITHUB_BIN_DIR, launcherName);
2868
2944
  const runtimeTarget = assetName.endsWith(".phar") ? `${tool.id}.phar` : `${tool.id}.jar`;
2869
2945
  const command = isWindows ? `@echo off\r
2870
2946
  ${launcherRuntime} "%~dp0${runtimeTarget}" %*\r
@@ -2889,9 +2965,9 @@ exec ${launcherRuntime} "$(dirname "$0")/${runtimeTarget}" "$@"
2889
2965
  mode: 488
2890
2966
  });
2891
2967
  } else if (assetName.endsWith(".tar.gz") || assetName.endsWith(".tar.xz")) {
2892
- const tmpArchive = path3.join(GITHUB_BIN_DIR, `_tmp_${assetName}`);
2968
+ const tmpArchive = path4.join(GITHUB_BIN_DIR, `_tmp_${assetName}`);
2893
2969
  await fs2.writeFile(tmpArchive, assetBuffer);
2894
- const tmpDir = path3.join(GITHUB_BIN_DIR, `_tmp_extract_${tool.id}`);
2970
+ const tmpDir = path4.join(GITHUB_BIN_DIR, `_tmp_extract_${tool.id}`);
2895
2971
  await fs2.mkdir(tmpDir, { recursive: true });
2896
2972
  const extracted = await runCommand("tar", ["xf", tmpArchive, "-C", tmpDir], GITHUB_BIN_DIR);
2897
2973
  await fs2.rm(tmpArchive, { force: true });
@@ -2912,9 +2988,9 @@ exec ${launcherRuntime} "$(dirname "$0")/${runtimeTarget}" "$@"
2912
2988
  if (!isWindows)
2913
2989
  await fs2.chmod(destPath, 488);
2914
2990
  } else if (assetName.endsWith(".zip")) {
2915
- const tmpArchive = path3.join(GITHUB_BIN_DIR, `_tmp_${assetName}`);
2991
+ const tmpArchive = path4.join(GITHUB_BIN_DIR, `_tmp_${assetName}`);
2916
2992
  await fs2.writeFile(tmpArchive, assetBuffer);
2917
- const tmpDir = path3.join(GITHUB_BIN_DIR, `_tmp_extract_${tool.id}`);
2993
+ const tmpDir = path4.join(GITHUB_BIN_DIR, `_tmp_extract_${tool.id}`);
2918
2994
  await fs2.mkdir(tmpDir, { recursive: true });
2919
2995
  const extracted = isWindows ? await runCommand("powershell", [
2920
2996
  "-NoProfile",
@@ -2956,7 +3032,7 @@ exec ${launcherRuntime} "$(dirname "$0")/${runtimeTarget}" "$@"
2956
3032
  }
2957
3033
  try {
2958
3034
  const extraBuffer = await httpsGet(extraAsset.browser_download_url);
2959
- await writeFileAtomicAsync(path3.join(GITHUB_BIN_DIR, extraName), extraBuffer, { bestEffort: false, mode: 488 });
3035
+ await writeFileAtomicAsync(path4.join(GITHUB_BIN_DIR, extraName), extraBuffer, { bestEffort: false, mode: 488 });
2960
3036
  logSessionStart(`github-install ${tool.id}: installed extra asset ${extraName} (${extraBuffer.length} bytes)`);
2961
3037
  } catch (err) {
2962
3038
  logSessionStart(`github-install ${tool.id}: extra asset ${extraName} download failed: ${err.message}`);
@@ -2971,7 +3047,7 @@ async function findFirstFileRecursive(dir, names) {
2971
3047
  const wanted = new Set(names.map((name) => name.toLowerCase()));
2972
3048
  const entries = await fs2.readdir(dir, { withFileTypes: true });
2973
3049
  for (const entry of entries) {
2974
- const full = path3.join(dir, entry.name);
3050
+ const full = path4.join(dir, entry.name);
2975
3051
  if (entry.isDirectory()) {
2976
3052
  const found = await findFirstFileRecursive(full, names);
2977
3053
  if (found)
@@ -3100,7 +3176,7 @@ async function isManagedToolPresent(toolId) {
3100
3176
  if (!tool.packageName)
3101
3177
  return false;
3102
3178
  try {
3103
- await fs2.access(path3.join(TOOLS_DIR, "node_modules", tool.packageName, "package.json"));
3179
+ await fs2.access(path4.join(TOOLS_DIR, "node_modules", tool.packageName, "package.json"));
3104
3180
  return true;
3105
3181
  } catch {
3106
3182
  return false;
@@ -3387,7 +3463,7 @@ async function refreshPinnedManagedTool(tool, known) {
3387
3463
  };
3388
3464
  }
3389
3465
  function resolveManagedNpmBinPath(binaryName) {
3390
- const binBase = path3.join(TOOLS_DIR, "node_modules", ".bin", binaryName);
3466
+ const binBase = path4.join(TOOLS_DIR, "node_modules", ".bin", binaryName);
3391
3467
  return installerPlatform() === "win32" ? `${binBase}.cmd` : binBase;
3392
3468
  }
3393
3469
  function invalidateManagedToolResolution(toolId) {
@@ -3425,10 +3501,10 @@ async function installMavenTool(tool) {
3425
3501
  try {
3426
3502
  await fs2.mkdir(GITHUB_BIN_DIR, { recursive: true });
3427
3503
  assertManagedBinDirInsidePinnedHome(tool.id);
3428
- const jarPath = path3.join(GITHUB_BIN_DIR, `${tool.id}.jar`);
3504
+ const jarPath = path4.join(GITHUB_BIN_DIR, `${tool.id}.jar`);
3429
3505
  await writeFileAtomicAsync(jarPath, jarBuffer, { bestEffort: false });
3430
3506
  const launcherName = isWindows ? `${binaryName}.bat` : binaryName;
3431
- const launcherPath = path3.join(GITHUB_BIN_DIR, launcherName);
3507
+ const launcherPath = path4.join(GITHUB_BIN_DIR, launcherName);
3432
3508
  if (isWindows) {
3433
3509
  await writeFileAtomicAsync(launcherPath, `@echo off\r
3434
3510
  java -jar "%~dp0${tool.id}.jar" %*\r
@@ -3449,6 +3525,9 @@ exec java -jar "$(dirname "$0")/${tool.id}.jar" "$@"
3449
3525
  function resolveArchiveUrl(spec, platform = installerPlatform(), arch = process.arch) {
3450
3526
  return typeof spec.url === "function" ? spec.url(platform, arch) : spec.url;
3451
3527
  }
3528
+ function resolveTreeMarker(spec, platform = installerPlatform()) {
3529
+ return typeof spec.treeMarker === "function" ? spec.treeMarker(platform) : spec.treeMarker;
3530
+ }
3452
3531
  function resolveArchiveKind(spec, platform = installerPlatform(), arch = process.arch) {
3453
3532
  return typeof spec.kind === "function" ? spec.kind(platform, arch) : spec.kind;
3454
3533
  }
@@ -3465,9 +3544,9 @@ async function stripExtractedArchiveRoot(dir, components) {
3465
3544
  const [entry] = entries;
3466
3545
  if (entries.length !== 1 || !entry?.isDirectory())
3467
3546
  return false;
3468
- const root = path3.join(dir, entry.name);
3547
+ const root = path4.join(dir, entry.name);
3469
3548
  for (const child of await fs2.readdir(root))
3470
- await fs2.rename(path3.join(root, child), path3.join(dir, child));
3549
+ await fs2.rename(path4.join(root, child), path4.join(dir, child));
3471
3550
  await fs2.rm(root, { recursive: true, force: true });
3472
3551
  }
3473
3552
  return true;
@@ -3517,7 +3596,7 @@ function runtimeHomeVerdict(runtime) {
3517
3596
  const names = windows ? [`${runtime}.exe`, runtime] : [runtime];
3518
3597
  return names.some((name) => {
3519
3598
  try {
3520
- const stat = statSync(path3.join(root, home.dir, name));
3599
+ const stat = statSync2(path4.join(root, home.dir, name));
3521
3600
  return stat.isFile() && stat.size > 0 && (windows || (stat.mode & 73) !== 0);
3522
3601
  } catch {
3523
3602
  return false;
@@ -3562,9 +3641,9 @@ async function installArchiveTool(tool) {
3562
3641
  const extractName = tool.id;
3563
3642
  const tmpExtractName = `${extractName}.refresh-tmp`;
3564
3643
  const archiveName = `${tool.id}.download.${archiveKind === "zip" ? "zip" : "tgz"}`;
3565
- const extractDir = path3.join(TOOLS_DIR, extractName);
3566
- const tmpExtractDir = path3.join(TOOLS_DIR, tmpExtractName);
3567
- const tmpArchive = path3.join(TOOLS_DIR, archiveName);
3644
+ const extractDir = path4.join(TOOLS_DIR, extractName);
3645
+ const tmpExtractDir = path4.join(TOOLS_DIR, tmpExtractName);
3646
+ const tmpArchive = path4.join(TOOLS_DIR, archiveName);
3568
3647
  try {
3569
3648
  await fs2.mkdir(TOOLS_DIR, { recursive: true });
3570
3649
  await fs2.rm(tmpExtractDir, { recursive: true, force: true });
@@ -3582,7 +3661,7 @@ async function installArchiveTool(tool) {
3582
3661
  tmpExtractName,
3583
3662
  ...stripComponents > 0 ? [`--strip-components=${stripComponents}`] : []
3584
3663
  ];
3585
- const extractor = archiveKind === "zip" && isWindows ? `${process.env.SystemRoot ?? "C:\\Windows"}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe` : archiveKind === "zip" ? "unzip" : isWindows ? `${process.env.SystemRoot ?? "C:\\Windows"}\\System32\\tar.exe` : "tar";
3664
+ const extractor = archiveKind === "zip" && isWindows ? windowsExe("WindowsPowerShell\\v1.0\\powershell.exe") : archiveKind === "zip" ? "unzip" : isWindows ? windowsExe("tar.exe") : "tar";
3586
3665
  const extractionResult = await safeSpawnAsync(extractor, extractionArgs, {
3587
3666
  cwd: TOOLS_DIR,
3588
3667
  timeout: 12e4,
@@ -3609,7 +3688,8 @@ async function installArchiveTool(tool) {
3609
3688
  return void 0;
3610
3689
  }
3611
3690
  if (!spec.launcher) {
3612
- const tmpMarker = spec.treeMarker ? path3.join(tmpExtractDir, ...spec.treeMarker.split("/")) : tmpExtractDir;
3691
+ const treeMarker = resolveTreeMarker(spec, platform);
3692
+ const tmpMarker = treeMarker ? path4.join(tmpExtractDir, ...treeMarker.split("/")) : tmpExtractDir;
3613
3693
  try {
3614
3694
  await fs2.access(tmpMarker);
3615
3695
  } catch {
@@ -3625,7 +3705,7 @@ async function installArchiveTool(tool) {
3625
3705
  return extractDir;
3626
3706
  }
3627
3707
  const launcherParts = spec.launcher.split("/").map((p) => p);
3628
- const tmpInnerLauncher = path3.join(tmpExtractDir, ...launcherParts);
3708
+ const tmpInnerLauncher = path4.join(tmpExtractDir, ...launcherParts);
3629
3709
  const tmpResolvedInner = isWindows ? `${tmpInnerLauncher}.bat` : tmpInnerLauncher;
3630
3710
  try {
3631
3711
  await fs2.access(tmpResolvedInner);
@@ -3651,10 +3731,10 @@ async function installArchiveTool(tool) {
3651
3731
  await fs2.mkdir(GITHUB_BIN_DIR, { recursive: true });
3652
3732
  assertManagedBinDirInsidePinnedHome(tool.id);
3653
3733
  await swapExtractedDir(tool.id, tmpExtractDir, extractDir);
3654
- const innerLauncher = path3.join(extractDir, ...launcherParts);
3734
+ const innerLauncher = path4.join(extractDir, ...launcherParts);
3655
3735
  const resolvedInner = isWindows ? `${innerLauncher}.bat` : innerLauncher;
3656
3736
  const launcherName = isWindows ? `${binaryName}.bat` : binaryName;
3657
- const shimPath = path3.join(GITHUB_BIN_DIR, launcherName);
3737
+ const shimPath = path4.join(GITHUB_BIN_DIR, launcherName);
3658
3738
  if (isWindows) {
3659
3739
  await writeFileAtomicAsync(shimPath, `@echo off\r
3660
3740
  call "${resolvedInner}" %*\r
@@ -3703,7 +3783,7 @@ async function installNpmTool(toolId, packageName, binaryName, verificationArgs
3703
3783
  };
3704
3784
  try {
3705
3785
  await fs2.mkdir(TOOLS_DIR, { recursive: true });
3706
- const packageJsonPath = path3.join(TOOLS_DIR, "package.json");
3786
+ const packageJsonPath = path4.join(TOOLS_DIR, "package.json");
3707
3787
  try {
3708
3788
  await fs2.access(packageJsonPath);
3709
3789
  } catch {
@@ -3751,7 +3831,7 @@ async function installNpmTool(toolId, packageName, binaryName, verificationArgs
3751
3831
  if (!outcome.ok) {
3752
3832
  throw new Error(`Failed to install ${packageName}: ${outcome.stderr}`);
3753
3833
  }
3754
- const binBase = path3.join(TOOLS_DIR, "node_modules", ".bin", binaryName);
3834
+ const binBase = path4.join(TOOLS_DIR, "node_modules", ".bin", binaryName);
3755
3835
  const binPath = installerPlatform() === "win32" ? `${binBase}.cmd` : binBase;
3756
3836
  if (installerPlatform() !== "win32") {
3757
3837
  try {
@@ -3793,7 +3873,7 @@ async function installNpmTool(toolId, packageName, binaryName, verificationArgs
3793
3873
  if (!isValid) {
3794
3874
  logSessionStart(`auto-install ${packageName}: installed but verification failed, cleaning up`);
3795
3875
  try {
3796
- const packagePath = path3.join(TOOLS_DIR, "node_modules", packageName);
3876
+ const packagePath = path4.join(TOOLS_DIR, "node_modules", packageName);
3797
3877
  await fs2.rm(packagePath, { recursive: true, force: true });
3798
3878
  await fs2.rm(binBase, { force: true });
3799
3879
  if (isWindows) {
@@ -3813,7 +3893,7 @@ function pipCommandCandidates() {
3813
3893
  return process.platform === "win32" ? ["pip", "py", "python"] : ["pip3", "pip", "python3", "python"];
3814
3894
  }
3815
3895
  function pipScriptsDir(base, platform = installerPlatform()) {
3816
- return path3.join(base, platform === "win32" ? "Scripts" : "bin");
3896
+ return path4.join(base, platform === "win32" ? "Scripts" : "bin");
3817
3897
  }
3818
3898
  var pipPep668LoggedRefusals = createGenerationMap("installer-pep668-log");
3819
3899
  async function pipConstraintEnvFor(toolId) {
@@ -3821,8 +3901,8 @@ async function pipConstraintEnvFor(toolId) {
3821
3901
  if (!constraints || constraints.length === 0)
3822
3902
  return {};
3823
3903
  const directories = [
3824
- path3.join(getGlobalPiLensDir(), "pip-constraints"),
3825
- path3.join(os.tmpdir(), "pi-lens-pip-constraints")
3904
+ path4.join(getGlobalPiLensDir(), "pip-constraints"),
3905
+ path4.join(os.tmpdir(), "pi-lens-pip-constraints")
3826
3906
  ];
3827
3907
  const directory = directories.find((candidate) => !/\s/.test(candidate));
3828
3908
  if (!directory) {
@@ -3833,9 +3913,9 @@ async function pipConstraintEnvFor(toolId) {
3833
3913
  });
3834
3914
  return {};
3835
3915
  }
3836
- const file = path3.join(directory, `${toolId}.txt`);
3916
+ const file = path4.join(directory, `${toolId}.txt`);
3837
3917
  try {
3838
- await fs2.mkdir(path3.dirname(file), { recursive: true });
3918
+ await fs2.mkdir(path4.dirname(file), { recursive: true });
3839
3919
  await writeFileAtomicAsync(file, `${constraints.join("\n")}
3840
3920
  `, {
3841
3921
  bestEffort: false
@@ -3904,7 +3984,7 @@ async function installPipTool(toolId, packageName, binaryName, options = {}) {
3904
3984
  return void 0;
3905
3985
  }
3906
3986
  const currentPath = process.env.PATH || process.env.Path || "";
3907
- const separator = isWindows ? ";" : path3.delimiter;
3987
+ const separator = isWindows ? ";" : path4.delimiter;
3908
3988
  if (!currentPath.toLowerCase().split(separator).includes(binDir.toLowerCase())) {
3909
3989
  const updatedPath = `${binDir}${separator}${currentPath}`;
3910
3990
  process.env.PATH = updatedPath;
@@ -3913,7 +3993,7 @@ async function installPipTool(toolId, packageName, binaryName, options = {}) {
3913
3993
  }
3914
3994
  const names = isWindows ? [`${binaryName}.exe`, `${binaryName}.cmd`, binaryName] : [binaryName];
3915
3995
  for (const name of names) {
3916
- const candidate = path3.join(binDir, name);
3996
+ const candidate = path4.join(binDir, name);
3917
3997
  try {
3918
3998
  await fs2.access(candidate);
3919
3999
  return candidate;
@@ -3931,7 +4011,7 @@ async function installPipTool(toolId, packageName, binaryName, options = {}) {
3931
4011
  "--value",
3932
4012
  "PIPX_BIN_DIR"
3933
4013
  ]);
3934
- const binDir = location.status === 0 && location.stdout.trim() ? location.stdout.trim() : path3.join(os.homedir(), ".local", "bin");
4014
+ const binDir = location.status === 0 && location.stdout.trim() ? location.stdout.trim() : path4.join(os.homedir(), ".local", "bin");
3935
4015
  const binaryPath = await addBinToPath(binDir);
3936
4016
  if (binaryPath)
3937
4017
  return succeeded("pipx", binaryPath);
@@ -3942,10 +4022,10 @@ async function installPipTool(toolId, packageName, binaryName, options = {}) {
3942
4022
  const pythonCandidates = pipCandidates.filter(({ command }) => command === "python3" || command === "python" || command === "py");
3943
4023
  const pythonAvailability = await Promise.all(pythonCandidates.map(({ command }) => isCommandAvailable(command)));
3944
4024
  const availablePythonCandidates = pythonCandidates.filter((_, index) => pythonAvailability[index]);
3945
- const venvRoot = path3.join(getGlobalPiLensDir(), "pip-tools");
4025
+ const venvRoot = path4.join(getGlobalPiLensDir(), "pip-tools");
3946
4026
  for (const candidate of availablePythonCandidates) {
3947
4027
  const venvBin = pipScriptsDir(venvRoot, installerPlatform());
3948
- let venvPip = path3.join(venvBin, isWindows ? "pip.exe" : "pip");
4028
+ let venvPip = path4.join(venvBin, isWindows ? "pip.exe" : "pip");
3949
4029
  try {
3950
4030
  await fs2.access(venvPip);
3951
4031
  } catch {
@@ -3959,7 +4039,7 @@ async function installPipTool(toolId, packageName, binaryName, options = {}) {
3959
4039
  try {
3960
4040
  await fs2.access(venvPip);
3961
4041
  } catch {
3962
- venvPip = path3.join(venvBin, isWindows ? "pip.cmd" : "pip3");
4042
+ venvPip = path4.join(venvBin, isWindows ? "pip.cmd" : "pip3");
3963
4043
  try {
3964
4044
  await fs2.access(venvPip);
3965
4045
  } catch {
@@ -3996,7 +4076,7 @@ async function installPipTool(toolId, packageName, binaryName, options = {}) {
3996
4076
  }
3997
4077
  if (!userRefused)
3998
4078
  throw new Error(`pip install failed: ${candidateErrors.join(" | ") || "unknown error"}`);
3999
- const privateBase = path3.join(getGlobalPiLensDir(), "pip-user");
4079
+ const privateBase = path4.join(getGlobalPiLensDir(), "pip-user");
4000
4080
  const privateEnv = { ...process.env, PYTHONUSERBASE: privateBase };
4001
4081
  for (const candidate of pipCandidates) {
4002
4082
  const args = candidate.command === "pip" || candidate.command === "pip3" ? [...verb, "--user", "--break-system-packages", packageName] : [
@@ -4049,7 +4129,7 @@ async function stampInstallResolution(toolId) {
4049
4129
  return;
4050
4130
  try {
4051
4131
  const resolutionId = lastInstallResolutionId.get(toolId);
4052
- const refresh = await import("./chunk-U6OC3QEM.js");
4132
+ const refresh = await import("./chunk-XOMGO63G.js");
4053
4133
  await refresh.stampManagedToolInstall(toolId, resolutionId);
4054
4134
  } catch {
4055
4135
  }
@@ -4062,7 +4142,7 @@ async function finishInstallAttempt(toolId, ok, startedAt) {
4062
4142
  if (ok) {
4063
4143
  resetSafeSpawnWindowsCommandCache();
4064
4144
  try {
4065
- const { resetMadgeManagedPathMemo } = await import("./chunk-4WX4CTUE.js");
4145
+ const { resetMadgeManagedPathMemo } = await import("./chunk-IE5D3RA5.js");
4066
4146
  resetMadgeManagedPathMemo();
4067
4147
  } catch (err) {
4068
4148
  logSessionStart(`auto-install ${toolId}: madge memo reset failed: ${err.message}`);
@@ -4092,7 +4172,7 @@ async function installTool(toolId, ownsLock) {
4092
4172
  return false;
4093
4173
  const npmPath = await installNpmTool(tool.id, tool.packageName, tool.binaryName, tool.checkArgs, getToolVerificationTimeout(tool), packageEntryVerification(tool), ownsLock);
4094
4174
  if (npmPath !== void 0) {
4095
- await import("./chunk-U6OC3QEM.js").then((m) => m.stampManagedToolInstalled(tool.id, tool.packageName)).catch(() => {
4175
+ await import("./chunk-XOMGO63G.js").then((m) => m.stampManagedToolInstalled(tool.id, tool.packageName)).catch(() => {
4096
4176
  });
4097
4177
  }
4098
4178
  return finishInstallAttempt(tool.id, npmPath !== void 0, startedAt);
@@ -4335,10 +4415,10 @@ async function ensureToolResolved(toolId, opts) {
4335
4415
  }
4336
4416
  }
4337
4417
  async function getToolEnvironment() {
4338
- const localBin = path3.join(TOOLS_DIR, "node_modules", ".bin");
4418
+ const localBin = path4.join(TOOLS_DIR, "node_modules", ".bin");
4339
4419
  const currentPath = process.env.PATH || process.env.Path || process.env.path || "";
4340
4420
  const separator = process.platform === "win32" ? ";" : ":";
4341
- const nodeDir = path3.dirname(process.execPath);
4421
+ const nodeDir = path4.dirname(process.execPath);
4342
4422
  const withNode = nodeDir ? `${nodeDir}${separator}${currentPath}` : currentPath;
4343
4423
  const augmentedPath = `${GITHUB_BIN_DIR}${separator}${localBin}${separator}${withNode}`;
4344
4424
  const env = {
@@ -4353,12 +4433,12 @@ async function getToolEnvironment() {
4353
4433
  async function checkAllTools() {
4354
4434
  const results = [];
4355
4435
  for (const tool of TOOLS) {
4356
- const path4 = await getToolPath(tool.id);
4436
+ const path5 = await getToolPath(tool.id);
4357
4437
  results.push({
4358
4438
  id: tool.id,
4359
4439
  name: tool.name,
4360
- installed: path4 !== void 0,
4361
- path: path4
4440
+ installed: path5 !== void 0,
4441
+ path: path5
4362
4442
  });
4363
4443
  }
4364
4444
  return results;
@@ -4467,6 +4547,7 @@ export {
4467
4547
  resetZizmorTokenAvailability,
4468
4548
  resolveZizmorGitHubToken,
4469
4549
  logSessionStart,
4550
+ findCommandOnPath,
4470
4551
  commitDurableStore,
4471
4552
  commitDurableStoreAsync,
4472
4553
  getManagedToolsDir,