pi-lens 4.4.6 → 4.4.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (174) hide show
  1. package/CHANGELOG.md +232 -0
  2. package/README.md +17 -3
  3. package/config/markdownlint/run-no-fix.mjs +36 -0
  4. package/dist/{chunk-ZQ6NZZTB.js → chunk-2453RRJ2.js} +44 -6
  5. package/dist/{chunk-GZE7WOI4.js → chunk-2BKUFQKR.js} +696 -330
  6. package/dist/chunk-2TS4GLOJ.js +31 -0
  7. package/dist/{chunk-2DMLM3ZO.js → chunk-2ZE3AUJQ.js} +12 -14
  8. package/dist/{chunk-OJLTLYHB.js → chunk-35WKJWO5.js} +51 -33
  9. package/dist/chunk-3JAHQBSY.js +27 -0
  10. package/dist/{chunk-PO45POGF.js → chunk-3O5EII3W.js} +2 -2
  11. package/dist/chunk-447YZL4S.js +25 -0
  12. package/dist/{chunk-TIYGSODX.js → chunk-4B2YFN4U.js} +28 -22
  13. package/dist/{chunk-OSTKYB55.js → chunk-4BKU7PV3.js} +1 -1
  14. package/dist/{chunk-XQCSWV2G.js → chunk-4LL2VRNY.js} +27 -28
  15. package/dist/{chunk-MA77RSFN.js → chunk-4NBWFYWW.js} +9 -9
  16. package/dist/{chunk-75SY4F24.js → chunk-4QG55RRC.js} +12 -12
  17. package/dist/{chunk-K2YGBXOA.js → chunk-4W52ZKZX.js} +2 -2
  18. package/dist/{chunk-Z2XAOKHK.js → chunk-565VRUP4.js} +2 -2
  19. package/dist/{chunk-CFRQMBGP.js → chunk-57X2CDRX.js} +23 -23
  20. package/dist/{chunk-XAIT2YGS.js → chunk-5F3XF3SX.js} +7 -15
  21. package/dist/{chunk-UHGF5UT5.js → chunk-5RNB4HVK.js} +1 -1
  22. package/dist/{chunk-Q4EMRFNA.js → chunk-5T5A6YAJ.js} +35 -34
  23. package/dist/{chunk-W5LGKNET.js → chunk-6FIRFP6A.js} +12 -12
  24. package/dist/{chunk-KLQVC3XC.js → chunk-6GMGEKQN.js} +36 -9
  25. package/dist/{chunk-UN4TEBWN.js → chunk-6LJOJ6EO.js} +20 -15
  26. package/dist/{chunk-HK6JVFZC.js → chunk-6YUNI7B5.js} +3 -3
  27. package/dist/{chunk-PKES3ISE.js → chunk-7ANZ7XDD.js} +2 -2
  28. package/dist/{chunk-VQH24FIP.js → chunk-7CGIDRIK.js} +16 -15
  29. package/dist/{chunk-SCIUNBPF.js → chunk-7MAD5ZAY.js} +16 -17
  30. package/dist/{chunk-OOU2WZZE.js → chunk-7TNILKGY.js} +1 -1
  31. package/dist/{chunk-LEJOJDXL.js → chunk-A5GRLYPZ.js} +9 -9
  32. package/dist/{chunk-AE37FEGH.js → chunk-AGGUWKRK.js} +1 -1
  33. package/dist/{chunk-BWYQUPOS.js → chunk-BBET6HD6.js} +1 -1
  34. package/dist/{chunk-GAACZY6R.js → chunk-BHWW6FAX.js} +14 -13
  35. package/dist/{chunk-A3YNG5KP.js → chunk-BOPDQ7AZ.js} +23 -21
  36. package/dist/{chunk-MKVZQUEG.js → chunk-BQG2QFVO.js} +215 -134
  37. package/dist/{chunk-EVDGNG4F.js → chunk-BUZIQDFS.js} +3 -3
  38. package/dist/{chunk-2PHMIAKO.js → chunk-CM73PPGD.js} +4 -4
  39. package/dist/{chunk-63RIVFQI.js → chunk-CUDD35TW.js} +10 -9
  40. package/dist/{chunk-BM5GS6ZH.js → chunk-CZL44WFN.js} +2 -2
  41. package/dist/{chunk-QGSTQH4D.js → chunk-DIWK3LBC.js} +12 -15
  42. package/dist/{chunk-JL6CXUMW.js → chunk-DYRZGUMA.js} +2 -2
  43. package/dist/{chunk-NDMCVUYK.js → chunk-FHEV6T4L.js} +22 -18
  44. package/dist/{chunk-4PCQCU47.js → chunk-FRLAUP2B.js} +4 -4
  45. package/dist/{chunk-RZOXUSPC.js → chunk-G5GV2Q7K.js} +2 -2
  46. package/dist/{chunk-2RLWJO5K.js → chunk-G6JKM4O7.js} +7 -7
  47. package/dist/chunk-GGYOZWHW.js +27 -0
  48. package/dist/{chunk-DC4CFXM5.js → chunk-GIRBSBGL.js} +6 -5
  49. package/dist/{chunk-PQJFG24Z.js → chunk-GMROJJRN.js} +1292 -946
  50. package/dist/{chunk-ZUUI3ZSA.js → chunk-HHR7WGCI.js} +3 -3
  51. package/dist/{chunk-TIQJPRDD.js → chunk-HKIL6DCL.js} +3 -2
  52. package/dist/{chunk-VPBIMOAQ.js → chunk-HUAM7QG3.js} +15 -13
  53. package/dist/{chunk-ZYNI26MI.js → chunk-HXFUTMX2.js} +2 -2
  54. package/dist/{chunk-W5R5SABV.js → chunk-I22THIHI.js} +12 -12
  55. package/dist/chunk-IE5D3RA5.js +58 -0
  56. package/dist/{chunk-MT6BVNFW.js → chunk-IYVYZQRL.js} +10 -16
  57. package/dist/{chunk-ARD426WI.js → chunk-JBP7KESM.js} +1 -1
  58. package/dist/{chunk-MN7MHUXQ.js → chunk-JE6HKLC7.js} +2 -2
  59. package/dist/{chunk-3MYEA7QD.js → chunk-JPRDTY5S.js} +85 -3
  60. package/dist/{chunk-CJYKEW2L.js → chunk-JYLOYTZD.js} +17 -1
  61. package/dist/{chunk-5APMQ2IJ.js → chunk-JZRP4DGP.js} +2 -2
  62. package/dist/{chunk-AMXIUN2R.js → chunk-KZ4ALBCH.js} +2 -2
  63. package/dist/{chunk-W2V54OCL.js → chunk-L3CLUGDY.js} +3 -3
  64. package/dist/{chunk-DMSLNKF7.js → chunk-L4NEVZ4T.js} +28 -27
  65. package/dist/chunk-LPYTPNOJ.js +22 -0
  66. package/dist/{chunk-BI5LAQ3Y.js → chunk-LSFXZLPW.js} +2071 -1725
  67. package/dist/{chunk-2DDDCJDL.js → chunk-MC6VB2E5.js} +4 -4
  68. package/dist/{chunk-U2SDMG7C.js → chunk-NM2NWH55.js} +5 -5
  69. package/dist/{chunk-Q4FCYCRE.js → chunk-NSPVR3FN.js} +19 -18
  70. package/dist/{chunk-VG5JS5SW.js → chunk-O2ARHQKF.js} +2 -2
  71. package/dist/{chunk-KSR7RGQY.js → chunk-O4N5BQ3T.js} +10 -10
  72. package/dist/{chunk-5ZR3APIM.js → chunk-OC7VWJBZ.js} +39 -40
  73. package/dist/chunk-OFNMHPBT.js +89 -0
  74. package/dist/{chunk-YSBHPOY6.js → chunk-OWTG6UMO.js} +21 -21
  75. package/dist/{chunk-7RQXA5GG.js → chunk-OY7WZI7Q.js} +13 -12
  76. package/dist/{chunk-5CV5ITZF.js → chunk-OZWXLJMX.js} +2 -2
  77. package/dist/{chunk-F6X3YJWD.js → chunk-PIQQM32Y.js} +2 -2
  78. package/dist/chunk-PKLB2XJL.js +8 -0
  79. package/dist/{chunk-DQXSPYRI.js → chunk-PKSUMEPT.js} +17 -4
  80. package/dist/{chunk-YISME6ON.js → chunk-PPKECBPP.js} +1 -1
  81. package/dist/{chunk-4AVZ3TG7.js → chunk-R2QQC33W.js} +14 -14
  82. package/dist/{chunk-GMTFDAOK.js → chunk-R4QWJQ2H.js} +11 -11
  83. package/dist/{chunk-V63BC55Q.js → chunk-RGGH6M34.js} +1 -1
  84. package/dist/{chunk-SJJYRZB4.js → chunk-RZG472YW.js} +116 -26
  85. package/dist/{chunk-NIU2IPC5.js → chunk-SDFKOLSF.js} +6 -6
  86. package/dist/{chunk-H7HTEQUZ.js → chunk-SFLHSL5R.js} +9 -9
  87. package/dist/{chunk-FA5LDARD.js → chunk-SP4TFY5F.js} +14 -13
  88. package/dist/{chunk-J6JP25XU.js → chunk-SQC7K3SP.js} +4 -3
  89. package/dist/{chunk-T7FTXGS3.js → chunk-T2S3FNNJ.js} +44 -42
  90. package/dist/{chunk-S67UJDGQ.js → chunk-TV6RXRYH.js} +10 -10
  91. package/dist/{chunk-GNSIWBAT.js → chunk-U3AS2FR6.js} +3 -3
  92. package/dist/{chunk-WIZWZR4C.js → chunk-UHHLR2VY.js} +43 -41
  93. package/dist/chunk-UYXV5NIS.js +20 -0
  94. package/dist/{chunk-VSFLRN5Y.js → chunk-VLQ7UKZH.js} +1 -1
  95. package/dist/{chunk-FFL3A2VP.js → chunk-VN3L2JWZ.js} +46 -72
  96. package/dist/{chunk-Z7IGUAXL.js → chunk-VOP4PJKA.js} +12 -8
  97. package/dist/{chunk-F5Z6URKM.js → chunk-VOXTCULR.js} +2 -2
  98. package/dist/{chunk-NNKXDXXS.js → chunk-VPLBLWFO.js} +14 -8
  99. package/dist/chunk-W3BGKBBK.js +27 -0
  100. package/dist/{chunk-ZKXQKGWZ.js → chunk-WC6WRNQT.js} +4 -3
  101. package/dist/{chunk-Q3UZHW6N.js → chunk-WMDUT4KH.js} +1150 -1138
  102. package/dist/{chunk-KXF5R4UN.js → chunk-WQV6BI4Q.js} +1 -1
  103. package/dist/chunk-WXUDRAG6.js +24 -0
  104. package/dist/{chunk-OLAWH5UQ.js → chunk-X35S7HSB.js} +29 -10
  105. package/dist/{chunk-YBSONGSZ.js → chunk-X66YJ2SS.js} +40 -34
  106. package/dist/{chunk-U6OC3QEM.js → chunk-XOMGO63G.js} +22 -21
  107. package/dist/{chunk-WQOIR3QY.js → chunk-XWIME22V.js} +13 -13
  108. package/dist/{chunk-3WEPUD2V.js → chunk-XYLC35E4.js} +202 -103
  109. package/dist/{chunk-UCGQT677.js → chunk-YHGYAEFH.js} +18 -18
  110. package/dist/{chunk-V3APN3DY.js → chunk-ZFORSIED.js} +13 -13
  111. package/dist/{chunk-BHUWL2Y3.js → chunk-ZKLTNLAW.js} +64 -73
  112. package/dist/chunk-ZONZ6YY3.js +74 -0
  113. package/dist/chunk-ZSM35JF4.js +30 -0
  114. package/dist/{chunk-PPIBVH4R.js → chunk-ZZDIOAAJ.js} +15 -6
  115. package/dist/index.js +8817 -6239
  116. package/dist/mcp/analyze-cli.js +10 -10
  117. package/dist/mcp/cli.js +44 -42
  118. package/dist/mcp/server.js +2236 -861
  119. package/dist/mcp/worker.js +62 -61
  120. package/dist/probes/installer.js +20 -19
  121. package/docs/adr/0003-git-guard-latch-writer.md +11 -6
  122. package/docs/agent-tools.md +29 -11
  123. package/docs/alignment-families.md +29 -0
  124. package/docs/ast-grep_rules_catalog.md +6 -4
  125. package/docs/ci-bot-pr-checks.md +126 -0
  126. package/docs/configuration.md +99 -3
  127. package/docs/defect-shapes.md +68 -11
  128. package/docs/dependencies.md +1 -0
  129. package/docs/engineering-principles.md +27 -2
  130. package/docs/environment-variables.md +14 -0
  131. package/docs/features.md +13 -3
  132. package/docs/globalconfig.md +12 -1
  133. package/docs/invariants/git-guard-host.md +38 -0
  134. package/docs/invariants/language-config.md +15 -4
  135. package/docs/invariants/lsp-trust-exec.md +22 -2
  136. package/docs/invariants/paths-os.md +4 -2
  137. package/docs/invariants/session-telemetry.md +42 -2
  138. package/docs/lsp-capability-matrix.md +208 -84
  139. package/docs/lsp-idle-eviction.md +3 -5
  140. package/docs/merge-queue-rollout.md +1 -1
  141. package/docs/pi-lens-fixer.md +31 -17
  142. package/docs/pi-lens-merge-policy.md +27 -15
  143. package/docs/pi-lens-monitor.md +9 -0
  144. package/docs/pi-lens-orchestration.md +4 -1
  145. package/docs/pi-lens-reviewer.md +5 -5
  146. package/docs/pi-lens-subagent.md +13 -7
  147. package/docs/public-api-stability.md +18 -2
  148. package/docs/schema/pi-lens-config-v1.json +33 -0
  149. package/docs/servercapabilities.md +1 -1
  150. package/docs/settings.md +15 -6
  151. package/docs/usage.md +5 -0
  152. package/docs/word-index.md +17 -5
  153. package/package.json +5 -3
  154. package/rules/ast-grep-rules/rule-tests/no-accumulating-spread-js-test.yml +37 -0
  155. package/rules/ast-grep-rules/rule-tests/ts-redundant-filter-map-test.yml +12 -1
  156. package/rules/ast-grep-rules/rule-tests-disabled/filter-then-map-js-test.yml +12 -0
  157. package/rules/ast-grep-rules/rule-tests-disabled/filter-then-map-test.yml +25 -0
  158. package/rules/ast-grep-rules/rules/no-accumulating-spread-js.yml +49 -1
  159. package/rules/ast-grep-rules/rules/ts-redundant-filter-map.yml +9 -1
  160. package/rules/ast-grep-rules/rules-disabled/filter-then-map-js.yml +17 -0
  161. package/rules/ast-grep-rules/rules-disabled/filter-then-map.yml +36 -0
  162. package/rules/ast-grep-rules/self-scan-baseline.json +1 -1
  163. package/dist/chunk-2F47TQOA.js +0 -73
  164. package/dist/chunk-2X4VLOCC.js +0 -55
  165. package/dist/chunk-4WX4CTUE.js +0 -57
  166. package/dist/chunk-FJIVKLPH.js +0 -31
  167. package/dist/chunk-G2B7F6ZU.js +0 -88
  168. package/dist/chunk-GTAI2J6U.js +0 -27
  169. package/dist/chunk-IPDG45G5.js +0 -26
  170. package/dist/chunk-P4QNXS6I.js +0 -27
  171. package/dist/chunk-Q6D6VMI4.js +0 -22
  172. package/dist/chunk-SXGD4ANG.js +0 -25
  173. package/dist/chunk-XCUHKYCQ.js +0 -23
  174. package/dist/chunk-YRD4ISED.js +0 -30
