Restores src/core/runner.rs to the develop state. After a5e6bf5 moved
npx execution into npm_cmd::exec (routing through runner::run_filtered),
nothing calls run_passthrough_cmd anymore.
Addresses review feedback on PR #1458.
Per @KuSh's review on #1458, the generic npx passthrough arm built
its own Command + tracking::TimedExecution inline, duplicating the
logic already covered by core::runner::run_passthrough. The sticking
point was `SKIP_ENV_VALIDATION`: the existing helper takes tool +
args and builds the Command itself, so there was no seam for a
caller-supplied env var.
Add a `run_passthrough_cmd` variant that accepts a pre-built Command
and refactor the existing `run_passthrough` to delegate to it. The
npx arm now builds a Command, sets SKIP_ENV_VALIDATION when
requested, and hands it to the shared helper. This also upgrades the
npx passthrough from a raw `cmd.status()` to the shared streaming +
tracking path that pnpm_cmd already uses, so verbose logging and
telemetry stay consistent across tools.
- grep: use --no-ignore-vcs so .gitignore'd files aren't silently skipped
(matches grep -r behavior, avoids false negatives in large monorepos)
- grep: passthrough raw output for <=50 matches so AI agents can parse
standard file:line:content format without retry loops
- filter: replace smart_truncate heuristic with clean first-N-lines truncation
and a single [X more lines] suffix (eliminates synthetic // ... markers
that AI agents misread as code, causing parsing confusion and retries)
- P0: non-terminal `rtk init` no longer writes consent_given=false leaves consent as None so next interactive run prompts normally
- P1: maybe_ping() loads Config once instead of twice per command
- pipe_cmd: fix panic on multi-byte UTF-8 at 1024 byte boundary (floor_char_boundary in auto_detect_filter)
- pipe_cmd: cap stdin at 10 MiB to prevent OOM (reuses RAW_CAP)
- stream: hoist RAW_CAP to pub const at module level
- hook_cmd: check deny before get_rewritten in handle_vscode
(matches handle_copilot_cli and run_claude order)
- hook_cmd: escape backslash and pipe in audit log sanitizer
- tsc_cmd: hoist duplicate TSC_ERROR regex to single module-level
lazy_static
P0 fixes:
- top_passthrough: GROUP BY first word only, not full command args (privacy leak)
- build_meta_usage: use dedicated count query instead of scanning deduplicated top list (was always returning 0 or 1)
P1 fixes:
- Single Tracker connection per ping (was opening 2 SQLite connections)
- first_seen_days: propagate DB errors instead of unwrap_or(None)
- ecosystem_mix: bound to 90 days instead of full table scan
- avg_savings_per_command: compute per-command mean, not per-row mean
- estimated_savings_usd_30d: use $3/Mtok (Sonnet input rate) not $5/Mtok
Signed-off-by: Patrick Szymkowiak <patrick@rtk-ai.app>
Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>
&raw[..max_file_size] panics if the byte offset falls inside a
multi-byte UTF-8 character (e.g. Japanese, emoji). Now finds the
nearest char boundary before slicing.
Ref: issue #640 (L-3 finding)
Signed-off-by: Patrick Szymkowiak <patrick@rtk-ai.app>
Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>
Tracker::new() uses a shared on-disk SQLite DB. Running reset_all()
in a parallel test suite wipes records inserted by other concurrent
tests, causing intermittent failures.
Add Tracker::new_in_memory() (cfg(test) only) backed by an isolated
Connection::open_in_memory(), and switch test_reset_all_clears_both_tables
to use it. Extracted init_schema() helper to avoid duplicating DDL.
https://claude.ai/code/session_015WXbDdxEU3pXPBtheDkXcd
- reset_all() now clears both `commands` and `parse_failures` atomically
via execute_batch (fixes incomplete reset reported by reviewer)
- Add [y/N] confirmation prompt before --reset; mirrors init.rs pattern
- Add --yes flag to skip prompt in scripts/CI
- Add unit test: test_reset_all_clears_both_tables verifies both tables
are empty after reset
https://claude.ai/code/session_015WXbDdxEU3pXPBtheDkXcd
Add 6 new fields to the anonymous daily telemetry ping to help identify
which commands need filters and which filters need improvement:
- passthrough_top: top 5 commands with 0% savings (missing filters)
- parse_failures_24h: count of parse failures (filter fragility)
- low_savings_commands: commands averaging <30% savings (weak filters)
- avg_savings_per_command: unweighted average savings
- hook_type: which AI agent hook is installed (claude/gemini/codex/etc)
- custom_toml_filters: count of user-defined TOML filter files
New tracking.rs queries: top_passthrough(), parse_failures_since(),
low_savings_commands(), avg_savings_per_command().
Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>
Adds `rtk gain --reset` to clear all token savings stats back to zero.
Implements `Tracker::reset_all()` in tracking.rs and wires the flag
through the Gain command args and gain::run().
https://claude.ai/code/session_015WXbDdxEU3pXPBtheDkXcd