Commit Graph

65 Commits

Author SHA1 Message Date
aesoft 1b3cd06f3d refacto(crate): split into lib + bin for downstream bundling 2026-05-03 18:26:19 +02:00
aesoft d327724f81 fix(stream): add semgrep flag for sh tests 2026-04-29 13:01:50 +02:00
aesoft 81a1be6a74 fix(stream): route to respective fd 2026-04-28 18:58:56 +02:00
Trevin Chow 2ad1579329 refactor(runner): drop unused run_passthrough_cmd helper
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.
2026-04-26 02:16:06 +02:00
Trevin Chow 4d5c2fc8a8 refactor(npx): use shared runner::run_passthrough_cmd helper
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.
2026-04-26 02:16:06 +02:00
aesoft 70b36b4dbc fix(tracking): test env path 2026-04-24 19:37:18 +02:00
aesoft 7681dafc76 fix(cicd):: no semgrep alert on sh call cicd 2026-04-24 19:04:51 +02:00
aesoft 88d9f6a0d9 fix(filters): benchmark ci update + fix stream filter quality 2026-04-24 18:54:29 +02:00
aesoft de415335ea Merge pull request #791 from BadassBison/fix/grep-false-negatives-and-truncation-annotations
fix: grep false negatives, output mangling, and truncation annotations
2026-04-22 19:49:03 +02:00
aesoft e3149cb7fb Merge pull request #1056 from vzwjustin/develop
feat(gains): add --reset flag
2026-04-21 19:00:59 +02:00
aesoft a1d46f39c2 fix(stream): missing stderr fields 2026-04-16 20:39:01 +02:00
aesoft e92d0993c9 fix(runner): preserve fd separation on command failure 2026-04-16 20:27:13 +02:00
Shawn Scott 9bdf435e8d fix: grep false negatives, output mangling, and truncation annotations
- 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)
2026-04-16 06:44:15 -07:00
aesoft d34389c3d0 fix: P0+P1 fixes from pre-merge review of hook engine
- runner: print captured output on non-zero exit (P0.1)
- main: add hook/pipe to META_COMMANDS (P0.2)
- init: store integrity hash after Gemini script install (P0.3)
- hook_cmd: audit log + permission check for all agent paths (P1.1, P1.2)
- runner: include failure_lines in cargo test summary (P1.5)
- Cargo.toml: remove unconditional libc dep (P1.7)
- init: clean stale settings.json entries during migration (P1.8)
2026-04-16 15:41:20 +02:00
aesoft 906dedd75a Merge remote-tracking branch 'origin/develop' into feat-hook-engine 2026-04-13 21:14:55 +02:00
Florian BRUNIAUX b41be60dd7 Merge pull request #1072 from rtk-ai/fix/tee-utf8-panic 2026-04-13 10:18:35 +02:00
Florian BRUNIAUX e09a53e5f7 Merge pull request #1181 from rtk-ai/rgpd-telemetry 2026-04-13 09:26:46 +02:00
s2005 630f0a2800 Add liquibase TOML filter 2026-04-12 22:25:04 +02:00
aesoft 8156081261 fix(telemetry): clean code 2026-04-12 15:28:25 +02:00
aesoft 7821e9872f fix(telemetry): non-terminal consent, single config load
- 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
2026-04-12 15:05:58 +02:00
aesoft 2e4cc4bb52 fix(telemetry): consent, erasure, auth, docs 2026-04-12 12:59:22 +02:00
aesoft 840571fe90 fix(core): review 956 various fix
4 fixes applied (all confirmed introduced by PR #956, all tests pass):

- P0 NEW-passthrough — pipe_cmd.rs: passthrough before cap read
- P1 BUFFERED-panic — stream.rs: catch_unwind on Buffered filter
- P1 STREAM-postcap — stream.rs: stop feeding filter after cap
- P2 OFFBYONE-rawcap — stream.rs: 5 cap boundary checks fixed

5 findings dropped (not introduced by PR or not bugs):

- DENY-claude: pre-existing on master
- AUDIT-asymmetry: intentional scope choice, not a bug
- GEMINI-test: pre-existing test pattern from master
- SAVINGS-threshold: 40% is correct (filters achieve ~46%)
- STDERR-test: cosmetic CI, not correctness
2026-04-11 17:24:04 +02:00
aesoft aaf4d1d9fe Merge pull request #422 from KuSh/cleanup-warnings
chore: apply clippy suggestions
2026-04-11 12:08:40 +02:00
aesoft 6a5bc847e0 fix(telemetry): RGPD-compliant, consent gate, erasure, privacy controls
+ docs update
2026-04-10 16:04:08 +02:00
aesoft 71eeedab4d feat(stream): P1 fixes from PR #956 review
+ trigger feat release tag
2026-04-10 14:00:23 +02:00
aesoft 2bb5265595 fix(stream): P0 fixes from PR #956 review
- 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
2026-04-10 12:09:29 +02:00
aesoft b3936b8e5d fix(stream): stream engine & template + BlockHandler, RegexBlockFilter, signal guard, pipe rewrite 2026-04-09 20:39:30 +02:00
aesoft 644c50f786 Merge pull request #1001 from rtk-ai/feat/telemetry-enrichment
feat(telemetry): enrich daily ping with gap detection and quality metrics
2026-04-09 08:57:21 +02:00
Justin Adams 3f15b89227 Merge branch 'develop' into develop 2026-04-08 17:54:07 -05:00
Patrick szymkowiak be5c0576d9 fix(docs): update TELEMETRY.md to match code after review fixes
- passthrough_top example: "npm ci:8" -> "npm:8" (first word only)
- estimated_savings_usd_30d: $5/Mtok -> $3/Mtok (input pricing)
- Remove needless borrow in build_meta_usage (clippy)

Signed-off-by: Patrick Szymkowiak <patrick@rtk-ai.app>
Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>
2026-04-08 17:30:24 +02:00
Patrick szymkowiak 15f666dd8d fix(telemetry): 7 bugs in enrichment — privacy leak, broken meta_usage, pricing
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>
2026-04-08 11:10:29 +02:00
Patrick szymkowiak da486bf394 fix(tee): prevent panic on UTF-8 multi-byte truncation boundary
&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>
2026-04-07 15:42:15 +02:00
aesoft 0d07f04d03 fix(core): error handl, RAW_CAP, recursion guard, atomic writes 2026-04-05 14:09:13 +02:00
aesoft 63313a25b6 fix(stream): skip printf-based tests on Win 2026-04-05 13:28:08 +02:00
Adrien Eppling 52643791bc Merge origin/develop into feat/refacto-stream-binary
Integrates ~30 develop commits (PR #997): AWS expansion (8→25 cmds),
SSH signing for git commit/push, go test context, grep stdin leak fix,
default-to-ask permissions, gh pr merge passthrough.

Conflict resolution (4 files):
- git.rs: kept .output()+stdin(inherit) for commit/push (SSH/GPG signing)
- go_cmd.rs: accepted incoming + added pub(crate) visibility
- hook_check.rs: merged binary_hook_registered + other_integration_installed
- hook_cmd.rs: fixed permissions path, println→writeln for Gemini deny

Verified: 1445 tests pass, 0 clippy errors, all manual integration tests pass.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-04-04 21:21:01 +02:00
aesoft a2312df5f2 feat(stream): standardize command execution with exec_capture() 2026-04-04 20:38:43 +02:00
aesoft 02e3a6f8f4 fix(stream): wire run_streaming as standard exec for filter commands 2026-04-04 19:47:20 +02:00
aesoft a919335519 Merge pull request #978 from rtk-ai/fix/batch-priority-issues
fix(main): kill zombie processes + path for rtk md + missing intergrations
2026-04-04 12:03:29 +02:00
Nicolas Le Cam c6f35c9771 fix: apply clippy suggestions
Signed-off-by: Nicolas Le Cam <niko.lecam@gmail.com>
2026-04-04 01:25:16 +02:00
Claude 4dec66fa9d fix: use isolated in-memory DB for reset test to prevent race condition
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
2026-04-03 14:33:53 +00:00
Claude ee6cddea98 fix: address PR review — atomic reset, confirmation prompt, and tests
- 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
2026-04-03 14:25:05 +00:00
Patrick szymkowiak 450ed107ab feat(telemetry): add retention, ecosystem, economics, and config metrics
Extend the daily anonymous ping with product-piloting metrics:

Retention: first_seen_days, active_days_30d, commands_total
Ecosystem: ecosystem_mix (category distribution percentages)
Economics: tokens_saved_30d, estimated_savings_usd_30d
Config: has_config_toml, exclude_commands_count, projects_count
Features: meta_usage (gain, discover, proxy, verify, learn counts)

Update README.md privacy section with full field-by-field table
explaining what is collected and why it helps improve RTK.

Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>
2026-04-03 13:58:45 +02:00
Patrick szymkowiak d57de86d88 feat(telemetry): enrich daily ping with gap detection and quality metrics
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>
2026-04-03 13:48:18 +02:00
aesoft e918661440 fix(tracking): use std::env::temp_dir() for compatibility (instead of unix tmp) 2026-04-03 11:03:13 +02:00
aesoft deda44f736 fix(docs): clean some docs + disclaimer 2026-04-02 21:33:38 +02:00
Claude 2003033269 feat: add --reset flag to rtk gain command
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
2026-04-02 19:19:34 +00:00
aesoft 402c48e669 Merge pull request #885 from jbronssin/feat/aws-expand-cli-filters
feat(aws): expand CLI filters from 8 to 25 subcommands
2026-04-02 19:23:17 +02:00
Adrien Eppling 42554d4383 Merge branch 'develop' into feat-hook-engine 2026-04-01 21:40:49 +02:00
aesoft bae7930119 fix(review): PR #934 2026-03-31 20:43:59 +02:00
aesoft 7b0f5e1ba9 feat(core): binary hook w/ native cmd exec + streaming
Co-Authored-By: ahundt <ATHundt@gmail.com>
2026-03-31 20:24:34 +02:00