@@ -1,86 +1,88 @@
1
1
  import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
2
  import {
3
- formatToolFailure
4
- } from "./chunk-SJJYRZB4.js";
5
- import "./chunk-2X4VLOCC.js";
3
+ nestedWorktreeOffsets
4
+ } from "./chunk-KZ4ALBCH.js";
6
5
  import {
7
6
  scannerReportParentDir
8
- } from "./chunk-V63BC55Q.js";
7
+ } from "./chunk-RGGH6M34.js";
9
8
  import {
10
- nestedWorktreeOffsets
11
- } from "./chunk-AMXIUN2R.js";
9
+ formatToolFailure
10
+ } from "./chunk-RZG472YW.js";
12
11
  import {
13
12
  createAvailabilityChecker,
14
13
  findManagedNodeToolBinary,
15
14
  resolveAvailableOrInstall
16
- } from "./chunk-V3APN3DY.js";
17
- import "./chunk-XAIT2YGS.js";
18
- import "./chunk-3WEPUD2V.js";
19
- import "./chunk-JL6CXUMW.js";
20
- import "./chunk-NDMCVUYK.js";
21
- import "./chunk-PPIBVH4R.js";
22
- import "./chunk-PKES3ISE.js";
23
- import "./chunk-ZKXQKGWZ.js";
24
- import "./chunk-ZUUI3ZSA.js";
25
- import "./chunk-TIQJPRDD.js";
26
- import "./chunk-YISME6ON.js";
27
- import "./chunk-UHGF5UT5.js";
15
+ } from "./chunk-ZFORSIED.js";
16
+ import "./chunk-5F3XF3SX.js";
17
+ import "./chunk-XYLC35E4.js";
18
+ import "./chunk-DYRZGUMA.js";
19
+ import "./chunk-FHEV6T4L.js";
20
+ import "./chunk-ZZDIOAAJ.js";
21
+ import "./chunk-7ANZ7XDD.js";
22
+ import "./chunk-WC6WRNQT.js";
23
+ import "./chunk-HHR7WGCI.js";
24
+ import "./chunk-HKIL6DCL.js";
25
+ import "./chunk-PPKECBPP.js";
26
+ import "./chunk-5RNB4HVK.js";
28
27
  import "./chunk-CKEQFGLT.js";
