mirror of
https://github.com/morluto/rea.git
synced 2026-11-18 04:34:13 +00:00
Add offline ELF dependency, search-path, symbol-version and import inspection with retained Evidence summaries and pages. Bound GNU-hash work and preserve cancellation, stable identity and caller-selected parameters across CLI/MCP. Assisted-by: Suika (gensokyo-skills:suika-scatter-gather-planning) Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
40 lines
1.8 KiB
TypeScript
40 lines
1.8 KiB
TypeScript
import { expect, it } from "vitest";
|
|
import { registerCaptureCommands } from "../../../src/cli/captureCommands.js";
|
|
import { contractCommandDescriptions } from "../../../src/cli/contractCommand.js";
|
|
import { registerSignalCommands } from "../../../src/cli/signalCommands.js";
|
|
import { registerSqliteCommands } from "../../../src/cli/sqliteCommands.js";
|
|
import { silentLogger } from "../../../src/logger.js";
|
|
import { createCommandCli } from "../../support/cli/commandCli.js";
|
|
|
|
const cli = createCommandCli();
|
|
registerCaptureCommands(cli, silentLogger, {});
|
|
registerSignalCommands(cli, silentLogger, {});
|
|
registerSqliteCommands(cli, silentLogger, {});
|
|
|
|
it.each([
|
|
{ command: "inspect-packet-capture", options: { fields: ["ip.addr"] } },
|
|
{ command: "decode-signal-recording", options: { decoders: "uart" } },
|
|
{ command: "inspect-sqlite-database", options: {} },
|
|
])(
|
|
"$command resolves defaults only for cross-field checks and preserves caller omission",
|
|
({ command, options }) => {
|
|
const description = contractCommandDescriptions(cli).find(
|
|
(candidate) => candidate.command === command,
|
|
);
|
|
if (description === undefined)
|
|
throw new Error(`Missing command ${command}`);
|
|
// These JSON strings are decoded when the command runs, after argv checks.
|
|
// Checking defaults must not reparse already-admitted option values.
|
|
const limits = description.parameters.find(
|
|
(parameter) => parameter.field === "producer_limits",
|
|
);
|
|
const text = '{"input_bytes":1024}';
|
|
const values =
|
|
limits === undefined ? options : { ...options, [limits.key]: text };
|
|
expect(description.checkOptions?.(values)).toEqual([]);
|
|
expect(description.toContractInput(values)).toEqual(
|
|
limits === undefined ? options : { ...options, producer_limits: text },
|
|
);
|
|
},
|
|
);
|