pi-lens 4.4.9 → 4.4.11

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 (383) hide show
  1. package/CHANGELOG-USER.md +12 -12
  2. package/CHANGELOG.md +262 -0
  3. package/README.md +2 -0
  4. package/dist/{chunk-7YTRG6YW.js → chunk-2SD2CGVH.js} +2 -2
  5. package/dist/{chunk-CDFJF5YD.js → chunk-34RXPR7M.js} +1 -1
  6. package/dist/{chunk-XO756WE5.js → chunk-3C6ZZAB2.js} +34 -27
  7. package/dist/{chunk-MKPDIAZH.js → chunk-3HZ6MNB2.js} +1 -1
  8. package/dist/{chunk-RNXOWDM6.js → chunk-3NVGBFJS.js} +6 -6
  9. package/dist/{chunk-DGKFWQK4.js → chunk-3QCI3V6C.js} +11 -11
  10. package/dist/{chunk-NL5LSKVD.js → chunk-3R3Z54J7.js} +10 -4
  11. package/dist/{chunk-PIIUNJIT.js → chunk-43KD3PPM.js} +1 -1
  12. package/dist/{chunk-LAHHGNAY.js → chunk-4HNBY7S7.js} +20 -19
  13. package/dist/chunk-4WWPDMRA.js +22 -0
  14. package/dist/{chunk-L7O774U7.js → chunk-532X3OCZ.js} +116 -22
  15. package/dist/{chunk-ZVCDHYWZ.js → chunk-5RLEDUUE.js} +9 -9
  16. package/dist/{chunk-5YSEQHJN.js → chunk-5YTDZ5WP.js} +3 -3
  17. package/dist/{chunk-X5BJ3G2P.js → chunk-6EIV3H7O.js} +158 -61
  18. package/dist/{chunk-KV6GQOGN.js → chunk-6K4X7IIF.js} +164 -172
  19. package/dist/{chunk-HYSKJMZK.js → chunk-6RXMQYNU.js} +3 -3
  20. package/dist/{chunk-7UTSNTWM.js → chunk-6XNVY3FW.js} +10 -10
  21. package/dist/{chunk-ACRJ2GZ5.js → chunk-7424ANRU.js} +2 -2
  22. package/dist/{chunk-JUZ67QZQ.js → chunk-A4HKPAEN.js} +8 -8
  23. package/dist/{chunk-EKNYSXFB.js → chunk-AFNPNHJV.js} +8 -8
  24. package/dist/{chunk-W5E72HJA.js → chunk-AGEQRJ5A.js} +37 -11
  25. package/dist/{chunk-4ENEJHF4.js → chunk-AJ62EQIQ.js} +15 -14
  26. package/dist/{chunk-VWLSU3XV.js → chunk-AOQKQWZU.js} +14 -5
  27. package/dist/{chunk-CJS6WE66.js → chunk-AVOUHMCS.js} +111 -107
  28. package/dist/{chunk-WTB4GKMH.js → chunk-AYDE7RFV.js} +45 -5
  29. package/dist/{chunk-AWQWXSW4.js → chunk-B4FAFEBP.js} +7 -2
  30. package/dist/{chunk-SLSMJPEF.js → chunk-B4K6OSLL.js} +49 -42
  31. package/dist/{chunk-CM6BDY4E.js → chunk-BBJXIZ3X.js} +3 -3
  32. package/dist/chunk-BJDB7PXU.js +25 -0
  33. package/dist/{chunk-TOE2RRCS.js → chunk-BLL4VYGZ.js} +1 -1
  34. package/dist/{chunk-THYHUIDR.js → chunk-BMMRLJA4.js} +7 -5
  35. package/dist/{chunk-LWOM6LVS.js → chunk-BN36MQW5.js} +35 -34
  36. package/dist/{chunk-ZCQBNPRH.js → chunk-C2REOMPO.js} +2 -2
  37. package/dist/{chunk-T5QSLSMM.js → chunk-C4ICGFEO.js} +23 -23
  38. package/dist/chunk-CIA7X2PZ.js +26 -0
  39. package/dist/{chunk-VO4JFPTV.js → chunk-D5L7Q57Z.js} +2 -2
  40. package/dist/{chunk-YOXCCJDF.js → chunk-DBAHJFBU.js} +70 -64
  41. package/dist/{chunk-TMNUTMT5.js → chunk-DNB4ZQGN.js} +59 -22
  42. package/dist/chunk-DPDA3ILA.js +108 -0
  43. package/dist/{chunk-QGITU23N.js → chunk-E3PNZDPH.js} +1 -1
  44. package/dist/{chunk-QVBOXT3L.js → chunk-E6Z3CJT2.js} +13 -9
  45. package/dist/{chunk-ZDMFGACN.js → chunk-ECYUBKYX.js} +588 -566
  46. package/dist/chunk-F37CCZUA.js +27 -0
  47. package/dist/{chunk-E65WJVI5.js → chunk-FVEEEEIM.js} +10 -13
  48. package/dist/{chunk-F6BEQWAK.js → chunk-GL6J5R34.js} +5 -5
  49. package/dist/{chunk-5GEYJJHG.js → chunk-GTNO6F6K.js} +11 -10
  50. package/dist/{chunk-NMUSOZ2D.js → chunk-HASJPQBC.js} +10 -10
  51. package/dist/{chunk-XVB3Q2PG.js → chunk-HGEE5LDW.js} +3 -2
  52. package/dist/{chunk-XKFO2SZV.js → chunk-HIUVHRLM.js} +35 -34
  53. package/dist/{chunk-PRHYIA6X.js → chunk-HTUG7ZFK.js} +8 -8
  54. package/dist/{chunk-HEA3EM23.js → chunk-IBEYUBCM.js} +9 -9
  55. package/dist/{chunk-WSSLVMDA.js → chunk-IJ55MYO6.js} +15 -12
  56. package/dist/{chunk-MRLH4MYU.js → chunk-IT7MFVGP.js} +2 -2
  57. package/dist/{chunk-MQ4PPCJB.js → chunk-ITAPXBIB.js} +42 -43
  58. package/dist/{chunk-RNJFRXEN.js → chunk-JSQK5DH3.js} +4 -4
  59. package/dist/{chunk-VCRVNLE7.js → chunk-K2GV34T2.js} +9 -1
  60. package/dist/{chunk-3NPWO5UO.js → chunk-KBSC5Z3G.js} +9 -8
  61. package/dist/{chunk-PXQ45SGD.js → chunk-KDGKKK7A.js} +2 -2
  62. package/dist/{chunk-SIQHOB6P.js → chunk-KDMJ2DJD.js} +11 -11
  63. package/dist/{chunk-RTFMDIKV.js → chunk-KNP4ENFT.js} +1 -1
  64. package/dist/chunk-KX4DF6XX.js +25 -0
  65. package/dist/{chunk-ZZN74OGD.js → chunk-LHCDWFDB.js} +37 -144
  66. package/dist/{chunk-N5CEGQPG.js → chunk-LHU6NG5Z.js} +16 -15
  67. package/dist/{chunk-G22UNQID.js → chunk-LIDFFCZZ.js} +17 -15
  68. package/dist/{chunk-NOWH2VA2.js → chunk-LPM6NKVI.js} +7 -7
  69. package/dist/{chunk-KXMJLOZF.js → chunk-LXE7JAMV.js} +37 -26
  70. package/dist/{chunk-47UCC4MM.js → chunk-ME6MF2N2.js} +1 -1
  71. package/dist/{chunk-V67D6TMU.js → chunk-NLRKB32C.js} +7 -7
  72. package/dist/{chunk-2VZ3VN3N.js → chunk-NQFXN5U7.js} +2 -2
  73. package/dist/{chunk-IILEH3ZC.js → chunk-NR4KQOXZ.js} +14 -9
  74. package/dist/{chunk-UXTQ3QPD.js → chunk-NWK7KKNO.js} +4 -4
  75. package/dist/{chunk-ZMMHHXSW.js → chunk-O6LCSHHI.js} +2 -1
  76. package/dist/{chunk-ZZSJAR76.js → chunk-OC4ZGVMH.js} +33 -17
  77. package/dist/{chunk-L6WBJGQS.js → chunk-OP5BMZKK.js} +3 -3
  78. package/dist/{chunk-MN635QYA.js → chunk-OYXD2MOM.js} +3 -3
  79. package/dist/{chunk-OSEKJEUU.js → chunk-PSUXESQ5.js} +41 -4
  80. package/dist/{chunk-6GPB3JLL.js → chunk-QAM2Q3VO.js} +3 -3
  81. package/dist/{chunk-OUYAUXAT.js → chunk-QBUSONNE.js} +518 -191
  82. package/dist/{chunk-PBZNYHMM.js → chunk-QDZ3ZZMY.js} +18 -66
  83. package/dist/{chunk-LT62P654.js → chunk-QJ4T73J5.js} +1 -1
  84. package/dist/{chunk-XLAI7UYY.js → chunk-QUZYRDT6.js} +12 -12
  85. package/dist/{chunk-QP33NKYC.js → chunk-R2UF54ON.js} +17 -15
  86. package/dist/{chunk-V2WDBOLZ.js → chunk-R2VUZZPJ.js} +11 -10
  87. package/dist/chunk-R5BNSOIV.js +29 -0
  88. package/dist/chunk-RV5VX2XW.js +29 -0
  89. package/dist/{chunk-FGNSESAC.js → chunk-SQBDX6IO.js} +12 -12
  90. package/dist/{chunk-CZCAZVTD.js → chunk-SRXYSLMW.js} +2 -2
  91. package/dist/{chunk-J3Q2NYJR.js → chunk-SUIZOCSY.js} +3 -2
  92. package/dist/{chunk-NUSXS6YB.js → chunk-T5EGSBM2.js} +4 -4
  93. package/dist/{chunk-FRUBVFXV.js → chunk-TBE4OLPA.js} +37 -35
  94. package/dist/{chunk-GQTQUNCG.js → chunk-TPMBNWHO.js} +28 -26
  95. package/dist/{chunk-IICERRFF.js → chunk-TRYOYWWU.js} +18 -12
  96. package/dist/{chunk-3HTZDY3C.js → chunk-TTGDTNSN.js} +6 -6
  97. package/dist/{chunk-NCLO6E6N.js → chunk-UELHWF5I.js} +139 -135
  98. package/dist/chunk-UG4YLCJ5.js +58 -0
  99. package/dist/chunk-UQ6OZYTO.js +91 -0
  100. package/dist/{chunk-L4Y3ROKQ.js → chunk-UY3WWW5R.js} +4 -4
  101. package/dist/chunk-V7IPIAE5.js +74 -0
  102. package/dist/{chunk-C3YRO3EU.js → chunk-VDMF7Q2P.js} +10 -10
  103. package/dist/{chunk-N56BNAA6.js → chunk-VI3BJMZO.js} +35 -34
  104. package/dist/{chunk-EY6LY2HO.js → chunk-VTXJAO5R.js} +34 -35
  105. package/dist/chunk-W6VLB6LL.js +145 -0
  106. package/dist/{chunk-AACN5GNE.js → chunk-WBXCIRVI.js} +21 -2
  107. package/dist/{chunk-CB7PEVOJ.js → chunk-WLD6BGON.js} +176 -60
  108. package/dist/{chunk-ZPM7ZIFL.js → chunk-WMCAEP2K.js} +11 -8
  109. package/dist/{chunk-H3BVMK47.js → chunk-WXMUGUZV.js} +21 -25
  110. package/dist/{chunk-QB7T2PHK.js → chunk-X33QECRJ.js} +4 -2
  111. package/dist/{chunk-7R5GZIA6.js → chunk-YUF4DRYB.js} +399 -308
  112. package/dist/{chunk-HSOBIN22.js → chunk-YVPB5YGO.js} +2 -2
  113. package/dist/{chunk-W7TY6HYX.js → chunk-ZRQMENT4.js} +5 -27
  114. package/dist/index.js +6100 -4440
  115. package/dist/mcp/analyze-cli.js +17 -11
  116. package/dist/mcp/cli.js +43 -42
  117. package/dist/mcp/server.js +1534 -623
  118. package/dist/mcp/worker.js +62 -59
  119. package/dist/probes/installer.js +19 -18
  120. package/docs/agent-guide.md +5 -2
  121. package/docs/agent-tools.md +17 -4
  122. package/docs/alignment-families.md +5 -1
  123. package/docs/ci.md +120 -0
  124. package/docs/configuration.md +30 -7
  125. package/docs/custom-rules.md +1 -0
  126. package/docs/defect-shapes.md +122 -72
  127. package/docs/durable-store-audit-1202.md +1 -1
  128. package/docs/engineering-principles.md +46 -12
  129. package/docs/environment-variables.md +25 -2
  130. package/docs/features.md +12 -2
  131. package/docs/globalconfig.md +13 -0
  132. package/docs/invariants/dispatch-runners.md +13 -0
  133. package/docs/invariants/language-config.md +9 -1
  134. package/docs/language-coverage.md +67 -1
  135. package/docs/lsp-capability-matrix.md +68 -23
  136. package/docs/lsp-idle-eviction.md +17 -13
  137. package/docs/module-report-read-symbol.md +2 -2
  138. package/docs/pi-lens-fixer.md +11 -8
  139. package/docs/pi-lens-merge-policy.md +6 -1
  140. package/docs/pi-lens-monitor.md +4 -1
  141. package/docs/pi-lens-release.md +22 -2
  142. package/docs/pi-lens-reviewer.md +60 -13
  143. package/docs/public-api-stability.md +41 -6
  144. package/docs/rfcs/5138-query-surface.md +121 -0
  145. package/docs/servercapabilities.md +1 -1
  146. package/docs/settings.md +16 -4
  147. package/docs/usage.md +1 -0
  148. package/docs/word-index.md +9 -10
  149. package/package.json +4 -4
  150. package/rules/ast-grep-rules/coderabbit/README.md +2 -0
  151. package/rules/ast-grep-rules/coderabbit/rules/c/security/dont-call-system-c.yml +2 -1
  152. package/rules/ast-grep-rules/coderabbit/rules/c/security/file-access-before-action-c.yml +2 -1
  153. package/rules/ast-grep-rules/coderabbit/rules/c/security/file-stat-before-action-c.yml +2 -1
  154. package/rules/ast-grep-rules/coderabbit/rules/c/security/insecure-hash-c.yml +2 -1
  155. package/rules/ast-grep-rules/coderabbit/rules/c/security/libxml2-audit-parser-c.yml +2 -1
  156. package/rules/ast-grep-rules/coderabbit/rules/c/security/null-library-function-c.yml +2 -1
  157. package/rules/ast-grep-rules/coderabbit/rules/c/security/sizeof-this-c.yml +2 -1
  158. package/rules/ast-grep-rules/coderabbit/rules/c/security/small-key-size-c.yml +2 -1
  159. package/rules/ast-grep-rules/coderabbit/rules/c/security/world-writable-file-c.yml +2 -1
  160. package/rules/ast-grep-rules/coderabbit/rules/cpp/security/dont-call-system-cpp.yml +2 -1
  161. package/rules/ast-grep-rules/coderabbit/rules/cpp/security/file-access-before-action-cpp.yml +2 -1
  162. package/rules/ast-grep-rules/coderabbit/rules/cpp/security/file-stat-before-action-cpp.yml +2 -1
  163. package/rules/ast-grep-rules/coderabbit/rules/cpp/security/fix-format-security-error-cpp.yml +2 -1
  164. package/rules/ast-grep-rules/coderabbit/rules/cpp/security/insecure-hash-cpp.yml +2 -1
  165. package/rules/ast-grep-rules/coderabbit/rules/cpp/security/libxml2-audit-parser-cpp.yml +2 -1
  166. package/rules/ast-grep-rules/coderabbit/rules/cpp/security/missing-nul-cpp-string-memcpy-cpp.yml +2 -1
  167. package/rules/ast-grep-rules/coderabbit/rules/cpp/security/null-library-function-cpp.yml +2 -1
  168. package/rules/ast-grep-rules/coderabbit/rules/cpp/security/return-c-str-cpp.yml +2 -1
  169. package/rules/ast-grep-rules/coderabbit/rules/cpp/security/sizeof-this-cpp.yml +2 -1
  170. package/rules/ast-grep-rules/coderabbit/rules/cpp/security/small-key-size-cpp.yml +2 -1
  171. package/rules/ast-grep-rules/coderabbit/rules/cpp/security/std-return-data-cpp.yml +2 -1
  172. package/rules/ast-grep-rules/coderabbit/rules/cpp/security/std-vector-invalidation-cpp.yml +2 -1
  173. package/rules/ast-grep-rules/coderabbit/rules/cpp/security/string-view-temporary-string-cpp.yml +2 -1
  174. package/rules/ast-grep-rules/coderabbit/rules/cpp/security/world-writable-file-cpp.yml +2 -1
  175. package/rules/ast-grep-rules/coderabbit/rules/csharp/security/httponly-false-csharp.yml +2 -1
  176. package/rules/ast-grep-rules/coderabbit/rules/csharp/security/insecure-binaryformatter-deserialization-csharp.yml +2 -1
  177. package/rules/ast-grep-rules/coderabbit/rules/csharp/security/jwt-decode-without-verify-csharp.yml +2 -1
  178. package/rules/ast-grep-rules/coderabbit/rules/csharp/security/jwt-hardcoded-secret-csharp.yml +2 -1
  179. package/rules/ast-grep-rules/coderabbit/rules/csharp/security/jwt-tokenvalidationparameters-no-expiry-validation-csharp.yml +2 -1
  180. package/rules/ast-grep-rules/coderabbit/rules/csharp/security/networkcredential-hardcoded-secret-python.yml +2 -1
  181. package/rules/ast-grep-rules/coderabbit/rules/csharp/security/npgsqlconnectionstringbuilder-hardcoded-secret-csharp.yml +2 -1
  182. package/rules/ast-grep-rules/coderabbit/rules/csharp/security/oracleconnectionstringbuilder-hardcoded-secret-csharp.yml +2 -1
  183. package/rules/ast-grep-rules/coderabbit/rules/csharp/security/sqlconnectionstringbuilder-hardcoded-secret-csharp.yml +2 -1
  184. package/rules/ast-grep-rules/coderabbit/rules/csharp/security/stacktrace-disclosure-csharp.yml +2 -1
  185. package/rules/ast-grep-rules/coderabbit/rules/csharp/security/use-ecb-mode-csharp.yml +2 -1
  186. package/rules/ast-grep-rules/coderabbit/rules/go/security/avoid-bind-to-all-interfaces-go.yml +2 -1
  187. package/rules/ast-grep-rules/coderabbit/rules/go/security/gorilla-cookie-store-hardcoded-session-key-go.yml +2 -1
  188. package/rules/ast-grep-rules/coderabbit/rules/go/security/gorilla-csrf-hardcoded-auth-key-go.yml +2 -1
  189. package/rules/ast-grep-rules/coderabbit/rules/go/security/grpc-client-insecure-connection-go.yml +2 -1
  190. package/rules/ast-grep-rules/coderabbit/rules/go/security/jwt-go-none-algorithm-go.yml +2 -1
  191. package/rules/ast-grep-rules/coderabbit/rules/go/security/missing-ssl-minversion-go.yml +2 -1
  192. package/rules/ast-grep-rules/coderabbit/rules/go/security/openai-empty-secret-go.yml +2 -1
  193. package/rules/ast-grep-rules/coderabbit/rules/go/security/openai-hardcoded-secret-go.yml +2 -1
  194. package/rules/ast-grep-rules/coderabbit/rules/go/security/ssl-v3-is-insecure-go.yml +2 -1
  195. package/rules/ast-grep-rules/coderabbit/rules/go/security/tls-with-insecure-cipher-go.yml +2 -1
  196. package/rules/ast-grep-rules/coderabbit/rules/go/security/use-of-weak-rsa-key-go.yml +2 -1
  197. package/rules/ast-grep-rules/coderabbit/rules/html/security/plaintext-http-link-html.yml +2 -1
  198. package/rules/ast-grep-rules/coderabbit/rules/java/security/cbc-padding-oracle-java.yml +2 -1
  199. package/rules/ast-grep-rules/coderabbit/rules/java/security/cookie-httponly-false-java.yml +2 -1
  200. package/rules/ast-grep-rules/coderabbit/rules/java/security/cookie-missing-httponly-java.yml +2 -1
  201. package/rules/ast-grep-rules/coderabbit/rules/java/security/cookie-missing-samesite-java.yml +2 -1
  202. package/rules/ast-grep-rules/coderabbit/rules/java/security/cookie-missing-secure-flag-java.yml +2 -1
  203. package/rules/ast-grep-rules/coderabbit/rules/java/security/cookie-secure-flag-false-java.yml +2 -1
  204. package/rules/ast-grep-rules/coderabbit/rules/java/security/datanucleus-hardcoded-connection-password-java.yml +2 -1
  205. package/rules/ast-grep-rules/coderabbit/rules/java/security/des-is-deprecated-java.yml +2 -1
  206. package/rules/ast-grep-rules/coderabbit/rules/java/security/desede-is-deprecated-java.yml +2 -1
  207. package/rules/ast-grep-rules/coderabbit/rules/java/security/documentbuilderfactory-disallow-doctype-decl-false-java.yml +2 -1
  208. package/rules/ast-grep-rules/coderabbit/rules/java/security/documentbuilderfactory-external-general-entities-true-java.yml +2 -1
  209. package/rules/ast-grep-rules/coderabbit/rules/java/security/documentbuilderfactory-external-parameter-entities-true-java.yml +2 -1
  210. package/rules/ast-grep-rules/coderabbit/rules/java/security/drivermanager-hardcoded-secret-java.yml +2 -1
  211. package/rules/ast-grep-rules/coderabbit/rules/java/security/ecb-cipher-java.yml +2 -1
  212. package/rules/ast-grep-rules/coderabbit/rules/java/security/hardcoded-connection-password-java.yml +2 -1
  213. package/rules/ast-grep-rules/coderabbit/rules/java/security/hardcoded-secret-in-credentials-java.yml +2 -1
  214. package/rules/ast-grep-rules/coderabbit/rules/java/security/java-jwt-hardcoded-secret-java.yml +2 -1
  215. package/rules/ast-grep-rules/coderabbit/rules/java/security/jedis-jedisclientconfig-hardcoded-password-java.yml +2 -1
  216. package/rules/ast-grep-rules/coderabbit/rules/java/security/jedis-jedisfactory-hardcoded-password-java.yml +2 -1
  217. package/rules/ast-grep-rules/coderabbit/rules/java/security/missing-httponly-java.yml +2 -1
  218. package/rules/ast-grep-rules/coderabbit/rules/java/security/missing-secure-java.yml +2 -1
  219. package/rules/ast-grep-rules/coderabbit/rules/java/security/no-null-cipher-java.yml +2 -1
  220. package/rules/ast-grep-rules/coderabbit/rules/java/security/passwordauthentication-hardcoded-password-java.yml +2 -1
  221. package/rules/ast-grep-rules/coderabbit/rules/java/security/rsa-no-padding-java.yml +2 -1
  222. package/rules/ast-grep-rules/coderabbit/rules/java/security/simple-command-injection-direct-input-java.yml +2 -1
  223. package/rules/ast-grep-rules/coderabbit/rules/java/security/system-setproperty-hardcoded-secret-java.yml +2 -1
  224. package/rules/ast-grep-rules/coderabbit/rules/java/security/unencrypted-socket-java.yml +2 -1
  225. package/rules/ast-grep-rules/coderabbit/rules/java/security/use-of-aes-ecb-java.yml +2 -1
  226. package/rules/ast-grep-rules/coderabbit/rules/java/security/use-of-blowfish-java.yml +2 -1
  227. package/rules/ast-grep-rules/coderabbit/rules/java/security/use-of-default-aes-java.yml +2 -1
  228. package/rules/ast-grep-rules/coderabbit/rules/java/security/use-of-md5-digest-utils-java.yml +2 -1
  229. package/rules/ast-grep-rules/coderabbit/rules/java/security/use-of-md5-java.yml +2 -1
  230. package/rules/ast-grep-rules/coderabbit/rules/java/security/use-of-rc2-java.yml +2 -1
  231. package/rules/ast-grep-rules/coderabbit/rules/java/security/use-of-rc4-java.yml +2 -1
  232. package/rules/ast-grep-rules/coderabbit/rules/java/security/use-of-sha1-java.yml +2 -1
  233. package/rules/ast-grep-rules/coderabbit/rules/java/security/weak-ssl-context-java.yml +2 -1
  234. package/rules/ast-grep-rules/coderabbit/rules/javascript/security/detect-angular-sce-disabled-javascript.yml +2 -1
  235. package/rules/ast-grep-rules/coderabbit/rules/javascript/security/express-jwt-hardcoded-secret-javascript.yml +2 -1
  236. package/rules/ast-grep-rules/coderabbit/rules/javascript/security/express-session-hardcoded-secret-javascript.yml +2 -1
  237. package/rules/ast-grep-rules/coderabbit/rules/javascript/security/jwt-simple-noverify-javascript.yml +2 -1
  238. package/rules/ast-grep-rules/coderabbit/rules/javascript/security/node-rsa-weak-key-javascript.yml +2 -1
  239. package/rules/ast-grep-rules/coderabbit/rules/javascript/security/node-sequelize-empty-password-argument-javascript.yml +2 -1
  240. package/rules/ast-grep-rules/coderabbit/rules/javascript/security/node-sequelize-hardcoded-secret-argument-javascript.yml +2 -1
  241. package/rules/ast-grep-rules/coderabbit/rules/kotlin/security/des-is-deprecated-kotlin.yml +2 -1
  242. package/rules/ast-grep-rules/coderabbit/rules/kotlin/security/desede-is-deprecated-kotlin.yml +2 -1
  243. package/rules/ast-grep-rules/coderabbit/rules/kotlin/security/jwt-hardcode-kotlin.yml +2 -1
  244. package/rules/ast-grep-rules/coderabbit/rules/kotlin/security/rsa-no-padding-kotlin.yml +2 -1
  245. package/rules/ast-grep-rules/coderabbit/rules/kotlin/security/system-setproperty-hardcoded-secret-kotlin.yml +2 -1
  246. package/rules/ast-grep-rules/coderabbit/rules/php/security/openssl-cbc-static-iv-php.yml +2 -1
  247. package/rules/ast-grep-rules/coderabbit/rules/php/security/search-active-debug-php.yml +2 -1
  248. package/rules/ast-grep-rules/coderabbit/rules/python/security/avoid-mktemp-python.yml +2 -1
  249. package/rules/ast-grep-rules/coderabbit/rules/python/security/avoid_app_run_with_bad_host-python.yml +2 -1
  250. package/rules/ast-grep-rules/coderabbit/rules/python/security/debug-enabled-python.yml +2 -1
  251. package/rules/ast-grep-rules/coderabbit/rules/python/security/hashids-with-django-secret-python.yml +2 -1
  252. package/rules/ast-grep-rules/coderabbit/rules/python/security/hashids-with-flask-secret-python.yml +2 -1
  253. package/rules/ast-grep-rules/coderabbit/rules/python/security/insecure-cipher-algorithm-rc4-python.yml +2 -1
  254. package/rules/ast-grep-rules/coderabbit/rules/python/security/jwt-python-hardcoded-secret-python.yml +2 -1
  255. package/rules/ast-grep-rules/coderabbit/rules/python/security/openai-hardcoded-secret-python.yml +2 -1
  256. package/rules/ast-grep-rules/coderabbit/rules/python/security/python-cassandra-empty-password-python.yml +2 -1
  257. package/rules/ast-grep-rules/coderabbit/rules/python/security/python-cassandra-hardcoded-secret-python.yml +2 -1
  258. package/rules/ast-grep-rules/coderabbit/rules/python/security/python-couchbase-empty-password-python.yml +2 -1
  259. package/rules/ast-grep-rules/coderabbit/rules/python/security/python-couchbase-hardcoded-secret-python.yml +2 -1
  260. package/rules/ast-grep-rules/coderabbit/rules/python/security/python-elasticsearch-hardcoded-bearer-auth-python.yml +2 -1
  261. package/rules/ast-grep-rules/coderabbit/rules/python/security/python-ldap3-empty-password-python.yml +2 -1
  262. package/rules/ast-grep-rules/coderabbit/rules/python/security/python-ldap3-hardcoded-secret-python.yml +2 -1
  263. package/rules/ast-grep-rules/coderabbit/rules/python/security/python-mariadb-empty-password-python.yml +2 -1
  264. package/rules/ast-grep-rules/coderabbit/rules/python/security/python-mariadb-hardcoded-secret-python.yml +2 -1
  265. package/rules/ast-grep-rules/coderabbit/rules/python/security/python-mysql-empty-password-python.yml +2 -1
  266. package/rules/ast-grep-rules/coderabbit/rules/python/security/python-mysql-hardcoded-secret-python.yml +2 -1
  267. package/rules/ast-grep-rules/coderabbit/rules/python/security/python-mysqlclient-empty-password-python.yml +2 -1
  268. package/rules/ast-grep-rules/coderabbit/rules/python/security/python-mysqlclient-hardcoded-secret-python.yml +2 -1
  269. package/rules/ast-grep-rules/coderabbit/rules/python/security/python-neo4j-empty-password-python.yml +2 -1
  270. package/rules/ast-grep-rules/coderabbit/rules/python/security/python-neo4j-hardcoded-secret-python.yml +2 -1
  271. package/rules/ast-grep-rules/coderabbit/rules/python/security/python-peewee-mysql-empty-password-python.yml +2 -1
  272. package/rules/ast-grep-rules/coderabbit/rules/python/security/python-peewee-mysql-hardcoded-secret-python.yml +2 -1
  273. package/rules/ast-grep-rules/coderabbit/rules/python/security/python-peewee-pg-empty-password-python.yml +2 -1
  274. package/rules/ast-grep-rules/coderabbit/rules/python/security/python-peewee-pg-hardcoded-secret-python.yml +2 -1
  275. package/rules/ast-grep-rules/coderabbit/rules/python/security/python-pg8000-empty-password-python.yml +2 -1
  276. package/rules/ast-grep-rules/coderabbit/rules/python/security/python-pg8000-hardcoded-secret-python.yml +2 -1
  277. package/rules/ast-grep-rules/coderabbit/rules/python/security/python-psycopg2-empty-password-python.yml +2 -1
  278. package/rules/ast-grep-rules/coderabbit/rules/python/security/python-psycopg2-hardcoded-secret-python.yml +2 -1
  279. package/rules/ast-grep-rules/coderabbit/rules/python/security/python-pyjwt-hardcoded-secret-python.yml +2 -1
  280. package/rules/ast-grep-rules/coderabbit/rules/python/security/python-pymongo-empty-password-python.yml +2 -1
  281. package/rules/ast-grep-rules/coderabbit/rules/python/security/python-pymongo-hardcoded-secret-python.yml +2 -1
  282. package/rules/ast-grep-rules/coderabbit/rules/python/security/python-pymssql-empty-password-python.yml +2 -1
  283. package/rules/ast-grep-rules/coderabbit/rules/python/security/python-pymssql-hardcoded-secret-python.yml +2 -1
  284. package/rules/ast-grep-rules/coderabbit/rules/python/security/python-pymysql-empty-password-python.yml +2 -1
  285. package/rules/ast-grep-rules/coderabbit/rules/python/security/python-pymysql-hardcoded-secret-python.yml +2 -1
  286. package/rules/ast-grep-rules/coderabbit/rules/python/security/python-redis-empty-password-python.yml +2 -1
  287. package/rules/ast-grep-rules/coderabbit/rules/python/security/python-redis-hardcoded-secret-python.yml +2 -1
  288. package/rules/ast-grep-rules/coderabbit/rules/python/security/python-requests-empty-password-python.yml +2 -1
  289. package/rules/ast-grep-rules/coderabbit/rules/python/security/python-requests-hardcoded-secret-python.yml +2 -1
  290. package/rules/ast-grep-rules/coderabbit/rules/python/security/python-requests-oauth-hardcoded-secret-python.yml +2 -1
  291. package/rules/ast-grep-rules/coderabbit/rules/python/security/python-tormysql-empty-password-python.yml +2 -1
  292. package/rules/ast-grep-rules/coderabbit/rules/python/security/python-tormysql-hardcoded-secret-python.yml +2 -1
  293. package/rules/ast-grep-rules/coderabbit/rules/python/security/python-urllib3-hardcoded-secret-python.yml +2 -1
  294. package/rules/ast-grep-rules/coderabbit/rules/python/security/python-webrepl-empty-password-python.yml +2 -1
  295. package/rules/ast-grep-rules/coderabbit/rules/python/security/python-webrepl-hardcoded-secret-python.yml +2 -1
  296. package/rules/ast-grep-rules/coderabbit/rules/ruby/security/force-ssl-false-ruby.yml +2 -1
  297. package/rules/ast-grep-rules/coderabbit/rules/ruby/security/hardcoded-http-auth-in-controller-ruby.yml +2 -1
  298. package/rules/ast-grep-rules/coderabbit/rules/ruby/security/hardcoded-secret-rsa-passphrase-ruby.yml +2 -1
  299. package/rules/ast-grep-rules/coderabbit/rules/ruby/security/insufficient-rsa-key-size-ruby.yml +2 -1
  300. package/rules/ast-grep-rules/coderabbit/rules/ruby/security/ruby-aws-sdk-hardcoded-secret-ruby.yml +2 -1
  301. package/rules/ast-grep-rules/coderabbit/rules/ruby/security/ruby-cassandra-empty-password-ruby.yml +2 -1
  302. package/rules/ast-grep-rules/coderabbit/rules/ruby/security/ruby-cassandra-hardcoded-secret-ruby.yml +2 -1
  303. package/rules/ast-grep-rules/coderabbit/rules/ruby/security/ruby-excon-hardcoded-secret-ruby.yml +2 -1
  304. package/rules/ast-grep-rules/coderabbit/rules/ruby/security/ruby-faraday-hardcoded-secret-ruby.yml +2 -1
  305. package/rules/ast-grep-rules/coderabbit/rules/ruby/security/ruby-mongo-empty-password-ruby.yml +2 -1
  306. package/rules/ast-grep-rules/coderabbit/rules/ruby/security/ruby-mongo-hardcoded-secret-ruby.yml +2 -1
  307. package/rules/ast-grep-rules/coderabbit/rules/ruby/security/ruby-mysql2-empty-password-ruby.yml +2 -1
  308. package/rules/ast-grep-rules/coderabbit/rules/ruby/security/ruby-mysql2-hardcoded-secret-ruby.yml +2 -1
  309. package/rules/ast-grep-rules/coderabbit/rules/ruby/security/ruby-octokit-hardcoded-secret-ruby.yml +2 -1
  310. package/rules/ast-grep-rules/coderabbit/rules/ruby/security/ruby-pg-empty-password-ruby.yml +2 -1
  311. package/rules/ast-grep-rules/coderabbit/rules/ruby/security/ruby-pg-hardcoded-secret-ruby.yml +2 -1
  312. package/rules/ast-grep-rules/coderabbit/rules/ruby/security/ruby-redis-empty-password-ruby.yml +2 -1
  313. package/rules/ast-grep-rules/coderabbit/rules/ruby/security/ruby-redis-hardcoded-secret-ruby.yml +2 -1
  314. package/rules/ast-grep-rules/coderabbit/rules/rust/security/empty-password-rust.yml +2 -1
  315. package/rules/ast-grep-rules/coderabbit/rules/rust/security/hardcoded-password-rust.yml +2 -1
  316. package/rules/ast-grep-rules/coderabbit/rules/rust/security/postgres-empty-password-rust.yml +2 -1
  317. package/rules/ast-grep-rules/coderabbit/rules/rust/security/reqwest-accept-invalid-rust.yml +2 -1
  318. package/rules/ast-grep-rules/coderabbit/rules/rust/security/secrets-reqwest-hardcoded-auth-rust.yml +2 -1
  319. package/rules/ast-grep-rules/coderabbit/rules/rust/security/ssl-verify-none-rust.yml +2 -1
  320. package/rules/ast-grep-rules/coderabbit/rules/rust/security/tokio-postgres-empty-password-rust.yml +2 -1
  321. package/rules/ast-grep-rules/coderabbit/rules/rust/security/tokio-postgres-hardcoded-password-rust.yml +2 -1
  322. package/rules/ast-grep-rules/coderabbit/rules/scala/security/jwt-scala-hardcode-scala.yml +2 -1
  323. package/rules/ast-grep-rules/coderabbit/rules/scala/security/scala-jwt-hardcoded-secret-scala.yml +2 -1
  324. package/rules/ast-grep-rules/coderabbit/rules/swift/security/aes-hardcoded-secret-swift.yml +2 -1
  325. package/rules/ast-grep-rules/coderabbit/rules/swift/security/blowfish-hardcoded-secret-swift.yml +2 -1
  326. package/rules/ast-grep-rules/coderabbit/rules/swift/security/chacha20-hardcoded-secret-swift.yml +2 -1
  327. package/rules/ast-grep-rules/coderabbit/rules/swift/security/insecure-biometrics-swift.yml +2 -1
  328. package/rules/ast-grep-rules/coderabbit/rules/swift/security/rabbit-hardcoded-secret-swift.yml +2 -1
  329. package/rules/ast-grep-rules/coderabbit/rules/typescript/security/detect-angular-sce-disabled-typescript.yml +2 -1
  330. package/rules/ast-grep-rules/coderabbit/rules/typescript/security/express-session-hardcoded-secret-typescript.yml +2 -1
  331. package/rules/ast-grep-rules/coderabbit/rules/typescript/security/jwt-simple-noverify-typescript.yml +2 -1
  332. package/rules/ast-grep-rules/coderabbit/rules/typescript/security/node-rsa-weak-key-typescript.yml +2 -1
  333. package/rules/ast-grep-rules/coderabbit/rules/typescript/security/node-sequelize-empty-password-argument-typescript.yml +2 -1
  334. package/rules/ast-grep-rules/coderabbit/rules/typescript/security/node-sequelize-hardcoded-secret-argument-typescript.yml +2 -1
  335. package/rules/ast-grep-rules/rule-schema.json +1 -1
  336. package/rules/ast-grep-rules/rules/c-no-malloc-free.yml +13 -12
  337. package/rules/ast-grep-rules/rules/cpp-no-malloc-free.yml +11 -10
  338. package/rules/ast-grep-rules/rules/cpp-no-printf.yml +10 -9
  339. package/rules/ast-grep-rules/rules/go-defer-func-call-antipattern.yml +14 -13
  340. package/rules/ast-grep-rules/rules/go-no-fmt-println.yml +14 -13
  341. package/rules/ast-grep-rules/rules/go-no-panic-in-lib.yml +20 -19
  342. package/rules/ast-grep-rules/rules/go-no-underscore-func-name.yml +14 -13
  343. package/rules/ast-grep-rules/rules/go-prefer-errors-is.yml +14 -13
  344. package/rules/ast-grep-rules/rules/go-prefer-string-builder.yml +19 -18
  345. package/rules/ast-grep-rules/rules/go-test-functions.yml +14 -13
  346. package/rules/ast-grep-rules/rules/hyphenated-svg-attribute.yml +10 -9
  347. package/rules/ast-grep-rules/rules/kotlin-no-lateinit.yml +12 -11
  348. package/rules/ast-grep-rules/rules/kotlin-no-nullable-boolean.yml +11 -10
  349. package/rules/ast-grep-rules/rules/kotlin-no-println.yml +15 -14
  350. package/rules/ast-grep-rules/rules/kotlin-no-unnecessary-let.yml +10 -9
  351. package/rules/ast-grep-rules/rules/kotlin-no-unsafe-cast.yml +10 -9
  352. package/rules/ast-grep-rules/rules/kotlin-no-var.yml +11 -10
  353. package/rules/ast-grep-rules/rules/kotlin-prefer-data-class.yml +10 -9
  354. package/rules/ast-grep-rules/rules/kotlin-prefer-is-empty.yml +10 -9
  355. package/rules/ast-grep-rules/rules/no-aws-access-key-literal.yml +1 -1
  356. package/rules/ast-grep-rules/rules/no-compile-call.yml +13 -12
  357. package/rules/ast-grep-rules/rules/no-flask-secret-key-literal.yml +1 -1
  358. package/rules/ast-grep-rules/rules/no-hardcoded-password.yml +1 -1
  359. package/rules/ast-grep-rules/rules/no-marshal-load.yml +12 -11
  360. package/rules/ast-grep-rules/rules/no-python-sql-string-concat.yml +12 -11
  361. package/rules/ast-grep-rules/rules/no-requests-verify-false.yml +13 -12
  362. package/rules/ast-grep-rules/rules/no-secret-in-env-var-name.yml +1 -1
  363. package/rules/ast-grep-rules/rules/python-optional-type.yml +9 -8
  364. package/rules/ast-grep-rules/rules/reducible-list-comprehension.yml +8 -7
  365. package/rules/ast-grep-rules/rules/ruby-detect-path-traversal.yml +14 -13
  366. package/rules/ast-grep-rules/rules/ruby-symbol-to-proc-candidate.yml +8 -7
  367. package/rules/ast-grep-rules/rules/rust-no-chars-enumerate.yml +9 -8
  368. package/rules/ast-grep-rules/rules-disabled/gorm-unbounded-preload.yml +7 -6
  369. package/rules/ast-grep-rules/rules-disabled/shadow-err-variable.yml +6 -5
  370. package/scripts/analyze-pi-lens-logs.mjs +262 -3
  371. package/scripts/download-grammars.js +10 -0
  372. package/scripts/grammars.lock.json +7 -0
  373. package/scripts/lib/latency-log-phases.mjs +125 -0
  374. package/vendor/grammars/tree-sitter-groovy.wasm +0 -0
  375. package/dist/chunk-H6FLQ5NW.js +0 -28
  376. package/dist/chunk-KR5VGMVT.js +0 -25
  377. package/dist/chunk-Q6JQKWPK.js +0 -25
  378. package/dist/chunk-QJJKOHLH.js +0 -57
  379. package/dist/chunk-TGQDAG4B.js +0 -88
  380. package/dist/chunk-TYHPVE5H.js +0 -25
  381. package/dist/chunk-UAKO2M6B.js +0 -73
  382. package/dist/chunk-UC5AXW5Z.js +0 -20
  383. package/dist/chunk-UTJP6WOS.js +0 -28