29
- import "./chunk-CJYKEW2L.js";
30
- import "./chunk-VPBIMOAQ.js";
28
+ import "./chunk-JYLOYTZD.js";
29
+ import "./chunk-HUAM7QG3.js";
31
30
  import {
32
31
  getJscpdMaxEntriesDerived
33
- } from "./chunk-ZYNI26MI.js";
32
+ } from "./chunk-HXFUTMX2.js";
34
33
  import "./chunk-2BEMIWEW.js";
35
34
  import "./chunk-IJYGIDF4.js";
36
- import "./chunk-MKVZQUEG.js";
37
- import "./chunk-MT6BVNFW.js";
35
+ import "./chunk-BQG2QFVO.js";
36
+ import "./chunk-IYVYZQRL.js";
38
37
  import {
39
38
  findNodeToolBinary
40
- } from "./chunk-Z7IGUAXL.js";
39
+ } from "./chunk-VOP4PJKA.js";
41
40
  import {
42
41
  getIsolatedNpxSpawnOptions
43
- } from "./chunk-ARD426WI.js";
44
- import "./chunk-5APMQ2IJ.js";
45
- import "./chunk-NIU2IPC5.js";
46
- import "./chunk-BWYQUPOS.js";
47
- import "./chunk-2RLWJO5K.js";
42
+ } from "./chunk-JBP7KESM.js";
43
+ import "./chunk-UYXV5NIS.js";
44
+ import "./chunk-JZRP4DGP.js";
45
+ import "./chunk-SDFKOLSF.js";
46
+ import "./chunk-BBET6HD6.js";
47
+ import "./chunk-G6JKM4O7.js";
48
48
  import {
49
49
  shouldRecurseIntoDir,
50
50
  walkTreeStackSync
51
- } from "./chunk-VG5JS5SW.js";
51
+ } from "./chunk-O2ARHQKF.js";
52
52
  import {
53
53
  getExcludedDirGlobs,
54
54
  getProjectIgnoreGlobs,
55
55
  getProjectIgnoreMatcher,
56
56
  safeSpawnAsync
57
- } from "./chunk-Q3UZHW6N.js";
57
+ } from "./chunk-WMDUT4KH.js";
58
58
  import "./chunk-AWQWXSW4.js";
