mirror of
https://github.com/morluto/rea.git
synced 2026-11-29 01:46:39 +00:00
* fix(cli): reject invalid inline values and honor requested output on terminals - Reject inline boolean and empty number values the schema cannot accept instead of coercing --skill=yes to false or --limit= to 0. - Give captured mcp add output the terminal presentation of every other command through one shared result destination. - Show the unapproved setup plan whose remediation asks a terminal reader to review it, and open the setup rail once when a scoped run starts at approval. - Treat --full-output and --token-count as requesting the result document, so setup and argument errors no longer add terminal presentation beside it. - Answer --schema for an unknown command in the selected format, and set the exit code instead of exiting so piped stdout drains. * fix(cli): keep rejected boolean and number literals across repeated flags Binding stored one scalar value, so a later valid flag replaced an earlier literal before the schema could reject it. Boolean and number literals the field rejects now stay bound, including decimal unions and count options, while repeated valid flags still use the last value. --dry-run keeps its own error. * test(cli): assert the terminal full-output failure envelope The terminal --full-output regression only checked that usage text was absent. Decode the default document and the --json envelope and require VALIDATION_ERROR with the skill field's invalid_type error. * test(cli): accept a counted setup approval prompt A scoped terminal plan names every eligible action, so a Linux host that can install Hopper asks "Apply these N changes?" rather than the singular question. The consent helper now answers either prompt, and the rail test finds that question before checking the intro was rendered once. --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com>
33 lines
1.1 KiB
TypeScript
33 lines
1.1 KiB
TypeScript
import { afterEach, expect, it } from "vitest";
|
|
|
|
import { cliResultDestination } from "../../../src/cli/cliDestination.js";
|
|
|
|
const original = Object.getOwnPropertyDescriptor(process.stdout, "isTTY");
|
|
afterEach(() => {
|
|
if (original === undefined) Reflect.deleteProperty(process.stdout, "isTTY");
|
|
else Object.defineProperty(process.stdout, "isTTY", original);
|
|
});
|
|
|
|
it.each([true, false])(
|
|
"keeps the terminal presentation (isTTY %s) for captured output",
|
|
async (tty) => {
|
|
Object.defineProperty(process.stdout, "isTTY", {
|
|
value: tty,
|
|
configurable: true,
|
|
});
|
|
const written: string[] = [];
|
|
const destination = cliResultDestination((text) => written.push(text));
|
|
expect((destination as { isTTY?: boolean }).isTTY).toBe(tty);
|
|
await new Promise<void>((resolve, reject) =>
|
|
destination.write("document", (cause) =>
|
|
cause == null ? resolve() : reject(cause),
|
|
),
|
|
);
|
|
expect(written).toEqual(["document"]);
|
|
},
|
|
);
|
|
|
|
it("writes to the process stream when nothing captures output", () => {
|
|
expect(cliResultDestination(undefined)).toBe(process.stdout);
|
|
});
|