pi-lens 4.4.7 → 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 (167) hide show
  1. package/CHANGELOG.md +149 -0
  2. package/README.md +12 -2
  3. package/config/markdownlint/run-no-fix.mjs +36 -0
  4. package/dist/{chunk-WME2OQST.js → chunk-2453RRJ2.js} +11 -6
  5. package/dist/{chunk-FZKFVUEC.js → chunk-2BKUFQKR.js} +276 -208
  6. package/dist/chunk-2TS4GLOJ.js +31 -0
  7. package/dist/{chunk-QHSNL7B2.js → chunk-2ZE3AUJQ.js} +12 -14
  8. package/dist/{chunk-MPKRJBPK.js → chunk-35WKJWO5.js} +28 -30
  9. package/dist/chunk-3JAHQBSY.js +27 -0
  10. package/dist/{chunk-4LM3VAZH.js → chunk-3O5EII3W.js} +2 -2
  11. package/dist/chunk-447YZL4S.js +25 -0
  12. package/dist/{chunk-H7OR7DFZ.js → chunk-4B2YFN4U.js} +25 -21
  13. package/dist/{chunk-OSTKYB55.js → chunk-4BKU7PV3.js} +1 -1
  14. package/dist/{chunk-RRV3FNNM.js → chunk-4LL2VRNY.js} +27 -28
  15. package/dist/{chunk-BZARLRJW.js → chunk-4NBWFYWW.js} +9 -9
  16. package/dist/{chunk-KKCK636N.js → chunk-4QG55RRC.js} +12 -12
  17. package/dist/{chunk-RQS4QQSD.js → chunk-4W52ZKZX.js} +2 -2
  18. package/dist/{chunk-Z2XAOKHK.js → chunk-565VRUP4.js} +2 -2
  19. package/dist/{chunk-HWDAVBFU.js → chunk-57X2CDRX.js} +23 -23
  20. package/dist/{chunk-MB6PXBUA.js → chunk-5F3XF3SX.js} +7 -15
  21. package/dist/{chunk-O4BJFESU.js → chunk-5RNB4HVK.js} +1 -1
  22. package/dist/{chunk-ZMAUPOMG.js → chunk-5T5A6YAJ.js} +35 -34
  23. package/dist/{chunk-4ZYJHQMB.js → chunk-6FIRFP6A.js} +12 -12
  24. package/dist/{chunk-4YHYPW2G.js → chunk-6GMGEKQN.js} +9 -5
  25. package/dist/{chunk-4LOE5R5P.js → chunk-6LJOJ6EO.js} +20 -15
  26. package/dist/{chunk-3YY7IXIL.js → chunk-6YUNI7B5.js} +3 -3
  27. package/dist/{chunk-PKES3ISE.js → chunk-7ANZ7XDD.js} +2 -2
  28. package/dist/{chunk-FB5SCCPT.js → chunk-7CGIDRIK.js} +16 -15
  29. package/dist/{chunk-L3CMBQMH.js → chunk-7MAD5ZAY.js} +16 -17
  30. package/dist/{chunk-WDBICWH3.js → chunk-7TNILKGY.js} +1 -1
  31. package/dist/{chunk-RORGS5II.js → chunk-A5GRLYPZ.js} +9 -9
  32. package/dist/{chunk-MNJIXFX4.js → chunk-AGGUWKRK.js} +1 -1
  33. package/dist/{chunk-ABPKUVA4.js → chunk-BBET6HD6.js} +1 -1
  34. package/dist/{chunk-L5JYIU47.js → chunk-BHWW6FAX.js} +14 -13
  35. package/dist/{chunk-URCQWAQ4.js → chunk-BOPDQ7AZ.js} +23 -21
  36. package/dist/{chunk-KDX35VXP.js → chunk-BQG2QFVO.js} +158 -133
  37. package/dist/{chunk-CB4WHS4H.js → chunk-BUZIQDFS.js} +3 -3
  38. package/dist/{chunk-2PHMIAKO.js → chunk-CM73PPGD.js} +4 -4
  39. package/dist/{chunk-DH5JPM3K.js → chunk-CUDD35TW.js} +10 -9
  40. package/dist/{chunk-AWDSEDER.js → chunk-CZL44WFN.js} +2 -2
  41. package/dist/{chunk-N5WSK2K7.js → chunk-DIWK3LBC.js} +12 -15
  42. package/dist/{chunk-24BILSZW.js → chunk-DYRZGUMA.js} +2 -2
  43. package/dist/{chunk-PR6PO3ES.js → chunk-FHEV6T4L.js} +22 -18
  44. package/dist/{chunk-DQZFQSR5.js → chunk-FRLAUP2B.js} +4 -4
  45. package/dist/{chunk-RZOXUSPC.js → chunk-G5GV2Q7K.js} +2 -2
  46. package/dist/{chunk-EKWX4WD3.js → chunk-G6JKM4O7.js} +7 -7
  47. package/dist/chunk-GGYOZWHW.js +27 -0
  48. package/dist/{chunk-XT2HTCJ5.js → chunk-GIRBSBGL.js} +6 -5
  49. package/dist/{chunk-PQJFG24Z.js → chunk-GMROJJRN.js} +1292 -946
  50. package/dist/{chunk-U6VN4NVL.js → chunk-HHR7WGCI.js} +3 -3
  51. package/dist/{chunk-TIQJPRDD.js → chunk-HKIL6DCL.js} +3 -2
  52. package/dist/{chunk-SNDXCFRS.js → chunk-HUAM7QG3.js} +11 -11
  53. package/dist/{chunk-QOE342SU.js → chunk-HXFUTMX2.js} +2 -2
  54. package/dist/{chunk-U7BD2QL7.js → chunk-I22THIHI.js} +12 -12
  55. package/dist/chunk-IE5D3RA5.js +58 -0
  56. package/dist/{chunk-DPGEAHZT.js → chunk-IYVYZQRL.js} +10 -16
  57. package/dist/{chunk-3F6BMY53.js → chunk-JBP7KESM.js} +1 -1
  58. package/dist/{chunk-U5HPROLA.js → chunk-JE6HKLC7.js} +2 -2
  59. package/dist/{chunk-ZE3KXHS7.js → chunk-JPRDTY5S.js} +85 -3
  60. package/dist/{chunk-HO6LWE2E.js → chunk-JYLOYTZD.js} +17 -1
  61. package/dist/{chunk-KW5JQPO5.js → chunk-JZRP4DGP.js} +2 -2
  62. package/dist/{chunk-CPSR3AVL.js → chunk-KZ4ALBCH.js} +2 -2
  63. package/dist/{chunk-6IR3ZYIB.js → chunk-L3CLUGDY.js} +3 -3
  64. package/dist/{chunk-LV4UMYVH.js → chunk-L4NEVZ4T.js} +28 -27
  65. package/dist/chunk-LPYTPNOJ.js +22 -0
  66. package/dist/{chunk-WGRJOXED.js → chunk-LSFXZLPW.js} +1016 -636
  67. package/dist/{chunk-LBLBAFG3.js → chunk-MC6VB2E5.js} +4 -4
  68. package/dist/{chunk-U2SDMG7C.js → chunk-NM2NWH55.js} +5 -5
  69. package/dist/{chunk-T7A2HK2B.js → chunk-NSPVR3FN.js} +19 -18
  70. package/dist/{chunk-ZGSJDWQU.js → chunk-O2ARHQKF.js} +2 -2
  71. package/dist/{chunk-OXOI55RU.js → chunk-O4N5BQ3T.js} +10 -10
  72. package/dist/{chunk-3FRLWYBG.js → chunk-OC7VWJBZ.js} +39 -40
  73. package/dist/chunk-OFNMHPBT.js +89 -0
  74. package/dist/{chunk-HR3OJ3TH.js → chunk-OWTG6UMO.js} +21 -21
  75. package/dist/{chunk-75GAYVNO.js → chunk-OY7WZI7Q.js} +6 -6
  76. package/dist/{chunk-ZJTT47IG.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-EAOK7MIZ.js → chunk-PKSUMEPT.js} +17 -4
  80. package/dist/{chunk-YISME6ON.js → chunk-PPKECBPP.js} +1 -1
  81. package/dist/{chunk-4L36HG27.js → chunk-R2QQC33W.js} +14 -14
  82. package/dist/{chunk-LUBPZN36.js → chunk-R4QWJQ2H.js} +11 -11
  83. package/dist/{chunk-V63BC55Q.js → chunk-RGGH6M34.js} +1 -1
  84. package/dist/{chunk-Y7F7IEE3.js → chunk-RZG472YW.js} +65 -7
  85. package/dist/{chunk-PUZ3E2J4.js → chunk-SDFKOLSF.js} +6 -6
  86. package/dist/{chunk-YHC2O2WO.js → chunk-SFLHSL5R.js} +9 -9
  87. package/dist/{chunk-CCV2EU7T.js → chunk-SP4TFY5F.js} +14 -13
  88. package/dist/{chunk-J6JP25XU.js → chunk-SQC7K3SP.js} +4 -3
  89. package/dist/{chunk-3K2F6UDZ.js → chunk-T2S3FNNJ.js} +44 -42
  90. package/dist/{chunk-2TF6RXWB.js → chunk-TV6RXRYH.js} +10 -10
  91. package/dist/{chunk-GNSIWBAT.js → chunk-U3AS2FR6.js} +3 -3
  92. package/dist/{chunk-F7K5IBZG.js → chunk-UHHLR2VY.js} +40 -40
  93. package/dist/chunk-UYXV5NIS.js +20 -0
  94. package/dist/{chunk-VSFLRN5Y.js → chunk-VLQ7UKZH.js} +1 -1
  95. package/dist/{chunk-VUZWQ7UG.js → chunk-VN3L2JWZ.js} +46 -72
  96. package/dist/{chunk-NA7SEXHE.js → chunk-VOP4PJKA.js} +7 -7
  97. package/dist/{chunk-F5Z6URKM.js → chunk-VOXTCULR.js} +2 -2
  98. package/dist/{chunk-LLS45EWB.js → chunk-VPLBLWFO.js} +6 -8
  99. package/dist/chunk-W3BGKBBK.js +27 -0
  100. package/dist/{chunk-ZKXQKGWZ.js → chunk-WC6WRNQT.js} +4 -3
  101. package/dist/{chunk-YVHBNSME.js → chunk-WMDUT4KH.js} +1148 -1132
  102. package/dist/{chunk-KXF5R4UN.js → chunk-WQV6BI4Q.js} +1 -1
  103. package/dist/chunk-WXUDRAG6.js +24 -0
  104. package/dist/{chunk-KPPJTH44.js → chunk-X35S7HSB.js} +28 -10
  105. package/dist/{chunk-JMEKXFOL.js → chunk-X66YJ2SS.js} +40 -34
  106. package/dist/{chunk-CE6VMBCB.js → chunk-XOMGO63G.js} +22 -21
  107. package/dist/{chunk-LS3QJRUB.js → chunk-XWIME22V.js} +13 -13
  108. package/dist/{chunk-R5MOQM2H.js → chunk-XYLC35E4.js} +119 -87
  109. package/dist/{chunk-OE5ZBP7F.js → chunk-YHGYAEFH.js} +18 -18
  110. package/dist/{chunk-7E2563GA.js → chunk-ZFORSIED.js} +13 -13
  111. package/dist/{chunk-E7HJ56Y7.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-RC2Z6K47.js → chunk-ZZDIOAAJ.js} +15 -6
  115. package/dist/index.js +6993 -5396
  116. package/dist/mcp/analyze-cli.js +10 -10
  117. package/dist/mcp/cli.js +44 -42
  118. package/dist/mcp/server.js +1627 -504
  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 +18 -8
  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 +55 -12
  128. package/docs/engineering-principles.md +27 -2
  129. package/docs/features.md +2 -2
  130. package/docs/invariants/git-guard-host.md +7 -3
  131. package/docs/invariants/language-config.md +15 -4
  132. package/docs/invariants/lsp-trust-exec.md +16 -2
  133. package/docs/invariants/paths-os.md +4 -2
  134. package/docs/lsp-capability-matrix.md +119 -39
  135. package/docs/merge-queue-rollout.md +1 -1
  136. package/docs/pi-lens-fixer.md +24 -17
  137. package/docs/pi-lens-merge-policy.md +20 -11
  138. package/docs/pi-lens-monitor.md +9 -0
  139. package/docs/pi-lens-orchestration.md +4 -1
  140. package/docs/pi-lens-reviewer.md +5 -5
  141. package/docs/pi-lens-subagent.md +6 -3
  142. package/docs/public-api-stability.md +18 -2
  143. package/docs/schema/pi-lens-config-v1.json +10 -0
  144. package/docs/settings.md +10 -6
  145. package/docs/word-index.md +17 -5
  146. package/package.json +5 -3
  147. package/rules/ast-grep-rules/rule-tests/no-accumulating-spread-js-test.yml +37 -0
  148. package/rules/ast-grep-rules/rule-tests/ts-redundant-filter-map-test.yml +12 -1
  149. package/rules/ast-grep-rules/rule-tests-disabled/filter-then-map-js-test.yml +12 -0
  150. package/rules/ast-grep-rules/rule-tests-disabled/filter-then-map-test.yml +25 -0
  151. package/rules/ast-grep-rules/rules/no-accumulating-spread-js.yml +49 -1
  152. package/rules/ast-grep-rules/rules/ts-redundant-filter-map.yml +9 -1
  153. package/rules/ast-grep-rules/rules-disabled/filter-then-map-js.yml +17 -0
  154. package/rules/ast-grep-rules/rules-disabled/filter-then-map.yml +36 -0
  155. package/rules/ast-grep-rules/self-scan-baseline.json +1 -1
  156. package/dist/chunk-46TNM7XZ.js +0 -88
  157. package/dist/chunk-72OKUXSD.js +0 -31
  158. package/dist/chunk-7GLOLOSH.js +0 -57
  159. package/dist/chunk-AKUUMGD5.js +0 -26
  160. package/dist/chunk-ASUXV767.js +0 -22
  161. package/dist/chunk-CTADOKYM.js +0 -25
  162. package/dist/chunk-JJ2RRESP.js +0 -58
  163. package/dist/chunk-LSC3VADM.js +0 -23
  164. package/dist/chunk-SHLDT3OI.js +0 -27
  165. package/dist/chunk-UF7RTZSO.js +0 -27
  166. package/dist/chunk-W4WP2ERB.js +0 -30
  167. package/dist/chunk-YES5CACN.js +0 -73
