Files
reverse-engineering-anything/src/cli/rustCommands.ts
T
morluto effb71f59c fix(providers): preserve bounded artifact reads and cleanup owners
Refs #4373, #4455, #4457, #4458.

Use canonical artifact ownership in Go, Rust, SQLite and PE readers and their failure consumers. Admit PE read budgets before allocation and ignore zero-extent sections in interval ownership. Close Rust resources through CLI and MCP lifecycles.
2026-10-17 00:44:02 +08:00

42 lines
1.4 KiB
TypeScript

import { z } from "incur";
import { createRustBinaryService } from "../composition/rust.js";
import { CLI_COMMANDS } from "../cliCommandNames.js";
import { logCliCommand } from "../cliLogging.js";
import { finishAnalysisCommand } from "./finishAnalysisCommand.js";
import type { Logger } from "pino";
import type { CliInstance } from "./types.js";
import { withCommandCancellation } from "./commandCancellation.js";
import { absoluteCallerPath } from "../filesystem/callerPath.js";
/** Resolve caller paths and inspect embedded Rust dependencies through the shared workflow. */
export const registerRustCommands = (
cli: CliInstance,
logger: Logger,
): void => {
cli.command(CLI_COMMANDS.inspectRustBinary, {
description:
"Inspect an embedded cargo-auditable Rust dependency list without target execution",
args: z.object({
path: z.string().describe("Local ELF, PE or thin Mach-O image"),
}),
run: ({ args }) =>
withCommandCancellation((signal) => {
const service = createRustBinaryService();
return logCliCommand(logger, CLI_COMMANDS.inspectRustBinary, () =>
finishAnalysisCommand(
() =>
service.inspect(
{ path: absoluteCallerPath(args.path) },
{ signal },
),
service,
"rust-auditable",
"inspect_rust_binary",
undefined,
signal,
),
);
}),
});
};