As of go v1.24, tools such as golanci-lint can be managed via the mod
file and called directly on the go binary via the tool subcommand.
When called via tools, we now apply the same logic to compact the
results as in the directly called command.
Signed-off-by: shwoop <monkey.mambo.al.ferguson@gmail.com>
cat flags like -v, -A, -e, -t, -s have different semantics than
rtk read flags (-v means verbose, -n means line numbers). Blindly
forwarding flags caused incorrect behavior (e.g. cat -A file →
rtk read -A file which fails).
Only skip rewrite for incompatible flags. cat -n (line numbers) maps
correctly to rtk read -n, so it is still rewritten for token savings.
Plain `cat file` continues to rewrite to `rtk read file` as before.
Fixes Documentation Validation CI check (main.rs=64, ARCHITECTURE.md was 60).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Ousama Ben Younes <benyounes.ousama@gmail.com>
rtk ls | wc -l returned N+2 instead of N because the summary line
(📊 X files, Y dirs) and blank line were always written to stdout.
Now uses std::io::stdout().is_terminal() to suppress the summary
when piped, following standard Unix convention (ls, grep, find all
do this).
Fixes#482
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Ousama Ben Younes <benyounes.ousama@gmail.com>
Verifies that `rtk rewrite "RTK_DISABLED=1 git status"` emits the
warning on stderr, not just that rewrite_command returns None.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Ousama Ben Younes <benyounes.ousama@gmail.com>
When the rewrite hook sees RTK_DISABLED=1, it now prints a warning to
stderr before skipping the rewrite. This educates AI agents to stop
overusing the bypass — a real session showed 30% of commands using
RTK_DISABLED=1 unnecessarily, dropping savings from ~65% to 48%.
The warning is on stderr (not stdout) so it doesn't affect command
output or piping. The bypass still works exactly as before.
Fixes#508
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Ousama Ben Younes <benyounes.ousama@gmail.com>
- 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>