pi-lens 4.2.0 → 4.3.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 +543 -0
- package/README.md +45 -2
- package/dist/clients/actionable-warnings.js +44 -16
- package/dist/clients/advisory-provenance.js +187 -51
- package/dist/clients/cache-manager.js +64 -5
- package/dist/clients/cascade-format.js +24 -0
- package/dist/clients/child-unref.js +17 -8
- package/dist/clients/config-diagnostic-codes.js +2 -0
- package/dist/clients/config-locations.js +237 -9
- package/dist/clients/config-resolve.js +7 -1
- package/dist/clients/degradation-ledger.js +33 -3
- package/dist/clients/dependency-checker.js +87 -64
- package/dist/clients/diagnostic-dispositions.js +39 -3
- package/dist/clients/dispatch/finding-policy.js +118 -1
- package/dist/clients/dispatch/indent-detect.js +8 -2
- package/dist/clients/dispatch/inline-suppressions.js +23 -4
- package/dist/clients/dispatch/rule-ignores.js +14 -7
- package/dist/clients/dispatch/runners/actionlint.js +26 -28
- package/dist/clients/dispatch/runners/biome-check.js +38 -25
- package/dist/clients/dispatch/runners/cpp-check.js +32 -49
- package/dist/clients/dispatch/runners/credo.js +16 -14
- package/dist/clients/dispatch/runners/cue-vet.js +25 -7
- package/dist/clients/dispatch/runners/dart-analyze.js +28 -47
- package/dist/clients/dispatch/runners/detekt.js +11 -4
- package/dist/clients/dispatch/runners/dotnet-build.js +27 -22
- package/dist/clients/dispatch/runners/elixir-check.js +31 -46
- package/dist/clients/dispatch/runners/eslint.js +29 -46
- package/dist/clients/dispatch/runners/gleam-check.js +91 -11
- package/dist/clients/dispatch/runners/go-vet.js +16 -2
- package/dist/clients/dispatch/runners/golangci-lint.js +38 -23
- package/dist/clients/dispatch/runners/hadolint.js +27 -15
- package/dist/clients/dispatch/runners/htmlhint.js +17 -8
- package/dist/clients/dispatch/runners/javac.js +31 -21
- package/dist/clients/dispatch/runners/ktlint.js +34 -60
- package/dist/clients/dispatch/runners/lsp.js +6 -5
- package/dist/clients/dispatch/runners/markdownlint.js +12 -5
- package/dist/clients/dispatch/runners/mypy.js +2 -1
- package/dist/clients/dispatch/runners/oxlint.js +22 -6
- package/dist/clients/dispatch/runners/php-lint.js +39 -16
- package/dist/clients/dispatch/runners/phpstan.js +1 -1
- package/dist/clients/dispatch/runners/rubocop.js +27 -18
- package/dist/clients/dispatch/runners/ruff.js +18 -19
- package/dist/clients/dispatch/runners/rust-clippy.js +6 -1
- package/dist/clients/dispatch/runners/shellcheck.js +6 -2
- package/dist/clients/dispatch/runners/spellcheck.js +10 -3
- package/dist/clients/dispatch/runners/sqlfluff.js +11 -2
- package/dist/clients/dispatch/runners/stylelint.js +10 -2
- package/dist/clients/dispatch/runners/swiftlint.js +11 -2
- package/dist/clients/dispatch/runners/taplo.js +12 -6
- package/dist/clients/dispatch/runners/tflint.js +30 -15
- package/dist/clients/dispatch/runners/tree-sitter.js +23 -0
- package/dist/clients/dispatch/runners/trivy-config.js +8 -2
- package/dist/clients/dispatch/runners/utils/diagnostic-parsers.js +11 -1
- package/dist/clients/dispatch/runners/vale.js +15 -3
- package/dist/clients/dispatch/runners/yamllint.js +12 -2
- package/dist/clients/dispatch/runners/zig-check.js +27 -39
- package/dist/clients/dispatch/suppress-writer.js +13 -3
- package/dist/clients/effective-config.js +3 -1
- package/dist/clients/extension-log.js +48 -1
- package/dist/clients/finding-delivery-gate.js +53 -23
- package/dist/clients/formatters.js +49 -11
- package/dist/clients/git-guard.js +247 -34
- package/dist/clients/gradle-ktfmt-style.js +121 -25
- package/dist/clients/inline-blocker-dispositions.js +186 -0
- package/dist/clients/install-diagnostics.js +19 -6
- package/dist/clients/installer/index.js +281 -32
- package/dist/clients/jscpd-client.js +8 -0
- package/dist/clients/latency-logger.js +8 -0
- package/dist/clients/lens-config.js +66 -8
- package/dist/clients/lsp/cascade-tier.js +3 -0
- package/dist/clients/lsp/client.js +139 -11
- package/dist/clients/lsp/config.js +9 -7
- package/dist/clients/lsp/content-limits.js +41 -0
- package/dist/clients/lsp/index.js +42 -8
- package/dist/clients/lsp/launch.js +23 -2
- package/dist/clients/lsp/server.js +106 -25
- package/dist/clients/lsp/sync-kind.js +14 -0
- package/dist/clients/lsp/wait-policy/strategies.js +105 -16
- package/dist/clients/mcp/analyze.js +9 -2
- package/dist/clients/mcp/ipc.js +232 -44
- package/dist/clients/mcp/review.js +53 -7
- package/dist/clients/opengrep-client.js +11 -6
- package/dist/clients/path-utils.js +51 -9
- package/dist/clients/persistent-reverify.js +271 -0
- package/dist/clients/pipeline.js +136 -67
- package/dist/clients/project-diagnostics/fresh-fetch.js +21 -3
- package/dist/clients/project-lens-config.js +11 -3
- package/dist/clients/review-graph/builder.js +34 -26
- package/dist/clients/review-graph/git-identity.js +16 -10
- package/dist/clients/ruff-client.js +31 -4
- package/dist/clients/runtime-coordinator.js +38 -4
- package/dist/clients/runtime-tool-call.js +16 -5
- package/dist/clients/runtime-tool-result.js +27 -12
- package/dist/clients/runtime-turn.js +571 -287
- package/dist/clients/safe-spawn.js +256 -65
- package/dist/clients/skills-resolver.js +38 -2
- package/dist/clients/spawn-output-cap.js +84 -1
- package/dist/clients/tree-sitter-client.js +119 -58
- package/dist/clients/turn-end/lane.js +51 -0
- package/dist/clients/turn-end/lanes/govulncheck.js +112 -0
- package/dist/clients/turn-end/lanes/secrets.js +204 -0
- package/dist/clients/warm-attach.js +59 -0
- package/dist/clients/widget-state.js +294 -17
- package/dist/clients/workspace-topology.js +57 -3
- package/dist/clients/zizmor-config.js +26 -13
- package/dist/index.js +6342 -3995
- package/dist/mcp/analyze-cli.js +4 -0
- package/dist/mcp/server.js +33 -21
- package/dist/scripts/lib/web-tree-sitter-dir.mjs +123 -0
- package/dist/tools/lens-diagnostic-mark.js +14 -2
- package/dist/tools/lens-diagnostics.js +127 -33
- package/dist/tools/lsp-diagnostics.js +150 -12
- package/docs/adr/0001-stale-advisory-live-arm.md +29 -0
- package/docs/adr/0002-workspace-hash-rendezvous.md +30 -0
- package/docs/adr/0003-git-guard-latch-writer.md +203 -0
- package/docs/adr/0004-disposition-policy-seam.md +38 -0
- package/docs/adr/0005-tool-availability-enforcement-seam.md +29 -0
- package/docs/adr/0006-derived-state-benchmark-first.md +31 -0
- package/docs/adr/0007-end-to-end-witness-per-seam-slice.md +38 -0
- package/docs/adr/0008-turn-end-lane-interface.md +165 -0
- package/docs/adr/0009-reported-path-attribution.md +114 -0
- package/docs/adr/README.md +26 -0
- package/docs/agent-tools.md +18 -1
- package/docs/ast-grep_rules_catalog.md +4 -3
- package/docs/configuration.md +55 -1
- package/docs/engineering-principles.md +202 -0
- package/docs/environment-variables.md +61 -4
- package/docs/features.md +2 -2
- package/docs/globalconfig.md +6 -1
- package/docs/language-coverage.md +17 -0
- package/docs/lsp-capability-matrix.md +98 -31
- package/docs/pi-lens-fixer.md +57 -3
- package/docs/pi-lens-investigator.md +9 -0
- package/docs/pi-lens-reviewer.md +16 -0
- package/docs/pi-lens-subagent.md +9 -0
- package/docs/public-api-stability.md +1 -0
- package/docs/release-qa-baseline.md +2 -0
- package/docs/servercapabilities.md +21 -11
- package/docs/settings.md +12 -3
- package/docs/subagent-compat.md +1 -1
- package/package.json +5 -3
- package/rules/ast-grep-rules/rule-tests/no-assert-tuple-test.yml +13 -0
- package/rules/ast-grep-rules/rule-tests/no-boolean-in-except-test.yml +26 -0
- package/rules/ast-grep-rules/rule-tests/no-http-headers-bracket-access-test.yml +10 -0
- package/rules/ast-grep-rules/rule-tests/unchecked-numeric-parse-python-test.yml +18 -0
- package/rules/ast-grep-rules/rule-tests/unchecked-throwing-call-python-test.yml +4 -3
- package/rules/ast-grep-rules/rules/go-no-fmt-println.yml +2 -2
- package/rules/ast-grep-rules/rules/no-assert-tuple.yml +23 -13
- package/rules/ast-grep-rules/rules/no-boolean-in-except.yml +7 -3
- package/rules/ast-grep-rules/rules/no-console-except-error-js.yml +2 -2
- package/rules/ast-grep-rules/rules/no-console-except-error.yml +2 -2
- package/rules/ast-grep-rules/rules/no-http-headers-bracket-access.yml +12 -7
- package/rules/ast-grep-rules/rules/unchecked-numeric-parse-python.yml +44 -0
- package/rules/ast-grep-rules/rules/unchecked-throwing-call-python.yml +5 -3
- package/rules/tree-sitter-queries/typescript/console-statement.yml +2 -2
- package/scripts/install-selftest.mjs +21 -17
- package/scripts/lib/web-tree-sitter-dir.mjs +123 -0
|
@@ -157,10 +157,12 @@ function classifyGhTokenFailure(res, hostStallMs) {
|
|
|
157
157
|
classifiedBy: "caller",
|
|
158
158
|
};
|
|
159
159
|
}
|
|
160
|
-
async function deriveGhCliToken() {
|
|
160
|
+
async function deriveGhCliToken(consumer) {
|
|
161
161
|
const sampler = startHostStallSampler();
|
|
162
162
|
const startedAt = Date.now();
|
|
163
|
-
// Best-effort: a missing/unauthenticated `gh`
|
|
163
|
+
// Best-effort: a missing/unauthenticated `gh` leaves the requesting
|
|
164
|
+
// consumer without a derived token; only the zizmor wrapper turns that into
|
|
165
|
+
// an offline-mode degradation.
|
|
164
166
|
// ignoreAmbientSignal so a mid-turn Esc can't silently drop the server into
|
|
165
167
|
// offline mode; short timeout so a wedged `gh` never stalls the warm spawn.
|
|
166
168
|
// safeSpawnAsync never rejects (every failure resolves into `res`), so no
|
|
@@ -176,7 +178,7 @@ async function deriveGhCliToken() {
|
|
|
176
178
|
if (token.length > 0) {
|
|
177
179
|
ghTokenLatch.noteAvailable();
|
|
178
180
|
logAvailabilityDecision({
|
|
179
|
-
tool: "zizmor-gh-token",
|
|
181
|
+
tool: consumer === "zizmor" ? "zizmor-gh-token" : "github-token",
|
|
180
182
|
verdict: "available",
|
|
181
183
|
outcome: "success",
|
|
182
184
|
cause: "ok",
|
|
@@ -195,13 +197,13 @@ async function deriveGhCliToken() {
|
|
|
195
197
|
// regardless of whether `token` was empty, so the record claimed the
|
|
196
198
|
// online audits ran while zizmor was actually about to launch offline
|
|
197
199
|
// — the #1535 silence moved into the telemetry instead of being fixed.
|
|
198
|
-
return recordGhTokenUnavailable({
|
|
200
|
+
return recordGhTokenUnavailable(consumer, {
|
|
199
201
|
outcome: "non-installable",
|
|
200
202
|
cause: "empty-result",
|
|
201
203
|
classifiedBy: "caller",
|
|
202
204
|
}, elapsedMs, hostStallMs);
|
|
203
205
|
}
|
|
204
|
-
return recordGhTokenUnavailable(classifyGhTokenFailure(res, hostStallMs), elapsedMs, hostStallMs);
|
|
206
|
+
return recordGhTokenUnavailable(consumer, classifyGhTokenFailure(res, hostStallMs), elapsedMs, hostStallMs);
|
|
205
207
|
}
|
|
206
208
|
/**
|
|
207
209
|
* Shared tail for every "no token" verdict: latches (or cools down) the
|
|
@@ -209,13 +211,13 @@ async function deriveGhCliToken() {
|
|
|
209
211
|
* and logs the decision. Centralized so the empty-answer and failure paths
|
|
210
212
|
* can't drift on which fields get set.
|
|
211
213
|
*/
|
|
212
|
-
function recordGhTokenUnavailable({ outcome, cause, classifiedBy }, elapsedMs, hostStallMs) {
|
|
214
|
+
function recordGhTokenUnavailable(consumer, { outcome, cause, classifiedBy }, elapsedMs, hostStallMs) {
|
|
213
215
|
const retryAfterMs = ghTokenLatch.noteUnavailable(outcome, cause);
|
|
214
|
-
if (outcome === "transient") {
|
|
216
|
+
if (consumer === "zizmor" && outcome === "transient") {
|
|
215
217
|
recordZizmorOfflineDegradation(`gh auth token probe ${cause}; running offline until the next zizmor start (retry allowed in ${Math.round(retryAfterMs / 1000)}s)`);
|
|
216
218
|
}
|
|
217
219
|
logAvailabilityDecision({
|
|
218
|
-
tool: "zizmor-gh-token",
|
|
220
|
+
tool: consumer === "zizmor" ? "zizmor-gh-token" : "github-token",
|
|
219
221
|
verdict: "unavailable",
|
|
220
222
|
outcome,
|
|
221
223
|
cause,
|
|
@@ -278,14 +280,25 @@ export async function resolveZizmorGitHubToken() {
|
|
|
278
280
|
// Respect an explicit offline request — never derive a token then.
|
|
279
281
|
if (process.env.ZIZMOR_OFFLINE)
|
|
280
282
|
return undefined;
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
283
|
+
return resolveGitHubToken(["ZIZMOR_GITHUB_TOKEN", "GH_TOKEN", "GITHUB_TOKEN"], { consumer: "zizmor" });
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Resolve a GitHub token for an API client. Explicit environment variables are
|
|
287
|
+
* checked in the caller's order; when none is present, reuse the bounded,
|
|
288
|
+
* session-reset `gh auth token` resolver above rather than spawning once per
|
|
289
|
+
* request. The returned token is ephemeral and callers must not persist or
|
|
290
|
+
* send it to non-API hosts.
|
|
291
|
+
*/
|
|
292
|
+
export async function resolveGitHubToken(envKeys = ["GITHUB_TOKEN", "GH_TOKEN"], options = {}) {
|
|
293
|
+
const consumer = options.consumer ?? "github-api";
|
|
294
|
+
const fromEnv = envKeys.map((key) => process.env[key]).find(Boolean);
|
|
284
295
|
if (fromEnv)
|
|
285
296
|
return fromEnv;
|
|
286
297
|
const memo = ghTokenLatch.read();
|
|
287
298
|
if (memo !== null) {
|
|
288
|
-
if (
|
|
299
|
+
if (consumer === "zizmor" &&
|
|
300
|
+
memo === false &&
|
|
301
|
+
ghTokenLatch.getOutcome() === "transient") {
|
|
289
302
|
// Served straight from the still-cooling latch: no new probe runs,
|
|
290
303
|
// so `deriveGhCliToken`'s own logging never fires. Without this, once
|
|
291
304
|
// the cooldown ladder crosses zizmor's own respawn cadence (bounded
|
|
@@ -322,6 +335,6 @@ export async function resolveZizmorGitHubToken() {
|
|
|
322
335
|
}
|
|
323
336
|
return memo ? cachedToken : undefined;
|
|
324
337
|
}
|
|
325
|
-
cachedToken = await deriveGhCliToken();
|
|
338
|
+
cachedToken = await deriveGhCliToken(consumer);
|
|
326
339
|
return cachedToken;
|
|
327
340
|
}
|