59
59
  import "./chunk-QYF5S6P6.js";
60
- import "./chunk-RZOXUSPC.js";
61
- import "./chunk-OLAWH5UQ.js";
62
- import "./chunk-J6JP25XU.js";
63
- import "./chunk-MN7MHUXQ.js";
60
+ import "./chunk-G5GV2Q7K.js";
61
+ import "./chunk-X35S7HSB.js";
62
+ import "./chunk-SQC7K3SP.js";
63
+ import "./chunk-JE6HKLC7.js";
64
64
  import {
65
65
  incrementDegradationCount
66
- } from "./chunk-ZQ6NZZTB.js";
66
+ } from "./chunk-2453RRJ2.js";
67
67
  import {
68
68
  createSubsystemLogger
69
- } from "./chunk-KXF5R4UN.js";
69
+ } from "./chunk-WQV6BI4Q.js";
70
70
  import "./chunk-S26LC76R.js";
71
- import "./chunk-Z2XAOKHK.js";
72
- import "./chunk-VSFLRN5Y.js";
71
+ import "./chunk-565VRUP4.js";
72
+ import "./chunk-VLQ7UKZH.js";
73
73
  import "./chunk-LJDODBBZ.js";
74
74
  import {
75
75
  isAtOrAboveHomeDir,
76
76
  isFullyQualified,
77
+ realpathOrResolve,
77
78
  toPosix
78
- } from "./chunk-PQJFG24Z.js";
79
+ } from "./chunk-GMROJJRN.js";
79
80
  import "./chunk-NXL4FFQQ.js";
