@stsepelin/checktrail 0.1.0-alpha.1
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/CONTRIBUTING.md +42 -0
- package/LICENSE +21 -0
- package/README.md +355 -0
- package/SECURITY.md +46 -0
- package/dist/src/actionlint-evidence.d.ts +2 -0
- package/dist/src/actionlint-evidence.js +166 -0
- package/dist/src/actionlint-inputs.d.ts +5 -0
- package/dist/src/actionlint-inputs.js +123 -0
- package/dist/src/actionlint-runner.d.ts +1 -0
- package/dist/src/actionlint-runner.js +122 -0
- package/dist/src/actionlint.d.ts +19 -0
- package/dist/src/actionlint.js +80 -0
- package/dist/src/adapters.d.ts +49 -0
- package/dist/src/adapters.js +430 -0
- package/dist/src/architecture.d.ts +107 -0
- package/dist/src/architecture.js +230 -0
- package/dist/src/clang-evidence.d.ts +2 -0
- package/dist/src/clang-evidence.js +194 -0
- package/dist/src/clang-protocol.d.ts +3 -0
- package/dist/src/clang-protocol.js +25 -0
- package/dist/src/clang-runner.d.ts +1 -0
- package/dist/src/clang-runner.js +159 -0
- package/dist/src/clang.d.ts +44 -0
- package/dist/src/clang.js +197 -0
- package/dist/src/cli.d.ts +2 -0
- package/dist/src/cli.js +338 -0
- package/dist/src/config.d.ts +33 -0
- package/dist/src/config.js +140 -0
- package/dist/src/contract-schema.d.ts +85 -0
- package/dist/src/contract-schema.js +56 -0
- package/dist/src/contract-worker.d.ts +1 -0
- package/dist/src/contract-worker.js +123 -0
- package/dist/src/contracts.d.ts +22 -0
- package/dist/src/contracts.js +123 -0
- package/dist/src/django-evidence.d.ts +2 -0
- package/dist/src/django-evidence.js +100 -0
- package/dist/src/django-runner.d.ts +1 -0
- package/dist/src/django-runner.js +80 -0
- package/dist/src/django.d.ts +9 -0
- package/dist/src/django.js +50 -0
- package/dist/src/dotnet-compiler.d.ts +1 -0
- package/dist/src/dotnet-compiler.js +87 -0
- package/dist/src/dotnet-evidence.d.ts +2 -0
- package/dist/src/dotnet-evidence.js +127 -0
- package/dist/src/dotnet-runner.d.ts +1 -0
- package/dist/src/dotnet-runner.js +167 -0
- package/dist/src/dotnet.d.ts +65 -0
- package/dist/src/dotnet.js +120 -0
- package/dist/src/engine.d.ts +19 -0
- package/dist/src/engine.js +239 -0
- package/dist/src/environment.d.ts +6 -0
- package/dist/src/environment.js +36 -0
- package/dist/src/eslint-evidence.d.ts +2 -0
- package/dist/src/eslint-evidence.js +98 -0
- package/dist/src/eslint-runner.d.ts +1 -0
- package/dist/src/eslint-runner.js +61 -0
- package/dist/src/eslint.d.ts +2 -0
- package/dist/src/eslint.js +40 -0
- package/dist/src/evidence.d.ts +2 -0
- package/dist/src/evidence.js +313 -0
- package/dist/src/external-adapter.d.ts +164 -0
- package/dist/src/external-adapter.js +265 -0
- package/dist/src/external-evidence.d.ts +2 -0
- package/dist/src/external-evidence.js +127 -0
- package/dist/src/external-runner.d.ts +1 -0
- package/dist/src/external-runner.js +122 -0
- package/dist/src/fastapi-evidence.d.ts +2 -0
- package/dist/src/fastapi-evidence.js +126 -0
- package/dist/src/fastapi-runner.d.ts +1 -0
- package/dist/src/fastapi-runner.js +84 -0
- package/dist/src/fastapi.d.ts +10 -0
- package/dist/src/fastapi.js +52 -0
- package/dist/src/fetch-pack.d.ts +16 -0
- package/dist/src/fetch-pack.js +154 -0
- package/dist/src/finding-policy-schema.d.ts +146 -0
- package/dist/src/finding-policy-schema.js +70 -0
- package/dist/src/finding-policy.d.ts +62 -0
- package/dist/src/finding-policy.js +206 -0
- package/dist/src/git-selection.d.ts +3 -0
- package/dist/src/git-selection.js +229 -0
- package/dist/src/go-directives.d.ts +1 -0
- package/dist/src/go-directives.js +32 -0
- package/dist/src/go-scope.d.ts +11 -0
- package/dist/src/go-scope.js +122 -0
- package/dist/src/golangci-evidence.d.ts +2 -0
- package/dist/src/golangci-evidence.js +92 -0
- package/dist/src/golangci-runner.d.ts +1 -0
- package/dist/src/golangci-runner.js +124 -0
- package/dist/src/golangci.d.ts +2 -0
- package/dist/src/golangci.js +35 -0
- package/dist/src/guidance.d.ts +98 -0
- package/dist/src/guidance.js +247 -0
- package/dist/src/index.d.ts +31 -0
- package/dist/src/index.js +16 -0
- package/dist/src/inventory.d.ts +4 -0
- package/dist/src/inventory.js +94 -0
- package/dist/src/java-compiler.d.ts +1 -0
- package/dist/src/java-compiler.js +110 -0
- package/dist/src/java-evidence.d.ts +2 -0
- package/dist/src/java-evidence.js +114 -0
- package/dist/src/java-runner.d.ts +1 -0
- package/dist/src/java-runner.js +79 -0
- package/dist/src/java.d.ts +25 -0
- package/dist/src/java.js +102 -0
- package/dist/src/jest-evidence.d.ts +2 -0
- package/dist/src/jest-evidence.js +117 -0
- package/dist/src/jest-runner.d.ts +1 -0
- package/dist/src/jest-runner.js +46 -0
- package/dist/src/jest.d.ts +2 -0
- package/dist/src/jest.js +36 -0
- package/dist/src/junit.d.ts +18 -0
- package/dist/src/junit.js +157 -0
- package/dist/src/laravel-evidence.d.ts +2 -0
- package/dist/src/laravel-evidence.js +175 -0
- package/dist/src/laravel-runner.d.ts +1 -0
- package/dist/src/laravel-runner.js +168 -0
- package/dist/src/laravel.d.ts +8 -0
- package/dist/src/laravel.js +50 -0
- package/dist/src/local-tool.d.ts +1 -0
- package/dist/src/local-tool.js +19 -0
- package/dist/src/mcp.d.ts +14 -0
- package/dist/src/mcp.js +362 -0
- package/dist/src/mutation.d.ts +118 -0
- package/dist/src/mutation.js +370 -0
- package/dist/src/mypy-evidence.d.ts +2 -0
- package/dist/src/mypy-evidence.js +63 -0
- package/dist/src/mypy.d.ts +2 -0
- package/dist/src/mypy.js +59 -0
- package/dist/src/node-reporter.d.ts +1 -0
- package/dist/src/node-reporter.js +28 -0
- package/dist/src/nuxt-evidence.d.ts +2 -0
- package/dist/src/nuxt-evidence.js +160 -0
- package/dist/src/nuxt-protocol.d.ts +52 -0
- package/dist/src/nuxt-protocol.js +29 -0
- package/dist/src/nuxt-runner.d.ts +1 -0
- package/dist/src/nuxt-runner.js +165 -0
- package/dist/src/nuxt.d.ts +24 -0
- package/dist/src/nuxt.js +105 -0
- package/dist/src/output.d.ts +3 -0
- package/dist/src/output.js +48 -0
- package/dist/src/phpstan-evidence.d.ts +2 -0
- package/dist/src/phpstan-evidence.js +81 -0
- package/dist/src/phpstan.d.ts +2 -0
- package/dist/src/phpstan.js +51 -0
- package/dist/src/phpunit-evidence.d.ts +2 -0
- package/dist/src/phpunit-evidence.js +53 -0
- package/dist/src/phpunit.d.ts +2 -0
- package/dist/src/phpunit.js +58 -0
- package/dist/src/pint-evidence.d.ts +2 -0
- package/dist/src/pint-evidence.js +79 -0
- package/dist/src/pint-runner.d.ts +1 -0
- package/dist/src/pint-runner.js +53 -0
- package/dist/src/pint.d.ts +2 -0
- package/dist/src/pint.js +37 -0
- package/dist/src/playwright-evidence.d.ts +2 -0
- package/dist/src/playwright-evidence.js +127 -0
- package/dist/src/playwright-reporter.d.ts +10 -0
- package/dist/src/playwright-reporter.js +37 -0
- package/dist/src/playwright-runner.d.ts +1 -0
- package/dist/src/playwright-runner.js +61 -0
- package/dist/src/playwright.d.ts +2 -0
- package/dist/src/playwright.js +35 -0
- package/dist/src/policy-pack.d.ts +21 -0
- package/dist/src/policy-pack.js +41 -0
- package/dist/src/pytest-evidence.d.ts +2 -0
- package/dist/src/pytest-evidence.js +116 -0
- package/dist/src/pytest-runner.d.ts +1 -0
- package/dist/src/pytest-runner.js +48 -0
- package/dist/src/pytest.d.ts +2 -0
- package/dist/src/pytest.js +25 -0
- package/dist/src/report-validation.d.ts +129 -0
- package/dist/src/report-validation.js +27 -0
- package/dist/src/review.d.ts +270 -0
- package/dist/src/review.js +349 -0
- package/dist/src/ruby.d.ts +2 -0
- package/dist/src/ruby.js +25 -0
- package/dist/src/ruff-evidence.d.ts +2 -0
- package/dist/src/ruff-evidence.js +99 -0
- package/dist/src/ruff.d.ts +2 -0
- package/dist/src/ruff.js +40 -0
- package/dist/src/runner.d.ts +8 -0
- package/dist/src/runner.js +117 -0
- package/dist/src/runtime-inventory.d.ts +112 -0
- package/dist/src/runtime-inventory.js +200 -0
- package/dist/src/rust-dep-info.d.ts +1 -0
- package/dist/src/rust-dep-info.js +46 -0
- package/dist/src/rust-evidence.d.ts +2 -0
- package/dist/src/rust-evidence.js +157 -0
- package/dist/src/rust-runner.d.ts +1 -0
- package/dist/src/rust-runner.js +161 -0
- package/dist/src/rust.d.ts +7 -0
- package/dist/src/rust.js +39 -0
- package/dist/src/sarif.d.ts +86 -0
- package/dist/src/sarif.js +113 -0
- package/dist/src/schemas.d.ts +393 -0
- package/dist/src/schemas.js +222 -0
- package/dist/src/staticcheck-evidence.d.ts +2 -0
- package/dist/src/staticcheck-evidence.js +75 -0
- package/dist/src/swift.d.ts +2 -0
- package/dist/src/swift.js +20 -0
- package/dist/src/task-store.d.ts +37 -0
- package/dist/src/task-store.js +349 -0
- package/dist/src/tool-versions.d.ts +3 -0
- package/dist/src/tool-versions.js +260 -0
- package/dist/src/types.d.ts +157 -0
- package/dist/src/types.js +37 -0
- package/dist/src/typescript-build-evidence.d.ts +2 -0
- package/dist/src/typescript-build-evidence.js +86 -0
- package/dist/src/typescript-build-runner.d.ts +1 -0
- package/dist/src/typescript-build-runner.js +132 -0
- package/dist/src/typescript-build.d.ts +2 -0
- package/dist/src/typescript-build.js +41 -0
- package/dist/src/typescript.d.ts +2 -0
- package/dist/src/typescript.js +54 -0
- package/dist/src/validation-task-worker.d.ts +1 -0
- package/dist/src/validation-task-worker.js +205 -0
- package/dist/src/validation-tasks-protocol.d.ts +69 -0
- package/dist/src/validation-tasks-protocol.js +57 -0
- package/dist/src/validation-tasks.d.ts +11 -0
- package/dist/src/validation-tasks.js +144 -0
- package/dist/src/vitest-evidence.d.ts +2 -0
- package/dist/src/vitest-evidence.js +112 -0
- package/dist/src/vitest-runner.d.ts +1 -0
- package/dist/src/vitest-runner.js +48 -0
- package/dist/src/vitest.d.ts +2 -0
- package/dist/src/vitest.js +36 -0
- package/dist/src/vue-router-capture.d.ts +42 -0
- package/dist/src/vue-router-capture.js +87 -0
- package/dist/src/vue-router-evidence.d.ts +2 -0
- package/dist/src/vue-router-evidence.js +126 -0
- package/dist/src/vue-router-protocol.d.ts +63 -0
- package/dist/src/vue-router-protocol.js +44 -0
- package/dist/src/vue-router-runner.d.ts +1 -0
- package/dist/src/vue-router-runner.js +88 -0
- package/dist/src/vue-router.d.ts +23 -0
- package/dist/src/vue-router.js +108 -0
- package/dist/src/vue-tsc-runner.d.ts +1 -0
- package/dist/src/vue-tsc-runner.js +24 -0
- package/dist/src/workspace.d.ts +7 -0
- package/dist/src/workspace.js +53 -0
- package/docs/ACCEPTANCE.md +56 -0
- package/docs/ACTIONLINT.md +112 -0
- package/docs/ARCHITECTURE-POLICY.md +82 -0
- package/docs/ARCHITECTURE.md +122 -0
- package/docs/CLANG.md +113 -0
- package/docs/CLIENTS.md +109 -0
- package/docs/CONTRACTS.md +73 -0
- package/docs/DEPENDENCIES.md +42 -0
- package/docs/DJANGO.md +70 -0
- package/docs/DOTNET.md +114 -0
- package/docs/ENVIRONMENTS.md +52 -0
- package/docs/ESLINT.md +68 -0
- package/docs/EVALUATION.md +124 -0
- package/docs/EXECUTION.md +250 -0
- package/docs/EXTERNAL-ADAPTERS.md +170 -0
- package/docs/EXTERNAL-EVALUATION.md +155 -0
- package/docs/EXTERNAL-RUFF-EVALUATION.md +85 -0
- package/docs/FASTAPI.md +73 -0
- package/docs/FINDING-POLICY.md +67 -0
- package/docs/GO-RACE.md +19 -0
- package/docs/GO-SCOPE.md +63 -0
- package/docs/GOLANGCI-LINT.md +64 -0
- package/docs/GUIDANCE.md +46 -0
- package/docs/IMPACT-MEASUREMENT.md +97 -0
- package/docs/INSTALLATION.md +102 -0
- package/docs/JAVA.md +79 -0
- package/docs/JEST.md +36 -0
- package/docs/JUNIT.md +31 -0
- package/docs/LANGUAGES.md +113 -0
- package/docs/LARAVEL.md +111 -0
- package/docs/MCP-COMPATIBILITY.md +68 -0
- package/docs/MUTATIONS.md +93 -0
- package/docs/MYPY.md +37 -0
- package/docs/NATIVE-CI.md +96 -0
- package/docs/NUXT.md +123 -0
- package/docs/PACK-DISTRIBUTION.md +98 -0
- package/docs/PERFORMANCE.md +71 -0
- package/docs/PEST.md +36 -0
- package/docs/PHPSTAN.md +48 -0
- package/docs/PHPUNIT.md +32 -0
- package/docs/PINT.md +41 -0
- package/docs/PLAN.md +265 -0
- package/docs/PLAYWRIGHT.md +73 -0
- package/docs/POLICY-PACKS.md +106 -0
- package/docs/PRIOR-WORKFLOW-EVALUATION.md +116 -0
- package/docs/PUBLICATION.md +28 -0
- package/docs/PYTEST.md +51 -0
- package/docs/RELEASE.md +115 -0
- package/docs/RENAMING.md +55 -0
- package/docs/REVIEW-EXCHANGE.md +136 -0
- package/docs/RUBY.md +50 -0
- package/docs/RUFF.md +39 -0
- package/docs/RUNTIME-INVENTORY.md +56 -0
- package/docs/RUST.md +74 -0
- package/docs/SARIF.md +64 -0
- package/docs/STATUS.md +530 -0
- package/docs/SWIFT.md +48 -0
- package/docs/TASK-STORAGE.md +141 -0
- package/docs/TOOL-IDENTITY.md +30 -0
- package/docs/TYPESCRIPT-BUILD.md +55 -0
- package/docs/VALIDATION-TASKS.md +119 -0
- package/docs/VITEST.md +36 -0
- package/docs/VUE-ROUTER.md +130 -0
- package/docs/VUE-TSC.md +26 -0
- package/docs/WORKSPACES.md +81 -0
- package/docs/licenses/nodable-entities-3.0.0.txt +21 -0
- package/docs/measurements/client-claude-before-schema-fix-darwin-arm64-node26.json +60 -0
- package/docs/measurements/client-claude-darwin-arm64-node26.json +55 -0
- package/docs/measurements/client-codex-darwin-arm64-node26.json +175 -0
- package/docs/measurements/evaluation-corpus-repo-verifier.json +332 -0
- package/docs/measurements/evaluation-darwin-arm64-node26.json +1236 -0
- package/docs/measurements/evaluation-linux-arm64-node22.json +1236 -0
- package/docs/measurements/external-eslint-darwin-arm64-node26.json +11866 -0
- package/docs/measurements/external-eslint-linux-arm64-node22.json +11866 -0
- package/docs/measurements/external-eslint-preservation.json +1527 -0
- package/docs/measurements/external-ruff-darwin-arm64-node26.json +1031 -0
- package/docs/measurements/external-ruff-linux-arm64-node22.json +1031 -0
- package/docs/measurements/hosted-ci-52ba415.json +1005 -0
- package/docs/measurements/impact-darwin-arm64-node26.json +6685 -0
- package/docs/measurements/impact-linux-arm64-node22.json +6690 -0
- package/docs/measurements/performance-darwin-arm64-node26.json +845 -0
- package/docs/measurements/performance-linux-arm64-node22.json +845 -0
- package/docs/measurements/required-native-profiles.json +500 -0
- package/package.json +72 -0
- package/packs/actionlint.json +8 -0
- package/packs/cpp.json +8 -0
- package/packs/dotnet.json +8 -0
- package/packs/go.json +7 -0
- package/packs/java.json +8 -0
- package/packs/javascript-node.json +7 -0
- package/packs/nuxt.json +7 -0
- package/packs/php-pest.json +7 -0
- package/packs/php-phpunit.json +7 -0
- package/packs/python-pytest.json +7 -0
- package/packs/ruby.json +7 -0
- package/packs/rust.json +7 -0
- package/packs/swift.json +7 -0
- package/packs/vue-router.json +7 -0
- package/packs/vue.json +11 -0
- package/schemas/actionlint-config.schema.json +19 -0
- package/schemas/architecture-policy.schema.json +51 -0
- package/schemas/architecture-report.schema.json +123 -0
- package/schemas/architecture-summary.schema.json +82 -0
- package/schemas/clang-database.schema.json +23 -0
- package/schemas/config.schema.json +69 -0
- package/schemas/contract-bundle.schema.json +78 -0
- package/schemas/contract-report.schema.json +114 -0
- package/schemas/contract-summary.schema.json +72 -0
- package/schemas/dependency-graph.schema.json +65 -0
- package/schemas/django-config.schema.json +16 -0
- package/schemas/dotnet-config.schema.json +60 -0
- package/schemas/external-manifest.schema.json +97 -0
- package/schemas/external-reference.schema.json +10 -0
- package/schemas/external-request.schema.json +56 -0
- package/schemas/external-result.schema.json +111 -0
- package/schemas/fastapi-config.schema.json +27 -0
- package/schemas/finding-baseline.schema.json +92 -0
- package/schemas/finding-comparison-summary.schema.json +95 -0
- package/schemas/finding-comparison.schema.json +121 -0
- package/schemas/guidance-context.schema.json +34 -0
- package/schemas/guidance-report.schema.json +176 -0
- package/schemas/guidance-summary.schema.json +68 -0
- package/schemas/java-config.schema.json +24 -0
- package/schemas/junit.schema.json +69 -0
- package/schemas/laravel-config.schema.json +11 -0
- package/schemas/mutation-recipe.schema.json +31 -0
- package/schemas/mutation-report.schema.json +238 -0
- package/schemas/mutation-summary.schema.json +98 -0
- package/schemas/nuxt-config.schema.json +51 -0
- package/schemas/plan-summary.schema.json +63 -0
- package/schemas/plan.schema.json +244 -0
- package/schemas/policy-pack.schema.json +41 -0
- package/schemas/report-summary.schema.json +100 -0
- package/schemas/report.schema.json +463 -0
- package/schemas/review-assessment.schema.json +133 -0
- package/schemas/review-context-summary.schema.json +31 -0
- package/schemas/review-context.schema.json +254 -0
- package/schemas/review-receipt-summary.schema.json +104 -0
- package/schemas/review-receipt.schema.json +271 -0
- package/schemas/review-selection.schema.json +30 -0
- package/schemas/runtime-comparison-summary.schema.json +68 -0
- package/schemas/runtime-comparison.schema.json +127 -0
- package/schemas/runtime-inventory.schema.json +99 -0
- package/schemas/vue-router-config.schema.json +67 -0
- package/server.json +47 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { environmentName } from "./environment.js";
|
|
4
|
+
import { readProjectFile } from "./inventory.js";
|
|
5
|
+
export const packReferenceSchema = z.strictObject({
|
|
6
|
+
path: z.string().min(1).max(4096),
|
|
7
|
+
sha256: z.string().regex(/^[a-f0-9]{64}$/),
|
|
8
|
+
});
|
|
9
|
+
export const policyPackSchema = z.strictObject({
|
|
10
|
+
schemaVersion: z.literal(1),
|
|
11
|
+
id: z
|
|
12
|
+
.string()
|
|
13
|
+
.regex(/^[a-z][a-z0-9]*(?:[.-][a-z0-9]+)*$/)
|
|
14
|
+
.max(256),
|
|
15
|
+
version: z
|
|
16
|
+
.string()
|
|
17
|
+
.regex(/^\d+\.\d+\.\d+(?:-[a-zA-Z0-9.-]+)?$/)
|
|
18
|
+
.max(128),
|
|
19
|
+
description: z.string().min(1).max(4096),
|
|
20
|
+
requiredChecks: z.array(z.string().min(1).max(256)).min(1).max(256),
|
|
21
|
+
requiredEnvironment: z.array(environmentName).max(64).optional(),
|
|
22
|
+
});
|
|
23
|
+
export function parsePolicyPack(contents) {
|
|
24
|
+
const pack = policyPackSchema.parse(JSON.parse(contents));
|
|
25
|
+
if (new Set(pack.requiredChecks).size !== pack.requiredChecks.length ||
|
|
26
|
+
new Set(pack.requiredEnvironment).size !==
|
|
27
|
+
(pack.requiredEnvironment?.length ?? 0))
|
|
28
|
+
throw new Error("Duplicate policy pack requirement");
|
|
29
|
+
return pack;
|
|
30
|
+
}
|
|
31
|
+
export async function loadPolicyPack(root, input) {
|
|
32
|
+
const reference = packReferenceSchema.parse(input);
|
|
33
|
+
const contents = await readProjectFile(root, reference.path);
|
|
34
|
+
if (Buffer.byteLength(contents) > 64 * 1024)
|
|
35
|
+
throw new Error("Policy pack exceeds 64 KiB limit");
|
|
36
|
+
const sha256 = createHash("sha256").update(contents).digest("hex");
|
|
37
|
+
if (sha256 !== reference.sha256)
|
|
38
|
+
throw new Error("Policy pack integrity mismatch");
|
|
39
|
+
const pack = parsePolicyPack(contents);
|
|
40
|
+
return { pack, sha256 };
|
|
41
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
const schema = z.object({
|
|
4
|
+
format: z.literal("checktrail-pytest-1"),
|
|
5
|
+
version: z.string().min(1),
|
|
6
|
+
exitCode: z.number().int().min(0).max(5),
|
|
7
|
+
finished: z.boolean(),
|
|
8
|
+
items: z.array(z.object({ id: z.string(), file: z.string() })),
|
|
9
|
+
reports: z.array(z.object({
|
|
10
|
+
id: z.string(),
|
|
11
|
+
phase: z.enum(["setup", "call", "teardown"]),
|
|
12
|
+
outcome: z.enum(["passed", "failed", "skipped"]),
|
|
13
|
+
xfail: z.boolean(),
|
|
14
|
+
})),
|
|
15
|
+
deselected: z.array(z.string()),
|
|
16
|
+
collectionErrors: z.array(z.string()),
|
|
17
|
+
});
|
|
18
|
+
export function pytestEvidence(check, processes, root) {
|
|
19
|
+
const incomplete = {
|
|
20
|
+
status: "inconclusive",
|
|
21
|
+
reason: "Pytest evidence is incomplete or does not account for every planned file and collected test.",
|
|
22
|
+
};
|
|
23
|
+
if (!root || processes.length !== 1 || !check.scope.length)
|
|
24
|
+
return incomplete;
|
|
25
|
+
const process = processes[0];
|
|
26
|
+
let value;
|
|
27
|
+
try {
|
|
28
|
+
value = JSON.parse(process.stdout);
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return incomplete;
|
|
32
|
+
}
|
|
33
|
+
if (process.exitCode === 3 &&
|
|
34
|
+
z
|
|
35
|
+
.object({
|
|
36
|
+
format: z.literal("checktrail-pytest-1"),
|
|
37
|
+
unavailable: z.literal("pytest"),
|
|
38
|
+
})
|
|
39
|
+
.safeParse(value).success)
|
|
40
|
+
return {
|
|
41
|
+
status: "unavailable",
|
|
42
|
+
reason: "Pytest is not installed in the selected python3 runtime.",
|
|
43
|
+
};
|
|
44
|
+
const parsed = schema.safeParse(value);
|
|
45
|
+
if (!parsed.success)
|
|
46
|
+
return incomplete;
|
|
47
|
+
const report = parsed.data;
|
|
48
|
+
if (report.exitCode !== process.exitCode || !report.finished)
|
|
49
|
+
return incomplete;
|
|
50
|
+
if (report.collectionErrors.length)
|
|
51
|
+
return {
|
|
52
|
+
status: "failed",
|
|
53
|
+
reason: "Pytest reported collection or import failures.",
|
|
54
|
+
};
|
|
55
|
+
if (report.exitCode === 2)
|
|
56
|
+
return incomplete;
|
|
57
|
+
if (report.exitCode === 3 || report.exitCode === 4)
|
|
58
|
+
return {
|
|
59
|
+
status: "error",
|
|
60
|
+
reason: "Pytest reported an internal or configuration error.",
|
|
61
|
+
};
|
|
62
|
+
const expected = new Set(check.scope.map((file) => path.resolve(root, check.project, file)));
|
|
63
|
+
const files = new Set();
|
|
64
|
+
const items = new Map();
|
|
65
|
+
for (const item of report.items) {
|
|
66
|
+
if (!expected.has(item.file) || items.has(item.id))
|
|
67
|
+
return incomplete;
|
|
68
|
+
files.add(item.file);
|
|
69
|
+
items.set(item.id, []);
|
|
70
|
+
}
|
|
71
|
+
for (const event of report.reports) {
|
|
72
|
+
const events = items.get(event.id);
|
|
73
|
+
if (!events || events.some((prior) => prior.phase === event.phase))
|
|
74
|
+
return incomplete;
|
|
75
|
+
events.push(event);
|
|
76
|
+
}
|
|
77
|
+
const tests = {
|
|
78
|
+
total: items.size,
|
|
79
|
+
passed: 0,
|
|
80
|
+
failed: 0,
|
|
81
|
+
skipped: 0,
|
|
82
|
+
};
|
|
83
|
+
for (const events of items.values()) {
|
|
84
|
+
const setup = events[0];
|
|
85
|
+
const teardown = events.at(-1);
|
|
86
|
+
if (setup?.phase !== "setup" || teardown?.phase !== "teardown")
|
|
87
|
+
return incomplete;
|
|
88
|
+
const call = events.find((event) => event.phase === "call");
|
|
89
|
+
if ((setup.outcome === "passed" && !call) ||
|
|
90
|
+
(setup.outcome !== "passed" && call))
|
|
91
|
+
return incomplete;
|
|
92
|
+
if (events.some((event) => event.outcome === "failed" ||
|
|
93
|
+
(event.outcome === "passed" && event.xfail)))
|
|
94
|
+
tests.failed++;
|
|
95
|
+
else if (events.some((event) => event.outcome === "skipped"))
|
|
96
|
+
tests.skipped++;
|
|
97
|
+
else
|
|
98
|
+
tests.passed++;
|
|
99
|
+
}
|
|
100
|
+
if (tests.failed || report.exitCode === 1)
|
|
101
|
+
return {
|
|
102
|
+
status: "failed",
|
|
103
|
+
reason: "Pytest reported assertion, fixture, teardown or unexpected-pass failures.",
|
|
104
|
+
tests,
|
|
105
|
+
};
|
|
106
|
+
if (files.size !== expected.size ||
|
|
107
|
+
report.deselected.length ||
|
|
108
|
+
!tests.passed ||
|
|
109
|
+
report.exitCode !== 0)
|
|
110
|
+
return { ...incomplete, tests };
|
|
111
|
+
return {
|
|
112
|
+
status: "passed",
|
|
113
|
+
reason: "Pytest accounted for every planned file and collected test with complete lifecycle evidence.",
|
|
114
|
+
tests,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const pytestRunner: string;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export const pytestRunner = String.raw `
|
|
2
|
+
import contextlib
|
|
3
|
+
import json
|
|
4
|
+
import pathlib
|
|
5
|
+
import sys
|
|
6
|
+
|
|
7
|
+
try:
|
|
8
|
+
import pytest
|
|
9
|
+
except ModuleNotFoundError as error:
|
|
10
|
+
if error.name != "pytest":
|
|
11
|
+
raise
|
|
12
|
+
print(json.dumps({"format": "checktrail-pytest-1", "unavailable": "pytest"}))
|
|
13
|
+
sys.exit(3)
|
|
14
|
+
|
|
15
|
+
class Evidence:
|
|
16
|
+
def __init__(self):
|
|
17
|
+
self.items = []
|
|
18
|
+
self.reports = []
|
|
19
|
+
self.deselected = []
|
|
20
|
+
self.collection_errors = []
|
|
21
|
+
self.finished = False
|
|
22
|
+
|
|
23
|
+
def pytest_collection_finish(self, session):
|
|
24
|
+
self.items = [{"id": item.nodeid, "file": str(item.path.resolve())} for item in session.items]
|
|
25
|
+
|
|
26
|
+
def pytest_deselected(self, items):
|
|
27
|
+
self.deselected.extend(item.nodeid for item in items)
|
|
28
|
+
|
|
29
|
+
def pytest_collectreport(self, report):
|
|
30
|
+
if report.failed:
|
|
31
|
+
self.collection_errors.append(report.nodeid)
|
|
32
|
+
print(str(report.longrepr), file=sys.stderr)
|
|
33
|
+
|
|
34
|
+
def pytest_runtest_logreport(self, report):
|
|
35
|
+
self.reports.append({"id": report.nodeid, "phase": report.when, "outcome": report.outcome, "xfail": hasattr(report, "wasxfail")})
|
|
36
|
+
if report.failed:
|
|
37
|
+
print(str(report.longrepr), file=sys.stderr)
|
|
38
|
+
|
|
39
|
+
def pytest_sessionfinish(self, session, exitstatus):
|
|
40
|
+
self.finished = True
|
|
41
|
+
|
|
42
|
+
plugin = Evidence()
|
|
43
|
+
files = [str(pathlib.Path(file).resolve()) for file in sys.argv[1:]]
|
|
44
|
+
with contextlib.redirect_stdout(sys.stderr):
|
|
45
|
+
code = pytest.main(["-o", "addopts=", "-o", "xfail_strict=true", "--maxfail=0", "-p", "no:cacheprovider", "-p", "no:terminal", "--", *files], plugins=[plugin])
|
|
46
|
+
print(json.dumps({"format": "checktrail-pytest-1", "version": pytest.__version__, "exitCode": int(code), "finished": plugin.finished, "items": plugin.items, "reports": plugin.reports, "deselected": plugin.deselected, "collectionErrors": plugin.collection_errors}))
|
|
47
|
+
sys.exit(int(code))
|
|
48
|
+
`;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { pytestRunner } from "./pytest-runner.js";
|
|
2
|
+
export function pytestCheck(project) {
|
|
3
|
+
const files = project.files.filter((file) => /(?:^|\/)(?:test_[^/]*|[^/]*_test)\.py$/.test(file));
|
|
4
|
+
const check = {
|
|
5
|
+
id: "python.pytest",
|
|
6
|
+
adapter: project.adapter,
|
|
7
|
+
project: project.path,
|
|
8
|
+
scope: files,
|
|
9
|
+
kind: "test",
|
|
10
|
+
parser: "pytest-json",
|
|
11
|
+
commands: [
|
|
12
|
+
{
|
|
13
|
+
executable: "python3",
|
|
14
|
+
args: ["-c", pytestRunner, ...files],
|
|
15
|
+
cwd: project.path,
|
|
16
|
+
env: { PYTHONDONTWRITEBYTECODE: "1" },
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
reason: "Run pytest against every planned candidate and reconcile collected items with setup/call/teardown events.",
|
|
20
|
+
};
|
|
21
|
+
if (!files.length)
|
|
22
|
+
check.unavailableReason =
|
|
23
|
+
"No test_*.py or *_test.py files were inventoried.";
|
|
24
|
+
return check;
|
|
25
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
export declare function validatedReport(input: unknown): {
|
|
2
|
+
startedAt: string;
|
|
3
|
+
sourceFingerprint: string;
|
|
4
|
+
finalSourceFingerprint: string | null;
|
|
5
|
+
policyFingerprint: string;
|
|
6
|
+
excluded: string[];
|
|
7
|
+
checks: {
|
|
8
|
+
id: string;
|
|
9
|
+
adapter: string;
|
|
10
|
+
project: string;
|
|
11
|
+
scope: string[];
|
|
12
|
+
status: "error" | "passed" | "failed" | "skipped" | "unavailable" | "inconclusive";
|
|
13
|
+
reason: string;
|
|
14
|
+
processes: {
|
|
15
|
+
command: {
|
|
16
|
+
executable: string;
|
|
17
|
+
args: string[];
|
|
18
|
+
cwd: string;
|
|
19
|
+
temporaryDirectory?: boolean | undefined;
|
|
20
|
+
env?: Record<string, string> | undefined;
|
|
21
|
+
};
|
|
22
|
+
exitCode: number | null;
|
|
23
|
+
signal: string | null;
|
|
24
|
+
stdout: string;
|
|
25
|
+
stderr: string;
|
|
26
|
+
durationMs: number;
|
|
27
|
+
timedOut: boolean;
|
|
28
|
+
cancelled: boolean;
|
|
29
|
+
truncated: boolean;
|
|
30
|
+
errorCode?: string | undefined;
|
|
31
|
+
}[];
|
|
32
|
+
external?: {
|
|
33
|
+
id: string;
|
|
34
|
+
version: string;
|
|
35
|
+
sha256: string;
|
|
36
|
+
tools?: {
|
|
37
|
+
name: string;
|
|
38
|
+
version: string;
|
|
39
|
+
source: "adapter-reported";
|
|
40
|
+
}[] | undefined;
|
|
41
|
+
} | undefined;
|
|
42
|
+
tests?: {
|
|
43
|
+
total: number;
|
|
44
|
+
passed: number;
|
|
45
|
+
failed: number;
|
|
46
|
+
skipped: number;
|
|
47
|
+
} | undefined;
|
|
48
|
+
findingsComplete?: boolean | undefined;
|
|
49
|
+
runtime?: {
|
|
50
|
+
schemaVersion: 1;
|
|
51
|
+
format: "runtime-inventory";
|
|
52
|
+
producer: {
|
|
53
|
+
name: string;
|
|
54
|
+
version: string;
|
|
55
|
+
};
|
|
56
|
+
assembly: {
|
|
57
|
+
name: string;
|
|
58
|
+
environment: string;
|
|
59
|
+
};
|
|
60
|
+
sourceFingerprint: string;
|
|
61
|
+
capturedAt: string;
|
|
62
|
+
collections: {
|
|
63
|
+
kind: "routes" | "listeners" | "middleware" | "schedules" | "bindings";
|
|
64
|
+
complete: boolean;
|
|
65
|
+
ordered: boolean;
|
|
66
|
+
entries: {
|
|
67
|
+
key: string;
|
|
68
|
+
attributes: Record<string, string | number | boolean | string[] | null>;
|
|
69
|
+
}[];
|
|
70
|
+
}[];
|
|
71
|
+
} | undefined;
|
|
72
|
+
findings?: {
|
|
73
|
+
ruleId: string;
|
|
74
|
+
level: "error" | "warning" | "note";
|
|
75
|
+
message: string;
|
|
76
|
+
file?: string | undefined;
|
|
77
|
+
line?: number | undefined;
|
|
78
|
+
}[] | undefined;
|
|
79
|
+
environment?: {
|
|
80
|
+
names: string[];
|
|
81
|
+
fingerprint: string;
|
|
82
|
+
} | undefined;
|
|
83
|
+
tools?: {
|
|
84
|
+
name: string;
|
|
85
|
+
source: "engine-runtime" | "package-metadata" | "version-command";
|
|
86
|
+
version: string | null;
|
|
87
|
+
status: "unavailable" | "inconclusive" | "identified";
|
|
88
|
+
process?: {
|
|
89
|
+
command: {
|
|
90
|
+
executable: string;
|
|
91
|
+
args: string[];
|
|
92
|
+
cwd: string;
|
|
93
|
+
temporaryDirectory?: boolean | undefined;
|
|
94
|
+
env?: Record<string, string> | undefined;
|
|
95
|
+
};
|
|
96
|
+
exitCode: number | null;
|
|
97
|
+
signal: string | null;
|
|
98
|
+
stdout: string;
|
|
99
|
+
stderr: string;
|
|
100
|
+
durationMs: number;
|
|
101
|
+
timedOut: boolean;
|
|
102
|
+
cancelled: boolean;
|
|
103
|
+
truncated: boolean;
|
|
104
|
+
errorCode?: string | undefined;
|
|
105
|
+
} | undefined;
|
|
106
|
+
path?: string | undefined;
|
|
107
|
+
}[] | undefined;
|
|
108
|
+
}[];
|
|
109
|
+
runId: string;
|
|
110
|
+
outcome: "passed" | "failed" | "incomplete";
|
|
111
|
+
durationMs: number;
|
|
112
|
+
sourceChanged: boolean;
|
|
113
|
+
sourceError: boolean;
|
|
114
|
+
schemaVersion: 1;
|
|
115
|
+
engineVersion: string;
|
|
116
|
+
selection?: {
|
|
117
|
+
mode: "full" | "affected";
|
|
118
|
+
reason: string;
|
|
119
|
+
changedFiles: string[];
|
|
120
|
+
selectedProjects: string[];
|
|
121
|
+
git?: {
|
|
122
|
+
baseCommit: string;
|
|
123
|
+
headCommit: string;
|
|
124
|
+
version: string;
|
|
125
|
+
worktreeId: string;
|
|
126
|
+
indexFingerprint: string;
|
|
127
|
+
} | undefined;
|
|
128
|
+
} | undefined;
|
|
129
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { reportSchema } from "./schemas.js";
|
|
2
|
+
export function validatedReport(input) {
|
|
3
|
+
const report = reportSchema.parse(input);
|
|
4
|
+
const expected = report.checks.some((check) => check.status === "failed")
|
|
5
|
+
? "failed"
|
|
6
|
+
: report.sourceChanged ||
|
|
7
|
+
report.sourceError ||
|
|
8
|
+
!report.checks.length ||
|
|
9
|
+
report.checks.some((check) => check.status !== "passed")
|
|
10
|
+
? "incomplete"
|
|
11
|
+
: "passed";
|
|
12
|
+
if (report.outcome !== expected)
|
|
13
|
+
throw new Error("Report outcome contradicts its check evidence");
|
|
14
|
+
if ((!report.finalSourceFingerprint && !report.sourceError) ||
|
|
15
|
+
(report.finalSourceFingerprint !== null &&
|
|
16
|
+
report.finalSourceFingerprint !== report.sourceFingerprint &&
|
|
17
|
+
!report.sourceChanged))
|
|
18
|
+
throw new Error("Report source flags contradict its fingerprints");
|
|
19
|
+
const checks = new Set();
|
|
20
|
+
for (const check of report.checks) {
|
|
21
|
+
const id = JSON.stringify([check.project, check.id]);
|
|
22
|
+
if (checks.has(id))
|
|
23
|
+
throw new Error("Duplicate check identity in report");
|
|
24
|
+
checks.add(id);
|
|
25
|
+
}
|
|
26
|
+
return report;
|
|
27
|
+
}
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const reviewSelectionSchema: z.ZodObject<{
|
|
3
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
4
|
+
files: z.ZodArray<z.ZodString>;
|
|
5
|
+
topics: z.ZodArray<z.ZodEnum<{
|
|
6
|
+
"test-lifecycle": "test-lifecycle";
|
|
7
|
+
"analysis-scope": "analysis-scope";
|
|
8
|
+
"package-consumers": "package-consumers";
|
|
9
|
+
"python-imports": "python-imports";
|
|
10
|
+
"framework-assembly": "framework-assembly";
|
|
11
|
+
"execution-depth": "execution-depth";
|
|
12
|
+
}>>;
|
|
13
|
+
}, z.core.$strict>;
|
|
14
|
+
export declare const reviewContextSchema: z.ZodObject<{
|
|
15
|
+
contextDigest: z.ZodString;
|
|
16
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
17
|
+
format: z.ZodLiteral<"review-context">;
|
|
18
|
+
channel: z.ZodLiteral<"advisory">;
|
|
19
|
+
automatedCoverage: z.ZodLiteral<false>;
|
|
20
|
+
sourceFingerprint: z.ZodString;
|
|
21
|
+
sourceTrust: z.ZodLiteral<"untrusted-source-text">;
|
|
22
|
+
selection: z.ZodObject<{
|
|
23
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
24
|
+
files: z.ZodArray<z.ZodString>;
|
|
25
|
+
topics: z.ZodArray<z.ZodEnum<{
|
|
26
|
+
"test-lifecycle": "test-lifecycle";
|
|
27
|
+
"analysis-scope": "analysis-scope";
|
|
28
|
+
"package-consumers": "package-consumers";
|
|
29
|
+
"python-imports": "python-imports";
|
|
30
|
+
"framework-assembly": "framework-assembly";
|
|
31
|
+
"execution-depth": "execution-depth";
|
|
32
|
+
}>>;
|
|
33
|
+
}, z.core.$strict>;
|
|
34
|
+
instructions: z.ZodString;
|
|
35
|
+
guidance: z.ZodObject<{
|
|
36
|
+
context: z.ZodObject<{
|
|
37
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
38
|
+
checks: z.ZodArray<z.ZodString>;
|
|
39
|
+
topics: z.ZodArray<z.ZodEnum<{
|
|
40
|
+
"test-lifecycle": "test-lifecycle";
|
|
41
|
+
"analysis-scope": "analysis-scope";
|
|
42
|
+
"package-consumers": "package-consumers";
|
|
43
|
+
"python-imports": "python-imports";
|
|
44
|
+
"framework-assembly": "framework-assembly";
|
|
45
|
+
"execution-depth": "execution-depth";
|
|
46
|
+
}>>;
|
|
47
|
+
}, z.core.$strict>;
|
|
48
|
+
items: z.ZodArray<z.ZodObject<{
|
|
49
|
+
id: z.ZodString;
|
|
50
|
+
version: z.ZodLiteral<"1.0.0">;
|
|
51
|
+
title: z.ZodString;
|
|
52
|
+
triggers: z.ZodObject<{
|
|
53
|
+
checks: z.ZodArray<z.ZodString>;
|
|
54
|
+
topics: z.ZodArray<z.ZodEnum<{
|
|
55
|
+
"test-lifecycle": "test-lifecycle";
|
|
56
|
+
"analysis-scope": "analysis-scope";
|
|
57
|
+
"package-consumers": "package-consumers";
|
|
58
|
+
"python-imports": "python-imports";
|
|
59
|
+
"framework-assembly": "framework-assembly";
|
|
60
|
+
"execution-depth": "execution-depth";
|
|
61
|
+
}>>;
|
|
62
|
+
}, z.core.$strict>;
|
|
63
|
+
questions: z.ZodArray<z.ZodString>;
|
|
64
|
+
references: z.ZodArray<z.ZodObject<{
|
|
65
|
+
title: z.ZodString;
|
|
66
|
+
url: z.ZodURL;
|
|
67
|
+
}, z.core.$strict>>;
|
|
68
|
+
matched: z.ZodObject<{
|
|
69
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
70
|
+
checks: z.ZodArray<z.ZodString>;
|
|
71
|
+
topics: z.ZodArray<z.ZodEnum<{
|
|
72
|
+
"test-lifecycle": "test-lifecycle";
|
|
73
|
+
"analysis-scope": "analysis-scope";
|
|
74
|
+
"package-consumers": "package-consumers";
|
|
75
|
+
"python-imports": "python-imports";
|
|
76
|
+
"framework-assembly": "framework-assembly";
|
|
77
|
+
"execution-depth": "execution-depth";
|
|
78
|
+
}>>;
|
|
79
|
+
}, z.core.$strict>;
|
|
80
|
+
}, z.core.$strict>>;
|
|
81
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
82
|
+
engineVersion: z.ZodString;
|
|
83
|
+
channel: z.ZodLiteral<"advisory">;
|
|
84
|
+
provenance: z.ZodLiteral<"builtin-guidance-selection">;
|
|
85
|
+
catalogueDigest: z.ZodString;
|
|
86
|
+
automatedCoverage: z.ZodLiteral<false>;
|
|
87
|
+
selectionBasis: z.ZodLiteral<"exact-check-or-topic">;
|
|
88
|
+
}, z.core.$strict>;
|
|
89
|
+
files: z.ZodArray<z.ZodObject<{
|
|
90
|
+
path: z.ZodString;
|
|
91
|
+
sha256: z.ZodString;
|
|
92
|
+
content: z.ZodString;
|
|
93
|
+
}, z.core.$strict>>;
|
|
94
|
+
}, z.core.$strict>;
|
|
95
|
+
export type ReviewContext = z.infer<typeof reviewContextSchema>;
|
|
96
|
+
export declare const reviewContextSummarySchema: z.ZodObject<{
|
|
97
|
+
format: z.ZodLiteral<"review-context-summary">;
|
|
98
|
+
contextDigest: z.ZodString;
|
|
99
|
+
selectedFiles: z.ZodNumber;
|
|
100
|
+
sourceBytes: z.ZodNumber;
|
|
101
|
+
sourceIncluded: z.ZodLiteral<false>;
|
|
102
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
103
|
+
engineVersion: z.ZodString;
|
|
104
|
+
channel: z.ZodLiteral<"advisory">;
|
|
105
|
+
automatedCoverage: z.ZodLiteral<false>;
|
|
106
|
+
claimsVerified: z.ZodLiteral<false>;
|
|
107
|
+
deterministicOutcomeChanged: z.ZodLiteral<false>;
|
|
108
|
+
}, z.core.$strict>;
|
|
109
|
+
export declare const reviewAssessmentSchema: z.ZodObject<{
|
|
110
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
111
|
+
contextDigest: z.ZodString;
|
|
112
|
+
reviewer: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
113
|
+
kind: z.ZodLiteral<"human">;
|
|
114
|
+
name: z.ZodString;
|
|
115
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
116
|
+
kind: z.ZodLiteral<"model">;
|
|
117
|
+
provider: z.ZodString;
|
|
118
|
+
model: z.ZodString;
|
|
119
|
+
version: z.ZodString;
|
|
120
|
+
}, z.core.$strict>], "kind">;
|
|
121
|
+
createdAt: z.ZodISODateTime;
|
|
122
|
+
usage: z.ZodObject<{
|
|
123
|
+
inputTokens: z.ZodNullable<z.ZodNumber>;
|
|
124
|
+
outputTokens: z.ZodNullable<z.ZodNumber>;
|
|
125
|
+
elapsedMs: z.ZodNullable<z.ZodNumber>;
|
|
126
|
+
costUSD: z.ZodNullable<z.ZodNumber>;
|
|
127
|
+
}, z.core.$strict>;
|
|
128
|
+
files: z.ZodArray<z.ZodObject<{
|
|
129
|
+
path: z.ZodString;
|
|
130
|
+
disposition: z.ZodEnum<{
|
|
131
|
+
reviewed: "reviewed";
|
|
132
|
+
"not-reviewed": "not-reviewed";
|
|
133
|
+
}>;
|
|
134
|
+
note: z.ZodString;
|
|
135
|
+
}, z.core.$strict>>;
|
|
136
|
+
observations: z.ZodArray<z.ZodObject<{
|
|
137
|
+
id: z.ZodString;
|
|
138
|
+
severity: z.ZodEnum<{
|
|
139
|
+
suggestion: "suggestion";
|
|
140
|
+
concern: "concern";
|
|
141
|
+
}>;
|
|
142
|
+
claim: z.ZodString;
|
|
143
|
+
citations: z.ZodArray<z.ZodObject<{
|
|
144
|
+
file: z.ZodString;
|
|
145
|
+
startLine: z.ZodNumber;
|
|
146
|
+
endLine: z.ZodNumber;
|
|
147
|
+
quote: z.ZodString;
|
|
148
|
+
}, z.core.$strict>>;
|
|
149
|
+
}, z.core.$strict>>;
|
|
150
|
+
}, z.core.$strict>;
|
|
151
|
+
export type ReviewAssessment = z.infer<typeof reviewAssessmentSchema>;
|
|
152
|
+
export declare const reviewReceiptSchema: z.ZodObject<{
|
|
153
|
+
assessment: z.ZodObject<{
|
|
154
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
155
|
+
contextDigest: z.ZodString;
|
|
156
|
+
reviewer: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
157
|
+
kind: z.ZodLiteral<"human">;
|
|
158
|
+
name: z.ZodString;
|
|
159
|
+
}, z.core.$strict>, z.ZodObject<{
|
|
160
|
+
kind: z.ZodLiteral<"model">;
|
|
161
|
+
provider: z.ZodString;
|
|
162
|
+
model: z.ZodString;
|
|
163
|
+
version: z.ZodString;
|
|
164
|
+
}, z.core.$strict>], "kind">;
|
|
165
|
+
createdAt: z.ZodISODateTime;
|
|
166
|
+
usage: z.ZodObject<{
|
|
167
|
+
inputTokens: z.ZodNullable<z.ZodNumber>;
|
|
168
|
+
outputTokens: z.ZodNullable<z.ZodNumber>;
|
|
169
|
+
elapsedMs: z.ZodNullable<z.ZodNumber>;
|
|
170
|
+
costUSD: z.ZodNullable<z.ZodNumber>;
|
|
171
|
+
}, z.core.$strict>;
|
|
172
|
+
files: z.ZodArray<z.ZodObject<{
|
|
173
|
+
path: z.ZodString;
|
|
174
|
+
disposition: z.ZodEnum<{
|
|
175
|
+
reviewed: "reviewed";
|
|
176
|
+
"not-reviewed": "not-reviewed";
|
|
177
|
+
}>;
|
|
178
|
+
note: z.ZodString;
|
|
179
|
+
}, z.core.$strict>>;
|
|
180
|
+
observations: z.ZodArray<z.ZodObject<{
|
|
181
|
+
id: z.ZodString;
|
|
182
|
+
severity: z.ZodEnum<{
|
|
183
|
+
suggestion: "suggestion";
|
|
184
|
+
concern: "concern";
|
|
185
|
+
}>;
|
|
186
|
+
claim: z.ZodString;
|
|
187
|
+
citations: z.ZodArray<z.ZodObject<{
|
|
188
|
+
file: z.ZodString;
|
|
189
|
+
startLine: z.ZodNumber;
|
|
190
|
+
endLine: z.ZodNumber;
|
|
191
|
+
quote: z.ZodString;
|
|
192
|
+
}, z.core.$strict>>;
|
|
193
|
+
}, z.core.$strict>>;
|
|
194
|
+
}, z.core.$strict>;
|
|
195
|
+
citationChecks: z.ZodArray<z.ZodObject<{
|
|
196
|
+
observationId: z.ZodString;
|
|
197
|
+
citation: z.ZodNumber;
|
|
198
|
+
matchesContext: z.ZodBoolean;
|
|
199
|
+
}, z.core.$strict>>;
|
|
200
|
+
provenance: z.ZodLiteral<"imported-review-assessment">;
|
|
201
|
+
contextDigest: z.ZodString;
|
|
202
|
+
freshness: z.ZodEnum<{
|
|
203
|
+
current: "current";
|
|
204
|
+
stale: "stale";
|
|
205
|
+
}>;
|
|
206
|
+
usageProvenance: z.ZodLiteral<"reviewer-declared">;
|
|
207
|
+
usage: z.ZodObject<{
|
|
208
|
+
inputTokens: z.ZodNullable<z.ZodNumber>;
|
|
209
|
+
outputTokens: z.ZodNullable<z.ZodNumber>;
|
|
210
|
+
elapsedMs: z.ZodNullable<z.ZodNumber>;
|
|
211
|
+
costUSD: z.ZodNullable<z.ZodNumber>;
|
|
212
|
+
}, z.core.$strict>;
|
|
213
|
+
coverage: z.ZodObject<{
|
|
214
|
+
selected: z.ZodNumber;
|
|
215
|
+
declaredReviewed: z.ZodNumber;
|
|
216
|
+
declaredNotReviewed: z.ZodNumber;
|
|
217
|
+
unaccounted: z.ZodNumber;
|
|
218
|
+
}, z.core.$strict>;
|
|
219
|
+
citations: z.ZodObject<{
|
|
220
|
+
matched: z.ZodNumber;
|
|
221
|
+
unmatched: z.ZodNumber;
|
|
222
|
+
}, z.core.$strict>;
|
|
223
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
224
|
+
engineVersion: z.ZodString;
|
|
225
|
+
channel: z.ZodLiteral<"advisory">;
|
|
226
|
+
automatedCoverage: z.ZodLiteral<false>;
|
|
227
|
+
claimsVerified: z.ZodLiteral<false>;
|
|
228
|
+
deterministicOutcomeChanged: z.ZodLiteral<false>;
|
|
229
|
+
}, z.core.$strict>;
|
|
230
|
+
export declare const reviewReceiptSummarySchema: z.ZodObject<{
|
|
231
|
+
reviewerKind: z.ZodEnum<{
|
|
232
|
+
human: "human";
|
|
233
|
+
model: "model";
|
|
234
|
+
}>;
|
|
235
|
+
observations: z.ZodNumber;
|
|
236
|
+
provenance: z.ZodLiteral<"imported-review-assessment">;
|
|
237
|
+
contextDigest: z.ZodString;
|
|
238
|
+
freshness: z.ZodEnum<{
|
|
239
|
+
current: "current";
|
|
240
|
+
stale: "stale";
|
|
241
|
+
}>;
|
|
242
|
+
usageProvenance: z.ZodLiteral<"reviewer-declared">;
|
|
243
|
+
usage: z.ZodObject<{
|
|
244
|
+
inputTokens: z.ZodNullable<z.ZodNumber>;
|
|
245
|
+
outputTokens: z.ZodNullable<z.ZodNumber>;
|
|
246
|
+
elapsedMs: z.ZodNullable<z.ZodNumber>;
|
|
247
|
+
costUSD: z.ZodNullable<z.ZodNumber>;
|
|
248
|
+
}, z.core.$strict>;
|
|
249
|
+
coverage: z.ZodObject<{
|
|
250
|
+
selected: z.ZodNumber;
|
|
251
|
+
declaredReviewed: z.ZodNumber;
|
|
252
|
+
declaredNotReviewed: z.ZodNumber;
|
|
253
|
+
unaccounted: z.ZodNumber;
|
|
254
|
+
}, z.core.$strict>;
|
|
255
|
+
citations: z.ZodObject<{
|
|
256
|
+
matched: z.ZodNumber;
|
|
257
|
+
unmatched: z.ZodNumber;
|
|
258
|
+
}, z.core.$strict>;
|
|
259
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
260
|
+
engineVersion: z.ZodString;
|
|
261
|
+
channel: z.ZodLiteral<"advisory">;
|
|
262
|
+
automatedCoverage: z.ZodLiteral<false>;
|
|
263
|
+
claimsVerified: z.ZodLiteral<false>;
|
|
264
|
+
deterministicOutcomeChanged: z.ZodLiteral<false>;
|
|
265
|
+
}, z.core.$strict>;
|
|
266
|
+
export type ReviewReceipt = z.infer<typeof reviewReceiptSchema>;
|
|
267
|
+
export declare function createReviewContext(root: string, input: unknown): Promise<ReviewContext>;
|
|
268
|
+
export declare function projectReviewContext(context: ReviewContext, sourceEnabled: boolean): Record<string, unknown>;
|
|
269
|
+
export declare function receiveReview(root: string, contextInput: unknown, assessmentInput: unknown): Promise<ReviewReceipt>;
|
|
270
|
+
export declare function projectReviewReceipt(report: ReviewReceipt, detailed: boolean): Record<string, unknown>;
|