@mrclrchtr/supi-review 6.1.0 → 6.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/README.md +4 -2
- package/node_modules/@mrclrchtr/supi-agent-runtime/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-agent-runtime/node_modules/@mrclrchtr/supi-core/src/debug-identity.ts +11 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/node_modules/@mrclrchtr/supi-core/src/debug.ts +5 -0
- package/node_modules/@mrclrchtr/supi-agent-runtime/package.json +2 -2
- package/node_modules/@mrclrchtr/supi-code-intelligence/README.md +3 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-core/src/debug-identity.ts +11 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-core/src/debug.ts +5 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/README.md +23 -3
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/debug-identity.ts +11 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/debug.ts +5 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/ignore/README.md +52 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/ignore/index.js +785 -129
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/ignore/legacy.js +660 -98
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/node_modules/ignore/package.json +10 -4
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/package.json +4 -5
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/api.ts +16 -7
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-cache.ts +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-capabilities.ts +0 -5
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-publication.ts +6 -3
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-refresh.ts +2 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-timing.ts +5 -2
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostics.ts +2 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +17 -5
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/client/transport.ts +40 -18
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/config/config.ts +164 -30
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/config/lsp-settings.ts +9 -87
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/config/server-config.ts +0 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/config/tsconfig-scope.ts +4 -5
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/config/types.ts +0 -29
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/debug-telemetry.ts +7 -21
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/diagnostic-severity.ts +6 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/diagnostic-summary.ts +11 -14
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/evidence.ts +0 -5
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/stale-diagnostics.ts +0 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/diagnostics/workspace-sentinels.ts +29 -49
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-client-state.ts +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-diagnostics.ts +4 -8
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-helpers.ts +1 -9
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-process-crash-report.ts +106 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-project-info.ts +6 -3
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-workspace-recovery.ts +9 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-workspace-symbol.ts +26 -41
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +577 -152
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/provider/lsp-semantic-provider.ts +4 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/provider/semantic-symbol-mapper.ts +59 -28
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-controller.ts +27 -19
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-diagnostics.ts +54 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registration.ts +0 -17
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registry.ts +74 -19
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-transition-debug.ts +5 -2
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/session/scanner.ts +24 -21
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/session/workspace-lsp-runtime.ts +29 -3
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/summary.ts +19 -40
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/utils.ts +13 -19
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/workspace-path-policy.ts +296 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/README.md +6 -18
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/debug-identity.ts +11 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/debug.ts +5 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/README.md +29 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.cjs +99 -19
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.cjs.map +4 -4
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.js +94 -18
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.js.map +4 -4
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.wasm.map +14 -14
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/package.json +13 -8
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.cjs +97 -19
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.cjs.map +4 -4
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.cts +28 -8
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.cts.map +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.ts +28 -8
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.ts.map +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.js +92 -18
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.js.map +4 -4
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.wasm.map +17 -17
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/package.json +7 -6
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/kotlin/tree-sitter-kotlin.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/kotlin/tree-sitter-kotlin.wasm.json +2 -2
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/sql/tree-sitter-sql.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/sql/tree-sitter-sql.wasm.json +2 -2
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/api.ts +1 -11
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/coordinates.ts +19 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/language.ts +5 -23
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/operation-support.ts +3 -21
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/provider/tree-sitter-provider.ts +5 -9
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/session/runtime-controller.ts +10 -20
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/session/session.ts +7 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/session/structural-worker-client.ts +9 -5
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/session/structural-worker-protocol.ts +134 -9
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/call-name.ts +96 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/call-sites.ts +11 -12
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/callees.ts +39 -56
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/exports.ts +9 -7
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/js-binding-pattern.ts +26 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/node-at.ts +2 -21
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/outline-html-sql.ts +144 -12
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/outline.ts +50 -37
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/scope.ts +138 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/types.ts +0 -7
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/parsed-file-store.ts +1 -14
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/runtime.ts +0 -10
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/service.ts +6 -8
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/worker-main.ts +34 -10
- package/node_modules/@mrclrchtr/supi-code-intelligence/package.json +5 -5
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/capability/capability-warnings.ts +4 -22
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/search/ast-scan-timing.ts +4 -2
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/analysis/search/ast-scan.ts +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/api.ts +1 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/extension.ts +4 -2
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/health-refresh.ts +26 -2
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/health-types.ts +19 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/input/health-refactor.ts +16 -14
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/refactor-types.ts +14 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/session/refactor-workflow.ts +21 -16
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/substrate/lsp/lifecycle.ts +0 -3
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/substrate/lsp/maintenance.ts +4 -5
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/substrate/lsp/settings.ts +7 -9
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/substrate/lsp/state.ts +0 -2
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/substrate/workspace-provider-host.ts +2 -2
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_health/file-scope-markdown.ts +43 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_health/markdown.ts +66 -66
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_health/refresh-outcome.ts +76 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_health/refresh-status.ts +212 -23
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_health/result.ts +1 -0
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_health/tui.ts +18 -5
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_refactor_apply/guidance.ts +3 -2
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/code_refactor_plan/guidance.ts +1 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/register.ts +5 -2
- package/node_modules/@mrclrchtr/supi-code-intelligence/src/tool/schemas.ts +21 -11
- package/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-core/src/debug-identity.ts +11 -0
- package/node_modules/@mrclrchtr/supi-core/src/debug.ts +5 -0
- package/package.json +4 -4
- package/src/audit/review-audit.ts +6 -1
- package/src/config.ts +36 -0
- package/src/thinking.ts +62 -0
- package/src/tool/review_run/child-session.ts +1 -0
- package/src/tool/review_run/debug-summary.ts +32 -1
- package/src/tool/review_run/execute.ts +11 -4
- package/src/tool/review_run/execution.ts +12 -0
- package/src/tool/review_run/planner.ts +4 -2
- package/src/tool/review_run/runner.ts +14 -4
- package/src/tool/review_run/workflow.ts +6 -0
- package/src/tui/common.ts +7 -0
- package/src/tui/review-command.ts +29 -1
- package/src/types.ts +14 -1
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/config/server-actions.ts +0 -59
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-lsp/src/pattern-matcher.ts +0 -24
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/scripts/generate-kotlin-wasm.mjs +0 -132
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/scripts/generate-sql-wasm.mjs +0 -158
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/scripts/vendor-wasm.mjs +0 -167
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/index.ts +0 -42
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/session/runtime-registration.ts +0 -37
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/session/service-registry.ts +0 -30
- package/node_modules/@mrclrchtr/supi-code-intelligence/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/structure.ts +0 -8
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
resolveRecoveryReviewModel,
|
|
16
16
|
} from "../model.ts";
|
|
17
17
|
import type { ReviewArtifactStore } from "../session/review-artifact-store.ts";
|
|
18
|
+
import { type ReviewThinkingLevel, resolveReviewThinkingLevel } from "../thinking.ts";
|
|
18
19
|
import { createReviewOutput } from "../tool/output-page.ts";
|
|
19
20
|
import { formatReviewBatch } from "../tool/review_run/format.ts";
|
|
20
21
|
import { queuePostReviewTurn } from "../tool/review_run/post-policy.ts";
|
|
@@ -212,6 +213,7 @@ async function draftInteractiveReview(
|
|
|
212
213
|
ctx: CommandContext,
|
|
213
214
|
target: ReviewTargetSpec,
|
|
214
215
|
scope: ReviewScope,
|
|
216
|
+
plannerThinkingLevel?: ReviewThinkingLevel,
|
|
215
217
|
): Promise<InteractivePlannerDraft | undefined> {
|
|
216
218
|
const config = loadReviewConfig(ctx.cwd);
|
|
217
219
|
const plannerModel = resolveAgentReviewModel(ctx, config.plannerModel);
|
|
@@ -227,6 +229,7 @@ async function draftInteractiveReview(
|
|
|
227
229
|
scope,
|
|
228
230
|
plannerContext: collectPlannerContext(session.messages),
|
|
229
231
|
plannerModel,
|
|
232
|
+
plannerThinkingLevel,
|
|
230
233
|
signal,
|
|
231
234
|
}),
|
|
232
235
|
);
|
|
@@ -258,6 +261,7 @@ async function executeInteractiveReview(
|
|
|
258
261
|
review: ReviewInput;
|
|
259
262
|
scope: ReviewScope;
|
|
260
263
|
reviewerModel: ReviewModelSelection;
|
|
264
|
+
reviewerThinkingLevel: ReviewThinkingLevel;
|
|
261
265
|
expectedSnapshot: ReviewSnapshot;
|
|
262
266
|
expectedSnapshotTarget: ReviewTargetSpec;
|
|
263
267
|
planning?: PlanningRecord;
|
|
@@ -279,6 +283,7 @@ async function executeInteractiveReview(
|
|
|
279
283
|
review: input.review,
|
|
280
284
|
scope: input.scope,
|
|
281
285
|
reviewerModel: input.reviewerModel,
|
|
286
|
+
reviewerThinkingLevel: input.reviewerThinkingLevel,
|
|
282
287
|
...(recoveryModel ? { recoveryModel } : {}),
|
|
283
288
|
...(config.recoveryModel !== "disabled" &&
|
|
284
289
|
config.recoveryModel !== CURRENT_SESSION_REVIEW_MODEL &&
|
|
@@ -340,9 +345,31 @@ export async function runReviewCommand(
|
|
|
340
345
|
]);
|
|
341
346
|
if (!planningChoice) return;
|
|
342
347
|
|
|
348
|
+
const config = loadReviewConfig(ctx.cwd);
|
|
349
|
+
let reviewerThinkingLevel: ReviewThinkingLevel;
|
|
350
|
+
let plannerThinkingLevel: ReviewThinkingLevel | undefined;
|
|
351
|
+
try {
|
|
352
|
+
reviewerThinkingLevel = resolveReviewThinkingLevel(config.reviewerThinkingLevel, "Reviewer");
|
|
353
|
+
plannerThinkingLevel =
|
|
354
|
+
planningChoice === "AI suggests tasks"
|
|
355
|
+
? resolveReviewThinkingLevel(config.plannerThinkingLevel, "Planner")
|
|
356
|
+
: undefined;
|
|
357
|
+
} catch (error) {
|
|
358
|
+
ctx.ui.notify(
|
|
359
|
+
error instanceof Error ? error.message : "Invalid Review thinking level.",
|
|
360
|
+
"error",
|
|
361
|
+
);
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
|
|
343
365
|
const plannerDraft =
|
|
344
366
|
planningChoice === "AI suggests tasks"
|
|
345
|
-
? await draftInteractiveReview(
|
|
367
|
+
? await draftInteractiveReview(
|
|
368
|
+
ctx,
|
|
369
|
+
selectedTarget.selectedTarget,
|
|
370
|
+
scope,
|
|
371
|
+
plannerThinkingLevel,
|
|
372
|
+
)
|
|
346
373
|
: undefined;
|
|
347
374
|
if (planningChoice === "AI suggests tasks" && !plannerDraft) return;
|
|
348
375
|
const snapshot =
|
|
@@ -380,6 +407,7 @@ export async function runReviewCommand(
|
|
|
380
407
|
review: edited,
|
|
381
408
|
scope,
|
|
382
409
|
reviewerModel,
|
|
410
|
+
reviewerThinkingLevel,
|
|
383
411
|
expectedSnapshot: snapshot,
|
|
384
412
|
expectedSnapshotTarget: selectedTarget.selectedTarget,
|
|
385
413
|
...(usePlannerDraft && plannerDraft ? { planning: plannerDraft.planning } : {}),
|
package/src/types.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import type { Model, Usage } from "@earendil-works/pi-ai";
|
|
1
|
+
import type { Model, ModelThinkingLevel, Usage } from "@earendil-works/pi-ai";
|
|
2
2
|
import type {
|
|
3
3
|
AgentRunDiagnostics,
|
|
4
4
|
AgentRunProviderAuthority,
|
|
5
5
|
} from "@mrclrchtr/supi-agent-runtime/api";
|
|
6
6
|
import type { LocalReviewAuditStore } from "./audit/local-review-audit-store.ts";
|
|
7
|
+
import type { ReviewThinkingLevel } from "./thinking.ts";
|
|
7
8
|
import type { ReviewWorkspaceCleanupWarning } from "./workspace/review-workspace.ts";
|
|
8
9
|
|
|
9
10
|
/** A full Git commit id after target resolution. */
|
|
@@ -225,6 +226,8 @@ export interface ReviewProgress {
|
|
|
225
226
|
tokens?: {
|
|
226
227
|
input: number;
|
|
227
228
|
output: number;
|
|
229
|
+
/** Reasoning tokens, when the provider reports them. */
|
|
230
|
+
reasoning?: number;
|
|
228
231
|
total: number;
|
|
229
232
|
cacheRead?: number;
|
|
230
233
|
cacheWrite?: number;
|
|
@@ -233,6 +236,8 @@ export interface ReviewProgress {
|
|
|
233
236
|
|
|
234
237
|
export interface PlannerInvocation {
|
|
235
238
|
prompt: string;
|
|
239
|
+
/** Requested level for this Planner Draft; omitted values keep the package default. */
|
|
240
|
+
requestedThinkingLevel?: ReviewThinkingLevel;
|
|
236
241
|
providerAuthority?: AgentRunProviderAuthority;
|
|
237
242
|
// biome-ignore lint/suspicious/noExplicitAny: Model<any> is Pi's canonical type
|
|
238
243
|
model: Model<any>;
|
|
@@ -255,6 +260,8 @@ export interface ReviewerAuditRequest {
|
|
|
255
260
|
|
|
256
261
|
export interface ReviewerInvocation {
|
|
257
262
|
prompt: string;
|
|
263
|
+
/** Requested level for this Reviewer Session; omitted values keep the package default. */
|
|
264
|
+
requestedThinkingLevel?: ReviewThinkingLevel;
|
|
258
265
|
providerAuthority?: AgentRunProviderAuthority;
|
|
259
266
|
packetHash: string;
|
|
260
267
|
task: ReviewTask;
|
|
@@ -277,6 +284,8 @@ export type ReviewerExtensionSetStatus = "active" | "degraded" | "unobserved";
|
|
|
277
284
|
|
|
278
285
|
export type ReviewerRunResult = ChildRunOutcome<ReviewSubmission> & {
|
|
279
286
|
modelId: string;
|
|
287
|
+
requestedThinkingLevel: ReviewThinkingLevel;
|
|
288
|
+
effectiveThinkingLevel: ModelThinkingLevel;
|
|
280
289
|
reviewerExtensionSetStatus: ReviewerExtensionSetStatus;
|
|
281
290
|
capabilityWarnings?: ReviewerCapabilityWarning[];
|
|
282
291
|
audit?: ReviewAuditReference;
|
|
@@ -287,6 +296,10 @@ interface ReviewTaskResultIdentity {
|
|
|
287
296
|
taskId: string;
|
|
288
297
|
mode: ReviewMode;
|
|
289
298
|
modelId: string;
|
|
299
|
+
/** Requested Reviewer Thinking Level for this task. */
|
|
300
|
+
requestedThinkingLevel: ReviewThinkingLevel;
|
|
301
|
+
/** Effective Reviewer Thinking Level after model capability clamping. */
|
|
302
|
+
effectiveThinkingLevel: ModelThinkingLevel;
|
|
290
303
|
/** SHA-256 of the exact reviewer packet bytes. */
|
|
291
304
|
packetHash: string;
|
|
292
305
|
/** Aggregate nested-model usage for this task, when reported by the provider. */
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
// Server capability action label helpers — maps LSP capabilities to readable action labels.
|
|
2
|
-
|
|
3
|
-
import type { ServerCapabilities } from "../config/types.ts";
|
|
4
|
-
|
|
5
|
-
interface LspServerSupportedActionSpec {
|
|
6
|
-
label: string;
|
|
7
|
-
isSupported: (capabilities: ServerCapabilities | null | undefined) => boolean;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const LSP_SERVER_SUPPORTED_ACTION_SPECS: readonly LspServerSupportedActionSpec[] = [
|
|
11
|
-
{
|
|
12
|
-
label: "diagnostics [optional file]",
|
|
13
|
-
isSupported: () => true,
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
label: "hover(file,line,char)",
|
|
17
|
-
isSupported: (capabilities) => Boolean(capabilities?.hoverProvider),
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
label: "definition(file,line,char)",
|
|
21
|
-
isSupported: (capabilities) => Boolean(capabilities?.definitionProvider),
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
label: "references(file,line,char)",
|
|
25
|
-
isSupported: (capabilities) => Boolean(capabilities?.referencesProvider),
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
label: "implementation(file,line,char)",
|
|
29
|
-
isSupported: (capabilities) => Boolean(capabilities?.implementationProvider),
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
label: "symbols(file)",
|
|
33
|
-
isSupported: (capabilities) => Boolean(capabilities?.documentSymbolProvider),
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
label: "workspace_symbols(query)",
|
|
37
|
-
isSupported: (capabilities) => Boolean(capabilities?.workspaceSymbolProvider),
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
label: "rename(file,line,char,newName)",
|
|
41
|
-
isSupported: (capabilities) => Boolean(capabilities?.renameProvider),
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
label: "code_actions(file,line,char)",
|
|
45
|
-
isSupported: (capabilities) => Boolean(capabilities?.codeActionProvider),
|
|
46
|
-
},
|
|
47
|
-
] as const;
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Get the list of supported LSP server actions based on capabilities.
|
|
51
|
-
*/
|
|
52
|
-
export function getSupportedLspServerActions(
|
|
53
|
-
capabilities: ServerCapabilities | null | undefined,
|
|
54
|
-
): string[] {
|
|
55
|
-
if (!capabilities) return [];
|
|
56
|
-
return LSP_SERVER_SUPPORTED_ACTION_SPECS.filter((spec) => spec.isSupported(capabilities)).map(
|
|
57
|
-
(spec) => spec.label,
|
|
58
|
-
);
|
|
59
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import ignore from "ignore";
|
|
2
|
-
|
|
3
|
-
/** Gitignore-style glob pattern matching for path exclusion.
|
|
4
|
-
*
|
|
5
|
-
* Delegates to the {@link https://github.com/kaelzhang/node-ignore | ignore} package,
|
|
6
|
-
* which provides battle-tested .gitignore semantics used by ESLint, Prettier, and others.
|
|
7
|
-
*
|
|
8
|
-
* Supports full gitignore syntax: literal names, `*` / `?` wildcards, `**` recursive globs,
|
|
9
|
-
* leading `/` anchored patterns, trailing `/` directory-only patterns, and `!` negation.
|
|
10
|
-
*
|
|
11
|
-
* **Note:** Patterns that start with `#` are treated as comments unless escaped with `\#`.
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Check whether a project-relative file path matches a gitignore-style glob pattern.
|
|
16
|
-
*
|
|
17
|
-
* @param filePath - Relative file path with forward slashes (e.g. `"src/__tests__/bar.test.ts"`)
|
|
18
|
-
* @param pattern - Gitignore-style glob pattern (e.g. `"__tests__/"`, `"*.test.ts"`, `"/build"`)
|
|
19
|
-
* @returns `true` if the file path matches the pattern
|
|
20
|
-
*/
|
|
21
|
-
export function isGlobMatch(filePath: string, pattern: string): boolean {
|
|
22
|
-
if (!filePath || !pattern) return false;
|
|
23
|
-
return ignore().add(pattern).ignores(filePath);
|
|
24
|
-
}
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { spawnSync } from "node:child_process";
|
|
4
|
-
import { createHash } from "node:crypto";
|
|
5
|
-
import * as fs from "node:fs";
|
|
6
|
-
import { createRequire } from "node:module";
|
|
7
|
-
import * as os from "node:os";
|
|
8
|
-
import * as path from "node:path";
|
|
9
|
-
import { fileURLToPath } from "node:url";
|
|
10
|
-
|
|
11
|
-
const require = createRequire(import.meta.url);
|
|
12
|
-
const scriptDir = path.dirname(fileURLToPath(import.meta.url));
|
|
13
|
-
const packageRoot = path.resolve(scriptDir, "..");
|
|
14
|
-
const wasmDir = path.join(packageRoot, "resources", "grammars", "kotlin");
|
|
15
|
-
const wasmPath = path.join(wasmDir, "tree-sitter-kotlin.wasm");
|
|
16
|
-
const metadataPath = path.join(wasmDir, "tree-sitter-kotlin.wasm.json");
|
|
17
|
-
const checkMode = process.argv.includes("--check");
|
|
18
|
-
|
|
19
|
-
function readPackage(packageName) {
|
|
20
|
-
const packageJsonPath = require.resolve(`${packageName}/package.json`);
|
|
21
|
-
return {
|
|
22
|
-
dir: path.dirname(packageJsonPath),
|
|
23
|
-
json: JSON.parse(fs.readFileSync(packageJsonPath, "utf-8")),
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function sha256(filePath) {
|
|
28
|
-
return createHash("sha256").update(fs.readFileSync(filePath)).digest("hex");
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function readMetadata() {
|
|
32
|
-
return JSON.parse(fs.readFileSync(metadataPath, "utf-8"));
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function expectedReleaseAsset(version) {
|
|
36
|
-
return `https://github.com/fwcd/tree-sitter-kotlin/releases/download/${version}/tree-sitter-kotlin.wasm`;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function assertKotlinWasmCurrent() {
|
|
40
|
-
const kotlinPackage = readPackage("tree-sitter-kotlin");
|
|
41
|
-
const cliPackage = readPackage("tree-sitter-cli");
|
|
42
|
-
const metadata = readMetadata();
|
|
43
|
-
const actualSha = sha256(wasmPath);
|
|
44
|
-
const errors = [];
|
|
45
|
-
|
|
46
|
-
if (metadata.source?.npmPackage !== "tree-sitter-kotlin") {
|
|
47
|
-
errors.push("metadata source package must be tree-sitter-kotlin");
|
|
48
|
-
}
|
|
49
|
-
if (metadata.source?.version !== kotlinPackage.json.version) {
|
|
50
|
-
errors.push(
|
|
51
|
-
`metadata pins tree-sitter-kotlin ${metadata.source?.version}, but installed package is ${kotlinPackage.json.version}`,
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
if (metadata.source?.releaseAsset !== expectedReleaseAsset(kotlinPackage.json.version)) {
|
|
55
|
-
errors.push(
|
|
56
|
-
"metadata release asset URL does not match the installed tree-sitter-kotlin version",
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
if (metadata.generatedWith?.treeSitterCli !== cliPackage.json.version) {
|
|
60
|
-
errors.push(
|
|
61
|
-
`metadata pins tree-sitter-cli ${metadata.generatedWith?.treeSitterCli}, but installed CLI is ${cliPackage.json.version}`,
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
if (metadata.sha256 !== actualSha) {
|
|
65
|
-
errors.push(`metadata sha256 ${metadata.sha256} does not match vendored file ${actualSha}`);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if (errors.length > 0) {
|
|
69
|
-
throw new Error(
|
|
70
|
-
`Vendored Kotlin Tree-sitter WASM is stale:\n- ${errors.join("\n- ")}\nRun: pnpm --filter @mrclrchtr/supi-tree-sitter generate:kotlin-wasm`,
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
process.stdout.write(
|
|
75
|
-
`Kotlin Tree-sitter WASM is current (${kotlinPackage.json.version}, ${actualSha}).\n`,
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function generateKotlinWasm() {
|
|
80
|
-
const kotlinPackage = readPackage("tree-sitter-kotlin");
|
|
81
|
-
const cliPackage = readPackage("tree-sitter-cli");
|
|
82
|
-
const cliPath = path.join(cliPackage.dir, "cli.js");
|
|
83
|
-
const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), "supi-kotlin-wasm-"));
|
|
84
|
-
const grammarDir = path.join(tempRoot, "tree-sitter-kotlin");
|
|
85
|
-
|
|
86
|
-
try {
|
|
87
|
-
fs.cpSync(kotlinPackage.dir, grammarDir, { recursive: true });
|
|
88
|
-
const result = spawnSync(process.execPath, [cliPath, "build", "--wasm"], {
|
|
89
|
-
cwd: grammarDir,
|
|
90
|
-
stdio: "inherit",
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
if (result.status !== 0) {
|
|
94
|
-
throw new Error(
|
|
95
|
-
"tree-sitter build --wasm failed. Install Docker or Emscripten, then rerun generate:kotlin-wasm.",
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
const generatedWasmPath = path.join(grammarDir, "tree-sitter-kotlin.wasm");
|
|
100
|
-
if (!fs.existsSync(generatedWasmPath)) {
|
|
101
|
-
throw new Error(`Expected generated WASM at ${generatedWasmPath}`);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
fs.mkdirSync(wasmDir, { recursive: true });
|
|
105
|
-
fs.copyFileSync(generatedWasmPath, wasmPath);
|
|
106
|
-
|
|
107
|
-
const checksum = sha256(wasmPath);
|
|
108
|
-
const metadata = {
|
|
109
|
-
source: {
|
|
110
|
-
npmPackage: "tree-sitter-kotlin",
|
|
111
|
-
version: kotlinPackage.json.version,
|
|
112
|
-
repository: "https://github.com/fwcd/tree-sitter-kotlin",
|
|
113
|
-
releaseAsset: expectedReleaseAsset(kotlinPackage.json.version),
|
|
114
|
-
},
|
|
115
|
-
generatedWith: {
|
|
116
|
-
treeSitterCli: cliPackage.json.version,
|
|
117
|
-
},
|
|
118
|
-
sha256: checksum,
|
|
119
|
-
};
|
|
120
|
-
fs.writeFileSync(metadataPath, `${JSON.stringify(metadata, null, 2)}\n`);
|
|
121
|
-
process.stdout.write(`Generated ${wasmPath}\n`);
|
|
122
|
-
process.stdout.write(`SHA256 ${checksum}\n`);
|
|
123
|
-
} finally {
|
|
124
|
-
fs.rmSync(tempRoot, { recursive: true, force: true });
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
if (checkMode) {
|
|
129
|
-
assertKotlinWasmCurrent();
|
|
130
|
-
} else {
|
|
131
|
-
generateKotlinWasm();
|
|
132
|
-
}
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* SQL Tree-sitter WASM generator
|
|
4
|
-
*
|
|
5
|
-
* Rebuilds the vendored SQL grammar WASM from the @derekstride/tree-sitter-sql
|
|
6
|
-
* npm package. This package is a devDependency ONLY — the vendored WASM is the
|
|
7
|
-
* sole runtime artifact. The npm package is never resolved at runtime.
|
|
8
|
-
*
|
|
9
|
-
* Trust considerations:
|
|
10
|
-
* - The @derekstride/tree-sitter-sql install script uses "npx --yes", which
|
|
11
|
-
* some package managers flag as a supply-chain risk. This workspace disables
|
|
12
|
-
* that package's build script explicitly via pnpm `allowBuilds`.
|
|
13
|
-
* - The WASM is built locally from the installed package source (not downloaded
|
|
14
|
-
* from npm). The build uses tree-sitter-cli with Emscripten/Docker.
|
|
15
|
-
* - Alternatives considered: tree-sitter-sql (m-novikov, stale since 2021),
|
|
16
|
-
* tree-sitter-sql-bigquery (dialect-specific), and dialect-specific grammars.
|
|
17
|
-
* derekstride/tree-sitter-sql is the most mature general-purpose SQL grammar.
|
|
18
|
-
*
|
|
19
|
-
* Usage:
|
|
20
|
-
* pnpm --filter @mrclrchtr/supi-tree-sitter generate:sql-wasm
|
|
21
|
-
* pnpm --filter @mrclrchtr/supi-tree-sitter check:sql-wasm
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
import { spawnSync } from "node:child_process";
|
|
25
|
-
import { createHash } from "node:crypto";
|
|
26
|
-
import * as fs from "node:fs";
|
|
27
|
-
import { createRequire } from "node:module";
|
|
28
|
-
import * as os from "node:os";
|
|
29
|
-
import * as path from "node:path";
|
|
30
|
-
import { fileURLToPath } from "node:url";
|
|
31
|
-
|
|
32
|
-
const require = createRequire(import.meta.url);
|
|
33
|
-
const scriptDir = path.dirname(fileURLToPath(import.meta.url));
|
|
34
|
-
const packageRoot = path.resolve(scriptDir, "..");
|
|
35
|
-
const wasmDir = path.join(packageRoot, "resources", "grammars", "sql");
|
|
36
|
-
const wasmPath = path.join(wasmDir, "tree-sitter-sql.wasm");
|
|
37
|
-
const metadataPath = path.join(wasmDir, "tree-sitter-sql.wasm.json");
|
|
38
|
-
const checkMode = process.argv.includes("--check");
|
|
39
|
-
|
|
40
|
-
function readPackage(packageName) {
|
|
41
|
-
const packageJsonPath = require.resolve(`${packageName}/package.json`);
|
|
42
|
-
return {
|
|
43
|
-
dir: path.dirname(packageJsonPath),
|
|
44
|
-
json: JSON.parse(fs.readFileSync(packageJsonPath, "utf-8")),
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function sha256(filePath) {
|
|
49
|
-
return createHash("sha256").update(fs.readFileSync(filePath)).digest("hex");
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function readMetadata() {
|
|
53
|
-
return JSON.parse(fs.readFileSync(metadataPath, "utf-8"));
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function assertSqlWasmCurrent() {
|
|
57
|
-
const sqlPackage = readPackage("@derekstride/tree-sitter-sql");
|
|
58
|
-
const cliPackage = readPackage("tree-sitter-cli");
|
|
59
|
-
const metadata = readMetadata();
|
|
60
|
-
const actualSha = sha256(wasmPath);
|
|
61
|
-
const errors = [];
|
|
62
|
-
|
|
63
|
-
if (metadata.source?.npmPackage !== "@derekstride/tree-sitter-sql") {
|
|
64
|
-
errors.push("metadata source package must be @derekstride/tree-sitter-sql");
|
|
65
|
-
}
|
|
66
|
-
if (metadata.source?.version !== sqlPackage.json.version) {
|
|
67
|
-
errors.push(
|
|
68
|
-
`metadata pins @derekstride/tree-sitter-sql ${metadata.source?.version}, but installed package is ${sqlPackage.json.version}`,
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
if (metadata.generatedWith?.treeSitterCli !== cliPackage.json.version) {
|
|
72
|
-
errors.push(
|
|
73
|
-
`metadata pins tree-sitter-cli ${metadata.generatedWith?.treeSitterCli}, but installed CLI is ${cliPackage.json.version}`,
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
if (metadata.sha256 !== actualSha) {
|
|
77
|
-
errors.push(`metadata sha256 ${metadata.sha256} does not match vendored file ${actualSha}`);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
if (errors.length > 0) {
|
|
81
|
-
throw new Error(
|
|
82
|
-
`Vendored SQL Tree-sitter WASM is stale:\n- ${errors.join("\n- ")}\nRun: pnpm --filter @mrclrchtr/supi-tree-sitter generate:sql-wasm`,
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
process.stdout.write(
|
|
87
|
-
`SQL Tree-sitter WASM is current (${sqlPackage.json.version}, ${actualSha}).\n`,
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function generateSqlWasm() {
|
|
92
|
-
const sqlPackage = readPackage("@derekstride/tree-sitter-sql");
|
|
93
|
-
const cliPackage = readPackage("tree-sitter-cli");
|
|
94
|
-
const cliPath = path.join(cliPackage.dir, "cli.js");
|
|
95
|
-
const tempRoot = fs.mkdtempSync(path.join(os.tmpdir(), "supi-sql-wasm-"));
|
|
96
|
-
const grammarDir = path.join(tempRoot, "tree-sitter-sql");
|
|
97
|
-
|
|
98
|
-
try {
|
|
99
|
-
fs.cpSync(sqlPackage.dir, grammarDir, { recursive: true });
|
|
100
|
-
|
|
101
|
-
// tree-sitter-cli requires a "tree-sitter" section in package.json
|
|
102
|
-
const grammarPackageJsonPath = path.join(grammarDir, "package.json");
|
|
103
|
-
const grammarPackageJson = JSON.parse(fs.readFileSync(grammarPackageJsonPath, "utf-8"));
|
|
104
|
-
grammarPackageJson["tree-sitter"] = [{ scope: "source.sql" }];
|
|
105
|
-
fs.writeFileSync(grammarPackageJsonPath, JSON.stringify(grammarPackageJson, null, 2));
|
|
106
|
-
|
|
107
|
-
const result = spawnSync(process.execPath, [cliPath, "build", "--wasm"], {
|
|
108
|
-
cwd: grammarDir,
|
|
109
|
-
stdio: "inherit",
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
if (result.status !== 0) {
|
|
113
|
-
throw new Error(
|
|
114
|
-
"tree-sitter build --wasm failed. Install Docker or Emscripten, then rerun generate:sql-wasm.",
|
|
115
|
-
);
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
const generatedWasmPath = path.join(grammarDir, "tree-sitter-sql.wasm");
|
|
119
|
-
if (!fs.existsSync(generatedWasmPath)) {
|
|
120
|
-
throw new Error(`Expected generated WASM at ${generatedWasmPath}`);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
fs.mkdirSync(wasmDir, { recursive: true });
|
|
124
|
-
fs.copyFileSync(generatedWasmPath, wasmPath);
|
|
125
|
-
|
|
126
|
-
const checksum = sha256(wasmPath);
|
|
127
|
-
const metadata = {
|
|
128
|
-
source: {
|
|
129
|
-
npmPackage: "@derekstride/tree-sitter-sql",
|
|
130
|
-
version: sqlPackage.json.version,
|
|
131
|
-
repository: "https://github.com/derekstride/tree-sitter-sql",
|
|
132
|
-
},
|
|
133
|
-
generatedWith: {
|
|
134
|
-
treeSitterCli: cliPackage.json.version,
|
|
135
|
-
},
|
|
136
|
-
sha256: checksum,
|
|
137
|
-
trust: {
|
|
138
|
-
note: "The @derekstride/tree-sitter-sql npm package is a devDependency only. It is never resolved at runtime; the vendored WASM above is the sole runtime artifact. This workspace explicitly disables the package's npx-based install script via pnpm allowBuilds. The WASM was built locally from the installed package source. See scripts/generate-sql-wasm.mjs for the rebuild procedure.",
|
|
139
|
-
alternativesConsidered: [
|
|
140
|
-
"tree-sitter-sql (m-novikov, 2021, stale)",
|
|
141
|
-
"tree-sitter-sql-bigquery (BigQuery-specific)",
|
|
142
|
-
"dialect-specific grammars (too narrow)",
|
|
143
|
-
],
|
|
144
|
-
},
|
|
145
|
-
};
|
|
146
|
-
fs.writeFileSync(metadataPath, `${JSON.stringify(metadata, null, 2)}\n`);
|
|
147
|
-
process.stdout.write(`Generated ${wasmPath}\n`);
|
|
148
|
-
process.stdout.write(`SHA256 ${checksum}\n`);
|
|
149
|
-
} finally {
|
|
150
|
-
fs.rmSync(tempRoot, { recursive: true, force: true });
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
if (checkMode) {
|
|
155
|
-
assertSqlWasmCurrent();
|
|
156
|
-
} else {
|
|
157
|
-
generateSqlWasm();
|
|
158
|
-
}
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Vendors Tree-sitter grammar WASM files from their installed npm packages
|
|
4
|
-
* into the package's resources/ directory.
|
|
5
|
-
*
|
|
6
|
-
* Grammars whose npm packages ship pre-built WASM files are copied directly.
|
|
7
|
-
* Kotlin and SQL are handled by dedicated generator scripts because their
|
|
8
|
-
* npm packages do not include WASM files.
|
|
9
|
-
*
|
|
10
|
-
* Usage:
|
|
11
|
-
* node scripts/vendor-wasm.mjs # Copy WASM files
|
|
12
|
-
* node scripts/vendor-wasm.mjs --check # Verify checksums
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
import { createHash } from "node:crypto";
|
|
16
|
-
import * as fs from "node:fs";
|
|
17
|
-
import { createRequire } from "node:module";
|
|
18
|
-
import * as path from "node:path";
|
|
19
|
-
import { fileURLToPath } from "node:url";
|
|
20
|
-
|
|
21
|
-
const require = createRequire(import.meta.url);
|
|
22
|
-
const scriptDir = path.dirname(fileURLToPath(import.meta.url));
|
|
23
|
-
const packageRoot = path.resolve(scriptDir, "..");
|
|
24
|
-
const resourcesDir = path.join(packageRoot, "resources", "grammars");
|
|
25
|
-
const checkMode = process.argv.includes("--check");
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Map: grammarId → { npmPackage, wasmFile }
|
|
29
|
-
* Only grammars whose npm packages ship .wasm files belong here.
|
|
30
|
-
* Kotlin and SQL use dedicated generator scripts (generate-kotlin-wasm.mjs,
|
|
31
|
-
* generate-sql-wasm.mjs) because their packages do not include WASM.
|
|
32
|
-
*/
|
|
33
|
-
const GRAMMAR_SOURCES = {
|
|
34
|
-
javascript: { npmPackage: "tree-sitter-javascript", wasmFile: "tree-sitter-javascript.wasm" },
|
|
35
|
-
typescript: { npmPackage: "tree-sitter-typescript", wasmFile: "tree-sitter-typescript.wasm" },
|
|
36
|
-
tsx: { npmPackage: "tree-sitter-typescript", wasmFile: "tree-sitter-tsx.wasm" },
|
|
37
|
-
python: { npmPackage: "tree-sitter-python", wasmFile: "tree-sitter-python.wasm" },
|
|
38
|
-
rust: { npmPackage: "tree-sitter-rust", wasmFile: "tree-sitter-rust.wasm" },
|
|
39
|
-
go: { npmPackage: "tree-sitter-go", wasmFile: "tree-sitter-go.wasm" },
|
|
40
|
-
c: { npmPackage: "tree-sitter-c", wasmFile: "tree-sitter-c.wasm" },
|
|
41
|
-
cpp: { npmPackage: "tree-sitter-cpp", wasmFile: "tree-sitter-cpp.wasm" },
|
|
42
|
-
java: { npmPackage: "tree-sitter-java", wasmFile: "tree-sitter-java.wasm" },
|
|
43
|
-
ruby: { npmPackage: "tree-sitter-ruby", wasmFile: "tree-sitter-ruby.wasm" },
|
|
44
|
-
bash: { npmPackage: "tree-sitter-bash", wasmFile: "tree-sitter-bash.wasm" },
|
|
45
|
-
html: { npmPackage: "tree-sitter-html", wasmFile: "tree-sitter-html.wasm" },
|
|
46
|
-
r: { npmPackage: "@davisvaughan/tree-sitter-r", wasmFile: "tree-sitter-r.wasm" },
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
function sha256(filePath) {
|
|
50
|
-
return createHash("sha256").update(fs.readFileSync(filePath)).digest("hex");
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function readPackage(packageName) {
|
|
54
|
-
const packageJsonPath = require.resolve(`${packageName}/package.json`);
|
|
55
|
-
return {
|
|
56
|
-
dir: path.dirname(packageJsonPath),
|
|
57
|
-
json: JSON.parse(fs.readFileSync(packageJsonPath, "utf-8")),
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
function vendorGrammar(grammarId, source) {
|
|
62
|
-
const pkg = readPackage(source.npmPackage);
|
|
63
|
-
const srcWasmPath = path.join(pkg.dir, source.wasmFile);
|
|
64
|
-
|
|
65
|
-
if (!fs.existsSync(srcWasmPath)) {
|
|
66
|
-
throw new Error(
|
|
67
|
-
`WASM file not found in ${source.npmPackage} at ${srcWasmPath}. ` +
|
|
68
|
-
`Ensure the package is installed (pnpm install) and ships a .wasm file.`,
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
const grammarDir = path.join(resourcesDir, grammarId);
|
|
73
|
-
const destWasmPath = path.join(grammarDir, source.wasmFile);
|
|
74
|
-
const metadataPath = path.join(grammarDir, `${source.wasmFile}.json`);
|
|
75
|
-
|
|
76
|
-
fs.mkdirSync(grammarDir, { recursive: true });
|
|
77
|
-
fs.copyFileSync(srcWasmPath, destWasmPath);
|
|
78
|
-
|
|
79
|
-
const checksum = sha256(destWasmPath);
|
|
80
|
-
const metadata = {
|
|
81
|
-
source: {
|
|
82
|
-
npmPackage: source.npmPackage,
|
|
83
|
-
version: pkg.json.version,
|
|
84
|
-
},
|
|
85
|
-
sha256: checksum,
|
|
86
|
-
};
|
|
87
|
-
fs.writeFileSync(metadataPath, `${JSON.stringify(metadata, null, 2)}\n`);
|
|
88
|
-
|
|
89
|
-
process.stdout.write(
|
|
90
|
-
`${grammarId}: ${source.wasmFile} (${source.npmPackage} ${pkg.json.version}, ${checksum})\n`,
|
|
91
|
-
);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
function checkGrammar(grammarId, source) {
|
|
95
|
-
const grammarDir = path.join(resourcesDir, grammarId);
|
|
96
|
-
const wasmPath = path.join(grammarDir, source.wasmFile);
|
|
97
|
-
const metadataPath = path.join(grammarDir, `${source.wasmFile}.json`);
|
|
98
|
-
const errors = [];
|
|
99
|
-
|
|
100
|
-
if (!fs.existsSync(wasmPath)) {
|
|
101
|
-
errors.push(`${grammarId}: missing vendored WASM at ${wasmPath}`);
|
|
102
|
-
return errors;
|
|
103
|
-
}
|
|
104
|
-
if (!fs.existsSync(metadataPath)) {
|
|
105
|
-
errors.push(`${grammarId}: missing metadata at ${metadataPath}`);
|
|
106
|
-
return errors;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
try {
|
|
110
|
-
const pkg = readPackage(source.npmPackage);
|
|
111
|
-
const sourceWasmPath = path.join(pkg.dir, source.wasmFile);
|
|
112
|
-
if (!fs.existsSync(sourceWasmPath)) {
|
|
113
|
-
errors.push(`${grammarId}: installed package is missing ${source.wasmFile}`);
|
|
114
|
-
return errors;
|
|
115
|
-
}
|
|
116
|
-
const metadata = JSON.parse(fs.readFileSync(metadataPath, "utf-8"));
|
|
117
|
-
const actualSha = sha256(wasmPath);
|
|
118
|
-
const sourceSha = sha256(sourceWasmPath);
|
|
119
|
-
|
|
120
|
-
if (metadata.source?.npmPackage !== source.npmPackage) {
|
|
121
|
-
errors.push(`${grammarId}: metadata source npmPackage mismatch`);
|
|
122
|
-
}
|
|
123
|
-
if (metadata.source?.version !== pkg.json.version) {
|
|
124
|
-
errors.push(
|
|
125
|
-
`${grammarId}: metadata version ${metadata.source?.version} !== installed ${pkg.json.version}`,
|
|
126
|
-
);
|
|
127
|
-
}
|
|
128
|
-
if (actualSha !== sourceSha) {
|
|
129
|
-
errors.push(
|
|
130
|
-
`${grammarId}: vendored sha256 ${actualSha} !== installed package source ${sourceSha}`,
|
|
131
|
-
);
|
|
132
|
-
}
|
|
133
|
-
if (metadata.sha256 !== actualSha) {
|
|
134
|
-
errors.push(`${grammarId}: metadata sha256 ${metadata.sha256} !== vendored ${actualSha}`);
|
|
135
|
-
}
|
|
136
|
-
if (metadata.sha256 !== sourceSha) {
|
|
137
|
-
errors.push(
|
|
138
|
-
`${grammarId}: metadata sha256 ${metadata.sha256} !== installed package source ${sourceSha}`,
|
|
139
|
-
);
|
|
140
|
-
}
|
|
141
|
-
} catch (err) {
|
|
142
|
-
errors.push(`${grammarId}: ${err.message}`);
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
return errors;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
// Main
|
|
149
|
-
if (checkMode) {
|
|
150
|
-
let allErrors = [];
|
|
151
|
-
for (const [grammarId, source] of Object.entries(GRAMMAR_SOURCES)) {
|
|
152
|
-
const errors = checkGrammar(grammarId, source);
|
|
153
|
-
allErrors = allErrors.concat(errors);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
if (allErrors.length > 0) {
|
|
157
|
-
throw new Error(
|
|
158
|
-
`Vendored WASM checks failed:\n- ${allErrors.join("\n- ")}\nRun: node scripts/vendor-wasm.mjs`,
|
|
159
|
-
);
|
|
160
|
-
}
|
|
161
|
-
process.stdout.write("All vendored WASM files are current.\n");
|
|
162
|
-
} else {
|
|
163
|
-
for (const [grammarId, source] of Object.entries(GRAMMAR_SOURCES)) {
|
|
164
|
-
vendorGrammar(grammarId, source);
|
|
165
|
-
}
|
|
166
|
-
process.stdout.write("All vendored WASM files generated.\n");
|
|
167
|
-
}
|