80
81
 
81
82
  // dist/clients/jscpd-client.js
82
83
  import * as fs from "node:fs";
83
84
  import { mkdtempSync } from "node:fs";
85
+ import * as os from "node:os";
84
86
  import * as path from "node:path";
85
87
  var EMPTY_RESULT = {
86
88
  success: false,
@@ -264,7 +266,7 @@ var JscpdClient = class {
264
266
  */
265
267
  async scan(cwd, minLines = 5, minTokens = 50, isTsProject = false, options = {}) {
266
268
  const targetDir = path.resolve(cwd);
267
- if (isAtOrAboveHomeDir(targetDir, options.homeDir)) {
269
+ if (isAtOrAboveHomeDir(realpathOrResolve(targetDir), realpathOrResolve(options.homeDir ?? os.homedir()))) {
268
270
  this.log(`Refusing scan of unsafe root at/above home: ${targetDir}`);
269
271
  return { ...EMPTY_RESULT };
270
272
  }
@@ -0,0 +1,20 @@
1
+ import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
+
3
+ // dist/clients/background-write-drains.js
4
+ var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("pi-lens.background-write-drains.v1");
5
+ var host = globalThis;
6
+ function registry() {
7
+ const existing = host[REGISTRY_KEY];
8
+ if (existing instanceof Set)
9
+ return existing;
10
+ const fresh = /* @__PURE__ */ new Set();
11
+ host[REGISTRY_KEY] = fresh;
12
+ return fresh;
13
+ }
14
+ function registerBackgroundWriteDrain(drain) {
15
+ registry().add(drain);
16
+ }
17
+
18
+ export {
19
+ registerBackgroundWriteDrain
20
+ };
@@ -3,7 +3,7 @@ import {
3
3
  isUnderDir,
4
4
  normalizeFilePath,
5
5
  pathsEqual
6
- } from "./chunk-PQJFG24Z.js";
6
+ } from "./chunk-GMROJJRN.js";
7
7
 
8
8
  // dist/clients/env-utils.js
9
9
  function isTestMode() {
@@ -1,32 +1,30 @@
1
1
  import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
- import {
3
- scannerReportParentDir
4
- } from "./chunk-V63BC55Q.js";
5
2
  import {
6
3
  getSecretsLaneAllowlistPaths,
7
4
  isUnderSecretsLaneScratchTree,
8
5
  nestedWorktreeOffsets
9
- } from "./chunk-AMXIUN2R.js";
6
+ } from "./chunk-KZ4ALBCH.js";
10
7
  import {
11
8
  SecurityScanClient
12
- } from "./chunk-3MYEA7QD.js";
9
+ } from "./chunk-JPRDTY5S.js";
13
10
  import {
14
11
  collectTrackedFiles,
15
12
  collectUntrackedIgnoredIds,
16
13
  safeSpawnAsync
17
- } from "./chunk-Q3UZHW6N.js";
14
+ } from "./chunk-WMDUT4KH.js";
18
15
  import {
19
16
  escapeRegExp
20
- } from "./chunk-ZQ6NZZTB.js";
17
+ } from "./chunk-2453RRJ2.js";
21
18
  import {
22
19
  normalizeEphemeralMapKey,
23
- normalizeMapKey
24
- } from "./chunk-PQJFG24Z.js";
20
+ normalizeMapKey,
21
+ relativeInside,
22
+ walkUpDirs
23
+ } from "./chunk-GMROJJRN.js";
25
24
 
