pi-lens 4.4.7 → 4.4.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. package/CHANGELOG-USER.md +31 -0
  2. package/CHANGELOG.md +327 -0
  3. package/README.md +13 -2
  4. package/config/dependency-cruiser-eager-allowlist.json +1 -1
  5. package/config/markdownlint/run-no-fix.mjs +36 -0
  6. package/dist/{chunk-4LM3VAZH.js → chunk-2VZ3VN3N.js} +2 -2
  7. package/dist/{chunk-PUZ3E2J4.js → chunk-3HTZDY3C.js} +8 -6
  8. package/dist/{chunk-RORGS5II.js → chunk-3NPWO5UO.js} +7 -13
  9. package/dist/{chunk-MNJIXFX4.js → chunk-47UCC4MM.js} +1 -1
  10. package/dist/chunk-4ENEJHF4.js +198 -0
  11. package/dist/chunk-5GEYJJHG.js +22 -0
  12. package/dist/{chunk-U6VN4NVL.js → chunk-5YSEQHJN.js} +3 -3
  13. package/dist/{chunk-6IR3ZYIB.js → chunk-6GPB3JLL.js} +3 -3
  14. package/dist/{chunk-MB6PXBUA.js → chunk-7R5GZIA6.js} +7 -15
  15. package/dist/{chunk-DH5JPM3K.js → chunk-7UTSNTWM.js} +10 -9
  16. package/dist/{chunk-24BILSZW.js → chunk-7YTRG6YW.js} +2 -2
  17. package/dist/{chunk-KW5JQPO5.js → chunk-AACN5GNE.js} +2 -2
  18. package/dist/{chunk-PKES3ISE.js → chunk-ACRJ2GZ5.js} +2 -2
  19. package/dist/{chunk-4ZYJHQMB.js → chunk-C3YRO3EU.js} +10 -12
  20. package/dist/{chunk-PQJFG24Z.js → chunk-CB7PEVOJ.js} +1300 -946
  21. package/dist/{chunk-ABPKUVA4.js → chunk-CDFJF5YD.js} +1 -1
  22. package/dist/{chunk-T7A2HK2B.js → chunk-CJS6WE66.js} +17 -18
  23. package/dist/{chunk-3YY7IXIL.js → chunk-CM6BDY4E.js} +14 -60
  24. package/dist/{chunk-RZOXUSPC.js → chunk-CZCAZVTD.js} +16 -2
  25. package/dist/chunk-DGKFWQK4.js +23 -0
  26. package/dist/{chunk-NA7SEXHE.js → chunk-E65WJVI5.js} +7 -9
  27. package/dist/{chunk-2TF6RXWB.js → chunk-EKNYSXFB.js} +8 -10
  28. package/dist/{chunk-RRV3FNNM.js → chunk-EY6LY2HO.js} +27 -30
  29. package/dist/{chunk-LBLBAFG3.js → chunk-F6BEQWAK.js} +17 -5
  30. package/dist/{chunk-4L36HG27.js → chunk-FGNSESAC.js} +12 -14
  31. package/dist/{chunk-3FRLWYBG.js → chunk-FRUBVFXV.js} +39 -42
  32. package/dist/{chunk-FB5SCCPT.js → chunk-G22UNQID.js} +14 -15
  33. package/dist/{chunk-LV4UMYVH.js → chunk-GQTQUNCG.js} +26 -27
  34. package/dist/{chunk-E7HJ56Y7.js → chunk-H3BVMK47.js} +64 -73
  35. package/dist/chunk-H6FLQ5NW.js +28 -0
  36. package/dist/{chunk-QHSNL7B2.js → chunk-HEA3EM23.js} +15 -19
  37. package/dist/{chunk-AWDSEDER.js → chunk-HSOBIN22.js} +2 -2
  38. package/dist/{chunk-EAOK7MIZ.js → chunk-HYSKJMZK.js} +17 -4
  39. package/dist/{chunk-VUZWQ7UG.js → chunk-IICERRFF.js} +46 -72
  40. package/dist/{chunk-OXOI55RU.js → chunk-IILEH3ZC.js} +8 -10
  41. package/dist/{chunk-ZKXQKGWZ.js → chunk-J3Q2NYJR.js} +4 -3
  42. package/dist/{chunk-YHC2O2WO.js → chunk-JUZ67QZQ.js} +20 -9
  43. package/dist/chunk-KR5VGMVT.js +25 -0
  44. package/dist/{chunk-F7K5IBZG.js → chunk-KV6GQOGN.js} +41 -44
  45. package/dist/{chunk-SNDXCFRS.js → chunk-KXMJLOZF.js} +25 -23
  46. package/dist/{chunk-CB4WHS4H.js → chunk-L4Y3ROKQ.js} +3 -3
  47. package/dist/{chunk-3F6BMY53.js → chunk-L6WBJGQS.js} +1 -1
  48. package/dist/{chunk-MPKRJBPK.js → chunk-L7O774U7.js} +30 -32
  49. package/dist/{chunk-URCQWAQ4.js → chunk-LAHHGNAY.js} +21 -21
  50. package/dist/{chunk-V63BC55Q.js → chunk-LT62P654.js} +1 -1
  51. package/dist/{chunk-ZMAUPOMG.js → chunk-LWOM6LVS.js} +34 -34
  52. package/dist/{chunk-HO6LWE2E.js → chunk-MKPDIAZH.js} +21 -1
  53. package/dist/{chunk-2PHMIAKO.js → chunk-MN635QYA.js} +3 -4
  54. package/dist/{chunk-KDX35VXP.js → chunk-MQ4PPCJB.js} +166 -149
  55. package/dist/{chunk-QOE342SU.js → chunk-MRLH4MYU.js} +2 -2
  56. package/dist/{chunk-CE6VMBCB.js → chunk-N56BNAA6.js} +20 -21
  57. package/dist/{chunk-L3CMBQMH.js → chunk-N5CEGQPG.js} +14 -17
  58. package/dist/{chunk-7E2563GA.js → chunk-NCLO6E6N.js} +13 -33
  59. package/dist/{chunk-J6JP25XU.js → chunk-NL5LSKVD.js} +4 -3
  60. package/dist/{chunk-U7BD2QL7.js → chunk-NMUSOZ2D.js} +10 -12
  61. package/dist/{chunk-BZARLRJW.js → chunk-NOWH2VA2.js} +8 -33
  62. package/dist/{chunk-U2SDMG7C.js → chunk-NUSXS6YB.js} +6 -5
  63. package/dist/{chunk-ZJTT47IG.js → chunk-OSEKJEUU.js} +2 -2
  64. package/dist/{chunk-FZKFVUEC.js → chunk-OUYAUXAT.js} +647 -355
  65. package/dist/{chunk-ZE3KXHS7.js → chunk-PBZNYHMM.js} +84 -4
  66. package/dist/{chunk-U5HPROLA.js → chunk-PIIUNJIT.js} +2 -4
  67. package/dist/chunk-PKLB2XJL.js +8 -0
  68. package/dist/{chunk-RC2Z6K47.js → chunk-PRHYIA6X.js} +15 -6
  69. package/dist/{chunk-RQS4QQSD.js → chunk-PXQ45SGD.js} +2 -2
  70. package/dist/chunk-Q6JQKWPK.js +25 -0
  71. package/dist/{chunk-F6X3YJWD.js → chunk-QB7T2PHK.js} +2 -2
  72. package/dist/{chunk-TIQJPRDD.js → chunk-QGITU23N.js} +3 -2
  73. package/dist/chunk-QJJKOHLH.js +57 -0
  74. package/dist/{chunk-4LOE5R5P.js → chunk-QP33NKYC.js} +18 -15
  75. package/dist/{chunk-N5WSK2K7.js → chunk-QVBOXT3L.js} +12 -17
  76. package/dist/{chunk-DPGEAHZT.js → chunk-RNJFRXEN.js} +10 -18
  77. package/dist/{chunk-EKWX4WD3.js → chunk-RNXOWDM6.js} +10 -10
  78. package/dist/{chunk-O4BJFESU.js → chunk-RTFMDIKV.js} +1 -1
  79. package/dist/{chunk-LS3QJRUB.js → chunk-SIQHOB6P.js} +11 -13
  80. package/dist/{chunk-3K2F6UDZ.js → chunk-SLSMJPEF.js} +43 -42
  81. package/dist/chunk-T5QSLSMM.js +50 -0
  82. package/dist/chunk-TGQDAG4B.js +88 -0
  83. package/dist/{chunk-4YHYPW2G.js → chunk-THYHUIDR.js} +44 -13
  84. package/dist/{chunk-YVHBNSME.js → chunk-TMNUTMT5.js} +1099 -1100
  85. package/dist/{chunk-WDBICWH3.js → chunk-TOE2RRCS.js} +1 -1
  86. package/dist/chunk-TYHPVE5H.js +25 -0
  87. package/dist/chunk-UAKO2M6B.js +73 -0
  88. package/dist/chunk-UC5AXW5Z.js +20 -0
  89. package/dist/chunk-UTJP6WOS.js +28 -0
  90. package/dist/{chunk-DQZFQSR5.js → chunk-UXTQ3QPD.js} +4 -4
  91. package/dist/chunk-UYXV5NIS.js +20 -0
  92. package/dist/{chunk-KKCK636N.js → chunk-V2WDBOLZ.js} +10 -12
  93. package/dist/{chunk-PR6PO3ES.js → chunk-V67D6TMU.js} +22 -20
  94. package/dist/{chunk-VSFLRN5Y.js → chunk-VCRVNLE7.js} +135 -2
  95. package/dist/{chunk-CPSR3AVL.js → chunk-VO4JFPTV.js} +2 -2
  96. package/dist/{chunk-XT2HTCJ5.js → chunk-VWLSU3XV.js} +6 -5
  97. package/dist/{chunk-WME2OQST.js → chunk-W5E72HJA.js} +66 -24
  98. package/dist/{chunk-LLS45EWB.js → chunk-W7TY6HYX.js} +6 -8
  99. package/dist/{chunk-CCV2EU7T.js → chunk-WSSLVMDA.js} +12 -13
  100. package/dist/{chunk-YISME6ON.js → chunk-WTB4GKMH.js} +10 -1
  101. package/dist/{chunk-KPPJTH44.js → chunk-X5BJ3G2P.js} +64 -35
  102. package/dist/{chunk-JMEKXFOL.js → chunk-XKFO2SZV.js} +39 -34
  103. package/dist/{chunk-HR3OJ3TH.js → chunk-XLAI7UYY.js} +84 -31
  104. package/dist/{chunk-H7OR7DFZ.js → chunk-XO756WE5.js} +53 -37
  105. package/dist/{chunk-F5Z6URKM.js → chunk-XVB3Q2PG.js} +2 -4
  106. package/dist/{chunk-R5MOQM2H.js → chunk-YOXCCJDF.js} +607 -366
  107. package/dist/{chunk-ZGSJDWQU.js → chunk-ZCQBNPRH.js} +2 -2
  108. package/dist/chunk-ZD4KVFXI.js +234 -0
  109. package/dist/{chunk-WGRJOXED.js → chunk-ZDMFGACN.js} +1295 -966
  110. package/dist/{chunk-OSTKYB55.js → chunk-ZMMHHXSW.js} +1 -1
  111. package/dist/{chunk-75GAYVNO.js → chunk-ZPM7ZIFL.js} +6 -6
  112. package/dist/{chunk-LUBPZN36.js → chunk-ZVCDHYWZ.js} +9 -11
  113. package/dist/{chunk-Y7F7IEE3.js → chunk-ZZN74OGD.js} +102 -7
  114. package/dist/{chunk-L5JYIU47.js → chunk-ZZSJAR76.js} +39 -20
  115. package/dist/index.js +10933 -8644
  116. package/dist/mcp/analyze-cli.js +12 -17
  117. package/dist/mcp/cli.js +43 -42
  118. package/dist/mcp/server.js +3073 -1147
  119. package/dist/mcp/worker.js +61 -61
  120. package/dist/probes/installer.js +18 -19
  121. package/docs/adr/0003-git-guard-latch-writer.md +11 -6
  122. package/docs/agent-tools.md +58 -16
  123. package/docs/alignment-families.md +29 -0
  124. package/docs/analysisall.md +1 -1
  125. package/docs/ast-grep_rules_catalog.md +6 -4
  126. package/docs/ci-bot-pr-checks.md +128 -0
  127. package/docs/configuration.md +150 -12
  128. package/docs/defect-shapes.md +107 -15
  129. package/docs/engineering-principles.md +27 -2
  130. package/docs/environment-variables.md +18 -1
  131. package/docs/features.md +14 -7
  132. package/docs/globalconfig.md +11 -3
  133. package/docs/invariants/git-guard-host.md +7 -3
  134. package/docs/invariants/language-config.md +15 -4
  135. package/docs/invariants/lsp-trust-exec.md +25 -4
  136. package/docs/invariants/paths-os.md +4 -2
  137. package/docs/invariants/session-telemetry.md +2 -2
  138. package/docs/language-coverage.md +1 -0
  139. package/docs/lsp-capability-matrix.md +167 -65
  140. package/docs/lsp-idle-eviction.md +4 -1
  141. package/docs/merge-queue-rollout.md +10 -8
  142. package/docs/module-report-read-symbol.md +34 -23
  143. package/docs/pi-lens-fixer.md +34 -17
  144. package/docs/pi-lens-investigator.md +3 -0
  145. package/docs/pi-lens-merge-policy.md +34 -17
  146. package/docs/pi-lens-monitor.md +9 -0
  147. package/docs/pi-lens-orchestration.md +4 -1
  148. package/docs/pi-lens-reviewer.md +6 -6
  149. package/docs/pi-lens-subagent.md +19 -3
  150. package/docs/public-api-stability.md +57 -7
  151. package/docs/release-qa-baseline.md +7 -4
  152. package/docs/schema/pi-lens-config-v1.json +21 -2
  153. package/docs/servercapabilities.md +3 -1
  154. package/docs/settings.md +11 -7
  155. package/docs/word-index.md +20 -7
  156. package/package.json +11 -4
  157. package/rules/ast-grep-rules/rule-tests/no-accumulating-spread-js-test.yml +37 -0
  158. package/rules/ast-grep-rules/rule-tests/ts-redundant-filter-map-test.yml +12 -1
  159. package/rules/ast-grep-rules/rule-tests-disabled/filter-then-map-js-test.yml +12 -0
  160. package/rules/ast-grep-rules/rule-tests-disabled/filter-then-map-test.yml +25 -0
  161. package/rules/ast-grep-rules/rules/no-accumulating-spread-js.yml +49 -1
  162. package/rules/ast-grep-rules/rules/no-sql-in-code-execute-js.yml +1 -2
  163. package/rules/ast-grep-rules/rules/no-sql-in-code-execute.yml +1 -2
  164. package/rules/ast-grep-rules/rules/ts-redundant-filter-map.yml +9 -1
  165. package/rules/ast-grep-rules/rules-disabled/filter-then-map-js.yml +17 -0
  166. package/rules/ast-grep-rules/rules-disabled/filter-then-map.yml +36 -0
  167. package/rules/ast-grep-rules/self-scan-baseline.json +1 -1
  168. package/scripts/download-grammars.js +3 -2
  169. package/skills/pi-lens-lsp-navigation/SKILL.md +5 -1
  170. package/dist/chunk-46TNM7XZ.js +0 -88
  171. package/dist/chunk-72OKUXSD.js +0 -31
  172. package/dist/chunk-7GLOLOSH.js +0 -57
  173. package/dist/chunk-AKUUMGD5.js +0 -26
  174. package/dist/chunk-ASUXV767.js +0 -22
  175. package/dist/chunk-CTADOKYM.js +0 -25
  176. package/dist/chunk-GNSIWBAT.js +0 -106
  177. package/dist/chunk-HWDAVBFU.js +0 -49
  178. package/dist/chunk-JJ2RRESP.js +0 -58
  179. package/dist/chunk-KXF5R4UN.js +0 -48
  180. package/dist/chunk-LSC3VADM.js +0 -23
  181. package/dist/chunk-OE5ZBP7F.js +0 -443
  182. package/dist/chunk-SHLDT3OI.js +0 -27
  183. package/dist/chunk-UF7RTZSO.js +0 -27
  184. package/dist/chunk-W4WP2ERB.js +0 -30
  185. package/dist/chunk-YES5CACN.js +0 -73
  186. package/dist/chunk-Z2XAOKHK.js +0 -136
