Files
rea/src/cli/gpuCommands.ts
T
morluto 11c1e45cce fix(cli): record the caller's --join-path spelling in Apple IPS Evidence (#10606)
* fix(cli): record the caller's --join-path spelling in Apple IPS Evidence

* refactor(cli): project CLI-only options for release exposure and IL2CPP from contracts (#10635)

* refactor(cli): project CLI-only options for release exposure and IL2CPP from contracts

The contract command description gains CLI-only options whose effect the handler owns, plus their dependentRequired entries. audit-release-exposure keeps --fail_on (exit status 3) and inspect-il2cpp-metadata keeps --ghidra-seeds/--seed-base; their hand-written options and input spreads are deleted.

* refactor(cli): project GPU, signal and capture inspectors from their contracts (#10643)

The contract command description gains JSON options decoded when the command runs, admitted with the delivery by the contract input, and bare flags that spell a nullable limit's null. inspect-gpu-code-objects, inspect-signal-decoders, decode-signal-recording, inspect-packet-fields and inspect-packet-capture are derived from their contracts; their hand-written options, superRefine blocks and CLI-only option schemas are deleted.
2026-11-15 17:04:45 +08:00

69 lines
2.3 KiB
TypeScript

import type { Logger } from "pino";
import { CLI_COMMANDS } from "../cliCommandNames.js";
import { createGpuCodeObjectsService } from "../composition/gpu.js";
import { GPU_TOOL_CONTRACTS } from "../contracts/gpu/gpuToolContracts.js";
import { contractNamed } from "./contractCliDescription.js";
import {
deliverWithService,
registerContractCommand,
} from "./contractCommand.js";
import type { CliInstance } from "./types.js";
/** One-shot summaries export the same complete observations used by MCP retained pages. */
export const registerGpuCommands = (cli: CliInstance, logger: Logger): void => {
const deliver = deliverWithService(
createGpuCodeObjectsService,
"gpu-code-objects",
);
registerContractCommand(
cli,
logger,
contractNamed(GPU_TOOL_CONTRACTS, "inspect_gpu_code_objects"),
{
command: CLI_COMMANDS.inspectGpuCodeObjects,
description:
"Inspect embedded CUDA/HIP targets and selected static kernel metadata",
positionals: ["path"],
callerPaths: ["path"],
evidenceDelivery: true,
viewDelivery: {
invalidJson: "view must be valid JSON",
kind: "gpu-code-objects",
},
runtimeJson: {
object_ids: "object_ids must be valid JSON",
targets: "targets must be valid JSON",
},
fields: {
path: {
description: "Local ELF/PE, CUDA fatbin, CUBIN, PTX or HIP bundle",
},
analysis: {
description:
"Inventory GPU targets or decode selected kernel metadata",
},
expected_sha256: {
name: "expected_sha256",
description:
"Inventory SHA-256 as 64 lowercase hex digits; required with --object_ids",
},
object_ids: {
name: "object_ids",
description: "JSON array of exact object IDs to decode",
},
targets: {
description: "JSON array of exact target declarations to decode",
},
view: {
description:
"JSON GPU object/kernel/PTX page selection; requires --detail summary and --evidence_output",
},
},
},
// The CLI delivers the summary itself, so the service returns complete
// Evidence; the contract's own default would retain a summary instead.
(input, context) => deliver({ ...input, detail: "complete" }, context),
);
};