@herbertgao/pi-extensions 2026.9.0 → 2026.9.2

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 (360) hide show
  1. package/node_modules/@czottmann/pi-automode/CHANGELOG.md +13 -1
  2. package/node_modules/@czottmann/pi-automode/README.md +20 -0
  3. package/node_modules/@czottmann/pi-automode/docs/GLOSSARY.md +1 -1
  4. package/node_modules/@czottmann/pi-automode/docs/automode-classifier-flow.md +2 -1
  5. package/node_modules/@czottmann/pi-automode/docs/defaults.md +3 -2
  6. package/node_modules/@czottmann/pi-automode/extensions/auto-mode/classifier.ts +38 -2
  7. package/node_modules/@czottmann/pi-automode/extensions/auto-mode/constants.ts +5 -3
  8. package/node_modules/@czottmann/pi-automode/extensions/auto-mode/extension.ts +11 -3
  9. package/node_modules/@czottmann/pi-automode/package.json +1 -1
  10. package/node_modules/@narumitw/pi-btw/README.md +57 -141
  11. package/node_modules/@narumitw/pi-btw/dist/index.ts +466 -41
  12. package/node_modules/@narumitw/pi-btw/dist/index.ts.map +4 -4
  13. package/node_modules/@narumitw/pi-btw/docs/workflows.md +74 -0
  14. package/node_modules/@narumitw/pi-btw/package.json +2 -1
  15. package/node_modules/@narumitw/pi-btw/src/btw.ts +15 -1
  16. package/node_modules/@narumitw/pi-btw/src/fullscreen-ui.ts +32 -2
  17. package/node_modules/@narumitw/pi-btw/src/keybindings.ts +330 -0
  18. package/node_modules/@narumitw/pi-btw/src/menu.ts +136 -19
  19. package/node_modules/@narumitw/pi-btw/src/settings.ts +32 -0
  20. package/node_modules/@narumitw/pi-btw/src/side-thread.ts +57 -5
  21. package/node_modules/@narumitw/pi-btw/src/transcript-pager.ts +52 -30
  22. package/node_modules/@pi-plugins/fast-mode/README.md +5 -3
  23. package/node_modules/@pi-plugins/fast-mode/dist/index.d.mts.map +1 -1
  24. package/node_modules/@pi-plugins/fast-mode/dist/index.mjs +20 -55
  25. package/node_modules/@pi-plugins/fast-mode/dist/index.mjs.map +1 -1
  26. package/node_modules/@pi-plugins/fast-mode/package.json +1 -1
  27. package/node_modules/pi-lens/CHANGELOG.md +1072 -0
  28. package/node_modules/pi-lens/README.md +3 -0
  29. package/node_modules/pi-lens/config/biome/core.jsonc +11 -2
  30. package/node_modules/pi-lens/config/dependency-cruiser-eager-allowlist.json +13 -1
  31. package/node_modules/pi-lens/dist/clients/actionable-warnings-logger.js +2 -9
  32. package/node_modules/pi-lens/dist/clients/actionable-warnings.js +927 -80
  33. package/node_modules/pi-lens/dist/clients/advisory-provenance.js +1 -1
  34. package/node_modules/pi-lens/dist/clients/agent-behavior-client.js +13 -4
  35. package/node_modules/pi-lens/dist/clients/ast-grep-client.js +123 -3
  36. package/node_modules/pi-lens/dist/clients/ast-grep-rule-manager.js +60 -5
  37. package/node_modules/pi-lens/dist/clients/ast-grep-tool-logger.js +2 -9
  38. package/node_modules/pi-lens/dist/clients/ast-grep-types.js +2 -0
  39. package/node_modules/pi-lens/dist/clients/bash-file-access.js +133 -3
  40. package/node_modules/pi-lens/dist/clients/biome-client.js +9 -2
  41. package/node_modules/pi-lens/dist/clients/blocker-freshness.js +14 -6
  42. package/node_modules/pi-lens/dist/clients/bootstrap.js +509 -73
  43. package/node_modules/pi-lens/dist/clients/bounded-cache.js +152 -12
  44. package/node_modules/pi-lens/dist/clients/bounded-pid-file-lock.js +1 -1
  45. package/node_modules/pi-lens/dist/clients/bounded-telemetry.js +59 -9
  46. package/node_modules/pi-lens/dist/clients/bundled-resource-health.js +113 -0
  47. package/node_modules/pi-lens/dist/clients/bus-events-logger.js +3 -11
  48. package/node_modules/pi-lens/dist/clients/cache/rule-cache.js +31 -4
  49. package/node_modules/pi-lens/dist/clients/cache-manager.js +105 -6
  50. package/node_modules/pi-lens/dist/clients/cache-observability.js +40 -19
  51. package/node_modules/pi-lens/dist/clients/cargo-manifest.js +422 -0
  52. package/node_modules/pi-lens/dist/clients/cascade-logger.js +2 -9
  53. package/node_modules/pi-lens/dist/clients/child-unref.js +1 -19
  54. package/node_modules/pi-lens/dist/clients/code-quality-warnings.js +13 -3
  55. package/node_modules/pi-lens/dist/clients/complexity-client.js +16 -5
  56. package/node_modules/pi-lens/dist/clients/config-core/deny.js +221 -0
  57. package/node_modules/pi-lens/dist/clients/config-core/index.js +50 -0
  58. package/node_modules/pi-lens/dist/clients/config-core/merge.js +357 -0
  59. package/node_modules/pi-lens/dist/clients/config-core/normalize.js +340 -0
  60. package/node_modules/pi-lens/dist/clients/config-core/process-spec.js +248 -0
  61. package/node_modules/pi-lens/dist/clients/config-core/provenance.js +164 -0
  62. package/node_modules/pi-lens/dist/clients/config-core/records.js +218 -0
  63. package/node_modules/pi-lens/dist/clients/config-core/resolve.js +125 -0
  64. package/node_modules/pi-lens/dist/clients/config-core/safe-object.js +78 -0
  65. package/node_modules/pi-lens/dist/clients/config-core/schema.js +165 -0
  66. package/node_modules/pi-lens/dist/clients/config-diagnostic-codes.js +281 -0
  67. package/node_modules/pi-lens/dist/clients/config-locations.js +160 -0
  68. package/node_modules/pi-lens/dist/clients/config-resolve.js +789 -0
  69. package/node_modules/pi-lens/dist/clients/config-schema.js +234 -0
  70. package/node_modules/pi-lens/dist/clients/config-warn.js +407 -0
  71. package/node_modules/pi-lens/dist/clients/dead-code-client.js +19 -14
  72. package/node_modules/pi-lens/dist/clients/dead-code-logger.js +2 -6
  73. package/node_modules/pi-lens/dist/clients/deadline-utils.js +178 -0
  74. package/node_modules/pi-lens/dist/clients/debug-handles.js +2 -2
  75. package/node_modules/pi-lens/dist/clients/debug-heap.js +3 -3
  76. package/node_modules/pi-lens/dist/clients/deferred-lsp-work.js +106 -0
  77. package/node_modules/pi-lens/dist/clients/degradation-ledger.js +113 -7
  78. package/node_modules/pi-lens/dist/clients/dependency-checker.js +8 -19
  79. package/node_modules/pi-lens/dist/clients/diagnostic-dispositions.js +1 -1
  80. package/node_modules/pi-lens/dist/clients/diagnostic-line-freshness.js +12 -9
  81. package/node_modules/pi-lens/dist/clients/diagnostic-logger.js +15 -5
  82. package/node_modules/pi-lens/dist/clients/dispatch/collect-later-tier.js +0 -4
  83. package/node_modules/pi-lens/dist/clients/dispatch/dispatcher.js +162 -44
  84. package/node_modules/pi-lens/dist/clients/dispatch/fact-store.js +97 -0
  85. package/node_modules/pi-lens/dist/clients/dispatch/integration.js +27 -8
  86. package/node_modules/pi-lens/dist/clients/dispatch/lazy.js +0 -6
  87. package/node_modules/pi-lens/dist/clients/dispatch/pending-runner-findings.js +1 -1
  88. package/node_modules/pi-lens/dist/clients/dispatch/plan.js +0 -3
  89. package/node_modules/pi-lens/dist/clients/dispatch/rules/high-complexity.js +2 -2
  90. package/node_modules/pi-lens/dist/clients/dispatch/rules/high-fan-out.js +1 -1
  91. package/node_modules/pi-lens/dist/clients/dispatch/runners/actionlint.js +0 -1
  92. package/node_modules/pi-lens/dist/clients/dispatch/runners/ast-grep-napi.js +383 -27
  93. package/node_modules/pi-lens/dist/clients/dispatch/runners/biome-check.js +0 -1
  94. package/node_modules/pi-lens/dist/clients/dispatch/runners/cpp-check.js +4 -1
  95. package/node_modules/pi-lens/dist/clients/dispatch/runners/credo.js +0 -1
  96. package/node_modules/pi-lens/dist/clients/dispatch/runners/cue-vet.js +0 -1
  97. package/node_modules/pi-lens/dist/clients/dispatch/runners/dart-analyze.js +0 -1
  98. package/node_modules/pi-lens/dist/clients/dispatch/runners/detekt.js +0 -1
  99. package/node_modules/pi-lens/dist/clients/dispatch/runners/dotnet-build.js +0 -1
  100. package/node_modules/pi-lens/dist/clients/dispatch/runners/elixir-check.js +0 -1
  101. package/node_modules/pi-lens/dist/clients/dispatch/runners/eslint.js +0 -1
  102. package/node_modules/pi-lens/dist/clients/dispatch/runners/fact-rules.js +0 -1
  103. package/node_modules/pi-lens/dist/clients/dispatch/runners/fish-indent.js +0 -1
  104. package/node_modules/pi-lens/dist/clients/dispatch/runners/gleam-check.js +0 -1
  105. package/node_modules/pi-lens/dist/clients/dispatch/runners/go-vet.js +1 -3
  106. package/node_modules/pi-lens/dist/clients/dispatch/runners/golangci-lint.js +0 -1
  107. package/node_modules/pi-lens/dist/clients/dispatch/runners/hadolint.js +0 -1
  108. package/node_modules/pi-lens/dist/clients/dispatch/runners/helm-lint.js +0 -1
  109. package/node_modules/pi-lens/dist/clients/dispatch/runners/helm-render.js +1 -2
  110. package/node_modules/pi-lens/dist/clients/dispatch/runners/htmlhint.js +0 -1
  111. package/node_modules/pi-lens/dist/clients/dispatch/runners/javac.js +0 -1
  112. package/node_modules/pi-lens/dist/clients/dispatch/runners/ktlint.js +0 -1
  113. package/node_modules/pi-lens/dist/clients/dispatch/runners/lsp.js +0 -1
  114. package/node_modules/pi-lens/dist/clients/dispatch/runners/markdownlint.js +0 -1
  115. package/node_modules/pi-lens/dist/clients/dispatch/runners/mypy.js +0 -1
  116. package/node_modules/pi-lens/dist/clients/dispatch/runners/oxlint.js +14 -18
  117. package/node_modules/pi-lens/dist/clients/dispatch/runners/php-lint.js +0 -1
  118. package/node_modules/pi-lens/dist/clients/dispatch/runners/phpstan.js +0 -1
  119. package/node_modules/pi-lens/dist/clients/dispatch/runners/prisma-validate.js +0 -1
  120. package/node_modules/pi-lens/dist/clients/dispatch/runners/psscriptanalyzer.js +6 -3
  121. package/node_modules/pi-lens/dist/clients/dispatch/runners/pyright.js +7 -4
  122. package/node_modules/pi-lens/dist/clients/dispatch/runners/rubocop.js +0 -1
  123. package/node_modules/pi-lens/dist/clients/dispatch/runners/ruff.js +1 -2
  124. package/node_modules/pi-lens/dist/clients/dispatch/runners/rust-clippy.js +1 -3
  125. package/node_modules/pi-lens/dist/clients/dispatch/runners/shellcheck.js +1 -2
  126. package/node_modules/pi-lens/dist/clients/dispatch/runners/shfmt.js +0 -1
  127. package/node_modules/pi-lens/dist/clients/dispatch/runners/spellcheck.js +4 -3
  128. package/node_modules/pi-lens/dist/clients/dispatch/runners/spotbugs.js +0 -1
  129. package/node_modules/pi-lens/dist/clients/dispatch/runners/sqlfluff.js +0 -1
  130. package/node_modules/pi-lens/dist/clients/dispatch/runners/stylelint.js +0 -1
  131. package/node_modules/pi-lens/dist/clients/dispatch/runners/swiftlint.js +0 -1
  132. package/node_modules/pi-lens/dist/clients/dispatch/runners/taplo.js +0 -1
  133. package/node_modules/pi-lens/dist/clients/dispatch/runners/terragrunt.js +0 -1
  134. package/node_modules/pi-lens/dist/clients/dispatch/runners/tflint.js +0 -1
  135. package/node_modules/pi-lens/dist/clients/dispatch/runners/tree-sitter.js +0 -1
  136. package/node_modules/pi-lens/dist/clients/dispatch/runners/trivy-config.js +0 -1
  137. package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/availability-policy.js +3 -0
  138. package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/diagnostic-parsers.js +3 -67
  139. package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/runner-helpers.js +194 -80
  140. package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/toolchain-availability.js +84 -15
  141. package/node_modules/pi-lens/dist/clients/dispatch/runners/utils.js +0 -21
  142. package/node_modules/pi-lens/dist/clients/dispatch/runners/vale.js +0 -1
  143. package/node_modules/pi-lens/dist/clients/dispatch/runners/yaml-rule-parser.js +2 -20
  144. package/node_modules/pi-lens/dist/clients/dispatch/runners/yamllint.js +1 -1
  145. package/node_modules/pi-lens/dist/clients/dispatch/runners/zig-check.js +0 -1
  146. package/node_modules/pi-lens/dist/clients/dispatch/utils/format-utils.js +2 -2
  147. package/node_modules/pi-lens/dist/clients/disposition-logger.js +3 -10
  148. package/node_modules/pi-lens/dist/clients/effective-config.js +403 -0
  149. package/node_modules/pi-lens/dist/clients/error-class.js +23 -0
  150. package/node_modules/pi-lens/dist/clients/event-loop-hold.js +274 -0
  151. package/node_modules/pi-lens/dist/clients/event-loop-monitor.js +2 -2
  152. package/node_modules/pi-lens/dist/clients/extension-log.js +2 -2
  153. package/node_modules/pi-lens/dist/clients/feature-hints.js +2 -1
  154. package/node_modules/pi-lens/dist/clients/file-kinds.js +1 -38
  155. package/node_modules/pi-lens/dist/clients/file-time.js +7 -2
  156. package/node_modules/pi-lens/dist/clients/file-utils.js +117 -10
  157. package/node_modules/pi-lens/dist/clients/finding-delivery-gate.js +50 -13
  158. package/node_modules/pi-lens/dist/clients/format-service.js +6 -2
  159. package/node_modules/pi-lens/dist/clients/formatters.js +385 -104
  160. package/node_modules/pi-lens/dist/clients/freshness-cadence.js +17 -0
  161. package/node_modules/pi-lens/dist/clients/generated-artifacts.js +116 -22
  162. package/node_modules/pi-lens/dist/clients/generation-guard.js +4 -9
  163. package/node_modules/pi-lens/dist/clients/git-guard.js +6 -1
  164. package/node_modules/pi-lens/dist/clients/go-client.js +39 -0
  165. package/node_modules/pi-lens/dist/clients/gradle-ktfmt-style.js +252 -0
  166. package/node_modules/pi-lens/dist/clients/grammar-source.js +3 -3
  167. package/node_modules/pi-lens/dist/clients/hashline-anchor.js +424 -0
  168. package/node_modules/pi-lens/dist/clients/hook-budgets.js +76 -0
  169. package/node_modules/pi-lens/dist/clients/host-edit-normalize.js +5 -2
  170. package/node_modules/pi-lens/dist/clients/host-ports.js +1 -1
  171. package/node_modules/pi-lens/dist/clients/installer/index.js +289 -59
  172. package/node_modules/pi-lens/dist/clients/installer/managed-tool-refresh.js +84 -18
  173. package/node_modules/pi-lens/dist/clients/instance-reaper.js +110 -236
  174. package/node_modules/pi-lens/dist/clients/instance-registry.js +6 -3
  175. package/node_modules/pi-lens/dist/clients/language-profile.js +0 -9
  176. package/node_modules/pi-lens/dist/clients/language-registry.js +599 -0
  177. package/node_modules/pi-lens/dist/clients/latency-logger.js +165 -9
  178. package/node_modules/pi-lens/dist/clients/ledger-bounds.js +34 -1
  179. package/node_modules/pi-lens/dist/clients/lens-config.js +160 -30
  180. package/node_modules/pi-lens/dist/clients/lens-engine.js +33 -41
  181. package/node_modules/pi-lens/dist/clients/lens-events.js +1 -1
  182. package/node_modules/pi-lens/dist/clients/lens-flag-registry.js +77 -6
  183. package/node_modules/pi-lens/dist/clients/lens-map.js +1 -1
  184. package/node_modules/pi-lens/dist/clients/log-cleanup.js +2 -38
  185. package/node_modules/pi-lens/dist/clients/lsp/aggregation.js +3 -1
  186. package/node_modules/pi-lens/dist/clients/lsp/client.js +172 -33
  187. package/node_modules/pi-lens/dist/clients/lsp/config.js +484 -158
  188. package/node_modules/pi-lens/dist/clients/lsp/diagnostic-binding.js +1 -1
  189. package/node_modules/pi-lens/dist/clients/lsp/document-drift.js +1 -1
  190. package/node_modules/pi-lens/dist/clients/lsp/edits.js +18 -5
  191. package/node_modules/pi-lens/dist/clients/lsp/index.js +892 -96
  192. package/node_modules/pi-lens/dist/clients/lsp/inferred-project.js +1 -1
  193. package/node_modules/pi-lens/dist/clients/lsp/language.js +18 -177
  194. package/node_modules/pi-lens/dist/clients/lsp/launch.js +2 -1
  195. package/node_modules/pi-lens/dist/clients/lsp/path-utils.js +1 -1
  196. package/node_modules/pi-lens/dist/clients/lsp/pending-aux-coverage.js +5 -18
  197. package/node_modules/pi-lens/dist/clients/lsp/server.js +284 -147
  198. package/node_modules/pi-lens/dist/clients/lsp/session-roots.js +116 -23
  199. package/node_modules/pi-lens/dist/clients/lsp/spawn-history.js +2 -7
  200. package/node_modules/pi-lens/dist/clients/lsp/sync-kind.js +0 -1
  201. package/node_modules/pi-lens/dist/clients/lsp/tsserver-sync.js +14 -7
  202. package/node_modules/pi-lens/dist/clients/lsp/wait-policy/classification.js +6 -0
  203. package/node_modules/pi-lens/dist/clients/lsp/wait-policy/strategies.js +2 -1
  204. package/node_modules/pi-lens/dist/clients/lsp/workspace-diagnostics-cache.js +1 -1
  205. package/node_modules/pi-lens/dist/clients/lsp-document-symbols.js +1 -1
  206. package/node_modules/pi-lens/dist/clients/lsp-mutation.js +163 -21
  207. package/node_modules/pi-lens/dist/clients/map-with-concurrency.js +36 -0
  208. package/node_modules/pi-lens/dist/clients/mcp/analyze.js +33 -4
  209. package/node_modules/pi-lens/dist/clients/mcp/session.js +5 -16
  210. package/node_modules/pi-lens/dist/clients/memory-sampler.js +8 -3
  211. package/node_modules/pi-lens/dist/clients/metrics-history.js +28 -107
  212. package/node_modules/pi-lens/dist/clients/middle-man-analysis.js +3 -5
  213. package/node_modules/pi-lens/dist/clients/module-report.js +21 -46
  214. package/node_modules/pi-lens/dist/clients/mutating-tool.js +651 -0
  215. package/node_modules/pi-lens/dist/clients/mutation-attribution.js +368 -0
  216. package/node_modules/pi-lens/dist/clients/mutation-bridge.js +240 -0
  217. package/node_modules/pi-lens/dist/clients/ndjson-logger.js +247 -24
  218. package/node_modules/pi-lens/dist/clients/observed-mutation-sources.js +101 -0
  219. package/node_modules/pi-lens/dist/clients/observed-mutation.js +1215 -0
  220. package/node_modules/pi-lens/dist/clients/opaque-mutation-scan.js +70 -28
  221. package/node_modules/pi-lens/dist/clients/opengrep-config.js +5 -1
  222. package/node_modules/pi-lens/dist/clients/package-manager.js +195 -26
  223. package/node_modules/pi-lens/dist/clients/partial-edit-apply.js +359 -80
  224. package/node_modules/pi-lens/dist/clients/path-attribution-telemetry.js +23 -7
  225. package/node_modules/pi-lens/dist/clients/path-keyed-map.js +21 -2
  226. package/node_modules/pi-lens/dist/clients/path-utils.js +451 -15
  227. package/node_modules/pi-lens/dist/clients/performance-report.js +2 -2
  228. package/node_modules/pi-lens/dist/clients/persist-debounce.js +8 -1
  229. package/node_modules/pi-lens/dist/clients/php-cs-fixer-config.js +114 -0
  230. package/node_modules/pi-lens/dist/clients/pipeline.js +79 -18
  231. package/node_modules/pi-lens/dist/clients/probe-home-state.js +228 -0
  232. package/node_modules/pi-lens/dist/clients/process-bridge.js +66 -0
  233. package/node_modules/pi-lens/dist/clients/process-snapshot.js +68 -0
  234. package/node_modules/pi-lens/dist/clients/project-changes.js +1 -1
  235. package/node_modules/pi-lens/dist/clients/project-diagnostics/extractors.js +1 -1
  236. package/node_modules/pi-lens/dist/clients/project-diagnostics/fresh-fetch.js +4 -3
  237. package/node_modules/pi-lens/dist/clients/project-diagnostics/runner-adapters/jscpd.js +1 -1
  238. package/node_modules/pi-lens/dist/clients/project-diagnostics/runner-adapters/knip.js +1 -1
  239. package/node_modules/pi-lens/dist/clients/project-diagnostics/runner-adapters/madge.js +1 -1
  240. package/node_modules/pi-lens/dist/clients/project-diagnostics/runner-adapters/opengrep.js +1 -1
  241. package/node_modules/pi-lens/dist/clients/project-diagnostics/runner-adapters/runner-findings.js +28 -4
  242. package/node_modules/pi-lens/dist/clients/project-diagnostics/scanner.js +51 -20
  243. package/node_modules/pi-lens/dist/clients/project-lens-config.js +438 -122
  244. package/node_modules/pi-lens/dist/clients/project-scan-policy.js +3 -51
  245. package/node_modules/pi-lens/dist/clients/project-snapshot.js +52 -24
  246. package/node_modules/pi-lens/dist/clients/python-environment.js +217 -0
  247. package/node_modules/pi-lens/dist/clients/python-provenance.js +639 -0
  248. package/node_modules/pi-lens/dist/clients/quiet-window.js +6 -1
  249. package/node_modules/pi-lens/dist/clients/read-bridge.js +13 -21
  250. package/node_modules/pi-lens/dist/clients/read-expansion.js +9 -46
  251. package/node_modules/pi-lens/dist/clients/read-guard-logger.js +16 -5
  252. package/node_modules/pi-lens/dist/clients/read-guard-tool-lines.js +364 -212
  253. package/node_modules/pi-lens/dist/clients/read-guard.js +26 -2
  254. package/node_modules/pi-lens/dist/clients/recent-touches.js +2 -2
  255. package/node_modules/pi-lens/dist/clients/resource-sampler.js +195 -96
  256. package/node_modules/pi-lens/dist/clients/review-graph/builder.js +155 -114
  257. package/node_modules/pi-lens/dist/clients/review-graph/import-resolvers.js +1 -1
  258. package/node_modules/pi-lens/dist/clients/review-graph/service.js +55 -3
  259. package/node_modules/pi-lens/dist/clients/review-graph/shared-extraction-ir.js +7 -15
  260. package/node_modules/pi-lens/dist/clients/review-graph/workspace-modules.js +10 -74
  261. package/node_modules/pi-lens/dist/clients/review-graph-logger.js +9 -3
  262. package/node_modules/pi-lens/dist/clients/runtime-agent-end.js +19 -3
  263. package/node_modules/pi-lens/dist/clients/runtime-context.js +49 -16
  264. package/node_modules/pi-lens/dist/clients/runtime-coordinator.js +25 -6
  265. package/node_modules/pi-lens/dist/clients/runtime-session.js +184 -32
  266. package/node_modules/pi-lens/dist/clients/runtime-tool-call.js +179 -36
  267. package/node_modules/pi-lens/dist/clients/runtime-tool-result.js +797 -243
  268. package/node_modules/pi-lens/dist/clients/runtime-turn.js +1028 -53
  269. package/node_modules/pi-lens/dist/clients/rust-client.js +31 -0
  270. package/node_modules/pi-lens/dist/clients/safe-spawn.js +33 -10
  271. package/node_modules/pi-lens/dist/clients/sanitize.js +7 -12
  272. package/node_modules/pi-lens/dist/clients/scan-utils.js +1 -56
  273. package/node_modules/pi-lens/dist/clients/scratch-tree-policy.js +1 -3
  274. package/node_modules/pi-lens/dist/clients/security-scan-client.js +3 -0
  275. package/node_modules/pi-lens/dist/clients/session-lifecycle.js +1 -1
  276. package/node_modules/pi-lens/dist/clients/session-start-observability.js +79 -0
  277. package/node_modules/pi-lens/dist/clients/session-summary.js +0 -24
  278. package/node_modules/pi-lens/dist/clients/sessionstart-logger.js +12 -3
  279. package/node_modules/pi-lens/dist/clients/sgconfig.js +7 -6
  280. package/node_modules/pi-lens/dist/clients/shared-checkout-guard.js +1 -1
  281. package/node_modules/pi-lens/dist/clients/skills-resolver.js +105 -0
  282. package/node_modules/pi-lens/dist/clients/smells-rollup.js +4 -4
  283. package/node_modules/pi-lens/dist/clients/startup-scan.js +2 -10
  284. package/node_modules/pi-lens/dist/clients/string-utils.js +13 -0
  285. package/node_modules/pi-lens/dist/clients/subagent-mode.js +17 -4
  286. package/node_modules/pi-lens/dist/clients/test-runner-client.js +176 -39
  287. package/node_modules/pi-lens/dist/clients/test-runner-delivery.js +244 -0
  288. package/node_modules/pi-lens/dist/clients/tool-definition.js +41 -1
  289. package/node_modules/pi-lens/dist/clients/tool-policy.js +92 -22
  290. package/node_modules/pi-lens/dist/clients/tree-sitter-cache.js +40 -40
  291. package/node_modules/pi-lens/dist/clients/tree-sitter-client.js +87 -100
  292. package/node_modules/pi-lens/dist/clients/tree-sitter-logger.js +2 -2
  293. package/node_modules/pi-lens/dist/clients/tree-sitter-query-loader.js +81 -1
  294. package/node_modules/pi-lens/dist/clients/tree-sitter-shared.js +51 -46
  295. package/node_modules/pi-lens/dist/clients/tree-sitter-symbol-extractor.js +28 -0
  296. package/node_modules/pi-lens/dist/clients/tui-fit.js +0 -4
  297. package/node_modules/pi-lens/dist/clients/typos-config.js +5 -0
  298. package/node_modules/pi-lens/dist/clients/user-notify.js +6 -6
  299. package/node_modules/pi-lens/dist/clients/widget-state.js +191 -26
  300. package/node_modules/pi-lens/dist/clients/word-index-logger.js +2 -9
  301. package/node_modules/pi-lens/dist/clients/word-index-store.js +23 -12
  302. package/node_modules/pi-lens/dist/clients/word-index.js +252 -47
  303. package/node_modules/pi-lens/dist/clients/workspace-topology.js +8 -1
  304. package/node_modules/pi-lens/dist/clients/zizmor-config.js +4 -1
  305. package/node_modules/pi-lens/dist/index.js +65899 -55340
  306. package/node_modules/pi-lens/dist/mcp/analyze-cli.js +3 -1
  307. package/node_modules/pi-lens/dist/mcp/build-staleness.js +1 -1
  308. package/node_modules/pi-lens/dist/mcp/server.js +127 -5
  309. package/node_modules/pi-lens/dist/scripts/lib/process-scan.mjs +583 -0
  310. package/node_modules/pi-lens/dist/scripts/lib/skills-predicate.mjs +129 -0
  311. package/node_modules/pi-lens/dist/tools/effective-config.js +89 -0
  312. package/node_modules/pi-lens/dist/tools/lens-diagnostics.js +96 -25
  313. package/node_modules/pi-lens/dist/tools/lsp-diagnostics.js +104 -86
  314. package/node_modules/pi-lens/dist/tools/lsp-navigation.js +37 -16
  315. package/node_modules/pi-lens/dist/tools/lsp-structured-output.js +3 -3
  316. package/node_modules/pi-lens/dist/tools/render-compact.js +1 -1
  317. package/node_modules/pi-lens/dist/tools/shared.js +0 -1
  318. package/node_modules/pi-lens/dist/tools/symbol-search.js +1 -2
  319. package/node_modules/pi-lens/docs/agent-guide.md +64 -1
  320. package/node_modules/pi-lens/docs/configuration.md +222 -0
  321. package/node_modules/pi-lens/docs/dependencies.md +3 -3
  322. package/node_modules/pi-lens/docs/features.md +44 -5
  323. package/node_modules/pi-lens/docs/globalconfig.md +20 -0
  324. package/node_modules/pi-lens/docs/language-coverage.md +2 -2
  325. package/node_modules/pi-lens/docs/lsp-capability-matrix.md +9 -1
  326. package/node_modules/pi-lens/docs/pi-lens-fixer.md +25 -0
  327. package/node_modules/pi-lens/docs/pi-lens-investigator.md +25 -0
  328. package/node_modules/pi-lens/docs/pi-lens-reviewer.md +33 -0
  329. package/node_modules/pi-lens/docs/pi-lens-subagent.md +49 -0
  330. package/node_modules/pi-lens/docs/pi-lens-warden.md +55 -0
  331. package/node_modules/pi-lens/docs/public-api-stability.md +359 -0
  332. package/node_modules/pi-lens/docs/release-qa-baseline.md +190 -0
  333. package/node_modules/pi-lens/docs/servercapabilities.md +7 -3
  334. package/node_modules/pi-lens/docs/subagent-compat.md +110 -30
  335. package/node_modules/pi-lens/docs/tree-sitter_rules_catalog.md +2 -2
  336. package/node_modules/pi-lens/docs/word-index.md +1 -1
  337. package/node_modules/pi-lens/package.json +18 -35
  338. package/node_modules/pi-lens/rules/tree-sitter-queries/python/python-cross-language-method.yml +3 -3
  339. package/node_modules/pi-lens/rules/tree-sitter-queries/python/python-hallucinated-import.yml +2 -2
  340. package/node_modules/pi-lens/rules/tree-sitter-queries/python/python-sql-injection.yml +12 -2
  341. package/node_modules/pi-lens/rules/typos/_typos.toml +4 -2
  342. package/node_modules/pi-lens/scripts/analyze-pi-lens-logs.mjs +192 -1
  343. package/node_modules/pi-lens/scripts/install-selftest.mjs +58 -2
  344. package/node_modules/pi-lens/scripts/lib/skills-predicate.mjs +129 -0
  345. package/node_modules/pi-lens/scripts/lib/warm-loader-cache.mjs +1 -1
  346. package/node_modules/pi-lens/scripts/rpc-load-check.mjs +3 -1
  347. package/node_modules/pi-lens/scripts/warm-loader-cache.mjs +4 -2
  348. package/node_modules/pi-web-access/CHANGELOG.md +28 -0
  349. package/node_modules/pi-web-access/README.md +62 -15
  350. package/node_modules/pi-web-access/curator-page.ts +3 -1
  351. package/node_modules/pi-web-access/curator-server.ts +5 -1
  352. package/node_modules/pi-web-access/gemini-search.ts +8 -4
  353. package/node_modules/pi-web-access/github-extract.ts +242 -1
  354. package/node_modules/pi-web-access/index.ts +118 -64
  355. package/node_modules/pi-web-access/mistral-search.ts +281 -0
  356. package/node_modules/pi-web-access/package.json +2 -2
  357. package/node_modules/pi-web-access/perplexity.ts +14 -1
  358. package/node_modules/pi-web-access/utils.ts +23 -6
  359. package/node_modules/pi-web-access/xai-search.ts +96 -33
  360. package/package.json +6 -6