@@ -12,11 +12,12 @@ note: |
12
12
  rule:
13
13
  kind: type
14
14
  regex: '^(Optional|typing\.Optional|t\.Optional)\['
15
- has_fix: false
16
- tags:
17
- - python
18
- - typing
19
- - modernization
20
- examples:
21
- bad: "value: Optional[str]"
22
- good: "value: str | None"
15
+ metadata:
16
+ has_fix: false
17
+ tags:
18
+ - python
19
+ - typing
20
+ - modernization
21
+ examples:
22
+ bad: "value: Optional[str]"
23
+ good: "value: str | None"
@@ -20,10 +20,11 @@ constraints:
20
20
  FN:
21
21
  regex: "^(any|all|sum)$"
22
22
  fix: "$FN($X for $Y in $Z)"
23
- tags:
24
- - python
25
- - performance
26
- - modernization
27
- examples:
28
- bad: "total = sum([price for price in prices])"
29
- good: "total = sum(price for price in prices)"
23
+ metadata:
24
+ tags:
25
+ - python
26
+ - performance
27
+ - modernization
28
+ examples:
29
+ bad: "total = sum([price for price in prices])"
30
+ good: "total = sum(price for price in prices)"
@@ -18,16 +18,17 @@ rule:
18
18
  - pattern: File.join($$$ARGS)