@@ -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-DPGEAHZT.js";
4
+ } from "./chunk-RNJFRXEN.js";
5
5
  import {
6
6
  allAvailableGlobalBinDirs,
7
7
  installArgs,
8
8
  pmBinary,
9
9
  resolveNodePackageManager
10
- } from "./chunk-NA7SEXHE.js";
10
+ } from "./chunk-E65WJVI5.js";
11
11
  import {
12
12
  probeToolAsync
13
- } from "./chunk-3F6BMY53.js";
13
+ } from "./chunk-L6WBJGQS.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-KW5JQPO5.js";
23
+ } from "./chunk-AACN5GNE.js";
21
24
  import {
22
25
  acquireBoundedPidFileLock,
23
26
  acquireQuarantinePidFileLock,
@@ -27,6 +30,7 @@ import {
27
30
  isLockContention,
28
31
  isUntrustedProjectPath,
29
32
  ownsTopGeneration,
33
+ realIsPidAlive,
30
34
  recordGenerationTakeover,
31
35
  recordLegacyLockHeld,
32
36
  recordProjectCommandRefusal,
@@ -34,56 +38,87 @@ import {
34
38
  resetSafeSpawnWindowsCommandCache,
35
39
  safeSpawnAsync,
36
40
  startGenerationHeartbeat,
37
- tryAcquireGeneration
38
- } from "./chunk-YVHBNSME.js";
41
+ tryAcquireGeneration,
42
+ windowsExe
43
+ } from "./chunk-TMNUTMT5.js";
39
44
  import {
40
45
  assertInstallAllowed,
41
46
  getProjectTrustGeneration,
42
47
  projectTrustDenialReason,
43
48
  writeFileAtomic,
44
49
  writeFileAtomicAsync
45
- } from "./chunk-U5HPROLA.js";
50
+ } from "./chunk-PIIUNJIT.js";
46
51
  import {
47
52
  getDegradationLedgerGeneration,
48
53
  incrementDegradationCount,
54
+ logExtension,
49
55
  recordDegradationOnce
50
- } from "./chunk-WME2OQST.js";
51
- import {
52
- logExtension
53
- } from "./chunk-KXF5R4UN.js";
56
+ } from "./chunk-W5E72HJA.js";
54
57
  import {
55
58
  createNdjsonLogger,
56
59
  getGlobalPiLensLogDir,
57
60
  getMaxLogSizeMB,
58
- isTestMode
59
- } from "./chunk-VSFLRN5Y.js";
61
+ isTestMode,
62
+ isToolInstallDisabled
63
+ } from "./chunk-VCRVNLE7.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-CB7PEVOJ.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,24 +363,16 @@ 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;
338
373
  function getManagedToolsDir() {
339
374
  return TOOLS_DIR;
340
375
  }
