pi-lens 3.8.73 → 4.0.0
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.
- package/CHANGELOG.md +2614 -12
- package/README.md +50 -21
- package/dist/clients/actionable-warnings.js +73 -18
- package/dist/clients/agent-behavior-client.js +21 -4
- package/dist/clients/ast-grep-client.js +68 -16
- package/dist/clients/ast-grep-types.js +0 -1
- package/dist/clients/ast-grep-yaml-synth.js +37 -10
- package/dist/clients/atomic-write-staging.js +63 -0
- package/dist/clients/atomic-write.js +116 -16
- package/dist/clients/bash-file-access.js +193 -23
- package/dist/clients/biome-client.js +29 -25
- package/dist/clients/bootstrap.js +11 -2
- package/dist/clients/bounded-cache.js +34 -0
- package/dist/clients/bounded-pid-file-lock.js +192 -0
- package/dist/clients/bus-events-logger.js +5 -1
- package/dist/clients/bus-publish.js +10 -3
- package/dist/clients/cache/rule-cache.js +89 -6
- package/dist/clients/cache-manager.js +97 -9
- package/dist/clients/cache-observability.js +498 -0
- package/dist/clients/call-graph.js +460 -108
- package/dist/clients/cascade-logger.js +5 -1
- package/dist/clients/child-unref.js +85 -0
- package/dist/clients/codebase-model.js +52 -23
- package/dist/clients/collateral-test-role.js +40 -0
- package/dist/clients/complexity-client.js +6 -8
- package/dist/clients/console-guard-install.js +14 -0
- package/dist/clients/cooperative-budget.js +42 -0
- package/dist/clients/dead-code-client.js +2 -1
- package/dist/clients/debug-handles.js +206 -0
- package/dist/clients/debug-heap.js +167 -0
- package/dist/clients/degradation-ledger.js +153 -0
- package/dist/clients/dependency-checker.js +466 -63
- package/dist/clients/diagnostic-dispositions.js +83 -13
- package/dist/clients/diagnostics-publish.js +10 -3
- package/dist/clients/dispatch/auxiliary-lsp.js +34 -0
- package/dist/clients/dispatch/dispatcher.js +71 -13
- package/dist/clients/dispatch/fact-store.js +11 -0
- package/dist/clients/dispatch/facts/function-facts.js +37 -7
- package/dist/clients/dispatch/facts/import-facts.js +108 -119
- package/dist/clients/dispatch/facts/tree-sitter-facts.js +12 -12
- package/dist/clients/dispatch/facts/try-catch-facts.js +13 -0
- package/dist/clients/dispatch/indent-detect.js +35 -0
- package/dist/clients/dispatch/inline-suppressions.js +17 -8
- package/dist/clients/dispatch/integration.js +1094 -611
- package/dist/clients/dispatch/lazy.js +14 -0
- package/dist/clients/dispatch/plan.js +11 -1
- package/dist/clients/dispatch/rule-id-normalize.js +50 -0
- package/dist/clients/dispatch/rule-policy.js +135 -0
- package/dist/clients/dispatch/rules/async-noise.js +1 -0
- package/dist/clients/dispatch/rules/unsafe-boundary.js +7 -0
- package/dist/clients/dispatch/runners/ast-grep-napi.js +47 -6
- package/dist/clients/dispatch/runners/biome-check.js +5 -9
- package/dist/clients/dispatch/runners/detekt.js +3 -2
- package/dist/clients/dispatch/runners/hadolint.js +2 -1
- package/dist/clients/dispatch/runners/helm-lint.js +154 -0
- package/dist/clients/dispatch/runners/htmlhint.js +3 -2
- package/dist/clients/dispatch/runners/index.js +5 -1
- package/dist/clients/dispatch/runners/lsp.js +14 -6
- package/dist/clients/dispatch/runners/markdownlint.js +4 -9
- package/dist/clients/dispatch/runners/psscriptanalyzer.js +10 -1
- package/dist/clients/dispatch/runners/pyright.js +9 -5
- package/dist/clients/dispatch/runners/ruff.js +4 -8
- package/dist/clients/dispatch/runners/shellcheck.js +2 -3
- package/dist/clients/dispatch/runners/shfmt.js +2 -3
- package/dist/clients/dispatch/runners/spotbugs.js +2 -1
- package/dist/clients/dispatch/runners/taplo.js +2 -1
- package/dist/clients/dispatch/runners/terragrunt.js +163 -0
- package/dist/clients/dispatch/runners/tflint.js +37 -5
- package/dist/clients/dispatch/runners/tree-sitter.js +155 -166
- package/dist/clients/dispatch/runners/trivy-config.js +13 -7
- package/dist/clients/dispatch/runners/utils/lazy-installer.js +3 -0
- package/dist/clients/dispatch/runners/utils/runner-helpers.js +284 -34
- package/dist/clients/dispatch/runners/utils/spawn-outcome.js +22 -0
- package/dist/clients/dispatch/runners/yaml-rule-parser.js +5 -4
- package/dist/clients/disposition-publish.js +10 -3
- package/dist/clients/durable-store.js +97 -0
- package/dist/clients/event-loop-monitor.js +94 -3
- package/dist/clients/extension-log.js +139 -0
- package/dist/clients/extension-mode.js +73 -0
- package/dist/clients/feature-hints.js +53 -7
- package/dist/clients/file-kinds.js +143 -31
- package/dist/clients/file-role.js +18 -3
- package/dist/clients/file-utils.js +56 -34
- package/dist/clients/fix-worklog.js +14 -2
- package/dist/clients/format-events-publish.js +16 -3
- package/dist/clients/format-service.js +24 -8
- package/dist/clients/formatters-lazy.js +8 -0
- package/dist/clients/formatters.js +358 -61
- package/dist/clients/generated-artifacts.js +169 -15
- package/dist/clients/git-guard.js +681 -11
- package/dist/clients/git-tracked-ignore.js +4 -0
- package/dist/clients/go-client.js +2 -1
- package/dist/clients/govulncheck-client.js +8 -0
- package/dist/clients/grammar-source.js +12 -4
- package/dist/clients/gzip-stage-write.js +102 -0
- package/dist/clients/host-ports.js +31 -0
- package/dist/clients/installer/index.js +733 -213
- package/dist/clients/instance-reaper.js +142 -172
- package/dist/clients/jscpd-client.js +31 -54
- package/dist/clients/knip-client.js +78 -36
- package/dist/clients/language-policy.js +14 -2
- package/dist/clients/language-profile.js +72 -77
- package/dist/clients/latency-logger.js +28 -16
- package/dist/clients/lens-config.js +140 -166
- package/dist/clients/lens-engine.js +124 -21
- package/dist/clients/lens-events.js +27 -4
- package/dist/clients/lens-flag-registry.js +293 -0
- package/dist/clients/lens-map.js +96 -26
- package/dist/clients/live-bus-emitter.js +30 -0
- package/dist/clients/log-cleanup.js +8 -18
- package/dist/clients/lsp/cascade-tier.js +23 -3
- package/dist/clients/lsp/client.js +566 -57
- package/dist/clients/lsp/config.js +74 -10
- package/dist/clients/lsp/diagnostic-binding.js +86 -0
- package/dist/clients/lsp/edits.js +1012 -121
- package/dist/clients/lsp/index.js +1840 -803
- package/dist/clients/lsp/language.js +4 -1
- package/dist/clients/lsp/launch.js +40 -32
- package/dist/clients/lsp/path-utils.js +1 -1
- package/dist/clients/lsp/ruby-drive-dirs.js +83 -0
- package/dist/clients/lsp/server.js +279 -60
- package/dist/clients/lsp/workspace-diagnostics-cache.js +28 -4
- package/dist/clients/lsp-document-symbols.js +112 -0
- package/dist/clients/lsp-lazy.js +8 -0
- package/dist/clients/lsp-mutation.js +248 -0
- package/dist/clients/mcp/analyze.js +128 -36
- package/dist/clients/mcp/ipc.js +157 -24
- package/dist/clients/mcp/review.js +36 -3
- package/dist/clients/mcp/session.js +216 -8
- package/dist/clients/memory-sampler.js +115 -0
- package/dist/clients/metrics-client.js +2 -1
- package/dist/clients/metrics-history.js +2 -1
- package/dist/clients/module-report-lsp.js +5 -0
- package/dist/clients/module-report.js +267 -82
- package/dist/clients/ndjson-logger.js +334 -103
- package/dist/clients/opengrep-client.js +1 -1
- package/dist/clients/partial-edit-apply.js +120 -5
- package/dist/clients/path-keyed-map.js +76 -0
- package/dist/clients/path-utils.js +141 -5
- package/dist/clients/performance-report.js +327 -0
- package/dist/clients/pipeline.js +54 -13
- package/dist/clients/print-mode.js +21 -0
- package/dist/clients/project-changes.js +117 -4
- package/dist/clients/project-diagnostics/cache.js +3 -2
- package/dist/clients/project-diagnostics/extractors.js +26 -115
- package/dist/clients/project-diagnostics/fresh-fetch.js +149 -19
- package/dist/clients/project-diagnostics/runner-adapters/call-graph-impact.js +117 -0
- package/dist/clients/project-diagnostics/runner-adapters/runner-findings.js +37 -5
- package/dist/clients/project-diagnostics/scanner.js +268 -128
- package/dist/clients/project-lens-config.js +138 -34
- package/dist/clients/project-report.js +64 -25
- package/dist/clients/project-scale.js +8 -10
- package/dist/clients/project-snapshot-persist-worker.js +6 -0
- package/dist/clients/project-snapshot.js +767 -8
- package/dist/clients/project-trust.js +181 -0
- package/dist/clients/quiet-window.js +27 -5
- package/dist/clients/read-bridge.js +147 -0
- package/dist/clients/read-expansion.js +22 -12
- package/dist/clients/read-guard-logger.js +159 -1
- package/dist/clients/read-guard-tool-lines.js +150 -29
- package/dist/clients/read-guard.js +262 -3
- package/dist/clients/redact/secrets.js +449 -0
- package/dist/clients/resource-sampler.js +144 -39
- package/dist/clients/reverse-deps.js +48 -0
- package/dist/clients/review-graph/builder.js +2570 -326
- package/dist/clients/review-graph/git-identity.js +2 -1
- package/dist/clients/review-graph/import-resolvers.js +21 -10
- package/dist/clients/review-graph/persist-worker.js +10 -0
- package/dist/clients/review-graph/query.js +5 -0
- package/dist/clients/review-graph/shared-extraction-ir.js +90 -0
- package/dist/clients/review-graph/symbol-id.js +46 -0
- package/dist/clients/review-graph/tsconfig-paths.js +57 -6
- package/dist/clients/review-graph/workspace-modules.js +51 -3
- package/dist/clients/review-graph-logger.js +53 -0
- package/dist/clients/ruff-client.js +27 -44
- package/dist/clients/runtime-agent-end.js +111 -75
- package/dist/clients/runtime-context.js +36 -12
- package/dist/clients/runtime-coordinator.js +76 -8
- package/dist/clients/runtime-session.js +799 -137
- package/dist/clients/runtime-tool-call.js +117 -62
- package/dist/clients/runtime-tool-result.js +218 -23
- package/dist/clients/runtime-turn.js +284 -40
- package/dist/clients/rust-client.js +2 -1
- package/dist/clients/safe-spawn.js +873 -71
- package/dist/clients/security-scan-client.js +2 -1
- package/dist/clients/session-start-observability.js +15 -0
- package/dist/clients/session-state-store.js +5 -3
- package/dist/clients/sessionstart-logger.js +18 -0
- package/dist/clients/sg-runner.js +284 -159
- package/dist/clients/slow-fs.js +2 -1
- package/dist/clients/smells-rollup.js +224 -0
- package/dist/clients/source-filter.js +231 -43
- package/dist/clients/source-walker.js +66 -10
- package/dist/clients/startup-scan.js +15 -16
- package/dist/clients/startup-timing.js +9 -0
- package/dist/clients/test-runner-client.js +38 -8
- package/dist/clients/todo-scanner.js +30 -3
- package/dist/clients/tool-event.js +35 -0
- package/dist/clients/tool-policy.js +388 -39
- package/dist/clients/tool-render.js +155 -0
- package/dist/clients/tree-sitter-cache.js +153 -140
- package/dist/clients/tree-sitter-client.js +1722 -80
- package/dist/clients/tree-sitter-logger.js +64 -1
- package/dist/clients/tree-sitter-query-loader.js +117 -12
- package/dist/clients/tree-sitter-shared.js +48 -19
- package/dist/clients/tree-sitter-symbol-extractor.js +115 -11
- package/dist/clients/user-notify.js +51 -0
- package/dist/clients/vanished-instance-marker.js +57 -0
- package/dist/clients/warm-attach.js +33 -13
- package/dist/clients/widget-state.js +342 -49
- package/dist/clients/word-index-logger.js +44 -0
- package/dist/clients/word-index.js +612 -68
- package/dist/clients/workspace-topology.js +100 -7
- package/dist/index.js +65923 -47161
- package/dist/mcp/analyze-cli.js +185 -29
- package/dist/mcp/cli.js +110 -0
- package/dist/mcp/server.js +272 -50
- package/dist/tools/ast-grep-search.js +93 -27
- package/dist/tools/lens-diagnostics.js +247 -41
- package/dist/tools/lsp-diagnostics.js +153 -40
- package/dist/tools/lsp-navigation.js +51 -31
- package/dist/tools/module-report.js +9 -0
- package/dist/tools/symbol-search.js +21 -2
- package/docs/agent-guide.md +247 -0
- package/docs/agent-tools.md +21 -10
- package/docs/analysisall.md +192 -0
- package/docs/api-ports-inventory.md +165 -0
- package/docs/ast-grep_rules_catalog.md +5 -2
- package/docs/astplayground.md +3 -4
- package/docs/audit1.md +5 -5
- package/docs/durable-store-audit-1202.md +32 -0
- package/docs/environment-variables.md +197 -11
- package/docs/fable.md +27 -0
- package/docs/features.md +35 -5
- package/docs/globalconfig.md +101 -5
- package/docs/language-coverage.md +6 -5
- package/docs/lsp-capability-matrix.md +2 -2
- package/docs/mcp.md +54 -20
- package/docs/servercapabilities.md +7 -4
- package/docs/settings.md +192 -0
- package/docs/tools.md +18 -1
- package/docs/tree-sitter_rules_catalog.md +11 -31
- package/docs/usage.md +31 -0
- package/package.json +139 -138
- package/rules/ast-grep-rules/rule-tests/hardcoded-url-js-test.yml +1 -0
- package/rules/ast-grep-rules/rule-tests/hardcoded-url-test.yml +2 -0
- package/rules/ast-grep-rules/rule-tests/no-bare-except-test.yml +49 -0
- package/rules/ast-grep-rules/rule-tests/no-bare-host-path-in-win32-branch-test.yml +87 -0
- package/rules/ast-grep-rules/rule-tests/no-case-declarations-js-test.yml +10 -0
- package/rules/ast-grep-rules/rule-tests/no-case-declarations-test.yml +10 -0
- package/rules/ast-grep-rules/rule-tests/no-javascript-url-js-test.yml +10 -0
- package/rules/ast-grep-rules/rule-tests/no-javascript-url-test.yml +10 -0
- package/rules/ast-grep-rules/rule-tests/no-nested-links-test.yml +11 -1
- package/rules/ast-grep-rules/rule-tests/no-raw-json-store-write-test.yml +17 -0
- package/rules/ast-grep-rules/rule-tests/no-win32-isabsolute-for-qualification-test.yml +16 -0
- package/rules/ast-grep-rules/rule-tests/strict-equality-js-test.yml +3 -0
- package/rules/ast-grep-rules/rule-tests/strict-equality-test.yml +3 -0
- package/rules/ast-grep-rules/rule-tests/strict-inequality-js-test.yml +3 -0
- package/rules/ast-grep-rules/rule-tests/strict-inequality-test.yml +4 -0
- package/rules/ast-grep-rules/rules/hardcoded-url-js.yml +22 -4
- package/rules/ast-grep-rules/rules/hardcoded-url.yml +22 -4
- package/rules/ast-grep-rules/rules/no-bare-except.yml +3 -15
- package/rules/ast-grep-rules/rules/no-bare-host-path-in-win32-branch.yml +25 -0
- package/rules/ast-grep-rules/rules/no-case-declarations-js.yml +4 -3
- package/rules/ast-grep-rules/rules/no-case-declarations.yml +4 -3
- package/rules/ast-grep-rules/rules/no-console-except-error-js.yml +10 -0
- package/rules/ast-grep-rules/rules/no-console-except-error.yml +10 -0
- package/rules/ast-grep-rules/rules/no-javascript-url-js.yml +42 -6
- package/rules/ast-grep-rules/rules/no-javascript-url.yml +42 -6
- package/rules/ast-grep-rules/rules/no-nested-links.yml +7 -0
- package/rules/ast-grep-rules/rules/no-raw-json-store-write.yml +30 -0
- package/rules/ast-grep-rules/rules/no-win32-isabsolute-for-qualification.yml +23 -0
- package/rules/ast-grep-rules/rules/strict-equality-js.yml +14 -1
- package/rules/ast-grep-rules/rules/strict-equality.yml +14 -1
- package/rules/ast-grep-rules/rules/strict-inequality-js.yml +14 -1
- package/rules/ast-grep-rules/rules/strict-inequality.yml +14 -1
- package/rules/tree-sitter-queries/cpp/no-memset-sensitive-data.yml +9 -3
- package/rules/tree-sitter-queries/cpp/no-scoped-lock-without-args.yml +6 -6
- package/rules/tree-sitter-queries/css/calc-spacing.yml +8 -6
- package/rules/tree-sitter-queries/go/go-mutex-copy.yml +21 -18
- package/rules/tree-sitter-queries/go/go-shared-map-write-goroutine.yml +3 -3
- package/rules/tree-sitter-queries/java/infinite-loop-java.yml +3 -3
- package/rules/tree-sitter-queries/java/junit-call-super.yml +6 -4
- package/rules/tree-sitter-queries/java/no-double-checked-locking.yml +10 -8
- package/rules/tree-sitter-queries/java/no-field-shadowing.yml +1 -1
- package/rules/tree-sitter-queries/java/prepared-statement-valid-indices.yml +2 -3
- package/rules/tree-sitter-queries/java/resources-closed.yml +2 -2
- package/rules/tree-sitter-queries/java/springboot-default-package.yml +6 -3
- package/rules/tree-sitter-queries/java/switch-fall-through.yml +6 -4
- package/rules/tree-sitter-queries/java/switch-non-case-labels.yml +4 -3
- package/rules/tree-sitter-queries/java/tests-include-assertions.yml +6 -5
- package/rules/tree-sitter-queries/javascript/switch-case-termination-js.yml +5 -8
- package/rules/tree-sitter-queries/javascript/switch-non-case-labels.yml +3 -2
- package/rules/tree-sitter-queries/kotlin/prepared-statement-indices.yml +9 -5
- package/rules/tree-sitter-queries/php/this-in-static-context.yml +5 -5
- package/rules/tree-sitter-queries/python/exit-signature-check.yml +2 -9
- package/rules/tree-sitter-queries/python/in-operator-unsupported.yml +3 -4
- package/rules/tree-sitter-queries/python/no-super-torchscript.yml +4 -8
- package/rules/tree-sitter-queries/python/notimplemented-boolean-context.yml +1 -5
- package/rules/tree-sitter-queries/python/python-empty-except.yml +1 -1
- package/rules/tree-sitter-queries/python/return-in-init.yml +0 -2
- package/rules/tree-sitter-queries/python/yield-return-outside-function.yml +0 -3
- package/rules/tree-sitter-queries/ruby/ruby-command-injection.yml +1 -12
- package/rules/tree-sitter-queries/ruby/ruby-eval.yml +1 -1
- package/rules/tree-sitter-queries/ruby/ruby-insecure-deserialization.yml +4 -4
- package/rules/tree-sitter-queries/ruby/ruby-insecure-random.yml +4 -11
- package/rules/tree-sitter-queries/ruby/ruby-open-struct.yml +1 -1
- package/rules/tree-sitter-queries/ruby/ruby-string-eval.yml +2 -3
- package/rules/tree-sitter-queries/ruby/ruby-weak-hash.yml +4 -4
- package/rules/tree-sitter-queries/rust/rust-lock-held-across-await.yml +4 -3
- package/rules/tree-sitter-queries/tsx/no-nested-links.yml +4 -6
- package/rules/tree-sitter-queries/typescript/console-statement.yml +11 -0
- package/rules/tree-sitter-queries/typescript/duplicate-function-arg.yml +4 -9
- package/rules/tree-sitter-queries/typescript/empty-switch-case.yml +13 -9
- package/rules/tree-sitter-queries/typescript/infinite-loop.yml +2 -2
- package/rules/tree-sitter-queries/typescript/mixed-async-styles.yml +10 -1
- package/rules/tree-sitter-queries/typescript/switch-case-termination.yml +5 -8
- package/rules/tree-sitter-queries/typescript/ts-insecure-random.yml +7 -10
- package/rules/tree-sitter-queries/typescript/unsafe-regex.yml +4 -2
- package/rules/typos/_typos.toml +17 -0
- package/scripts/analyze-pi-lens-logs.mjs +55 -2
- package/skills/pi-lens-write-tree-sitter-rule/SKILL.md +5 -0
- package/dist/clients/ast-grep-parser.js +0 -86
- package/dist/clients/config-enabled-shape.js +0 -39
- package/dist/clients/lsp/interactive-install.js +0 -367
- package/dist/clients/lsp/lsp-index.js +0 -10
- package/dist/clients/lsp/server-strategies.js +0 -5
- package/dist/clients/project-metadata.js +0 -690
- package/dist/clients/source-groups.js +0 -96
- package/dist/clients/types.js +0 -11
- package/docs/env_variables.md +0 -10
- package/rules/tree-sitter-queries/abap-disabled/delete-where.yml +0 -46
- package/rules/tree-sitter-queries/cpp/no-confused-move-forward.yml +0 -59
- package/rules/tree-sitter-queries/cpp/noexcept-functions.yml +0 -58
- package/rules/tree-sitter-queries/java/mockito-initialized.yml +0 -66
- package/rules/tree-sitter-queries/java/no-wait-notify-on-thread.yml +0 -58
- package/rules/tree-sitter-queries/java/short-circuit-logic.yml +0 -57
- package/rules/tree-sitter-queries/java/spring-session-attributes-setcomplete.yml +0 -75
- package/rules/tree-sitter-queries/plsql-disabled/delete-update-where.yml +0 -56
- package/rules/tree-sitter-queries/plsql-disabled/end-loop-semicolon.yml +0 -51
- package/rules/tree-sitter-queries/plsql-disabled/fetch-bulk-collect-limit.yml +0 -47
- package/rules/tree-sitter-queries/plsql-disabled/forallsave-exceptions.yml +0 -51
- package/rules/tree-sitter-queries/plsql-disabled/nchar-nvarchar2-bytes.yml +0 -54
- package/rules/tree-sitter-queries/plsql-disabled/not-null-initialization.yml +0 -59
- package/rules/tree-sitter-queries/plsql-disabled/raise-application-error-codes.yml +0 -50
- package/rules/tree-sitter-queries/typescript-disabled/ts-path-traversal.yml +0 -71
package/docs/features.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
### LSP Support
|
|
4
4
|
|
|
5
|
-
pi-lens includes **
|
|
5
|
+
pi-lens includes **42 language server definitions** (including four cross-cutting *auxiliary* scanners that attach alongside the file's language server — Opengrep, ast-grep, zizmor, and typos — see below). LSP is **enabled by default**; use `--no-lsp` to disable it for a session. Servers are auto-discovered from PATH, project `node_modules`, and managed installs. When a server is not installed, pi-lens offers an interactive install prompt.
|
|
6
6
|
|
|
7
7
|
**LSP Idle Management:** LSP servers shut down after 240 seconds of inactivity (no files modified) to free resources. The timer resets when you resume editing, preventing cold-start penalties during active development.
|
|
8
8
|
|
|
@@ -40,6 +40,21 @@ Repositories can disable all immediate and deferred auto-format mutations with
|
|
|
40
40
|
keeping formatter detection, lint dispatch, LSP synchronization, and
|
|
41
41
|
diagnostics available.
|
|
42
42
|
|
|
43
|
+
Deferred formatting (the `agent_end` default) runs with **bounded
|
|
44
|
+
concurrency**: at most three formatter subprocesses in flight at once, with
|
|
45
|
+
results applied in admission order and cooperative yields between files, so a
|
|
46
|
+
large batch of queued files can't stall the event loop or the turn-end pass.
|
|
47
|
+
|
|
48
|
+
### Commit/Push Guard (Experimental)
|
|
49
|
+
|
|
50
|
+
`--lens-guard` (also `guard.enabled: true` in `~/.pi-lens/config.json`) opts
|
|
51
|
+
into blocking `git commit`/`git push` while unresolved pi-lens blockers exist.
|
|
52
|
+
Detection covers normalized wrapper launchers, shell-escaped and
|
|
53
|
+
keyword/combined-flag verb forms, and shell substitutions, while literal text
|
|
54
|
+
in non-executing contexts remains allowed. Off by default; see
|
|
55
|
+
[docs/agent-guide.md](agent-guide.md) and [docs/settings.md](settings.md) for
|
|
56
|
+
the full behavior and honest limits.
|
|
57
|
+
|
|
43
58
|
### Review Graph - Cascade Diagnostics
|
|
44
59
|
|
|
45
60
|
pi-lens builds a review graph (`file → symbol → dependency`) during session and uses it at turn end to render an impact cascade: which files were affected by a change and how diagnostics propagated through the dependency graph. Nodes track kind, language, and export status; edges track contains/imports/calls/references.
|
|
@@ -57,7 +72,8 @@ Coverage is tracked across multiple reads: two reads of lines 1–100 and 101–
|
|
|
57
72
|
|
|
58
73
|
Override for a single edit: `/lens-allow-edit <path>`
|
|
59
74
|
|
|
60
|
-
Configure behavior with `--no-read-guard` to disable entirely, or
|
|
75
|
+
Configure behavior with `--no-read-guard` to disable it entirely, or use the
|
|
76
|
+
read-guard configuration to select `warn` instead of `block` where supported.
|
|
61
77
|
|
|
62
78
|
### Module Report + Read Symbol (Read Substitute)
|
|
63
79
|
|
|
@@ -316,9 +332,9 @@ pi-lens ships an MCP (Model Context Protocol) server so Claude Code — or any M
|
|
|
316
332
|
| Layer | MCP tools | What they expose |
|
|
317
333
|
|---|---|---|
|
|
318
334
|
| **Per-edit** | `pilens_analyze`, `pilens_lsp_diagnostics`, `pilens_lsp_navigation`, `pilens_ast_grep_search`, `pilens_ast_grep_replace`, `pilens_module_report`, `pilens_read_symbol` | The fast pipeline (format → autofix → LSP diagnostics → parallel runners) plus the structured read-substitute pair. `analyze` accepts `mode: warm \| fresh` — `warm` reuses the server's in-process LSP, `fresh` forks a worker that loads freshly-built code from disk so the result reflects the latest commit. |
|
|
319
|
-
| **Per-turn** | `pilens_turn_end` | Drives the **real** `handleTurnEnd` (knip incremental,
|
|
320
|
-
| **Per-session** | `pilens_session_start` | Drives the **real** `handleSessionStart` — full jscpd/knip/madge/govulncheck/gitleaks/trivy scans + complexity baselines + LSP warm
|
|
321
|
-
| **Project / observability** | `pilens_project_scan`, `pilens_diagnostics`, `pilens_health`, `pilens_latency`, `pilens_symbol_search` | Cheap project-wide scans, cached diagnostic state, latency telemetry, ranked identifier search (BM25 over the persisted word index — see [docs/word-index.md](word-index.md)). Cross-file blast radius now lives in `pilens_module_report`'s `blastRadius` option. |
|
|
335
|
+
| **Per-turn** | `pilens_turn_end` | Drives the **real** `handleTurnEnd` (knip incremental, dep-circular, cascade, tests, actionable+code-quality warnings) — not a re-implementation. Caller-supplied edited files are auto-registered into turn-state via `addModifiedRange`. |
|
|
336
|
+
| **Per-session** | `pilens_session_start` | Drives the **real** `handleSessionStart` — full jscpd/knip/madge/govulncheck/gitleaks/trivy scans + complexity baselines + LSP warm. The error-debt baseline is not currently populated by the production session-start path. |
|
|
337
|
+
| **Project / observability** | `pilens_project_scan`, `pilens_diagnostics`, `pilens_health`, `pilens_latency`, `pilens_symbol_search` | Cheap project-wide scans, cached diagnostic state, latency telemetry, ranked identifier search (BM25 over the persisted word index — see [docs/word-index.md](word-index.md)). Cross-file blast radius now lives in `pilens_module_report`'s `blastRadius` option. `pilens_health` (and its pi-side `/lens-health` counterpart) also reports a bounded, process-local **degradation ledger** — trust refusals, mode suppressions, LSP breaker trips, formatter skips/failures, TypeScript/word-index/review-graph/project-snapshot idle evictions, WASM aborts, and diagnostics-timeout tallies — so silently degraded behavior stays visible instead of vanishing into a log. |
|
|
322
338
|
| **Lifecycle / loop** | `pilens_rebuild` | Runs `npm run build:dist` so `pilens_analyze mode=fresh` reflects the latest commit. Makes the review loop self-contained: commit → `pilens_rebuild` → `pilens_analyze mode=fresh` → `pilens_latency`. |
|
|
323
339
|
|
|
324
340
|
**Honest limits** (live-tested, documented in `mcp.md`):
|
|
@@ -341,4 +357,18 @@ claude mcp add --scope user pi-lens \
|
|
|
341
357
|
-- node <repo>/dist/mcp/server.js
|
|
342
358
|
```
|
|
343
359
|
|
|
360
|
+
**Hooks** (`settings.json`) close the loop: PostToolUse = per-edit, Stop = per-turn.
|
|
361
|
+
|
|
362
|
+
```json
|
|
363
|
+
{ "hooks": {
|
|
364
|
+
"PostToolUse": [
|
|
365
|
+
{ "matcher": "Edit|Write",
|
|
366
|
+
"hooks": [ { "type": "command", "command": "pi-lens-analyze --hook" } ] } ],
|
|
367
|
+
"Stop": [
|
|
368
|
+
{ "hooks": [ { "type": "command", "command": "pi-lens-analyze --turn-end", "timeout": 60 } ] } ]
|
|
369
|
+
} }
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
The per-edit hook falls back to a cold local analysis when no server is up; the `Stop` hook is **warm-server-only** because only the server process owns the session state and pending turn work. It skips with a single stderr line when unavailable. Workspace IPC requests are ordered, so a timed-out PostToolUse client cannot let `Stop` overtake analysis still running in the server. `SubagentStop` is deliberately not registered because subagent edits already reach turn-state through PostToolUse.
|
|
373
|
+
|
|
344
374
|
The full design + tier-by-tier progress (and known limits) lives in [`docs/mcp.md`](docs/mcp.md). Status: **experimental** — the foundation is solid (transport, warm LSP, lifecycle handlers wired), but the surface is still maturing. Use the pi extension for production agent work; reach for the MCP server for debugging, dogfooding, and direct Claude Code access.
|
package/docs/globalconfig.md
CHANGED
|
@@ -1,6 +1,42 @@
|
|
|
1
1
|
# Configuration
|
|
2
2
|
|
|
3
|
-
pi-lens reads optional user preferences from `~/.pi-lens/config.json` (`%USERPROFILE%\\.pi-lens\\config.json` on Windows).
|
|
3
|
+
pi-lens reads optional user preferences from `~/.pi-lens/config.json` (`%USERPROFILE%\\.pi-lens\\config.json` on Windows). An unrecognized top-level key is logged once (to surface a typo like `lps` for `lsp`) and then ignored; `$schema` is always allowed for editor JSON-schema association. Missing or invalid config falls back to defaults.
|
|
4
|
+
|
|
5
|
+
## Every toggle, both ways
|
|
6
|
+
|
|
7
|
+
Each runtime toggle is settable from the CLI *and* from `config.json`. The two are driven by one declarative registry (`clients/lens-flag-registry.ts`), so neither surface can gain a toggle the other lacks.
|
|
8
|
+
|
|
9
|
+
| CLI flag | `config.json` key | Default |
|
|
10
|
+
| --- | --- | --- |
|
|
11
|
+
| `--no-lens` | `lens.enabled` | `true` |
|
|
12
|
+
| `--no-lsp` | `lsp.enabled` | `true` |
|
|
13
|
+
| `--no-tests` | `tests.enabled` | `true` |
|
|
14
|
+
| `--no-delta` | `delta.enabled` | `true` |
|
|
15
|
+
| `--no-opengrep` | `opengrep.enabled` | `true` |
|
|
16
|
+
| `--no-read-guard` | `readGuard.enabled` | `true` |
|
|
17
|
+
| `--no-autoformat` | `format.enabled` | `true` |
|
|
18
|
+
| `--no-autofix` | `autofix.enabled` | `true` |
|
|
19
|
+
| `--no-lens-context` | `contextInjection.enabled` | `true` |
|
|
20
|
+
| `--lens-guard` | `guard.enabled` | `false` |
|
|
21
|
+
| `--immediate-format` | `format.mode` (`"immediate"`) | `"deferred"` |
|
|
22
|
+
| `--lens-turn-summary` | `turnSummary.enabled` | `false` |
|
|
23
|
+
| `--lens-actionable-warnings` | `actionableWarnings.enabled` | `false` |
|
|
24
|
+
| `--lens-actionable-warning-actions` | `actionableWarnings.includeLspCodeActions` | `false` |
|
|
25
|
+
| `--lens-actionable-warning-autofix` | `actionableWarnings.autoFix.enabled` | `false` |
|
|
26
|
+
| `--lens-actionable-warning-all` | `actionableWarnings.deltaOnly` (`false`) | `true` |
|
|
27
|
+
| `--lens-compact-tool-line` | `ui.compactToolLine` | `false` |
|
|
28
|
+
|
|
29
|
+
Keys are positive (`"enabled": true` means the feature runs), so a `--no-*` flag corresponds to setting its key `false`. A `no-*` flag on the command line is a one-way switch: it can disable, never re-enable, so `--no-lsp` wins over `lsp.enabled: true` but nothing on the CLI overrides `lsp.enabled: false`. Set the key back to `true` to re-enable.
|
|
30
|
+
|
|
31
|
+
Resolution order for a single toggle, highest first:
|
|
32
|
+
|
|
33
|
+
1. Environment variable, where one is bound (`PI_LENS_NO_CONTEXT_INJECTION=1`).
|
|
34
|
+
2. The CLI flag.
|
|
35
|
+
3. The nearest `.pi-lens.json` that defines the key, for the three mutation controls only (see [Mutation controls](#mutation-controls)).
|
|
36
|
+
4. `~/.pi-lens/config.json`.
|
|
37
|
+
5. The built-in default.
|
|
38
|
+
|
|
39
|
+
## Examples
|
|
4
40
|
|
|
5
41
|
Hide the diagnostics widget by default, run formatting immediately after write/edit tool calls instead of at `agent_end`, and enable actionable warnings with conservative autofix:
|
|
6
42
|
|
|
@@ -41,14 +77,30 @@ Hide the diagnostics widget by default, run formatting immediately after write/e
|
|
|
41
77
|
|
|
42
78
|
`contextInjection.enabled` (default `true`) controls whether pi-lens prepends automatic findings — session-start guidance, turn-end findings, and test findings — into the next model turn. Set it to `false` (or use `--no-lens-context` / `PI_LENS_NO_CONTEXT_INJECTION=1` / `/lens-context-toggle`) to keep tools, LSP, read-guard, and formatting running while avoiding the prompt-cache invalidation that injected messages cause in long, cache-sensitive sessions. Findings are still cached, so `lens_diagnostics` and `/lens-health` keep working.
|
|
43
79
|
|
|
44
|
-
`actionableWarnings.enabled` gates the turn_end report. `includeLspCodeActions` fetches LSP code actions for each warning (requires an active language server). `deltaOnly` (default `true`) limits the report to lines touched in the current turn. `autoFix.enabled` applies conservative LSP quickfixes at `agent_end`; `autoFix.maxFixes` caps the number applied per turn (default `5
|
|
80
|
+
`actionableWarnings.enabled` gates the turn_end report. `includeLspCodeActions` fetches LSP code actions for each warning (requires an active language server). `deltaOnly` (default `true`) limits the report to lines touched in the current turn. `autoFix.enabled` applies conservative LSP quickfixes at `agent_end`; `autoFix.maxFixes` caps the number applied per turn (default `5`, must be a non-negative whole number). `maxFixes: 0` keeps the report and applies nothing, which is a useful halfway step before enabling `autoFix` for real. Unlike the toggles in the table above there is no CLI counterpart, since it takes a number rather than being on or off.
|
|
45
81
|
|
|
46
82
|
`ignore` is an array of gitignore-style glob patterns excluded from pi-lens scans across **every** project — the global counterpart to the per-project `.pi-lens.json` `ignore` below. Precedence is lowest: a project `.gitignore` or `.pi-lens.json` (including a `!negation`) overrides it, so you can globally hide e.g. `scratch/**` and still re-include it in one repo.
|
|
47
83
|
|
|
84
|
+
Turn subsystems off globally instead of retyping flags every session:
|
|
85
|
+
|
|
86
|
+
```json
|
|
87
|
+
{
|
|
88
|
+
"lsp": { "enabled": false },
|
|
89
|
+
"tests": { "enabled": false },
|
|
90
|
+
"opengrep": { "enabled": false },
|
|
91
|
+
"readGuard": { "enabled": false },
|
|
92
|
+
"guard": { "enabled": true }
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
`lens.enabled: false` starts every session with pi-lens off (the `--no-lens` equivalent); `/lens-toggle` still re-enables it for one session. `lsp.enabled: false` falls back to language-specific checkers such as pyright. `tests.enabled: false` skips the on-write test runner. `delta.enabled: false` reports every diagnostic rather than only ones introduced this turn. `opengrep.enabled: false` detaches the Opengrep security scanner. `readGuard.enabled: false` turns off the read-before-edit monitor. `guard.enabled: true` opts into the experimental commit/push blocker.
|
|
97
|
+
|
|
48
98
|
## Project Config
|
|
49
99
|
|
|
50
100
|
In addition to the user-level `~/.pi-lens/config.json` above, pi-lens reads a per-project `.pi-lens.json` (or `pi-lens.json`) at the project root. Walked upward from the cwd, so a monorepo can keep the config at the repo root and have every subdir pick it up. The schema is intentionally small — only fields pi-lens actually honors:
|
|
51
101
|
|
|
102
|
+
Note that most toggles from the table above are **user-level only**. Of them, a project config honors just the three [mutation controls](#mutation-controls) (`format.enabled`, `autofix.enabled`, `actionableWarnings.autoFix.enabled`). Putting a user-level toggle such as `"lsp": { "enabled": false }` in a `.pi-lens.json` is **not** honored at project scope; pi-lens now logs a one-time warning saying so rather than dropping it silently, so you get a signal instead of a setting that quietly does nothing. Set it in `~/.pi-lens/config.json` or pass `--no-lsp` instead. A genuinely unrecognized key (a typo) is likewise logged once. Foreign namespaces that a shared `.pi-lens.json` legitimately carries for the LSP loader (`servers`, `serverOverrides`, `disabledServers`, `warmFiles`) and `$schema` are tolerated without warning.
|
|
103
|
+
|
|
52
104
|
```json
|
|
53
105
|
{
|
|
54
106
|
"ignore": [
|
|
@@ -116,16 +168,58 @@ Note: `maxProjectFiles` (below) is discovered differently — via an upward walk
|
|
|
116
168
|
|
|
117
169
|
### `rules`
|
|
118
170
|
|
|
119
|
-
Per-rule threshold overrides. Currently honored:
|
|
171
|
+
Per-rule threshold overrides and policy filters. Currently honored:
|
|
120
172
|
|
|
121
173
|
- `high-complexity.threshold` — cyclomatic complexity (default `15`)
|
|
122
174
|
- `high-fan-out.threshold` — distinct function calls (default `20`)
|
|
175
|
+
- `<id>.disable` — disable diagnostics for the listed rule ids (output-only
|
|
176
|
+
filter). Same rule-id normalization as `pi-lens-ignore`: a user lists
|
|
177
|
+
`no-eval` once and the filter covers `no-eval`, `ast-grep:no-eval`, and
|
|
178
|
+
`no-eval-js`. Side effect: a rule whose real name genuinely ends in `-js`
|
|
179
|
+
(e.g. `prefer-js`) is conflated with its stem (`prefer`) — disabling or
|
|
180
|
+
selecting one also disables or selects the other.
|
|
181
|
+
- `<id>.select` — allowlist of rule ids; only the listed rule ids survive
|
|
182
|
+
filtering. Disable wins over select project-wide, even when the two lists
|
|
183
|
+
are configured under different keys.
|
|
184
|
+
|
|
185
|
+
The `<id>` key is a grouping label only — it does not scope which rules the
|
|
186
|
+
`disable`/`select` list underneath it can match. Matching is **project-wide**:
|
|
187
|
+
every `disable` list across every key is unioned into one drop list, and
|
|
188
|
+
every `select` list across every key is unioned into one allowlist. So
|
|
189
|
+
`"security": { "disable": ["no-eval"] }` disables `no-eval` regardless of
|
|
190
|
+
`security` being the rule's own id, and two keys can each contribute to the
|
|
191
|
+
same select union.
|
|
192
|
+
|
|
193
|
+
```json
|
|
194
|
+
{
|
|
195
|
+
"rules": {
|
|
196
|
+
"high-complexity": { "threshold": 25 },
|
|
197
|
+
"high-fan-out": { "threshold": 30 },
|
|
198
|
+
"no-eval": { "disable": ["no-eval", "no-eval-js", "ast-grep:no-eval"] },
|
|
199
|
+
"my-rule-set": { "select": ["rule-a", "rule-b"] }
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
**Warning:** because select is project-wide, a non-empty `select` list
|
|
205
|
+
*anywhere* in `rules` silences every rule not in that list, across the whole
|
|
206
|
+
project — including tsc/eslint findings, not just the rule types you're
|
|
207
|
+
thinking about when you write it. It's a big hammer; reach for `disable`
|
|
208
|
+
instead unless you actually want an allowlist over everything. Findings that
|
|
209
|
+
carry no rule id at all (an eslint parse error, for example) are exempt from
|
|
210
|
+
select, so an allowlist can never hide them.
|
|
211
|
+
|
|
212
|
+
Disable and select are output-only filters applied AFTER inline suppression,
|
|
213
|
+
disposition, and dedup — the project-level policy never widens the trusted
|
|
214
|
+
surface area (widget state, baseline, dedup cache stay authoritative). The
|
|
215
|
+
baseline still records the full unfiltered set so a project-config edit does
|
|
216
|
+
not corrupt delta baselines.
|
|
123
217
|
|
|
124
218
|
### `maxProjectFiles`
|
|
125
219
|
|
|
126
220
|
Single scale knob (default `2000`) that a large-but-healthy repo can raise to scale five independent size budgets together instead of tripping each one separately: the project-diagnostics scanner (0.25×, default 500 files), the review graph (0.5× up to a point, default 1,000 files — see below), the startup scan (1×, default 2,000 source files), jscpd (3×, default 6,000 directory entries), and the word index (3×, default 6,000 files). Raising it (e.g. to `5000`) scales all five proportionally. Each subsystem's own environment-variable override (e.g. `PI_LENS_REVIEW_GRAPH_MAX_FILES`, `PI_LENS_STARTUP_SCAN_MAX_ENTRIES`) still takes precedence over this knob when set, and a separate `PI_LENS_MAX_PROJECT_FILES` environment variable sits below `maxProjectFiles` but above the built-in default. See `clients/project-scale.ts` for the full ratio table and precedence order.
|
|
127
221
|
|
|
128
|
-
Unlike the other four, the review graph's budget stops scaling flatly at 0.5× once `maxProjectFiles` climbs past 4,000 — it tapers toward a 5,000-file ceiling instead of growing unbounded (#775).
|
|
222
|
+
Unlike the other four, the review graph's budget stops scaling flatly at 0.5× once `maxProjectFiles` climbs past 4,000 — it tapers toward a 5,000-file ceiling instead of growing unbounded (#775). Its higher per-file cold-build cost bounds this default file budget independently of the graph's disk-persist circuit-breaker, whose measured default is now 500,000 elements (#936; override with `PI_LENS_GRAPH_PERSIST_MAX_ELEMENTS`). An over-cap graph persists a centrality-ranked partial snapshot with explicit total-versus-persisted coverage; read-only orientation may use it, but incremental builds never reuse it as a complete base. Below the 4,000 threshold (which covers every typical/default-sized project) it's the same flat 0.5× ratio as before. See `reviewGraph.maxFiles` below for an explicit opt-in past the taper.
|
|
129
223
|
|
|
130
224
|
### `reviewGraph.maxFiles`
|
|
131
225
|
|
|
@@ -141,9 +235,11 @@ Explicit override for the review graph's own file budget (#775), for monorepos t
|
|
|
141
235
|
|
|
142
236
|
### Schema rules
|
|
143
237
|
|
|
144
|
-
- Unknown top-level keys and
|
|
238
|
+
- Unknown rule ids are ignored (forward-compat). Unrecognized **top-level** keys are logged once and then ignored — never fatal to the parse. The LSP namespaces a shared file legitimately carries (`servers`, `serverOverrides`, `disabledServers`, `warmFiles`) and `$schema` are tolerated silently; a user-level-only lens key placed here (e.g. `lsp`, `tests`, `delta`) is logged as "not honored at project scope"; anything else is logged as a likely typo. The raw parsed JSON is still exposed for forward-compat consumers regardless.
|
|
239
|
+
- Every toggle key in the table above must be a boolean, and its containing section must be an object. A wrong type is logged once and the key is treated as absent, so the flag falls through to its default rather than the whole file being rejected.
|
|
145
240
|
- A malformed JSON file is logged once and treated as "no config" — your diagnostics never get blocked by a syntax error in your own config.
|
|
146
241
|
- Rule thresholds must be positive finite numbers; invalid, zero, or negative values are logged once and ignored.
|
|
147
242
|
- Mutation-control `enabled` values must be booleans; invalid values are logged once and ignored.
|
|
243
|
+
- `rules.<id>.disable` and `rules.<id>.select` must each be a non-empty array of non-empty strings; a non-array value, an empty array, or an all-whitespace array is logged once and the entry is dropped. A policy-only entry (no `threshold`) is honored. A policy entry with an invalid value still keeps any valid `threshold` alongside it.
|
|
148
244
|
- The depth sub-threshold of `high-complexity` (default `6`) is intentionally not exposed; only the cyclomatic-complexity knob ships today to keep the schema tight.
|
|
149
245
|
- The file is mtime-cached, so editing it takes effect on the next scan without restarting the agent.
|
|
@@ -15,13 +15,13 @@ Dispatch is diagnostics-oriented: automatic formatting and safe autofix happen i
|
|
|
15
15
|
| Ruby | ✓ | lsp, rubocop, tree-sitter | rubocop, standardrb |
|
|
16
16
|
| C/C++ | ✓ | lsp, cpp-check, tree-sitter | clang-format |
|
|
17
17
|
| Shell | ✓ | lsp, shellcheck | shfmt |
|
|
18
|
-
| Fish | ✓
|
|
18
|
+
| Fish | ✓ (fish-lsp) | lsp, fish-indent | fish_indent |
|
|
19
19
|
| CSS/SCSS/Less | ✓ | lsp, stylelint | biome, prettier |
|
|
20
20
|
| HTML | ✓ | lsp, htmlhint | prettier |
|
|
21
21
|
| YAML | ✓ | lsp, yamllint, actionlint (GitHub workflows) | prettier |
|
|
22
22
|
| JSON | ✓ | lsp | biome, prettier |
|
|
23
|
-
| Svelte | ✓ | lsp |
|
|
24
|
-
| Vue | ✓ | lsp |
|
|
23
|
+
| Svelte | ✓ | lsp | oxfmt (needs `svelte` pkg installed + config `svelte: true`) |
|
|
24
|
+
| Vue | ✓ | lsp | prettier, oxfmt |
|
|
25
25
|
| SQL | — | sqlfluff | sqlfluff |
|
|
26
26
|
| Markdown | — | spellcheck, markdownlint, vale | prettier |
|
|
27
27
|
| Docker | ✓ | lsp, hadolint | — |
|
|
@@ -42,7 +42,8 @@ Dispatch is diagnostics-oriented: automatic formatting and safe autofix happen i
|
|
|
42
42
|
| Gleam | ✓ | lsp, gleam-check | gleam format |
|
|
43
43
|
| OCaml | ✓ | lsp | ocamlformat |
|
|
44
44
|
| Clojure | ✓ | lsp | cljfmt |
|
|
45
|
-
| Terraform | ✓ | lsp, tflint
|
|
45
|
+
| Terraform | ✓ | lsp, tflint, trivy-config (opt-in) | terraform fmt |
|
|
46
|
+
| Terragrunt | — | terragrunt | terragrunt hcl fmt |
|
|
46
47
|
| Nix | ✓ | lsp | nixfmt |
|
|
47
48
|
| TOML | ✓ | lsp, taplo | taplo |
|
|
48
|
-
| CMake | ✓
|
|
49
|
+
| CMake | ✓ (cmake-language-server) | lsp | cmake-format |
|
|
@@ -18,7 +18,7 @@ regenerated docs — so this file self-populates from CI without manual copy-pas
|
|
|
18
18
|
|
|
19
19
|
`probe-clean-signal.mjs` also runs a **drift check** (#529): it compares each
|
|
20
20
|
probed server's observed `clean-behavior` against the hand-set `silentOnClean`
|
|
21
|
-
marker in `clients/lsp/
|
|
21
|
+
marker in `clients/lsp/wait-policy/strategies.ts` and writes any mismatch to the
|
|
22
22
|
`## silentOnClean drift` section below. This is telemetry only — never a CI
|
|
23
23
|
gate — because the probe is a timing-based negative observation; a mismatch
|
|
24
24
|
just tells a human the marker may need updating. `unknown` observations are
|
|
@@ -150,7 +150,7 @@ the rest fill in as the nightly reaches them.
|
|
|
150
150
|
## silentOnClean drift (nightly-generated)
|
|
151
151
|
|
|
152
152
|
Telemetry only — never a CI gate. Compares each probed server's observed
|
|
153
|
-
`clean-behavior` against `clients/lsp/
|
|
153
|
+
`clean-behavior` against `clients/lsp/wait-policy/strategies.ts`'s `silentOnClean`
|
|
154
154
|
marker; a mismatch means the marker may need a human update (#529). `unknown`
|
|
155
155
|
observations are never compared (a slow/absent server is not evidence either way).
|
|
156
156
|
|
package/docs/mcp.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# pi-lens as an MCP server — implementation plan
|
|
2
2
|
|
|
3
|
-
> Local working doc.
|
|
3
|
+
> Local working doc. Tracks the design + progress for exposing
|
|
4
4
|
> pi-lens to Claude (Claude Code) as an MCP server, built so a *real review loop*
|
|
5
5
|
> can be created (Claude commits → Claude measures the commit's actual impact,
|
|
6
6
|
> not inferred from logs the user pastes).
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
The host coupling is **thin**. Everything under `clients/` operates on
|
|
19
19
|
`(filePath, content, cwd)` — the host SDK (`@earendil-works/pi-coding-agent`) is
|
|
20
|
-
imported **only** in `index.ts` (the pi adapter)
|
|
20
|
+
imported **only** in `index.ts` (the pi adapter) and tests.
|
|
21
21
|
|
|
22
22
|
Confirmed reuse points:
|
|
23
23
|
|
|
@@ -244,12 +244,12 @@ Initial assumption ("knip/jscpd are booboo-only") was **wrong**. Verified:
|
|
|
244
244
|
|-------|---------|------|
|
|
245
245
|
| per-edit | `dispatchLintWithResult` | LSP, tree-sitter, ast-grep, fact-rules, biome/ruff/eslint/oxlint |
|
|
246
246
|
| per-turn | `handleTurnEnd` (`runtime-turn.ts`) | **knip** (`:298`), **jscpd** (incremental, `getFilesForJscpd`), **madge/dep circular** (`:426`), **cascade merge** (`:175`), **tests** (`:461`), actionable/code-quality warnings aggregation, project-diagnostics delta |
|
|
247
|
-
| per-session | `handleSessionStart` (`runtime-session.ts`) | **jscpd full scan** (`:505`), knip, type-coverage, dep, govulncheck, gitleaks, todo, complexity baselines, dominant-language **LSP warm** (#203)
|
|
247
|
+
| per-session | `handleSessionStart` (`runtime-session.ts`) | **jscpd full scan** (`:505`), knip, type-coverage, dep, govulncheck, gitleaks, todo, complexity baselines, dominant-language **LSP warm** (#203). The production path does not currently populate the error-debt baseline. |
|
|
248
248
|
|
|
249
|
-
The MCP
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
249
|
+
The initial MCP implementation invoked **none** of the lifecycle handlers —
|
|
250
|
+
only the per-edit layer. The shipped server now exposes `pilens_session_start`
|
|
251
|
+
and `pilens_turn_end`, which drive the real handlers; `fresh` analysis still
|
|
252
|
+
pays a cold LSP because it starts a new worker without session-start warming.
|
|
253
253
|
|
|
254
254
|
## Revised recommendation — drive the real lifecycle, don't re-plumb
|
|
255
255
|
|
|
@@ -272,7 +272,8 @@ Rather than re-implementing knip/jscpd/cascade/warnings as bespoke MCP tools,
|
|
|
272
272
|
**run pi's own handlers**:
|
|
273
273
|
|
|
274
274
|
- `pilens_session_start` (or auto-init on first call) → `handleSessionStart` →
|
|
275
|
-
jscpd/knip/type-cov/dep full scan +
|
|
275
|
+
jscpd/knip/type-cov/dep full scan + LSP warm (the error-debt baseline is not
|
|
276
|
+
currently populated by the production session-start path; this also
|
|
276
277
|
fixes D at the source).
|
|
277
278
|
- `pilens_turn_end` → `handleTurnEnd` → knip/jscpd incremental + cascade + dep +
|
|
278
279
|
tests + the actionable/code-quality aggregation.
|
|
@@ -281,12 +282,13 @@ Rather than re-implementing knip/jscpd/cascade/warnings as bespoke MCP tools,
|
|
|
281
282
|
This reconstructs the genuine **edit → turn → session** loop and answers the
|
|
282
283
|
knip/jscpd/cascade/warnings questions "for free" (same code pi runs). Cost: wire
|
|
283
284
|
the `deps` bundle the handlers need — `loadBootstrapClients()` (host-neutral) +
|
|
284
|
-
`getFlag`/`notify` stubs + a `RuntimeCoordinator`.
|
|
285
|
-
`turn_end` wiring
|
|
285
|
+
`getFlag`/`notify` stubs + a `RuntimeCoordinator`. This was the original wiring
|
|
286
|
+
cost; `index.ts`'s `session_start`/`turn_end` wiring remains the exact template
|
|
287
|
+
and the shipped `clients/mcp/session.ts` keeps the coupling thin.
|
|
286
288
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
289
|
+
An error-debt baseline would allow the MCP to report whether a change flipped
|
|
290
|
+
tests/build from green to red, but the production session-start path does not
|
|
291
|
+
currently populate that baseline, so this regression delta is not available.
|
|
290
292
|
|
|
291
293
|
### Plan: Tier 1 then Tier 2
|
|
292
294
|
|
|
@@ -335,9 +337,8 @@ needed for `fresh` (new process) and for files outside the warmed dominant langu
|
|
|
335
337
|
session unit tests; live `pilens_session_start` smoke confirmed end-to-end.
|
|
336
338
|
- This exposes the previously-absent layers: knip dead-code, jscpd duplication,
|
|
337
339
|
dep-circular, tests, cascade, actionable/code-quality aggregation (turn_end);
|
|
338
|
-
LSP warm +
|
|
339
|
-
|
|
340
|
-
(tests/build pass-state); turn_end writes the pending check against it.
|
|
340
|
+
LSP warm + complexity baselines + project scans (session_start). The
|
|
341
|
+
error-debt baseline remains unpopulated by the production session-start path.
|
|
341
342
|
- [ ] Tier 2 follow-ups: have warm `pilens_analyze` auto-register edited files into
|
|
342
343
|
turn-state (so `turn_end` needs no explicit file list); surface the error-debt
|
|
343
344
|
green→red delta directly in the turn_end result; let session_start optionally
|
|
@@ -377,13 +378,18 @@ be exercised + debugged directly through Claude Code without running pi.
|
|
|
377
378
|
Wire it in Claude Code `settings.json`:
|
|
378
379
|
|
|
379
380
|
```json
|
|
380
|
-
{ "hooks": {
|
|
381
|
-
|
|
382
|
-
|
|
381
|
+
{ "hooks": {
|
|
382
|
+
"PostToolUse": [
|
|
383
|
+
{ "matcher": "Edit|Write",
|
|
384
|
+
"hooks": [ { "type": "command", "command": "pi-lens-analyze --hook" } ] } ],
|
|
385
|
+
"Stop": [
|
|
386
|
+
{ "hooks": [ { "type": "command", "command": "pi-lens-analyze --turn-end", "timeout": 60 } ] } ]
|
|
387
|
+
} }
|
|
383
388
|
```
|
|
384
389
|
|
|
385
390
|
(the cold-LSP fix means the type-check is honestly reported as skipped, not a
|
|
386
|
-
false clean; the agent pulls `pilens_analyze` warm when it wants types.
|
|
391
|
+
false clean; the agent pulls `pilens_analyze` warm when it wants types. The
|
|
392
|
+
`Stop` half is the per-turn pass — see the bullet below.)
|
|
387
393
|
|
|
388
394
|
- [ ] **booboo** full-codebase review tool (`/lens-booboo` → handleBooboo:
|
|
389
395
|
complexity, AI-slop, TODOs, dead-code, dupes, type-coverage).
|
|
@@ -409,6 +415,34 @@ be exercised + debugged directly through Claude Code without running pi.
|
|
|
409
415
|
project. 5 IPC unit tests (path stability, named-pipe round-trip, no-server +
|
|
410
416
|
error → undefined fallback); live-proven (server "warm analyze" log fired,
|
|
411
417
|
bin returned the diagnostic). Removes the one real weakness of the push half.
|
|
418
|
+
- [x] **Stop hook → per-turn pass** (#538) — the `pi-lens-analyze` bin gains a
|
|
419
|
+
turn-end mode (`--turn-end`, or a Claude Code `Stop` payload on stdin), the
|
|
420
|
+
analogue of pi's `agent_end`: incremental knip/madge, dep-circular,
|
|
421
|
+
cascade-to-dependents, tests, actionable-warnings aggregation. PostToolUse has
|
|
422
|
+
already accumulated the edited files into turn-state by the time `Stop` fires,
|
|
423
|
+
so the hook passes no files and clears any inherited pi `sessionId` — turn-
|
|
424
|
+
end's stale-session eviction leaves the registered worklist alone. The request is a
|
|
425
|
+
tagged route (`{route:"turn-end"}`, own schema version) on the **workspace**
|
|
426
|
+
socket, not the PID-scoped one: a Stop hook knows its cwd, never the server's
|
|
427
|
+
pid. It rides in ahead of the parse, so it inherits the #535 build-staleness
|
|
428
|
+
gate for free, and an untagged analyze request on the same socket is byte-for-
|
|
429
|
+
byte unchanged. All workspace IPC requests share one server-side queue, so a
|
|
430
|
+
timed-out PostToolUse client cannot let `Stop` overtake analysis still running
|
|
431
|
+
in the server, and concurrent turn-ends cannot race the turn-state clear.
|
|
432
|
+
**Warm-only, no cold fallback**: only the server process owns the session state
|
|
433
|
+
and pending turn work, so a local pass would report a false clean — no warm
|
|
434
|
+
server means one stderr line, silent stdout, exit 0.
|
|
435
|
+
The client waits 55s so it gives up inside Claude Code's 60s hook timeout.
|
|
436
|
+
`SubagentStop` is deliberately NOT registered: subagent edits already fire
|
|
437
|
+
PostToolUse into the shared turn-state, the consume bridges are one-shot (a
|
|
438
|
+
subagent pass would eat the main agent's findings into a transcript nobody
|
|
439
|
+
reads), and the fan-out would multiply the heavy pass. Visibility, honestly:
|
|
440
|
+
Stop-hook stdout is user-visible in transcript mode (Ctrl-R), NOT model
|
|
441
|
+
context — blockers still gate commits through the retained lens-guard record,
|
|
442
|
+
and a `decision:"block"` render is a follow-up. Tests run fire-and-forget
|
|
443
|
+
inside turn-end, so the `Tests:` section you see is the *previous* turn's
|
|
444
|
+
failures. Unit, bin, and live-route smoke tests cover transport, ordering,
|
|
445
|
+
rendering, and spawned-server behavior.
|
|
412
446
|
|
|
413
447
|
## Transport decision — RESOLVED: hand-roll (zero new deps)
|
|
414
448
|
|
|
@@ -6,7 +6,7 @@ server's `initialize` handshake. Generated by `node scripts/server-capabilities.
|
|
|
6
6
|
absent on the generating host are listed under *Unavailable* — run in a
|
|
7
7
|
provisioned environment (the nightly) to capture those rows.
|
|
8
8
|
|
|
9
|
-
_Last generated: 2026-
|
|
9
|
+
_Last generated: 2026-08-14 on linux; 29 servers captured, 14 unavailable._
|
|
10
10
|
|
|
11
11
|
## Diagnostic mode + navigation/edit operations
|
|
12
12
|
|
|
@@ -19,7 +19,7 @@ Legend: ✓ advertised, · not. **mode** = document diagnostics (`pull` = `textD
|
|
|
19
19
|
| clojure | push-only | · | ✓ | · | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | 62 |
|
|
20
20
|
| csharp | pull | ✓ | ✓ | ✓ | · | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | 0 |
|
|
21
21
|
| css | pull | · | ✓ | · | · | ✓ | ✓ | · | ✓ | · | ✓ | ✓ | · | · | 0 |
|
|
22
|
-
| dart | push-only | · | ✓ | ✓ | · | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
|
|
22
|
+
| dart | push-only | · | ✓ | ✓ | · | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | 18 |
|
|
23
23
|
| deno | pull | · | ✓ | ✓ | · | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | 2 |
|
|
24
24
|
| docker | push-only | · | ✓ | · | · | · | ✓ | ✓ | ✓ | · | · | ✓ | · | · | 0 |
|
|
25
25
|
| expert | push-only | · | ✓ | · | · | ✓ | ✓ | · | ✓ | ✓ | ✓ | · | · | · | 2 |
|
|
@@ -59,7 +59,7 @@ Legend: ✓ advertised, · not. **mode** = document diagnostics (`pull` = `textD
|
|
|
59
59
|
- **docker**: codeActionProvider, completionProvider, definitionProvider, documentFormattingProvider, documentHighlightProvider, documentLinkProvider, documentOnTypeFormattingProvider, documentRangeFormattingProvider, documentSymbolProvider, foldingRangeProvider, hoverProvider, renameProvider, signatureHelpProvider, textDocumentSync
|
|
60
60
|
- **expert**: codeActionProvider, codeLensProvider, completionProvider, definitionProvider, documentFormattingProvider, documentSymbolProvider, executeCommandProvider, experimental, hoverProvider, referencesProvider, textDocumentSync, workspace, workspaceSymbolProvider
|
|
61
61
|
- **fsharp**: callHierarchyProvider, codeActionProvider, codeLensProvider, completionProvider, definitionProvider, documentFormattingProvider, documentHighlightProvider, documentRangeFormattingProvider, documentSymbolProvider, foldingRangeProvider, hoverProvider, implementationProvider, inlayHintProvider, inlineValueProvider, referencesProvider, renameProvider, selectionRangeProvider, semanticTokensProvider, signatureHelpProvider, textDocumentSync, typeDefinitionProvider, workspaceSymbolProvider
|
|
62
|
-
- **gleam**: codeActionProvider, completionProvider, definitionProvider, documentFormattingProvider, documentHighlightProvider, documentSymbolProvider, foldingRangeProvider, hoverProvider, referencesProvider, renameProvider, signatureHelpProvider, textDocumentSync, typeDefinitionProvider
|
|
62
|
+
- **gleam**: codeActionProvider, completionProvider, definitionProvider, documentFormattingProvider, documentHighlightProvider, documentSymbolProvider, foldingRangeProvider, hoverProvider, referencesProvider, renameProvider, signatureHelpProvider, textDocumentSync, typeDefinitionProvider, workspace
|
|
63
63
|
- **go**: callHierarchyProvider, codeActionProvider, codeLensProvider, completionProvider, definitionProvider, documentFormattingProvider, documentHighlightProvider, documentLinkProvider, documentSymbolProvider, executeCommandProvider, experimental, foldingRangeProvider, hoverProvider, implementationProvider, inlayHintProvider, referencesProvider, renameProvider, selectionRangeProvider, semanticTokensProvider, signatureHelpProvider, textDocumentSync, typeDefinitionProvider, typeHierarchyProvider, workspace, workspaceSymbolProvider
|
|
64
64
|
- **html**: colorProvider, definitionProvider, diagnosticProvider, documentFormattingProvider, documentHighlightProvider, documentLinkProvider, documentRangeFormattingProvider, documentSymbolProvider, foldingRangeProvider, hoverProvider, linkedEditingRangeProvider, referencesProvider, renameProvider, selectionRangeProvider, signatureHelpProvider, textDocumentSync
|
|
65
65
|
- **json**: codeActionProvider, colorProvider, diagnosticProvider, documentFormattingProvider, documentLinkProvider, documentRangeFormattingProvider, documentSymbolProvider, foldingRangeProvider, hoverProvider, selectionRangeProvider, textDocumentSync
|
|
@@ -89,7 +89,7 @@ surface, including providers pi-lens does not yet consume.
|
|
|
89
89
|
|
|
90
90
|
- **ast-grep** (1): ast-grep.applyAllFixes
|
|
91
91
|
- **clojure** (62): add-import-to-namespace, add-missing-import, add-missing-libspec, add-require-suggestion, as-to-refer, backward, backward-barf, backward-select, backward-slurp, change-coll, clean-ns, cond->if-refactor, create-function, create-test, cursor-info, cycle-coll, cycle-keyword-auto-resolve, cycle-privacy, demote-fn, destructure-keys, drag-backward, drag-forward, drag-param-backward, drag-param-forward, expand-let, extract-function, extract-to-def, forward, forward-barf, forward-select, forward-slurp, get-in-all, get-in-less, get-in-more, get-in-none, if->cond-refactor, inline-function, inline-symbol, introduce-let, kill-sexp, …
|
|
92
|
-
- **dart** (
|
|
92
|
+
- **dart** (18): dart.edit.codeAction.apply, dart.edit.sortMembers, dart.edit.organizeImports, dart.edit.fixAll, dart.edit.fixAllInWorkspace.preview, dart.edit.fixAllInWorkspace, dart.edit.sendWorkspaceEdit, refactor.perform, refactor.validate, dart.logAction, dart.refactor.add_constructor_name, dart.refactor_add.import_prefix, dart.refactor.convert_all_formal_parameters_to_named, dart.refactor.convert_selected_formal_parameters_to_named, dart.refactor.move_selected_formal_parameters_left, dart.refactor.move_top_level_to_file, dart.refactor.remove_constructor_name, dart.refactor.remove_import_prefix
|
|
93
93
|
- **deno** (2): deno.cache, deno.reloadImportRegistries
|
|
94
94
|
- **expert** (2): Reindex, connectionDetails
|
|
95
95
|
- **go** (47): gopls.add_dependency, gopls.add_import, gopls.add_telemetry_counters, gopls.add_test, gopls.apply_fix, gopls.assembly, gopls.change_signature, gopls.check_upgrades, gopls.client_open_url, gopls.diagnose_files, gopls.doc, gopls.edit_go_directive, gopls.extract_to_new_file, gopls.fetch_vulncheck_result, gopls.free_symbols, gopls.gc_details, gopls.generate, gopls.go_get_package, gopls.implement_interface, gopls.list_imports, gopls.list_known_packages, gopls.lsp, gopls.maybe_prompt_for_telemetry, gopls.mem_stats, gopls.modify_tags, gopls.modules, gopls.move_type, gopls.package_symbols, gopls.packages, gopls.regenerate_cgo, gopls.remove_dependency, gopls.reset_go_mod_diagnostics, gopls.run_go_work_command, gopls.run_govulncheck, gopls.run_tests, gopls.scan_imports, gopls.split_package, gopls.start_debugging, gopls.start_profile, gopls.stop_profile, …
|
|
@@ -105,8 +105,11 @@ surface, including providers pi-lens does not yet consume.
|
|
|
105
105
|
Toolchain/binary not installed here, so capabilities weren't captured
|
|
106
106
|
(many are the toolchain-gated family tracked in #241):
|
|
107
107
|
|
|
108
|
+
- @prisma/language-server
|
|
108
109
|
- PowerShell Editor Services (pwsh Start-EditorServices.ps1 -Stdio)
|
|
109
110
|
- clangd
|
|
111
|
+
- cmake-language-server
|
|
112
|
+
- fish-lsp
|
|
110
113
|
- haskell-language-server
|
|
111
114
|
- intelephense
|
|
112
115
|
- jdtls
|