19
19
  - pattern: send_file $VAR
20
20
  fix: ""
21
- tags:
22
- - ruby
23
- - security
24
- - path-traversal
25
- - cwe-22
26
- - rails
27
- examples:
28
- bad: |
29
- Rails.root.join('uploads', params[:filename])
30
- send_file params[:file]
31
- good: |
32
- Rails.root.join('uploads', 'safe.png')
33
- send_file 'public/index.html'
21
+ metadata:
22
+ tags:
23
+ - ruby
24
+ - security
25
+ - path-traversal
26
+ - cwe-22
27
+ - rails
28
+ examples:
29
+ bad: |
30
+ Rails.root.join('uploads', params[:filename])
31
+ send_file params[:file]
32
+ good: |
33
+ Rails.root.join('uploads', 'safe.png')
34
+ send_file 'public/index.html'
@@ -16,10 +16,11 @@ constraints:
16
16
  METHOD:
17
17
  regex: '^[A-Za-z_][A-Za-z0-9_]*[?!=]?$'
18
18
  fix: "$LIST.$ITER(&:$METHOD)"
19
- tags:
20
- - ruby
21
- - style
22
- - modernization
23
- examples:
24
- bad: "names.map { |name| name.upcase }"
25
- good: "names.map(&:upcase)"
19
+ metadata:
20
+ tags:
21
+ - ruby
22
+ - style
23
+ - modernization
24
+ examples:
25
+ bad: "names.map { |name| name.upcase }"
26
+ good: "names.map(&:upcase)"
@@ -9,11 +9,12 @@ note: |
9
9
  consumer requires byte offsets.
