mirror of
https://github.com/rtk-ai/rtk.git
synced 2026-09-19 07:33:17 +08:00
861a46dee5
RTK could emit more tokens than the underlying command on small inputs:
filters that add headers, summaries, re-indentation, or a tee hint, plus
synthetic no-result messages ("0 matches", "No stashes", "[docker] 0
containers") printed where the raw command emitted nothing. Both break the
Transparency principle and inflate tokens instead of saving them.
- core::guard::never_worse(raw, filtered) returns raw when the filtered form
has more tokens (reuses tracking::estimate_tokens), so RTK output is never
larger than the real command.
- runner::emit_guarded(filtered, hint, raw) composes body + tee hint, guards
the whole, prints, and returns what was shown so printed == tracked.
- run_captured_filter guards the run_filtered* family centrally; per-site
guards cover the remaining single-string filters.
- On empty raw, emit empty and preserve the exit code instead of a synthetic
no-result message (the messages were cosmetic with no dependents; #2461
reports the grep one as actively harmful).
- git stash show now propagates its exit code instead of masking a real
failure as Ok(0).
Resolves #2551.
.NET Ecosystem
Part of
src/cmds/— see also docs/contributing/TECHNICAL.md
Specifics
dotnet_cmd.rsusesDotnetCommandssub-enum in main.rs- Internal helper modules (
dotnet_trx.rs,dotnet_format_report.rs,binlog.rs) are only used bydotnet_cmd.rs-- they parse specialized .NET output formats (TRX XML, binary logs, format reports) - Test fixtures are in
tests/fixtures/dotnet/(JSON and text formats)