Files
reverse-engineering-anything/src/cli/rustCommands.ts
T
morluto 3097263763 fix(cli): describe universal Mach-O slice selection without a single-dash flag (#14912)
* fix(cli): describe universal Mach-O slice selection without a single-dash flag

Four --architecture options carried their own copy of the slice help,
in two variants, and each said "as lipo -thin does". CLI help must not
show a multi-letter single-dash spelling, because -abc parses as stacked
one-letter flags, so tests/boundary/cli/cliOptionAliases.test.ts fails
on main for inspect-dwarf-units, inspect-go-binary,
inspect-native-initializers and inspect-rust-binary.

The commands share one description, UNIVERSAL_SLICE_ARCHITECTURE_HELP,
which names lipo without the flag spelling. inspect-dwarf-units now
states the same-family subtype rule the other three already stated; its
selection uses the same selectMachoTarget rule.

* docs(cli): name the slice selection owner in the shared help comment
2026-11-27 11:39:34 -05:00

55 lines
1.9 KiB
TypeScript

import type { Logger } from "pino";
import { createRustBinaryService } from "../composition/rust.js";
import { RUST_TOOL_CONTRACTS } from "../contracts/rust/rustToolContracts.js";
import { contractNamed } from "./contractCliDescription.js";
import { registerContractCommand } from "./contractCommand.js";
import { deliverWithService } from "./contractCommandRunners.js";
import { PRODUCER_LIMITS_HELP } from "./producerLimitsOption.js";
import type { CliInstance } from "./types.js";
import { UNIVERSAL_SLICE_ARCHITECTURE_HELP } from "./universalSliceOption.js";
/** Resolve caller paths and inspect embedded Rust dependencies through the shared workflow. */
export const registerRustCommands = (
cli: CliInstance,
logger: Logger,
): void => {
registerContractCommand(
cli,
logger,
contractNamed(RUST_TOOL_CONTRACTS, "inspect_rust_binary"),
{
description:
"Inspect an embedded cargo-auditable Rust dependency list without target execution",
positionals: ["path"],
callerPaths: ["path"],
jsonText: ["producer_limits"],
evidenceDelivery: true,
viewDelivery: {
invalidJson: "view must be a JSON package or edge selection",
kind: "rust",
viewSelectsSummary: true,
},
fields: {
path: {
description:
"Local ELF, PE, thin or universal Mach-O, or WebAssembly core-module image",
},
producer_limits: { description: PRODUCER_LIMITS_HELP },
architecture: {
description: UNIVERSAL_SLICE_ARCHITECTURE_HELP,
},
detail: {
description:
"Default complete; a view selects compact delivery with --evidence_output",
},
view: {
description:
"JSON package or edge selection; retains complete Evidence with --evidence_output",
},
},
},
deliverWithService(createRustBinaryService, "rust-auditable"),
);
};