10
10
  rule:
11
11
  pattern: $TEXT.chars().enumerate()
12
- has_fix: false
13
- tags:
14
- - rust
15
- - correctness
16
- - unicode
17
- examples:
18
- bad: "for (index, character) in text.chars().enumerate() {}"
19
- good: "for (index, character) in text.char_indices() {}"
12
+ metadata:
13
+ has_fix: false
14
+ tags:
15
+ - rust
16
+ - correctness
17
+ - unicode
18
+ examples:
19
+ bad: "for (index, character) in text.chars().enumerate() {}"
20
+ good: "for (index, character) in text.char_indices() {}"
@@ -33,9 +33,10 @@ rule:
33
33
  has:
34
34
  kind: func_literal
35
35
  stopBy: end
36
- has_fix: false
37
- tags:
38
- - go
39
- - orm
40
- - gorm
41
- - performance
36
+ metadata:
37
+ has_fix: false
38
+ tags:
39
+ - go
40
+ - orm
41
+ - gorm
42
+ - performance
@@ -31,8 +31,9 @@ rule:
31
31
  - kind: for_statement
32
32
  - kind: expression_switch_statement
33
33
  stopBy: end
34
- has_fix: false
35
- tags:
36
- - go
37
- - error-handling
38
- - limited
34
+ metadata:
35
+ has_fix: false
36
+ tags:
37
+ - go
38
+ - error-handling
39
+ - limited
@@ -20,6 +20,11 @@ import os from "node:os";
20
20
  import path from "node:path";
