Files
reverse-engineering-anything/src/cli/v8CodeCacheCommands.ts
T
morluto da53dce1f7 refactor(cli): project Go, V8 and delivery inspectors from their contracts (#10576)
Migrate inspect-go-binary, inspect-v8-code-cache, inspect-devicetree and
inspect-native-exports onto the contract command description and delete
their hand-written options and input spreads.

The description gains evidenceDelivery. It adds the shared --detail and
--evidence_output options, and the run context carries the selected
delivery. A contract detail field selects that delivery and is not passed
to the analysis, as the hand-written commands did. Go's cross-field
budget rules stay with the service's contract parse, so standalone
--max-string-literals still returns invalid_request.

The parity guard accepts the declared CLI-only delivery options as the
only options without a contract field.
2026-11-15 09:14:56 +08:00

37 lines
1.2 KiB
TypeScript

import type { Logger } from "pino";
import { CLI_COMMANDS } from "../cliCommandNames.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";
/** Inspect operator-selected V8 code caches through the same shared workflow as MCP. */
export const registerV8CodeCacheCommands = (
cli: CliInstance,
logger: Logger,
): void => {
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"),
);
};