@@ -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-IYVYZQRL.js";
5
5
  import {
6
6
  allAvailableGlobalBinDirs,
7
7
  installArgs,
8
8
  pmBinary,
9
9
  resolveNodePackageManager
10
- } from "./chunk-NA7SEXHE.js";
10
+ } from "./chunk-VOP4PJKA.js";
11
11
  import {
12
12
  probeToolAsync
13
- } from "./chunk-3F6BMY53.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-KW5JQPO5.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-YVHBNSME.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-U5HPROLA.js";
49
+ } from "./chunk-JE6HKLC7.js";
46
50
  import {
47
51
  getDegradationLedgerGeneration,
48
52
  incrementDegradationCount,
49
53
  recordDegradationOnce
50
- } from "./chunk-WME2OQST.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)
@@ -1886,7 +1921,7 @@ var resolvedPathCache = new BoundedLruCache(256);
1886
1921
  function resetResolvedPathCache() {
1887
1922
  resolvedPathCache.clear();
1888
1923
  }
1889
- var PROBE_CACHE_PATH = path3.join(getGlobalPiLensDir(), "probe-cache.json");
1924
+ var PROBE_CACHE_PATH = path4.join(getGlobalPiLensDir(), "probe-cache.json");
1890
1925
  var PROBE_CACHE_LOCK_STALE_MS = 18e4;
