mirror of
https://github.com/morluto/rea.git
synced 2026-11-17 04:04:25 +00:00
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>
34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
TypeScript
import { createCommandCli } from "../../support/cli/commandCli.js";
|
|
import { expect, it } from "vitest";
|
|
import { registerElectronCommands } from "../../../src/cli/electronCommands.js";
|
|
import { silentLogger } from "../../../src/logger.js";
|
|
|
|
const serve = async (argv: readonly string[]): Promise<unknown> => {
|
|
const cli = createCommandCli();
|
|
registerElectronCommands(cli, silentLogger, {});
|
|
let stdout = "";
|
|
await cli.serve([...argv, "--json"], {
|
|
env: {},
|
|
stdout: (text) => {
|
|
stdout += text;
|
|
},
|
|
exit: () => undefined,
|
|
});
|
|
return JSON.parse(stdout);
|
|
};
|
|
|
|
it("rejects an empty or NUL analyze-javascript-application path before analysis", async () => {
|
|
expect(await serve(["analyze-javascript-application", ""])).toMatchObject({
|
|
code: "VALIDATION_ERROR",
|
|
fieldErrors: [expect.objectContaining({ path: "path", code: "too_small" })],
|
|
});
|
|
expect(
|
|
await serve(["analyze-javascript-application", "target\x00name"]),
|
|
).toMatchObject({
|
|
code: "VALIDATION_ERROR",
|
|
fieldErrors: [
|
|
expect.objectContaining({ path: "path", code: "invalid_format" }),
|
|
],
|
|
});
|
|
});
|