mirror of
https://github.com/morluto/rea.git
synced 2026-11-16 11:43:20 +00:00
refactor(cli): own shell completion behind new CLI parity goldens (#11662)
* test(cli): capture CLI parity goldens before replacing incur * test(cli): cover completion groups, aliases and hand-built enums in the parity goldens * refactor(cli): own the shell completion protocol instead of incur's Completions (#11665) * test(cli): keep root help goldens stable for longer names and let recording add cases
This commit is contained in:
1 parent
d4c2be509e
commit
f39e5e80db
86 files changed
+2027
-51
No files matched your search
@@ -1,38 +0,0 @@
|
||||
/** Register Incur's dynamic Bash protocol, including macOS system Bash 3.2. */
|
||||
export const bashCompletionScript = (name: string): string => {
|
||||
const id = name.replace(/[^a-zA-Z0-9_]/gu, "_");
|
||||
const command = `'${name.replaceAll("'", "'\\''")}'`;
|
||||
return `_incur_complete_${id}() {
|
||||
local IFS=$'\\013'
|
||||
local _COMPLETE_INDEX=\${COMP_CWORD}
|
||||
local _completions _output
|
||||
if ! _output=$(
|
||||
export COMPLETE="bash"
|
||||
export _COMPLETE_INDEX="$_COMPLETE_INDEX"
|
||||
${command} -- "\${COMP_WORDS[@]}"
|
||||
); then
|
||||
unset COMPREPLY
|
||||
return
|
||||
fi
|
||||
# Split the protocol records without expanding pathname patterns.
|
||||
read -r -d '' -a _completions < <(printf '%s\\0' "$_output")
|
||||
local _nospace=false
|
||||
local _nospace_marker=$'\\001'
|
||||
local _c
|
||||
COMPREPLY=()
|
||||
for _c in "\${_completions[@]}"; do
|
||||
if [[ "$_c" == *"$_nospace_marker" ]]; then
|
||||
_nospace=true
|
||||
COMPREPLY+=("\${_c%"$_nospace_marker"}")
|
||||
else
|
||||
COMPREPLY+=("$_c")
|
||||
fi
|
||||
done
|
||||
if [[ $_nospace == true ]] && type compopt >/dev/null 2>&1; then
|
||||
compopt -o nospace
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
complete -o default -o bashdefault -o nosort -F _incur_complete_${id} ${command} 2>/dev/null ||
|
||||
complete -o default -o bashdefault -F _incur_complete_${id} ${command}`;
|
||||
};
|
||||
@@ -0,0 +1,311 @@
|
||||
import { z } from "zod";
|
||||
|
||||
/**
|
||||
* REA's shell completion protocol: the hook script each shell sources, the
|
||||
* candidates for the words before the cursor, and their per-shell encoding.
|
||||
* A hook calls back into the binary as `COMPLETE=<shell> rea -- <words>`.
|
||||
* Function names keep the `_incur_complete_` prefix so hooks that users
|
||||
* already installed keep working.
|
||||
*/
|
||||
|
||||
/** Shells with a completion hook. */
|
||||
export type CompletionShell = "bash" | "zsh" | "fish" | "nushell";
|
||||
|
||||
/** One node of the command tree that completion walks. */
|
||||
export interface CompletionCommand {
|
||||
readonly description?: string | undefined;
|
||||
readonly options?: z.ZodObject | undefined;
|
||||
/** Short alias by option key, such as `{ yes: "y" }`. */
|
||||
readonly alias?: Readonly<Record<string, string>> | undefined;
|
||||
/** A group selects a nested command map instead of running. */
|
||||
readonly _group?: true | undefined;
|
||||
readonly commands?: ReadonlyMap<string, CompletionCommand> | undefined;
|
||||
/** A group's own options, used while the group is the active scope. */
|
||||
readonly root?: CompletionCommand | undefined;
|
||||
/** An alias entry names its canonical sibling in `target`. */
|
||||
readonly _alias?: true | undefined;
|
||||
readonly target?: string | undefined;
|
||||
}
|
||||
|
||||
/** Options that apply to every command in the active scope. */
|
||||
export interface CompletionGlobals {
|
||||
readonly schema: z.ZodObject;
|
||||
readonly alias?: Readonly<Record<string, string>> | undefined;
|
||||
}
|
||||
|
||||
export interface CompletionCandidate {
|
||||
readonly value: string;
|
||||
readonly description?: string | undefined;
|
||||
/** A group keeps the cursor on the word so a subcommand can follow. */
|
||||
readonly noSpace?: true | undefined;
|
||||
}
|
||||
|
||||
const identifier = (name: string): string =>
|
||||
name.replace(/[^a-zA-Z0-9_]/gu, "_");
|
||||
|
||||
/** Register the dynamic Bash protocol, including macOS system Bash 3.2. */
|
||||
export const bashCompletionScript = (name: string): string => {
|
||||
const id = identifier(name);
|
||||
const command = `'${name.replaceAll("'", "'\\''")}'`;
|
||||
return `_incur_complete_${id}() {
|
||||
local IFS=$'\\013'
|
||||
local _COMPLETE_INDEX=\${COMP_CWORD}
|
||||
local _completions _output
|
||||
if ! _output=$(
|
||||
export COMPLETE="bash"
|
||||
export _COMPLETE_INDEX="$_COMPLETE_INDEX"
|
||||
${command} -- "\${COMP_WORDS[@]}"
|
||||
); then
|
||||
unset COMPREPLY
|
||||
return
|
||||
fi
|
||||
# Split the protocol records without expanding pathname patterns.
|
||||
read -r -d '' -a _completions < <(printf '%s\\0' "$_output")
|
||||
local _nospace=false
|
||||
local _nospace_marker=$'\\001'
|
||||
local _c
|
||||
COMPREPLY=()
|
||||
for _c in "\${_completions[@]}"; do
|
||||
if [[ "$_c" == *"$_nospace_marker" ]]; then
|
||||
_nospace=true
|
||||
COMPREPLY+=("\${_c%"$_nospace_marker"}")
|
||||
else
|
||||
COMPREPLY+=("$_c")
|
||||
fi
|
||||
done
|
||||
if [[ $_nospace == true ]] && type compopt >/dev/null 2>&1; then
|
||||
compopt -o nospace
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
complete -o default -o bashdefault -o nosort -F _incur_complete_${id} ${command} 2>/dev/null ||
|
||||
complete -o default -o bashdefault -F _incur_complete_${id} ${command}`;
|
||||
};
|
||||
|
||||
const zshCompletionScript = (name: string): string => {
|
||||
const id = identifier(name);
|
||||
return `#compdef ${name}
|
||||
_incur_complete_${id}() {
|
||||
local completions=("\${(@f)$(
|
||||
export _COMPLETE_INDEX=$(( CURRENT - 1 ))
|
||||
export COMPLETE="zsh"
|
||||
"${name}" -- "\${words[@]}" 2>/dev/null
|
||||
)}")
|
||||
if [[ -n $completions ]]; then
|
||||
_describe 'values' completions -S ''
|
||||
fi
|
||||
}
|
||||
compdef _incur_complete_${id} ${name}`;
|
||||
};
|
||||
|
||||
const fishCompletionScript = (name: string): string =>
|
||||
`complete --keep-order --exclusive --command ${name} \\
|
||||
--arguments "(COMPLETE=fish ${name} -- (commandline --current-process --tokenize --cut-at-cursor) (commandline --current-token))"`;
|
||||
|
||||
const nushellCompletionScript = (name: string): string => {
|
||||
const id = identifier(name);
|
||||
return `# External completer for ${name}
|
||||
# Add to $env.config.completions.external.completer or use in a dispatch completer.
|
||||
let _incur_complete_${id} = {|spans|
|
||||
COMPLETE=nushell ${name} -- ...$spans | from json
|
||||
}`;
|
||||
};
|
||||
|
||||
/** The hook script a shell evaluates to register completion for `name`. */
|
||||
export const completionScript = (
|
||||
shell: CompletionShell,
|
||||
name: string,
|
||||
): string => {
|
||||
switch (shell) {
|
||||
case "bash":
|
||||
return bashCompletionScript(name);
|
||||
case "zsh":
|
||||
return zshCompletionScript(name);
|
||||
case "fish":
|
||||
return fishCompletionScript(name);
|
||||
case "nushell":
|
||||
return nushellCompletionScript(name);
|
||||
}
|
||||
};
|
||||
|
||||
const kebab = (key: string): string =>
|
||||
key.replace(/[A-Z]/gu, (character) => `-${character.toLowerCase()}`);
|
||||
|
||||
/** Strip wrappers (optional, default, nullable, ...) to the declared value type. */
|
||||
const declaredType = (field: z.ZodType): z.ZodType => {
|
||||
let current = field;
|
||||
for (
|
||||
let inner = innerType(current);
|
||||
inner !== undefined;
|
||||
inner = innerType(current)
|
||||
)
|
||||
current = inner;
|
||||
return current;
|
||||
};
|
||||
|
||||
const innerType = (field: z.ZodType): z.ZodType | undefined => {
|
||||
const inner: unknown = Reflect.get(field._zod.def, "innerType");
|
||||
return inner instanceof z.ZodType ? inner : undefined;
|
||||
};
|
||||
|
||||
const isFlagOption = (field: z.ZodType): boolean =>
|
||||
field.meta()?.count === true || declaredType(field) instanceof z.ZodBoolean;
|
||||
|
||||
const enumValues = (field: z.ZodType): readonly string[] | undefined => {
|
||||
const type = declaredType(field);
|
||||
return type instanceof z.ZodEnum
|
||||
? type.options.map((value) => String(value))
|
||||
: undefined;
|
||||
};
|
||||
|
||||
/** Resolve `--foo-bar`, `--fooBar` or a short alias to its option key. */
|
||||
const optionKey = (
|
||||
token: string,
|
||||
options: z.ZodObject,
|
||||
alias: Readonly<Record<string, string>> | undefined,
|
||||
): string | undefined => {
|
||||
const keys = Object.keys(options.shape);
|
||||
if (token.startsWith("--")) {
|
||||
const raw = token.slice(2);
|
||||
return (
|
||||
keys.find((key) => kebab(key) === raw) ??
|
||||
(keys.includes(raw) ? raw : undefined)
|
||||
);
|
||||
}
|
||||
if (token.length === 2 && alias !== undefined)
|
||||
return Object.entries(alias).find(([, short]) => short === token[1])?.[0];
|
||||
return undefined;
|
||||
};
|
||||
|
||||
const flagCandidates = (
|
||||
current: string,
|
||||
options: z.ZodObject,
|
||||
alias: Readonly<Record<string, string>> | undefined,
|
||||
candidates: CompletionCandidate[],
|
||||
): void => {
|
||||
const shape = options.shape as Record<string, z.ZodType>;
|
||||
const add = (value: string, key: string) => {
|
||||
if (
|
||||
value.startsWith(current) &&
|
||||
!candidates.some((candidate) => candidate.value === value)
|
||||
)
|
||||
candidates.push({ value, description: shape[key]?.description });
|
||||
};
|
||||
for (const key of Object.keys(shape)) add(`--${kebab(key)}`, key);
|
||||
for (const [key, short] of Object.entries(alias ?? {})) add(`-${short}`, key);
|
||||
};
|
||||
|
||||
/**
|
||||
* Value candidates for the option before the cursor. `undefined` means the
|
||||
* previous word is not a value-taking option of this scope; an empty list
|
||||
* means it takes a free-form value.
|
||||
*/
|
||||
const valueCandidates = (
|
||||
previous: string,
|
||||
current: string,
|
||||
options: z.ZodObject,
|
||||
alias: Readonly<Record<string, string>> | undefined,
|
||||
): CompletionCandidate[] | undefined => {
|
||||
const key = optionKey(previous, options, alias);
|
||||
if (key === undefined) return undefined;
|
||||
const field = (options.shape as Record<string, z.ZodType>)[key]!;
|
||||
const values = enumValues(field);
|
||||
if (values !== undefined)
|
||||
return values
|
||||
.filter((value) => value.startsWith(current))
|
||||
.map((value) => ({ value }));
|
||||
return isFlagOption(field) ? undefined : [];
|
||||
};
|
||||
|
||||
/**
|
||||
* Candidates for `words[index]`. Earlier words select the command scope;
|
||||
* a dash-prefixed cursor word lists options, a word after a value-taking
|
||||
* option lists its enum values, and otherwise subcommands are listed in
|
||||
* registration order.
|
||||
*/
|
||||
export const completeWords = (
|
||||
commands: ReadonlyMap<string, CompletionCommand>,
|
||||
words: readonly string[],
|
||||
index: number,
|
||||
globals: CompletionGlobals,
|
||||
): CompletionCandidate[] => {
|
||||
const current = words[index] ?? "";
|
||||
let scope: {
|
||||
commands: ReadonlyMap<string, CompletionCommand>;
|
||||
leaf: CompletionCommand | undefined;
|
||||
} = { commands, leaf: undefined };
|
||||
for (const token of words.slice(0, index)) {
|
||||
if (token.startsWith("-")) continue;
|
||||
let entry = scope.commands.get(token);
|
||||
if (entry?._alias === true && entry.target !== undefined)
|
||||
entry = scope.commands.get(entry.target);
|
||||
if (entry === undefined) continue;
|
||||
if (entry._group === true && entry.commands !== undefined)
|
||||
scope = { commands: entry.commands, leaf: entry.root };
|
||||
else {
|
||||
scope = { commands: new Map(), leaf: entry };
|
||||
break;
|
||||
}
|
||||
}
|
||||
const { leaf } = scope;
|
||||
const candidates: CompletionCandidate[] = [];
|
||||
if (current.startsWith("-")) {
|
||||
if (leaf?.options !== undefined)
|
||||
flagCandidates(current, leaf.options, leaf.alias, candidates);
|
||||
flagCandidates(current, globals.schema, globals.alias, candidates);
|
||||
return candidates;
|
||||
}
|
||||
const previous = index > 0 ? words[index - 1]! : "";
|
||||
if (previous.startsWith("-")) {
|
||||
const values =
|
||||
(leaf?.options === undefined
|
||||
? undefined
|
||||
: valueCandidates(previous, current, leaf.options, leaf.alias)) ??
|
||||
valueCandidates(previous, current, globals.schema, globals.alias);
|
||||
if (values !== undefined) return values;
|
||||
}
|
||||
for (const [name, entry] of scope.commands)
|
||||
if (entry._alias !== true && name.startsWith(current))
|
||||
candidates.push({
|
||||
value: name,
|
||||
description: entry.description,
|
||||
...(entry._group === true ? { noSpace: true as const } : {}),
|
||||
});
|
||||
return candidates;
|
||||
};
|
||||
|
||||
/**
|
||||
* Encode candidates for one shell: bash `\v`-separated values (a group ends
|
||||
* with `\x01`), zsh `value:description` lines (`:` escaped in values), fish
|
||||
* `value\tdescription` lines, nushell a JSON array of records.
|
||||
*/
|
||||
export const formatCompletions = (
|
||||
shell: CompletionShell,
|
||||
candidates: readonly CompletionCandidate[],
|
||||
): string => {
|
||||
switch (shell) {
|
||||
case "bash":
|
||||
return candidates
|
||||
.map(({ value, noSpace }) => (noSpace ? `${value}\x01` : value))
|
||||
.join("\v");
|
||||
case "zsh":
|
||||
return candidates
|
||||
.map(({ value, description }) => {
|
||||
const escaped = value.replaceAll(":", "\\:");
|
||||
return description ? `${escaped}:${description}` : escaped;
|
||||
})
|
||||
.join("\n");
|
||||
case "fish":
|
||||
return candidates
|
||||
.map(({ value, description }) =>
|
||||
description ? `${value}\t${description}` : value,
|
||||
)
|
||||
.join("\n");
|
||||
case "nushell":
|
||||
return JSON.stringify(
|
||||
candidates.map(({ value, description }) =>
|
||||
description ? { value, description } : { value },
|
||||
),
|
||||
);
|
||||
}
|
||||
};
|
||||
+17
-12
@@ -1,4 +1,4 @@
|
||||
import { Cli, Completions } from "incur";
|
||||
import { Cli } from "incur";
|
||||
import { z } from "zod";
|
||||
|
||||
import {
|
||||
@@ -11,11 +11,15 @@ import {
|
||||
splitIncurBuiltinArguments,
|
||||
} from "../cliBuiltinArguments.js";
|
||||
import { CLI_OUTPUT_FORMATS, parseCliOutputArguments } from "../cliOutput.js";
|
||||
import { bashCompletionScript } from "./bashCompletionRegistration.js";
|
||||
import {
|
||||
completeWords,
|
||||
completionScript,
|
||||
formatCompletions,
|
||||
type CompletionCommand,
|
||||
} from "./completionProtocol.js";
|
||||
import { MCP_SUBCOMMANDS } from "./mcpBuiltinCommands.js";
|
||||
import { MCP_DOCTOR_ALIAS, MCP_DOCTOR_OPTIONS } from "../mcpDoctorOptions.js";
|
||||
|
||||
type Commands = Parameters<typeof Completions.complete>[0];
|
||||
type CompletionCli = Parameters<typeof Cli.toCommands.get>[0];
|
||||
type ServeOptions = NonNullable<Parameters<CompletionCli["serve"]>[1]>;
|
||||
const ROOT_FLAGS = new Set(["--mcp", "--update", "--version"]);
|
||||
@@ -82,8 +86,12 @@ const standardGlobals = (root: boolean): z.ZodObject =>
|
||||
);
|
||||
|
||||
/** Pinned Incur builtins are not exported in its registered command map. */
|
||||
const completionCommands = (cli: CompletionCli): Commands => {
|
||||
const commands: Commands = new Map(Cli.toCommands.get(cli));
|
||||
const completionCommands = (
|
||||
cli: CompletionCli,
|
||||
): ReadonlyMap<string, CompletionCommand> => {
|
||||
const commands = new Map<string, CompletionCommand>(
|
||||
Cli.toCommands.get(cli) as ReadonlyMap<string, CompletionCommand>,
|
||||
);
|
||||
commands.set("mcp", {
|
||||
_group: true,
|
||||
description: "Register as MCP server",
|
||||
@@ -98,15 +106,13 @@ const completionCommands = (cli: CompletionCli): Commands => {
|
||||
return commands;
|
||||
};
|
||||
|
||||
/** One tree owns command scope; the framework retains option/enum binding and shell formatting. */
|
||||
/** One tree owns command scope; completionProtocol owns candidates and shell encoding. */
|
||||
export const createCliCompletions = (
|
||||
cli: CompletionCli,
|
||||
environment: Readonly<NodeJS.ProcessEnv>,
|
||||
) => {
|
||||
const script = (shell: (typeof CLI_COMPLETION_SHELLS)[number]) =>
|
||||
shell === "bash"
|
||||
? bashCompletionScript(cli.name)
|
||||
: Completions.register(shell, cli.name);
|
||||
completionScript(shell, cli.name);
|
||||
return (arguments_: readonly string[], options: ServeOptions): boolean => {
|
||||
const write =
|
||||
options.stdout ?? ((text: string) => process.stdout.write(text));
|
||||
@@ -130,9 +136,8 @@ export const createCliCompletions = (
|
||||
if (before.includes("--")) return true;
|
||||
const input = [cli.name, ...before, words[index] ?? ""];
|
||||
const doctor = before[0] === "mcp" && before[1] === "doctor";
|
||||
const candidates = Completions.complete(
|
||||
const candidates = completeWords(
|
||||
completionCommands(cli),
|
||||
undefined,
|
||||
input,
|
||||
input.length - 1,
|
||||
{
|
||||
@@ -143,7 +148,7 @@ export const createCliCompletions = (
|
||||
alias: doctor ? MCP_DOCTOR_ALIAS : { help: "h" },
|
||||
},
|
||||
);
|
||||
const result = Completions.format(shell, candidates);
|
||||
const result = formatCompletions(shell, candidates);
|
||||
if (result !== "") write(result);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,444 @@
|
||||
import { mkdir, readdir, readFile, writeFile } from "node:fs/promises";
|
||||
import { afterAll, beforeAll, describe, expect } from "vitest";
|
||||
|
||||
import { PRODUCT_IDENTITY } from "../../../src/identity.js";
|
||||
import { cliTest } from "../../support/cli/cliFixture.js";
|
||||
import {
|
||||
createTestWorkspace,
|
||||
removeTestWorkspace,
|
||||
type TestWorkspace,
|
||||
} from "../../support/workspace/workspaceFixture.js";
|
||||
|
||||
/**
|
||||
* Parity goldens for the CLI layer REA is moving off incur (#11654). Each case
|
||||
* runs the compiled `rea` and compares its exit code, stdout and stderr with a
|
||||
* reviewed file in tests/fixtures/cli-parity. A replacement of the parser,
|
||||
* help, completions, formatter or dispatch must keep every file unchanged
|
||||
* unless the owner approves the difference.
|
||||
*
|
||||
* Record after an approved change with
|
||||
* `REA_RECORD_CLI_PARITY=1 npm run test:focused -- tests/boundary/cli/cliParityGoldens.test.ts`
|
||||
* and review the diff.
|
||||
*/
|
||||
|
||||
const GOLDEN_DIRECTORY = new URL("../../fixtures/cli-parity/", import.meta.url);
|
||||
const RECORD = process.env.REA_RECORD_CLI_PARITY === "1";
|
||||
|
||||
/** Bytes whose entropy, length and digest the output cases select. */
|
||||
const SAMPLE = Buffer.from("REA\x00\x01\x02parity-golden\n", "latin1");
|
||||
const SENSITIVE = "secret-literal";
|
||||
|
||||
interface ParityCase {
|
||||
readonly name: string;
|
||||
readonly arguments: (workspace: TestWorkspace) => readonly string[];
|
||||
/** Shell completion protocol requests. */
|
||||
readonly complete?: "bash" | "zsh" | "fish" | "nushell";
|
||||
}
|
||||
|
||||
const sample = (workspace: TestWorkspace) => workspace.path("sample.bin");
|
||||
const entropy = (
|
||||
workspace: TestWorkspace,
|
||||
...rest: readonly string[]
|
||||
): readonly string[] => ["inspect-byte-entropy", sample(workspace), ...rest];
|
||||
const SELECTION = [
|
||||
"--filter-output",
|
||||
"normalized_result.window,normalized_result.blocks,normalized_result.thresholds",
|
||||
] as const;
|
||||
const BLOCKS = ["--filter-output", "normalized_result.blocks"] as const;
|
||||
const WINDOW = ["--filter-output", "normalized_result.window"] as const;
|
||||
const fixed =
|
||||
(...arguments_: readonly string[]) =>
|
||||
(): readonly string[] =>
|
||||
arguments_;
|
||||
const completion = (
|
||||
shell: NonNullable<ParityCase["complete"]>,
|
||||
name: string,
|
||||
...words: readonly string[]
|
||||
): ParityCase => ({
|
||||
name: `complete-${shell}-${name}`,
|
||||
complete: shell,
|
||||
arguments: fixed("--", "rea", ...words),
|
||||
});
|
||||
|
||||
const CASES: readonly ParityCase[] = [
|
||||
// Help and manifests
|
||||
{ name: "help-root-bare", arguments: fixed() },
|
||||
{ name: "help-root", arguments: fixed("--help") },
|
||||
{ name: "help-root-short", arguments: fixed("-h") },
|
||||
{
|
||||
name: "help-root-with-format",
|
||||
arguments: fixed("--help", "--format", "json"),
|
||||
},
|
||||
{ name: "version", arguments: fixed("--version") },
|
||||
{
|
||||
name: "version-after-command",
|
||||
arguments: fixed("inspect-byte-entropy", "--version"),
|
||||
},
|
||||
{
|
||||
name: "help-contract-command",
|
||||
arguments: fixed("inspect-byte-entropy", "--help"),
|
||||
},
|
||||
{
|
||||
name: "help-contract-optional-positional",
|
||||
arguments: fixed("instructions", "--help"),
|
||||
},
|
||||
{
|
||||
name: "help-contract-long-description",
|
||||
arguments: fixed("decompile", "--help"),
|
||||
},
|
||||
{ name: "help-contract-defaults", arguments: fixed("read-bytes", "--help") },
|
||||
{ name: "help-hand-built-setup", arguments: fixed("setup", "--help") },
|
||||
{ name: "help-hand-built-doctor", arguments: fixed("doctor", "--help") },
|
||||
{ name: "help-hand-built-guidance", arguments: fixed("guidance", "--help") },
|
||||
{
|
||||
name: "help-hand-built-capture-process",
|
||||
arguments: fixed("capture-process", "--help"),
|
||||
},
|
||||
{
|
||||
name: "help-hand-built-environment-build",
|
||||
arguments: fixed("environment-build", "--help"),
|
||||
},
|
||||
{ name: "help-update", arguments: fixed("update", "--help") },
|
||||
{ name: "help-mcp", arguments: fixed("mcp", "--help") },
|
||||
{ name: "help-mcp-add", arguments: fixed("mcp", "add", "--help") },
|
||||
{ name: "help-mcp-doctor", arguments: fixed("mcp", "doctor", "--help") },
|
||||
{ name: "help-completions", arguments: fixed("completions", "--help") },
|
||||
{ name: "help-completions-bare", arguments: fixed("completions") },
|
||||
{
|
||||
name: "schema-command",
|
||||
arguments: fixed("inspect-byte-entropy", "--schema"),
|
||||
},
|
||||
{
|
||||
name: "schema-command-json",
|
||||
arguments: fixed("inspect-byte-entropy", "--schema", "--format", "json"),
|
||||
},
|
||||
{ name: "llms-command", arguments: fixed("inspect-byte-entropy", "--llms") },
|
||||
{
|
||||
name: "llms-full-command",
|
||||
arguments: fixed("inspect-byte-entropy", "--llms-full"),
|
||||
},
|
||||
|
||||
// Completion scripts and the completion protocol
|
||||
{ name: "completions-bash", arguments: fixed("completions", "bash") },
|
||||
{ name: "completions-zsh", arguments: fixed("completions", "zsh") },
|
||||
{ name: "completions-fish", arguments: fixed("completions", "fish") },
|
||||
{ name: "completions-nushell", arguments: fixed("completions", "nushell") },
|
||||
{
|
||||
name: "completions-unknown-shell",
|
||||
arguments: fixed("completions", "powershell"),
|
||||
},
|
||||
completion("bash", "command-prefix", "inspect-byte-e"),
|
||||
completion("bash", "option-prefix", "inspect-byte-entropy", "--bl"),
|
||||
completion("bash", "mcp-subcommands", "mcp", ""),
|
||||
completion("bash", "completion-shells", "completions", ""),
|
||||
completion("bash", "format-values", "inspect-byte-entropy", "--format", ""),
|
||||
completion("bash", "enum-values", "instructions", "--target-format", ""),
|
||||
completion("bash", "global-prefix", "inspect-byte-entropy", "--tok"),
|
||||
completion("bash", "group-prefix", "mc"),
|
||||
completion("bash", "short-aliases", "setup", "-"),
|
||||
completion(
|
||||
"bash",
|
||||
"hand-built-enum-values",
|
||||
"setup",
|
||||
"--tool-catalog-profile",
|
||||
"",
|
||||
),
|
||||
completion("bash", "aliased-option-value", "mcp", "add", "-c", ""),
|
||||
completion(
|
||||
"bash",
|
||||
"boolean-before-subcommand",
|
||||
"inspect-byte-entropy",
|
||||
"--json",
|
||||
"",
|
||||
),
|
||||
completion("bash", "after-separator", "inspect-byte-entropy", "--", ""),
|
||||
completion("zsh", "mcp-doctor-options", "mcp", "doctor", "--"),
|
||||
completion("zsh", "described-commands", "inspect-pe-"),
|
||||
completion("zsh", "format-values", "inspect-byte-entropy", "--format", ""),
|
||||
completion("fish", "described-commands", "inspect-pe-"),
|
||||
completion("nushell", "described-commands", "inspect-pe-"),
|
||||
|
||||
// Command resolution and argument errors
|
||||
{ name: "error-unknown-command", arguments: fixed("no-such-command") },
|
||||
{ name: "error-empty-command", arguments: fixed("") },
|
||||
{ name: "error-unknown-mcp-subcommand", arguments: fixed("mcp", "bogus") },
|
||||
{
|
||||
name: "error-missing-positional",
|
||||
arguments: fixed("inspect-byte-entropy"),
|
||||
},
|
||||
{ name: "error-extra-positional", arguments: (w) => entropy(w, "extra") },
|
||||
{
|
||||
name: "error-unknown-flag",
|
||||
arguments: (w) => entropy(w, "--no-such-flag"),
|
||||
},
|
||||
{
|
||||
name: "error-missing-flag-value",
|
||||
arguments: (w) => entropy(w, "--block-size"),
|
||||
},
|
||||
{
|
||||
name: "error-invalid-number",
|
||||
arguments: (w) => entropy(w, "--block-size", "abc"),
|
||||
},
|
||||
{
|
||||
name: "error-refined-number",
|
||||
arguments: (w) => entropy(w, "--block-size", "100"),
|
||||
},
|
||||
{
|
||||
name: "error-refined-number-json",
|
||||
arguments: (w) => entropy(w, "--block-size", "100", "--format", "json"),
|
||||
},
|
||||
{
|
||||
name: "error-refined-number-md",
|
||||
arguments: (w) => entropy(w, "--block-size", "100", "--format", "md"),
|
||||
},
|
||||
{
|
||||
name: "error-refined-number-full-output",
|
||||
arguments: (w) =>
|
||||
entropy(w, "--block-size", "100", "--json", "--full-output"),
|
||||
},
|
||||
{
|
||||
name: "error-separator",
|
||||
arguments: (w) => entropy(w, "--", "--block-size"),
|
||||
},
|
||||
{
|
||||
name: "error-format-invalid",
|
||||
arguments: (w) => entropy(w, "--format", "bogus"),
|
||||
},
|
||||
{ name: "error-format-missing", arguments: (w) => entropy(w, "--format") },
|
||||
{
|
||||
name: "error-delimited-without-columns",
|
||||
arguments: (w) => entropy(w, ...BLOCKS, "--format", "csv"),
|
||||
},
|
||||
{
|
||||
name: "error-jsonl-not-collection",
|
||||
arguments: (w) => entropy(w, ...BLOCKS, "--format", "jsonl"),
|
||||
},
|
||||
{
|
||||
name: "error-sensitive-output-value",
|
||||
arguments: (w) => [
|
||||
"inspect-web-network-capture",
|
||||
w.path("capture.har"),
|
||||
"--format",
|
||||
SENSITIVE,
|
||||
"--sensitive-value",
|
||||
SENSITIVE,
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "error-sensitive-positional",
|
||||
arguments: (w) => [
|
||||
"inspect-web-network-capture",
|
||||
w.path("capture.har"),
|
||||
"har",
|
||||
SENSITIVE,
|
||||
"--sensitive-value",
|
||||
SENSITIVE,
|
||||
],
|
||||
},
|
||||
|
||||
// Output formats, filtering and global output controls
|
||||
{ name: "output-toon", arguments: (w) => entropy(w, ...SELECTION) },
|
||||
{
|
||||
name: "output-json",
|
||||
arguments: (w) => entropy(w, ...SELECTION, "--format", "json"),
|
||||
},
|
||||
{
|
||||
name: "output-json-switch",
|
||||
arguments: (w) => entropy(w, ...SELECTION, "--json"),
|
||||
},
|
||||
{
|
||||
name: "output-json-equals",
|
||||
arguments: (w) =>
|
||||
entropy(w, `--filter-output=${SELECTION[1]}`, "--format=json"),
|
||||
},
|
||||
{
|
||||
name: "output-yaml",
|
||||
arguments: (w) => entropy(w, ...SELECTION, "--format", "yaml"),
|
||||
},
|
||||
{
|
||||
name: "output-md",
|
||||
arguments: (w) => entropy(w, ...SELECTION, "--format", "md"),
|
||||
},
|
||||
{
|
||||
name: "output-csv",
|
||||
arguments: (w) =>
|
||||
entropy(
|
||||
w,
|
||||
...BLOCKS,
|
||||
"--columns",
|
||||
"offset,length,entropy",
|
||||
"--format",
|
||||
"csv",
|
||||
),
|
||||
},
|
||||
{
|
||||
name: "output-tsv",
|
||||
arguments: (w) =>
|
||||
entropy(w, ...BLOCKS, "--columns", "offset,entropy", "--format", "tsv"),
|
||||
},
|
||||
{
|
||||
name: "output-full-output",
|
||||
arguments: (w) => entropy(w, ...WINDOW, "--full-output"),
|
||||
},
|
||||
{
|
||||
name: "output-full-output-json",
|
||||
arguments: (w) => entropy(w, ...WINDOW, "--full-output", "--json"),
|
||||
},
|
||||
{
|
||||
name: "output-token-count",
|
||||
arguments: (w) => entropy(w, ...WINDOW, "--token-count"),
|
||||
},
|
||||
{
|
||||
name: "output-token-limit",
|
||||
arguments: (w) => entropy(w, ...SELECTION, "--token-limit", "5"),
|
||||
},
|
||||
{
|
||||
name: "output-token-offset",
|
||||
arguments: (w) =>
|
||||
entropy(w, ...SELECTION, "--token-limit", "5", "--token-offset", "5"),
|
||||
},
|
||||
{
|
||||
name: "output-timings",
|
||||
arguments: (w) => entropy(w, ...WINDOW, "--timings"),
|
||||
},
|
||||
];
|
||||
|
||||
/** Rows of the root command list kept in the golden; the rest are elided. */
|
||||
const ROOT_HELP_ROWS: ReadonlySet<string> = new Set([
|
||||
"address-to-file-offset",
|
||||
"build-reconstruction-obligation-ledger",
|
||||
"decompile",
|
||||
"inspect-byte-entropy",
|
||||
"setup",
|
||||
"xrefs",
|
||||
]);
|
||||
const ELIDED_ROWS = " <registered command rows elided>";
|
||||
|
||||
/**
|
||||
* The root command list grows with every new command. Check its layout here
|
||||
* (sorted, every description starting two columns after the longest name)
|
||||
* and keep only sample rows in the golden, written with a two-space gap
|
||||
* instead of the measured padding, so adding a command, including one with a
|
||||
* longer name, does not change the goldens.
|
||||
*/
|
||||
const elideRootCommandRows = (stdout: string): string => {
|
||||
const lines = stdout.split("\n");
|
||||
const start = lines.indexOf("Commands:");
|
||||
if (start < 0) return stdout;
|
||||
const end = lines.indexOf("", start);
|
||||
const rows = lines.slice(start + 1, end);
|
||||
const parsed = rows.map((row) => /^ {2}(\S+)( +)\S/u.exec(row));
|
||||
expect(parsed.every((match) => match !== null)).toBe(true);
|
||||
const names = parsed.map((match) => match![1]!);
|
||||
expect(names).toEqual([...names].sort());
|
||||
const width = Math.max(...names.map((name) => name.length));
|
||||
for (const match of parsed)
|
||||
expect(match![1]!.length + match![2]!.length).toBe(width + 2);
|
||||
const kept: string[] = [];
|
||||
rows.forEach((row, index) => {
|
||||
if (ROOT_HELP_ROWS.has(names[index]!))
|
||||
kept.push(` ${names[index]!} ${row.slice(width + 4)}`);
|
||||
else if (kept.at(-1) !== ELIDED_ROWS) kept.push(ELIDED_ROWS);
|
||||
});
|
||||
return [...lines.slice(0, start + 1), ...kept, ...lines.slice(end)].join(
|
||||
"\n",
|
||||
);
|
||||
};
|
||||
|
||||
/** Visible, reviewable text for protocol control bytes. */
|
||||
const visible = (text: string): string =>
|
||||
text.replace(
|
||||
// oxlint-disable-next-line no-control-regex -- the completion protocol separates records with control bytes.
|
||||
/[\x00-\x08\x0b-\x1f\x7f]/gu,
|
||||
(character) =>
|
||||
`<0x${character.charCodeAt(0).toString(16).padStart(2, "0")}>`,
|
||||
);
|
||||
|
||||
const normalize = (text: string, workspace: TestWorkspace): string =>
|
||||
visible(
|
||||
text
|
||||
.split(workspace.root)
|
||||
.join("<workspace>")
|
||||
.split(`rea@${PRODUCT_IDENTITY.packageVersion}`)
|
||||
.join("rea@<version>")
|
||||
.replace(/^\d+\.\d+\.\d+(?:-[\w.]+)?\n$/u, (line) =>
|
||||
line === `${PRODUCT_IDENTITY.packageVersion}\n` ? "<version>\n" : line,
|
||||
)
|
||||
.replace(/(duration"?:\s*"?)\d+ms/gu, "$1<ms>ms")
|
||||
.replace(/("command_ms":)\d+/gu, "$1<ms>"),
|
||||
);
|
||||
|
||||
const render = (
|
||||
testCase: ParityCase,
|
||||
workspace: TestWorkspace,
|
||||
result: { exitCode: number | null; stdout: string; stderr: string },
|
||||
): string => {
|
||||
const command = testCase
|
||||
.arguments(workspace)
|
||||
.map((argument) =>
|
||||
argument === "" || /\s/u.test(argument)
|
||||
? JSON.stringify(argument)
|
||||
: argument,
|
||||
);
|
||||
const stdout = testCase.name.startsWith("help-root")
|
||||
? elideRootCommandRows(result.stdout)
|
||||
: result.stdout;
|
||||
return [
|
||||
`$ ${testCase.complete === undefined ? "" : `COMPLETE=${testCase.complete} `}rea ${command.join(" ")}`.trimEnd(),
|
||||
`exit: ${result.exitCode}`,
|
||||
"--- stdout",
|
||||
`${normalize(stdout, workspace)}<end>`,
|
||||
"--- stderr",
|
||||
`${normalize(result.stderr, workspace)}<end>`,
|
||||
"",
|
||||
]
|
||||
.join("\n")
|
||||
.split(workspace.root)
|
||||
.join("<workspace>");
|
||||
};
|
||||
|
||||
describe("CLI parity goldens", () => {
|
||||
// One workspace and environment for the file, so the shared CLI process
|
||||
// serves every non-completion case instead of restarting per case.
|
||||
let workspace: TestWorkspace;
|
||||
beforeAll(async () => {
|
||||
workspace = await createTestWorkspace("rea-cli-parity-");
|
||||
await workspace.write("sample.bin", SAMPLE);
|
||||
});
|
||||
afterAll(async () => {
|
||||
await removeTestWorkspace(workspace.root);
|
||||
});
|
||||
|
||||
// Recording writes the files of new cases, so only orphans fail then.
|
||||
cliTest("every golden belongs to a case", async () => {
|
||||
const files = (await readdir(GOLDEN_DIRECTORY)).filter((file) =>
|
||||
file.endsWith(".txt"),
|
||||
);
|
||||
const expected = CASES.map(({ name }) => `${name}.txt`).sort();
|
||||
if (RECORD)
|
||||
expect(files.filter((file) => !expected.includes(file))).toEqual([]);
|
||||
else expect(files.sort()).toEqual(expected);
|
||||
});
|
||||
|
||||
cliTest.for(CASES)("$name", async (testCase, { cli }) => {
|
||||
const result = await cli.run({
|
||||
arguments: testCase.arguments(workspace),
|
||||
cwd: workspace.root,
|
||||
environment: {
|
||||
...workspace.environment,
|
||||
...(testCase.complete === undefined
|
||||
? {}
|
||||
: { COMPLETE: testCase.complete }),
|
||||
},
|
||||
...(testCase.complete === undefined ? {} : { freshProcess: true }),
|
||||
});
|
||||
const actual = render(testCase, workspace, result);
|
||||
const golden = new URL(`${testCase.name}.txt`, GOLDEN_DIRECTORY);
|
||||
if (RECORD) {
|
||||
await mkdir(GOLDEN_DIRECTORY, { recursive: true });
|
||||
await writeFile(golden, actual, "utf8");
|
||||
return;
|
||||
}
|
||||
expect(actual).toBe(await readFile(golden, "utf8"));
|
||||
});
|
||||
});
|
||||
+1
-1
@@ -2,7 +2,7 @@ import { execFile } from "node:child_process";
|
||||
import { promisify } from "node:util";
|
||||
import { expect, it } from "vitest";
|
||||
|
||||
import { bashCompletionScript } from "../../../src/cli/bashCompletionRegistration.js";
|
||||
import { bashCompletionScript } from "../../../src/cli/completionProtocol.js";
|
||||
|
||||
const execute = promisify(execFile);
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
$ COMPLETE=bash rea -- rea inspect-byte-entropy -- ""
|
||||
exit: 0
|
||||
--- stdout
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,6 @@
|
||||
$ COMPLETE=bash rea -- rea mcp add -c ""
|
||||
exit: 0
|
||||
--- stdout
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,6 @@
|
||||
$ COMPLETE=bash rea -- rea inspect-byte-entropy --json ""
|
||||
exit: 0
|
||||
--- stdout
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,6 @@
|
||||
$ COMPLETE=bash rea -- rea inspect-byte-e
|
||||
exit: 0
|
||||
--- stdout
|
||||
inspect-byte-entropy<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,6 @@
|
||||
$ COMPLETE=bash rea -- rea completions ""
|
||||
exit: 0
|
||||
--- stdout
|
||||
bash<0x0b>zsh<0x0b>fish<0x0b>nushell<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,6 @@
|
||||
$ COMPLETE=bash rea -- rea instructions --target-format ""
|
||||
exit: 0
|
||||
--- stdout
|
||||
dos-com<0x0b>raw-binary<0x0b>gamecube-dol<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,6 @@
|
||||
$ COMPLETE=bash rea -- rea inspect-byte-entropy --format ""
|
||||
exit: 0
|
||||
--- stdout
|
||||
toon<0x0b>json<0x0b>yaml<0x0b>md<0x0b>jsonl<0x0b>csv<0x0b>tsv<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,6 @@
|
||||
$ COMPLETE=bash rea -- rea inspect-byte-entropy --tok
|
||||
exit: 0
|
||||
--- stdout
|
||||
--token-limit<0x0b>--token-offset<0x0b>--token-count<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,6 @@
|
||||
$ COMPLETE=bash rea -- rea mc
|
||||
exit: 0
|
||||
--- stdout
|
||||
mcp<0x01><end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,6 @@
|
||||
$ COMPLETE=bash rea -- rea setup --tool-catalog-profile ""
|
||||
exit: 0
|
||||
--- stdout
|
||||
full<0x0b>hot-cold<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,6 @@
|
||||
$ COMPLETE=bash rea -- rea mcp ""
|
||||
exit: 0
|
||||
--- stdout
|
||||
add<0x0b>doctor<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,6 @@
|
||||
$ COMPLETE=bash rea -- rea inspect-byte-entropy --bl
|
||||
exit: 0
|
||||
--- stdout
|
||||
--block-size<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,6 @@
|
||||
$ COMPLETE=bash rea -- rea setup -
|
||||
exit: 0
|
||||
--- stdout
|
||||
--yes<0x0b>--install-hopper<0x0b>--desktop-build<0x0b>--install-agentenv<0x0b>--client<0x0b>--skill-client<0x0b>--tool-families<0x0b>--tool-catalog-profile<0x0b>--all-detected<0x0b>--skill<0x0b>--dry-run<0x0b>--accessible<0x0b>-y<0x0b>--format<0x0b>--filter-output<0x0b>--columns<0x0b>--token-limit<0x0b>--token-offset<0x0b>--full-output<0x0b>--llms<0x0b>--llms-full<0x0b>--help<0x0b>--schema<0x0b>--json<0x0b>--token-count<0x0b>--timings<0x0b>-h<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,9 @@
|
||||
$ COMPLETE=fish rea -- rea inspect-pe-
|
||||
exit: 0
|
||||
--- stdout
|
||||
inspect-pe-load-config Inspect PE TLS callbacks and load configuration without executing the image
|
||||
inspect-pe-certificates Inspect PE Authenticode certificate table identities without verifying signatures
|
||||
inspect-pe-imports Inspect PE import and delay-load table identities without executing the image
|
||||
inspect-pe-resources Inspect PE resource identities, payload ranges, hashes and icon-group relationships<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,6 @@
|
||||
$ COMPLETE=nushell rea -- rea inspect-pe-
|
||||
exit: 0
|
||||
--- stdout
|
||||
[{"value":"inspect-pe-load-config","description":"Inspect PE TLS callbacks and load configuration without executing the image"},{"value":"inspect-pe-certificates","description":"Inspect PE Authenticode certificate table identities without verifying signatures"},{"value":"inspect-pe-imports","description":"Inspect PE import and delay-load table identities without executing the image"},{"value":"inspect-pe-resources","description":"Inspect PE resource identities, payload ranges, hashes and icon-group relationships"}]<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,9 @@
|
||||
$ COMPLETE=zsh rea -- rea inspect-pe-
|
||||
exit: 0
|
||||
--- stdout
|
||||
inspect-pe-load-config:Inspect PE TLS callbacks and load configuration without executing the image
|
||||
inspect-pe-certificates:Inspect PE Authenticode certificate table identities without verifying signatures
|
||||
inspect-pe-imports:Inspect PE import and delay-load table identities without executing the image
|
||||
inspect-pe-resources:Inspect PE resource identities, payload ranges, hashes and icon-group relationships<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,12 @@
|
||||
$ COMPLETE=zsh rea -- rea inspect-byte-entropy --format ""
|
||||
exit: 0
|
||||
--- stdout
|
||||
toon
|
||||
json
|
||||
yaml
|
||||
md
|
||||
jsonl
|
||||
csv
|
||||
tsv<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,10 @@
|
||||
$ COMPLETE=zsh rea -- rea mcp doctor --
|
||||
exit: 0
|
||||
--- stdout
|
||||
--format:Output format
|
||||
--json:Emit the report as JSON
|
||||
--full-output:Show the full output envelope
|
||||
--help:Show help
|
||||
--timings<end>
|
||||
--- stderr
|
||||
<end>
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
$ rea completions bash
|
||||
exit: 0
|
||||
--- stdout
|
||||
_incur_complete_rea() {
|
||||
local IFS=$'\013'
|
||||
local _COMPLETE_INDEX=${COMP_CWORD}
|
||||
local _completions _output
|
||||
if ! _output=$(
|
||||
export COMPLETE="bash"
|
||||
export _COMPLETE_INDEX="$_COMPLETE_INDEX"
|
||||
'rea' -- "${COMP_WORDS[@]}"
|
||||
); then
|
||||
unset COMPREPLY
|
||||
return
|
||||
fi
|
||||
# Split the protocol records without expanding pathname patterns.
|
||||
read -r -d '' -a _completions < <(printf '%s\0' "$_output")
|
||||
local _nospace=false
|
||||
local _nospace_marker=$'\001'
|
||||
local _c
|
||||
COMPREPLY=()
|
||||
for _c in "${_completions[@]}"; do
|
||||
if [[ "$_c" == *"$_nospace_marker" ]]; then
|
||||
_nospace=true
|
||||
COMPREPLY+=("${_c%"$_nospace_marker"}")
|
||||
else
|
||||
COMPREPLY+=("$_c")
|
||||
fi
|
||||
done
|
||||
if [[ $_nospace == true ]] && type compopt >/dev/null 2>&1; then
|
||||
compopt -o nospace
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
complete -o default -o bashdefault -o nosort -F _incur_complete_rea 'rea' 2>/dev/null ||
|
||||
complete -o default -o bashdefault -F _incur_complete_rea 'rea'
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,8 @@
|
||||
$ rea completions fish
|
||||
exit: 0
|
||||
--- stdout
|
||||
complete --keep-order --exclusive --command rea \
|
||||
--arguments "(COMPLETE=fish rea -- (commandline --current-process --tokenize --cut-at-cursor) (commandline --current-token))"
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,11 @@
|
||||
$ rea completions nushell
|
||||
exit: 0
|
||||
--- stdout
|
||||
# External completer for rea
|
||||
# Add to $env.config.completions.external.completer or use in a dispatch completer.
|
||||
let _incur_complete_rea = {|spans|
|
||||
COMPLETE=nushell rea -- ...$spans | from json
|
||||
}
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,7 @@
|
||||
$ rea completions powershell
|
||||
exit: 1
|
||||
--- stdout
|
||||
Error (INVALID_SHELL): Unknown shell 'powershell'. Supported: bash, fish, nushell, zsh
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
$ rea completions zsh
|
||||
exit: 0
|
||||
--- stdout
|
||||
#compdef rea
|
||||
_incur_complete_rea() {
|
||||
local completions=("${(@f)$(
|
||||
export _COMPLETE_INDEX=$(( CURRENT - 1 ))
|
||||
export COMPLETE="zsh"
|
||||
"rea" -- "${words[@]}" 2>/dev/null
|
||||
)}")
|
||||
if [[ -n $completions ]]; then
|
||||
_describe 'values' completions -S ''
|
||||
fi
|
||||
}
|
||||
compdef _incur_complete_rea rea
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,7 @@
|
||||
$ rea inspect-byte-entropy <workspace>/sample.bin --filter-output normalized_result.blocks --format csv
|
||||
exit: 1
|
||||
--- stdout
|
||||
{"ok":false,"error":{"code":"UNSUPPORTED_OUTPUT_COMBINATION","message":"CSV/TSV output requires --filter-output <row-array-path> and --columns <column,...>; nested Evidence is not flattened."}}
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,14 @@
|
||||
$ rea ""
|
||||
exit: 1
|
||||
--- stdout
|
||||
code: COMMAND_NOT_FOUND
|
||||
message: '' is not a command for 'rea'. Did you mean 'mcp'?
|
||||
cta:
|
||||
description: "Suggested commands:"
|
||||
commands[2]:
|
||||
- command: rea mcp
|
||||
- command: rea --help
|
||||
description: see all available commands
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,8 @@
|
||||
$ rea inspect-byte-entropy <workspace>/sample.bin extra
|
||||
exit: 1
|
||||
--- stdout
|
||||
code: UNKNOWN
|
||||
message: "Unexpected positional arguments: \"extra\". Use 'rea inspect-byte-entropy --help' for the declared argument shape."
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,7 @@
|
||||
$ rea inspect-byte-entropy <workspace>/sample.bin --format bogus
|
||||
exit: 1
|
||||
--- stdout
|
||||
{"ok":false,"error":{"code":"INVALID_OUTPUT_VALUE","message":"Invalid format: \"bogus\". Expected one of: toon, json, yaml, md, jsonl, csv, tsv"}}
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,7 @@
|
||||
$ rea inspect-byte-entropy <workspace>/sample.bin --format
|
||||
exit: 1
|
||||
--- stdout
|
||||
{"ok":false,"error":{"code":"MISSING_OUTPUT_VALUE","message":"--format requires a value, as in --format <value> or --format=<value>."}}
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,10 @@
|
||||
$ rea inspect-byte-entropy <workspace>/sample.bin --block-size abc
|
||||
exit: 1
|
||||
--- stdout
|
||||
code: VALIDATION_ERROR
|
||||
message: "REA could not read the command arguments. Check the named argument and its expected type, then try again."
|
||||
fieldErrors[1]{code,missing,path,expected,received,message}:
|
||||
invalid_union,false,blockSize,"","",Invalid input
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,7 @@
|
||||
$ rea inspect-byte-entropy <workspace>/sample.bin --filter-output normalized_result.blocks --format jsonl
|
||||
exit: 1
|
||||
--- stdout
|
||||
{"$rea":"jsonl/v1","type":"error","ok":false,"result":{"code":"invalid_request","category":"invalid_input","message":"The --filter-output selection normalized_result.blocks is not a JSON Lines record collection: normalized_result.blocks is an array. JSON Lines needs a top-level array, or exactly one rows, items, records, or occurrences array directly in the result, under page, or under normalized_result.","retryable":false,"remediation":{"action":"Use --format json for the complete document, or select one record collection with --filter-output."},"recovery":{"kind":"inspect_input_contract","operation":"inspect-byte-entropy"},"details":{"operation":"inspect-byte-entropy","issues":[{"path":["filter-output"],"reason":"invalid_value","message":"The --filter-output selection normalized_result.blocks is not a JSON Lines record collection: normalized_result.blocks is an array.","observed":[{"path":["normalized_result","blocks"],"shape":"array"}]}]}}}
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,8 @@
|
||||
$ rea inspect-byte-entropy <workspace>/sample.bin --block-size
|
||||
exit: 1
|
||||
--- stdout
|
||||
code: UNKNOWN
|
||||
message: "Missing value for flag: --block-size"
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,10 @@
|
||||
$ rea inspect-byte-entropy
|
||||
exit: 1
|
||||
--- stdout
|
||||
code: VALIDATION_ERROR
|
||||
message: "REA could not read the command arguments. Check the named argument and its expected type, then try again."
|
||||
fieldErrors[1]{code,missing,path,expected,received,message}:
|
||||
invalid_type,true,path,string,"","Invalid input: expected string, received undefined"
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,7 @@
|
||||
$ rea inspect-byte-entropy <workspace>/sample.bin --block-size 100 --json --full-output
|
||||
exit: 1
|
||||
--- stdout
|
||||
{"ok":false,"error":{"code":"VALIDATION_ERROR","message":"REA could not read the command arguments. Check the named argument and its expected type, then try again.","fieldErrors":[{"code":"too_small","missing":false,"path":"blockSize","expected":"","received":"","message":"Too small: expected number to be >=256"},{"code":"custom","missing":false,"path":"blockSize","expected":"","received":"","message":"Block size must be a power of two."}]},"meta":{"command":"inspect-byte-entropy","duration":"<ms>ms"}}
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,7 @@
|
||||
$ rea inspect-byte-entropy <workspace>/sample.bin --block-size 100 --format json
|
||||
exit: 1
|
||||
--- stdout
|
||||
{"code":"VALIDATION_ERROR","message":"REA could not read the command arguments. Check the named argument and its expected type, then try again.","fieldErrors":[{"code":"too_small","missing":false,"path":"blockSize","expected":"","received":"","message":"Too small: expected number to be >=256"},{"code":"custom","missing":false,"path":"blockSize","expected":"","received":"","message":"Block size must be a power of two."}]}
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,20 @@
|
||||
$ rea inspect-byte-entropy <workspace>/sample.bin --block-size 100 --format md
|
||||
exit: 1
|
||||
--- stdout
|
||||
## code
|
||||
|
||||
VALIDATION_ERROR
|
||||
|
||||
## message
|
||||
|
||||
REA could not read the command arguments. Check the named argument and its expected type, then try again.
|
||||
|
||||
## fieldErrors
|
||||
|
||||
| code | missing | path | expected | received | message |
|
||||
|-----------|---------|-----------|----------|----------|-----------------------------------------------|
|
||||
| too_small | false | blockSize | | | Too small: expected number to be >=256 |
|
||||
| custom | false | blockSize | | | Block size must be a power of two. |
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,11 @@
|
||||
$ rea inspect-byte-entropy <workspace>/sample.bin --block-size 100
|
||||
exit: 1
|
||||
--- stdout
|
||||
code: VALIDATION_ERROR
|
||||
message: "REA could not read the command arguments. Check the named argument and its expected type, then try again."
|
||||
fieldErrors[2]{code,missing,path,expected,received,message}:
|
||||
too_small,false,blockSize,"","","Too small: expected number to be >=256"
|
||||
custom,false,blockSize,"","",Block size must be a power of two.
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,7 @@
|
||||
$ rea inspect-web-network-capture <workspace>/capture.har --format secret-literal --sensitive-value secret-literal
|
||||
exit: 1
|
||||
--- stdout
|
||||
{"ok":false,"error":{"code":"INVALID_OUTPUT_VALUE","message":"Invalid format: \"[REDACTED]\". Expected one of: toon, json, yaml, md, jsonl, csv, tsv"}}
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,8 @@
|
||||
$ rea inspect-web-network-capture <workspace>/capture.har har secret-literal --sensitive-value secret-literal
|
||||
exit: 1
|
||||
--- stdout
|
||||
code: UNKNOWN
|
||||
message: "Unexpected positional arguments: \"[REDACTED]\". Use 'rea inspect-web-network-capture --help' for the declared argument shape."
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,8 @@
|
||||
$ rea inspect-byte-entropy <workspace>/sample.bin -- --block-size
|
||||
exit: 1
|
||||
--- stdout
|
||||
code: UNKNOWN
|
||||
message: "Unknown flag: --"
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,14 @@
|
||||
$ rea no-such-command
|
||||
exit: 1
|
||||
--- stdout
|
||||
code: COMMAND_NOT_FOUND
|
||||
message: 'no-such-command' is not a command for 'rea'. Did you mean 'cutter-command'?
|
||||
cta:
|
||||
description: "Suggested commands:"
|
||||
commands[2]:
|
||||
- command: rea cutter-command
|
||||
- command: rea --help
|
||||
description: see all available commands
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,8 @@
|
||||
$ rea inspect-byte-entropy <workspace>/sample.bin --no-such-flag
|
||||
exit: 1
|
||||
--- stdout
|
||||
code: UNKNOWN
|
||||
message: "Unknown flag: --no-such-flag"
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,12 @@
|
||||
$ rea mcp bogus
|
||||
exit: 1
|
||||
--- stdout
|
||||
code: COMMAND_NOT_FOUND
|
||||
message: 'bogus' is not a command for 'rea mcp'.
|
||||
cta:
|
||||
description: "Suggested command:"
|
||||
commands[1]{command,description}:
|
||||
rea mcp --help,see all available commands
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,20 @@
|
||||
$ rea completions
|
||||
exit: 0
|
||||
--- stdout
|
||||
rea completions — Generate shell completion script
|
||||
|
||||
Usage: rea completions <bash|fish|nushell|zsh>
|
||||
|
||||
Arguments:
|
||||
shell Shell to generate completions for
|
||||
|
||||
Setup:
|
||||
bash eval "$(rea completions bash)" # add to ~/.bashrc
|
||||
fish rea completions fish | source # add to ~/.config/fish/config.fish
|
||||
nushell see `rea completions nushell` # add to config.nu
|
||||
zsh eval "$(rea completions zsh)" # add to ~/.zshrc
|
||||
|
||||
Zsh: initialize completion with `autoload -Uz compinit; compinit` before evaluating the zsh hook. If your shell already runs compinit, place the hook after it.
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
$ rea completions --help
|
||||
exit: 0
|
||||
--- stdout
|
||||
rea completions — Generate shell completion script
|
||||
|
||||
Usage: rea completions <bash|fish|nushell|zsh>
|
||||
|
||||
Arguments:
|
||||
shell Shell to generate completions for
|
||||
|
||||
Setup:
|
||||
bash eval "$(rea completions bash)" # add to ~/.bashrc
|
||||
fish rea completions fish | source # add to ~/.config/fish/config.fish
|
||||
nushell see `rea completions nushell` # add to config.nu
|
||||
zsh eval "$(rea completions zsh)" # add to ~/.zshrc
|
||||
|
||||
Zsh: initialize completion with `autoload -Uz compinit; compinit` before evaluating the zsh hook. If your shell already runs compinit, place the hook after it.
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,31 @@
|
||||
$ rea inspect-byte-entropy --help
|
||||
exit: 0
|
||||
--- stdout
|
||||
rea inspect-byte-entropy — Inspect file-wide and block byte entropy without executing the file
|
||||
|
||||
Usage: rea inspect-byte-entropy <path> [options]
|
||||
|
||||
Arguments:
|
||||
path Local file
|
||||
|
||||
Options:
|
||||
--block-size <value> Power-of-two block size from 256 to 65536 bytes (default: 4096)
|
||||
--offset <value> Window start as a decimal file byte offset (default: 0)
|
||||
--length <value> Window length in bytes; omit to extend through EOF
|
||||
|
||||
Custom Global Options:
|
||||
--timings Write measured command timing to stderr.
|
||||
|
||||
Global Options:
|
||||
--filter-output <keys> Filter output by key paths (e.g. foo,bar.baz,a[0,3])
|
||||
--format <toon|json|yaml|md|jsonl> Output format
|
||||
--full-output Show full output envelope
|
||||
--help Show help
|
||||
--llms, --llms-full Print LLM-readable manifest
|
||||
--schema Show JSON Schema for command
|
||||
--token-count Print token count of output (instead of output)
|
||||
--token-limit <n> Limit output to n tokens
|
||||
--token-offset <n> Skip first n tokens of output
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,34 @@
|
||||
$ rea read-bytes --help
|
||||
exit: 0
|
||||
--- stdout
|
||||
rea read-bytes — Read provider memory bytes; Ghidra memory may include loader fixups and differ from file bytes
|
||||
|
||||
Usage: rea read-bytes <path> <address> [options]
|
||||
|
||||
Arguments:
|
||||
path Local executable path
|
||||
address Exact provider memory address
|
||||
|
||||
Options:
|
||||
--length <value> Requested byte count (default: 256)
|
||||
--target-format <dos-com|raw-binary|gamecube-dol> Explicit interpretation: dos-com or raw-binary (headerless), or gamecube-dol (GameCube/Wii DOL, never auto-detected); omission preserves header-based detection
|
||||
--architecture <6502|x86|x86_64|arm|arm64|m68k> Caller-supplied CPU family; required with --target-format raw-binary, must be omitted with gamecube-dol
|
||||
--entry-point <string> Caller-supplied load and entry address (0xhex); required with --target-format raw-binary, optional with gamecube-dol (must equal the DOL header entry)
|
||||
--provider <value> Bind deep analysis to a provider ID or use deterministic auto selection
|
||||
|
||||
Custom Global Options:
|
||||
--timings Write measured command timing to stderr.
|
||||
|
||||
Global Options:
|
||||
--filter-output <keys> Filter output by key paths (e.g. foo,bar.baz,a[0,3])
|
||||
--format <toon|json|yaml|md|jsonl> Output format
|
||||
--full-output Show full output envelope
|
||||
--help Show help
|
||||
--llms, --llms-full Print LLM-readable manifest
|
||||
--schema Show JSON Schema for command
|
||||
--token-count Print token count of output (instead of output)
|
||||
--token-limit <n> Limit output to n tokens
|
||||
--token-offset <n> Skip first n tokens of output
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,39 @@
|
||||
$ rea decompile --help
|
||||
exit: 0
|
||||
--- stdout
|
||||
rea decompile — Read one part of an app as code. Supply at least one of the positional address or --procedure. Alternatively, use --file-offset alone. Equal positional and --procedure values are accepted; conflicts fail. With Ghidra, a space-qualified address such as ram:0x... avoids file-offset fallback; inspect-native-load-image reports the observed default space.
|
||||
|
||||
Usage: rea decompile <path> [address] [options]
|
||||
|
||||
Arguments:
|
||||
path App or program path
|
||||
address Procedure name or address. Supply at least one of the positional address or --procedure. Alternatively, use --file-offset alone.
|
||||
|
||||
Options:
|
||||
--analysis <independent_fresh> Request a new independent decompile, bypassing project and snapshot results. Use only when the routed provider's procedure_pseudo_code capability declares independent_decompile; otherwise the request is refused. This may use different analysis context.
|
||||
--detail <complete|summary> Deliver complete Evidence, or a summary with --evidence_output (default: complete)
|
||||
--snapshot <string> Load and update a local analysis snapshot
|
||||
--target-format <dos-com|raw-binary|gamecube-dol> Explicit interpretation: dos-com or raw-binary (headerless), or gamecube-dol (GameCube/Wii DOL, never auto-detected); omission preserves header-based detection
|
||||
--architecture <6502|x86|x86_64|arm|arm64|m68k> Caller-supplied CPU family; required with --target-format raw-binary, must be omitted with gamecube-dol
|
||||
--entry-point <string> Caller-supplied load and entry address (0xhex); required with --target-format raw-binary, optional with gamecube-dol (must equal the DOL header entry)
|
||||
--provider <value> Bind deep analysis to a provider ID or use deterministic auto selection
|
||||
--evidence_output <string> Save complete Evidence as a bundle; required for summary delivery. Never overwrites.
|
||||
--procedure <string> Procedure name or address; use --procedure=<value> for leading dashes. Supply at least one of the positional address or --procedure. Alternatively, use --file-offset alone.
|
||||
--file-offset <string> Ghidra source-file byte offset; mapped internally to an analysis address. Supply at least one of the positional address or --procedure. Alternatively, use --file-offset alone.
|
||||
|
||||
Custom Global Options:
|
||||
--timings Write measured command timing to stderr.
|
||||
|
||||
Global Options:
|
||||
--filter-output <keys> Filter output by key paths (e.g. foo,bar.baz,a[0,3])
|
||||
--format <toon|json|yaml|md|jsonl> Output format
|
||||
--full-output Show full output envelope
|
||||
--help Show help
|
||||
--llms, --llms-full Print LLM-readable manifest
|
||||
--schema Show JSON Schema for command
|
||||
--token-count Print token count of output (instead of output)
|
||||
--token-limit <n> Limit output to n tokens
|
||||
--token-offset <n> Skip first n tokens of output
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,35 @@
|
||||
$ rea instructions --help
|
||||
exit: 0
|
||||
--- stdout
|
||||
rea instructions — Read every raw instruction without decompiling. Supply at least one of the positional address or --procedure. Equal values are accepted; conflicts fail.
|
||||
|
||||
Usage: rea instructions <path> [address] [options]
|
||||
|
||||
Arguments:
|
||||
path App or program path
|
||||
address Procedure name or address. Supply at least one of the positional address or --procedure.
|
||||
|
||||
Options:
|
||||
--snapshot <string> Load and update a local analysis snapshot
|
||||
--target-format <dos-com|raw-binary|gamecube-dol> Explicit interpretation: dos-com or raw-binary (headerless), or gamecube-dol (GameCube/Wii DOL, never auto-detected); omission preserves header-based detection
|
||||
--architecture <6502|x86|x86_64|arm|arm64|m68k> Caller-supplied CPU family; required with --target-format raw-binary, must be omitted with gamecube-dol
|
||||
--entry-point <string> Caller-supplied load and entry address (0xhex); required with --target-format raw-binary, optional with gamecube-dol (must equal the DOL header entry)
|
||||
--provider <value> Bind deep analysis to a provider ID or use deterministic auto selection
|
||||
--procedure <string> Procedure name or address; use --procedure=<value> for leading dashes. Supply at least one of the positional address or --procedure.
|
||||
|
||||
Custom Global Options:
|
||||
--timings Write measured command timing to stderr.
|
||||
|
||||
Global Options:
|
||||
--filter-output <keys> Filter output by key paths (e.g. foo,bar.baz,a[0,3])
|
||||
--format <toon|json|yaml|md|jsonl> Output format
|
||||
--full-output Show full output envelope
|
||||
--help Show help
|
||||
--llms, --llms-full Print LLM-readable manifest
|
||||
--schema Show JSON Schema for command
|
||||
--token-count Print token count of output (instead of output)
|
||||
--token-limit <n> Limit output to n tokens
|
||||
--token-offset <n> Skip first n tokens of output
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,26 @@
|
||||
$ rea capture-process --help
|
||||
exit: 0
|
||||
--- stdout
|
||||
rea capture-process — Capture one caller-selected process scenario
|
||||
|
||||
Usage: rea capture-process <scenario>
|
||||
|
||||
Arguments:
|
||||
scenario Scenario JSON path
|
||||
|
||||
Custom Global Options:
|
||||
--timings Write measured command timing to stderr.
|
||||
|
||||
Global Options:
|
||||
--filter-output <keys> Filter output by key paths (e.g. foo,bar.baz,a[0,3])
|
||||
--format <toon|json|yaml|md|jsonl> Output format
|
||||
--full-output Show full output envelope
|
||||
--help Show help
|
||||
--llms, --llms-full Print LLM-readable manifest
|
||||
--schema Show JSON Schema for command
|
||||
--token-count Print token count of output (instead of output)
|
||||
--token-limit <n> Limit output to n tokens
|
||||
--token-offset <n> Skip first n tokens of output
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,29 @@
|
||||
$ rea doctor --help
|
||||
exit: 0
|
||||
--- stdout
|
||||
rea doctor — Check whether REA is ready
|
||||
|
||||
Usage: rea doctor [options]
|
||||
|
||||
Options:
|
||||
--target <string> Optional app path to check
|
||||
--client <array> Agent registration whose readiness is required; repeatable
|
||||
--provider <array> Deep-analysis provider, or desktop_build for a desktop build host, whose readiness is required
|
||||
--skill Require the installed REA skill identity to be aligned
|
||||
|
||||
Custom Global Options:
|
||||
--timings Write measured command timing to stderr.
|
||||
|
||||
Global Options:
|
||||
--filter-output <keys> Filter output by key paths (e.g. foo,bar.baz,a[0,3])
|
||||
--format <toon|json|yaml|md|jsonl> Output format
|
||||
--full-output Show full output envelope
|
||||
--help Show help
|
||||
--llms, --llms-full Print LLM-readable manifest
|
||||
--schema Show JSON Schema for command
|
||||
--token-count Print token count of output (instead of output)
|
||||
--token-limit <n> Limit output to n tokens
|
||||
--token-offset <n> Skip first n tokens of output
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,35 @@
|
||||
$ rea environment-build --help
|
||||
exit: 0
|
||||
--- stdout
|
||||
rea environment-build — Build an agent environment bundle from a recorded capture in one offline step: inspect a HAR (or read capture Evidence), project the environment manifest, derive the state, report which tools the environment answers from state, which replay and why each write is withheld, then write the bundle environment-export writes
|
||||
|
||||
Usage: rea environment-build <capture> [directory] [options]
|
||||
|
||||
Arguments:
|
||||
capture A .har file, or capture Evidence JSON from inspect-web-network-capture (HAR) or capture-browser-scenario
|
||||
directory Bundle directory to create; must be absent or empty, nothing is overwritten; omit only with --dry-run
|
||||
|
||||
Options:
|
||||
--name <string> Env folder and env id (kebab-case); default the manifest's name, or the capture file's name when the origin is a loopback or IP address
|
||||
--template-rule <array> Opt-in template rule; repeat to select several. Replaces the default after-uid-literal, opaque-token, sibling-variance and prefix-variance
|
||||
--format-rules-only Apply only the four format rules, the views' own default
|
||||
--package-tarball <string> Packed rea-agents tarball (npm pack) copied into the env folder and installed by the Dockerfile instead of the registry package pinned to this version
|
||||
--dry-run Run every stage and report, but write nothing
|
||||
--capture-timeout-ms <value> Capture wall-clock deadline in milliseconds (default 30000), from decoder start through process exit. Omitted means 30000 and applies on the next capture. deadlineExpired returns no partial capture. Does not raise the separately selected max_input_bytes, max_reply_bytes or max_nesting_depth budgets.
|
||||
|
||||
Custom Global Options:
|
||||
--timings Write measured command timing to stderr.
|
||||
|
||||
Global Options:
|
||||
--filter-output <keys> Filter output by key paths (e.g. foo,bar.baz,a[0,3])
|
||||
--format <toon|json|yaml|md|jsonl> Output format
|
||||
--full-output Show full output envelope
|
||||
--help Show help
|
||||
--llms, --llms-full Print LLM-readable manifest
|
||||
--schema Show JSON Schema for command
|
||||
--token-count Print token count of output (instead of output)
|
||||
--token-limit <n> Limit output to n tokens
|
||||
--token-offset <n> Skip first n tokens of output
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,30 @@
|
||||
$ rea guidance --help
|
||||
exit: 0
|
||||
--- stdout
|
||||
rea guidance — Search or read the installed REA workflow guidance
|
||||
|
||||
Usage: rea guidance [options]
|
||||
|
||||
Options:
|
||||
--action <search|read> Guidance action to perform: search or read (default: search)
|
||||
--query <string> Required with search; all non-generic query words must match
|
||||
--locator <string> Required with --action read; locator returned by search
|
||||
--limit <value> Maximum search matches; search only, defaults to 8
|
||||
--cursor <string> Continue a search page; search only
|
||||
|
||||
Custom Global Options:
|
||||
--timings Write measured command timing to stderr.
|
||||
|
||||
Global Options:
|
||||
--filter-output <keys> Filter output by key paths (e.g. foo,bar.baz,a[0,3])
|
||||
--format <toon|json|yaml|md|jsonl> Output format
|
||||
--full-output Show full output envelope
|
||||
--help Show help
|
||||
--llms, --llms-full Print LLM-readable manifest
|
||||
--schema Show JSON Schema for command
|
||||
--token-count Print token count of output (instead of output)
|
||||
--token-limit <n> Limit output to n tokens
|
||||
--token-offset <n> Skip first n tokens of output
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,37 @@
|
||||
$ rea setup --help
|
||||
exit: 0
|
||||
--- stdout
|
||||
rea setup — Configure agent integrations and optional analysis providers
|
||||
|
||||
Usage: rea setup [options]
|
||||
|
||||
Options:
|
||||
--yes, -y Approve user-owned setup actions without prompting
|
||||
--install-hopper Also approve Hopper installation with --yes
|
||||
--desktop-build Prepare this host for desktop builds: pack REA's build-computer runtime and record the build settings in the selected registrations
|
||||
--install-agentenv With --desktop-build, also install the agentenv-framework release bundles target with uv
|
||||
--client <array> Agent integration to configure; repeat for multiple agents
|
||||
--skill-client <array> Existing client skill destination to update; repeatable
|
||||
--tool-families <string> Comma-separated tool families this registration advertises; omit to preserve the saved selection, or advertise every tool if none is saved. To restore every tool, remove REA_MCP_TOOL_FAMILIES from the client's registration and restart the client.
|
||||
--tool-catalog-profile <full|hot-cold> MCP catalog: full advertises every in-scope tool; hot-cold loads tools on demand and requires client catalog refresh. Omit to preserve the saved profile, or use full if none is saved. Restart the client after changing it.
|
||||
--all-detected Configure every detected supported agent
|
||||
--skill Override the bundled skill included with agent integrations
|
||||
--dry-run Print the resolved plan without applying it
|
||||
--accessible Use sequential accessible setup prompts
|
||||
|
||||
Custom Global Options:
|
||||
--timings Write measured command timing to stderr.
|
||||
|
||||
Global Options:
|
||||
--filter-output <keys> Filter output by key paths (e.g. foo,bar.baz,a[0,3])
|
||||
--format <toon|json|yaml|md|jsonl> Output format
|
||||
--full-output Show full output envelope
|
||||
--help Show help
|
||||
--llms, --llms-full Print LLM-readable manifest
|
||||
--schema Show JSON Schema for command
|
||||
--token-count Print token count of output (instead of output)
|
||||
--token-limit <n> Limit output to n tokens
|
||||
--token-offset <n> Skip first n tokens of output
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
$ rea mcp add --help
|
||||
exit: 0
|
||||
--- stdout
|
||||
rea mcp add — Register exact stdio launcher arguments in selected client settings, with backups and verified publication.
|
||||
|
||||
Usage: rea mcp add [options]
|
||||
|
||||
Options:
|
||||
--agent <array> Select client IDs or documented aliases; repeat --agent to select more than one.
|
||||
--command, -c <string> Stdio launcher text: space-separated words, single/double quote fragments, literal backslashes. Empty quoted arguments are preserved; NUL is rejected. HTTP(S) URL sources are unsupported; configure remote transports in client settings.
|
||||
--no-global Write only project-scoped client settings; reject selections requiring global writes.
|
||||
|
||||
No package acquisition or server execution. --no-global never writes global settings.
|
||||
|
||||
Global Options:
|
||||
--filter-output <keys> Filter output by key paths (e.g. foo,bar.baz,a[0,3])
|
||||
--format <toon|json|yaml|md|jsonl> Output format
|
||||
--full-output Show full output envelope
|
||||
--help Show help
|
||||
--llms, --llms-full Print LLM-readable manifest
|
||||
--schema Show JSON Schema for command
|
||||
--token-count Print token count of output (instead of output)
|
||||
--token-limit <n> Limit output to n tokens
|
||||
--token-offset <n> Skip first n tokens of output
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
$ rea mcp doctor --help
|
||||
exit: 0
|
||||
--- stdout
|
||||
rea mcp doctor — Validate MCP adapter startup and tool listing
|
||||
|
||||
Usage: rea mcp doctor [options]
|
||||
|
||||
Options:
|
||||
--format <toon|json|yaml|md|jsonl> Output format
|
||||
--json Emit the report as JSON
|
||||
--full-output Show the full output envelope
|
||||
--help, -h Show help
|
||||
|
||||
Checks this REA adapter using the current runtime; does not verify a client's registered command or launch environment. This entry accepts only the options above.
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
$ rea mcp --help
|
||||
exit: 0
|
||||
--- stdout
|
||||
rea mcp — Register as MCP server
|
||||
|
||||
Usage: rea mcp <command>
|
||||
|
||||
Commands:
|
||||
add Register as MCP server
|
||||
doctor Validate MCP server startup and tool listing
|
||||
|
||||
Global Options:
|
||||
--filter-output <keys> Filter output by key paths (e.g. foo,bar.baz,a[0,3])
|
||||
--format <toon|json|yaml|md|jsonl> Output format
|
||||
--full-output Show full output envelope
|
||||
--help Show help
|
||||
--llms, --llms-full Print LLM-readable manifest
|
||||
--schema Show JSON Schema for command
|
||||
--token-count Print token count of output (instead of output)
|
||||
--token-limit <n> Limit output to n tokens
|
||||
--token-offset <n> Skip first n tokens of output
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
$ rea
|
||||
exit: 0
|
||||
--- stdout
|
||||
rea@<version> — Reverse engineer anything from your terminal or agent.
|
||||
|
||||
Usage: rea <command>
|
||||
|
||||
Commands:
|
||||
address-to-file-offset Map one analysis address to a file offset; memory bytes may differ and ranges may not be contiguous
|
||||
<registered command rows elided>
|
||||
build-reconstruction-obligation-ledger Generate a deterministic Evidence-backed reconstruction obligation ledger page
|
||||
<registered command rows elided>
|
||||
decompile Read one part of an app as code. Supply at least one of the positional address or --procedure. Alternatively, use --file-offset alone. Equal positional and --procedure values are accepted; conflicts fail. With Ghidra, a space-qualified address such as ram:0x... avoids file-offset fallback; inspect-native-load-image reports the observed default space.
|
||||
<registered command rows elided>
|
||||
inspect-byte-entropy Inspect file-wide and block byte entropy without executing the file
|
||||
<registered command rows elided>
|
||||
setup Configure agent integrations and optional analysis providers
|
||||
<registered command rows elided>
|
||||
xrefs List bounded, untyped references to an analyzed address. For typed incoming references, use inspect-native-instruction at the target address where supported. Supply at least one of the positional address or --address. Equal values are accepted; conflicts fail.
|
||||
|
||||
Integrations:
|
||||
completions Generate shell completion script
|
||||
mcp Register as MCP server (add, doctor)
|
||||
|
||||
Custom Global Options:
|
||||
--timings Write measured command timing to stderr.
|
||||
|
||||
Global Options:
|
||||
--filter-output <keys> Filter output by key paths (e.g. foo,bar.baz,a[0,3])
|
||||
--format <toon|json|yaml|md|jsonl> Output format
|
||||
--full-output Show full output envelope
|
||||
--help Show help
|
||||
--llms, --llms-full Print LLM-readable manifest
|
||||
--mcp Start as MCP stdio server
|
||||
--schema Show JSON Schema for command
|
||||
--token-count Print token count of output (instead of output)
|
||||
--token-limit <n> Limit output to n tokens
|
||||
--token-offset <n> Skip first n tokens of output
|
||||
--update Update to latest version
|
||||
--version Show version
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
$ rea -h
|
||||
exit: 0
|
||||
--- stdout
|
||||
rea@<version> — Reverse engineer anything from your terminal or agent.
|
||||
|
||||
Usage: rea <command>
|
||||
|
||||
Commands:
|
||||
address-to-file-offset Map one analysis address to a file offset; memory bytes may differ and ranges may not be contiguous
|
||||
<registered command rows elided>
|
||||
build-reconstruction-obligation-ledger Generate a deterministic Evidence-backed reconstruction obligation ledger page
|
||||
<registered command rows elided>
|
||||
decompile Read one part of an app as code. Supply at least one of the positional address or --procedure. Alternatively, use --file-offset alone. Equal positional and --procedure values are accepted; conflicts fail. With Ghidra, a space-qualified address such as ram:0x... avoids file-offset fallback; inspect-native-load-image reports the observed default space.
|
||||
<registered command rows elided>
|
||||
inspect-byte-entropy Inspect file-wide and block byte entropy without executing the file
|
||||
<registered command rows elided>
|
||||
setup Configure agent integrations and optional analysis providers
|
||||
<registered command rows elided>
|
||||
xrefs List bounded, untyped references to an analyzed address. For typed incoming references, use inspect-native-instruction at the target address where supported. Supply at least one of the positional address or --address. Equal values are accepted; conflicts fail.
|
||||
|
||||
Integrations:
|
||||
completions Generate shell completion script
|
||||
mcp Register as MCP server (add, doctor)
|
||||
|
||||
Custom Global Options:
|
||||
--timings Write measured command timing to stderr.
|
||||
|
||||
Global Options:
|
||||
--filter-output <keys> Filter output by key paths (e.g. foo,bar.baz,a[0,3])
|
||||
--format <toon|json|yaml|md|jsonl> Output format
|
||||
--full-output Show full output envelope
|
||||
--help Show help
|
||||
--llms, --llms-full Print LLM-readable manifest
|
||||
--mcp Start as MCP stdio server
|
||||
--schema Show JSON Schema for command
|
||||
--token-count Print token count of output (instead of output)
|
||||
--token-limit <n> Limit output to n tokens
|
||||
--token-offset <n> Skip first n tokens of output
|
||||
--update Update to latest version
|
||||
--version Show version
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,43 @@
|
||||
$ rea --help --format json
|
||||
exit: 0
|
||||
--- stdout
|
||||
rea@<version> — Reverse engineer anything from your terminal or agent.
|
||||
|
||||
Usage: rea <command>
|
||||
|
||||
Commands:
|
||||
address-to-file-offset Map one analysis address to a file offset; memory bytes may differ and ranges may not be contiguous
|
||||
<registered command rows elided>
|
||||
build-reconstruction-obligation-ledger Generate a deterministic Evidence-backed reconstruction obligation ledger page
|
||||
<registered command rows elided>
|
||||
decompile Read one part of an app as code. Supply at least one of the positional address or --procedure. Alternatively, use --file-offset alone. Equal positional and --procedure values are accepted; conflicts fail. With Ghidra, a space-qualified address such as ram:0x... avoids file-offset fallback; inspect-native-load-image reports the observed default space.
|
||||
<registered command rows elided>
|
||||
inspect-byte-entropy Inspect file-wide and block byte entropy without executing the file
|
||||
<registered command rows elided>
|
||||
setup Configure agent integrations and optional analysis providers
|
||||
<registered command rows elided>
|
||||
xrefs List bounded, untyped references to an analyzed address. For typed incoming references, use inspect-native-instruction at the target address where supported. Supply at least one of the positional address or --address. Equal values are accepted; conflicts fail.
|
||||
|
||||
Integrations:
|
||||
completions Generate shell completion script
|
||||
mcp Register as MCP server (add, doctor)
|
||||
|
||||
Custom Global Options:
|
||||
--timings Write measured command timing to stderr.
|
||||
|
||||
Global Options:
|
||||
--filter-output <keys> Filter output by key paths (e.g. foo,bar.baz,a[0,3])
|
||||
--format <toon|json|yaml|md|jsonl> Output format
|
||||
--full-output Show full output envelope
|
||||
--help Show help
|
||||
--llms, --llms-full Print LLM-readable manifest
|
||||
--mcp Start as MCP stdio server
|
||||
--schema Show JSON Schema for command
|
||||
--token-count Print token count of output (instead of output)
|
||||
--token-limit <n> Limit output to n tokens
|
||||
--token-offset <n> Skip first n tokens of output
|
||||
--update Update to latest version
|
||||
--version Show version
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
$ rea --help
|
||||
exit: 0
|
||||
--- stdout
|
||||
rea@<version> — Reverse engineer anything from your terminal or agent.
|
||||
|
||||
Usage: rea <command>
|
||||
|
||||
Commands:
|
||||
address-to-file-offset Map one analysis address to a file offset; memory bytes may differ and ranges may not be contiguous
|
||||
<registered command rows elided>
|
||||
build-reconstruction-obligation-ledger Generate a deterministic Evidence-backed reconstruction obligation ledger page
|
||||
<registered command rows elided>
|
||||
decompile Read one part of an app as code. Supply at least one of the positional address or --procedure. Alternatively, use --file-offset alone. Equal positional and --procedure values are accepted; conflicts fail. With Ghidra, a space-qualified address such as ram:0x... avoids file-offset fallback; inspect-native-load-image reports the observed default space.
|
||||
<registered command rows elided>
|
||||
inspect-byte-entropy Inspect file-wide and block byte entropy without executing the file
|
||||
<registered command rows elided>
|
||||
setup Configure agent integrations and optional analysis providers
|
||||
<registered command rows elided>
|
||||
xrefs List bounded, untyped references to an analyzed address. For typed incoming references, use inspect-native-instruction at the target address where supported. Supply at least one of the positional address or --address. Equal values are accepted; conflicts fail.
|
||||
|
||||
Integrations:
|
||||
completions Generate shell completion script
|
||||
mcp Register as MCP server (add, doctor)
|
||||
|
||||
Custom Global Options:
|
||||
--timings Write measured command timing to stderr.
|
||||
|
||||
Global Options:
|
||||
--filter-output <keys> Filter output by key paths (e.g. foo,bar.baz,a[0,3])
|
||||
--format <toon|json|yaml|md|jsonl> Output format
|
||||
--full-output Show full output envelope
|
||||
--help Show help
|
||||
--llms, --llms-full Print LLM-readable manifest
|
||||
--mcp Start as MCP stdio server
|
||||
--schema Show JSON Schema for command
|
||||
--token-count Print token count of output (instead of output)
|
||||
--token-limit <n> Limit output to n tokens
|
||||
--token-offset <n> Skip first n tokens of output
|
||||
--update Update to latest version
|
||||
--version Show version
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
$ rea update --help
|
||||
exit: 0
|
||||
--- stdout
|
||||
rea update — Update this REA installation and verify the installed release
|
||||
|
||||
Usage: rea update
|
||||
|
||||
Custom Global Options:
|
||||
--timings Write measured command timing to stderr.
|
||||
|
||||
Global Options:
|
||||
--filter-output <keys> Filter output by key paths (e.g. foo,bar.baz,a[0,3])
|
||||
--format <toon|json|yaml|md|jsonl> Output format
|
||||
--full-output Show full output envelope
|
||||
--help Show help
|
||||
--llms, --llms-full Print LLM-readable manifest
|
||||
--schema Show JSON Schema for command
|
||||
--token-count Print token count of output (instead of output)
|
||||
--token-limit <n> Limit output to n tokens
|
||||
--token-offset <n> Skip first n tokens of output
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
$ rea inspect-byte-entropy --llms
|
||||
exit: 0
|
||||
--- stdout
|
||||
# rea
|
||||
|
||||
Reverse engineer anything from your terminal or agent.
|
||||
|
||||
| Command | Description |
|
||||
|---------|-------------|
|
||||
| `rea inspect-byte-entropy <path>` | Inspect file-wide and block byte entropy without executing the file |
|
||||
|
||||
Run `rea --llms-full` for full manifest. Run `rea <command> --schema` for argument details.
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
$ rea inspect-byte-entropy --llms-full
|
||||
exit: 0
|
||||
--- stdout
|
||||
# rea inspect-byte-entropy
|
||||
|
||||
Inspect file-wide and block byte entropy without executing the file
|
||||
|
||||
## Arguments
|
||||
|
||||
| Name | Type | Required | Description |
|
||||
|------|------|----------|-------------|
|
||||
| `path` | `string` | yes | Local file |
|
||||
|
||||
## Options
|
||||
|
||||
| Flag | Type | Default | Description |
|
||||
|------|------|---------|-------------|
|
||||
| `--blockSize` | `unknown` | `4096` | Power-of-two block size from 256 to 65536 bytes |
|
||||
| `--offset` | `unknown` | `0` | Window start as a decimal file byte offset |
|
||||
| `--length` | `unknown` | | Window length in bytes; omit to extend through EOF |
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
$ rea inspect-byte-entropy <workspace>/sample.bin --filter-output normalized_result.blocks --columns offset,length,entropy --format csv
|
||||
exit: 0
|
||||
--- stdout
|
||||
# rea-delimited-v1 {"version":1,"format":"csv","command":"inspect-byte-entropy","duration":"<ms>ms","selected_path":["normalized_result","blocks"],"coverage":null,"source_coverage":null,"source_complete":null,"view":null,"limitations":["Entropy does not prove encryption; compressed and encrypted bytes cannot be distinguished by this measure.","Entropy is rounded to four decimal places; thresholds classify those reported values. Small blocks can underestimate entropy.","The file-wide hash and entropy cover the entire file; blocks and runs cover only the selected window. Empty input has entropy 0 by convention."],"unknowns":null,"provenance":{},"pagination":{}}<0x0d>
|
||||
offset,length,entropy<0x0d>
|
||||
0,20,4.3219<0x0d>
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,7 @@
|
||||
$ rea inspect-byte-entropy <workspace>/sample.bin --filter-output normalized_result.window --full-output --json
|
||||
exit: 0
|
||||
--- stdout
|
||||
{"ok":true,"data":{"normalized_result":{"window":{"offset":0,"length":20}}},"meta":{"command":"inspect-byte-entropy","duration":"<ms>ms"}}
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,15 @@
|
||||
$ rea inspect-byte-entropy <workspace>/sample.bin --filter-output normalized_result.window --full-output
|
||||
exit: 0
|
||||
--- stdout
|
||||
ok: true
|
||||
data:
|
||||
normalized_result:
|
||||
window:
|
||||
offset: 0
|
||||
length: 20
|
||||
meta:
|
||||
command: inspect-byte-entropy
|
||||
duration: <ms>ms
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,7 @@
|
||||
$ rea inspect-byte-entropy <workspace>/sample.bin --filter-output=normalized_result.window,normalized_result.blocks,normalized_result.thresholds --format=json
|
||||
exit: 0
|
||||
--- stdout
|
||||
{"normalized_result":{"blocks":[{"offset":0,"length":20,"entropy":4.3219}],"thresholds":{"high":7.2,"low":1},"window":{"offset":0,"length":20}}}
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,7 @@
|
||||
$ rea inspect-byte-entropy <workspace>/sample.bin --filter-output normalized_result.window,normalized_result.blocks,normalized_result.thresholds --json
|
||||
exit: 0
|
||||
--- stdout
|
||||
{"normalized_result":{"blocks":[{"offset":0,"length":20,"entropy":4.3219}],"thresholds":{"high":7.2,"low":1},"window":{"offset":0,"length":20}}}
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
$ rea inspect-byte-entropy <workspace>/sample.bin --filter-output normalized_result.window,normalized_result.blocks,normalized_result.thresholds --format json
|
||||
exit: 0
|
||||
--- stdout
|
||||
{"normalized_result":{"blocks":[{"offset":0,"length":20,"entropy":4.3219}],"thresholds":{"high":7.2,"low":1},"window":{"offset":0,"length":20}}}
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
$ rea inspect-byte-entropy <workspace>/sample.bin --filter-output normalized_result.window,normalized_result.blocks,normalized_result.thresholds --format md
|
||||
exit: 0
|
||||
--- stdout
|
||||
## normalized_result.blocks
|
||||
|
||||
| offset | length | entropy |
|
||||
|--------|--------|---------|
|
||||
| 0 | 20 | 4.3219 |
|
||||
|
||||
## normalized_result.thresholds
|
||||
|
||||
| Key | Value |
|
||||
|------|-------|
|
||||
| high | 7.2 |
|
||||
| low | 1 |
|
||||
|
||||
## normalized_result.window
|
||||
|
||||
| Key | Value |
|
||||
|--------|-------|
|
||||
| offset | 0 |
|
||||
| length | 20 |
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
$ rea inspect-byte-entropy <workspace>/sample.bin --filter-output normalized_result.window --timings
|
||||
exit: 0
|
||||
--- stdout
|
||||
normalized_result:
|
||||
window:
|
||||
offset: 0
|
||||
length: 20
|
||||
<end>
|
||||
--- stderr
|
||||
{"rea_timings":{"version":1,"command_ms":<ms>}}
|
||||
<end>
|
||||
@@ -0,0 +1,7 @@
|
||||
$ rea inspect-byte-entropy <workspace>/sample.bin --filter-output normalized_result.window --token-count
|
||||
exit: 0
|
||||
--- stdout
|
||||
13
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,8 @@
|
||||
$ rea inspect-byte-entropy <workspace>/sample.bin --filter-output normalized_result.window,normalized_result.blocks,normalized_result.thresholds --token-limit 5
|
||||
exit: 0
|
||||
--- stdout
|
||||
normalized_result:
|
||||
[truncated: showing tokens 0–5 of 42]
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,9 @@
|
||||
$ rea inspect-byte-entropy <workspace>/sample.bin --filter-output normalized_result.window,normalized_result.blocks,normalized_result.thresholds --token-limit 5 --token-offset 5
|
||||
exit: 0
|
||||
--- stdout
|
||||
|
||||
blocks[1]{offset
|
||||
[truncated: showing tokens 5–10 of 42]
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
$ rea inspect-byte-entropy <workspace>/sample.bin --filter-output normalized_result.window,normalized_result.blocks,normalized_result.thresholds
|
||||
exit: 0
|
||||
--- stdout
|
||||
normalized_result:
|
||||
blocks[1]{offset,length,entropy}:
|
||||
0,20,4.3219
|
||||
thresholds:
|
||||
high: 7.2
|
||||
low: 1
|
||||
window:
|
||||
offset: 0
|
||||
length: 20
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
$ rea inspect-byte-entropy <workspace>/sample.bin --filter-output normalized_result.blocks --columns offset,entropy --format tsv
|
||||
exit: 0
|
||||
--- stdout
|
||||
# rea-delimited-v1 {"version":1,"format":"tsv","command":"inspect-byte-entropy","duration":"<ms>ms","selected_path":["normalized_result","blocks"],"coverage":null,"source_coverage":null,"source_complete":null,"view":null,"limitations":["Entropy does not prove encryption; compressed and encrypted bytes cannot be distinguished by this measure.","Entropy is rounded to four decimal places; thresholds classify those reported values. Small blocks can underestimate entropy.","The file-wide hash and entropy cover the entire file; blocks and runs cover only the selected window. Empty input has entropy 0 by convention."],"unknowns":null,"provenance":{},"pagination":{}}
|
||||
offset entropy
|
||||
0 4.3219
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
$ rea inspect-byte-entropy <workspace>/sample.bin --filter-output normalized_result.window,normalized_result.blocks,normalized_result.thresholds --format yaml
|
||||
exit: 0
|
||||
--- stdout
|
||||
normalized_result:
|
||||
blocks:
|
||||
- offset: 0
|
||||
length: 20
|
||||
entropy: 4.3219
|
||||
thresholds:
|
||||
high: 7.2
|
||||
low: 1
|
||||
window:
|
||||
offset: 0
|
||||
length: 20
|
||||
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,7 @@
|
||||
$ rea inspect-byte-entropy --schema --format json
|
||||
exit: 0
|
||||
--- stdout
|
||||
{"args":{"type":"object","properties":{"path":{"type":"string","minLength":1,"pattern":"^[^\\x00]*$","description":"Local file"}},"required":["path"],"additionalProperties":false},"options":{"type":"object","properties":{"blockSize":{"default":4096,"anyOf":[{"type":"integer","minimum":256,"maximum":65536},{"type":"string","pattern":"^[0-9]+$"}],"description":"Power-of-two block size from 256 to 65536 bytes"},"offset":{"default":0,"anyOf":[{"type":"integer","minimum":0,"maximum":9007199254740991},{"type":"string","pattern":"^[0-9]+$"}],"description":"Window start as a decimal file byte offset"},"length":{"anyOf":[{"type":"integer","minimum":0,"maximum":9007199254740991},{"type":"string","pattern":"^[0-9]+$"}],"description":"Window length in bytes; omit to extend through EOF"}},"additionalProperties":false},"globals":{"type":"object","properties":{"timings":{"default":false,"description":"Write measured command timing to stderr.","type":"boolean"}},"required":["timings"],"additionalProperties":false}}
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
$ rea inspect-byte-entropy --schema
|
||||
exit: 0
|
||||
--- stdout
|
||||
args:
|
||||
type: object
|
||||
properties:
|
||||
path:
|
||||
type: string
|
||||
minLength: 1
|
||||
pattern: "^[^\\x00]*$"
|
||||
description: Local file
|
||||
required[1]: path
|
||||
additionalProperties: false
|
||||
options:
|
||||
type: object
|
||||
properties:
|
||||
blockSize:
|
||||
default: 4096
|
||||
anyOf[2]:
|
||||
- type: integer
|
||||
minimum: 256
|
||||
maximum: 65536
|
||||
- type: string
|
||||
pattern: "^[0-9]+$"
|
||||
description: Power-of-two block size from 256 to 65536 bytes
|
||||
offset:
|
||||
default: 0
|
||||
anyOf[2]:
|
||||
- type: integer
|
||||
minimum: 0
|
||||
maximum: 9007199254740991
|
||||
- type: string
|
||||
pattern: "^[0-9]+$"
|
||||
description: Window start as a decimal file byte offset
|
||||
length:
|
||||
anyOf[2]:
|
||||
- type: integer
|
||||
minimum: 0
|
||||
maximum: 9007199254740991
|
||||
- type: string
|
||||
pattern: "^[0-9]+$"
|
||||
description: Window length in bytes; omit to extend through EOF
|
||||
additionalProperties: false
|
||||
globals:
|
||||
type: object
|
||||
properties:
|
||||
timings:
|
||||
default: false
|
||||
description: Write measured command timing to stderr.
|
||||
type: boolean
|
||||
required[1]: timings
|
||||
additionalProperties: false
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
@@ -0,0 +1,7 @@
|
||||
$ rea inspect-byte-entropy --version
|
||||
exit: 0
|
||||
--- stdout
|
||||
<version>
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
$ rea --version
|
||||
exit: 0
|
||||
--- stdout
|
||||
<version>
|
||||
<end>
|
||||
--- stderr
|
||||
<end>
|
||||
Reference in new issue
Block a user