When the `ls` binary on PATH is a modern replacement (eza, exa, lsd),
its day-first date format (22 Apr 14:30) doesn't match the POSIX regex
anchor, causing every line to fail silently and returning "(empty)" for
non-empty directories.
Track `any_content_line` and `parse_hit` in `compact_ls`. When output
lines were present but none parsed successfully, return a sentinel
(both fields empty) so the caller falls back to raw output with a
warning instead of "(empty)".
Truly empty directories and noise-filtered results are unaffected.
Removing old guards, windows can now just use the binary hook engine from 0.37
Related issues:
- Fixes#502 : rtk init --global falls back to --claude-md on Windows
- Fixes#1353 : Feature request: hook-based mode on Windows
- Partially addresses #330 : Add hooks support for Windows
- Partially addresses #913 : Persistent "No hook installed" warning on Windows
- Partially addresses #1373 : Suppress "No hook installed" warning on Windows
- Partially addresses #682 : Config to suppress hook warning
- Related to #1248 : Windows PowerShell compatibility gaps
Supersedes community PRs:
- #1123 fix(init): enable hook installation on Windows
- #1027 fix(init): enable hook-based mode on Windows
- #809 feat: enable hook-based mode on Windows
- #452 feat: add Windows hook support for rtk init --global
- #551 feat: native cross-platform hook for Windows support
- #150 feat(hook): native cross-platform hook-rewrite command
- #1063 Feat/windows hooks
Replace \b with ($|\s) to only match end-of-string or whitespace.
Empty string and bare "^" patterns produce regexes that match all commands, silently disabling all rewrites on a config typo. Skip
trivial patterns with an eprintln warning.
Strip env prefix (sudo, VAR=val) before exclude check so PGPASSWORD=x psql matches ["psql"]. Match against full command instead of first token so ["git push"] matches "git push origin main".
Compile exclude entries as regex so ["^curl"] works as pattern.
Invalid regex falls back to prefix match with eprintln warning.
Non-regex patterns auto-anchor with ^ and \b to prevent substring matches (e.g. "go" won't exclude "golangci-lint").
B6 — report.rs:already_rtk integer division truncated small ratios to 0%
(e.g. 3/1000 showed "0%" instead of "0.3%"). Now uses f64 division with
one decimal place. Three regression tests added.
B7 — mod.rs:SupportedBucket.savings_pct was set once from the first-seen
sub-command and never updated. For buckets containing multiple sub-commands
(e.g. git add + git diff + git log all under "rtk git"), the displayed
estimated_savings_pct reflected only the first classification. Fix: track
total_raw_output_tokens alongside total_output_tokens (savings). Compute
effective_savings_pct = saved / raw * 100 at entry construction, giving a
weighted average across all sub-commands in the bucket. This rate is exposed
in rtk discover --format json via estimated_savings_pct.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Florian BRUNIAUX <florian@bruniaux.com>