refactor(cli): project WASM inspection and firmware commands from their contracts (#10648)

* refactor(cli): project WASM inspection and firmware commands from their contracts

The contract command description gains lists of caller paths and optional object fields flattened into one option per member. inspect-wasm-artifact, inspect-firmware-regions and extract-firmware are derived from their contracts. extract-firmware now records the caller's output_directory spelling in Evidence, like every other caller-path field.

* refactor(cli): project Apple bundle commands onto a declared session target (#10656)

Session-scoped operations take their target from the MCP session, so the CLI's target positional is not a contract field. The contract command description declares a session target: the CLI takes it as the first positional, opens it through runProviderAnalysis as the hand-written commands did, and passes the rest of the contract input. Input issues reported after argv parsing name renamed fields by their CLI key. inspect-keyed-archive, trace-dylib-resolution, inspect-asset-catalog and decode-interface-builder are the pilot; trace-dylib-resolution --root now admits only the roots its contract admits.
This commit is contained in:
morluto authored and GitHub committed 2026-11-15 17:45:33 +08:00
1 parent 26520bd290
commit a761efda70
9 files changed
+592 -404

No files matched your search

+11 -6
View File
@@ -26,6 +26,7 @@ import { BYTE_ENTROPY_PROVIDER } from "../domain/investigationProviders.js";
import { BINARY_DIAGNOSTICS_TOOL_CONTRACTS } from "../contracts/native/binaryDiagnosticsToolContracts.js";
import { contractNamed } from "./contractCliDescription.js";
import {
callerTargetPath,
deliverWithService,
inspectWithService,
registerContractCommand,
@@ -331,10 +332,12 @@ export const registerBinaryDiagnosticsCommands = (
"One-shot output is complete Evidence; this command has no summary delivery",
},
},
async (input, { signal, callerInputs }) => {
const result = await layout.inspectAndClose(input, { signal });
async (input, context) => {
const result = await layout.inspectAndClose(input, {
signal: context.signal,
});
return result.ok
? withEvidenceCallerInputPath(result.value, callerInputs.path)
? withEvidenceCallerInputPath(result.value, callerTargetPath(context))
: projectAnalysisError(result.error);
},
);
@@ -361,10 +364,12 @@ export const registerBinaryDiagnosticsCommands = (
},
},
},
async (input, { signal, callerInputs }) => {
const result = await recorded.inspectAndClose(input, { signal });
async (input, context) => {
const result = await recorded.inspectAndClose(input, {
signal: context.signal,
});
return result.ok
? withEvidenceCallerInputPath(result.value, callerInputs.path)
? withEvidenceCallerInputPath(result.value, callerTargetPath(context))
: projectAnalysisError(result.error);
},
);