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/settings.md
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
# Settings
|
|
2
|
+
|
|
3
|
+
How pi-lens is configured, and what you can change. This page is the overview
|
|
4
|
+
hub. For the full per-field docs of the config JSON, see the
|
|
5
|
+
[Configuration reference](./globalconfig.md); for the complete environment-variable
|
|
6
|
+
reference, see [Environment variables](./environment-variables.md); for the CLI
|
|
7
|
+
flags in context, see [Usage](./usage.md).
|
|
8
|
+
|
|
9
|
+
pi-lens ships with sensible defaults, so **zero configuration is needed** — it
|
|
10
|
+
works out of the box. Everything below is optional tuning.
|
|
11
|
+
|
|
12
|
+
## The three ways to configure pi-lens
|
|
13
|
+
|
|
14
|
+
1. **Environment variables** (`PI_LENS_*`) — read at process start; set them in
|
|
15
|
+
the shell that launches pi, your process manager, or CI. Best for machine- or
|
|
16
|
+
CI-scoped switches and for the handful of tuning knobs that have no config key.
|
|
17
|
+
2. **CLI flags** (`--no-lsp`, `--immediate-format`, …) — per-session, passed on
|
|
18
|
+
the pi command line.
|
|
19
|
+
3. **Config JSON** — a per-user global file (`~/.pi-lens/config.json`) and an
|
|
20
|
+
optional per-project file (`.pi-lens.json` at the repo root).
|
|
21
|
+
|
|
22
|
+
Every runtime toggle is settable **both** from the CLI and from `config.json`;
|
|
23
|
+
the two surfaces are driven by one declarative registry
|
|
24
|
+
(`clients/lens-flag-registry.ts`), so neither can gain a toggle the other lacks.
|
|
25
|
+
|
|
26
|
+
## Precedence
|
|
27
|
+
|
|
28
|
+
For a single toggle, highest priority first:
|
|
29
|
+
|
|
30
|
+
1. **Environment variable**, for the toggles that have one bound (only
|
|
31
|
+
`PI_LENS_NO_CONTEXT_INJECTION` today).
|
|
32
|
+
2. **CLI flag**.
|
|
33
|
+
3. **Nearest project `.pi-lens.json`** that defines the key — for the three
|
|
34
|
+
project-scoped mutation controls only (`format.enabled`, `autofix.enabled`,
|
|
35
|
+
`actionableWarnings.autoFix.enabled`). In a monorepo the closest config to the
|
|
36
|
+
edited file wins.
|
|
37
|
+
4. **Global `~/.pi-lens/config.json`**.
|
|
38
|
+
5. **Built-in default**.
|
|
39
|
+
|
|
40
|
+
**The `--no-*` one-way rule.** Config keys are positive (`"enabled": true` means
|
|
41
|
+
the feature runs), so a `--no-*` flag corresponds to setting its key `false`. A
|
|
42
|
+
`--no-*` flag on the command line is a *one-way switch*: it can disable but never
|
|
43
|
+
re-enable. `--no-lsp` overrides `lsp.enabled: true`, but nothing on the CLI
|
|
44
|
+
overrides `lsp.enabled: false`. To re-enable, set the config key back to `true`.
|
|
45
|
+
|
|
46
|
+
## Defaults at a glance
|
|
47
|
+
|
|
48
|
+
### Runtime toggles (flags)
|
|
49
|
+
|
|
50
|
+
Each is settable via the CLI flag *or* the `config.json` key. The **Default**
|
|
51
|
+
column is the effective behavior when nothing is set.
|
|
52
|
+
|
|
53
|
+
| CLI flag | `config.json` key | Scope | Default |
|
|
54
|
+
| --- | --- | --- | --- |
|
|
55
|
+
| `--no-lens` | `lens.enabled` | global | pi-lens **on** |
|
|
56
|
+
| `--no-lsp` | `lsp.enabled` | global | LSP diagnostics **on** |
|
|
57
|
+
| `--no-autoformat` | `format.enabled` | project | autoformat **on** (deferred) |
|
|
58
|
+
| `--immediate-format` | `format.mode` (`"immediate"`) | global | `"deferred"` |
|
|
59
|
+
| `--no-autofix` | `autofix.enabled` | project | autofix **on** |
|
|
60
|
+
| `--no-tests` | `tests.enabled` | global | test runner **on** |
|
|
61
|
+
| `--no-delta` | `delta.enabled` | global | delta mode **on** (new diagnostics only) |
|
|
62
|
+
| `--lens-guard` | `guard.enabled` | global | **off** |
|
|
63
|
+
|
|
64
|
+
| `--no-opengrep` | `opengrep.enabled` | global | Opengrep scanner **on** |
|
|
65
|
+
| `--no-read-guard` | `readGuard.enabled` | global | read-before-edit monitor **on** |
|
|
66
|
+
| `--no-lens-context` | `contextInjection.enabled` | global | context injection **on** |
|
|
67
|
+
| `--lens-turn-summary` | `turnSummary.enabled` | global | **off** |
|
|
68
|
+
| `--lens-actionable-warnings` | `actionableWarnings.enabled` | global | **off** |
|
|
69
|
+
| `--lens-actionable-warning-actions` | `actionableWarnings.includeLspCodeActions` | global | **off** |
|
|
70
|
+
| `--lens-actionable-warning-autofix` | `actionableWarnings.autoFix.enabled` | project | **off** |
|
|
71
|
+
| `--lens-actionable-warning-all` | `actionableWarnings.deltaOnly` (`false`) | global | `deltaOnly` **on** (report this turn only) |
|
|
72
|
+
| `--lens-compact-tool-line` | `ui.compactToolLine` | global | **off** (two-row tool rendering) |
|
|
73
|
+
|
|
74
|
+
`--lens-guard` is **EXPERIMENTAL and strictly opt-in**. When enabled, actual
|
|
75
|
+
`git commit`/`git push` commands are blocked only for current, structured
|
|
76
|
+
blocking findings (including blocking test failures); advisory/no-action-required
|
|
77
|
+
findings do not block. Stale, malformed, or ambiguous persisted state blocks
|
|
78
|
+
conservatively until checks run again.
|
|
79
|
+
|
|
80
|
+
`--immediate-format` and `--lens-actionable-warning-all` are not `--no-*` flags,
|
|
81
|
+
so they set a value rather than flipping a boolean off.
|
|
82
|
+
|
|
83
|
+
### Non-flag config knobs
|
|
84
|
+
|
|
85
|
+
These take values (numbers, arrays, strings) rather than being on/off, so they
|
|
86
|
+
have no CLI flag. See the [Configuration reference](./globalconfig.md) for full
|
|
87
|
+
field docs.
|
|
88
|
+
|
|
89
|
+
| Key | Where | Default | What it does |
|
|
90
|
+
| --- | --- | --- | --- |
|
|
91
|
+
| `ignore` | global + project | `[]` | Gitignore-style globs excluded from every scan |
|
|
92
|
+
| `widget.visible` | global | `true` | Whether the diagnostics widget shows at session start |
|
|
93
|
+
| `dispatch.runnerTimeoutFloorMs` | global | none (no floor) | Minimum wall-clock budget per dispatch runner |
|
|
94
|
+
| `format.mode` | global | `"deferred"` | `"deferred"` (at `agent_end`) or `"immediate"` |
|
|
95
|
+
| `actionableWarnings.autoFix.maxFixes` | global | `5` | Cap on quickfixes applied per turn (`0` = report only) |
|
|
96
|
+
| `rules.high-complexity.threshold` | project | `15` | Cyclomatic-complexity threshold |
|
|
97
|
+
| `rules.high-fan-out.threshold` | project | `20` | Distinct-function-call threshold |
|
|
98
|
+
| `rules.<id>.disable` | project | absent | Disable diagnostics for a rule (output-only filter, project-wide; same normalization as `pi-lens-ignore`) |
|
|
99
|
+
| `rules.<id>.select` | project | absent | Allowlist of rule ids (output-only filter, project-wide across every key; disable wins over select) |
|
|
100
|
+
| `maxProjectFiles` | project | `2000` | Base scale knob; derives five subsystem size budgets |
|
|
101
|
+
| `reviewGraph.maxFiles` | project | derived (clamped `100`–`20000`) | Explicit review-graph file budget |
|
|
102
|
+
| `trivy.enabled` / `trivy.minSeverity` | project | off | Opt-in Trivy vulnerability scanning |
|
|
103
|
+
|
|
104
|
+
## Global vs project config
|
|
105
|
+
|
|
106
|
+
### Global — `~/.pi-lens/config.json`
|
|
107
|
+
|
|
108
|
+
User-level. Applies to **every** project. Honors **all** flag keys from the
|
|
109
|
+
table above plus the non-flag global knobs (`ignore`, `widget.visible`,
|
|
110
|
+
`dispatch.runnerTimeoutFloorMs`, `format.mode`,
|
|
111
|
+
`actionableWarnings.autoFix.maxFixes`). On Windows the path is
|
|
112
|
+
`%USERPROFILE%\.pi-lens\config.json`.
|
|
113
|
+
|
|
114
|
+
```json
|
|
115
|
+
{
|
|
116
|
+
"lsp": { "enabled": true },
|
|
117
|
+
"tests": { "enabled": false },
|
|
118
|
+
"widget": { "visible": false },
|
|
119
|
+
"format": { "enabled": true, "mode": "immediate" },
|
|
120
|
+
"actionableWarnings": {
|
|
121
|
+
"enabled": true,
|
|
122
|
+
"autoFix": { "enabled": false, "maxFixes": 5 }
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Project — `.pi-lens.json`
|
|
128
|
+
|
|
129
|
+
Per-repo. Discovered by walking **upward** from the current directory, so a
|
|
130
|
+
monorepo can keep one config at the repo root and every subdirectory picks it up
|
|
131
|
+
(closest config wins per edited file). `pi-lens.json` (no leading dot) is also
|
|
132
|
+
accepted.
|
|
133
|
+
|
|
134
|
+
A project file honors **only**:
|
|
135
|
+
|
|
136
|
+
- the three mutation controls — `format.enabled`, `autofix.enabled`,
|
|
137
|
+
`actionableWarnings.autoFix.enabled`;
|
|
138
|
+
- `ignore`, `rules`, `maxProjectFiles`, `reviewGraph`, and `trivy`.
|
|
139
|
+
|
|
140
|
+
Most toggles are **global-only**. Putting a global-only key such as
|
|
141
|
+
`"lsp": { "enabled": false }` in a `.pi-lens.json` is **not** honored at project
|
|
142
|
+
scope — pi-lens logs a one-time warning saying so (rather than silently doing
|
|
143
|
+
nothing) and you should set it in `~/.pi-lens/config.json` or pass the CLI flag
|
|
144
|
+
instead. Foreign LSP-loader namespaces that a shared file legitimately carries
|
|
145
|
+
(`servers`, `serverOverrides`, `disabledServers`, `warmFiles`) and `$schema` are
|
|
146
|
+
tolerated without warning; anything else is logged once as a likely typo.
|
|
147
|
+
|
|
148
|
+
```json
|
|
149
|
+
{
|
|
150
|
+
"ignore": ["**/*.test.ts", "vendor/**"],
|
|
151
|
+
"rules": {
|
|
152
|
+
"high-complexity": { "threshold": 25 },
|
|
153
|
+
"high-fan-out": { "threshold": 30 },
|
|
154
|
+
"no-eval": { "disable": ["no-eval", "ast-grep:no-eval", "no-eval-js"] }
|
|
155
|
+
},
|
|
156
|
+
"maxProjectFiles": 5000,
|
|
157
|
+
"format": { "enabled": false }
|
|
158
|
+
}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
A project's own mutation-control value wins over the global default in **either**
|
|
162
|
+
direction (a repo can re-enable a mutation path the user disabled globally, and
|
|
163
|
+
vice versa); only an explicit disabling CLI flag (`--no-autoformat`,
|
|
164
|
+
`--no-autofix`) outranks it. See
|
|
165
|
+
[Mutation controls](./globalconfig.md#mutation-controls) for the full precedence.
|
|
166
|
+
|
|
167
|
+
## Environment variables
|
|
168
|
+
|
|
169
|
+
Environment variables are read once at process start; set them in the launching
|
|
170
|
+
shell (`export VAR=…` in bash, `$env:VAR = "…"` in PowerShell), your process
|
|
171
|
+
manager, or CI config. The handful you are most likely to reach for:
|
|
172
|
+
|
|
173
|
+
- `PI_LENS_NO_CONTEXT_INJECTION=1` — disable automatic context injection while
|
|
174
|
+
keeping tools, LSP, read-guard, and formatting active.
|
|
175
|
+
- `PILENS_DATA_DIR` — relocate per-project persistent state (caches, snapshot,
|
|
176
|
+
review graph) out of the workspace.
|
|
177
|
+
- `PI_LENS_HOME` — relocate the machine-global root (logs, tool binaries, install
|
|
178
|
+
caches, instance registry).
|
|
179
|
+
- `PI_LENS_MAX_PROJECT_FILES` — base project-size scale knob (default `2000`).
|
|
180
|
+
- `PI_LENS_STARTUP_MODE` — force the startup path: `full`, `minimal`, or `quick`.
|
|
181
|
+
|
|
182
|
+
**Full environment-variable reference:** [environment-variables.md](./environment-variables.md)
|
|
183
|
+
— every supported variable with its default, behavior, and precedence (install
|
|
184
|
+
control, scale/limit knobs, logging, language-specific, and more).
|
|
185
|
+
|
|
186
|
+
## See also
|
|
187
|
+
|
|
188
|
+
- [Configuration reference](./globalconfig.md) — full field-by-field docs for
|
|
189
|
+
`~/.pi-lens/config.json` and `.pi-lens.json`.
|
|
190
|
+
- [Usage](./usage.md) — the CLI flags in context.
|
|
191
|
+
- [Environment variables](./environment-variables.md) — the complete
|
|
192
|
+
environment-variable reference.
|
package/docs/tools.md
CHANGED
|
@@ -5,7 +5,11 @@ pi-lens registers the following slash commands with the pi host:
|
|
|
5
5
|
- `/lens-toggle` — toggle pi-lens on/off for the current session without restarting
|
|
6
6
|
- `/lens-context-toggle` — toggle automatic context injection on/off for the session (tools/LSP/read-guard/formatting stay active)
|
|
7
7
|
- `/lens-widget-toggle` — show/hide the pi-lens diagnostics widget below the editor
|
|
8
|
-
- `/lens-health` — runtime health, latency, and diagnostic telemetry
|
|
8
|
+
- `/lens-health` — runtime health, latency, and diagnostic telemetry, including
|
|
9
|
+
bounded per-session degradation counts (trust refusals, LSP breakers,
|
|
10
|
+
formatter skips/failures, idle evictions, WASM aborts, timeout tallies, and
|
|
11
|
+
more)
|
|
12
|
+
- `/lens-perf` — independent top-five p50 and p99 rankings for the current process session and machine-wide active latency-log window
|
|
9
13
|
- `/lens-allow-edit <path>` — override the read-before-edit guard for a single edit
|
|
10
14
|
- `/lens-tools` — tool installation status: globally installed, auto-installed, or npx fallback
|
|
11
15
|
- `/lens-tdi` — Technical Debt Index (TDI) and project health trend
|
|
@@ -14,3 +18,16 @@ pi-lens registers the following slash commands with the pi host:
|
|
|
14
18
|
the project data dir, path shown on completion)
|
|
15
19
|
|
|
16
20
|
For runtime startup flags (`--no-lens`, `--no-lsp`, etc.) see [`usage.md`](usage.md).
|
|
21
|
+
|
|
22
|
+
## Standalone CLI
|
|
23
|
+
|
|
24
|
+
Build and persist the review graph out of band for CI or cron:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npx pi-lens build-graph [--cwd <dir>]
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
The command uses the same graph builder, project configuration, file cap, and
|
|
31
|
+
persist cap as an interactive session. It prints file/node/edge/element count,
|
|
32
|
+
snapshot JSON bytes, and duration on success; an unsafe root, build skip/error,
|
|
33
|
+
or failed/skipped persistence exits non-zero with the reason on stderr.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
<!-- GENERATED by scripts/gen-rule-catalogs.mjs — do not edit by hand. Run `npm run docs:rule-catalogs` after changing rules. -->
|
|
4
4
|
|
|
5
|
-
pi-lens bundles **
|
|
5
|
+
pi-lens bundles **158 enabled** tree-sitter query rules across **14 languages**, plus 12 disabled.
|
|
6
6
|
|
|
7
7
|
Rule source: `rules/tree-sitter-queries/<language>/`.
|
|
8
8
|
|
|
@@ -25,15 +25,13 @@ Rule source: `rules/tree-sitter-queries/<language>/`.
|
|
|
25
25
|
| `non-case-label-in-switch` | error | maintainability | non-case label inside switch statement — move label outside or restructure |
|
|
26
26
|
| `noreturn-returns` | error | reliability | function declared with noreturn attribute contains a return statement |
|
|
27
27
|
|
|
28
|
-
### C++ (
|
|
28
|
+
### C++ (4)
|
|
29
29
|
|
|
30
30
|
| Rule | Severity | Category | Description |
|
|
31
31
|
|---|---|---|---|
|
|
32
32
|
| `no-auto-ptr` | error | reliability | std::auto_ptr should not be used — use std::unique_ptr instead |
|
|
33
|
-
| `no-
|
|
34
|
-
| `no-memset-sensitive-data` | error | security | memset should not be used to delete sensitive data — use SecureZeroMemory or explicit_bzero |
|
|
33
|
+
| `no-memset-sensitive-data` | warning | security | memset should not be used to delete sensitive data — use SecureZeroMemory or explicit_bzero |
|
|
35
34
|
| `no-scoped-lock-without-args` | error | reliability | std::scoped_lock should be created with constructor arguments |
|
|
36
|
-
| `noexcept-functions` | error | reliability | Function should be declared noexcept |
|
|
37
35
|
| `unnecessary-bit-ops` | error | maintainability | Unnecessary bit operation - has no effect |
|
|
38
36
|
|
|
39
37
|
### C# (5)
|
|
@@ -67,14 +65,14 @@ Rule source: `rules/tree-sitter-queries/<language>/`.
|
|
|
67
65
|
| `go-ignored-call-result` | warning | error-handling | Call result assigned to '_' — verify this discard is intentional |
|
|
68
66
|
| `go-insecure-random` | warning | security | Insecure randomness source detected — use crypto/rand for security-sensitive values |
|
|
69
67
|
| `go-log-fatal` | warning | reliability | log.Fatal/log.Panic terminates execution — prefer returning errors from core logic |
|
|
70
|
-
| `go-mutex-copy` | warning | concurrency | sync.Mutex
|
|
68
|
+
| `go-mutex-copy` | warning | concurrency | sync.Mutex parameter taken by value — the callee locks a copy; take *sync.Mutex instead |
|
|
71
69
|
| `go-path-traversal` | warning | security | Potential path traversal sink — sanitize and constrain file paths |
|
|
72
70
|
| `go-shared-map-write-goroutine` | error | concurrency | Map write inside goroutine may race — guard with synchronization or ownership boundaries |
|
|
73
71
|
| `go-sql-injection` | error | security | Potential SQL injection sink — use parameterized queries |
|
|
74
72
|
| `go-time-sleep-test` | warning | correctness | time.Sleep in test — use synchronisation (channel, WaitGroup, Eventually) instead of arbitrary sleeps |
|
|
75
73
|
| `go-weak-hash` | error | security | Weak hash primitive detected (md5/sha1) — use sha256+ for security-sensitive contexts |
|
|
76
74
|
|
|
77
|
-
### Java (
|
|
75
|
+
### Java (20)
|
|
78
76
|
|
|
79
77
|
| Rule | Severity | Category | Description |
|
|
80
78
|
|---|---|---|---|
|
|
@@ -82,7 +80,6 @@ Rule source: `rules/tree-sitter-queries/<language>/`.
|
|
|
82
80
|
| `infinite-recursion` | error | reliability | Method '{{NAME}}' appears to recurse without termination condition |
|
|
83
81
|
| `junit-call-super` | error | maintainability | JUnit test case should call super method |
|
|
84
82
|
| `main-should-not-throw` | warning | reliability | main() should not declare throws — handle exceptions internally |
|
|
85
|
-
| `mockito-initialized` | error | reliability | @Mock/@InjectMocks object should be initialized with MockitoAnnotations.openMocks() |
|
|
86
83
|
| `name-capitalization-conflict` | error | maintainability | '{{NAME}}' differs only by capitalization from existing field/method |
|
|
87
84
|
| `no-clone-override` | warning | reliability | clone() should not be overridden — use copy constructor instead |
|
|
88
85
|
| `no-double-checked-locking` | error | reliability | Double-checked locking should not be used |
|
|
@@ -92,15 +89,12 @@ Rule source: `rules/tree-sitter-queries/<language>/`.
|
|
|
92
89
|
| `no-octal-values` | error | maintainability | Octal value '{{VALUE}}' should not be used - use explicit 0o prefix if intended |
|
|
93
90
|
| `no-threadgroup` | warning | reliability | ThreadGroup should not be used — it's obsolete and unsafe |
|
|
94
91
|
| `no-threads-in-constructors` | error | maintainability | Threads should not be started in constructors |
|
|
95
|
-
| `no-wait-notify-on-thread` | error | reliability | {{METHOD}}() should not be called on Thread instances |
|
|
96
92
|
| `prepared-statement-valid-indices` | error | reliability | PreparedStatement/ResultSet methods should use valid indices (1-based) |
|
|
97
|
-
| `resources-closed` |
|
|
98
|
-
| `short-circuit-logic` | error | maintainability | Use '{{OP}}' instead of '{{BAD_OP}}' for short-circuit evaluation |
|
|
99
|
-
| `spring-session-attributes-setcomplete` | error | reliability | @Controller with @SessionAttributes must call setComplete on SessionStatus |
|
|
93
|
+
| `resources-closed` | warning | reliability | Resource '{{RESOURCE}}' should be closed in finally block |
|
|
100
94
|
| `springboot-default-package` | error | reliability | @SpringBootApplication and @ComponentScan should not be used in default package |
|
|
101
95
|
| `switch-fall-through` | error | maintainability | Switch case should end with an unconditional break statement |
|
|
102
96
|
| `switch-non-case-labels` | error | reliability | Non-case labels should not be used inside switch statements |
|
|
103
|
-
| `tests-include-assertions` |
|
|
97
|
+
| `tests-include-assertions` | warning | maintainability | Test method should include at least one assertion |
|
|
104
98
|
| `unnecessary-bit-ops-java` | error | maintainability | Unnecessary bit operation - has no effect |
|
|
105
99
|
|
|
106
100
|
### JavaScript (2)
|
|
@@ -216,7 +210,7 @@ Rule source: `rules/tree-sitter-queries/<language>/`.
|
|
|
216
210
|
| `deep-promise-chain` | warning | complexity | Promise chain {{M1}} → {{M2}} → {{M3}} → {{M4}} — consider async/await |
|
|
217
211
|
| `default-not-last` | error | maintainability | default clause should be the last case |
|
|
218
212
|
| `duplicate-function-arg` | error | reliability | Duplicate parameter name '{{NAME}}' |
|
|
219
|
-
| `empty-switch-case` | error | reliability | Switch case
|
|
213
|
+
| `empty-switch-case` | error | reliability | Switch case is empty and shares no body with a following label |
|
|
220
214
|
| `infinite-loop` | error | reliability | Loop appears to be infinite with no termination condition |
|
|
221
215
|
| `mixed-async-styles` | warning | style | Mixed async/await + promise chains — use consistent async style |
|
|
222
216
|
| `no-console-in-tests` | warning | testing | console.{{METHOD}} in test block — use proper assertions or logging |
|
|
@@ -239,17 +233,11 @@ Rule source: `rules/tree-sitter-queries/<language>/`.
|
|
|
239
233
|
| `ts-ssrf` | error | security | Potential SSRF sink — validate and allowlist outbound URLs |
|
|
240
234
|
| `ts-weak-hash` | error | security | Weak hash primitive selected (md5/sha1) — use sha256+ for security-sensitive contexts |
|
|
241
235
|
| `ts-xss-dom-sink` | error | security | XSS risk — dynamic value written to innerHTML/outerHTML or document.write() |
|
|
242
|
-
| `unsafe-regex` |
|
|
236
|
+
| `unsafe-regex` | warning | security | Dynamic regex from user input — can cause ReDoS (Regular Expression Denial of Service) |
|
|
243
237
|
| `variable-shadowing` | warning | maintainability | Variable '{{NAME}}' shadows a parameter — use a distinct name |
|
|
244
238
|
|
|
245
239
|
## Disabled rules
|
|
246
240
|
|
|
247
|
-
### ABAP (1)
|
|
248
|
-
|
|
249
|
-
| Rule | Severity | Category | Description |
|
|
250
|
-
|---|---|---|---|
|
|
251
|
-
| `delete-where` | error | reliability | DELETE FROM statement should have a WHERE clause |
|
|
252
|
-
|
|
253
241
|
### C (1)
|
|
254
242
|
|
|
255
243
|
| Rule | Severity | Category | Description |
|
|
@@ -263,19 +251,12 @@ Rule source: `rules/tree-sitter-queries/<language>/`.
|
|
|
263
251
|
| `alter-statement` | warning | maintainability | ALTER should not be used - causes spaghetti code |
|
|
264
252
|
| `lock-table-cobol` | error | maintainability | LOCK TABLE should not be used |
|
|
265
253
|
|
|
266
|
-
### PL/SQL (
|
|
254
|
+
### PL/SQL (2)
|
|
267
255
|
|
|
268
256
|
| Rule | Severity | Category | Description |
|
|
269
257
|
|---|---|---|---|
|
|
270
|
-
| `delete-update-where` | error | reliability | {{STATEMENT}} statement should contain a WHERE clause |
|
|
271
|
-
| `end-loop-semicolon` | error | reliability | END LOOP should be followed by a semicolon |
|
|
272
|
-
| `fetch-bulk-collect-limit` | error | reliability | FETCH ... BULK COLLECT INTO should not be used without a LIMIT clause |
|
|
273
|
-
| `forallsave-exceptions` | error | reliability | FORALL statement should use the SAVE EXCEPTIONS clause |
|
|
274
258
|
| `lock-table` | error | maintainability | LOCK TABLE should not be used |
|
|
275
|
-
| `nchar-nvarchar2-bytes` | error | reliability | NCHAR/NVARCHAR2 size should be in characters, not bytes |
|
|
276
259
|
| `no-synchronize` | error | reliability | SYNCHRONIZE should not be used |
|
|
277
|
-
| `not-null-initialization` | error | reliability | NOT NULL variable should be initialized |
|
|
278
|
-
| `raise-application-error-codes` | error | reliability | RAISE_APPLICATION_ERROR should only be used with error codes from -20000 to -20999 |
|
|
279
260
|
|
|
280
261
|
### Python (1)
|
|
281
262
|
|
|
@@ -283,7 +264,7 @@ Rule source: `rules/tree-sitter-queries/<language>/`.
|
|
|
283
264
|
|---|---|---|---|
|
|
284
265
|
| `python-print-statement` | warning | debugging | print() — remove debug output before committing |
|
|
285
266
|
|
|
286
|
-
### TypeScript (
|
|
267
|
+
### TypeScript (6)
|
|
287
268
|
|
|
288
269
|
| Rule | Severity | Category | Description |
|
|
289
270
|
|---|---|---|---|
|
|
@@ -293,4 +274,3 @@ Rule source: `rules/tree-sitter-queries/<language>/`.
|
|
|
293
274
|
| `hardcoded-secrets` | error | security | Hardcoded secret in variable assignment — use environment variables |
|
|
294
275
|
| `long-parameter-list` | warning | complexity | Function has {{PARAM_COUNT}} parameters — use object pattern |
|
|
295
276
|
| `nested-ternary` | warning | readability | Nested ternary — use if/else or early returns for clarity |
|
|
296
|
-
| `ts-path-traversal` | error | security | Potential path traversal sink — avoid filesystem I/O with untrusted input |
|
package/docs/usage.md
CHANGED
|
@@ -89,8 +89,22 @@ pi --no-tests # Skip test runner
|
|
|
89
89
|
pi --no-delta # Disable delta mode (show all diagnostics, not just new ones)
|
|
90
90
|
pi --lens-guard # Block git commit/push when unresolved blockers exist (experimental)
|
|
91
91
|
pi --no-opengrep # Disable the Opengrep security scanner (default-on auxiliary LSP)
|
|
92
|
+
pi --no-read-guard # Disable the read-before-edit behavior monitor
|
|
93
|
+
pi --lens-turn-summary # Persist a per-turn summary of diagnostics, autofixes, and autoformats
|
|
94
|
+
pi --lens-compact-tool-line # Render tool results as one compact, theme-aware line (closes #1327)
|
|
95
|
+
|
|
96
|
+
# Actionable warnings (all default off)
|
|
97
|
+
pi --lens-actionable-warnings # Report fixable warnings at turn end
|
|
98
|
+
pi --lens-actionable-warning-actions # Enrich the report with LSP code-action titles
|
|
99
|
+
pi --lens-actionable-warning-autofix # Apply conservative LSP quickfixes at agent_end
|
|
100
|
+
pi --lens-actionable-warning-all # Report every warning, not just this turn's
|
|
92
101
|
```
|
|
93
102
|
|
|
103
|
+
Every one of these has a `~/.pi-lens/config.json` equivalent, so you can set it
|
|
104
|
+
once instead of per session. See
|
|
105
|
+
[Global and Project Config](globalconfig.md#every-toggle-both-ways) for the
|
|
106
|
+
flag-to-key table and the precedence order.
|
|
107
|
+
|
|
94
108
|
## Rules
|
|
95
109
|
|
|
96
110
|
### Tree-sitter rules
|
|
@@ -128,6 +142,23 @@ second host adapter that calls the same `clients/lens-engine.ts` seam as the pi
|
|
|
128
142
|
extension. Use `npm run build:dist` after MCP/engine changes so the user-scoped
|
|
129
143
|
server loads fresh compiled code.
|
|
130
144
|
|
|
145
|
+
Two Claude Code hooks give the MCP mirror the same automatic cadence the pi
|
|
146
|
+
extension has. PostToolUse runs the per-edit pass, `Stop` runs the per-turn one:
|
|
147
|
+
|
|
148
|
+
```json
|
|
149
|
+
{ "hooks": {
|
|
150
|
+
"PostToolUse": [
|
|
151
|
+
{ "matcher": "Edit|Write",
|
|
152
|
+
"hooks": [ { "type": "command", "command": "pi-lens-analyze --hook" } ] } ],
|
|
153
|
+
"Stop": [
|
|
154
|
+
{ "hooks": [ { "type": "command", "command": "pi-lens-analyze --turn-end", "timeout": 60 } ] } ]
|
|
155
|
+
} }
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
The `Stop` hook only works against a running MCP server because only that
|
|
159
|
+
process owns the session state and pending turn work. With no warm server the
|
|
160
|
+
turn-end is skipped, not faked: one line on stderr and nothing on stdout.
|
|
161
|
+
|
|
131
162
|
## Troubleshooting
|
|
132
163
|
|
|
133
164
|
- Run `npm run build` before tests after editing TypeScript; tests import
|