mirror of
https://github.com/morluto/rea.git
synced 2026-12-03 21:46:01 +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>
29 lines
813 B
TypeScript
29 lines
813 B
TypeScript
import { Writable } from "node:stream";
|
|
|
|
import type { CliServeOptions } from "./types.js";
|
|
|
|
/**
|
|
* Where one invocation writes its result document. A callback owns captured
|
|
* output and keeps the process terminal's presentation; otherwise the process
|
|
* owns stdout directly.
|
|
*/
|
|
export const cliResultDestination = (
|
|
stdout: CliServeOptions["stdout"],
|
|
): Writable => {
|
|
if (stdout === undefined) return process.stdout;
|
|
const destination = new Writable({
|
|
write(chunk: Buffer, _encoding, done) {
|
|
try {
|
|
stdout(chunk.toString("utf8"));
|
|
done();
|
|
} catch (cause) {
|
|
done(cause instanceof Error ? cause : new Error(String(cause)));
|
|
}
|
|
},
|
|
});
|
|
Object.defineProperty(destination, "isTTY", {
|
|
value: process.stdout.isTTY === true,
|
|
});
|
|
return destination;
|
|
};
|