refactor(cli)!: own builtin refusals and retire per-command MCP

Own builtin refusal paths and Markdown schemas in REA. Reject retired per-command MCP before loading command registrars, preserve invoked identity, and apply token controls to the complete selected failure document.

BREAKING CHANGE: rea <command> --mcp is removed. Start REA's MCP server with rea mcp or rea --mcp.

Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
This commit is contained in:
Ysopwnableandgensokyo-dev authored and GitHub committed 2026-11-16 18:26:02 +08:00
1 parent d6bcfc10ea
commit 7d502ddb0d
18 files changed
+413 -50

No files matched your search

+5 -4
View File
@@ -22,8 +22,8 @@ const isRegistrationId = (id: string): id is CliCommandRegistrationId =>
/**
* The registrars the command these arguments run needs, or undefined when the
* complete CLI must answer, as it does for shell completion, which has no
* global arguments. A standalone `--version` needs none: Incur answers
* it from the CLI identity alone. Help, schemas, `--llms`, completions, other
* global arguments. A standalone version or retired per-command MCP query
* needs no registrar. Help, schemas, `--llms`, completions, other
* Incur builtins, unknown names ("did you mean"), and a missing or unusable
* recording all describe or search every command.
*/
@@ -33,6 +33,7 @@ export const selectCliRegistrations = (
): readonly CliCommandRegistrationId[] | undefined => {
if (global === undefined) return undefined;
const { command, flags } = global;
if (flags.has("--mcp") && command.length > 0) return [];
if (command.length === 0 && flags.size === 1 && flags.has("--version"))
return [];
if (recorded === undefined) return undefined;
@@ -54,8 +55,8 @@ export interface CliRuntime {
/**
* Load the command runtime for one invocation. A recorded top-level command
* loads only its registrar's module graph, a standalone version query loads
* none, and anything else loads the complete CLI.
* loads only its registrar's module graph. A standalone version or retired
* mode query loads none; anything else loads the complete CLI.
*/
export const loadCliRuntime = async (
global: CliGlobalArguments | undefined,