26
25
  // dist/clients/gitleaks-client.js
27
26
  import * as fs from "node:fs";
28
27
  import * as path from "node:path";
29
- import { mkdtempSync } from "node:fs";
30
28
  var EMPTY_RESULT = {
31
29
  success: false,
32
30
  findings: []
@@ -184,84 +182,60 @@ var GitleaksClient = class _GitleaksClient extends SecurityScanClient {
184
182
  }
185
183
  return this.dedupeScan(targetDir, () => this.runScan(targetDir));
186
184
  }
187
- async runScan(cwd) {
188
- const scannedAt = (/* @__PURE__ */ new Date()).toISOString();
185
+ runScan(cwd) {
189
186
  const bin = this.binaryPath ?? "gitleaks";
190
- const outDir = mkdtempSync(path.join(scannerReportParentDir(), "pi-lens-gitleaks-"));
191
- const reportPath = path.join(outDir, "gitleaks-report.json");
192
- try {
193
- const configPath = writeScopedGitleaksConfig(outDir, cwd);
194
- const result = await safeSpawnAsync(bin, [
195
- "detect",
196
- "--no-git",
197
- "--source",
198
- cwd,
199
- "--config",
200
- configPath,
201
- "--report-format",
202
- "json",
203
- "--report-path",
204
- reportPath,
205
- "--exit-code",
206
- "0",
207
- "--no-banner"
208
- ], { cwd, timeout: SCAN_TIMEOUT_MS });
209
- if (result.error) {
210
- this.log(`Scan error: ${result.error.message}`);
211
- return {
212
- ...EMPTY_RESULT,
213
- scannedAt,
214
- summary: result.error.message.slice(0, 200)
215
- };
216
- }
217
- if (!fs.existsSync(reportPath)) {
187
+ return this.runReportScan({
188
+ spawn: ({ outDir, reportPath }) => {
189
+ const configPath = writeScopedGitleaksConfig(outDir, cwd);
190
+ return safeSpawnAsync(bin, [
191
+ "detect",
192
+ "--no-git",
193
+ "--source",
194
+ cwd,
195
+ "--config",
196
+ configPath,
197
+ "--report-format",
198
+ "json",
199
+ "--report-path",
200
+ reportPath,
201
+ "--exit-code",
202
+ "0",
203
+ "--no-banner"
204
+ ], { cwd, timeout: SCAN_TIMEOUT_MS });
205
+ },
206
+ // gitleaks writes the report file even when nothing is found, so a
207
+ // missing file (the seam's no-report outcome) means the scan stopped
208
+ // before writing it.
209
+ parse: async (raw, scannedAt) => {
210
+ const rawFindings = parseGitleaksReport(raw);
211
+ const findings = await classifyAndFilterFindings(rawFindings, cwd);
218
212
  return {
219
- ...EMPTY_RESULT,
220
213
  success: true,
221
- scannedAt,
222
- summary: (result.stderr ?? "").trim().split("\n")[0] || "no report produced"
214
+ analyzed: true,
215
+ findings,
216
+ scannedAt
223
217
  };
224
- }
225
- const rawFindings = parseGitleaksReport(fs.readFileSync(reportPath, "utf-8"));
226
- const findings = await classifyAndFilterFindings(rawFindings, cwd);
227
- return {
228
- success: true,
229
- analyzed: true,
230
- findings,
231
- scannedAt
232
- };
233
- } catch (err) {
234
- return {
235
- ...EMPTY_RESULT,
236
- scannedAt,
237
- summary: err instanceof Error ? err.message.slice(0, 200) : String(err)
238
- };
239
- } finally {
240
- try {
241
- fs.rmSync(outDir, { recursive: true, force: true });
242
- } catch {
243
- }
244
- }
218
+ },
219
+ fail: (failure) => ({ ...EMPTY_RESULT, ...failure })
220
+ });
245
221
  }
246
222
  };