21
21
  import readline from "node:readline";
22
22
  import { minimatch } from "minimatch";
23
+ import {
24
+ latencyAgeMs,
25
+ latencySpanMs,
26
+ lowerRankPercentile,
27
+ } from "./lib/latency-log-phases.mjs";
23
28
 
24
29
  const DEFAULT_ROOT = path.join(os.homedir(), ".pi-lens");
25
30
  const DEFAULT_SINCE = "2d";
@@ -33,8 +38,7 @@ const DEFAULT_EXCLUDE_GLOBS = [
33
38
  const args = parseArgs(process.argv.slice(2));
34
39
  const root = path.resolve(expandHome(args.root ?? DEFAULT_ROOT));
35
40
  const since = parseSince(args.since ?? DEFAULT_SINCE);
36
- const limit =
37
- Number.parseInt(args.limit ?? `${DEFAULT_LIMIT}`, 10) || DEFAULT_LIMIT;
41
+ const limit = parseLimit(args.limit);
38
42
  const outputJson = Boolean(args.json);
39
43
  const includeArchived = Boolean(args.archived);
40
44
  const excludeGlobs = [
@@ -113,6 +117,22 @@ function parseArgs(argv) {
113
117
  return out;
114
118
  }
115
119
 
120
+ /**
121
+ * `--limit` caps each section's rows through `pushTop`, which truncates with
122
+ * `array.length = max`: a value below 1 threw `RangeError` mid-report (-1) or
123
+ * silently became the default (0). A non-numeric value keeps falling back to
124
+ * the default, as before.
125
+ */
126
+ function parseLimit(value) {
127
+ const parsed = Number.parseInt(value ?? `${DEFAULT_LIMIT}`, 10);
128
+ if (Number.isNaN(parsed)) return DEFAULT_LIMIT;
129
+ if (parsed < 1) {
130
+ console.error(`Invalid --limit value: ${value} (must be at least 1)`);
131
+ process.exit(2);
132
+ }
133
+ return parsed;
134
+ }
135
+
116
136
  function printHelp() {
117
137
  console.log(
118
138
  `Usage: node scripts/analyze-pi-lens-logs.mjs [options]\n\nOptions:\n --since <2d|24h|YYYY-MM-DD|all> Time window (default: ${DEFAULT_SINCE})\n --root <dir> pi-lens log root (default: ~/.pi-lens)\n --limit <n> Top-N rows per section (default: ${DEFAULT_LIMIT})\n --archived Include archived rotated logs too\n --json Emit machine-readable JSON\n\nThresholds:\n --startupSlowMs <n> session_start total threshold (default: ${thresholds.startupSlowMs})\n --backgroundSlowMs <n> session_start background task threshold (default: ${thresholds.backgroundSlowMs})\n --totalSlowMs <n> tool total phase threshold (default: ${thresholds.totalSlowMs})\n --runnerSlowMs <n> runner duration threshold (default: ${thresholds.runnerSlowMs})\n --cascadeGraphSlowMs <n> cascade graph build threshold (default: ${thresholds.cascadeGraphSlowMs})\n`,
@@ -221,6 +241,19 @@ function createState(files) {
221
241
  toolResults: counter(),
222
242
  phaseCounts: counter(),
223
243
  phaseTimeouts: counter(),
244
+ // #5263: every in-window `durationMs` per (tool, phase) and per runner, so
245
+ // the report answers "how long does this phase actually take" instead of
246
+ // only "how many rows crossed a fixed threshold". See
247
+ // `latencyDistribution` for the percentile method and the memory bound.
248
+ phaseDurations: new Map(),
249
+ // #5263 r2 F2: parent `total` phase rows, which sum the phases under them
250
+ // and are therefore excluded from the phase sample like `tool_result`.
251
+ phaseParentRows: 0,
252
+ runnerDurations: new Map(),
253
+ // Runner rows that record a plan decision or a placeholder instead of
254
+ // work (`skipped`, `not_registered`, `pending`), counted per runner so a
255
+ // distribution count can be reconciled against `runnerStatus`.
256
+ runnerSkipped: counter(),
224
257
  skillsResolved: counter(),
225
258
  // D1: every latency row timestamp (ms) in window, for the coverage-gap
226
259
  // scan. Sorted after all files are read.
@@ -437,6 +470,7 @@ async function analyzeLatency(files, state) {
437
470
  state.seen.inc("latency");
438
471
  trackLatencyProject(state, entry);
439
472
  trackLatencySignals(state, entry, ts);
473
+ recordLatencyDuration(state, entry);
440
474
 
441
475
  if (entry.type === "runner") {
442
476
  const status = entry.status ?? "unknown";
@@ -1427,7 +1461,11 @@ function summarizeWorkspaceSweep(entry) {
1427
1461
  if (md.perFileMs) bits.push(`perFileMs=${md.perFileMs}`);
1428
1462
  return {
1429
1463
  ts: entry.ts,
1430
- durationMs: entry.durationMs,
1464
+ // A finished sweep carries a span; a heartbeat carries its elapsed time so
1465
+ // far, an age (#5379). Both read through the one shared span-or-age rule
1466
+ // (a pre-#5379 heartbeat holds the age in `durationMs`), and this field is
1467
+ // the elapsed time either way: it is shown, never ranked as a duration.
1468
+ durationMs: latencySpanMs(entry) ?? latencyAgeMs(entry),
1431
1469
  project: projectOf(entry.filePath),
1432
1470
  filePath: shortPath(entry.filePath),
1433
1471
  message: bits.join(", "),
@@ -1859,6 +1897,168 @@ async function analyzeExtension(files, state) {
1859
1897
  }
1860
1898
  }
1861
1899
 
1900
+ /**
1901
+ * #5263: keep one duration sample per in-window latency row, so the report can
1902
+ * state a per-(tool, phase) and per-runner distribution. Rows that carry no
1903
+ * usable `durationMs` (absent, null, non-finite, or negative — a row from a
1904
+ * build that computed it wrong) are counted out rather than guessed at as 0:
1905
+ * a phantom 0 would move p50 without being a measurement. They stay in
1906
+ * `phaseCounts`, which counts rows, not milliseconds.
1907
+ *
1908
+ * Only the two row types with a duration that means work are sampled. A
1909
+ * `tool_result` row's `durationMs` is the whole hook's total, which is the sum
1910
+ * of the phases under it, so sampling it too would double-count the same
1911
+ * milliseconds into the same denominator. A parent `total` phase row is the same
1912
+ * double-count one level down (#5263 r2 F2), and is counted out instead.
1913
+ *
1914
+ * `latencySpanMs` is the one span-or-age rule (#5379, `scripts/lib/latency-log-phases.mjs`):
1915
+ * a row that carries `ageMs`, or is a legacy age line, is not a duration at all,
1916
+ * so it never enters a percentile and this script keeps no phase-name list.
1917
+ */
1918
+ function recordLatencyDuration(state, entry) {
1919
+ const ms = latencySpanMs(entry);
1920
+ if (ms === undefined || ms < 0) return;
1921
+ if (entry.type === "phase") {
1922
+ const phase = entry.phase ?? "unknown";
1923
+ const key = `${entry.toolName ?? "unknown"}:${phase}`;
1924
+ if (phase === "total") {
1925
+ state.latency.phaseParentRows += 1;
1926
+ return;
1927
+ }
1928
+ pushDurationGroup(state.latency.phaseDurations, key, ms);
1929
+ } else if (entry.type === "runner") {
1930
+ const runner = entry.runnerId ?? "unknown";
1931
+ if (!runnerRowRan(entry)) {
1932
+ state.latency.runnerSkipped.inc(runner);
1933
+ return;
1934
+ }
1935
+ pushDurationGroup(state.latency.runnerDurations, runner, ms);
1936
+ }
1937
+ }
1938
+
1939
+ function pushDurationGroup(groups, key, ms) {
1940
+ const list = groups.get(key);
1941
+ if (list) list.push(ms);
1942
+ else groups.set(key, [ms]);
1943
+ }
1944
+
1945
+ /**
1946
+ * Did this runner row measure work? The dispatcher writes `durationMs: 0`
1947
+ * beside every plan decision (`skipped`, `test_file_skipped`, `when_skipped`,
1948
+ * `not_registered` in `clients/dispatch/dispatcher.ts`), so a runner that never
1949
+ * ran would add a zero sample to its own distribution and drag p50 toward the
1950
+ * skip time. The status family is matched by suffix, not by an enumerated
1951
+ * list, so a new `<something>_skipped` status is excluded the way its siblings
1952
+ * are. A row with no status at all, or with an empty one (an older build),
1953
+ * counts as work: the suffix cannot match an empty string, so it needs no clause
1954
+ * of its own — pinned by the `status: ""` cell in
1955
+ * `tests/fixtures/analyze-logs/sample-rules/latency.log`.
1956
+ *
1957
+ * `pending` is the collect-later runner's placeholder (`durationMs: 0`, written
1958
+ * by `clients/dispatch/dispatcher.ts` before the turn-end result settles it):
1959
+ * it measures nothing, so it is non-work like the skip family and the settled
1960
+ * row alone carries the runner's time.
1961
+ */
1962
+ function runnerRowRan(entry) {
1963
+ const status = entry.status;
1964
+ if (typeof status !== "string") return true;
1965
+ return (
1966
+ !/(?:^|_)skipped$/.test(status) &&
1967
+ status !== "not_registered" &&
1968
+ status !== "pending"
1969
+ );
1970
+ }
1971
+
1972
+ /**
1973
+ * One row per group: count, the p50/p95 from `lowerRankPercentile` (the shared
1974
+ * clamped floor-rank rule in `scripts/lib/latency-log-phases.mjs`, which names
1975
+ * the method and its small-n behaviour), the group's total, and its share of the
1976
+ * family total. The report exists to rank real work for a human, so an 8.55th
1977
+ * sample would name no row anyone can go find.
1978
+ *
1979
+ * The sample is the whole group: exact rather than approximate, which is what
1980
+ * an offline forensic run wants (no histogram edges, no summary state to keep
1981
+ * in sync with a late row). The retained population is one number per in-window
1982
+ * duration row; the maintainer's ~12 MB live-plus-rotation `latency.log` held
1983
+ * 25,310 rows in its 7-day window, so this is a few MB in a process that prints
1984
+ * one report and exits. The analyzer already retains one number per row this
1985
+ * way (`latency.rowTs`, D1), so the distribution scales with the axis the
1986
+ * window already bounds rather than opening a new unbounded one.
1987
+ */
1988
+ function latencyDistribution(groups, cap, label) {
1989
+ let totalMs = 0;
1990
+ for (const durations of groups.values()) {
1991
+ for (const ms of durations) totalMs += ms;
1992
+ }
1993
+ const rows = [];
1994
+ for (const [key, durations] of groups) {
1995
+ durations.sort((a, b) => a - b);
1996
+ const groupMs = durations.reduce((acc, ms) => acc + ms, 0);
1997
+ pushTop(
1998
+ rows,
1999
+ {
2000
+ key,
2001
+ ...(label ? label(key) : {}),
2002
+ count: durations.length,
2003
+ p50Ms: lowerRankPercentile(durations, 0.5),
2004
+ p95Ms: lowerRankPercentile(durations, 0.95),
2005
+ maxMs: durations.at(-1),
2006
+ totalMs: groupMs,
2007
+ // The denominator is this family's total, so a phase's share reads as
2008
+ // "of the recorded phase spans in window" and runner time never dilutes it.
2009
+ share: totalMs > 0 ? groupMs / totalMs : 0,
2010
+ },
2011
+ cap,
2012
+ (a, b) => b.totalMs - a.totalMs || a.key.localeCompare(b.key),
2013
+ );
2014
+ }
2015
+ // `groups`/`shown` are the disclosure of the cap (#5263 r2 F3): the field run
2016
+ // read the 12-row `--limit` as the population, because the report said
2017
+ // nothing about the 122 groups it had hidden.
2018
+ return { totalMs, groups: groups.size, shown: rows.length, rows };
2019
+ }
2020
+
2021
+ /**
2022
+ * The phase block's row label. Phase rows key on `"<toolName>:<phase>"`, so the
2023
+ * split is on the FIRST colon: a phase name can hold one (a runner id does not,
2024
+ * but a future `tool:sub` phase label might), while the tool name written by
2025
+ * `logLatency` is always a bare tool name.
2026
+ */
2027
+ function phaseKeyLabel(key) {
2028
+ const at = key.indexOf(":");
2029
+ return { tool: key.slice(0, at), phase: key.slice(at + 1) };
2030
+ }
2031
+
2032
+ /**
2033
+ * The #5263 report sections. `phaseLatency` is the ranking of recorded phase
2034
+ * spans and `runnerLatency` is the per-runner distribution with its own
2035
+ * denominator.
2036
+ */
2037
+ function buildLatencyDistributions(state) {
2038
+ const phaseLatency = latencyDistribution(
2039
+ state.latency.phaseDurations,
2040
+ limit,
2041
+ phaseKeyLabel,
2042
+ );
2043
+ // Disclosed rather than silently dropped: a reader needs to know the 1,000 ms
2044
+ // they can see is not the 2,500 ms the hook path spent.
2045
+ phaseLatency.parentTotalRows = state.latency.phaseParentRows;
2046
+ const runnerLatency = latencyDistribution(
2047
+ state.latency.runnerDurations,
2048
+ limit,
2049
+ (key) => ({ runner: key }),
2050
+ );
2051
+ for (const row of runnerLatency.rows) {
2052
+ row.skippedRows = state.latency.runnerSkipped.get(row.key);
2053
+ }
2054
+ // The per-row count cannot show a runner that only ever had non-work rows
2055
+ // (it owns no group), so the section carries the whole total (#5263 C7.1).
2056
+ runnerLatency.skippedRows = state.latency.runnerSkipped
2057
+ .entries()
2058
+ .reduce((sum, [, count]) => sum + count, 0);
2059
+ return { phaseLatency, runnerLatency };
2060
+ }
2061
+
1862
2062
  function countBetween(sorted, a, b) {
1863
2063
  let n = 0;
1864
2064
  for (const value of sorted) {
@@ -2639,6 +2839,7 @@ function buildReport(state) {
2639
2839
  toolResults: state.latency.toolResults.toJSON(),
2640
2840
  phaseCounts: state.latency.phaseCounts.top(limit),
2641
2841
  phaseTimeouts: state.latency.phaseTimeouts.toJSON(),
2842
+ ...buildLatencyDistributions(state),
2642
2843
  skillsResolved: state.latency.skillsResolved.toJSON(),
2643
2844
  workspaceDiagnostics: {
2644
2845
  started: ws.started,
@@ -2891,6 +3092,43 @@ function printReport(report) {
2891
3092
  report.latency.runnerStatus,
2892
3093
  (x) => `${x.count.toString().padStart(5)} ${x.key}`,
2893
3094
  );
3095
+ const phaseDist = report.latency.phaseLatency;
3096
+ if (phaseDist?.rows?.length) {
3097
+ console.log("\nPhase latency");
3098
+ console.log(
3099
+ ` p50/p95/max (clamped floor-rank percentile) per (tool, phase), share of ${formatMs(phaseDist.totalMs)}ms summed recorded phase spans (nested spans overlap)`,
3100
+ );
3101
+ if (phaseDist.parentTotalRows) {
3102
+ console.log(
3103
+ ` ${phaseDist.parentTotalRows} parent \`total\` rows excluded (they sum the phases under them)`,
3104
+ );
3105
+ }
3106
+ for (const row of phaseDist.rows) console.log(` ${formatLatencyRow(row)}`);
3107
+ const hidden = phaseDist.groups - phaseDist.shown;
3108
+ if (hidden > 0)
3109
+ console.log(
3110
+ ` showing ${phaseDist.shown} of ${phaseDist.groups} groups (${hidden} hidden by --limit ${limit})`,
3111
+ );
3112
+ }
3113
+ const runnerDist = report.latency.runnerLatency;
3114
+ if (runnerDist?.rows?.length) {
3115
+ console.log("\nRunner latency");
3116
+ console.log(
3117
+ ` p50/p95/max (clamped floor-rank percentile) per runner, share of ${formatMs(runnerDist.totalMs)}ms runner time (skip rows excluded)`,
3118
+ );
3119
+ if (runnerDist.skippedRows) {
3120
+ console.log(
3121
+ ` ${runnerDist.skippedRows} skipped or pending rows excluded (they record a decision or a placeholder, not work)`,
3122
+ );
3123
+ }
3124
+ for (const row of runnerDist.rows)
3125
+ console.log(` ${formatLatencyRow(row)}`);
3126
+ const hidden = runnerDist.groups - runnerDist.shown;
3127
+ if (hidden > 0)
3128
+ console.log(
3129
+ ` showing ${runnerDist.shown} of ${runnerDist.groups} groups (${hidden} hidden by --limit ${limit})`,
3130
+ );
3131
+ }
2894
3132
  section(
2895
3133
  "Read-guard events",
2896
3134
  Object.entries(report.readGuard.events).map(([key, count]) => ({
@@ -3021,6 +3259,27 @@ function section(title, rows, formatter) {
3021
3259
  for (const row of rows.slice(0, limit)) console.log(` ${formatter(row)}`);
3022
3260
  }
3023
3261
 
3262
+ function formatLatencyRow(row) {
3263
+ return (
3264
+ `${String(row.count).padStart(6)} p50=${formatMs(row.p50Ms)} p95=${formatMs(row.p95Ms)} max=${formatMs(row.maxMs)}` +
3265
+ ` ${(row.share * 100).toFixed(1)}%` +
3266
+ ` ${row.key}` +
3267
+ (row.skippedRows ? ` (skipped ${row.skippedRows})` : "")
3268
+ );
3269
+ }
3270
+
3271
+ /**
3272
+ * The report is a ranking a human reads, so a duration keeps at most one
3273
+ * decimal: several producers time with `performance.now()` and write 677.82059…
3274
+ * (a 45-column number per row hides the ranking). `--json` keeps the exact
3275
+ * value; only the text rendering rounds.
3276
+ */
3277
+ function formatMs(ms) {
3278
+ return typeof ms === "number" && Number.isInteger(ms)
3279
+ ? `${ms}`
3280
+ : `${Number(ms).toFixed(1)}`;
3281
+ }
3282
+
3024
3283
  function formatExample(ex) {
3025
3284
  if (!ex) return "";
3026
3285
  const bits = [];
@@ -51,6 +51,9 @@ export const SOURCE_OVERRIDES = {
51
51
  * tree-sitter-cue: no published wasm exists — npm's `tree-sitter-cue` is a
52
52
  * native binding, the `tree-sitter-wasms` aggregator has no CUE, and upstream
53
53
  * cuts no releases — so we build it from a pinned commit (#1522).
54
+ *
55
+ * tree-sitter-groovy: no publisher ships a wasm, so dekobon v0.3.0 is built at
56
+ * its tagged commit with the pinned CLI, unpatched (#5235).
54
57
  */
55
58
  export const VENDORED_GRAMMARS = {
56
59
  "tree-sitter-cue.wasm": {
@@ -60,6 +63,13 @@ export const VENDORED_GRAMMARS = {
60
63
  buildCommand: "npx tree-sitter-cli build --wasm",
61
64
  sha256: "sha256:751f8cc8ccf72da760133e3d365562ff7bbf5b951e0b73568576fd159db7d601",
62
65
  },
66
+ "tree-sitter-groovy.wasm": {
67
+ repo: "https://github.com/dekobon/tree-sitter-groovy",
68
+ commit: "654e4c2d736571dbc512043a1dc26017c7aedc85",
69
+ license: "MIT OR Apache-2.0",
70
+ buildCommand: "npx tree-sitter-cli@0.25.10 build --wasm",
71
+ sha256: "sha256:d03e2a88789bcf02a3f6976531eadbe3f8e0328935d1c353f8a98a0813e5e9d9",
72
+ },
63
73
  };
64
74
  /** Directory the committed grammars live in, relative to the package root. */
65
75
  export const VENDORED_DIR = "vendor/grammars";
@@ -53,6 +53,13 @@
53
53
  "license": "MIT",
54
54
  "buildCommand": "npx tree-sitter-cli build --wasm",
55
55
  "sha256": "sha256:751f8cc8ccf72da760133e3d365562ff7bbf5b951e0b73568576fd159db7d601"
56
+ },
57
+ "tree-sitter-groovy.wasm": {
58
+ "repo": "https://github.com/dekobon/tree-sitter-groovy",
59
+ "commit": "654e4c2d736571dbc512043a1dc26017c7aedc85",
60
+ "license": "MIT OR Apache-2.0",
61
+ "buildCommand": "npx tree-sitter-cli@0.25.10 build --wasm",
62
+ "sha256": "sha256:d03e2a88789bcf02a3f6976531eadbe3f8e0328935d1c353f8a98a0813e5e9d9"
56
63
  }
57
64
  }
58
65
  }
@@ -93,3 +93,128 @@ export function countEntriesSince(entries, sinceIso) {
93
93
  return Number.isFinite(ts) && ts >= sinceMs;
94
94
  }).length;
95
95
  }
96
+
97
+ /**
98
+ * The p-quantile of an ascending sample by the clamped floor-rank index
99
+ * `clamp(floor(p * n), 0, n - 1)`, so `p(0)` answers the first element, `p(1)`
100
+ * the last, and every reported number is an OBSERVED sample rather than an
101
+ * interpolation between two.
102
+ *
103
+ * The exact rule matters at small n, so it is named rather than labelled
104
+ * "nearest-rank": at even n the p50 is the UPPER of the two middle samples
105
+ * (`n = 2` → the 2nd, `n = 20` → the 11th, where nearest-rank answers the 10th),
106
+ * and for every `n <= 20` the p95 index `floor(0.95 * n)` is the last index, so
107
+ * a 20-row group reports p95 equal to max and shows no tail of its own.
108
+ *
109
+ * This is the ONE implementation for both consumers of a latency-log percentile:
110
+ * the published log analyzer (`scripts/analyze-pi-lens-logs.mjs`, #5263) and the
111
+ * hot-path gate's bootstrapped CI tails (`scripts/lib/latency-stats.mjs`, #4363).
112
+ * It lives here because this module is the only percentile home in `package.json`
113
+ * `files`: `latency-stats.mjs` is dev/CI-only, so having the analyzer import it
114
+ * shipped `scripts/analyze-pi-lens-logs.mjs -> './lib/latency-stats.mjs'` →
115
+ * `NOT FOUND` in the packed tree (the `Install test` leg runs
116
+ * `scripts/check-extensions.mjs` over the installed files). The two percentile
117
+ * siblings that stay separate are different methods on purpose:
118
+ * `clients/performance-report.ts` interpolates between samples for its
119
+ * in-session p50/p99 summary, and `scripts/bench-word-index-replacement.mjs`
120
+ * uses `floor((n - 1) * p)`; folding either would change shipped numbers.
121
+ *
122
+ * @param {readonly number[]} sorted ascending sample
123
+ * @param {number} p quantile in [0, 1]
124
+ */
125
+ export function lowerRankPercentile(sorted, p) {
126
+ const at = Math.min(
127
+ sorted.length - 1,
128
+ Math.max(0, Math.floor(p * sorted.length)),
129
+ );
130
+ return sorted[at];
131
+ }
132
+
133
+ // #5379 — span versus age. A latency row's `durationMs` is a SPAN: how long the
134
+ // work the row names took. Some producers instead had a value that is an AGE
135
+ // (time since an earlier event: a document's last sync, a hold's acquisition, a
136
+ // process's start) or a partial elapsed time of work that had not finished, and
137
+ // wrote it to `durationMs` as well; every reader that ranks phases by duration
138
+ // then ranked waiting time as work (`lsp_document_drift` was 81.8% of a live
139
+ // log's phase time). Producers now write such a value to `ageMs` and no
140
+ // `durationMs`. This is the ONE rule both `clients/performance-report.ts` and
141
+ // `scripts/analyze-pi-lens-logs.mjs` read: a row is a duration only if it
142
+ // carries `durationMs` and no `ageMs`. A reader never keeps a phase-name list of
143
+ // its own; a new producer of a non-span value writes `ageMs` and every reader
144
+ // follows.
145
+
146
+ /**
147
+ * COMPAT for log lines written before #5379, which hold an age in `durationMs`
148
+ * and carry no `ageMs`. This fixed list is consulted ONLY for a line without
149
+ * `ageMs`; a line from a build that has the field never reads it. The list is
150
+ * closed on purpose: it names the producers that existed when the field was
151
+ * introduced and is never extended. A new producer of an age writes `ageMs`.
152
+ * Each name was verified against its producer, and `durationMs` was an age (or
153
+ * a partial elapsed time) on every row of the phase, never only some:
154
+ * - lsp_document_drift: now minus the document's last sync (clients/lsp/index.ts)
155
+ * - lsp_workspace_sweep_hold_force_released: the hold's age at the cap reap
156
+ * - event_loop_hold_force_released: the oldest released hold's age
157
+ * - lsp_notify_resync_deferred: the age of ANOTHER writer's outstanding write
158
+ * - lsp_notify_stall_cpu_busy: a still-outstanding write's age at a stall sample
159
+ * - lsp_workspace_diagnostics_progress: cumulative elapsed at a 10 s heartbeat
160
+ * - lsp_empty_first_publish_held: time from didOpen to the server's first publish
161
+ * - format_late_resync_chained / inband_format_late_resync /
162
+ * deferred_format_late_resync: time since the format write row began
163
+ * - host_boot: ms since process start; extension_loaded: host_boot plus eval
164
+ */
165
+ export const LEGACY_AGE_PHASES = new Set([
166
+ "lsp_document_drift",
167
+ "lsp_workspace_sweep_hold_force_released",
168
+ "event_loop_hold_force_released",
169
+ "lsp_notify_resync_deferred",
170
+ "lsp_notify_stall_cpu_busy",
171
+ "lsp_workspace_diagnostics_progress",
172
+ "lsp_empty_first_publish_held",
173
+ "format_late_resync_chained",
174
+ "inband_format_late_resync",
175
+ "deferred_format_late_resync",
176
+ "host_boot",
177
+ "extension_loaded",
178
+ ]);
179
+
180
+ function finiteMs(value) {
181
+ return typeof value === "number" && Number.isFinite(value)
182
+ ? value
183
+ : undefined;
184
+ }
185
+
186
+ /** True when the row is an age row: it carries `ageMs`, or is a legacy age line. */
187
+ function isAgeRow(entry) {
188
+ if (entry.ageMs !== undefined && entry.ageMs !== null) return true;
189
+ return entry.type === "phase" && LEGACY_AGE_PHASES.has(entry.phase);
190
+ }
191
+
192
+ /**
193
+ * The age a row carries, or undefined when it is not an age row (or its age is
194
+ * not a finite number). Reads `ageMs`; only a line without the field falls back
195
+ * to `durationMs` of a `LEGACY_AGE_PHASES` name.
196
+ *
197
+ * @param {unknown} entry a parsed latency.log row
198
+ * @returns {number | undefined}
199
+ */
200
+ export function latencyAgeMs(entry) {
201
+ if (!entry || typeof entry !== "object") return undefined;
202
+ if (!isAgeRow(entry)) return undefined;
203
+ if (entry.ageMs !== undefined && entry.ageMs !== null) {
204
+ return finiteMs(entry.ageMs);
205
+ }
206
+ return finiteMs(entry.durationMs);
207
+ }
208
+
209
+ /**
210
+ * The span a row measures, or undefined when the row is an age row or carries
211
+ * no finite `durationMs`. This is the only function a ranking reads.
212
+ *
213
+ * @param {unknown} entry a parsed latency.log row
214
+ * @returns {number | undefined}
215
+ */
216
+ export function latencySpanMs(entry) {
217
+ if (!entry || typeof entry !== "object") return undefined;
218
+ if (isAgeRow(entry)) return undefined;
219
+ return finiteMs(entry.durationMs);
220
+ }