- Run cargo fmt on diff_cmd.rs and init.rs (line length violations)
- Add Unreleased section to CHANGELOG.md with the two bug fixes
from this PR (required by doc review CI gate)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Florian BRUNIAUX <florian@bruniaux.com>
Keep truncation accuracy fix (HEAD) — accurate overflow counts in
condense_unified_diff. Drop test_condense_unified_no_truncation from
develop (incompatible). Add test_no_truncation_large_diff and
test_long_lines_not_truncated from develop (test compute_diff, no conflict).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Two silent truncation bugs in git.rs:
1. compact_diff: hunk truncation showed "... (truncated)" with no count.
An LLM had no way to know if 5 or 450 lines were dropped. Replace
with "... (N lines truncated)" by tracking hunk_skipped separately
from hunk_shown — flush the count at each hunk/file boundary.
2. filter_log_output: commit body beyond 3 lines was silently dropped.
A 20-line body explaining a breaking change would show 3 lines with
no indicator that 17 were omitted. Now appends "[+N lines omitted]"
when body_omitted > 0.
Adds 2 RED-then-GREEN tests to lock in the new behavior.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Florian BRUNIAUX <florian@bruniaux.com>
The overflow message "+N more" in condense_unified_diff was lying.
The `changes` vec was capped at 15 entries, so `changes.len() - 10`
could only reach 5 — reporting "+5 more" when 190 lines were actually
truncated. Fix: track `added + removed` directly and compute true
overflow as `(added + removed) - 10`.
Adds 7 accuracy tests across 4 modules to lock in correct overflow
reporting:
- diff_cmd: overflow count matches true total (200 changes → "+190 more")
- diff_cmd: no spurious overflow message for 8 changes
- git: format_status overflow count is exact (25 staged → "+10 more")
- git: compact_diff recovery hint present when hunk is truncated
- grep: documents uncapped-vector invariant that prevents the diff bug
- filter: smart_truncate kept + reported_more == total_lines
Closes the test gap flagged in testing-patterns.md backlog for diff_cmd.rs.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Florian BRUNIAUX <florian@bruniaux.com>
Changed default filter level from "minimal" to "none". RTK read now
shows complete file content by default. Filtering is opt-in:
rtk read file.rs # full content (was: minimal filter)
rtk read file.rs -l minimal # light filtering (opt-in)
rtk read file.rs -l aggressive # signatures only (opt-in)
Also adds fallback: if a filter produces empty output on non-empty
file, show raw content with a warning.
Fixes#822
Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>
- Detect binary files (null bytes in first 8KB) before filtering
- Show clear message: [binary file] path (size) instead of empty output
- Fallback to raw content if filter produces empty output on non-empty file
- Prevents LLM from concluding a 70MB file is "empty" (was #822)
Fixes#822
Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>
Silent truncation caused a user to make irreversible decisions on
incomplete data. rtk diff was capping at 50 changes and 70-80 char
lines without clear warning to the LLM.
- Remove all line truncation (70/80 char limits)
- Remove change count limit (was 50, now unlimited)
- Remove truncate import (no longer needed)
- Same fix for condense_unified_diff (stdin/git diff path)
- Add 3 tests verifying zero truncation on large inputs
The only compression remaining is the summary header
(+N added, -N removed, ~N modified) and stripping diff metadata.
Fixes#827
Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>
- Add `rtk init --copilot` that creates .github/hooks/rtk-rewrite.json
and .github/copilot-instructions.md in the current project
- Hook routes through `rtk hook copilot` (auto-detects VS Code vs CLI)
- VS Code Copilot Chat: transparent rewrite via updatedInput
- Copilot CLI: deny-with-suggestion (CLI limitation)
- Update README: split Copilot VS Code/CLI, add Vibe status, 10 tools
Closes#823
Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>
- Split Copilot into VS Code (transparent rewrite) and CLI (deny-with-suggestion)
- Use --copilot flag (consistent with --gemini, --codex, --opencode)
- Add Mistral Vibe as planned (blocked on upstream #531)
- Fix Copilot section with VS Code vs CLI details
- Update tool count from 9 to 10
- Verified all 10 tools against actual codebase
Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>
Pre-release tags on develop used v* prefix (e.g. v0.33.1-rc.60) which
release-please interpreted as the latest version, causing it to generate
wrong release versions. Changed to dev- prefix (e.g. dev-0.34.0-rc.61)
so release-please only sees stable v* tags.
Cleaned up: 42 RC releases and tags deleted.
Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>
Commands like `git status 2>&1` or `cargo test 2>/dev/null` were not
rewritten because the redirect suffix prevented pattern matching.
Now strips redirects (2>&1, 2>/dev/null, etc.) before matching,
then re-appends them to the rewritten command.
Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>
Document Copilot, Cursor, Codex, Windsurf, Cline, OpenClaw setup.
Unified table with install commands for each tool.
Updated Quick Start with all agent options.
Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>
- Add "Privacy & Telemetry" section to README explaining what is
collected, what is NOT, and how to opt-out
- Show telemetry notice during rtk init so users are informed
Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>
When `gh pr diff` is called with output-format-changing flags like
--name-only, --stat, --name-status, --numstat, or --shortstat, the
output is a plain filename/stat list rather than a unified diff.
compact_diff() expects diff headers and hunks, so it produces empty
output from these formats.
Skip filtering and passthrough directly when any of these flags are
present. The output is already compact and doesn't benefit from diff
compaction.
Fixes#730
Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Add --comments to the passthrough trigger list in should_passthrough_pr_view().
The --comments flag changes gh output to include comments, but the rtk
filter hardcodes a JSON field list without 'comments', silently
discarding all comment data. This misleads AI agents into concluding
issues have no responses.
Add should_passthrough_issue_view() for view_issue(), which previously
had no passthrough check at all. Both functions now passthrough on
--comments, --json, --jq, and --web.
Fixes#720
Signed-off-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Add crate::tee::tee_and_hint call to playwright_cmd::run(), matching
the pattern used by all other test runners (vitest, pytest, cargo,
go, rspec, rake). When playwright fails, the full raw output is saved
to ~/.local/share/rtk/tee/ and a one-line hint is appended so the
LLM can read the complete output without re-running.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Ousama Ben Younes <benyounes.ousama@gmail.com>
format_compact() was truncating error messages to 2 lines via .take(2).
Playwright (and vitest, pytest, cargo test) errors contain the critical
expected/received diff and call log starting at line 3+, so agents saw
only the error type with no actionable debug information.
Fix: iterate all lines of error_message for each failure instead of
taking the first 2. Summary line stays compact; only the per-failure
detail is preserved in full.
Affects all test runners using TestResult (playwright, vitest, cargo,
pytest, dotnet) — any test failure is now fully visible.
Closes#690
Signed-off-by: Ousama Ben Younes <benyounes.ousama@gmail.com>
Bug 2 (Critical): *:* catch-all matched nothing. strip_suffix('*') left
"*:" which after trim became "*" (non-empty), so the branch returned
false instead of true. Fix: detect empty-or-star prefix after stripping.
Bug 3 (Medium): leading wildcards ("* --force"), middle wildcards
("git * main"), and multi-wildcard patterns ("git * --force *") fell
through to exact match, silently failing. Add glob_matches() with
character-level segment anchoring: first segment must be prefix, last
must be suffix, middle segments found via str::find in order.
Colon normalization in glob_matches(): "sudo:*" -> "sudo *" so both
fast path and glob path interpret colon syntax consistently.
New tests: test_star_colon_star_matches_everything,
test_leading_wildcard, test_leading_wildcard_no_partial,
test_middle_wildcard, test_middle_wildcard_no_match,
test_multiple_wildcards, test_deny_with_leading_wildcard,
test_deny_star_colon_star.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Florian BRUNIAUX <florian@bruniaux.com>
Bug 1 (Critical): check_command() was called inside Some(rewritten),
so non-RTK commands (rm, kill, python3 -c) bypassed deny rules entirely.
Move verdict check before registry::rewrite_command() so all commands
are evaluated regardless of whether RTK has an equivalent.
Bug 4 (Medium): print!() before process::exit() could leave stdout
unflushed. Add explicit std::io::stdout().flush() after each print!().
Add Eq derive to PermissionVerdict (required for == comparison).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Florian BRUNIAUX <florian@bruniaux.com>