1891
1926
  var PROBE_CACHE_TTL_MS = 24 * 60 * 60 * 1e3;
1892
1927
  var PROBE_CACHE_TRANSIENT_COOLDOWN_MS = TRANSIENT_MAX_COOLDOWN_MS;
@@ -2052,6 +2087,17 @@ async function flushProbeCache() {
2052
2087
  _probeCacheWriteInFlight = null;
2053
2088
  }
2054
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);
2055
2101
  function isAstGrepVersionOutput(output) {
2056
2102
  return /\bast[- ]grep\b/i.test(output);
2057
2103
  }
@@ -2148,35 +2194,13 @@ function resetPathWalkMemo() {
2148
2194
  pathWalkMemo.clear();
2149
2195
  }
2150
2196
  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;
2197
+ return findCommandOnPath(command, installerPlatform() === "win32") !== null;
2174
2198
  }
2175
2199
  async function isSpawnableCommand(command) {
2176
2200
  const namesPath = installerPlatform() === "win32" ? /[\\/]/.test(command) : command.includes("/");
2177
2201
  if (namesPath) {
2178
2202
  try {
2179
- const stat = statSync(command);
2203
+ const stat = statSync2(command);
2180
2204
  return stat.isFile() && stat.size > 0;
2181
2205
  } catch {
2182
2206
  return false;
@@ -2207,17 +2231,17 @@ function packageEntryVerification(tool) {
2207
2231
  return tool.verification === "package-entry" ? tool.packageName : void 0;
2208
2232
  }
2209
2233
  async function verifyNpmPackageEntry(binPath, packageName) {
2210
- const nodeModulesDir = path3.dirname(path3.dirname(binPath));
2234
+ const nodeModulesDir = path4.dirname(path4.dirname(binPath));
2211
2235
  const pinned = parsePinnedVersion(packageName);
2212
2236
  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();
2237
+ const packageDir = path4.join(nodeModulesDir, ...bareName.split("/"));
2238
+ const shimName = path4.basename(binPath).replace(/\.(cmd|exe|ps1|bat)$/i, "").toLowerCase();
2215
2239
  const fail = (reason) => {
2216
2240
  logSessionStart(`auto-install verify: failed for ${binPath} (check=package-entry, kind=${reason})`);
2217
2241
  return false;
2218
2242
  };
2219
2243
  try {
2220
- const shim = statSync(binPath);
2244
+ const shim = statSync2(binPath);
2221
2245
  if (!shim.isFile() || shim.size === 0)
2222
2246
  return fail("shim-not-a-file");
2223
2247
  } catch {
@@ -2225,7 +2249,7 @@ async function verifyNpmPackageEntry(binPath, packageName) {
2225
2249
  }
2226
2250
  let manifest;
2227
2251
  try {
2228
- 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"));
2229
2253
  } catch {
2230
2254
  return fail("package-json-unreadable");
2231
2255
  }
@@ -2243,7 +2267,7 @@ async function verifyNpmPackageEntry(binPath, packageName) {
2243
2267
  return fail("package-json-no-entry");
2244
2268
  }
2245
2269
  try {
2246
- const stat = statSync(path3.join(packageDir, entry));
2270
+ const stat = statSync2(path4.join(packageDir, entry));
2247
2271
  if (!stat.isFile() || stat.size === 0)
2248
2272
  return fail("entry-not-a-file");
2249
2273
  } catch {
@@ -2380,7 +2404,7 @@ async function getAllToolStatuses(toolIds) {
2380
2404
  continue;
2381
2405
  }
2382
2406
  }
2383
- 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);
2384
2408
  const localPath = installerPlatform() === "win32" ? `${localBase}.cmd` : localBase;
2385
2409
  try {
2386
2410
  await fs2.access(localPath);
@@ -2407,9 +2431,9 @@ async function getArchiveTreeBundlePath(tool) {
2407
2431
  if (tool.installStrategy !== "archive" || tool.archive?.launcher) {
2408
2432
  return void 0;
2409
2433
  }
2410
- const extractDir = path3.join(TOOLS_DIR, tool.id);
2434
+ const extractDir = path4.join(TOOLS_DIR, tool.id);
2411
2435
  const treeMarker = tool.archive && resolveTreeMarker(tool.archive);
2412
- const marker = treeMarker ? path3.join(extractDir, ...treeMarker.split("/")) : extractDir;
2436
+ const marker = treeMarker ? path4.join(extractDir, ...treeMarker.split("/")) : extractDir;
2413
2437
  try {
2414
2438
  await fs2.access(marker);
2415
2439
  return extractDir;
@@ -2430,14 +2454,14 @@ function resolvePlatformPackageBinary(tool) {
2430
2454
  const fromMain = createRequire(mainPkgJson);
2431
2455
  let pkgDir;
2432
2456
  try {
2433
- pkgDir = path3.dirname(fromMain.resolve(`${platformPkg}/package.json`));
2457
+ pkgDir = path4.dirname(fromMain.resolve(`${platformPkg}/package.json`));
2434
2458
  } catch {
2435
- pkgDir = path3.dirname(_installerRequire.resolve(`${platformPkg}/package.json`));
2459
+ pkgDir = path4.dirname(_installerRequire.resolve(`${platformPkg}/package.json`));
2436
2460
  }
2437
2461
  const isWin = installerPlatform() === "win32";
2438
2462
  for (const bin of spec.binaries) {
2439
2463
  for (const name of isWin ? [`${bin}.exe`, bin] : [bin]) {
2440
- const candidate = path3.join(pkgDir, name);
2464
+ const candidate = path4.join(pkgDir, name);
2441
2465
  if (existsSync(candidate))
2442
2466
  return candidate;
2443
2467
  }
@@ -2475,7 +2499,7 @@ async function getToolPathResolved(toolId, onTransient, storeOnly) {
2475
2499
  if (seen)
2476
2500
  lastManagedInstallVersion.set(toolId, seen);
2477
2501
  } : void 0;
2478
- 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);
2479
2503
  if (installerPlatform() === "win32") {
2480
2504
  const cmdPath = `${localBase}.cmd`;
2481
2505
  try {
@@ -2560,11 +2584,11 @@ async function getToolPathResolved(toolId, onTransient, storeOnly) {
2560
2584
  async function findGitHubToolPath(binaryName) {
2561
2585
  const isWindows = process.platform === "win32";
2562
2586
  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)];
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)];
2568
2592
  for (const candidate of candidates) {
2569
2593
  try {
2570
2594
  await fs2.access(candidate);
@@ -2625,9 +2649,9 @@ async function findNpmGlobalToolPath(binaryName, onTransient, verificationArgs =
2625
2649
  const binDirs = await getNpmGlobalBinCandidates(onTransient);
2626
2650
  for (const dir of binDirs) {
2627
2651
  const candidates = isWindows ? [
2628
- path3.join(dir, `${binaryName}.cmd`),
2629
- path3.join(dir, `${binaryName}.exe`)
2630
- ] : [path3.join(dir, binaryName)];
2652
+ path4.join(dir, `${binaryName}.cmd`),
2653
+ path4.join(dir, `${binaryName}.exe`)
2654
+ ] : [path4.join(dir, binaryName)];
2631
2655
  for (const candidate of candidates) {
2632
2656
  try {
2633
2657
  await fs2.access(candidate);
@@ -2650,7 +2674,7 @@ async function getNpmGlobalBinCandidates(onTransient) {
2650
2674
  const add = (value) => {
2651
2675
  if (!value)
2652
2676
  return;
2653
- const normalized = path3.resolve(value.trim());
2677
+ const normalized = path4.resolve(value.trim());
2654
2678
  if (!normalized)
2655
2679
  return;
2656
2680
  if (seen.has(normalized))
@@ -2659,9 +2683,9 @@ async function getNpmGlobalBinCandidates(onTransient) {
2659
2683
  dirs.push(normalized);
2660
2684
  };
2661
2685
  if (process.platform === "win32") {
2662
- add(path3.join(process.env.APPDATA || "", "npm"));
2686
+ add(path4.join(process.env.APPDATA || "", "npm"));
2663
2687
  } else {
2664
- add(path3.join(os.homedir(), ".npm-global", "bin"));
2688
+ add(path4.join(os.homedir(), ".npm-global", "bin"));
2665
2689
  }
2666
2690
  for (const dir of await allAvailableGlobalBinDirs(onTransient)) {
2667
2691
  add(dir);
@@ -2671,8 +2695,8 @@ async function getNpmGlobalBinCandidates(onTransient) {
2671
2695
  async function findPipUserToolPath(binaryName, onTransient, verificationArgs = ["--version"], verificationTimeoutMs = 1e4, piLensPrefixesOnly = false) {
2672
2696
  const isWindows = installerPlatform() === "win32";
2673
2697
  const userBaseCandidates = [
2674
- path3.join(getGlobalPiLensDir(), "pip-tools"),
2675
- path3.join(getGlobalPiLensDir(), "pip-user"),
2698
+ path4.join(getGlobalPiLensDir(), "pip-tools"),
2699
+ path4.join(getGlobalPiLensDir(), "pip-user"),
2676
2700
  ...piLensPrefixesOnly ? [] : await getPythonUserBaseCandidates()
2677
2701
  ];
2678
2702
  for (const userBase of userBaseCandidates) {
@@ -2685,17 +2709,17 @@ async function findPipUserToolPath(binaryName, onTransient, verificationArgs = [
2685
2709
  continue;
2686
2710
  if (!/^python\d+$/i.test(entry.name))
2687
2711
  continue;
2688
- scriptDirs.push(path3.join(userBase, entry.name, "Scripts"));
2712
+ scriptDirs.push(path4.join(userBase, entry.name, "Scripts"));
2689
2713
  }
2690
2714
  } catch {
2691
2715
  }
2692
2716
  }
2693
2717
  for (const dir of scriptDirs) {
2694
2718
  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)];
2719
+ path4.join(dir, `${binaryName}.exe`),
2720
+ path4.join(dir, `${binaryName}.cmd`),
2721
+ path4.join(dir, binaryName)
2722
+ ] : [path4.join(dir, binaryName)];
2699
2723
  for (const candidate of candidates) {
2700
2724
  try {
2701
2725
  await fs2.access(candidate);
@@ -2741,7 +2765,7 @@ async function getPythonUserBaseCandidates() {
2741
2765
  candidates.push(normalized);
2742
2766
  };
2743
2767
  if (process.platform === "win32") {
2744
- add(path3.join(process.env.APPDATA || "", "Python"));
2768
+ add(path4.join(process.env.APPDATA || "", "Python"));
2745
2769
  }
2746
2770
  const probes = process.platform === "win32" ? [
2747
2771
  { command: "py", args: ["-m", "site", "--user-base"] },
@@ -2900,7 +2924,7 @@ async function installGitHubTool(tool, prefetchedRelease) {
2900
2924
  const binaryName = tool.binaryName ?? tool.id;
2901
2925
  const isWindows = platform === "win32";
2902
2926
  const finalBinaryName = getGitHubInstalledBinaryName(binaryName, platform, asset.name);
2903
- let destPath = path3.join(GITHUB_BIN_DIR, finalBinaryName);
2927
+ let destPath = path4.join(GITHUB_BIN_DIR, finalBinaryName);
2904
2928
  const assetName = asset.name;
2905
2929
  const launcherRuntime = launcherForGitHubAsset(spec, assetName);
2906
2930
  if (launcherRuntime && !await isCommandAvailable(launcherRuntime, ["--version"])) {
@@ -2910,13 +2934,13 @@ async function installGitHubTool(tool, prefetchedRelease) {
2910
2934
  try {
2911
2935
  assertManagedBinDirInsidePinnedHome(tool.id);
2912
2936
  if (launcherRuntime) {
2913
- 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"}`);
2914
2938
  await writeFileAtomicAsync(assetPath, assetBuffer, {
2915
2939
  bestEffort: false,
2916
2940
  mode: 488
2917
2941
  });
2918
2942
  const launcherName = isWindows ? `${binaryName}.bat` : binaryName;
2919
- destPath = path3.join(GITHUB_BIN_DIR, launcherName);
2943
+ destPath = path4.join(GITHUB_BIN_DIR, launcherName);
2920
2944
  const runtimeTarget = assetName.endsWith(".phar") ? `${tool.id}.phar` : `${tool.id}.jar`;
2921
2945
  const command = isWindows ? `@echo off\r
2922
2946
  ${launcherRuntime} "%~dp0${runtimeTarget}" %*\r
@@ -2941,9 +2965,9 @@ exec ${launcherRuntime} "$(dirname "$0")/${runtimeTarget}" "$@"
2941
2965
  mode: 488
2942
2966
  });
2943
2967
  } else if (assetName.endsWith(".tar.gz") || assetName.endsWith(".tar.xz")) {
2944
- const tmpArchive = path3.join(GITHUB_BIN_DIR, `_tmp_${assetName}`);
2968
+ const tmpArchive = path4.join(GITHUB_BIN_DIR, `_tmp_${assetName}`);
2945
2969
  await fs2.writeFile(tmpArchive, assetBuffer);
2946
- const tmpDir = path3.join(GITHUB_BIN_DIR, `_tmp_extract_${tool.id}`);
2970
+ const tmpDir = path4.join(GITHUB_BIN_DIR, `_tmp_extract_${tool.id}`);
2947
2971
  await fs2.mkdir(tmpDir, { recursive: true });
2948
2972
  const extracted = await runCommand("tar", ["xf", tmpArchive, "-C", tmpDir], GITHUB_BIN_DIR);
2949
2973
  await fs2.rm(tmpArchive, { force: true });
@@ -2964,9 +2988,9 @@ exec ${launcherRuntime} "$(dirname "$0")/${runtimeTarget}" "$@"
2964
2988
  if (!isWindows)
2965
2989
  await fs2.chmod(destPath, 488);
2966
2990
  } else if (assetName.endsWith(".zip")) {
2967
- const tmpArchive = path3.join(GITHUB_BIN_DIR, `_tmp_${assetName}`);
2991
+ const tmpArchive = path4.join(GITHUB_BIN_DIR, `_tmp_${assetName}`);
2968
2992
  await fs2.writeFile(tmpArchive, assetBuffer);
2969
- const tmpDir = path3.join(GITHUB_BIN_DIR, `_tmp_extract_${tool.id}`);
2993
+ const tmpDir = path4.join(GITHUB_BIN_DIR, `_tmp_extract_${tool.id}`);
2970
2994
  await fs2.mkdir(tmpDir, { recursive: true });
2971
2995
  const extracted = isWindows ? await runCommand("powershell", [
2972
2996
  "-NoProfile",
@@ -3008,7 +3032,7 @@ exec ${launcherRuntime} "$(dirname "$0")/${runtimeTarget}" "$@"
3008
3032
  }
3009
3033
  try {
3010
3034
  const extraBuffer = await httpsGet(extraAsset.browser_download_url);
3011
- 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 });
3012
3036
  logSessionStart(`github-install ${tool.id}: installed extra asset ${extraName} (${extraBuffer.length} bytes)`);
3013
3037
  } catch (err) {
3014
3038
  logSessionStart(`github-install ${tool.id}: extra asset ${extraName} download failed: ${err.message}`);
@@ -3023,7 +3047,7 @@ async function findFirstFileRecursive(dir, names) {
3023
3047
  const wanted = new Set(names.map((name) => name.toLowerCase()));
3024
3048
  const entries = await fs2.readdir(dir, { withFileTypes: true });
3025
3049
  for (const entry of entries) {
3026
- const full = path3.join(dir, entry.name);
3050
+ const full = path4.join(dir, entry.name);
3027
3051
  if (entry.isDirectory()) {
3028
3052
  const found = await findFirstFileRecursive(full, names);
3029
3053
  if (found)
@@ -3152,7 +3176,7 @@ async function isManagedToolPresent(toolId) {
3152
3176
  if (!tool.packageName)
3153
3177
  return false;
3154
3178
  try {
3155
- 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"));
3156
3180
  return true;
3157
3181
  } catch {
3158
3182
  return false;
@@ -3439,7 +3463,7 @@ async function refreshPinnedManagedTool(tool, known) {
3439
3463
  };
3440
3464
  }
3441
3465
  function resolveManagedNpmBinPath(binaryName) {
3442
- const binBase = path3.join(TOOLS_DIR, "node_modules", ".bin", binaryName);
3466
+ const binBase = path4.join(TOOLS_DIR, "node_modules", ".bin", binaryName);
3443
3467
  return installerPlatform() === "win32" ? `${binBase}.cmd` : binBase;
3444
3468
  }
3445
3469
  function invalidateManagedToolResolution(toolId) {
@@ -3477,10 +3501,10 @@ async function installMavenTool(tool) {
3477
3501
  try {
3478
3502
  await fs2.mkdir(GITHUB_BIN_DIR, { recursive: true });
3479
3503
  assertManagedBinDirInsidePinnedHome(tool.id);
3480
- const jarPath = path3.join(GITHUB_BIN_DIR, `${tool.id}.jar`);
3504
+ const jarPath = path4.join(GITHUB_BIN_DIR, `${tool.id}.jar`);
3481
3505
  await writeFileAtomicAsync(jarPath, jarBuffer, { bestEffort: false });
3482
3506
  const launcherName = isWindows ? `${binaryName}.bat` : binaryName;
3483
- const launcherPath = path3.join(GITHUB_BIN_DIR, launcherName);
3507
+ const launcherPath = path4.join(GITHUB_BIN_DIR, launcherName);
3484
3508
  if (isWindows) {
3485
3509
  await writeFileAtomicAsync(launcherPath, `@echo off\r
3486
3510
  java -jar "%~dp0${tool.id}.jar" %*\r
@@ -3520,9 +3544,9 @@ async function stripExtractedArchiveRoot(dir, components) {
3520
3544
  const [entry] = entries;
3521
3545
  if (entries.length !== 1 || !entry?.isDirectory())
3522
3546
  return false;
3523
- const root = path3.join(dir, entry.name);
3547
+ const root = path4.join(dir, entry.name);
3524
3548
  for (const child of await fs2.readdir(root))
3525
- await fs2.rename(path3.join(root, child), path3.join(dir, child));
3549
+ await fs2.rename(path4.join(root, child), path4.join(dir, child));
3526
3550
  await fs2.rm(root, { recursive: true, force: true });
3527
3551
  }
3528
3552
  return true;
@@ -3572,7 +3596,7 @@ function runtimeHomeVerdict(runtime) {
3572
3596
  const names = windows ? [`${runtime}.exe`, runtime] : [runtime];
3573
3597
  return names.some((name) => {
3574
3598
  try {
3575
- const stat = statSync(path3.join(root, home.dir, name));
3599
+ const stat = statSync2(path4.join(root, home.dir, name));
3576
3600
  return stat.isFile() && stat.size > 0 && (windows || (stat.mode & 73) !== 0);
3577
3601
  } catch {
3578
3602
  return false;
@@ -3617,9 +3641,9 @@ async function installArchiveTool(tool) {
3617
3641
  const extractName = tool.id;
3618
3642
  const tmpExtractName = `${extractName}.refresh-tmp`;
3619
3643
  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);
3644
+ const extractDir = path4.join(TOOLS_DIR, extractName);
3645
+ const tmpExtractDir = path4.join(TOOLS_DIR, tmpExtractName);
3646
+ const tmpArchive = path4.join(TOOLS_DIR, archiveName);
3623
3647
  try {
3624
3648
  await fs2.mkdir(TOOLS_DIR, { recursive: true });
3625
3649
  await fs2.rm(tmpExtractDir, { recursive: true, force: true });
@@ -3637,7 +3661,7 @@ async function installArchiveTool(tool) {
3637
3661
  tmpExtractName,
3638
3662
  ...stripComponents > 0 ? [`--strip-components=${stripComponents}`] : []
3639
3663
  ];
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";
3664
+ const extractor = archiveKind === "zip" && isWindows ? windowsExe("WindowsPowerShell\\v1.0\\powershell.exe") : archiveKind === "zip" ? "unzip" : isWindows ? windowsExe("tar.exe") : "tar";
3641
3665
  const extractionResult = await safeSpawnAsync(extractor, extractionArgs, {
3642
3666
  cwd: TOOLS_DIR,
3643
3667
  timeout: 12e4,
@@ -3665,7 +3689,7 @@ async function installArchiveTool(tool) {
3665
3689
  }
3666
3690
  if (!spec.launcher) {
3667
3691
  const treeMarker = resolveTreeMarker(spec, platform);
3668
- const tmpMarker = treeMarker ? path3.join(tmpExtractDir, ...treeMarker.split("/")) : tmpExtractDir;
3692
+ const tmpMarker = treeMarker ? path4.join(tmpExtractDir, ...treeMarker.split("/")) : tmpExtractDir;
3669
3693
  try {
3670
3694
  await fs2.access(tmpMarker);
3671
3695
  } catch {
@@ -3681,7 +3705,7 @@ async function installArchiveTool(tool) {
3681
3705
  return extractDir;
3682
3706
  }
3683
3707
  const launcherParts = spec.launcher.split("/").map((p) => p);
3684
- const tmpInnerLauncher = path3.join(tmpExtractDir, ...launcherParts);
3708
+ const tmpInnerLauncher = path4.join(tmpExtractDir, ...launcherParts);
3685
3709
  const tmpResolvedInner = isWindows ? `${tmpInnerLauncher}.bat` : tmpInnerLauncher;
3686
3710
  try {
3687
3711
  await fs2.access(tmpResolvedInner);
@@ -3707,10 +3731,10 @@ async function installArchiveTool(tool) {
3707
3731
  await fs2.mkdir(GITHUB_BIN_DIR, { recursive: true });
3708
3732
  assertManagedBinDirInsidePinnedHome(tool.id);
3709
3733
  await swapExtractedDir(tool.id, tmpExtractDir, extractDir);
3710
- const innerLauncher = path3.join(extractDir, ...launcherParts);
3734
+ const innerLauncher = path4.join(extractDir, ...launcherParts);
3711
3735
  const resolvedInner = isWindows ? `${innerLauncher}.bat` : innerLauncher;
3712
3736
  const launcherName = isWindows ? `${binaryName}.bat` : binaryName;
3713
- const shimPath = path3.join(GITHUB_BIN_DIR, launcherName);
3737
+ const shimPath = path4.join(GITHUB_BIN_DIR, launcherName);
3714
3738
  if (isWindows) {
3715
3739
  await writeFileAtomicAsync(shimPath, `@echo off\r
3716
3740
  call "${resolvedInner}" %*\r
@@ -3759,7 +3783,7 @@ async function installNpmTool(toolId, packageName, binaryName, verificationArgs
3759
3783
  };
3760
3784
  try {
3761
3785
  await fs2.mkdir(TOOLS_DIR, { recursive: true });
3762
- const packageJsonPath = path3.join(TOOLS_DIR, "package.json");
3786
+ const packageJsonPath = path4.join(TOOLS_DIR, "package.json");
3763
3787
  try {
3764
3788
  await fs2.access(packageJsonPath);
3765
3789
  } catch {
@@ -3807,7 +3831,7 @@ async function installNpmTool(toolId, packageName, binaryName, verificationArgs
3807
3831
  if (!outcome.ok) {
3808
3832
  throw new Error(`Failed to install ${packageName}: ${outcome.stderr}`);
3809
3833
  }
3810
- const binBase = path3.join(TOOLS_DIR, "node_modules", ".bin", binaryName);
3834
+ const binBase = path4.join(TOOLS_DIR, "node_modules", ".bin", binaryName);
3811
3835
  const binPath = installerPlatform() === "win32" ? `${binBase}.cmd` : binBase;
3812
3836
  if (installerPlatform() !== "win32") {
3813
3837
  try {
@@ -3849,7 +3873,7 @@ async function installNpmTool(toolId, packageName, binaryName, verificationArgs
3849
3873
  if (!isValid) {
3850
3874
  logSessionStart(`auto-install ${packageName}: installed but verification failed, cleaning up`);
3851
3875
  try {
3852
- const packagePath = path3.join(TOOLS_DIR, "node_modules", packageName);
3876
+ const packagePath = path4.join(TOOLS_DIR, "node_modules", packageName);
3853
3877
  await fs2.rm(packagePath, { recursive: true, force: true });
3854
3878
  await fs2.rm(binBase, { force: true });
3855
3879
  if (isWindows) {
@@ -3869,7 +3893,7 @@ function pipCommandCandidates() {
3869
3893
  return process.platform === "win32" ? ["pip", "py", "python"] : ["pip3", "pip", "python3", "python"];
3870
3894
  }
3871
3895
  function pipScriptsDir(base, platform = installerPlatform()) {
3872
- return path3.join(base, platform === "win32" ? "Scripts" : "bin");
3896
+ return path4.join(base, platform === "win32" ? "Scripts" : "bin");
3873
3897
  }
3874
3898
  var pipPep668LoggedRefusals = createGenerationMap("installer-pep668-log");
3875
3899
  async function pipConstraintEnvFor(toolId) {
@@ -3877,8 +3901,8 @@ async function pipConstraintEnvFor(toolId) {
3877
3901
  if (!constraints || constraints.length === 0)
3878
3902
  return {};
3879
3903
  const directories = [
3880
- path3.join(getGlobalPiLensDir(), "pip-constraints"),
3881
- path3.join(os.tmpdir(), "pi-lens-pip-constraints")
3904
+ path4.join(getGlobalPiLensDir(), "pip-constraints"),
3905
+ path4.join(os.tmpdir(), "pi-lens-pip-constraints")
3882
3906
  ];
3883
3907
  const directory = directories.find((candidate) => !/\s/.test(candidate));
3884
3908
  if (!directory) {
@@ -3889,9 +3913,9 @@ async function pipConstraintEnvFor(toolId) {
3889
3913
  });
3890
3914
  return {};
3891
3915
  }
3892
- const file = path3.join(directory, `${toolId}.txt`);
3916
+ const file = path4.join(directory, `${toolId}.txt`);
3893
3917
  try {
3894
- await fs2.mkdir(path3.dirname(file), { recursive: true });
3918
+ await fs2.mkdir(path4.dirname(file), { recursive: true });
3895
3919
  await writeFileAtomicAsync(file, `${constraints.join("\n")}
3896
3920
  `, {
3897
3921
  bestEffort: false
@@ -3960,7 +3984,7 @@ async function installPipTool(toolId, packageName, binaryName, options = {}) {
3960
3984
  return void 0;
3961
3985
  }
3962
3986
  const currentPath = process.env.PATH || process.env.Path || "";
3963
- const separator = isWindows ? ";" : path3.delimiter;
3987
+ const separator = isWindows ? ";" : path4.delimiter;
3964
3988
  if (!currentPath.toLowerCase().split(separator).includes(binDir.toLowerCase())) {
3965
3989
  const updatedPath = `${binDir}${separator}${currentPath}`;
3966
3990
  process.env.PATH = updatedPath;
@@ -3969,7 +3993,7 @@ async function installPipTool(toolId, packageName, binaryName, options = {}) {
3969
3993
  }
3970
3994
  const names = isWindows ? [`${binaryName}.exe`, `${binaryName}.cmd`, binaryName] : [binaryName];
3971
3995
  for (const name of names) {
3972
- const candidate = path3.join(binDir, name);
3996
+ const candidate = path4.join(binDir, name);
3973
3997
  try {
3974
3998
  await fs2.access(candidate);
3975
3999
  return candidate;
@@ -3987,7 +4011,7 @@ async function installPipTool(toolId, packageName, binaryName, options = {}) {
3987
4011
  "--value",
3988
4012
  "PIPX_BIN_DIR"
3989
4013
  ]);
3990
- 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");
3991
4015
  const binaryPath = await addBinToPath(binDir);
3992
4016
  if (binaryPath)
3993
4017
  return succeeded("pipx", binaryPath);
@@ -3998,10 +4022,10 @@ async function installPipTool(toolId, packageName, binaryName, options = {}) {
3998
4022
  const pythonCandidates = pipCandidates.filter(({ command }) => command === "python3" || command === "python" || command === "py");
3999
4023
  const pythonAvailability = await Promise.all(pythonCandidates.map(({ command }) => isCommandAvailable(command)));
4000
4024
  const availablePythonCandidates = pythonCandidates.filter((_, index) => pythonAvailability[index]);
4001
- const venvRoot = path3.join(getGlobalPiLensDir(), "pip-tools");
4025
+ const venvRoot = path4.join(getGlobalPiLensDir(), "pip-tools");
4002
4026
  for (const candidate of availablePythonCandidates) {
4003
4027
  const venvBin = pipScriptsDir(venvRoot, installerPlatform());
4004
- let venvPip = path3.join(venvBin, isWindows ? "pip.exe" : "pip");
4028
+ let venvPip = path4.join(venvBin, isWindows ? "pip.exe" : "pip");
4005
4029
  try {
4006
4030
  await fs2.access(venvPip);
4007
4031
  } catch {
@@ -4015,7 +4039,7 @@ async function installPipTool(toolId, packageName, binaryName, options = {}) {
4015
4039
  try {
4016
4040
  await fs2.access(venvPip);
4017
4041
  } catch {
4018
- venvPip = path3.join(venvBin, isWindows ? "pip.cmd" : "pip3");
4042
+ venvPip = path4.join(venvBin, isWindows ? "pip.cmd" : "pip3");
4019
4043
  try {
4020
4044
  await fs2.access(venvPip);
4021
4045
  } catch {
@@ -4052,7 +4076,7 @@ async function installPipTool(toolId, packageName, binaryName, options = {}) {
4052
4076
  }
4053
4077
  if (!userRefused)
4054
4078
  throw new Error(`pip install failed: ${candidateErrors.join(" | ") || "unknown error"}`);
4055
- const privateBase = path3.join(getGlobalPiLensDir(), "pip-user");
4079
+ const privateBase = path4.join(getGlobalPiLensDir(), "pip-user");
4056
4080
  const privateEnv = { ...process.env, PYTHONUSERBASE: privateBase };
4057
4081
  for (const candidate of pipCandidates) {
4058
4082
  const args = candidate.command === "pip" || candidate.command === "pip3" ? [...verb, "--user", "--break-system-packages", packageName] : [
@@ -4105,7 +4129,7 @@ async function stampInstallResolution(toolId) {
4105
4129
  return;
4106
4130
  try {
4107
4131
  const resolutionId = lastInstallResolutionId.get(toolId);
4108
- const refresh = await import("./chunk-CE6VMBCB.js");
4132
+ const refresh = await import("./chunk-XOMGO63G.js");
4109
4133
  await refresh.stampManagedToolInstall(toolId, resolutionId);
4110
4134
  } catch {
4111
4135
  }
@@ -4118,7 +4142,7 @@ async function finishInstallAttempt(toolId, ok, startedAt) {
4118
4142
  if (ok) {
4119
4143
  resetSafeSpawnWindowsCommandCache();
4120
4144
  try {
4121
- const { resetMadgeManagedPathMemo } = await import("./chunk-7GLOLOSH.js");
4145
+ const { resetMadgeManagedPathMemo } = await import("./chunk-IE5D3RA5.js");
4122
4146
  resetMadgeManagedPathMemo();
4123
4147
  } catch (err) {
4124
4148
  logSessionStart(`auto-install ${toolId}: madge memo reset failed: ${err.message}`);
@@ -4148,7 +4172,7 @@ async function installTool(toolId, ownsLock) {
4148
4172
  return false;
4149
4173
  const npmPath = await installNpmTool(tool.id, tool.packageName, tool.binaryName, tool.checkArgs, getToolVerificationTimeout(tool), packageEntryVerification(tool), ownsLock);
4150
4174
  if (npmPath !== void 0) {
4151
- await import("./chunk-CE6VMBCB.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(() => {
4152
4176
  });
4153
4177
  }
4154
4178
  return finishInstallAttempt(tool.id, npmPath !== void 0, startedAt);
@@ -4391,10 +4415,10 @@ async function ensureToolResolved(toolId, opts) {
4391
4415
  }
4392
4416
  }
4393
4417
  async function getToolEnvironment() {
4394
- const localBin = path3.join(TOOLS_DIR, "node_modules", ".bin");
4418
+ const localBin = path4.join(TOOLS_DIR, "node_modules", ".bin");
4395
4419
  const currentPath = process.env.PATH || process.env.Path || process.env.path || "";
4396
4420
  const separator = process.platform === "win32" ? ";" : ":";
4397
- const nodeDir = path3.dirname(process.execPath);
4421
+ const nodeDir = path4.dirname(process.execPath);
4398
4422
  const withNode = nodeDir ? `${nodeDir}${separator}${currentPath}` : currentPath;
4399
4423
  const augmentedPath = `${GITHUB_BIN_DIR}${separator}${localBin}${separator}${withNode}`;
4400
4424
  const env = {
@@ -4409,12 +4433,12 @@ async function getToolEnvironment() {
4409
4433
  async function checkAllTools() {
4410
4434
  const results = [];
4411
4435
  for (const tool of TOOLS) {
4412
- const path4 = await getToolPath(tool.id);
4436
+ const path5 = await getToolPath(tool.id);
4413
4437
  results.push({
4414
4438
  id: tool.id,
4415
4439
  name: tool.name,
4416
- installed: path4 !== void 0,
4417
- path: path4
4440
+ installed: path5 !== void 0,
4441
+ path: path5
4418
4442
  });
4419
4443
  }
4420
4444
  return results;
@@ -4523,6 +4547,7 @@ export {
4523
4547
  resetZizmorTokenAvailability,
4524
4548
  resolveZizmorGitHubToken,
4525
4549
  logSessionStart,
4550
+ findCommandOnPath,
4526
4551
  commitDurableStore,
4527
4552
  commitDurableStoreAsync,
4528
4553
  getManagedToolsDir,