Files
reverse-engineering-anything/tests/acceptance/cliTerminalNotices.test.ts
T
Ysopwnableandgensokyo-dev 62014b566d refactor(cli)!: dispatch commands through REA-owned execution
Run ordinary CLI commands through REA's registry, argv parser and result owner.
Remove Incur, the second admission parse, SDK error middleware, output capture
and redundant command traversal. Preserve explicit redaction, publication
receipts, incremental output, terminal notice eligibility and drain ownership.
Migrate fixtures to real registrations and retain the derived-source notices.

Validation includes unchanged public parity goldens, public and lifecycle
regressions, repaired fixture consumers, real TTY base comparisons, exports
beyond the engine string limit, four schema catalogs and final static/docs
checks. Native provider and optional validator coverage limits are in the PR.

Fixes #11654. Fixes #10583. Refs #11682, #11476 and #10511.

BREAKING CHANGE: Markdown argument diagnostics use REA's literal escaping,
table widths and token counts. Flag-shaped unknown MCP subcommands honor the
selected format. Completion --schema/--version routes use the canonical
REA-owned hook rather than the retired SDK generator. Refresh affected literal
snapshots and regenerate completion hooks with rea completions <shell>.

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
2026-11-16 13:56:34 +00:00

57 lines
2.0 KiB
TypeScript

import { expect } from "vitest";
import { PRODUCT_IDENTITY } from "../../src/identity.js";
import { workspaceCliTest } from "../support/cli/workspaceCliFixture.js";
workspaceCliTest.skipIf(process.platform === "win32")(
"keeps terminal update notices outside selected result documents",
async ({ cli, workspace }) => {
await workspace.write("sample.bin", Buffer.from("notice fixture"));
await workspace.write(
`cache/incur/updates/${PRODUCT_IDENTITY.packageName}.json`,
JSON.stringify({ checkedAt: Date.now(), latest: "999.0.0" }),
);
const environment = {
...workspace.environment,
XDG_CACHE_HOME: workspace.path("cache"),
npm_config_registry: "http://127.0.0.1:9/",
};
const run = async (
arguments_: readonly string[],
stderrContains?: string,
) => {
const result = await cli.run({
arguments: arguments_,
cwd: workspace.root,
environment,
terminal: true,
});
expect(result.exitCode, result.stderr).toBe(0);
if (stderrContains === undefined) expect(result.stderr).toBe("");
else expect(result.stderr).toContain(stderrContains);
return result.stdout;
};
const entropy = ["inspect-byte-entropy", workspace.path("sample.bin")];
const notice = "Update available for rea-agents:";
expect(await run(entropy)).toContain(notice);
expect(await run([...entropy, "--full-output"])).toContain(notice);
for (const flags of [[], ["--full-output"], ["--token-limit", "10"]]) {
const output = await run([
...entropy,
"--filter-output",
"normalized_result.window",
...flags,
]);
expect(output).toContain("offset");
expect(output).not.toContain(notice);
}
// Suppressed agent-only output leaves the terminal notice visible.
expect(
await run(
["setup", "--dry-run", "--client", "codex", "--token-limit", "1"],
"Dry run complete. No changes were made.",
),
).toContain(notice);
},
);