247
223
  function isInsideNestedGitRepository(file, cwd) {
248
224
  const root = path.resolve(cwd);
249
225
  const absoluteFile = path.isAbsolute(file) ? path.resolve(file) : path.resolve(root, file);
250
- const relative2 = path.relative(root, absoluteFile);
251
- if (relative2 === ".." || relative2.startsWith(`..${path.sep}`) || path.isAbsolute(relative2))
226
+ if (relativeInside(root, absoluteFile) === void 0)
252
227
  return false;
253
- let directory = path.dirname(absoluteFile);
254
- while (directory !== root) {
228
+ for (const directory of walkUpDirs(path.dirname(absoluteFile), {
229
+ spelling: true
230
+ })) {
231
+ if (directory === root)
232
+ return false;
255
233
  try {
256
234
  if (fs.existsSync(path.join(directory, ".git")))
257
235
  return true;
258
236
  } catch {
259
237
  return false;
260
238
  }
261
- const parent = path.dirname(directory);
262
- if (parent === directory)
263
- return false;
264
- directory = parent;
265
239
  }
266
240
  return false;
267
241
  }
@@ -2,14 +2,14 @@ import { createRequire as __pilensCreateRequire } from "node:module"; const requ
2
2
  import {
3
3
  createAvailabilityProbeFlight,
4
4
  probeToolAsync
5
- } from "./chunk-ARD426WI.js";
5
+ } from "./chunk-JBP7KESM.js";
6
6
  import {
7
7
  classifyProbeFailure,
8
8
  createAvailabilityLatch,
9
9
  isTransientDecision,
10
10
  logAvailabilityDecision,
11
11
  startHostStallSampler
12
- } from "./chunk-5APMQ2IJ.js";
12
+ } from "./chunk-JZRP4DGP.js";
13
13
  import {
14
14
  NODE_MODULES_BIN_DIRS,
15
15
  createGenerationSource,
@@ -17,21 +17,22 @@ import {
17
17
  projectLocalBinDirs,
18
18
  recordProjectCommandRefusal,
19
19
  safeSpawnAsync
20
- } from "./chunk-Q3UZHW6N.js";
20
+ } from "./chunk-WMDUT4KH.js";
21
21
  import {
22
22
  getProjectTrustState
23
- } from "./chunk-MN7MHUXQ.js";
23
+ } from "./chunk-JE6HKLC7.js";
24
24
  import {
25
25
  recordDegradationOnce
26
- } from "./chunk-ZQ6NZZTB.js";
26
+ } from "./chunk-2453RRJ2.js";
27
27
  import {
28
28
  logExtension
29
- } from "./chunk-KXF5R4UN.js";
29
+ } from "./chunk-WQV6BI4Q.js";
30
30
  import {
31
31
  isAtOrAboveHomeDir,
32
32
  isUnderDir,
33
+ realpathOrResolve,
33
34
  walkUpDirs
34
- } from "./chunk-PQJFG24Z.js";
35
+ } from "./chunk-GMROJJRN.js";
35
36
 
36
37
  // dist/clients/package-manager.js
37
38
  import * as fs from "node:fs";
@@ -316,8 +317,11 @@ function* matchesInDir(dir, names, binDirs) {
316
317
  function* localBinMatches(tools, startDir, options) {
317
318
  const { windowsExt = ".cmd", homeDir = os.homedir(), binDirs = NODE_MODULES_BIN_DIRS, isWindows = onWindows(), ceiling = true } = options;
318
319
  const names = expandCandidateNames(tools, windowsExt, isWindows);
320
+ const home = ceiling ? realpathOrResolve(homeDir) : homeDir;
321
+ let startIsReal;
319
322
  for (const dir of walkUpDirs(startDir, { spelling: true })) {
320
- if (ceiling && isAtOrAboveHomeDir(dir, homeDir))
323
+ startIsReal ??= ceiling && realpathOrResolve(dir) === dir;
324
+ if (ceiling && isAtOrAboveHomeDir(startIsReal ? dir : realpathOrResolve(dir), home))
321
325
  return;
322
326
  yield* matchesInDir(dir, names, binDirs);
323
327
  }
@@ -1,10 +1,10 @@
1
1
  import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
2
  import {
3
3
  logLatency
4
- } from "./chunk-Z2XAOKHK.js";
4
+ } from "./chunk-565VRUP4.js";
5
5
  import {
6
6
  getProcessSingleton
7
- } from "./chunk-VSFLRN5Y.js";
7
+ } from "./chunk-VLQ7UKZH.js";
8
8
 
9
9
  // dist/clients/lsp/workspace-sweep-hold.js
10
10
  var SWEEP_IDLE_SAFETY_MARGIN_MS = 6e4;
@@ -2,8 +2,10 @@ import { createRequire as __pilensCreateRequire } from "node:module"; const requ
2
2
  import {
3
3
  normalizeHostToolPath,
4
4
  normalizeMapKey,
5
+ relativeInside,
6
+ toPosix,
5
7
  walkUpDirs
6
- } from "./chunk-PQJFG24Z.js";
8
+ } from "./chunk-GMROJJRN.js";
7
9
 
8
10
  // dist/clients/content-stamp.js
9
11
  import { createHash } from "node:crypto";