341
- function isProcessAlive(pid) {
342
- try {
343
- process.kill(pid, 0);
344
- return true;
345
- } catch (error) {
346
- return error.code === "EPERM";
347
- }
348
- }
349
376
  function installLockMaxAgeMs() {
350
377
  return (Number(process.env.PI_LENS_INSTALL_TIMEOUT_MS) || 12e4) + 6e4;
351
378
  }
@@ -353,10 +380,10 @@ function legacyInstallLockIsStale(maxAgeMs) {
353
380
  try {
354
381
  const owner = JSON.parse(readFileSync2(INSTALL_LOCK_PATH, "utf8"));
355
382
  const expired = Number.isFinite(owner.createdAt) && Date.now() - owner.createdAt > maxAgeMs;
356
- return expired || Number.isInteger(owner.pid) && owner.pid > 0 && !isProcessAlive(owner.pid);
383
+ return expired || Number.isInteger(owner.pid) && owner.pid > 0 && !realIsPidAlive(owner.pid);
357
384
  } catch {
358
385
  try {
359
- return Date.now() - statSync(INSTALL_LOCK_PATH).mtimeMs > maxAgeMs;
386
+ return Date.now() - statSync2(INSTALL_LOCK_PATH).mtimeMs > maxAgeMs;
360
387
  } catch {
361
388
  return false;
362
389
  }
@@ -466,7 +493,7 @@ async function acquireInstallLock() {
466
493
  };
467
494
  }
468
495
  var GLOBAL_HOME_DIR = getGlobalPiLensDir();
469
- var GITHUB_BIN_DIR = path3.join(GLOBAL_HOME_DIR, "bin");
496
+ var GITHUB_BIN_DIR = path4.join(GLOBAL_HOME_DIR, "bin");
470
497
  var GITHUB_BIN_DIR_PINNED = Boolean(process.env.PI_LENS_HOME?.trim());
471
498
  function assertManagedBinDirInsidePinnedHome(toolId) {
472
499
  if (!GITHUB_BIN_DIR_PINNED)
@@ -1886,7 +1913,7 @@ var resolvedPathCache = new BoundedLruCache(256);
1886
1913
  function resetResolvedPathCache() {
1887
1914
  resolvedPathCache.clear();
1888
1915
  }
1889
- var PROBE_CACHE_PATH = path3.join(getGlobalPiLensDir(), "probe-cache.json");
1916
+ var PROBE_CACHE_PATH = path4.join(getGlobalPiLensDir(), "probe-cache.json");
1890
1917
  var PROBE_CACHE_LOCK_STALE_MS = 18e4;
1891
1918
  var PROBE_CACHE_TTL_MS = 24 * 60 * 60 * 1e3;
1892
1919
  var PROBE_CACHE_TRANSIENT_COOLDOWN_MS = TRANSIENT_MAX_COOLDOWN_MS;
@@ -2052,6 +2079,17 @@ async function flushProbeCache() {
2052
2079
  _probeCacheWriteInFlight = null;
2053
2080
  }
2054
2081
  }
2082
+ async function settleProbeCacheForTests() {
2083
+ const result = await flushProbeCache();
2084
+ if (result === "idle" || result === "written")
2085
+ return void 0;
2086
+ if (_probeCacheFlushTimer !== null) {
2087
+ clearTimeout(_probeCacheFlushTimer);
2088
+ _probeCacheFlushTimer = null;
2089
+ }
2090
+ return `probe-cache flush did not land (${result})`;
2091
+ }
2092
+ registerBackgroundWriteDrain(settleProbeCacheForTests);
2055
2093
  function isAstGrepVersionOutput(output) {
2056
2094
  return /\bast[- ]grep\b/i.test(output);
2057
2095
  }
@@ -2148,35 +2186,13 @@ function resetPathWalkMemo() {
2148
2186
  pathWalkMemo.clear();
2149
2187
  }
2150
2188
  async function isCommandAvailable(command, _args) {
2151
- const isWindows = installerPlatform() === "win32";
2152
- const pathEnv = process.env.PATH || process.env.Path || process.env.path || "";
2153
- const dirs = pathEnv.split(path3.delimiter);
2154
- const names = isWindows ? [command, `${command}.exe`, `${command}.cmd`, `${command}.bat`] : [command];
2155
- for (const dir of dirs) {
2156
- if (!dir)
2157
- continue;
2158
- for (const name of names) {
2159
- const candidate = isWindows ? path3.join(dir, name) : `${dir}${path3.sep}${name}`;
2160
- try {
2161
- const stat = statSync(candidate);
2162
- if (!stat.isFile() || stat.size === 0)
2163
- continue;
2164
- if (isUntrustedProjectPath(candidate)) {
2165
- recordProjectCommandRefusal(candidate);
2166
- continue;
2167
- }
2168
- return true;
2169
- } catch {
2170
- }
2171
- }
2172
- }
2173
- return false;
2189
+ return findCommandOnPath(command, installerPlatform() === "win32") !== null;
2174
2190
  }
2175
2191
  async function isSpawnableCommand(command) {
2176
2192
  const namesPath = installerPlatform() === "win32" ? /[\\/]/.test(command) : command.includes("/");
2177
2193
  if (namesPath) {
2178
2194
  try {
2179
- const stat = statSync(command);
2195
+ const stat = statSync2(command);
2180
2196
  return stat.isFile() && stat.size > 0;
2181
2197
  } catch {
2182
2198
  return false;
@@ -2207,17 +2223,17 @@ function packageEntryVerification(tool) {
2207
2223
  return tool.verification === "package-entry" ? tool.packageName : void 0;
2208
2224
  }
2209
2225
  async function verifyNpmPackageEntry(binPath, packageName) {
2210
- const nodeModulesDir = path3.dirname(path3.dirname(binPath));
2226
+ const nodeModulesDir = path4.dirname(path4.dirname(binPath));
2211
2227
  const pinned = parsePinnedVersion(packageName);
2212
2228
  const bareName = pinned ? packageName.slice(0, -(pinned.length + 1)) : packageName;
2213
- const packageDir = path3.join(nodeModulesDir, ...bareName.split("/"));
2214
- const shimName = path3.basename(binPath).replace(/\.(cmd|exe|ps1|bat)$/i, "").toLowerCase();
2229
+ const packageDir = path4.join(nodeModulesDir, ...bareName.split("/"));
2230
+ const shimName = path4.basename(binPath).replace(/\.(cmd|exe|ps1|bat)$/i, "").toLowerCase();
2215
2231
  const fail = (reason) => {
2216
2232
  logSessionStart(`auto-install verify: failed for ${binPath} (check=package-entry, kind=${reason})`);
2217
2233
  return false;
2218
2234
  };
2219
2235
  try {
2220
- const shim = statSync(binPath);
2236
+ const shim = statSync2(binPath);
2221
2237
  if (!shim.isFile() || shim.size === 0)
2222
2238
  return fail("shim-not-a-file");
2223
2239
  } catch {
@@ -2225,7 +2241,7 @@ async function verifyNpmPackageEntry(binPath, packageName) {
2225
2241
  }
2226
2242
  let manifest;
2227
2243
  try {
2228
- manifest = JSON.parse(await fs2.readFile(path3.join(packageDir, "package.json"), "utf8"));
2244
+ manifest = JSON.parse(await fs2.readFile(path4.join(packageDir, "package.json"), "utf8"));
2229
2245
  } catch {
2230
2246
  return fail("package-json-unreadable");
2231
2247
  }
@@ -2243,7 +2259,7 @@ async function verifyNpmPackageEntry(binPath, packageName) {
2243
2259
  return fail("package-json-no-entry");
2244
2260
  }
2245
2261
  try {
2246
- const stat = statSync(path3.join(packageDir, entry));
2262
+ const stat = statSync2(path4.join(packageDir, entry));
2247
2263
  if (!stat.isFile() || stat.size === 0)
2248
2264
  return fail("entry-not-a-file");
2249
2265
  } catch {
@@ -2380,7 +2396,7 @@ async function getAllToolStatuses(toolIds) {
2380
2396
  continue;
2381
2397
  }
2382
2398
  }
2383
- const localBase = path3.join(TOOLS_DIR, "node_modules", ".bin", tool.binaryName || tool.id);
2399
+ const localBase = path4.join(TOOLS_DIR, "node_modules", ".bin", tool.binaryName || tool.id);
2384
2400
  const localPath = installerPlatform() === "win32" ? `${localBase}.cmd` : localBase;
2385
2401
  try {
2386
2402
  await fs2.access(localPath);
@@ -2407,9 +2423,9 @@ async function getArchiveTreeBundlePath(tool) {
2407
2423
  if (tool.installStrategy !== "archive" || tool.archive?.launcher) {
2408
2424
  return void 0;
2409
2425
  }
2410
- const extractDir = path3.join(TOOLS_DIR, tool.id);
2426
+ const extractDir = path4.join(TOOLS_DIR, tool.id);
2411
2427
  const treeMarker = tool.archive && resolveTreeMarker(tool.archive);
2412
- const marker = treeMarker ? path3.join(extractDir, ...treeMarker.split("/")) : extractDir;
2428
+ const marker = treeMarker ? path4.join(extractDir, ...treeMarker.split("/")) : extractDir;
2413
2429
  try {
2414
2430
  await fs2.access(marker);
2415
2431
  return extractDir;
@@ -2430,14 +2446,14 @@ function resolvePlatformPackageBinary(tool) {
2430
2446
  const fromMain = createRequire(mainPkgJson);
2431
2447
  let pkgDir;
2432
2448
  try {
2433
- pkgDir = path3.dirname(fromMain.resolve(`${platformPkg}/package.json`));
2449
+ pkgDir = path4.dirname(fromMain.resolve(`${platformPkg}/package.json`));
2434
2450
  } catch {
2435
- pkgDir = path3.dirname(_installerRequire.resolve(`${platformPkg}/package.json`));
2451
+ pkgDir = path4.dirname(_installerRequire.resolve(`${platformPkg}/package.json`));
2436
2452
  }
2437
2453
  const isWin = installerPlatform() === "win32";
2438
2454
  for (const bin of spec.binaries) {
2439
2455
  for (const name of isWin ? [`${bin}.exe`, bin] : [bin]) {
2440
- const candidate = path3.join(pkgDir, name);
2456
+ const candidate = path4.join(pkgDir, name);
2441
2457
  if (existsSync(candidate))
2442
2458
  return candidate;
2443
2459
  }
@@ -2475,7 +2491,7 @@ async function getToolPathResolved(toolId, onTransient, storeOnly) {
2475
2491
  if (seen)
2476
2492
  lastManagedInstallVersion.set(toolId, seen);
2477
2493
  } : void 0;
2478
- const localBase = path3.join(TOOLS_DIR, "node_modules", ".bin", tool.binaryName || tool.id);
2494
+ const localBase = path4.join(TOOLS_DIR, "node_modules", ".bin", tool.binaryName || tool.id);
2479
2495
  if (installerPlatform() === "win32") {
2480
2496
  const cmdPath = `${localBase}.cmd`;
2481
2497
  try {
@@ -2560,11 +2576,11 @@ async function getToolPathResolved(toolId, onTransient, storeOnly) {
2560
2576
  async function findGitHubToolPath(binaryName) {
2561
2577
  const isWindows = process.platform === "win32";
2562
2578
  const candidates = isWindows ? [
2563
- path3.join(GITHUB_BIN_DIR, `${binaryName}.exe`),
2564
- path3.join(GITHUB_BIN_DIR, `${binaryName}.bat`),
2565
- path3.join(GITHUB_BIN_DIR, `${binaryName}.cmd`),
2566
- path3.join(GITHUB_BIN_DIR, binaryName)
2567
- ] : [path3.join(GITHUB_BIN_DIR, binaryName)];
2579
+ path4.join(GITHUB_BIN_DIR, `${binaryName}.exe`),
2580
+ path4.join(GITHUB_BIN_DIR, `${binaryName}.bat`),
2581
+ path4.join(GITHUB_BIN_DIR, `${binaryName}.cmd`),
2582
+ path4.join(GITHUB_BIN_DIR, binaryName)
2583
+ ] : [path4.join(GITHUB_BIN_DIR, binaryName)];
2568
2584
  for (const candidate of candidates) {
2569
2585
  try {
2570
2586
  await fs2.access(candidate);
@@ -2625,9 +2641,9 @@ async function findNpmGlobalToolPath(binaryName, onTransient, verificationArgs =
2625
2641
  const binDirs = await getNpmGlobalBinCandidates(onTransient);
2626
2642
  for (const dir of binDirs) {
2627
2643
  const candidates = isWindows ? [
2628
- path3.join(dir, `${binaryName}.cmd`),
2629
- path3.join(dir, `${binaryName}.exe`)
2630
- ] : [path3.join(dir, binaryName)];
2644
+ path4.join(dir, `${binaryName}.cmd`),
2645
+ path4.join(dir, `${binaryName}.exe`)
2646
+ ] : [path4.join(dir, binaryName)];
2631
2647
  for (const candidate of candidates) {
2632
2648
  try {
2633
2649
  await fs2.access(candidate);
@@ -2650,7 +2666,7 @@ async function getNpmGlobalBinCandidates(onTransient) {
2650
2666
  const add = (value) => {
2651
2667
  if (!value)
2652
2668
  return;
2653
- const normalized = path3.resolve(value.trim());
2669
+ const normalized = path4.resolve(value.trim());
2654
2670
  if (!normalized)
2655
2671
  return;
2656
2672
  if (seen.has(normalized))
@@ -2659,9 +2675,9 @@ async function getNpmGlobalBinCandidates(onTransient) {
2659
2675
  dirs.push(normalized);
2660
2676
  };
2661
2677
  if (process.platform === "win32") {
2662
- add(path3.join(process.env.APPDATA || "", "npm"));
2678
+ add(path4.join(process.env.APPDATA || "", "npm"));
2663
2679
  } else {
2664
- add(path3.join(os.homedir(), ".npm-global", "bin"));
2680
+ add(path4.join(os.homedir(), ".npm-global", "bin"));
2665
2681
  }
2666
2682
  for (const dir of await allAvailableGlobalBinDirs(onTransient)) {
2667
2683
  add(dir);
@@ -2671,8 +2687,8 @@ async function getNpmGlobalBinCandidates(onTransient) {
2671
2687
  async function findPipUserToolPath(binaryName, onTransient, verificationArgs = ["--version"], verificationTimeoutMs = 1e4, piLensPrefixesOnly = false) {
2672
2688
  const isWindows = installerPlatform() === "win32";
2673
2689
  const userBaseCandidates = [
2674
- path3.join(getGlobalPiLensDir(), "pip-tools"),
2675
- path3.join(getGlobalPiLensDir(), "pip-user"),
2690
+ path4.join(getGlobalPiLensDir(), "pip-tools"),
2691
+ path4.join(getGlobalPiLensDir(), "pip-user"),
2676
2692
  ...piLensPrefixesOnly ? [] : await getPythonUserBaseCandidates()
2677
2693
  ];
2678
2694
  for (const userBase of userBaseCandidates) {
@@ -2685,17 +2701,17 @@ async function findPipUserToolPath(binaryName, onTransient, verificationArgs = [
2685
2701
  continue;
2686
2702
  if (!/^python\d+$/i.test(entry.name))
2687
2703
  continue;
2688
- scriptDirs.push(path3.join(userBase, entry.name, "Scripts"));
2704
+ scriptDirs.push(path4.join(userBase, entry.name, "Scripts"));
2689
2705
  }
2690
2706
  } catch {
2691
2707
  }
2692
2708
  }
2693
2709
  for (const dir of scriptDirs) {
2694
2710
  const candidates = isWindows ? [
2695
- path3.join(dir, `${binaryName}.exe`),
2696
- path3.join(dir, `${binaryName}.cmd`),
2697
- path3.join(dir, binaryName)
2698
- ] : [path3.join(dir, binaryName)];
2711
+ path4.join(dir, `${binaryName}.exe`),
2712
+ path4.join(dir, `${binaryName}.cmd`),
2713
+ path4.join(dir, binaryName)
2714
+ ] : [path4.join(dir, binaryName)];
2699
2715
  for (const candidate of candidates) {
2700
2716
  try {
2701
2717
  await fs2.access(candidate);
@@ -2741,7 +2757,7 @@ async function getPythonUserBaseCandidates() {
2741
2757
  candidates.push(normalized);
2742
2758
  };
2743
2759
  if (process.platform === "win32") {
2744
- add(path3.join(process.env.APPDATA || "", "Python"));
2760
+ add(path4.join(process.env.APPDATA || "", "Python"));
2745
2761
  }
2746
2762
  const probes = process.platform === "win32" ? [
2747
2763
  { command: "py", args: ["-m", "site", "--user-base"] },
@@ -2900,7 +2916,7 @@ async function installGitHubTool(tool, prefetchedRelease) {
2900
2916
  const binaryName = tool.binaryName ?? tool.id;
2901
2917
  const isWindows = platform === "win32";
2902
2918
  const finalBinaryName = getGitHubInstalledBinaryName(binaryName, platform, asset.name);
2903
- let destPath = path3.join(GITHUB_BIN_DIR, finalBinaryName);
2919
+ let destPath = path4.join(GITHUB_BIN_DIR, finalBinaryName);
2904
2920
  const assetName = asset.name;
2905
2921
  const launcherRuntime = launcherForGitHubAsset(spec, assetName);
2906
2922
  if (launcherRuntime && !await isCommandAvailable(launcherRuntime, ["--version"])) {
@@ -2910,13 +2926,13 @@ async function installGitHubTool(tool, prefetchedRelease) {
2910
2926
  try {
2911
2927
  assertManagedBinDirInsidePinnedHome(tool.id);
2912
2928
  if (launcherRuntime) {
2913
- const assetPath = path3.join(GITHUB_BIN_DIR, `${tool.id}${assetName.endsWith(".phar") ? ".phar" : ".jar"}`);
2929
+ const assetPath = path4.join(GITHUB_BIN_DIR, `${tool.id}${assetName.endsWith(".phar") ? ".phar" : ".jar"}`);
2914
2930
  await writeFileAtomicAsync(assetPath, assetBuffer, {
2915
2931
  bestEffort: false,
2916
2932
  mode: 488
2917
2933
  });
2918
2934
  const launcherName = isWindows ? `${binaryName}.bat` : binaryName;
2919
- destPath = path3.join(GITHUB_BIN_DIR, launcherName);
2935
+ destPath = path4.join(GITHUB_BIN_DIR, launcherName);
2920
2936
  const runtimeTarget = assetName.endsWith(".phar") ? `${tool.id}.phar` : `${tool.id}.jar`;
2921
2937
  const command = isWindows ? `@echo off\r
2922
2938
  ${launcherRuntime} "%~dp0${runtimeTarget}" %*\r
@@ -2941,9 +2957,9 @@ exec ${launcherRuntime} "$(dirname "$0")/${runtimeTarget}" "$@"
2941
2957
  mode: 488
2942
2958
  });
2943
2959
  } else if (assetName.endsWith(".tar.gz") || assetName.endsWith(".tar.xz")) {
2944
- const tmpArchive = path3.join(GITHUB_BIN_DIR, `_tmp_${assetName}`);
2960
+ const tmpArchive = path4.join(GITHUB_BIN_DIR, `_tmp_${assetName}`);
2945
2961
  await fs2.writeFile(tmpArchive, assetBuffer);
2946
- const tmpDir = path3.join(GITHUB_BIN_DIR, `_tmp_extract_${tool.id}`);
2962
+ const tmpDir = path4.join(GITHUB_BIN_DIR, `_tmp_extract_${tool.id}`);
2947
2963
  await fs2.mkdir(tmpDir, { recursive: true });
2948
2964
  const extracted = await runCommand("tar", ["xf", tmpArchive, "-C", tmpDir], GITHUB_BIN_DIR);
2949
2965
  await fs2.rm(tmpArchive, { force: true });
@@ -2964,9 +2980,9 @@ exec ${launcherRuntime} "$(dirname "$0")/${runtimeTarget}" "$@"
2964
2980
  if (!isWindows)
2965
2981
  await fs2.chmod(destPath, 488);
2966
2982
  } else if (assetName.endsWith(".zip")) {
2967
- const tmpArchive = path3.join(GITHUB_BIN_DIR, `_tmp_${assetName}`);
2983
+ const tmpArchive = path4.join(GITHUB_BIN_DIR, `_tmp_${assetName}`);
2968
2984
  await fs2.writeFile(tmpArchive, assetBuffer);
2969
- const tmpDir = path3.join(GITHUB_BIN_DIR, `_tmp_extract_${tool.id}`);
2985
+ const tmpDir = path4.join(GITHUB_BIN_DIR, `_tmp_extract_${tool.id}`);
2970
2986
  await fs2.mkdir(tmpDir, { recursive: true });
2971
2987
  const extracted = isWindows ? await runCommand("powershell", [
2972
2988
  "-NoProfile",
@@ -3008,7 +3024,7 @@ exec ${launcherRuntime} "$(dirname "$0")/${runtimeTarget}" "$@"
3008
3024
  }
3009
3025
  try {
3010
3026
  const extraBuffer = await httpsGet(extraAsset.browser_download_url);
3011
- await writeFileAtomicAsync(path3.join(GITHUB_BIN_DIR, extraName), extraBuffer, { bestEffort: false, mode: 488 });
3027
+ await writeFileAtomicAsync(path4.join(GITHUB_BIN_DIR, extraName), extraBuffer, { bestEffort: false, mode: 488 });
3012
3028
  logSessionStart(`github-install ${tool.id}: installed extra asset ${extraName} (${extraBuffer.length} bytes)`);
3013
3029
  } catch (err) {
3014
3030
  logSessionStart(`github-install ${tool.id}: extra asset ${extraName} download failed: ${err.message}`);
@@ -3023,7 +3039,7 @@ async function findFirstFileRecursive(dir, names) {
3023
3039
  const wanted = new Set(names.map((name) => name.toLowerCase()));
3024
3040
  const entries = await fs2.readdir(dir, { withFileTypes: true });
3025
3041
  for (const entry of entries) {
3026
- const full = path3.join(dir, entry.name);
3042
+ const full = path4.join(dir, entry.name);
3027
3043
  if (entry.isDirectory()) {
3028
3044
  const found = await findFirstFileRecursive(full, names);
3029
3045
  if (found)
@@ -3152,7 +3168,7 @@ async function isManagedToolPresent(toolId) {
3152
3168
  if (!tool.packageName)
3153
3169
  return false;
3154
3170
  try {
3155
- await fs2.access(path3.join(TOOLS_DIR, "node_modules", tool.packageName, "package.json"));
3171
+ await fs2.access(path4.join(TOOLS_DIR, "node_modules", tool.packageName, "package.json"));
3156
3172
  return true;
3157
3173
  } catch {
3158
3174
  return false;
@@ -3192,7 +3208,7 @@ ${result.stderr}`);
3192
3208
  }
3193
3209
  }
3194
3210
  async function acquireManagedInstallGate(context) {
3195
- if (process.env.PI_LENS_DISABLE_TOOL_INSTALL === "1") {
3211
+ if (isToolInstallDisabled()) {
3196
3212
  return {
3197
3213
  ok: false,
3198
3214
  reason: "installation disabled by PI_LENS_DISABLE_TOOL_INSTALL=1"
@@ -3439,7 +3455,7 @@ async function refreshPinnedManagedTool(tool, known) {
3439
3455
  };
3440
3456
  }
3441
3457
  function resolveManagedNpmBinPath(binaryName) {
3442
- const binBase = path3.join(TOOLS_DIR, "node_modules", ".bin", binaryName);
3458
+ const binBase = path4.join(TOOLS_DIR, "node_modules", ".bin", binaryName);
3443
3459
  return installerPlatform() === "win32" ? `${binBase}.cmd` : binBase;
3444
3460
  }
3445
3461
  function invalidateManagedToolResolution(toolId) {
@@ -3477,10 +3493,10 @@ async function installMavenTool(tool) {
3477
3493
  try {
3478
3494
  await fs2.mkdir(GITHUB_BIN_DIR, { recursive: true });
3479
3495
  assertManagedBinDirInsidePinnedHome(tool.id);
3480
- const jarPath = path3.join(GITHUB_BIN_DIR, `${tool.id}.jar`);
3496
+ const jarPath = path4.join(GITHUB_BIN_DIR, `${tool.id}.jar`);
3481
3497
  await writeFileAtomicAsync(jarPath, jarBuffer, { bestEffort: false });
3482
3498
  const launcherName = isWindows ? `${binaryName}.bat` : binaryName;
3483
- const launcherPath = path3.join(GITHUB_BIN_DIR, launcherName);
3499
+ const launcherPath = path4.join(GITHUB_BIN_DIR, launcherName);
3484
3500
  if (isWindows) {
3485
3501
  await writeFileAtomicAsync(launcherPath, `@echo off\r
3486
3502
  java -jar "%~dp0${tool.id}.jar" %*\r
@@ -3520,9 +3536,9 @@ async function stripExtractedArchiveRoot(dir, components) {
3520
3536
  const [entry] = entries;
3521
3537
  if (entries.length !== 1 || !entry?.isDirectory())
3522
3538
  return false;
3523
- const root = path3.join(dir, entry.name);
3539
+ const root = path4.join(dir, entry.name);
3524
3540
  for (const child of await fs2.readdir(root))
3525
- await fs2.rename(path3.join(root, child), path3.join(dir, child));
3541
+ await fs2.rename(path4.join(root, child), path4.join(dir, child));
3526
3542
  await fs2.rm(root, { recursive: true, force: true });
3527
3543
  }
3528
3544
  return true;
@@ -3572,7 +3588,7 @@ function runtimeHomeVerdict(runtime) {
3572
3588
  const names = windows ? [`${runtime}.exe`, runtime] : [runtime];
3573
3589
  return names.some((name) => {
3574
3590
  try {
3575
- const stat = statSync(path3.join(root, home.dir, name));
3591
+ const stat = statSync2(path4.join(root, home.dir, name));
3576
3592
  return stat.isFile() && stat.size > 0 && (windows || (stat.mode & 73) !== 0);
3577
3593
  } catch {
3578
3594
  return false;
@@ -3617,9 +3633,9 @@ async function installArchiveTool(tool) {
3617
3633
  const extractName = tool.id;
3618
3634
  const tmpExtractName = `${extractName}.refresh-tmp`;
3619
3635
  const archiveName = `${tool.id}.download.${archiveKind === "zip" ? "zip" : "tgz"}`;
3620
- const extractDir = path3.join(TOOLS_DIR, extractName);
3621
- const tmpExtractDir = path3.join(TOOLS_DIR, tmpExtractName);
3622
- const tmpArchive = path3.join(TOOLS_DIR, archiveName);
3636
+ const extractDir = path4.join(TOOLS_DIR, extractName);
3637
+ const tmpExtractDir = path4.join(TOOLS_DIR, tmpExtractName);
3638
+ const tmpArchive = path4.join(TOOLS_DIR, archiveName);
3623
3639
  try {
3624
3640
  await fs2.mkdir(TOOLS_DIR, { recursive: true });
3625
3641
  await fs2.rm(tmpExtractDir, { recursive: true, force: true });
@@ -3637,7 +3653,7 @@ async function installArchiveTool(tool) {
3637
3653
  tmpExtractName,
3638
3654
  ...stripComponents > 0 ? [`--strip-components=${stripComponents}`] : []
3639
3655
  ];
3640
- 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";
3656
+ const extractor = archiveKind === "zip" && isWindows ? windowsExe("WindowsPowerShell\\v1.0\\powershell.exe") : archiveKind === "zip" ? "unzip" : isWindows ? windowsExe("tar.exe") : "tar";
3641
3657
  const extractionResult = await safeSpawnAsync(extractor, extractionArgs, {
3642
3658
  cwd: TOOLS_DIR,
3643
3659
  timeout: 12e4,
@@ -3665,7 +3681,7 @@ async function installArchiveTool(tool) {
3665
3681
  }
3666
3682
  if (!spec.launcher) {
3667
3683
  const treeMarker = resolveTreeMarker(spec, platform);
3668
- const tmpMarker = treeMarker ? path3.join(tmpExtractDir, ...treeMarker.split("/")) : tmpExtractDir;
3684
+ const tmpMarker = treeMarker ? path4.join(tmpExtractDir, ...treeMarker.split("/")) : tmpExtractDir;
3669
3685
  try {
3670
3686
  await fs2.access(tmpMarker);
3671
3687
  } catch {
@@ -3681,7 +3697,7 @@ async function installArchiveTool(tool) {
3681
3697
  return extractDir;
3682
3698
  }
3683
3699
  const launcherParts = spec.launcher.split("/").map((p) => p);
3684
- const tmpInnerLauncher = path3.join(tmpExtractDir, ...launcherParts);
3700
+ const tmpInnerLauncher = path4.join(tmpExtractDir, ...launcherParts);
3685
3701
  const tmpResolvedInner = isWindows ? `${tmpInnerLauncher}.bat` : tmpInnerLauncher;
3686
3702
  try {
3687
3703
  await fs2.access(tmpResolvedInner);
@@ -3707,10 +3723,10 @@ async function installArchiveTool(tool) {
3707
3723
  await fs2.mkdir(GITHUB_BIN_DIR, { recursive: true });
3708
3724
  assertManagedBinDirInsidePinnedHome(tool.id);
3709
3725
  await swapExtractedDir(tool.id, tmpExtractDir, extractDir);
3710
- const innerLauncher = path3.join(extractDir, ...launcherParts);
3726
+ const innerLauncher = path4.join(extractDir, ...launcherParts);
3711
3727
  const resolvedInner = isWindows ? `${innerLauncher}.bat` : innerLauncher;
3712
3728
  const launcherName = isWindows ? `${binaryName}.bat` : binaryName;
3713
- const shimPath = path3.join(GITHUB_BIN_DIR, launcherName);
3729
+ const shimPath = path4.join(GITHUB_BIN_DIR, launcherName);
3714
3730
  if (isWindows) {
3715
3731
  await writeFileAtomicAsync(shimPath, `@echo off\r
3716
3732
  call "${resolvedInner}" %*\r
@@ -3759,7 +3775,7 @@ async function installNpmTool(toolId, packageName, binaryName, verificationArgs
3759
3775
  };
3760
3776
  try {
3761
3777
  await fs2.mkdir(TOOLS_DIR, { recursive: true });
3762
- const packageJsonPath = path3.join(TOOLS_DIR, "package.json");
3778
+ const packageJsonPath = path4.join(TOOLS_DIR, "package.json");
3763
3779
  try {
3764
3780
  await fs2.access(packageJsonPath);
3765
3781
  } catch {
@@ -3807,7 +3823,7 @@ async function installNpmTool(toolId, packageName, binaryName, verificationArgs
3807
3823
  if (!outcome.ok) {
3808
3824
  throw new Error(`Failed to install ${packageName}: ${outcome.stderr}`);
3809
3825
  }
3810
- const binBase = path3.join(TOOLS_DIR, "node_modules", ".bin", binaryName);
3826
+ const binBase = path4.join(TOOLS_DIR, "node_modules", ".bin", binaryName);
3811
3827
  const binPath = installerPlatform() === "win32" ? `${binBase}.cmd` : binBase;
3812
3828
  if (installerPlatform() !== "win32") {
3813
3829
  try {
@@ -3849,7 +3865,7 @@ async function installNpmTool(toolId, packageName, binaryName, verificationArgs
3849
3865
  if (!isValid) {
3850
3866
  logSessionStart(`auto-install ${packageName}: installed but verification failed, cleaning up`);
3851
3867
  try {
3852
- const packagePath = path3.join(TOOLS_DIR, "node_modules", packageName);
3868
+ const packagePath = path4.join(TOOLS_DIR, "node_modules", packageName);
3853
3869
  await fs2.rm(packagePath, { recursive: true, force: true });
3854
3870
  await fs2.rm(binBase, { force: true });
3855
3871
  if (isWindows) {
@@ -3869,7 +3885,7 @@ function pipCommandCandidates() {
3869
3885
  return process.platform === "win32" ? ["pip", "py", "python"] : ["pip3", "pip", "python3", "python"];
3870
3886
  }
3871
3887
  function pipScriptsDir(base, platform = installerPlatform()) {
3872
- return path3.join(base, platform === "win32" ? "Scripts" : "bin");
3888
+ return path4.join(base, platform === "win32" ? "Scripts" : "bin");
3873
3889
  }
3874
3890
  var pipPep668LoggedRefusals = createGenerationMap("installer-pep668-log");
3875
3891
  async function pipConstraintEnvFor(toolId) {
@@ -3877,8 +3893,8 @@ async function pipConstraintEnvFor(toolId) {
3877
3893
  if (!constraints || constraints.length === 0)
3878
3894
  return {};
3879
3895
  const directories = [
3880
- path3.join(getGlobalPiLensDir(), "pip-constraints"),
3881
- path3.join(os.tmpdir(), "pi-lens-pip-constraints")
3896
+ path4.join(getGlobalPiLensDir(), "pip-constraints"),
3897
+ path4.join(os.tmpdir(), "pi-lens-pip-constraints")
3882
3898
  ];
3883
3899
  const directory = directories.find((candidate) => !/\s/.test(candidate));
3884
3900
  if (!directory) {
@@ -3889,9 +3905,9 @@ async function pipConstraintEnvFor(toolId) {
3889
3905
  });
3890
3906
  return {};
3891
3907
  }
3892
- const file = path3.join(directory, `${toolId}.txt`);
3908
+ const file = path4.join(directory, `${toolId}.txt`);
3893
3909
  try {
3894
- await fs2.mkdir(path3.dirname(file), { recursive: true });
3910
+ await fs2.mkdir(path4.dirname(file), { recursive: true });
3895
3911
  await writeFileAtomicAsync(file, `${constraints.join("\n")}
3896
3912
  `, {
3897
3913
  bestEffort: false
@@ -3960,7 +3976,7 @@ async function installPipTool(toolId, packageName, binaryName, options = {}) {
3960
3976
  return void 0;
3961
3977
  }
3962
3978
  const currentPath = process.env.PATH || process.env.Path || "";
3963
- const separator = isWindows ? ";" : path3.delimiter;
3979
+ const separator = isWindows ? ";" : path4.delimiter;
3964
3980
  if (!currentPath.toLowerCase().split(separator).includes(binDir.toLowerCase())) {
3965
3981
  const updatedPath = `${binDir}${separator}${currentPath}`;
3966
3982
  process.env.PATH = updatedPath;
@@ -3969,7 +3985,7 @@ async function installPipTool(toolId, packageName, binaryName, options = {}) {
3969
3985
  }
3970
3986
  const names = isWindows ? [`${binaryName}.exe`, `${binaryName}.cmd`, binaryName] : [binaryName];
3971
3987
  for (const name of names) {
3972
- const candidate = path3.join(binDir, name);
3988
+ const candidate = path4.join(binDir, name);
3973
3989
  try {
3974
3990
  await fs2.access(candidate);
3975
3991
  return candidate;
@@ -3987,7 +4003,7 @@ async function installPipTool(toolId, packageName, binaryName, options = {}) {
3987
4003
  "--value",
3988
4004
  "PIPX_BIN_DIR"
3989
4005
  ]);
3990
- const binDir = location.status === 0 && location.stdout.trim() ? location.stdout.trim() : path3.join(os.homedir(), ".local", "bin");
4006
+ const binDir = location.status === 0 && location.stdout.trim() ? location.stdout.trim() : path4.join(os.homedir(), ".local", "bin");
3991
4007
  const binaryPath = await addBinToPath(binDir);
3992
4008
  if (binaryPath)
3993
4009
  return succeeded("pipx", binaryPath);
@@ -3998,10 +4014,10 @@ async function installPipTool(toolId, packageName, binaryName, options = {}) {
3998
4014
  const pythonCandidates = pipCandidates.filter(({ command }) => command === "python3" || command === "python" || command === "py");
3999
4015
  const pythonAvailability = await Promise.all(pythonCandidates.map(({ command }) => isCommandAvailable(command)));
4000
4016
  const availablePythonCandidates = pythonCandidates.filter((_, index) => pythonAvailability[index]);
4001
- const venvRoot = path3.join(getGlobalPiLensDir(), "pip-tools");
4017
+ const venvRoot = path4.join(getGlobalPiLensDir(), "pip-tools");
4002
4018
  for (const candidate of availablePythonCandidates) {
4003
4019
  const venvBin = pipScriptsDir(venvRoot, installerPlatform());
4004
- let venvPip = path3.join(venvBin, isWindows ? "pip.exe" : "pip");
4020
+ let venvPip = path4.join(venvBin, isWindows ? "pip.exe" : "pip");
4005
4021
  try {
4006
4022
  await fs2.access(venvPip);
4007
4023
  } catch {
@@ -4015,7 +4031,7 @@ async function installPipTool(toolId, packageName, binaryName, options = {}) {
4015
4031
  try {
4016
4032
  await fs2.access(venvPip);
4017
4033
  } catch {
4018
- venvPip = path3.join(venvBin, isWindows ? "pip.cmd" : "pip3");
4034
+ venvPip = path4.join(venvBin, isWindows ? "pip.cmd" : "pip3");
4019
4035
  try {
4020
4036
  await fs2.access(venvPip);
4021
4037
  } catch {
@@ -4052,7 +4068,7 @@ async function installPipTool(toolId, packageName, binaryName, options = {}) {
4052
4068
  }
4053
4069
  if (!userRefused)
4054
4070
  throw new Error(`pip install failed: ${candidateErrors.join(" | ") || "unknown error"}`);
4055
- const privateBase = path3.join(getGlobalPiLensDir(), "pip-user");
4071
+ const privateBase = path4.join(getGlobalPiLensDir(), "pip-user");
4056
4072
  const privateEnv = { ...process.env, PYTHONUSERBASE: privateBase };
4057
4073
  for (const candidate of pipCandidates) {
4058
4074
  const args = candidate.command === "pip" || candidate.command === "pip3" ? [...verb, "--user", "--break-system-packages", packageName] : [
@@ -4105,7 +4121,7 @@ async function stampInstallResolution(toolId) {
4105
4121
  return;
4106
4122
  try {
4107
4123
  const resolutionId = lastInstallResolutionId.get(toolId);
4108
- const refresh = await import("./chunk-CE6VMBCB.js");
4124
+ const refresh = await import("./chunk-N56BNAA6.js");
4109
4125
  await refresh.stampManagedToolInstall(toolId, resolutionId);
4110
4126
  } catch {
4111
4127
  }
@@ -4118,7 +4134,7 @@ async function finishInstallAttempt(toolId, ok, startedAt) {
4118
4134
  if (ok) {
4119
4135
  resetSafeSpawnWindowsCommandCache();
4120
4136
  try {
4121
- const { resetMadgeManagedPathMemo } = await import("./chunk-7GLOLOSH.js");
4137
+ const { resetMadgeManagedPathMemo } = await import("./chunk-QJJKOHLH.js");
4122
4138
  resetMadgeManagedPathMemo();
4123
4139
  } catch (err) {
4124
4140
  logSessionStart(`auto-install ${toolId}: madge memo reset failed: ${err.message}`);
@@ -4127,7 +4143,7 @@ async function finishInstallAttempt(toolId, ok, startedAt) {
4127
4143
  return ok;
4128
4144
  }
4129
4145
  async function installTool(toolId, ownsLock) {
4130
- if (process.env.PI_LENS_DISABLE_TOOL_INSTALL === "1") {
4146
+ if (isToolInstallDisabled()) {
4131
4147
  installFailureReasons.set(toolId, "installation disabled by PI_LENS_DISABLE_TOOL_INSTALL=1");
4132
4148
  noteInstallAttempt(toolId, "declined", "installation disabled by PI_LENS_DISABLE_TOOL_INSTALL=1");
4133
4149
  logSessionStart(`auto-install ${toolId}: refused \u2014 PI_LENS_DISABLE_TOOL_INSTALL=1`);
@@ -4148,7 +4164,7 @@ async function installTool(toolId, ownsLock) {
4148
4164
  return false;
4149
4165
  const npmPath = await installNpmTool(tool.id, tool.packageName, tool.binaryName, tool.checkArgs, getToolVerificationTimeout(tool), packageEntryVerification(tool), ownsLock);
4150
4166
  if (npmPath !== void 0) {
4151
- await import("./chunk-CE6VMBCB.js").then((m) => m.stampManagedToolInstalled(tool.id, tool.packageName)).catch(() => {
4167
+ await import("./chunk-N56BNAA6.js").then((m) => m.stampManagedToolInstalled(tool.id, tool.packageName)).catch(() => {
4152
4168
  });
4153
4169
  }
4154
4170
  return finishInstallAttempt(tool.id, npmPath !== void 0, startedAt);
@@ -4251,7 +4267,7 @@ async function ensureToolResolved(toolId, opts) {
4251
4267
  logSessionStart(`auto-install ensure ${toolId}: force reinstall blocked \u2014 install disabled, discovery only (${Date.now() - ensureStartMs2}ms)`);
4252
4268
  return cacheResolvedPath(await getToolPath(toolId));
4253
4269
  }
4254
- if (process.env.PI_LENS_DISABLE_TOOL_INSTALL === "1") {
4270
+ if (isToolInstallDisabled()) {
4255
4271
  installFailureReasons.set(toolId, "installation disabled by PI_LENS_DISABLE_TOOL_INSTALL=1");
4256
4272
  noteInstallAttempt(toolId, "declined", "installation disabled by PI_LENS_DISABLE_TOOL_INSTALL=1");
4257
4273
  logSessionStart(`auto-install ensure ${toolId}: refused \u2014 PI_LENS_DISABLE_TOOL_INSTALL=1`);
@@ -4340,7 +4356,7 @@ async function ensureToolResolved(toolId, opts) {
4340
4356
  logSessionStart(`auto-install ensure ${toolId}: install disabled \u2014 discovery only, not found (${Date.now() - ensureStartMs}ms)`);
4341
4357
  return void 0;
4342
4358
  }
4343
- if (process.env.PI_LENS_DISABLE_TOOL_INSTALL === "1") {
4359
+ if (isToolInstallDisabled()) {
4344
4360
  installFailureReasons.set(toolId, "installation disabled by PI_LENS_DISABLE_TOOL_INSTALL=1");
4345
4361
  noteInstallAttempt(toolId, "declined", "installation disabled by PI_LENS_DISABLE_TOOL_INSTALL=1");
4346
4362
  logSessionStart(`auto-install ensure ${toolId}: refused \u2014 PI_LENS_DISABLE_TOOL_INSTALL=1 (${Date.now() - ensureStartMs}ms)`);
@@ -4391,10 +4407,10 @@ async function ensureToolResolved(toolId, opts) {
4391
4407
  }
4392
4408
  }
4393
4409
  async function getToolEnvironment() {
4394
- const localBin = path3.join(TOOLS_DIR, "node_modules", ".bin");
4410
+ const localBin = path4.join(TOOLS_DIR, "node_modules", ".bin");
4395
4411
  const currentPath = process.env.PATH || process.env.Path || process.env.path || "";
4396
4412
  const separator = process.platform === "win32" ? ";" : ":";
4397
- const nodeDir = path3.dirname(process.execPath);
4413
+ const nodeDir = path4.dirname(process.execPath);
4398
4414
  const withNode = nodeDir ? `${nodeDir}${separator}${currentPath}` : currentPath;
4399
4415
  const augmentedPath = `${GITHUB_BIN_DIR}${separator}${localBin}${separator}${withNode}`;
4400
4416
  const env = {
@@ -4409,12 +4425,12 @@ async function getToolEnvironment() {
4409
4425
  async function checkAllTools() {
4410
4426
  const results = [];
4411
4427
  for (const tool of TOOLS) {
4412
- const path4 = await getToolPath(tool.id);
4428
+ const path5 = await getToolPath(tool.id);
4413
4429
  results.push({
4414
4430
  id: tool.id,
4415
4431
  name: tool.name,
4416
- installed: path4 !== void 0,
4417
- path: path4
4432
+ installed: path5 !== void 0,
4433
+ path: path5
4418
4434
  });
4419
4435
  }
4420
4436
  return results;
@@ -4523,6 +4539,7 @@ export {
4523
4539
  resetZizmorTokenAvailability,
4524
4540
  resolveZizmorGitHubToken,
4525
4541
  logSessionStart,
4542
+ findCommandOnPath,
4526
4543
  commitDurableStore,
4527
4544
  commitDurableStoreAsync,
4528
4545
  getManagedToolsDir,