Files
reverse-engineering-anything/src/cli/pythonPycCommands.ts
T

37 lines
1.3 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import type { Logger } from "pino";
import { createPythonPycService } from "../composition/pythonPyc.js";
import { PYTHON_PYC_TOOL_CONTRACTS } from "../contracts/python/pythonPycToolContracts.js";
import { contractNamed } from "./contractCliDescription.js";
import { registerContractCommand } from "./contractCommand.js";
import { deliverWithService } from "./contractCommandRunners.js";
import type { CliInstance } from "./types.js";
/** Inspect operator-selected pyc files through the same shared workflow as MCP. */
export const registerPythonPycCommands = (
cli: CliInstance,
logger: Logger,
): void => {
registerContractCommand(
cli,
logger,
contractNamed(PYTHON_PYC_TOOL_CONTRACTS, "inspect_python_pyc"),
{
description:
"Inspect a supported CPython 3.7–3.15 pyc header and marshal code objects without executing bytecode",
positionals: ["path"],
callerPaths: ["path"],
evidenceDelivery: true,
viewDelivery: { invalidJson: "view must be valid JSON" },
fields: {
path: { description: "Local CPython .pyc file" },
view: {
description:
"JSON python-pyc view; requires --detail summary and --evidence_output",
},
},
},
deliverWithService(createPythonPycService, "rea-python-pyc"),
);
};