diff --git a/docs/development/tool-design.md b/docs/development/tool-design.md index 3e7e3f4adf..89a234142f 100644 --- a/docs/development/tool-design.md +++ b/docs/development/tool-design.md @@ -584,7 +584,7 @@ and rendered for the CLI framework by `registerContractCommand` in [`contractCommand.ts`](https://github.com/morluto/rea/blob/main/src/cli/contractCommand.ts). The projection names only what the CLI spells differently: positionals, caller-relative path fields, option renames and short flags, CLI help wording, -omitted optional fields with a reason, and whether the contract's cross-field +omitted optional fields with a reason, Evidence delivery options, and whether the contract's cross-field rules refuse at argv parsing or at the service's contract parse. Field schemas and decimal argv tokens are derived, and `tests/boundary/cli/cliContractCommandParity.test.ts` checks that each projected diff --git a/src/cli/binaryDiagnosticsCommands.ts b/src/cli/binaryDiagnosticsCommands.ts index 2d047440a0..fe945485f8 100644 --- a/src/cli/binaryDiagnosticsCommands.ts +++ b/src/cli/binaryDiagnosticsCommands.ts @@ -1,4 +1,3 @@ -import { inspectDevicetreeInputSchema } from "../domain/firmware/devicetree.js"; import { z } from "incur"; import { cliDecimalField } from "./options.js"; import { producerLimitsOption } from "./producerLimitsOption.js"; @@ -29,19 +28,15 @@ import type { CliInstance } from "./types.js"; import { withCommandCancellation } from "./commandCancellation.js"; import { inspectBinaryLayoutInputSchema } from "../domain/native/binaryLayout.js"; import { inspectRecordedCrashInputSchema } from "../domain/native/recordedCrash.js"; -import { inspectNativeExportsInputSchema } from "../domain/native/nativeExports.js"; import { projectAnalysisError } from "../domain/analysisErrorProjection.js"; import { withEvidenceCallerInputPath } from "../domain/evidence.js"; import { BYTE_ENTROPY_PROVIDER } from "../domain/investigationProviders.js"; import { localPathStringSchema } from "../domain/localPath.js"; import { absoluteCallerPath } from "../filesystem/callerPath.js"; -import { - analysisEvidenceDeliveryOptions, - deliverCliAnalysisEvidence, -} from "./analysisEvidenceDelivery.js"; import { BINARY_DIAGNOSTICS_TOOL_CONTRACTS } from "../contracts/native/binaryDiagnosticsToolContracts.js"; import { contractNamed } from "./contractCliDescription.js"; import { + deliverWithService, inspectWithService, registerContractCommand, } from "./contractCommand.js"; @@ -287,95 +282,43 @@ export const registerBinaryDiagnosticsCommands = ( }, inspectWithService(createPeResourcesService, "rea-pe-resources"), ); - cli.command(CLI_COMMANDS.inspectDevicetree, { - description: "Inspect a flattened devicetree blob without executing it", - args: z.object({ - path: localPathStringSchema.describe("Local flattened devicetree image"), - }), - options: z.object({ - maxFileBytes: cliDecimalField( - inspectDevicetreeInputSchema.shape.max_file_bytes, - ).describe("Maximum FDT file size in bytes"), - maxNodes: cliDecimalField( - inspectDevicetreeInputSchema.shape.max_nodes, - ).describe("Maximum number of device-tree nodes"), - maxProperties: cliDecimalField( - inspectDevicetreeInputSchema.shape.max_properties, - ).describe("Maximum number of device-tree properties"), - maxDepth: cliDecimalField( - inspectDevicetreeInputSchema.shape.max_depth, - ).describe("Maximum device-tree nesting depth"), - ...analysisEvidenceDeliveryOptions, - }), - run: ({ args, options }) => - withCommandCancellation(async (signal) => { - const devicetree = createDevicetreeService(); - return await logCliCommand( - logger, - CLI_COMMANDS.inspectDevicetree, - async () => - deliverCliAnalysisEvidence({ - callerInputPath: args.path, - run: () => - devicetree.inspect( - { - path: absoluteCallerPath(args.path), - max_file_bytes: options.maxFileBytes, - max_nodes: options.maxNodes, - max_properties: options.maxProperties, - max_depth: options.maxDepth, - }, - { signal }, - ), - service: devicetree, - providerId: "rea-devicetree", - operation: "inspect_devicetree", - signal, - detail: options.detail, - evidenceOutput: options.evidence_output, - }), - ); - }), - }); - cli.command(CLI_COMMANDS.inspectNativeExports, { - description: - "Inspect a PE or ELF image's export table without executing it", - args: z.object({ - path: localPathStringSchema.describe("Local PE or ELF image"), - }), - options: z.object({ - maxFileBytes: cliDecimalField( - inspectNativeExportsInputSchema.shape.max_file_bytes, - ), - ...analysisEvidenceDeliveryOptions, - }), - run: ({ args, options }) => - withCommandCancellation(async (signal) => { - const exports = createNativeExportsService(); - return await logCliCommand( - logger, - CLI_COMMANDS.inspectNativeExports, - async () => - deliverCliAnalysisEvidence({ - callerInputPath: args.path, - run: () => - exports.inspect( - { - path: absoluteCallerPath(args.path), - max_file_bytes: options.maxFileBytes, - }, - { signal }, - ), - service: exports, - providerId: "rea-native-exports", - operation: "inspect_native_exports", - signal, - detail: options.detail, - evidenceOutput: options.evidence_output, - }), - ); - }), - }); + registerContractCommand( + cli, + logger, + contract("inspect_devicetree"), + { + command: CLI_COMMANDS.inspectDevicetree, + description: "Inspect a flattened devicetree blob without executing it", + positionals: ["path"], + callerPaths: ["path"], + evidenceDelivery: true, + fields: { + path: { description: "Local flattened devicetree image" }, + max_file_bytes: { description: "Maximum FDT file size in bytes" }, + max_nodes: { description: "Maximum number of device-tree nodes" }, + max_properties: { + description: "Maximum number of device-tree properties", + }, + max_depth: { description: "Maximum device-tree nesting depth" }, + }, + }, + deliverWithService(createDevicetreeService, "rea-devicetree"), + ); + registerContractCommand( + cli, + logger, + contract("inspect_native_exports"), + { + command: CLI_COMMANDS.inspectNativeExports, + description: + "Inspect a PE or ELF image's export table without executing it", + positionals: ["path"], + callerPaths: ["path"], + evidenceDelivery: true, + fields: { path: { description: "Local PE or ELF image" } }, + }, + deliverWithService(createNativeExportsService, "rea-native-exports"), + ); const service = createBinaryLayoutService(environment); cli.command(CLI_COMMANDS.inspectBinaryLayout, { description: diff --git a/src/cli/contractCliDescription.ts b/src/cli/contractCliDescription.ts index ac8637edd3..853c53b7cd 100644 --- a/src/cli/contractCliDescription.ts +++ b/src/cli/contractCliDescription.ts @@ -2,6 +2,7 @@ import { z } from "zod"; import { localPathStringSchema } from "../domain/localPath.js"; import { absoluteCallerPath } from "../filesystem/callerPath.js"; +import { analysisEvidenceDeliveryOptions } from "./analysisEvidenceDelivery.js"; import { cliDecimalShape } from "./options.js"; /** @@ -61,6 +62,25 @@ export interface CliContractProjection { * the service's contract parse reports them as an `invalid_request`. */ readonly crossFieldRules?: "argv"; + /** + * The command delivers complete Evidence or a summary saved beside a + * bundle: it adds `--detail` and `--evidence_output`. A contract `detail` + * field selects that delivery and is not passed to the analysis. + */ + readonly evidenceDelivery?: true; +} + +/** A CLI option with no contract field, such as `--evidence_output`. */ +export interface CliOnlyOption { + readonly key: string; + readonly description: string | undefined; + readonly schema: z.ZodType; +} + +/** The Evidence delivery a command invocation selected. */ +export interface CliEvidenceDeliveryChoice { + readonly detail: "complete" | "summary"; + readonly evidenceOutput: string | undefined; } /** One positional argument or option of a contract command. */ @@ -85,6 +105,8 @@ export interface ContractCliParameter { readonly decimal: boolean; /** Resolved with `absoluteCallerPath` before the contract sees it. */ readonly callerPath: boolean; + /** Selects CLI Evidence delivery and is not analysis input. */ + readonly delivery: boolean; } /** One cross-field refusal, naming CLI keys. */ @@ -100,6 +122,8 @@ export interface ContractCliDescription { readonly description: string; readonly contract: ProjectedContract; readonly parameters: readonly ContractCliParameter[]; + /** Options after the contract parameters that no contract field owns. */ + readonly cliOnlyOptions: readonly CliOnlyOption[]; /** Contract fields the command does not expose, with the reason. */ readonly omitted: Readonly>; /** Object-level JSON Schema constraints, renamed to CLI keys. */ @@ -121,6 +145,10 @@ export interface ContractCliDescription { readonly callerInputs: ( values: Readonly>, ) => Readonly>; + /** The selected delivery, for a projection with `evidenceDelivery`. */ + readonly delivery: ( + values: Readonly>, + ) => CliEvidenceDeliveryChoice; } /** One contract from a contract group, keeping its exact schema types. */ @@ -301,12 +329,15 @@ export const describeContractCommand = ( if (!admitsOmission(shape[field]!)) throw new Error(`${contract.name}.${field} is required on the CLI`); + const evidenceDelivery = projection.evidenceDelivery === true; const parameter = (field: string): ContractCliParameter => { const declared = shape[field]!; const projected = fieldProjections[field]; const callerPath = callerPaths.has(field); + const delivery = evidenceDelivery && field === "detail"; let schema: z.ZodType; - if (callerPath) { + if (delivery) schema = analysisEvidenceDeliveryOptions.detail; + else if (callerPath) { schema = admitsOmission(declared) ? localPathStringSchema.optional() : localPathStringSchema; @@ -331,6 +362,7 @@ export const describeContractCommand = ( repeatable: value instanceof z.ZodArray, decimal: value instanceof z.ZodNumber, callerPath, + delivery, }; }; const parameters = [ @@ -339,8 +371,22 @@ export const describeContractCommand = ( (field) => !positionals.includes(field) && !Object.hasOwn(omitted, field), ), ].map(parameter); - const keys = new Set(parameters.map(({ key }) => key)); - if (keys.size !== parameters.length) + const cliOnlyOptions: readonly CliOnlyOption[] = Object.entries( + evidenceDelivery + ? Object.hasOwn(shape, "detail") + ? { evidence_output: analysisEvidenceDeliveryOptions.evidence_output } + : analysisEvidenceDeliveryOptions + : {}, + ).map(([key, schema]: [string, z.ZodType]) => ({ + key, + description: schema.description, + schema, + })); + const keys = new Set([ + ...parameters.map(({ key }) => key), + ...cliOnlyOptions.map(({ key }) => key), + ]); + if (keys.size !== parameters.length + cliOnlyOptions.length) throw new Error(`${contract.name} projects two fields to one CLI key`); const keyOf = new Map(parameters.map(({ field, key }) => [field, key])); const rename = (field: string): string => keyOf.get(field) ?? field; @@ -349,9 +395,9 @@ export const describeContractCommand = ( values: Readonly>, ): Record => { const input: Record = {}; - for (const { field, key, callerPath } of parameters) { + for (const { field, key, callerPath, delivery } of parameters) { const value = values[key]; - if (value === undefined) continue; + if (value === undefined || delivery) continue; input[field] = callerPath && typeof value === "string" ? absoluteCallerPath(value) @@ -397,6 +443,7 @@ export const describeContractCommand = ( description: projection.description, contract, parameters, + cliOnlyOptions, omitted, optionConstraints: projectObjectConstraints(contract, rename), checkOptions, @@ -410,5 +457,12 @@ export const describeContractCommand = ( : []; }), ), + delivery: (values) => ({ + detail: values.detail === "summary" ? "summary" : "complete", + evidenceOutput: + typeof values.evidence_output === "string" + ? values.evidence_output + : undefined, + }), }; }; diff --git a/src/cli/contractCommand.ts b/src/cli/contractCommand.ts index 8db008c1b8..644beab995 100644 --- a/src/cli/contractCommand.ts +++ b/src/cli/contractCommand.ts @@ -5,11 +5,13 @@ import { logCliCommand } from "../cliLogging.js"; import type { AnalysisError } from "../domain/analysisErrorBase.js"; import type { Evidence } from "../domain/evidence.js"; import type { Result } from "../domain/result.js"; +import { deliverCliAnalysisEvidence } from "./analysisEvidenceDelivery.js"; import { finishCliEvidenceCommand } from "./cliEvidenceCallerPath.js"; import { withCommandCancellation } from "./commandCancellation.js"; import { describeContractCommand, type CliContractProjection, + type CliEvidenceDeliveryChoice, type ContractCliDescription, type ContractField, type ProjectedContract, @@ -30,6 +32,8 @@ export interface ContractCommandContext { readonly operation: string; /** Each caller-path field as the caller spelled it, before resolution. */ readonly callerInputs: Readonly>; + /** The selected delivery, for a projection with `evidenceDelivery`. */ + readonly delivery: CliEvidenceDeliveryChoice; } /** A closeable one-shot service that inspects one contract input. */ @@ -70,6 +74,27 @@ export const inspectWithService = ).then(projectCliAnalysisResult); }; +/** + * Inspect through a closeable service, then deliver complete Evidence or a + * summary with its bundle, recording the caller's spelling of `path`. + */ +export const deliverWithService = + (service: () => EvidenceInspectionService, providerId: string) => + (input: unknown, context: ContractCommandContext) => { + const callerInputPath = primaryCallerPath(context); + const owned = service(); + return deliverCliAnalysisEvidence({ + callerInputPath, + run: () => owned.inspect(input, { signal: context.signal }), + service: owned, + providerId, + operation: context.operation, + signal: context.signal, + detail: context.delivery.detail, + evidenceOutput: context.delivery.evidenceOutput, + }); + }; + const descriptions = new WeakMap(); /** Commands registered on this CLI through `registerContractCommand`. */ @@ -79,11 +104,14 @@ export const contractCommandDescriptions = ( const incurOptions = (description: ContractCliDescription): z.ZodType => { const object = z.object( - Object.fromEntries( - description.parameters + Object.fromEntries([ + ...description.parameters .filter(({ positional }) => !positional) - .map(({ key, schema }) => [key, schema]), - ), + .map(({ key, schema }) => [key, schema] as const), + ...description.cliOnlyOptions.map( + ({ key, schema }) => [key, schema] as const, + ), + ]), ); const constrained = description.optionConstraints === undefined @@ -155,6 +183,7 @@ export const registerContractCommand = < signal, operation: contract.name, callerInputs: description.callerInputs(values), + delivery: description.delivery(values), }, ), ), diff --git a/src/cli/goCommands.ts b/src/cli/goCommands.ts index cff997c286..c524b6b7a2 100644 --- a/src/cli/goCommands.ts +++ b/src/cli/goCommands.ts @@ -1,133 +1,43 @@ -import { z } from "incur"; -import { createGoBinaryService } from "../composition/go.js"; -import { CLI_COMMANDS } from "../cliCommandNames.js"; -import { logCliCommand } from "../cliLogging.js"; import type { Logger } from "pino"; -import type { CliInstance } from "./types.js"; -import { withCommandCancellation } from "./commandCancellation.js"; + +import { CLI_COMMANDS } from "../cliCommandNames.js"; +import { createGoBinaryService } from "../composition/go.js"; +import { GO_TOOL_CONTRACTS } from "../contracts/go/goToolContracts.js"; +import { contractNamed } from "./contractCliDescription.js"; import { - analysisEvidenceDeliveryOptions, - deliverCliAnalysisEvidence, -} from "./analysisEvidenceDelivery.js"; -import { localPathStringSchema } from "../domain/localPath.js"; -import { absoluteCallerPath } from "../filesystem/callerPath.js"; -import { machoSliceArchitectureSchema } from "../domain/apple/machoTargetSelection.js"; -import { goResourceBudgetFields } from "../domain/go/goBinary.js"; -import { cliDecimalField } from "./options.js"; + deliverWithService, + registerContractCommand, +} from "./contractCommand.js"; +import type { CliInstance } from "./types.js"; /** Resolve caller paths and inspect static build metadata through the shared workflow. */ export const registerGoCommands = (cli: CliInstance, logger: Logger): void => { - cli.command(CLI_COMMANDS.inspectGoBinary, { - description: - "Inspect embedded Go compiler, modules, build settings and optional static (ptr, len) string literals without target execution", - args: z.object({ - path: localPathStringSchema.describe( - "Local ELF, PE, thin Mach-O or universal Mach-O image", - ), - }), - options: z.object({ - ...analysisEvidenceDeliveryOptions, - architecture: machoSliceArchitectureSchema - .optional() - .describe( - "Slice to read from a universal Mach-O, by CPU family; when several slices share a family, arm64 (arm64 or arm64v8), arm64e (arm64e or arm64e.x1) or x86_64 names the subtype, and a value matching several slices is refused; required for universal files", - ), - includeStringLiterals: z - .boolean() - .optional() - .describe( - "Also recover bounded inferred Go UTF-8 string literals from static (ptr, len) headers", - ), - maxInputBytes: cliDecimalField(goResourceBudgetFields.max_input_bytes), - maxReportBytes: cliDecimalField(goResourceBudgetFields.max_report_bytes), - maxBuildInfoBytes: cliDecimalField( - goResourceBudgetFields.max_build_info_bytes, - ), - maxHeaderSearchBytes: cliDecimalField( - goResourceBudgetFields.max_header_search_bytes, - ), - maxStringLiterals: cliDecimalField( - goResourceBudgetFields.max_string_literals, - ), - maxStringLiteralBytes: cliDecimalField( - goResourceBudgetFields.max_string_literal_bytes, - ), - maxStringBytes: cliDecimalField(goResourceBudgetFields.max_string_bytes), - maxStringHeaderScanBytes: cliDecimalField( - goResourceBudgetFields.max_string_header_scan_bytes, - ), - maxStringCandidates: cliDecimalField( - goResourceBudgetFields.max_string_candidates, - ), - }), - run: ({ args, options }) => - withCommandCancellation(async (signal) => { - const service = createGoBinaryService(); - return await logCliCommand( - logger, - CLI_COMMANDS.inspectGoBinary, - async () => - deliverCliAnalysisEvidence({ - callerInputPath: args.path, - run: () => - service.inspect( - { - path: absoluteCallerPath(args.path), - ...(options.architecture === undefined - ? {} - : { architecture: options.architecture }), - ...(options.includeStringLiterals === undefined - ? {} - : { - include_string_literals: - options.includeStringLiterals, - }), - ...(options.maxInputBytes === undefined - ? {} - : { max_input_bytes: options.maxInputBytes }), - ...(options.maxReportBytes === undefined - ? {} - : { max_report_bytes: options.maxReportBytes }), - ...(options.maxBuildInfoBytes === undefined - ? {} - : { max_build_info_bytes: options.maxBuildInfoBytes }), - ...(options.maxHeaderSearchBytes === undefined - ? {} - : { - max_header_search_bytes: options.maxHeaderSearchBytes, - }), - ...(options.maxStringLiterals === undefined - ? {} - : { max_string_literals: options.maxStringLiterals }), - ...(options.maxStringLiteralBytes === undefined - ? {} - : { - max_string_literal_bytes: - options.maxStringLiteralBytes, - }), - ...(options.maxStringBytes === undefined - ? {} - : { max_string_bytes: options.maxStringBytes }), - ...(options.maxStringHeaderScanBytes === undefined - ? {} - : { - max_string_header_scan_bytes: - options.maxStringHeaderScanBytes, - }), - ...(options.maxStringCandidates === undefined - ? {} - : { max_string_candidates: options.maxStringCandidates }), - }, - { signal }, - ), - service, - providerId: "go-build-info", - operation: "inspect_go_binary", - signal, - detail: options.detail, - evidenceOutput: options.evidence_output, - }), - ); - }), - }); + const contract = contractNamed(GO_TOOL_CONTRACTS, "inspect_go_binary"); + registerContractCommand( + cli, + logger, + contract, + { + command: CLI_COMMANDS.inspectGoBinary, + description: + "Inspect embedded Go compiler, modules, build settings and optional static (ptr, len) string literals without target execution", + positionals: ["path"], + callerPaths: ["path"], + evidenceDelivery: true, + fields: { + path: { + description: "Local ELF, PE, thin Mach-O or universal Mach-O image", + }, + architecture: { + description: + "Slice to read from a universal Mach-O, by CPU family; when several slices share a family, arm64 (arm64 or arm64v8), arm64e (arm64e or arm64e.x1) or x86_64 names the subtype, and a value matching several slices is refused; required for universal files", + }, + include_string_literals: { + description: + "Also recover bounded inferred Go UTF-8 string literals from static (ptr, len) headers", + }, + }, + }, + deliverWithService(createGoBinaryService, "go-build-info"), + ); }; diff --git a/src/cli/v8CodeCacheCommands.ts b/src/cli/v8CodeCacheCommands.ts index 5c76991309..f9528e595c 100644 --- a/src/cli/v8CodeCacheCommands.ts +++ b/src/cli/v8CodeCacheCommands.ts @@ -1,66 +1,36 @@ -import { z } from "incur"; import type { Logger } from "pino"; -import { localPathStringSchema } from "../domain/localPath.js"; -import { absoluteCallerPath } from "../filesystem/callerPath.js"; -import { createV8CodeCacheService } from "../composition/v8CodeCache.js"; + import { CLI_COMMANDS } from "../cliCommandNames.js"; -import { logCliCommand } from "../cliLogging.js"; +import { createV8CodeCacheService } from "../composition/v8CodeCache.js"; +import { V8_CODE_CACHE_TOOL_CONTRACTS } from "../contracts/v8/v8CodeCacheToolContracts.js"; +import { contractNamed } from "./contractCliDescription.js"; +import { + inspectWithService, + registerContractCommand, +} from "./contractCommand.js"; import type { CliInstance } from "./types.js"; -import { withCommandCancellation } from "./commandCancellation.js"; -import { cliDecimalField } from "./options.js"; -import { inspectV8CodeCacheInputSchema } from "../domain/v8/v8CodeCache.js"; -import { projectCliAnalysisResult } from "./projectCliAnalysisResult.js"; -import { finishCliEvidenceCommand } from "./cliEvidenceCallerPath.js"; /** Inspect operator-selected V8 code caches through the same shared workflow as MCP. */ export const registerV8CodeCacheCommands = ( cli: CliInstance, logger: Logger, ): void => { - cli.command(CLI_COMMANDS.inspectV8CodeCache, { - description: - "Inspect a V8 code cache header and its embedded printable byte patterns without executing it", - args: z.object({ - path: localPathStringSchema.describe("Local V8 code cache (.jsc) file"), - }), - options: z.object({ - // Decimal tokens only: numeric coercion would read "0x10" as 16 and "1e3" as - // 1000. The shared fields keep their bounds, defaults and help. - maxFileBytes: cliDecimalField( - inspectV8CodeCacheInputSchema.shape.max_file_bytes, - ), - maxStrings: cliDecimalField( - inspectV8CodeCacheInputSchema.shape.max_strings, - ), - minStringBytes: cliDecimalField( - inspectV8CodeCacheInputSchema.shape.min_string_bytes, - ), - }), - run: ({ args, options }) => - withCommandCancellation(async (signal) => { - const v8CodeCache = createV8CodeCacheService(); - return await logCliCommand( - logger, - CLI_COMMANDS.inspectV8CodeCache, - async () => - finishCliEvidenceCommand( - args.path, - () => - v8CodeCache.inspect( - { - path: absoluteCallerPath(args.path), - max_file_bytes: options.maxFileBytes, - max_strings: options.maxStrings, - min_string_bytes: options.minStringBytes, - }, - { signal }, - ), - v8CodeCache, - "rea-v8-code-cache", - "inspect_v8_code_cache", - signal, - ).then(projectCliAnalysisResult), - ); - }), - }); + const contract = contractNamed( + V8_CODE_CACHE_TOOL_CONTRACTS, + "inspect_v8_code_cache", + ); + registerContractCommand( + cli, + logger, + contract, + { + command: CLI_COMMANDS.inspectV8CodeCache, + description: + "Inspect a V8 code cache header and its embedded printable byte patterns without executing it", + positionals: ["path"], + callerPaths: ["path"], + fields: { path: { description: "Local V8 code cache (.jsc) file" } }, + }, + inspectWithService(createV8CodeCacheService, "rea-v8-code-cache"), + ); }; diff --git a/tests/boundary/cli/cliContractCommandParity.test.ts b/tests/boundary/cli/cliContractCommandParity.test.ts index 430b4f2777..4268456e5b 100644 --- a/tests/boundary/cli/cliContractCommandParity.test.ts +++ b/tests/boundary/cli/cliContractCommandParity.test.ts @@ -128,6 +128,9 @@ describe("CLI commands projected from tool contracts", () => { "inspect-sqlite-database", "inspect-elf-notes", "inspect-pe-resources", + "inspect-devicetree", + "inspect-go-binary", + "inspect-v8-code-cache", ]), ); }); @@ -156,10 +159,12 @@ describe("CLI commands projected from tool contracts", () => { .map(({ key }) => key), ); expect(optionKeys.toSorted()).toEqual( - description.parameters - .filter(({ positional }) => !positional) - .map(({ key }) => key) - .toSorted(), + [ + ...description.parameters + .filter(({ positional }) => !positional) + .map(({ key }) => key), + ...description.cliOnlyOptions.map(({ key }) => key), + ].toSorted(), ); }, );