@@ -15,6 +17,13 @@ function hashContentBytes(bytes) {
15
17
  function hashFileBytes(filePath) {
16
18
  return hashContentBytes(fs.readFileSync(filePath));
17
19
  }
20
+ function stampContentBytes(bytes, mtimeMs) {
21
+ return {
22
+ size: bytes.byteLength,
23
+ mtimeMs,
24
+ ...bytes.byteLength <= CONTENT_HASH_MAX_BYTES ? { sha256: hashContentBytes(bytes) } : {}
25
+ };
26
+ }
18
27
 
19
28
  // dist/clients/dispatch/runner-context.js
20
29
  import * as fs2 from "node:fs";
@@ -24,8 +33,8 @@ function resolveAgainstAncestors(cwd, filePath) {
24
33
  if (path.isAbsolute(filePath)) {
25
34
  return filePath;
26
35
  }
27
- const normalizedRelative = filePath.replace(/\\/g, "/");
28
- const cwdBaseName = path.basename(path.resolve(cwd)).replace(/\\/g, "/");
36
+ const normalizedRelative = toPosix(filePath);
37
+ const cwdBaseName = toPosix(path.basename(path.resolve(cwd)));
29
38
  if (cwdBaseName && (normalizedRelative === cwdBaseName || normalizedRelative.startsWith(`${cwdBaseName}/`))) {
30
39
  const trimmedRelative = normalizedRelative === cwdBaseName ? "" : normalizedRelative.slice(cwdBaseName.length + 1);
31
40
  const trimmedCandidate = trimmedRelative ? path.resolve(cwd, trimmedRelative) : path.resolve(cwd);
@@ -51,17 +60,14 @@ function resolveRunnerPath(cwd, filePath) {
51
60
  function toRunnerDisplayPath(cwd, filePath) {
52
61
  const cwdKey = normalizeMapKey(path.resolve(cwd));
53
62
  const fileKey = resolveRunnerPath(cwd, filePath);
54
- const relative2 = path.relative(cwdKey, fileKey).replace(/\\/g, "/");
55
- if (relative2 && relative2 !== "." && !relative2.startsWith("../")) {
56
- return relative2;
57
- }
58
- return fileKey;
63
+ return relativeInside(cwdKey, fileKey) || fileKey;
59
64
  }
60
65
 
61
66
  export {
62
67
  CONTENT_HASH_MAX_BYTES,
63
68
  hashContentBytes,
64
69
  hashFileBytes,
70
+ stampContentBytes,
65
71
  resolveRunnerPath,
66
72
  toRunnerDisplayPath
67
73
  };
@@ -0,0 +1,27 @@
1
+ import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
+ import {
3
+ GovulncheckClient,
4
+ parseGovulncheckJson
5
+ } from "./chunk-SFLHSL5R.js";
6
+ import "./chunk-JPRDTY5S.js";
7
+ import "./chunk-RGGH6M34.js";
8
+ import "./chunk-RZG472YW.js";
9
+ import "./chunk-JBP7KESM.js";
10
+ import "./chunk-JZRP4DGP.js";
11
+ import "./chunk-WMDUT4KH.js";
12
+ import "./chunk-AWQWXSW4.js";
13
+ import "./chunk-X35S7HSB.js";
14
+ import "./chunk-SQC7K3SP.js";
15
+ import "./chunk-JE6HKLC7.js";
16
+ import "./chunk-2453RRJ2.js";
17
+ import "./chunk-WQV6BI4Q.js";
18
+ import "./chunk-S26LC76R.js";
19
+ import "./chunk-565VRUP4.js";
20
+ import "./chunk-VLQ7UKZH.js";
21
+ import "./chunk-LJDODBBZ.js";
22
+ import "./chunk-GMROJJRN.js";
23
+ import "./chunk-NXL4FFQQ.js";
24
+ export {
25
+ GovulncheckClient,
26
+ parseGovulncheckJson
27
+ };
@@ -1,11 +1,12 @@
1
1
  import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
2
  import {
3
3
  logExtension
4
- } from "./chunk-KXF5R4UN.js";
4
+ } from "./chunk-WQV6BI4Q.js";
5
5
  import {
6
6
  findNearestMarkerRoot,
7
+ realpathOrResolve,
7
8
  walkUpDirs
8
- } from "./chunk-PQJFG24Z.js";
9
+ } from "./chunk-GMROJJRN.js";
9
10
 
10
11
  // dist/clients/cargo-manifest.js
11
12
  import { readFile } from "node:fs/promises";
@@ -141,7 +142,7 @@ function readWorkspacePackageEdition(content) {
141
142
  return parseTomlScalarString(workspaceSection, "edition");
142
143
  }
143
144
  async function resolveCargoPackageEdition(filePath, homeDir = os.homedir()) {
144
- const startDir = path.dirname(path.resolve(filePath));
145
+ const startDir = path.dirname(realpathOrResolve(filePath));
145
146
  const packageDir = findNearestMarkerRoot(startDir, ["Cargo.toml"], {
146
147
  homeDir
147
148
  });