refactor(cli): project reconstruction and source-to-bundle documents from their contracts (#10697)

* refactor(cli): project reconstruction ledger and coverage commands from their contracts

* refactor(cli): project compare-source-to-bundle from its contract and refuse omitted document fields

* fix(cli): advertise caller paths in JSON documents as the CLI admits them

* fix(cli): advertise that JSON document caller paths exclude URLs

* refactor(cli): narrow omitted document field refusal to object documents

* test(cli): give the coverage document fixture the current evidence_format
This commit is contained in:
morluto authored and GitHub committed 2026-11-15 19:40:22 +08:00
1 parent fd2eabb12a
commit 9be6a96fd6
12 files changed
+456 -182

No files matched your search

@@ -6,7 +6,6 @@ import {
import {
compareApplicationVersionsRequestSchema,
compareJavaScriptExportShapesRequestSchema,
compareSourceToBundleCliInputSchema,
compareSourceToBundleRequestSchema,
traceApplicationFeatureRequestSchema,
} from "../../contracts/javascript/applicationWorkflowInputContracts.js";
@@ -235,12 +234,12 @@ export const compareApplicationVersionsEvidence = (
/** Select the application record and historical graph through their shared owners. */
export const executeSourceToBundleComparison = async (
rawInput: unknown,
schema:
| typeof compareSourceToBundleCliInputSchema
| typeof compareSourceToBundleRequestSchema,
lookup: EvidenceLookup | undefined,
resources: ArtifactResourceScope,
options: Pick<ExecutionOptions, "signal"> = {},
options: Pick<ExecutionOptions, "signal"> & {
/** The reference file path as the caller spelled it. */
readonly requestedReferencePath?: string;
} = {},
): Promise<
Result<
ApplicationWorkflowExecution<SourceToBundleComparisonResult>,
@@ -250,7 +249,7 @@ export const executeSourceToBundleComparison = async (
const selected = resolveEvidenceRequest(
"compare_source_to_bundle",
rawInput,
schema,
compareSourceToBundleRequestSchema,
lookup,
options,
);
@@ -261,6 +260,7 @@ export const executeSourceToBundleComparison = async (
selected.value.input.reference,
options.signal,
resources,
options.requestedReferencePath,
);
return reference.ok
? compareSourceToBundleEvidence({
@@ -1,7 +1,7 @@
import { requireAuthenticationHeadroom } from "../JsonAuthenticationHeadroom.js";
import { setImmediate } from "node:timers/promises";
import type { z } from "zod";
import type { compareSourceToBundleCliInputSchema } from "../../contracts/javascript/applicationWorkflowInputContracts.js";
import type { compareSourceToBundleRequestSchema } from "../../contracts/javascript/applicationWorkflowInputContracts.js";
import {
historicalSourceGraphSchema,
type HistoricalSourceGraph,
@@ -25,9 +25,11 @@ export type ResolvedSourceToBundleReference = {
/** Resolve one caller-selected historical graph using the shared bounded regular-file reader. No file cache. */
export const resolveSourceToBundleReference = async (
reference: z.output<typeof compareSourceToBundleCliInputSchema>["reference"],
reference: z.output<typeof compareSourceToBundleRequestSchema>["reference"],
signal?: AbortSignal,
resources?: ArtifactResourceScope,
/** The file path as the caller spelled it, when an adapter resolved it. */
requestedPath?: string,
): Promise<Result<ResolvedSourceToBundleReference, AnalysisError>> => {
if (isAborted(signal))
return err(cancelledBy("compare_source_to_bundle", signal));
@@ -71,7 +73,7 @@ export const resolveSourceToBundleReference = async (
reference_source: {
kind: "file",
path: read.value.path,
requested_path: reference.path,
requested_path: requestedPath ?? reference.path,
},
});
};