From 3c5c6522b5d24aefd5fa3ba67c64adc2c18c2e63 Mon Sep 17 00:00:00 2001 From: morluto <76467478+morluto@users.noreply.github.com> Date: Sun, 22 Nov 2026 20:07:14 -0500 Subject: [PATCH] refactor(cli): extract contractDocumentCommand from contractCommand (#13782) --- src/cli/analysisViewCommands.ts | 2 +- src/cli/applicationCommands.ts | 2 +- src/cli/artifactComparisonCommand.ts | 2 +- src/cli/contractCommand.ts | 202 +-------------- src/cli/contractDocumentCommand.ts | 231 ++++++++++++++++++ src/cli/electronCommands.ts | 2 +- src/cli/evidenceInputCommand.ts | 2 +- src/cli/managedCommands.ts | 2 +- src/cli/nativeCallCommands.ts | 6 +- src/cli/nativeFunctionMatchingCommands.ts | 6 +- src/cli/sourceToBundleCommand.ts | 2 +- src/cli/staticObservedEndpointsCommand.ts | 2 +- src/cli/wasmCommands.ts | 2 +- src/cliBrowserScenarioCommands.ts | 2 +- .../cli/contractCommandInputFields.test.ts | 2 +- .../cli/contractCommandViewDelivery.test.ts | 6 +- 16 files changed, 249 insertions(+), 224 deletions(-) create mode 100644 src/cli/contractDocumentCommand.ts diff --git a/src/cli/analysisViewCommands.ts b/src/cli/analysisViewCommands.ts index bf9dd25dbca..3eb47df6eab 100644 --- a/src/cli/analysisViewCommands.ts +++ b/src/cli/analysisViewCommands.ts @@ -19,7 +19,7 @@ import type { CliInstance } from "./types.js"; import { localPathStringSchema } from "../domain/localPath.js"; import { withCommandCancellation } from "./commandCancellation.js"; import { contractNamed } from "./contractCliDescription.js"; -import { registerContractDocumentCommand } from "./contractCommand.js"; +import { registerContractDocumentCommand } from "./contractDocumentCommand.js"; import { finishAnalysisCommand } from "./finishAnalysisCommand.js"; import { jsonInputArgument } from "./jsonInputArgument.js"; diff --git a/src/cli/applicationCommands.ts b/src/cli/applicationCommands.ts index fe7a624c0ad..1f1281ec915 100644 --- a/src/cli/applicationCommands.ts +++ b/src/cli/applicationCommands.ts @@ -10,7 +10,7 @@ import type { JsonValue } from "../domain/jsonValue.js"; import type { Logger } from "pino"; import { APPLICATION_TOOL_CONTRACTS } from "../contracts/applicationToolContracts.js"; import { contractNamed } from "./contractCliDescription.js"; -import { registerContractDocumentCommand } from "./contractCommand.js"; +import { registerContractDocumentCommand } from "./contractDocumentCommand.js"; import type { EvidenceLookup } from "../application/EvidenceInputResolver.js"; import type { Evidence } from "../domain/evidence.js"; import type { Result } from "../domain/result.js"; diff --git a/src/cli/artifactComparisonCommand.ts b/src/cli/artifactComparisonCommand.ts index 8b7a7f94334..497303a315f 100644 --- a/src/cli/artifactComparisonCommand.ts +++ b/src/cli/artifactComparisonCommand.ts @@ -8,7 +8,7 @@ import { ArtifactResourceScope } from "../resources/index.js"; import { SESSION_TOOL_CONTRACTS } from "../contracts/sessionToolContracts.js"; import { ARTIFACT_COMPARISON_PROVIDER } from "../domain/comparisonEvidenceIdentity.js"; import { contractNamed } from "./contractCliDescription.js"; -import { registerContractDocumentCommand } from "./contractCommand.js"; +import { registerContractDocumentCommand } from "./contractDocumentCommand.js"; import { finishAnalysisCommand } from "./finishAnalysisCommand.js"; import type { CliInstance } from "./types.js"; diff --git a/src/cli/contractCommand.ts b/src/cli/contractCommand.ts index 04bb9238e96..b0b11bc630f 100644 --- a/src/cli/contractCommand.ts +++ b/src/cli/contractCommand.ts @@ -26,12 +26,9 @@ import { finishAnalysisCommand } from "./finishAnalysisCommand.js"; import { withCommandCancellation } from "./commandCancellation.js"; import { dispatchQueuedInterrupts } from "../process/queuedInterrupts.js"; import { finalizedResult, runOwned } from "../providers/runOwned.js"; -import { parseCliJsonInput, resolveCliJsonPaths } from "./cliJsonInput.js"; -import { jsonInputArgument } from "./jsonInputArgument.js"; +import { parseCliJsonInput } from "./cliJsonInput.js"; import { describeContractCommand, - describeContractDocumentCommand, - type CliDocumentProjection, describeOperationChoices, withoutDefault, } from "./contractCliDescription.js"; @@ -1138,72 +1135,6 @@ const withCliOnlyDefaults = ( ), }); -/** What a JSON-document command's handler receives besides the document. */ -export interface ContractDocumentContext< - CliOptions extends Readonly> = Readonly< - Record - >, - Parsed = unknown, -> { - readonly signal: AbortSignal; - /** The contract name, which is the canonical operation. */ - readonly operation: string; - /** The document as decoded, before its caller paths were resolved. */ - readonly spelled: unknown; - /** A document is never parsed at admission; see `parseWholeInput`. */ - readonly parsed: undefined; - /** - * The contract's parse of the document, with caller paths resolved, as - * the whole contract input, or its refusal (issues name the caller's - * spelling). It parses on first call and reuses the result, so a handler - * whose document is not the whole input never parses it here. Read it - * through `admittedContractInput`. - */ - readonly parseWholeInput: () => Result; - /** - * The document's transport frame as `--schema` advertises it. A handler - * that reads other inputs first, such as an Evidence bundle, admits the - * document with it beforehand; Evidence carriers stay with their owner. - */ - readonly frame: z.ZodType; - /** The admitted delivery, for a projection with `evidenceDelivery`. */ - readonly delivery: CliEvidenceDeliveryChoice | undefined; - /** The projection's CLI-only options, whose effect the handler owns. */ - readonly cliOptions: CliOptions; - /** - * The session target as the caller spelled it, for a projection with - * `sessionTarget`; undefined otherwise. - */ - readonly sessionTarget: string | undefined; - /** - * The session target's opening fields the caller selected, in the opening - * contract's spelling; empty without `sessionTarget.open`. - */ - readonly opening: Readonly>; -} - -/** - * A document field the projection omits or takes as an option is refused - * with its reason rather than passed to an owner that would act on it. - */ -const refusedDocumentFieldError = ( - operation: string, - refusals: Readonly>, - document: object, -): AnalysisError | undefined => { - const issues = Object.entries(refusals) - .filter(([field]) => Object.hasOwn(document, field)) - .map(([field, message]) => ({ - code: "custom" as const, - path: [field], - message, - input: (document as Readonly>)[field], - })); - return issues.length === 0 - ? undefined - : analysisInputErrorFromIssues(operation, issues, document); -}; - /** The CLI keys of a description's JSON inputs. */ const jsonInputKeys = ( description: ContractCliDescription, @@ -1323,134 +1254,3 @@ const keepsOwnFailure = (error: JsonValue): boolean => isRecord(error) && ("input_path" in error || (error as { readonly code?: unknown }).code === "cancelled"); - -/** - * Register one CLI command whose whole contract input is one JSON document. - * The handler receives the decoded document with its caller paths made - * absolute, and admits it with the contract's owner. - */ -export const registerContractDocumentCommand = < - Contract extends DocumentContract, - Value, - CliOptions extends CliOptionShape = Record, ->( - cli: CliInstance, - logger: Logger, - contract: Contract, - projection: CliDocumentProjection, CliOptions>, - run: ( - document: unknown, - context: ContractDocumentContext< - CliOptionValues, - z.output - >, - ) => Promise, -): void => { - const description = describeContractDocumentCommand(contract, projection); - const options = Object.fromEntries( - [ - ...(description.sessionTarget?.options ?? []), - ...description.deliveryOptions, - ...description.cliOnlyOptions, - ].map(({ key, schema }) => [key, schema]), - ); - registerCliCommand( - cli, - description.command, - { - description: description.description, - args: z.object({ - ...(description.sessionTarget === undefined - ? {} - : { - [description.sessionTarget.key]: description.sessionTarget.schema, - }), - [description.key]: jsonInputArgument( - description.documentDescription, - description.content, - ), - }), - ...(Object.keys(options).length === 0 - ? {} - : { options: z.object(options) }), - run: ({ - args, - options: values, - }: { - readonly args: Readonly>; - readonly options: Readonly>; - }) => - withCommandCancellation((signal) => - logCliCommand(logger, description.command, async () => { - // Delivery options are checked before the document is read. - const delivery = description.admitDelivery(values); - if (!delivery.ok) return projectAnalysisError(delivery.error); - const opening = admitOpening(description, { ...values, ...args }); - if (!opening.ok) return projectAnalysisError(opening.error); - const decoded = await parseCliJsonInput( - args[description.key]!, - contract.name, - signal, - ); - if (!decoded.ok) return decoded.error; - // A document that is not an object has no fields to refuse; the - // contract refuses it. - const refused = - typeof decoded.value === "object" && decoded.value !== null - ? refusedDocumentFieldError( - contract.name, - description.documentRefusals, - decoded.value, - ) - : undefined; - if (refused !== undefined) return projectAnalysisError(refused); - const document = resolveCliJsonPaths( - decoded.value, - description.callerPaths, - ); - let admitted: - | Result, AnalysisInputError> - | undefined; - const parseWholeInput = () => - (admitted ??= (() => { - const parsed = contract.inputSchema.safeParse(document); - return parsed.success - ? ok(parsed.data as z.output) - : err( - analysisInputErrorFromIssues( - contract.name, - parsed.error.issues, - decoded.value, - ), - ); - })()); - return run(document, { - signal, - operation: contract.name, - spelled: decoded.value, - parsed: undefined, - parseWholeInput, - frame: description.content, - delivery: delivery.value, - opening: opening.value, - sessionTarget: - description.sessionTarget === undefined - ? undefined - : args[description.sessionTarget.key], - cliOptions: description.cliOptionValues( - values, - ) as CliOptionValues, - }); - }), - ), - } as never, - { - // A document's fields are set in the document, not by flags. - operations: contractDescriptionOperations({ - contract: description.contract, - sessionTarget: description.sessionTarget, - }), - source: { kind: "document", description }, - }, - ); -}; diff --git a/src/cli/contractDocumentCommand.ts b/src/cli/contractDocumentCommand.ts new file mode 100644 index 00000000000..840c856dc02 --- /dev/null +++ b/src/cli/contractDocumentCommand.ts @@ -0,0 +1,231 @@ +import { z } from "zod"; +import type { Logger } from "pino"; + +import { logCliCommand } from "../cliLogging.js"; +import type { AnalysisError } from "../domain/analysisErrorBase.js"; +import type { AnalysisInputError } from "../domain/analysisErrorCore.js"; +import { projectAnalysisError } from "../domain/analysisErrorProjection.js"; +import { analysisInputErrorFromIssues } from "../domain/inputIssueProjection.js"; +import { err, ok, type Result } from "../domain/result.js"; +import { withCommandCancellation } from "./commandCancellation.js"; +import { parseCliJsonInput, resolveCliJsonPaths } from "./cliJsonInput.js"; +import { jsonInputArgument } from "./jsonInputArgument.js"; +import { + describeContractDocumentCommand, + type CliDocumentProjection, +} from "./contractCliDescription.js"; +import type { + DocumentContract, + CliEvidenceDeliveryChoice, + CliOptionShape, + CliOptionValues, + ContractField, +} from "./contractCliDescriptionTypes.js"; +import { + contractDescriptionOperations, + registerCliCommand, +} from "./commandRegistry.js"; +import type { CliInstance } from "./types.js"; + +/** What a JSON-document command's handler receives besides the document. */ +export interface ContractDocumentContext< + CliOptions extends Readonly> = Readonly< + Record + >, + Parsed = unknown, +> { + readonly signal: AbortSignal; + /** The contract name, which is the canonical operation. */ + readonly operation: string; + /** The document as decoded, before its caller paths were resolved. */ + readonly spelled: unknown; + /** A document is never parsed at admission; see `parseWholeInput`. */ + readonly parsed: undefined; + /** + * The contract's parse of the document, with caller paths resolved, as + * the whole contract input, or its refusal (issues name the caller's + * spelling). It parses on first call and reuses the result, so a handler + * whose document is not the whole input never parses it here. Read it + * through `admittedContractInput`. + */ + readonly parseWholeInput: () => Result; + /** + * The document's transport frame as `--schema` advertises it. A handler + * that reads other inputs first, such as an Evidence bundle, admits the + * document with it beforehand; Evidence carriers stay with their owner. + */ + readonly frame: z.ZodType; + /** The admitted delivery, for a projection with `evidenceDelivery`. */ + readonly delivery: CliEvidenceDeliveryChoice | undefined; + /** The projection's CLI-only options, whose effect the handler owns. */ + readonly cliOptions: CliOptions; + /** + * The session target as the caller spelled it, for a projection with + * `sessionTarget`; undefined otherwise. + */ + readonly sessionTarget: string | undefined; + /** + * The session target's opening fields the caller selected, in the opening + * contract's spelling; empty without `sessionTarget.open`. + */ + readonly opening: Readonly>; +} + +/** + * A document field the projection omits or takes as an option is refused + * with its reason rather than passed to an owner that would act on it. + */ +const refusedDocumentFieldError = ( + operation: string, + refusals: Readonly>, + document: object, +): AnalysisError | undefined => { + const issues = Object.entries(refusals) + .filter(([field]) => Object.hasOwn(document, field)) + .map(([field, message]) => ({ + code: "custom" as const, + path: [field], + message, + input: (document as Readonly>)[field], + })); + return issues.length === 0 + ? undefined + : analysisInputErrorFromIssues(operation, issues, document); +}; + +/** + * Register one CLI command whose whole contract input is one JSON document. + * The handler receives the decoded document with its caller paths made + * absolute, and admits it with the contract's owner. + */ +export const registerContractDocumentCommand = < + Contract extends DocumentContract, + Value, + CliOptions extends CliOptionShape = Record, +>( + cli: CliInstance, + logger: Logger, + contract: Contract, + projection: CliDocumentProjection, CliOptions>, + run: ( + document: unknown, + context: ContractDocumentContext< + CliOptionValues, + z.output + >, + ) => Promise, +): void => { + const description = describeContractDocumentCommand(contract, projection); + const options = Object.fromEntries( + [ + ...(description.sessionTarget?.options ?? []), + ...description.deliveryOptions, + ...description.cliOnlyOptions, + ].map(({ key, schema }) => [key, schema]), + ); + registerCliCommand( + cli, + description.command, + { + description: description.description, + args: z.object({ + ...(description.sessionTarget === undefined + ? {} + : { + [description.sessionTarget.key]: description.sessionTarget.schema, + }), + [description.key]: jsonInputArgument( + description.documentDescription, + description.content, + ), + }), + ...(Object.keys(options).length === 0 + ? {} + : { options: z.object(options) }), + run: ({ + args, + options: values, + }: { + readonly args: Readonly>; + readonly options: Readonly>; + }) => + withCommandCancellation((signal) => + logCliCommand(logger, description.command, async () => { + // Delivery options are checked before the document is read. + const delivery = description.admitDelivery(values); + if (!delivery.ok) return projectAnalysisError(delivery.error); + const opening = + description.sessionTarget === undefined + ? ok({} as Readonly>) + : description.sessionTarget.admitOpening( + description.contract.name, + { ...values, ...args }, + ); + if (!opening.ok) return projectAnalysisError(opening.error); + const decoded = await parseCliJsonInput( + args[description.key]!, + contract.name, + signal, + ); + if (!decoded.ok) return decoded.error; + // A document that is not an object has no fields to refuse; the + // contract refuses it. + const refused = + typeof decoded.value === "object" && decoded.value !== null + ? refusedDocumentFieldError( + contract.name, + description.documentRefusals, + decoded.value, + ) + : undefined; + if (refused !== undefined) return projectAnalysisError(refused); + const document = resolveCliJsonPaths( + decoded.value, + description.callerPaths, + ); + let admitted: + | Result, AnalysisInputError> + | undefined; + const parseWholeInput = () => + (admitted ??= (() => { + const parsed = contract.inputSchema.safeParse(document); + return parsed.success + ? ok(parsed.data as z.output) + : err( + analysisInputErrorFromIssues( + contract.name, + parsed.error.issues, + decoded.value, + ), + ); + })()); + return run(document, { + signal, + operation: contract.name, + spelled: decoded.value, + parsed: undefined, + parseWholeInput, + frame: description.content, + delivery: delivery.value, + opening: opening.value, + sessionTarget: + description.sessionTarget === undefined + ? undefined + : args[description.sessionTarget.key], + cliOptions: description.cliOptionValues( + values, + ) as CliOptionValues, + }); + }), + ), + } as never, + { + // A document's fields are set in the document, not by flags. + operations: contractDescriptionOperations({ + contract: description.contract, + sessionTarget: description.sessionTarget, + }), + source: { kind: "document", description }, + }, + ); +}; diff --git a/src/cli/electronCommands.ts b/src/cli/electronCommands.ts index cd89c2af53f..546038b1f6c 100644 --- a/src/cli/electronCommands.ts +++ b/src/cli/electronCommands.ts @@ -1,3 +1,4 @@ +import { registerContractDocumentCommand } from "./contractDocumentCommand.js"; import { projectCliAnalysisResult } from "./projectCliAnalysisResult.js"; import type { CliInstance } from "./types.js"; @@ -9,7 +10,6 @@ import { admittedContractInput, inspectWithService, registerContractCommand, - registerContractDocumentCommand, type ContractCommandContext, } from "./contractCommand.js"; import type { AnalysisError } from "../domain/analysisErrorBase.js"; diff --git a/src/cli/evidenceInputCommand.ts b/src/cli/evidenceInputCommand.ts index 9441d6991af..11d5acc3235 100644 --- a/src/cli/evidenceInputCommand.ts +++ b/src/cli/evidenceInputCommand.ts @@ -8,7 +8,7 @@ import { absoluteCallerPath } from "../filesystem/callerPath.js"; import type { EvidenceLookup } from "../application/EvidenceInputResolver.js"; import { parseAnalysisInput } from "../application/AnalysisInput.js"; import { finishAnalysisCommand } from "./finishAnalysisCommand.js"; -import type { ContractDocumentContext } from "./contractCommand.js"; +import type { ContractDocumentContext } from "./contractDocumentCommand.js"; /** Explicit portable lookup context for CLI workflows accepting retained IDs. */ export const evidenceBundleOption = localPathStringSchema diff --git a/src/cli/managedCommands.ts b/src/cli/managedCommands.ts index f794140a046..6502177e38d 100644 --- a/src/cli/managedCommands.ts +++ b/src/cli/managedCommands.ts @@ -1,3 +1,4 @@ +import { registerContractDocumentCommand } from "./contractDocumentCommand.js"; import { projectCliAnalysisResult } from "./projectCliAnalysisResult.js"; import { executeManagedMemberComparison } from "../application/managed/ManagedMemberComparisonService.js"; import { executeManagedNativeBoundaries } from "../application/managed/ManagedNativeVerificationService.js"; @@ -8,7 +9,6 @@ import { MANAGED_WORKFLOW_TOOL_CONTRACTS } from "../contracts/managed/managedWor import { contractNamed } from "./contractCliDescription.js"; import { registerContractCommand, - registerContractDocumentCommand, runOnEvidenceTargets, runOnSessionTarget, } from "./contractCommand.js"; diff --git a/src/cli/nativeCallCommands.ts b/src/cli/nativeCallCommands.ts index c83e7262ff1..97fc949c145 100644 --- a/src/cli/nativeCallCommands.ts +++ b/src/cli/nativeCallCommands.ts @@ -1,3 +1,4 @@ +import { registerContractDocumentCommand } from "./contractDocumentCommand.js"; import { projectCliAnalysisResult } from "./projectCliAnalysisResult.js"; import type { DirectAnalysis } from "../composition/directAnalysis.js"; @@ -7,10 +8,7 @@ import type { JsonValue } from "../domain/jsonValue.js"; import type { Logger } from "pino"; import type { CliInstance } from "./types.js"; import { contractNamed } from "./contractCliDescription.js"; -import { - admittedContractInput, - registerContractDocumentCommand, -} from "./contractCommand.js"; +import { admittedContractInput } from "./contractCommand.js"; /** `observe-native-calls `: the MCP input object as JSON. */ export const registerNativeCallCommands = ( diff --git a/src/cli/nativeFunctionMatchingCommands.ts b/src/cli/nativeFunctionMatchingCommands.ts index 8975bbc0cd4..a33fac11fd6 100644 --- a/src/cli/nativeFunctionMatchingCommands.ts +++ b/src/cli/nativeFunctionMatchingCommands.ts @@ -1,3 +1,4 @@ +import { registerContractDocumentCommand } from "./contractDocumentCommand.js"; import { z } from "zod"; import type { Logger } from "pino"; import { matchNativeFunctionsFromBundles } from "../application/native/NativeFunctionMatchingService.js"; @@ -9,10 +10,7 @@ import type { Evidence } from "../domain/evidence.js"; import { cliEvidenceDeliveryInputError } from "./analysisEvidenceDeliveryOptions.js"; import { publishCliAnalysisEvidence } from "./analysisEvidenceDelivery.js"; import { contractNamed } from "./contractCliDescription.js"; -import { - admittedContractInput, - registerContractDocumentCommand, -} from "./contractCommand.js"; +import { admittedContractInput } from "./contractCommand.js"; import { finishAnalysisCommand } from "./finishAnalysisCommand.js"; import type { CliInstance } from "./types.js"; import { parseNativeMatchingAllowance } from "../config/nativeMatchingAllowance.js"; diff --git a/src/cli/sourceToBundleCommand.ts b/src/cli/sourceToBundleCommand.ts index b1d0df4ce44..1cd39e72cfb 100644 --- a/src/cli/sourceToBundleCommand.ts +++ b/src/cli/sourceToBundleCommand.ts @@ -1,7 +1,7 @@ import type { Logger } from "pino"; import type { CliInstance } from "./types.js"; import { COMPARE_SOURCE_TO_BUNDLE_TOOL_CONTRACT } from "../contracts/sourceToBundleToolContract.js"; -import { registerContractDocumentCommand } from "./contractCommand.js"; +import { registerContractDocumentCommand } from "./contractDocumentCommand.js"; import { evidenceBundleOption, runEvidenceInputCommand, diff --git a/src/cli/staticObservedEndpointsCommand.ts b/src/cli/staticObservedEndpointsCommand.ts index 52f73829936..d7dc9cb0eee 100644 --- a/src/cli/staticObservedEndpointsCommand.ts +++ b/src/cli/staticObservedEndpointsCommand.ts @@ -2,7 +2,7 @@ import type { Logger } from "pino"; import type { Evidence } from "../domain/evidence.js"; import type { CliInstance } from "./types.js"; import { COMPARE_STATIC_AND_OBSERVED_ENDPOINTS_TOOL_CONTRACT } from "../contracts/staticObservedEndpointsToolContract.js"; -import { registerContractDocumentCommand } from "./contractCommand.js"; +import { registerContractDocumentCommand } from "./contractDocumentCommand.js"; import { evidenceBundleOption, runEvidenceInputCommand, diff --git a/src/cli/wasmCommands.ts b/src/cli/wasmCommands.ts index 031c547e59c..459925cf318 100644 --- a/src/cli/wasmCommands.ts +++ b/src/cli/wasmCommands.ts @@ -1,3 +1,4 @@ +import { registerContractDocumentCommand } from "./contractDocumentCommand.js"; import { projectCliAnalysisResult } from "./projectCliAnalysisResult.js"; import { compareWasmInterfaces } from "../application/wasm/WasmInterfaceComparisonService.js"; import { wasmArtifactModule } from "../composition/wasm.js"; @@ -7,7 +8,6 @@ import type { CliInstance } from "./types.js"; import { inspectWithService, registerContractCommand, - registerContractDocumentCommand, } from "./contractCommand.js"; import { evidenceBundleOption, diff --git a/src/cliBrowserScenarioCommands.ts b/src/cliBrowserScenarioCommands.ts index ed5c0f909b7..4d914267aef 100644 --- a/src/cliBrowserScenarioCommands.ts +++ b/src/cliBrowserScenarioCommands.ts @@ -4,7 +4,7 @@ import { captureBrowserScenario } from "./application/BrowserScenarioCaptureServ import type { BrowserScenarioCapturePort } from "./ports/BrowserScenarioCapturePort.js"; import { publishCliAnalysisEvidence } from "./cli/analysisEvidenceDelivery.js"; import { contractNamed } from "./cli/contractCliDescription.js"; -import { registerContractDocumentCommand } from "./cli/contractCommand.js"; +import { registerContractDocumentCommand } from "./cli/contractDocumentCommand.js"; import { finishAnalysisCommand } from "./cli/finishAnalysisCommand.js"; import type { CliInstance } from "./cli/types.js"; import { CLI_COMMANDS } from "./contracts/cliCommandNames.js"; diff --git a/tests/boundary/cli/contractCommandInputFields.test.ts b/tests/boundary/cli/contractCommandInputFields.test.ts index eb68e980d2d..13bf6d5a313 100644 --- a/tests/boundary/cli/contractCommandInputFields.test.ts +++ b/tests/boundary/cli/contractCommandInputFields.test.ts @@ -1,3 +1,4 @@ +import { registerContractDocumentCommand } from "../../../src/cli/contractDocumentCommand.js"; import { cliCommand } from "../../../src/cli/commandRegistry.js"; import { createCommandCli } from "../../support/cli/commandCli.js"; import { z } from "zod"; @@ -7,7 +8,6 @@ import { expect, it } from "vitest"; import { admittedContractInput, registerContractCommand, - registerContractDocumentCommand, } from "../../../src/cli/contractCommand.js"; import type { CliInstance } from "../../../src/cli/types.js"; diff --git a/tests/boundary/cli/contractCommandViewDelivery.test.ts b/tests/boundary/cli/contractCommandViewDelivery.test.ts index dd02b5dc339..135a1382857 100644 --- a/tests/boundary/cli/contractCommandViewDelivery.test.ts +++ b/tests/boundary/cli/contractCommandViewDelivery.test.ts @@ -1,13 +1,11 @@ +import { registerContractDocumentCommand } from "../../../src/cli/contractDocumentCommand.js"; import { cliCommand } from "../../../src/cli/commandRegistry.js"; import { createCommandCli } from "../../support/cli/commandCli.js"; import { z } from "zod"; import pino from "pino"; import { expect, it } from "vitest"; -import { - registerContractCommand, - registerContractDocumentCommand, -} from "../../../src/cli/contractCommand.js"; +import { registerContractCommand } from "../../../src/cli/contractCommand.js"; import type { CliInstance } from "../../../src/cli/types.js"; const viewSchema = z.strictObject({ page: z.number().int() }).optional();