@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,112 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const runtimeInventorySchema: z.ZodObject<{
|
|
3
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
4
|
+
format: z.ZodLiteral<"runtime-inventory">;
|
|
5
|
+
producer: z.ZodObject<{
|
|
6
|
+
name: z.ZodString;
|
|
7
|
+
version: z.ZodString;
|
|
8
|
+
}, z.core.$strict>;
|
|
9
|
+
assembly: z.ZodObject<{
|
|
10
|
+
name: z.ZodString;
|
|
11
|
+
environment: z.ZodString;
|
|
12
|
+
}, z.core.$strict>;
|
|
13
|
+
sourceFingerprint: z.ZodString;
|
|
14
|
+
capturedAt: z.ZodISODateTime;
|
|
15
|
+
collections: z.ZodArray<z.ZodObject<{
|
|
16
|
+
kind: z.ZodEnum<{
|
|
17
|
+
routes: "routes";
|
|
18
|
+
listeners: "listeners";
|
|
19
|
+
middleware: "middleware";
|
|
20
|
+
schedules: "schedules";
|
|
21
|
+
bindings: "bindings";
|
|
22
|
+
}>;
|
|
23
|
+
complete: z.ZodBoolean;
|
|
24
|
+
ordered: z.ZodBoolean;
|
|
25
|
+
entries: z.ZodArray<z.ZodObject<{
|
|
26
|
+
key: z.ZodString;
|
|
27
|
+
attributes: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull, z.ZodArray<z.ZodString>]>>;
|
|
28
|
+
}, z.core.$strict>>;
|
|
29
|
+
}, z.core.$strict>>;
|
|
30
|
+
}, z.core.$strict>;
|
|
31
|
+
export type RuntimeInventory = z.infer<typeof runtimeInventorySchema>;
|
|
32
|
+
export declare const runtimeComparisonSchema: z.ZodObject<{
|
|
33
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
34
|
+
engineVersion: z.ZodString;
|
|
35
|
+
provenance: z.ZodLiteral<"imported-runtime-comparison">;
|
|
36
|
+
outcome: z.ZodEnum<{
|
|
37
|
+
passed: "passed";
|
|
38
|
+
failed: "failed";
|
|
39
|
+
incomplete: "incomplete";
|
|
40
|
+
}>;
|
|
41
|
+
reason: z.ZodString;
|
|
42
|
+
beforeFingerprint: z.ZodString;
|
|
43
|
+
afterFingerprint: z.ZodString;
|
|
44
|
+
counts: z.ZodObject<{
|
|
45
|
+
collections: z.ZodNumber;
|
|
46
|
+
compared: z.ZodNumber;
|
|
47
|
+
unverified: z.ZodNumber;
|
|
48
|
+
changed: z.ZodNumber;
|
|
49
|
+
added: z.ZodNumber;
|
|
50
|
+
removed: z.ZodNumber;
|
|
51
|
+
}, z.core.$strict>;
|
|
52
|
+
collections: z.ZodArray<z.ZodObject<{
|
|
53
|
+
kind: z.ZodEnum<{
|
|
54
|
+
routes: "routes";
|
|
55
|
+
listeners: "listeners";
|
|
56
|
+
middleware: "middleware";
|
|
57
|
+
schedules: "schedules";
|
|
58
|
+
bindings: "bindings";
|
|
59
|
+
}>;
|
|
60
|
+
status: z.ZodEnum<{
|
|
61
|
+
unverified: "unverified";
|
|
62
|
+
changed: "changed";
|
|
63
|
+
unchanged: "unchanged";
|
|
64
|
+
}>;
|
|
65
|
+
beforeCount: z.ZodNumber;
|
|
66
|
+
afterCount: z.ZodNumber;
|
|
67
|
+
added: z.ZodNumber;
|
|
68
|
+
removed: z.ZodNumber;
|
|
69
|
+
orderChanged: z.ZodBoolean;
|
|
70
|
+
changedKeys: z.ZodArray<z.ZodString>;
|
|
71
|
+
}, z.core.$strict>>;
|
|
72
|
+
}, z.core.$strict>;
|
|
73
|
+
export declare const runtimeComparisonSummarySchema: z.ZodObject<{
|
|
74
|
+
schemaVersion: z.ZodLiteral<1>;
|
|
75
|
+
engineVersion: z.ZodString;
|
|
76
|
+
provenance: z.ZodLiteral<"imported-runtime-comparison">;
|
|
77
|
+
outcome: z.ZodEnum<{
|
|
78
|
+
passed: "passed";
|
|
79
|
+
failed: "failed";
|
|
80
|
+
incomplete: "incomplete";
|
|
81
|
+
}>;
|
|
82
|
+
reason: z.ZodString;
|
|
83
|
+
beforeFingerprint: z.ZodString;
|
|
84
|
+
afterFingerprint: z.ZodString;
|
|
85
|
+
counts: z.ZodObject<{
|
|
86
|
+
collections: z.ZodNumber;
|
|
87
|
+
compared: z.ZodNumber;
|
|
88
|
+
unverified: z.ZodNumber;
|
|
89
|
+
changed: z.ZodNumber;
|
|
90
|
+
added: z.ZodNumber;
|
|
91
|
+
removed: z.ZodNumber;
|
|
92
|
+
}, z.core.$strict>;
|
|
93
|
+
}, z.core.$strict>;
|
|
94
|
+
export type RuntimeComparison = z.infer<typeof runtimeComparisonSchema>;
|
|
95
|
+
export declare function compareRuntimeInventories(beforeInput: unknown, afterInput: unknown): RuntimeComparison;
|
|
96
|
+
export declare function projectRuntimeComparison(result: RuntimeComparison, detailed: boolean): {
|
|
97
|
+
schemaVersion: 1;
|
|
98
|
+
engineVersion: string;
|
|
99
|
+
provenance: "imported-runtime-comparison";
|
|
100
|
+
outcome: "passed" | "failed" | "incomplete";
|
|
101
|
+
reason: string;
|
|
102
|
+
beforeFingerprint: string;
|
|
103
|
+
afterFingerprint: string;
|
|
104
|
+
counts: {
|
|
105
|
+
collections: number;
|
|
106
|
+
compared: number;
|
|
107
|
+
unverified: number;
|
|
108
|
+
changed: number;
|
|
109
|
+
added: number;
|
|
110
|
+
removed: number;
|
|
111
|
+
};
|
|
112
|
+
};
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { VERSION } from "./types.js";
|
|
4
|
+
const label = z.string().min(1).max(4096);
|
|
5
|
+
const kind = z.enum([
|
|
6
|
+
"routes",
|
|
7
|
+
"listeners",
|
|
8
|
+
"middleware",
|
|
9
|
+
"schedules",
|
|
10
|
+
"bindings",
|
|
11
|
+
]);
|
|
12
|
+
const attribute = z.union([
|
|
13
|
+
z.string().max(4096),
|
|
14
|
+
z.number().finite(),
|
|
15
|
+
z.boolean(),
|
|
16
|
+
z.null(),
|
|
17
|
+
z.array(z.string().max(4096)).max(1024),
|
|
18
|
+
]);
|
|
19
|
+
export const runtimeInventorySchema = z.strictObject({
|
|
20
|
+
schemaVersion: z.literal(1),
|
|
21
|
+
format: z.literal("runtime-inventory"),
|
|
22
|
+
producer: z.strictObject({ name: label, version: label }),
|
|
23
|
+
assembly: z.strictObject({ name: label, environment: label }),
|
|
24
|
+
sourceFingerprint: z.string().regex(/^[a-f0-9]{64}$/),
|
|
25
|
+
capturedAt: z.iso.datetime(),
|
|
26
|
+
collections: z
|
|
27
|
+
.array(z.strictObject({
|
|
28
|
+
kind,
|
|
29
|
+
complete: z.boolean(),
|
|
30
|
+
ordered: z.boolean(),
|
|
31
|
+
entries: z
|
|
32
|
+
.array(z.strictObject({
|
|
33
|
+
key: label,
|
|
34
|
+
attributes: z.record(label, attribute),
|
|
35
|
+
}))
|
|
36
|
+
.max(20_000),
|
|
37
|
+
}))
|
|
38
|
+
.min(1)
|
|
39
|
+
.max(5),
|
|
40
|
+
});
|
|
41
|
+
const count = z.number().int().nonnegative();
|
|
42
|
+
export const runtimeComparisonSchema = z.strictObject({
|
|
43
|
+
schemaVersion: z.literal(1),
|
|
44
|
+
engineVersion: z.string(),
|
|
45
|
+
provenance: z.literal("imported-runtime-comparison"),
|
|
46
|
+
outcome: z.enum(["passed", "failed", "incomplete"]),
|
|
47
|
+
reason: z.string(),
|
|
48
|
+
beforeFingerprint: z.string(),
|
|
49
|
+
afterFingerprint: z.string(),
|
|
50
|
+
counts: z.strictObject({
|
|
51
|
+
collections: count,
|
|
52
|
+
compared: count,
|
|
53
|
+
unverified: count,
|
|
54
|
+
changed: count,
|
|
55
|
+
added: count,
|
|
56
|
+
removed: count,
|
|
57
|
+
}),
|
|
58
|
+
collections: z.array(z.strictObject({
|
|
59
|
+
kind,
|
|
60
|
+
status: z.enum(["unchanged", "changed", "unverified"]),
|
|
61
|
+
beforeCount: count,
|
|
62
|
+
afterCount: count,
|
|
63
|
+
added: count,
|
|
64
|
+
removed: count,
|
|
65
|
+
orderChanged: z.boolean(),
|
|
66
|
+
changedKeys: z.array(label),
|
|
67
|
+
})),
|
|
68
|
+
});
|
|
69
|
+
export const runtimeComparisonSummarySchema = runtimeComparisonSchema.omit({
|
|
70
|
+
collections: true,
|
|
71
|
+
});
|
|
72
|
+
function canonical(value) {
|
|
73
|
+
if (Array.isArray(value))
|
|
74
|
+
return `[${value.map(canonical).join(",")}]`;
|
|
75
|
+
if (value !== null && typeof value === "object")
|
|
76
|
+
return `{${Object.entries(value)
|
|
77
|
+
.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))
|
|
78
|
+
.map(([key, item]) => `${JSON.stringify(key)}:${canonical(item)}`)
|
|
79
|
+
.join(",")}}`;
|
|
80
|
+
return JSON.stringify(value);
|
|
81
|
+
}
|
|
82
|
+
const digest = (value) => createHash("sha256").update(canonical(value)).digest("hex");
|
|
83
|
+
function parse(input) {
|
|
84
|
+
if (Buffer.byteLength(JSON.stringify(input)) > 8 * 1024 * 1024)
|
|
85
|
+
throw new Error("Runtime inventory exceeds artifact limit");
|
|
86
|
+
const result = runtimeInventorySchema.parse(input);
|
|
87
|
+
if (new Set(result.collections.map((collection) => collection.kind)).size !==
|
|
88
|
+
result.collections.length)
|
|
89
|
+
throw new Error("Duplicate runtime collection kind");
|
|
90
|
+
if (result.collections.reduce((sum, collection) => sum + collection.entries.length, 0) > 20_000)
|
|
91
|
+
throw new Error("Runtime inventory exceeds entry limit");
|
|
92
|
+
return result;
|
|
93
|
+
}
|
|
94
|
+
export function compareRuntimeInventories(beforeInput, afterInput) {
|
|
95
|
+
const before = parse(beforeInput);
|
|
96
|
+
const after = parse(afterInput);
|
|
97
|
+
const compatible = canonical(before.assembly) === canonical(after.assembly) &&
|
|
98
|
+
before.producer.name === after.producer.name;
|
|
99
|
+
const kinds = [
|
|
100
|
+
...new Set([...before.collections, ...after.collections].map((collection) => collection.kind)),
|
|
101
|
+
].sort();
|
|
102
|
+
const collections = kinds.map((kind) => {
|
|
103
|
+
const left = before.collections.find((collection) => collection.kind === kind);
|
|
104
|
+
const right = after.collections.find((collection) => collection.kind === kind);
|
|
105
|
+
const result = {
|
|
106
|
+
kind,
|
|
107
|
+
status: "unverified",
|
|
108
|
+
beforeCount: left?.entries.length ?? 0,
|
|
109
|
+
afterCount: right?.entries.length ?? 0,
|
|
110
|
+
added: 0,
|
|
111
|
+
removed: 0,
|
|
112
|
+
orderChanged: false,
|
|
113
|
+
changedKeys: [],
|
|
114
|
+
};
|
|
115
|
+
if (!compatible ||
|
|
116
|
+
!left?.complete ||
|
|
117
|
+
!right?.complete ||
|
|
118
|
+
left.ordered !== right.ordered)
|
|
119
|
+
return result;
|
|
120
|
+
const leftCounts = new Map();
|
|
121
|
+
const rightCounts = new Map();
|
|
122
|
+
for (const [entries, counts] of [
|
|
123
|
+
[left.entries, leftCounts],
|
|
124
|
+
[right.entries, rightCounts],
|
|
125
|
+
])
|
|
126
|
+
for (const entry of entries) {
|
|
127
|
+
const id = canonical(entry);
|
|
128
|
+
counts.set(id, {
|
|
129
|
+
key: entry.key,
|
|
130
|
+
count: (counts.get(id)?.count ?? 0) + 1,
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
const changedKeys = new Set();
|
|
134
|
+
for (const id of new Set([...leftCounts.keys(), ...rightCounts.keys()])) {
|
|
135
|
+
const a = leftCounts.get(id);
|
|
136
|
+
const b = rightCounts.get(id);
|
|
137
|
+
const change = (b?.count ?? 0) - (a?.count ?? 0);
|
|
138
|
+
if (change !== 0)
|
|
139
|
+
changedKeys.add((a ?? b).key);
|
|
140
|
+
if (change > 0)
|
|
141
|
+
result.added += change;
|
|
142
|
+
else
|
|
143
|
+
result.removed -= change;
|
|
144
|
+
}
|
|
145
|
+
result.orderChanged =
|
|
146
|
+
left.ordered &&
|
|
147
|
+
canonical(left.entries) !== canonical(right.entries) &&
|
|
148
|
+
result.added === 0 &&
|
|
149
|
+
result.removed === 0;
|
|
150
|
+
result.changedKeys = [...changedKeys].sort();
|
|
151
|
+
result.status =
|
|
152
|
+
result.added || result.removed || result.orderChanged
|
|
153
|
+
? "changed"
|
|
154
|
+
: "unchanged";
|
|
155
|
+
return result;
|
|
156
|
+
});
|
|
157
|
+
const counts = {
|
|
158
|
+
collections: collections.length,
|
|
159
|
+
compared: collections.filter((collection) => collection.status !== "unverified").length,
|
|
160
|
+
unverified: collections.filter((collection) => collection.status === "unverified").length,
|
|
161
|
+
changed: collections.filter((collection) => collection.status === "changed")
|
|
162
|
+
.length,
|
|
163
|
+
added: collections.reduce((sum, collection) => sum + collection.added, 0),
|
|
164
|
+
removed: collections.reduce((sum, collection) => sum + collection.removed, 0),
|
|
165
|
+
};
|
|
166
|
+
const outcome = counts.changed
|
|
167
|
+
? "failed"
|
|
168
|
+
: counts.unverified
|
|
169
|
+
? "incomplete"
|
|
170
|
+
: "passed";
|
|
171
|
+
return {
|
|
172
|
+
schemaVersion: 1,
|
|
173
|
+
engineVersion: VERSION,
|
|
174
|
+
provenance: "imported-runtime-comparison",
|
|
175
|
+
outcome,
|
|
176
|
+
reason: outcome === "passed"
|
|
177
|
+
? "Declared runtime collections match; imported artifacts do not attest current runtime or source freshness."
|
|
178
|
+
: outcome === "failed"
|
|
179
|
+
? "Declared runtime collections changed; inspect registration counts, attributes and ordering."
|
|
180
|
+
: "Runtime collection completeness or comparable assembly identity could not be established.",
|
|
181
|
+
beforeFingerprint: digest(before),
|
|
182
|
+
afterFingerprint: digest(after),
|
|
183
|
+
counts,
|
|
184
|
+
collections,
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
export function projectRuntimeComparison(result, detailed) {
|
|
188
|
+
if (detailed)
|
|
189
|
+
return result;
|
|
190
|
+
return runtimeComparisonSummarySchema.parse({
|
|
191
|
+
schemaVersion: result.schemaVersion,
|
|
192
|
+
engineVersion: result.engineVersion,
|
|
193
|
+
provenance: result.provenance,
|
|
194
|
+
outcome: result.outcome,
|
|
195
|
+
reason: result.reason,
|
|
196
|
+
beforeFingerprint: result.beforeFingerprint,
|
|
197
|
+
afterFingerprint: result.afterFingerprint,
|
|
198
|
+
counts: result.counts,
|
|
199
|
+
});
|
|
200
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function rustDependencyPaths(text: string, cwd: string): string[];
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
function words(value) {
|
|
3
|
+
const result = [];
|
|
4
|
+
let word = "";
|
|
5
|
+
for (let index = 0; index < value.length; index++) {
|
|
6
|
+
const character = value[index];
|
|
7
|
+
if (character === "\\") {
|
|
8
|
+
const escaped = value[++index];
|
|
9
|
+
if (escaped !== " " && escaped !== "\\")
|
|
10
|
+
throw new Error("Unsupported dep-info escape");
|
|
11
|
+
word += escaped;
|
|
12
|
+
}
|
|
13
|
+
else if (character === " " || character === "\t") {
|
|
14
|
+
if (word)
|
|
15
|
+
result.push(word);
|
|
16
|
+
word = "";
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
if ("$#\r\n".includes(character))
|
|
20
|
+
throw new Error("Unsupported dep-info path character");
|
|
21
|
+
word += character;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
if (word)
|
|
25
|
+
result.push(word);
|
|
26
|
+
return result;
|
|
27
|
+
}
|
|
28
|
+
export function rustDependencyPaths(text, cwd) {
|
|
29
|
+
const paths = new Set();
|
|
30
|
+
let rules = 0;
|
|
31
|
+
for (const line of text.split("\n")) {
|
|
32
|
+
if (!line.trim() || line.startsWith("# env-dep:"))
|
|
33
|
+
continue;
|
|
34
|
+
const separator = line.indexOf(":");
|
|
35
|
+
if (separator <= 0 || !words(line.slice(0, separator)).length)
|
|
36
|
+
throw new Error("Malformed dep-info rule");
|
|
37
|
+
const dependencies = words(line.slice(separator + 1));
|
|
38
|
+
if (dependencies.length)
|
|
39
|
+
rules++;
|
|
40
|
+
for (const dependency of dependencies)
|
|
41
|
+
paths.add(path.resolve(cwd, dependency));
|
|
42
|
+
}
|
|
43
|
+
if (!rules)
|
|
44
|
+
throw new Error("Empty dep-info dependency rules");
|
|
45
|
+
return [...paths].sort();
|
|
46
|
+
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
const target = z.object({
|
|
4
|
+
name: z.string(),
|
|
5
|
+
src_path: z.string(),
|
|
6
|
+
kind: z.array(z.string()).min(1),
|
|
7
|
+
test: z.boolean(),
|
|
8
|
+
});
|
|
9
|
+
const event = z.discriminatedUnion("reason", [
|
|
10
|
+
z.object({ reason: z.literal("build-finished"), success: z.boolean() }),
|
|
11
|
+
z.object({
|
|
12
|
+
reason: z.literal("compiler-artifact"),
|
|
13
|
+
package_id: z.string(),
|
|
14
|
+
target,
|
|
15
|
+
fresh: z.boolean(),
|
|
16
|
+
profile: z.object({ test: z.boolean() }),
|
|
17
|
+
}),
|
|
18
|
+
z.object({
|
|
19
|
+
reason: z.literal("compiler-message"),
|
|
20
|
+
package_id: z.string(),
|
|
21
|
+
message: z.object({
|
|
22
|
+
level: z.enum(["error", "warning", "note", "help", "failure-note"]),
|
|
23
|
+
code: z.object({ code: z.string() }).nullable(),
|
|
24
|
+
message: z.string(),
|
|
25
|
+
spans: z.array(z.object({
|
|
26
|
+
file_name: z.string(),
|
|
27
|
+
line_start: z.number().int().nonnegative(),
|
|
28
|
+
is_primary: z.boolean(),
|
|
29
|
+
})),
|
|
30
|
+
}),
|
|
31
|
+
}),
|
|
32
|
+
z.object({
|
|
33
|
+
reason: z.literal("build-script-executed"),
|
|
34
|
+
package_id: z.string(),
|
|
35
|
+
}),
|
|
36
|
+
]);
|
|
37
|
+
const schema = z.strictObject({
|
|
38
|
+
version: z.literal(1),
|
|
39
|
+
cargoVersion: z.literal("1.98.1"),
|
|
40
|
+
rustcVersion: z.literal("1.98.1"),
|
|
41
|
+
project: z.string(),
|
|
42
|
+
packageId: z.string(),
|
|
43
|
+
exitCode: z.number().int(),
|
|
44
|
+
targets: z.array(target).min(1),
|
|
45
|
+
events: z.array(event).max(20_000),
|
|
46
|
+
observedSources: z.array(z.string()).max(20_000),
|
|
47
|
+
depInfoCount: z.number().int().nonnegative().max(20_000),
|
|
48
|
+
scopeError: z.boolean(),
|
|
49
|
+
});
|
|
50
|
+
export function rustEvidence(check, processes, root) {
|
|
51
|
+
const incomplete = {
|
|
52
|
+
status: "inconclusive",
|
|
53
|
+
reason: "Rust evidence is malformed, stale or missing native target/source coverage.",
|
|
54
|
+
};
|
|
55
|
+
if (processes.length !== 1 || !root)
|
|
56
|
+
return incomplete;
|
|
57
|
+
const process = processes[0];
|
|
58
|
+
if (process.exitCode === 3) {
|
|
59
|
+
try {
|
|
60
|
+
z.strictObject({
|
|
61
|
+
unavailable: z.literal("rust-toolchain"),
|
|
62
|
+
reason: z.enum(["unsupported-version", "unsupported-workspace"]),
|
|
63
|
+
}).parse(JSON.parse(process.stdout));
|
|
64
|
+
return {
|
|
65
|
+
status: "unavailable",
|
|
66
|
+
reason: "The installed Rust version or Cargo workspace shape is outside the verified profile.",
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
return incomplete;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (process.exitCode !== 0)
|
|
74
|
+
return {
|
|
75
|
+
status: "error",
|
|
76
|
+
reason: "Rust tooling could not resolve the package or complete native evidence collection.",
|
|
77
|
+
};
|
|
78
|
+
try {
|
|
79
|
+
const data = schema.parse(JSON.parse(process.stdout));
|
|
80
|
+
if (data.project !== check.project)
|
|
81
|
+
return incomplete;
|
|
82
|
+
const expected = new Set(check.scope.map((file) => path.resolve(root, check.project, file)));
|
|
83
|
+
const findings = [];
|
|
84
|
+
let errors = 0;
|
|
85
|
+
for (const item of data.events) {
|
|
86
|
+
if (item.reason !== "compiler-message")
|
|
87
|
+
continue;
|
|
88
|
+
if (item.message.level === "error")
|
|
89
|
+
errors++;
|
|
90
|
+
if (!["error", "warning"].includes(item.message.level))
|
|
91
|
+
continue;
|
|
92
|
+
const location = item.message.spans.find((span) => span.is_primary);
|
|
93
|
+
const absolute = location
|
|
94
|
+
? path.resolve(root, check.project, location.file_name)
|
|
95
|
+
: undefined;
|
|
96
|
+
findings.push({
|
|
97
|
+
ruleId: `rustc/${item.message.code?.code ?? "diagnostic"}`,
|
|
98
|
+
level: item.message.level === "error" ? "error" : "warning",
|
|
99
|
+
message: item.message.message,
|
|
100
|
+
...(absolute && expected.has(absolute) && location.line_start > 0
|
|
101
|
+
? {
|
|
102
|
+
file: path.relative(root, absolute).split(path.sep).join("/"),
|
|
103
|
+
line: location.line_start,
|
|
104
|
+
}
|
|
105
|
+
: {}),
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
if (errors)
|
|
109
|
+
return {
|
|
110
|
+
status: "failed",
|
|
111
|
+
reason: "The Rust compiler reported errors; compilation failures do not establish complete analysis.",
|
|
112
|
+
findings,
|
|
113
|
+
findingsComplete: false,
|
|
114
|
+
};
|
|
115
|
+
if (data.exitCode !== 0)
|
|
116
|
+
return {
|
|
117
|
+
status: "error",
|
|
118
|
+
reason: "Cargo failed without structured compiler-error evidence.",
|
|
119
|
+
findings,
|
|
120
|
+
findingsComplete: false,
|
|
121
|
+
};
|
|
122
|
+
const finished = data.events.filter((item) => item.reason === "build-finished");
|
|
123
|
+
const artifacts = data.events
|
|
124
|
+
.filter((item) => item.reason === "compiler-artifact")
|
|
125
|
+
.filter((item) => item.package_id === data.packageId);
|
|
126
|
+
const observed = new Set(data.observedSources.map((file) => path.resolve(root, check.project, file)));
|
|
127
|
+
if (finished.length !== 1 ||
|
|
128
|
+
!finished[0].success ||
|
|
129
|
+
data.events.at(-1)?.reason !== "build-finished" ||
|
|
130
|
+
data.scopeError ||
|
|
131
|
+
!data.depInfoCount ||
|
|
132
|
+
!expected.size ||
|
|
133
|
+
observed.size !== data.observedSources.length ||
|
|
134
|
+
observed.size !== expected.size ||
|
|
135
|
+
[...observed].some((file) => !expected.has(file)) ||
|
|
136
|
+
!artifacts.length ||
|
|
137
|
+
artifacts.some((item) => item.fresh) ||
|
|
138
|
+
data.targets.some((item) => !expected.has(path.resolve(item.src_path)) ||
|
|
139
|
+
!artifacts.some((artifact) => artifact.target.name === item.name &&
|
|
140
|
+
artifact.target.src_path === item.src_path &&
|
|
141
|
+
JSON.stringify(artifact.target.kind) ===
|
|
142
|
+
JSON.stringify(item.kind) &&
|
|
143
|
+
(!item.test ||
|
|
144
|
+
item.kind.includes("custom-build") ||
|
|
145
|
+
artifact.profile.test))))
|
|
146
|
+
return { ...incomplete, findings, findingsComplete: false };
|
|
147
|
+
return {
|
|
148
|
+
status: "passed",
|
|
149
|
+
reason: "Cargo checked all declared targets with fresh output and dep-info coverage of inventoried Rust source; no tests were executed.",
|
|
150
|
+
findings,
|
|
151
|
+
findingsComplete: true,
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
catch {
|
|
155
|
+
return incomplete;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
2
|
+
import { mkdtemp, readdir, readFile, realpath, rm, stat, } from "node:fs/promises";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
import { rustDependencyPaths } from "./rust-dep-info.js";
|
|
7
|
+
const target = z.object({
|
|
8
|
+
name: z.string(),
|
|
9
|
+
src_path: z.string(),
|
|
10
|
+
kind: z.array(z.string()),
|
|
11
|
+
test: z.boolean(),
|
|
12
|
+
});
|
|
13
|
+
const metadataSchema = z.object({
|
|
14
|
+
version: z.literal(1),
|
|
15
|
+
workspace_root: z.string(),
|
|
16
|
+
target_directory: z.string(),
|
|
17
|
+
build_directory: z.string(),
|
|
18
|
+
workspace_members: z.array(z.string()),
|
|
19
|
+
packages: z.array(z.object({
|
|
20
|
+
id: z.string(),
|
|
21
|
+
manifest_path: z.string(),
|
|
22
|
+
targets: z.array(target),
|
|
23
|
+
})),
|
|
24
|
+
});
|
|
25
|
+
function invoke(executable, args) {
|
|
26
|
+
const result = spawnSync(executable, args, {
|
|
27
|
+
encoding: "utf8",
|
|
28
|
+
maxBuffer: 1024 * 1024,
|
|
29
|
+
});
|
|
30
|
+
if (result.error || result.signal || result.status === null)
|
|
31
|
+
throw new Error("Rust tool did not complete within evidence limits");
|
|
32
|
+
return result;
|
|
33
|
+
}
|
|
34
|
+
async function main() {
|
|
35
|
+
const [root, ...scope] = process.argv.slice(2);
|
|
36
|
+
if (!root || !scope.length)
|
|
37
|
+
throw new Error("Invalid Rust scope");
|
|
38
|
+
for (const tool of ["rustc", "cargo"]) {
|
|
39
|
+
const version = invoke(tool, ["--version"]);
|
|
40
|
+
if (version.status !== 0 ||
|
|
41
|
+
version.stderr.trim() ||
|
|
42
|
+
!new RegExp(`^${tool} 1\\.98\\.1 \\([a-f0-9]+ [0-9-]+\\)$`).test(version.stdout.trim())) {
|
|
43
|
+
process.stdout.write(JSON.stringify({
|
|
44
|
+
unavailable: "rust-toolchain",
|
|
45
|
+
reason: "unsupported-version",
|
|
46
|
+
}));
|
|
47
|
+
process.exitCode = 3;
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const temporary = await mkdtemp(path.join(tmpdir(), "checktrail-rust-"));
|
|
52
|
+
try {
|
|
53
|
+
const config = [
|
|
54
|
+
"--config",
|
|
55
|
+
`build.build-dir=${JSON.stringify(temporary)}`,
|
|
56
|
+
"--config",
|
|
57
|
+
`build.target-dir=${JSON.stringify(temporary)}`,
|
|
58
|
+
];
|
|
59
|
+
const metadataProcess = invoke("cargo", [
|
|
60
|
+
"metadata",
|
|
61
|
+
"--format-version=1",
|
|
62
|
+
"--offline",
|
|
63
|
+
"--locked",
|
|
64
|
+
"--no-deps",
|
|
65
|
+
...config,
|
|
66
|
+
]);
|
|
67
|
+
if (metadataProcess.status !== 0)
|
|
68
|
+
throw new Error("Cargo metadata could not resolve the locked local package");
|
|
69
|
+
const metadata = metadataSchema.parse(JSON.parse(metadataProcess.stdout));
|
|
70
|
+
if (metadata.target_directory !== temporary ||
|
|
71
|
+
metadata.build_directory !== temporary)
|
|
72
|
+
throw new Error("Cargo did not select fresh output directories");
|
|
73
|
+
const cwd = await realpath(process.cwd());
|
|
74
|
+
const selected = metadata.packages.find((item) => item.manifest_path === path.join(cwd, "Cargo.toml"));
|
|
75
|
+
if (metadata.workspace_root !== cwd ||
|
|
76
|
+
metadata.workspace_members.length !== 1 ||
|
|
77
|
+
!selected ||
|
|
78
|
+
metadata.workspace_members[0] !== selected.id) {
|
|
79
|
+
process.stdout.write(JSON.stringify({
|
|
80
|
+
unavailable: "rust-toolchain",
|
|
81
|
+
reason: "unsupported-workspace",
|
|
82
|
+
}));
|
|
83
|
+
process.exitCode = 3;
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
const execution = invoke("cargo", [
|
|
87
|
+
"check",
|
|
88
|
+
"--all-targets",
|
|
89
|
+
"--offline",
|
|
90
|
+
"--locked",
|
|
91
|
+
"--message-format=json",
|
|
92
|
+
"--color=never",
|
|
93
|
+
"--target-dir",
|
|
94
|
+
temporary,
|
|
95
|
+
...config,
|
|
96
|
+
]);
|
|
97
|
+
const events = execution.stdout
|
|
98
|
+
.split("\n")
|
|
99
|
+
.filter(Boolean)
|
|
100
|
+
.map((line) => JSON.parse(line));
|
|
101
|
+
const files = new Set();
|
|
102
|
+
let entries = 0;
|
|
103
|
+
let bytes = 0;
|
|
104
|
+
let depInfoCount = 0;
|
|
105
|
+
let scopeError = false;
|
|
106
|
+
try {
|
|
107
|
+
const pending = [temporary];
|
|
108
|
+
while (pending.length) {
|
|
109
|
+
const directory = pending.pop();
|
|
110
|
+
for (const entry of await readdir(directory, { withFileTypes: true })) {
|
|
111
|
+
if (++entries > 20_000)
|
|
112
|
+
throw new Error("Rust build inventory limit");
|
|
113
|
+
const file = path.join(directory, entry.name);
|
|
114
|
+
if (entry.isDirectory())
|
|
115
|
+
pending.push(file);
|
|
116
|
+
else if (entry.isFile() && entry.name.endsWith(".d")) {
|
|
117
|
+
if ((await stat(file)).size >
|
|
118
|
+
Math.min(8 * 1024 * 1024, 16 * 1024 * 1024 - bytes))
|
|
119
|
+
throw new Error("Rust dep-info byte limit");
|
|
120
|
+
const source = await readFile(file, "utf8");
|
|
121
|
+
bytes += Buffer.byteLength(source);
|
|
122
|
+
if (bytes > 16 * 1024 * 1024)
|
|
123
|
+
throw new Error("Rust dep-info byte limit");
|
|
124
|
+
for (const dependency of rustDependencyPaths(source, cwd))
|
|
125
|
+
files.add(dependency);
|
|
126
|
+
depInfoCount++;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
catch {
|
|
132
|
+
scopeError = true;
|
|
133
|
+
}
|
|
134
|
+
const expected = new Set(scope.map((item) => path.resolve(cwd, item)));
|
|
135
|
+
const observedSources = [...files]
|
|
136
|
+
.filter((file) => expected.has(file))
|
|
137
|
+
.map((file) => path.relative(cwd, file))
|
|
138
|
+
.sort();
|
|
139
|
+
process.stdout.write(JSON.stringify({
|
|
140
|
+
version: 1,
|
|
141
|
+
cargoVersion: "1.98.1",
|
|
142
|
+
rustcVersion: "1.98.1",
|
|
143
|
+
exitCode: execution.status,
|
|
144
|
+
project: path.relative(root, cwd) || ".",
|
|
145
|
+
packageId: selected.id,
|
|
146
|
+
targets: selected.targets,
|
|
147
|
+
events,
|
|
148
|
+
observedSources,
|
|
149
|
+
depInfoCount,
|
|
150
|
+
scopeError,
|
|
151
|
+
}));
|
|
152
|
+
process.stderr.write(execution.stderr);
|
|
153
|
+
}
|
|
154
|
+
finally {
|
|
155
|
+
await rm(temporary, { recursive: true, force: true });
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
main().catch(() => {
|
|
159
|
+
process.stderr.write("Rust collector failed while resolving the package or bounded native evidence.\n");
|
|
160
|
+
process.exitCode = 2;
|
|
161
|
+
});
|