@@ -0,0 +1,165 @@
1
+ /**
2
+ * The schema representation the config core reads (#2425).
3
+ *
4
+ * A schema here is a PLAIN JSON-Schema-shaped object, not a compiled validator
5
+ * object and not a TypeBox/Zod value. That is a deliberate constraint, not
6
+ * laziness: #2416 publishes the same object as `docs/schema/pi-lens-config-v1.json`
7
+ * and its drift test compares the published artifact against the object the
8
+ * runtime validates with. Two representations would need a compiler between
9
+ * them, and a compiler is exactly the place drift hides.
10
+ *
11
+ * Three pi-lens annotations extend the vocabulary, all `x-`-prefixed so a
12
+ * standard JSON Schema validator ignores them:
13
+ *
14
+ * - `x-stability` — the #2418 tier every published property carries. Owned by
15
+ * `clients/config-diagnostic-codes.ts`; re-exported here only as the key, so
16
+ * a schema author has one import.
17
+ * - `x-merge-strategy` — how an ARRAY node combines across tiers. Objects are
18
+ * always merged field-wise, so the annotation is meaningless on them.
19
+ * - `x-deny` — the node carries a denial, and `deny.ts` gives it monotonic
20
+ * precedence instead of last-tier-wins.
21
+ *
22
+ * Pure accessors only. Nothing here reads a file, and nothing holds state.
23
+ */
24
+ /** Narrows to the recursive domain type, not to `unknown`. */
25
+ export function isConfigObject(value) {
26
+ return typeof value === "object" && value !== null && !Array.isArray(value);
27
+ }
28
+ // --- x-merge-strategy ---
29
+ /** The annotation key selecting how an array node combines across tiers. */
30
+ export const MERGE_STRATEGY_KEY = "x-merge-strategy";
31
+ const DEFAULT_MERGE_STRATEGY = "replace";
32
+ const KEYED_PREFIX = "keyed:";
33
+ export function isMergeStrategy(value) {
34
+ if (typeof value !== "string")
35
+ return false;
36
+ if (value === "replace" || value === "append")
37
+ return true;
38
+ return value.startsWith(KEYED_PREFIX) && value.length > KEYED_PREFIX.length;
39
+ }
40
+ /**
41
+ * The declared strategy for a node, or the default.
42
+ *
43
+ * An UNRECOGNIZED annotation value falls back to `replace` rather than throwing.
44
+ * The default is the conservative one: replace never silently unions entries a
45
+ * nearer tier meant to supersede, so a typo in a schema degrades to the safe
46
+ * shape. Schema typos are caught by the #2416 drift test, not at resolve time.
47
+ */
48
+ export function mergeStrategyOf(node) {
49
+ const declared = node?.[MERGE_STRATEGY_KEY];
50
+ return isMergeStrategy(declared) ? declared : DEFAULT_MERGE_STRATEGY;
51
+ }
52
+ /** The field name a `keyed:<field>` strategy matches on, else `undefined`. */
53
+ export function keyedField(strategy) {
54
+ return strategy.startsWith(KEYED_PREFIX)
55
+ ? strategy.slice(KEYED_PREFIX.length)
56
+ : undefined;
57
+ }
58
+ // --- x-deny ---
59
+ /** The annotation key marking a node as carrying a denial. */
60
+ export const DENY_KEY = "x-deny";
61
+ /**
62
+ * How a node expresses a denial.
63
+ *
64
+ * - `boolean-false` — a boolean whose `false` denies. `enabled: false`.
65
+ * - `array-union` — a list whose MEMBERS are denials. `disabledServers`.
66
+ *
67
+ * Annotation-driven rather than name-driven on purpose. A heuristic over field
68
+ * names ("anything called `disabled*`") is defect shape 8: it silently misses
69
+ * the field someone spelled differently, and silently claims one that merely
70
+ * looks the part. A schema says what it means.
71
+ */
72
+ const DENY_POLICIES = ["boolean-false", "array-union"];
73
+ export function isDenyPolicy(value) {
74
+ return (typeof value === "string" &&
75
+ DENY_POLICIES.includes(value));
76
+ }
77
+ /** The declared deny policy for a node, or `undefined` when it carries none. */
78
+ export function denyPolicyOf(node) {
79
+ const declared = node?.[DENY_KEY];
80
+ return isDenyPolicy(declared) ? declared : undefined;
81
+ }
82
+ // --- structural accessors ---
83
+ export function isSchemaNode(value) {
84
+ return typeof value === "object" && value !== null && !Array.isArray(value);
85
+ }
86
+ export function isPlainObject(value) {
87
+ return typeof value === "object" && value !== null && !Array.isArray(value);
88
+ }
89
+ /** The declared `type` keyword, when it is a single string. */
90
+ export function schemaType(node) {
91
+ const declared = node?.type;
92
+ return typeof declared === "string" ? declared : undefined;
93
+ }
94
+ /**
95
+ * The `type` keywords the core knows how to act on.
96
+ *
97
+ * An unrecognized keyword is the SCHEMA's problem, not the user's, and both
98
+ * halves of the pipeline treat it identically: the node is opaque, so the walk
99
+ * dispatches on the value's own shape instead of on a word it cannot read
100
+ * (#2440 review). Asking `schemaType(node) !== undefined` was the older,
101
+ * asymmetric test — it let the validator walk a `type: "widget"` node field by
102
+ * field while the merger replaced it whole, so the same schema typo produced
103
+ * two different merge semantics.
104
+ */
105
+ const SCHEMA_TYPES = [
106
+ "object",
107
+ "array",
108
+ "string",
109
+ "number",
110
+ "integer",
111
+ "boolean",
112
+ "null",
113
+ ];
114
+ const SCHEMA_TYPE_SET = new Set(SCHEMA_TYPES);
115
+ /** True when the node declares a `type` keyword the core acts on. */
116
+ export function isKnownSchemaType(declared) {
117
+ return declared !== undefined && SCHEMA_TYPE_SET.has(declared);
118
+ }
119
+ /**
120
+ * The subschema governing property `name`: its `properties` entry, else the
121
+ * first `patternProperties` entry whose regex matches.
122
+ *
123
+ * A malformed pattern is skipped rather than thrown: a schema is data, and one
124
+ * bad regex must not take down every config load that touches the file.
125
+ */
126
+ export function propertySchema(node, name) {
127
+ if (!node)
128
+ return undefined;
129
+ const properties = node.properties;
130
+ if (isSchemaNode(properties) && Object.hasOwn(properties, name)) {
131
+ const child = properties[name];
132
+ if (isSchemaNode(child))
133
+ return child;
134
+ }
135
+ const patterns = node.patternProperties;
136
+ if (isSchemaNode(patterns)) {
137
+ for (const [pattern, child] of Object.entries(patterns)) {
138
+ if (!isSchemaNode(child))
139
+ continue;
140
+ let matcher;
141
+ try {
142
+ matcher = new RegExp(pattern);
143
+ }
144
+ catch {
145
+ continue;
146
+ }
147
+ if (matcher.test(name))
148
+ return child;
149
+ }
150
+ }
151
+ return undefined;
152
+ }
153
+ export function additionalPropertyPolicy(node) {
154
+ const declared = node?.additionalProperties;
155
+ if (declared === true)
156
+ return { kind: "keep" };
157
+ if (isSchemaNode(declared))
158
+ return { kind: "validate", schema: declared };
159
+ return { kind: "drop" };
160
+ }
161
+ /** The `items` subschema of an array node, when it is a single schema. */
162
+ export function itemsSchema(node) {
163
+ const declared = node?.items;
164
+ return isSchemaNode(declared) ? declared : undefined;
165
+ }
@@ -0,0 +1,281 @@
1
+ /**
2
+ * The stability registry for pi-lens's PUBLIC config surfaces (#2418).
3
+ *
4
+ * At ~28k downloads/month a config field or a warning string becomes a
5
+ * compatibility obligation the moment it ships. This module is the one place
6
+ * that obligation is written down as DATA, so the policy in
7
+ * `docs/public-api-stability.md` is enforceable by test rather than by
8
+ * convention:
9
+ *
10
+ * - `STABILITY_TIERS` / `STABILITY_TIER_KEY` — the `x-stability` annotation
11
+ * every published schema property must carry. New fields default to
12
+ * `experimental`; only `stable` fields are covered by the compatibility
13
+ * guarantee. Promotion is a deliberate, changelogged act.
14
+ * - `CONFIG_SCHEMA_ID` / `CONFIG_SCHEMA_ANCHOR_KEY` — the reserved schema
15
+ * identity anchor the unified config envelope carries from its first
16
+ * published version (#2416 populates it; nothing here emits config).
17
+ * - `CONFIG_DIAGNOSTIC_CODES` — a closed, APPEND-ONLY namespace of stable
18
+ * codes for user-facing config validation and migration warnings, so a user
19
+ * can match or suppress on `PILENS_CFG_0001` instead of on prose. Message
20
+ * text may change freely; codes may never be renumbered or removed.
21
+ * - `DEPRECATED_CONFIG_SURFACES` — the deprecation window (`deprecatedSince` /
22
+ * `removeNotBefore`) for every legacy config key and file location that is
23
+ * still read. Removal happens only in a major, through the documented
24
+ * breaking-change checklist.
25
+ *
26
+ * Deliberately DEPENDENCY-FREE: this is a data leaf imported by the config
27
+ * loaders, the degradation ledger seam, and the governance tests. It must
28
+ * never grow an import on a module that itself reports config diagnostics.
29
+ */
30
+ // --- Field stability tiers (policy point 1) ---
31
+ /** The JSON Schema annotation key carrying a field's stability tier. */
32
+ export const STABILITY_TIER_KEY = "x-stability";
33
+ /**
34
+ * The closed tier vocabulary. `experimental` fields may change or be removed
35
+ * in a minor; `stable` fields are covered by the compatibility guarantee.
36
+ */
37
+ const STABILITY_TIERS = ["experimental", "stable"];
38
+ export function isStabilityTier(value) {
39
+ return (typeof value === "string" &&
40
+ STABILITY_TIERS.includes(value));
41
+ }
42
+ // --- Config envelope identity (policy point 3) ---
43
+ /**
44
+ * The reserved `$schema` URL for the unified pi-lens config envelope. Pinned
45
+ * here from the first published version so the identity anchor cannot drift
46
+ * between the schema, the validator, and the docs. #2416 is the first consumer.
47
+ */
48
+ export const CONFIG_SCHEMA_ID = "https://raw.githubusercontent.com/apmantza/pi-lens/master/docs/schema/pi-lens-config-v1.json";
49
+ /** The envelope key carrying `CONFIG_SCHEMA_ID` in a user's config file. */
50
+ export const CONFIG_SCHEMA_ANCHOR_KEY = "$schema";
51
+ // --- Stable config diagnostic codes (policy point 2) ---
52
+ /**
53
+ * APPEND-ONLY. Add new codes at the end with the next number; never renumber,
54
+ * never delete, never reuse a retired number. A retired code keeps its entry
55
+ * with its description amended — `tests/clients/config-diagnostic-codes.test.ts`
56
+ * pins the full list and goes red on any renumber or removal.
57
+ */
58
+ export const CONFIG_DIAGNOSTIC_CODES = {
59
+ /**
60
+ * A config file exists but could not be read or parsed, so it is ignored.
61
+ *
62
+ * EMITTED, by `warnIgnoredConfigOnce` (`clients/config-warn.ts`) — the one
63
+ * seam behind all three config loaders. It rides the user-facing message as
64
+ * a ` [PILENS_CFG_0001]` suffix AND the durable `config-ignored`
65
+ * degradation row, so the code a user greps for in the terminal is the same
66
+ * one in `latency.log`.
67
+ */
68
+ PILENS_CFG_0001: "config file unreadable or unparsable; ignored",
69
+ /**
70
+ * A deprecated config KEY was accepted inside its deprecation window.
71
+ *
72
+ * EMITTED since #2426, by `deprecationRecords` (`clients/config-resolve.ts`)
73
+ * for every `kind: "key"` row below that appears at the ROOT of a canonical
74
+ * file — one record per `(file, key)` — and delivered through
75
+ * `reportPiLensConfigRecords` -> `warnIgnoredConfigOnce`, which renders it as
76
+ * `deprecated <label> key in <file>: …` and records a `config-deprecated`
77
+ * ledger row rather than a `config-ignored` one. The setting still APPLIES;
78
+ * the code says only that the spelling is on a removal schedule.
79
+ *
80
+ * The record carries `canonicalKey`, so the auto-migrator #2426 defers can
81
+ * be a pure function over these records rather than a prose parser.
82
+ */
83
+ PILENS_CFG_0002: "deprecated config key accepted",
84
+ /**
85
+ * A deprecated config FILE LOCATION was read inside its window.
86
+ *
87
+ * EMITTED since #2426 — same producer, same delivery path, and the same
88
+ * one-record-per-`(file, key)` granularity as `PILENS_CFG_0002`; this is the
89
+ * code for the `kind: "file"` rows below. Per-key rather than per-file so the
90
+ * warning can name the destination of each setting the user has to move.
91
+ */
92
+ PILENS_CFG_0003: "deprecated config file location accepted",
93
+ /**
94
+ * A config field no schema property claims was dropped.
95
+ *
96
+ * PRODUCED by `validate()` (`clients/config-core/normalize.ts`), which is
97
+ * the one place the unknown-field policy in `docs/public-api-stability.md`
98
+ * is implemented: warn and drop, never throw. It reaches a user through
99
+ * `reportPiLensConfigRecords` -> `warnIgnoredConfigOnce`, which #2426 wires
100
+ * when the loaders adopt the core. Registered now because the resolution
101
+ * pipeline already stamps records with it, and a record carrying an
102
+ * unregistered code is exactly what the #2418 drift test forbids.
103
+ */
104
+ PILENS_CFG_0004: "unknown config field ignored",
105
+ /**
106
+ * A config field's value did not match its schema and was dropped.
107
+ *
108
+ * Wrong type, a value outside a declared `enum`, or a nesting depth past the
109
+ * validator's bound. Same producer and same delivery path as
110
+ * `PILENS_CFG_0004`. Kept distinct from it because the two need different
111
+ * user actions: an unknown field is usually a typo or a removed key, while a
112
+ * rejected value is a field the user meant and spelled wrongly.
113
+ */
114
+ PILENS_CFG_0005: "config field value rejected by schema; ignored",
115
+ /**
116
+ * A config KEY that would have modified an object's prototype was refused.
117
+ *
118
+ * `__proto__`, `constructor`, `prototype`. PRODUCED by both halves of the
119
+ * config core (`normalize.ts` when validating, `merge.ts` when combining
120
+ * tiers), through the shared policy in `config-core/safe-object.ts`.
121
+ *
122
+ * Kept distinct from `PILENS_CFG_0004` even though both describe a dropped
123
+ * key, because the two mean different things to whoever reads the warning: an
124
+ * unknown field is a typo the user should fix, while this one is a key no
125
+ * pi-lens config can ever legitimately carry. A user who sees it in their own
126
+ * hand-written file has a mistake; a user who sees it naming a file they did
127
+ * not write has something worth looking at.
128
+ */
129
+ PILENS_CFG_0006: "config key would modify the object prototype; ignored",
130
+ /**
131
+ * Further config notices were suppressed by a per-resolution bound.
132
+ *
133
+ * The record count a config file can produce is USER INPUT — one key, one
134
+ * record — so every producer collects into a bounded
135
+ * `MigrationRecordCollector` through `finalizeRecords`, which holds one slot
136
+ * back for this code. It is the difference between a bound that is honest
137
+ * and one that drops notices silently: a user who sees it knows the list
138
+ * they were shown is partial, and how much of it is missing. The count is
139
+ * the WHOLE truncation, including anything an earlier bound in the same
140
+ * pipeline already discarded (#2426 review round 6, F1).
141
+ *
142
+ * Registered as its own code rather than folded into `PILENS_CFG_0001`
143
+ * because the user action differs — nothing about the config is wrong, the
144
+ * OUTPUT was truncated, and the fix is to read the file rather than to
145
+ * change it. For the same reason it is the ONE code `warnIgnoredConfigOnce`
146
+ * renders with neither the `ignoring invalid …` prose nor the
147
+ * `config-ignored` ledger kind: it records under `config-notice-suppressed`,
148
+ * because a file whose every setting applied can still overflow the bound.
149
+ */
150
+ PILENS_CFG_0007: "further config notices suppressed by the per-resolution bound",
151
+ /**
152
+ * A WHOLE configuration was dropped because resolving it failed internally.
153
+ *
154
+ * PRODUCED by the two guards that stand under the config pipeline —
155
+ * `resolveConfig` (`clients/config-core/resolve.ts`) and the global loader's
156
+ * post-parse catch (`clients/lens-config.ts`) — each of which degrades a
157
+ * failed resolution to "no config" rather than taking the session with it.
158
+ * The record carries the error CLASS only, never its message.
159
+ *
160
+ * Distinct from `PILENS_CFG_0005`, which both guards borrowed until #2426
161
+ * review round 6 (S1). 0005 is registered as a per-FIELD rejection: a user
162
+ * who matches on it expects one setting to have been dropped and the rest to
163
+ * be in effect. Here NOTHING in the file is in effect, so the two need
164
+ * different codes to be worth matching on at all.
165
+ *
166
+ * The ONE code the per-resolution bound never suppresses (#2426 review round
167
+ * 7, F1). Every other record is one more per-key notice, and past 20 of
168
+ * those a count is worth more than the list; this record is the statement
169
+ * that those notices are no longer the whole story, so letting a
170
+ * `PILENS_CFG_0007` stand in for it told the user "19 keys rejected, N more
171
+ * suppressed" about a configuration that applied nothing at all.
172
+ */
173
+ PILENS_CFG_0008: "config resolution failed; whole configuration ignored",
174
+ };
175
+ /** The shape every code in the namespace must match. */
176
+ export const CONFIG_DIAGNOSTIC_CODE_PATTERN = /^PILENS_CFG_\d{4}$/;
177
+ export function isConfigDiagnosticCode(value) {
178
+ return (typeof value === "string" && Object.hasOwn(CONFIG_DIAGNOSTIC_CODES, value));
179
+ }
180
+ /** The registered description for a code, or `undefined` when unregistered. */
181
+ export function getConfigDiagnosticCode(code) {
182
+ return isConfigDiagnosticCode(code)
183
+ ? CONFIG_DIAGNOSTIC_CODES[code]
184
+ : undefined;
185
+ }
186
+ /**
187
+ * The user-visible marker appended to a coded message: ` [PILENS_CFG_0001]`.
188
+ * Kept as a bracketed suffix so it is greppable and suppressible without
189
+ * depending on any prose before it.
190
+ */
191
+ export function configDiagnosticMarker(code) {
192
+ return `[${code}]`;
193
+ }
194
+ /** Append a code marker to a message, unless the message already carries it. */
195
+ export function withConfigDiagnosticCode(message, code) {
196
+ const marker = configDiagnosticMarker(code);
197
+ return message.includes(marker) ? message : `${message} ${marker}`;
198
+ }
199
+ /** Matches the marker suffix in rendered messages (capture group 1 = code). */
200
+ export const CONFIG_DIAGNOSTIC_MARKER_PATTERN = /\[(PILENS_CFG_\d{4})\]/;
201
+ /**
202
+ * The legacy config surfaces pi-lens still reads. Each row commits to being
203
+ * read for one deprecation window and then ACTUALLY removed at
204
+ * `removeNotBefore` — legacy sources are not carried forever. Removal routes
205
+ * through the #2372 slice-5 breaking-change plan, which instantiates the
206
+ * checklist in `docs/public-api-stability.md`.
207
+ *
208
+ * The consolidation slice (#2426) blesses exactly two canonical locations:
209
+ * `.pi-lens.json` (project) and `~/.pi-lens/config.json` (global). Neither
210
+ * appears here, and that is the point: a CANONICAL FILE IS NOT DEPRECATED
211
+ * BECAUSE SOME OF ITS KEYS ARE. `.pi-lens.json` keeps being read forever; what
212
+ * is deprecated is the legacy top-level LSP keys inside it (`servers`,
213
+ * `serverOverrides`, `disabledServers`, `warmFiles`), which are the
214
+ * `kind: "key"` rows below. Listing the file itself would have promised users
215
+ * that the file they were just told to migrate TO is going away.
216
+ */
217
+ /**
218
+ * The window every surface below shares. One window, not eight copies: the
219
+ * whole point of policy point 4 is that a deprecation is announced ONCE and
220
+ * removed at ONE major, so a per-row date is an invitation to drift. Spelling
221
+ * it once also means the S3 rule — `deprecatedSince` is the release that
222
+ * announces, never one that already shipped — has a single place to be wrong.
223
+ */
224
+ const LSP_DEPRECATION_WINDOW = {
225
+ deprecatedSince: "4.1.4",
226
+ removeNotBefore: "5.0.0",
227
+ };
228
+ /** A legacy top-level LSP KEY inside a config file that is itself canonical. */
229
+ const LEGACY_KEY = {
230
+ kind: "key",
231
+ code: "PILENS_CFG_0002",
232
+ ...LSP_DEPRECATION_WINDOW,
233
+ };
234
+ /** A legacy config FILE LOCATION that a loader still reads. */
235
+ const LEGACY_FILE = {
236
+ kind: "file",
237
+ code: "PILENS_CFG_0003",
238
+ ...LSP_DEPRECATION_WINDOW,
239
+ };
240
+ export const DEPRECATED_CONFIG_SURFACES = [
241
+ {
242
+ ...LEGACY_KEY,
243
+ surface: "servers",
244
+ reason: "custom-server definitions move to the unified catalog schema; the bare string command + args form is replaced by the trust-gated ProcessSpec (#2416).",
245
+ },
246
+ {
247
+ ...LEGACY_KEY,
248
+ surface: "serverOverrides",
249
+ reason: "per-server initializationOptions overrides fold into the catalog's field-wise merge, keyed by the same public server IDs (#2416).",
250
+ },
251
+ {
252
+ ...LEGACY_KEY,
253
+ surface: "disabledServers",
254
+ reason: "replaced by the catalog's per-entry `enabled: false`, which carries monotonic deny precedence (#1416/#2415).",
255
+ },
256
+ {
257
+ ...LEGACY_KEY,
258
+ surface: "warmFiles",
259
+ reason: "session warm-up seeds become a per-server catalog field rather than a config-root list (#2416).",
260
+ },
261
+ {
262
+ ...LEGACY_FILE,
263
+ surface: ".pi-lens/lsp.json",
264
+ reason: "project LSP settings consolidate into `.pi-lens.json` under the unified envelope (#2426).",
265
+ },
266
+ {
267
+ ...LEGACY_FILE,
268
+ surface: "pi-lsp.json",
269
+ reason: "pre-rename project location; superseded by `.pi-lens.json` (#2426).",
270
+ },
271
+ {
272
+ ...LEGACY_FILE,
273
+ surface: "pi-lens.json",
274
+ reason: "undotted project-config basename; superseded by `.pi-lens.json` (#2426).",
275
+ },
276
+ {
277
+ ...LEGACY_FILE,
278
+ surface: "~/.pi-lens/lsp.json",
279
+ reason: "global LSP settings consolidate into `~/.pi-lens/config.json` (#2426).",
280
+ },
281
+ ];
@@ -0,0 +1,160 @@
1
+ /**
2
+ * WHERE pi-lens config lives, and in what order (#2426).
3
+ *
4
+ * Before this module the answer was spread across three loaders with three
5
+ * different walks: `lsp/config.ts` had its own `CONFIG_PATHS` and an UNBOUNDED
6
+ * upward walk to the filesystem root, `project-lens-config.ts` had its own
7
+ * `PROJECT_CONFIG_BASENAMES` and a second unbounded walk, and `lens-config.ts`
8
+ * read one fixed path. Three walks meant three places for the #622/#625
9
+ * ceiling rule to be forgotten, and it was: a `pi-lsp.json` sitting in `$HOME`
10
+ * — or in `C:\` — was read for every project on the machine.
11
+ *
12
+ * There are exactly TWO canonical locations:
13
+ *
14
+ * `.pi-lens.json` — project, nearest-package-wins per field
15
+ * `~/.pi-lens/config.json` — machine-global
16
+ *
17
+ * Everything else in `PROJECT_CONFIG_LOCATIONS` / `GLOBAL_CONFIG_LOCATIONS` is
18
+ * legacy, read for the deprecation window declared in
19
+ * `DEPRECATED_CONFIG_SURFACES` and then removed. This module does not restate
20
+ * that membership: it DERIVES the legacy set from the registry and orders it,
21
+ * and `tests/clients/config-locations.test.ts` pins that the derived set is
22
+ * exactly the registry's `kind: "file"` rows. Registry owns WHICH surfaces are
23
+ * deprecated; this module owns only their precedence.
24
+ *
25
+ * Pure data plus one walk. No file reads, no caching, no state.
26
+ */
27
+ import * as os from "node:os";
28
+ import * as path from "node:path";
29
+ import { DEPRECATED_CONFIG_SURFACES } from "./config-diagnostic-codes.js";
30
+ import { isAtOrAboveHomeDir, walkUpDirs } from "./path-utils.js";
31
+ /** The one canonical PROJECT config file. Never deprecated. */
32
+ export const CANONICAL_PROJECT_CONFIG_FILE = ".pi-lens.json";
33
+ /** Basename of the one canonical GLOBAL config file inside `~/.pi-lens/`. */
34
+ export const CANONICAL_GLOBAL_CONFIG_FILE = "config.json";
35
+ /** The key the LSP namespace lives under in BOTH canonical files. */
36
+ export const LSP_NAMESPACE_KEY = "lsp";
37
+ /** The `~/` prefix a global row in the registry carries. */
38
+ const GLOBAL_SURFACE_PREFIX = "~/.pi-lens/";
39
+ const LEGACY_FILE_SURFACES = DEPRECATED_CONFIG_SURFACES.filter((row) => row.kind === "file").map((row) => row.surface);
40
+ /**
41
+ * The legacy LSP ROOT keys still accepted inside a canonical file. Derived from
42
+ * the registry's `kind: "key"` rows so the accepted set and the deprecation
43
+ * schedule cannot drift apart.
44
+ */
45
+ export const LEGACY_ROOT_LSP_KEYS = DEPRECATED_CONFIG_SURFACES.filter((row) => row.kind === "key").map((row) => row.surface);
46
+ function isLspScoped(relativePath) {
47
+ const base = path.posix.basename(relativePath.replace(/\\/g, "/"));
48
+ return base === "lsp.json" || base === "pi-lsp.json";
49
+ }
50
+ function legacyLocation(relativePath, surface) {
51
+ return {
52
+ relativePath,
53
+ surface,
54
+ legacy: true,
55
+ lspScoped: isLspScoped(relativePath),
56
+ };
57
+ }
58
+ /**
59
+ * Project locations in ASCENDING precedence: the canonical file is LAST, so it
60
+ * wins every collision with a legacy file in the same directory.
61
+ *
62
+ * This inverts one pre-#2426 rule deliberately. `lsp/config.ts` searched
63
+ * `.pi-lens/lsp.json`, `.pi-lens.json`, `pi-lsp.json` and took the FIRST hit,
64
+ * so a leftover `.pi-lens/lsp.json` silently beat the file the user was being
65
+ * told to migrate to. A deprecated location that outranks the canonical one is
66
+ * a migration that can never be completed.
67
+ */
68
+ export const PROJECT_CONFIG_LOCATIONS = [
69
+ legacyLocation("pi-lens.json", "pi-lens.json"),
70
+ legacyLocation("pi-lsp.json", "pi-lsp.json"),
71
+ legacyLocation(path.posix.join(".pi-lens", "lsp.json"), ".pi-lens/lsp.json"),
72
+ {
73
+ relativePath: CANONICAL_PROJECT_CONFIG_FILE,
74
+ legacy: false,
75
+ lspScoped: false,
76
+ },
77
+ ];
78
+ /**
79
+ * The project config BASENAMES a first-match-wins probe uses, in DESCENDING
80
+ * precedence — canonical first. The inverse view of the table above, for the
81
+ * two callers that look for one file in one directory rather than layering all
82
+ * of them: `project-lens-config.ts`'s upward walk and `workspace-topology.ts`'s
83
+ * directory-marker index.
84
+ *
85
+ * Derived here rather than restated there. Both of those modules carried their
86
+ * OWN literal pair before (#2426 folded the first one in; the marker index's
87
+ * copy outlived it), and two hand-maintained lists of the same filenames is the
88
+ * mirror the single-source-of-truth rule forbids — the failure mode being a
89
+ * table change that flips one probe's collision winner and not the other's.
90
+ *
91
+ * The LSP-scoped legacy locations are filtered out: their ROOT keys are LSP
92
+ * settings, not the pi-lens config sections these two probes project.
93
+ */
94
+ export const PROJECT_CONFIG_BASENAMES = PROJECT_CONFIG_LOCATIONS.filter((location) => !location.lspScoped)
95
+ .map((location) => location.relativePath)
96
+ .reverse();
97
+ /** Global locations in ASCENDING precedence; canonical last, same rule. */
98
+ export const GLOBAL_CONFIG_LOCATIONS = [
99
+ legacyLocation("lsp.json", `${GLOBAL_SURFACE_PREFIX}lsp.json`),
100
+ {
101
+ relativePath: CANONICAL_GLOBAL_CONFIG_FILE,
102
+ legacy: false,
103
+ lspScoped: false,
104
+ },
105
+ ];
106
+ /**
107
+ * Every legacy surface this module claims to read, for the registry-agreement
108
+ * test. Exported rather than re-derived in the test, so the test compares the
109
+ * SHIPPED set against the registry instead of comparing the registry to itself.
110
+ */
111
+ export const DECLARED_LEGACY_FILE_SURFACES = [
112
+ ...PROJECT_CONFIG_LOCATIONS,
113
+ ...GLOBAL_CONFIG_LOCATIONS,
114
+ ]
115
+ .filter((location) => location.legacy)
116
+ .map((location) => location.surface);
117
+ /** The registry's own `kind: "file"` surfaces, for the same test. */
118
+ export const REGISTERED_LEGACY_FILE_SURFACES = LEGACY_FILE_SURFACES;
119
+ /**
120
+ * Directories to look for a project config in, INNERMOST FIRST, stopping at the
121
+ * `$HOME` ceiling.
122
+ *
123
+ * The ceiling is the whole point (#622/#625, #2426 scope item 1). `$HOME` and
124
+ * every ancestor of it is refused, so a stray `pi-lsp.json` in the user's home
125
+ * directory — or at the filesystem root — is not silently adopted by every
126
+ * project on the machine. `isAtOrAboveHomeDir` is the shared primitive; a
127
+ * private `dir === homedir()` check is the exact bug #625 catalogued, because
128
+ * it stops at HOME but still reads everything above it.
129
+ *
130
+ * The MACHINE-GLOBAL config is not affected: it is read by absolute path from
131
+ * `~/.pi-lens/`, never by walking into `$HOME` and finding it.
132
+ */
133
+ export function configSearchDirs(startDir, homeDir = os.homedir()) {
134
+ const dirs = [];
135
+ for (const dir of walkUpDirs(startDir)) {
136
+ if (isAtOrAboveHomeDir(dir, homeDir))
137
+ break;
138
+ dirs.push(dir);
139
+ }
140
+ return dirs;
141
+ }
142
+ /**
143
+ * The absolute path of the canonical GLOBAL config — `~/.pi-lens/config.json`,
144
+ * or `PI_LENS_CONFIG_PATH` when it overrides that.
145
+ *
146
+ * Lives here rather than in `lens-config.ts` (#2426 review round 3, S1),
147
+ * which is where it originated: this module is the one that already states
148
+ * "WHERE pi-lens config lives", and `project-lens-config.ts` needs this exact
149
+ * function — not a re-derivation of `PI_LENS_CONFIG_PATH` — to name the file a
150
+ * global-only setting belongs in. Importing it from `lens-config.ts` would
151
+ * close a cycle, since `lens-config.ts` itself imports from
152
+ * `project-lens-config.ts`. `lens-config.ts` re-exports this so its own,
153
+ * pre-existing import sites are unaffected.
154
+ */
155
+ export function getPiLensGlobalConfigPath(homeDir = os.homedir()) {
156
+ const override = process.env.PI_LENS_CONFIG_PATH;
157
+ if (override)
158
+ return path.resolve(override);
159
+ return path.join(homeDir, ".pi-lens", CANONICAL_GLOBAL_CONFIG_FILE);
160
+ }