* feat(cli)!: keep over-budget CLI results recoverable by default
An over-budget CLI result without --evidence_output now saves its
complete Evidence to a private retained-Evidence cache under the user
cache directory and returns the summary with the file's path, size and
digest, so it pages with inspect-analysis-view without a rerun.
Files are named by the complete record's Evidence ID, created
exclusively as 0600 by the Evidence bundle writer in a 0700 directory
the user owns, reused by repeat runs and never overwritten. Each
retention removes records unused for 7 days, then the least recently
used over delivery.cli_retained_evidence_bytes (REA_CLI_RETAINED_EVIDENCE_BYTES,
default 256 MiB). --no-retain or a 0 setting writes nothing; a record
that cannot be kept falls back to the rerun arguments with the reason.
Fixes#14594
BREAKING CHANGE: An over-budget CLI result without --evidence_output is
now saved to REA's private retained-Evidence cache and reported as
{summary, evidence_bundle, delivery} with delivery.retained cache-file,
instead of writing nothing. Pass --no-retain, or set
REA_CLI_RETAINED_EVIDENCE_BYTES=0, to write nothing as before.
* fix(cli): key retained Evidence by its content and keep its owner's facts
Review fixes for default CLI retention:
- Name files by the SHA-256 of the complete record's exact JSON, since
the Evidence ID leaves out caller paths; report it as
evidence_bundle.sha256.
- Remove a bundle that outgrows the cache after the write.
- Renew a record's age when inspect-analysis-view reads it.
- Re-check a record's use time before evicting it.
- Never use a cache whose path holds a value marked sensitive, and
redact retention failure reasons.
- Report a save that committed but then failed with its receipt and
cleanup owner, as --evidence_output does.
- Request source records whenever the cache may receive a bundle.
- Refresh the advertised-schema summaries for the new setting.
* fix(cli): withdraw the receipt of a bundle the cache discards
A bundle that outgrew the cache was removed after the writer had already
recorded its publication receipt, so output recovery could name a
missing file. Retention now withdraws that receipt whenever it keeps
nothing, unless the file committed and its failure is reported.
* fix(cli): retain publication receipt when removing an oversized retained bundle fails
* refactor(cli): render command help with REA's own help owner
Add src/cli/help.ts and move the three incur Help.formatCommand callers
(rea mcp add, rea mcp doctor, rea mcp --http) onto it. Option spelling and
the unwrapped field type move to src/cli/optionFields.ts, which completion
now reads instead of its own copies. A counted incur-import guard records
the names still imported from incur so the list can only shrink.
Refs #11654
* refactor(cli): share option spelling across CLI owners and count every incur import
The argv parser, strict positionals, contract command projection and the
command registry now read the flag spelling, declared field type and count
marker from src/cli/optionFields.ts instead of their own copies. The
incur-import guard also counts namespace, default, star, side-effect and
dynamic imports, so `import * as Incur from "incur"` cannot bring a removed
owner back.
* refactor(cli): format and filter CLI output without incur (#11684)
* refactor(cli): format and filter CLI output without incur
formatCliOutput encodes TOON (@toon-format/toon), JSON, YAML and JSON Lines
itself instead of calling incur's Formatter; YAML still loads on first use.
src/cli/outputFilter.ts owns the --filter-output grammar and returns a
Result: an unclosed slice is a parse failure, so output validation reads
the parser instead of a second bracket scanner, and the parsed paths
travel with the output arguments to the result writer and JSON Lines.
@toon-format/toon moves from devDependencies to dependencies because REA
now imports it at runtime.
Refs #11654
* test(cli): pin output encodings and filter grammar with literal cases
Literal expected outputs for empty values, TOON scalars, objects and rows,
JSON-text re-indentation, nested BigInt values, JSON Lines rows and YAML,
and literal parsed paths and unclosed-slice refusals for --filter-output,
so a change to either owner fails without comparing against itself.