mirror of
https://github.com/morluto/rea.git
synced 2026-11-21 06:04:03 +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>
67 lines
1.6 KiB
TypeScript
67 lines
1.6 KiB
TypeScript
import { createCommandCli } from "../../support/cli/commandCli.js";
|
|
import pino from "pino";
|
|
import { expect, it, vi } from "vitest";
|
|
import { registerCoreNativeCommands } from "../../../src/cli/coreNativeCommands.js";
|
|
|
|
const registry = () => {
|
|
const run = vi.fn(async () => ({
|
|
ok: false as const,
|
|
error: { code: "invalid_request", message: "Admitted query control" },
|
|
}));
|
|
const cli = createCommandCli();
|
|
registerCoreNativeCommands(cli, pino({ enabled: false }), run);
|
|
return { cli, run };
|
|
};
|
|
|
|
it("forwards admitted original strings and caller-selected search/provider controls", async () => {
|
|
const { cli, run } = registry();
|
|
await cli.serve(
|
|
[
|
|
"search-bytes",
|
|
"/selected",
|
|
"ab ?? CD",
|
|
"--mask",
|
|
"FF 00 ff",
|
|
"--start",
|
|
"0x10",
|
|
"--end",
|
|
"0x20",
|
|
"--cursor",
|
|
"next",
|
|
"--limit",
|
|
"7",
|
|
"--provider",
|
|
"ghidra",
|
|
"--json",
|
|
],
|
|
{ stdout: () => undefined, exit: () => undefined },
|
|
);
|
|
expect(run).toHaveBeenCalledExactlyOnceWith(
|
|
"/selected",
|
|
"search_bytes",
|
|
{
|
|
pattern: "ab ?? CD",
|
|
mask: "FF 00 ff",
|
|
start: "0x10",
|
|
end: "0x20",
|
|
cursor: "next",
|
|
limit: 7,
|
|
},
|
|
expect.objectContaining({ providerId: "ghidra" }),
|
|
);
|
|
});
|
|
|
|
it("keeps omitted mask and limit selections omitted", async () => {
|
|
const { cli, run } = registry();
|
|
await cli.serve(["search-bytes", "/selected", "AB", "--json"], {
|
|
stdout: () => undefined,
|
|
exit: () => undefined,
|
|
});
|
|
expect(run).toHaveBeenCalledExactlyOnceWith(
|
|
"/selected",
|
|
"search_bytes",
|
|
{ pattern: "AB" },
|
|
expect.any(Object),
|
|
);
|
|
});
|