2061 Commits

Author SHA1 Message Date
heAdz0r 393fa5ba2b feat: add rtk wc command for compact word/line/byte counts (#175)
Adds a new `wc` subcommand that compresses wc output by:
- Stripping alignment padding: `      30      96     978 file.py` → `30L 96W 978B`
- Removing common path prefixes in multi-file output
- Returning bare numbers for single-flag modes (-l, -w, -c, -m)
- Showing Σ totals instead of verbose "total" lines

Includes 15 unit tests covering single/multi-file, stdin, all flag
modes, and common prefix detection.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 15:54:48 +01:00
github-actions[bot] c29644b7ab chore(master): release 0.21.1 (#179)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
v0.21.1
2026-02-17 23:06:03 +01:00
shadowofdoom d196c2d2df fix: gh run view drops --log-failed, --log, --json flags (#159)
view_run() only passed the run ID to `gh run view`, silently
dropping all subsequent args. This made it impossible to inspect
CI failure logs when the rtk-rewrite hook was active.

Add should_passthrough_run_view() to detect flags that produce
output incompatible with the summary filter, and pass through
to gh directly when found.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 22:59:54 +01:00
github-actions[bot] aa0b462182 chore(master): release 0.21.0 (#178)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
v0.21.0
2026-02-17 22:49:48 +01:00
polamin 510c491238 feat(docker): add docker compose support (#110)
* feat(docker): add docker compose support with compact output

Add token-optimized output for docker compose commands:
- `docker compose ps`: compact service listing with status and ports
- `docker compose logs`: deduplicated log output via existing log engine
- `docker compose build`: summary with build time, services, and step count
- Unsupported compose subcommands pass through directly

Includes 11 tests (8 compose format tests + 3 for existing compact_ports).

Fixes #101

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: address PR #110 review — use --format for compose ps, fix bytes/chars bugs

- Switch format_compose_ps to parse structured --format tab output
  instead of fragile human-readable table (eliminates contains("Up")
  false positives and byte/char confusion)
- Fix find('[') byte offset used with chars().skip() in build parsing
- Use .next_back() instead of .last() on DoubleEndedIterator
- Consistent error handling with .context()? in run_compose_ps
- Strengthen test assertion for compose logs
- Add tests for no-ports and long-image-path cases

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: propagate exit codes on compose failures + remove Vec allocation

Address PR #110 review feedback from pszymkowiak:
- Check output.status.success() after .output() in run_compose_ps,
  run_compose_logs, and run_compose_build to prevent silent failures
  when Docker daemon is not running
- Replace .collect::<Vec<&str>>().len() with .count() in
  format_compose_build step counting to avoid unnecessary allocation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* docs: update version references to 0.20.1 after upstream rebase

Sync documentation version strings with Cargo.toml after rebasing
on upstream master. Fixes CI validate-docs check.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* chore: drop upstream workflow file from feature branch

This workflow was pulled in during rebase on upstream master.
Not part of the docker compose feature — let upstream manage it.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* chore: restore validate-docs workflow from upstream

Workflow was unintentionally removed while resolving a push
permission issue. Restored to match upstream master.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 22:45:16 +01:00
Rui Chen c83a834486 docs: add brew install note (#177)
Signed-off-by: Rui Chen <rui@chenrui.dev>
2026-02-17 22:27:38 +01:00
github-actions[bot] 577e082c5d chore(master): release 0.20.1 (#167)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
v0.20.1
2026-02-17 10:33:27 +01:00
Florian BRUNIAUX 0b34772a67 fix: install to ~/.local/bin instead of /usr/local/bin (closes #155) (#161)
Remove sudo requirement by defaulting to $HOME/.local/bin (XDG standard).
Supports RTK_INSTALL_DIR env var for custom install path.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 10:28:51 +01:00
github-actions[bot] 78c9e94b7c chore(master): release 0.20.0 (#152)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
v0.20.0
2026-02-17 07:29:19 +01:00
Florian BRUNIAUX 70c37867e7 feat: add hook audit mode for verifiable rewrite metrics (#151)
Add opt-in audit logging to the RTK rewrite hook and a new `rtk hook-audit`
command to analyze the collected metrics. This provides verifiable data on
hook reliability (rewrite rate, skip reasons, top commands) instead of
relying on anecdotal claims.

- Add `_rtk_audit_log()` function to rtk-rewrite.sh (opt-in via RTK_HOOK_AUDIT=1)
- Log each invocation: timestamp | action | original_cmd | rewritten_cmd
- Actions: rewrite, skip:already_rtk, skip:heredoc, skip:no_match, skip:no_deps, skip:empty
- New `src/hook_audit_cmd.rs` module with log parser and stats display
- New `rtk hook-audit --since N` subcommand (default: last 7 days)
- 8 Rust unit tests + 7 hook bash tests for audit mode
- Make HOOK var overridable in test suite for repo-local testing

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 22:05:28 +01:00
Florian BRUNIAUX c6001e6869 Merge pull request #144 from rtk-ai/chore/claude-config
chore: add Claude Code configuration (.claude)
2026-02-16 21:06:05 +01:00
github-actions[bot] 5231f98973 chore(master): release 0.19.0 (#148)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
v0.19.0
2026-02-16 20:16:17 +01:00
Florian BRUNIAUX a08a62b4e3 feat: tee raw output to file for LLM re-read without re-run (#134)
* feat: tee raw output to file for LLM re-read without re-run (#86)

When RTK filters command output, LLM agents lose failure details
(stack traces, assertions) and re-run the same command 2-3x. The tee
feature saves raw output to ~/.local/share/rtk/tee/ on failure and
prints a one-line hint so the agent can read the file instead.

- Add src/tee.rs: core module with tee_raw(), tee_and_hint(), rotation
- Add TeeConfig to config.rs: enabled, mode, max_files, max_file_size
- Integrate in 7 modules: cargo, runner, vitest, pytest, lint, tsc, go
- Default: failures only, skip <500 chars, 20 file rotation, 1MB cap
- Env overrides: RTK_TEE=0 (disable), RTK_TEE_DIR (custom directory)
- 14 unit tests, 352 total tests passing, zero regressions

Closes #86

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: add tee.rs to ARCHITECTURE.md module count (47 modules)

CI validate-docs requires main.rs module count == ARCHITECTURE.md count.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 20:03:03 +01:00
Florian BRUNIAUX 34db3e4738 fix: update CLAUDE.md version to 0.18.1
Fix CI validation: CLAUDE.md referenced 0.18.0, Cargo.toml is at 0.18.1.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 11:27:08 +01:00
Florian BRUNIAUX 981d3be7db feat: add /repo-recap skill for PR/issue/release summaries
Generates structured repo recap with:
- Open PRs categorized (ours/reviewable/problematic)
- Open issues with priority classification
- Recent releases
- Executive summary with risks and quick wins
- Auto-copy to clipboard
- FR/EN language support via argument

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 10:06:45 +01:00
Florian BRUNIAUX 621b65afea fix: update README.md version to 0.18.1
Fix CI validation: README referenced 0.18.0, Cargo.toml is at 0.18.1.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 09:50:26 +01:00
Florian BRUNIAUX d8f4659ad7 chore: add Claude Code agents, commands, skills, hooks and rules
Add project-specific Claude Code configuration for RTK development:

- 5 agents: code-reviewer, debugger, rtk-testing-specialist, rust-rtk, technical-writer
- 2 commands: /diagnose (env checks), /test-routing (dry-run validation)
- 1 hook: pre-commit cargo fmt + clippy + test gate
- 1 rule: CLI testing methodology (snapshot, token accuracy, cross-platform)
- 3 skills: performance optimization, security audit, release workflow

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 09:37:48 +01:00
github-actions[bot] a82b2872ba chore(master): release 0.18.1 (#133)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
v0.18.1
2026-02-16 08:22:16 +01:00
heAdz0r 7d69299c9f fix(grep): accept -n flag for grep/rg compatibility
`rtk grep -n "pattern" path` failed with "unexpected argument '-n'"
because clap didn't recognize -n before the positional arguments.

Users naturally place -n before the pattern (muscle memory from
grep/rg). The flag is a no-op since grep_cmd::run() already passes
-n to ripgrep unconditionally, but clap must accept it.

Adds -n/--line-numbers as an explicit bool field to the Grep command
and ignores it in the match arm. Test added in grep_cmd::tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 23:22:19 +03:00
Florian BRUNIAUX c4c9515cbc Merge pull request #102 from FlorianBruniaux/docs/v0.15.1-python-go-complete
docs: comprehensive v0.15.1 documentation for Python/Go support
2026-02-15 19:07:25 +01:00
Florian BRUNIAUX 398cb08125 fix: update ARCHITECTURE.md version to 0.18.0
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 18:49:03 +01:00
Florian BRUNIAUX c73ed470a7 fix: update version references to 0.18.0 in docs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 18:34:38 +01:00
Florian BRUNIAUX 439fa33c3f Merge remote-tracking branch 'origin/master' into docs/v0.15.1-python-go-complete 2026-02-15 18:34:16 +01:00
Florian BRUNIAUX ec54833621 fix: update version references to 0.16.0 in README.md and CLAUDE.md
CI validate-docs requires version consistency across all doc files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 18:19:10 +01:00
github-actions[bot] 2bc7d207b6 chore(master): release 0.18.0 (#132)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
v0.18.0
2026-02-15 16:00:57 +01:00
heAdz0r 606b86ed43 feat(gain): colored dashboard with efficiency meter and impact bars (#129)
* feat(gain): add colored dashboard with efficiency meter and impact bars

Upgrade `rtk gain` output with rich terminal visualization:
- Colored percentage cells (green ≥70%, yellow ≥40%, red <40%)
- Efficiency meter: ASCII progress bar with savings percentage
- Impact bars: proportional block charts per command
- Styled section headers (bold green)
- Command names in bright cyan
- History tier indicators (▲/■/•)
- Dynamic column widths for clean table alignment
- KPI-style key-value layout for summary metrics

All visual features are TTY-aware via std::io::IsTerminal — output
degrades gracefully to plain text when piped or redirected.

No new dependencies (uses existing `colored` crate).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add dashboard visualization screenshot

Shows colored terminal output of `rtk gain -p` with:
- Project-scoped token savings header
- Efficiency meter with color gradient
- Per-command table with colored Avg% and Impact bars

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 15:50:24 +01:00
github-actions[bot] ec88f5c109 chore(master): release 0.17.0 (#126)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
v0.17.0
2026-02-15 15:28:48 +01:00
heAdz0r 356c0d61a3 refactor(init): add upsert_rtk_block for idempotent CLAUDE.md management (#123)
Replace naive append-or-skip logic in run_claude_md_mode with
upsert_rtk_block() that handles all 4 cases:
- Added: no existing block → append
- Updated: stale block → replace in-place
- Unchanged: current block → no-op
- Malformed: opening marker without closing → warn safely

Includes 4 unit tests covering each case.
2026-02-15 15:15:08 +01:00
playb0t 1d7d9d065e fix(integrity): address security review findings
Addresses all findings from FlorianBruniaux's review of PR #119:

C-02 (CRITICAL): Remove RTK_SKIP_INTEGRITY env var bypass
  - Any process in the environment could disable verification
  - If attacker can modify hook, they can also set env var
  - Recovery path: `rtk init -g --auto-patch` to re-baseline

I-02 (IMPORTANT): Invert is_operational_command to whitelist
  - Explicitly enumerate commands requiring integrity check
  - New commands fail open (no check) rather than creating
    false confidence about protection coverage

I-03 (IMPORTANT): Strict hash file parsing
  - Validate exact sha256sum format: "<64 hex>  <filename>"
  - Reject single-space separator, missing filename, garbage
  - Prevents silent acceptance of corrupted hash files

N-01 (NIT): Safe hash truncation in error output
  - Use .get(..16).unwrap_or() instead of &[..16] slice
  - Prevents potential panic on malformed stored hash

N-02 (NIT): Remove bypass hint from error message
  - "To override: RTK_SKIP_INTEGRITY=1" leaked mechanism
  - Resolved automatically by C-02 (env var removed entirely)

Tests: 14 → 16 (+hash_only_no_filename, +wrong_separator)
2026-02-15 20:38:46 +07:00
igor 68fd570f2b feat(cargo): add cargo nextest support with failures-only output (#107)
Add token-optimized filtering for `cargo nextest` output: strip
compilation noise, PASS lines, and post-summary recaps; show only
failure details and a compact summary. Extract flush_failure_block
helper to DRY up failure block collection (was repeated 4 times).

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 14:14:28 +01:00
Michael Coen 7401f1099f feat(hook): handle global options before subcommands (#99)
* fix(hook): use POSIX character classes for cross-platform grep compatibility

Replace \s with [[:space:]] in all grep -E patterns. The \s shorthand
is a PCRE extension not guaranteed by POSIX ERE, causing intermittent
match failures on macOS depending on grep version and locale settings.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* feat(hook): handle global options before subcommands in git/cargo/docker/kubectl

Normalize commands by stripping global options (git -C, --no-pager;
cargo +toolchain; docker -H, --context; kubectl --context, -n) to
correctly identify the subcommand for rewrite matching. Preserves all
original arguments in the rewritten command.

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 08:15:02 +01:00
Florian BRUNIAUX fb37bc9f04 Merge branch 'master' into docs/v0.15.1-python-go-complete
Resolve 9 conflicts:
- Versions: take master (0.16.0)
- Hooks: take master (POSIX character classes + ENV_PREFIX)
- CHANGELOG/CLAUDE.md: take master entries
- parser/mod.rs: add multibyte/emoji tests from master
- ruff_cmd.rs: take pub fn visibility from master

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 18:20:57 +01:00
github-actions[bot] d67ade9ecf chore(master): release 0.16.0 (#121)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
v0.16.0
2026-02-14 14:48:30 +01:00
Florian BRUNIAUX 4cae6b6c9a feat(python): add lint dispatcher + universal format command (#100)
* feat(cargo): aggregate test output into single line (#83)

Problem: `cargo test` shows 24+ summary lines even when all pass.
An LLM only needs to know IF something failed, not 24x "ok".

Before (24 lines):
```
✓ test result: ok. 2 passed; 0 failed; ...
✓ test result: ok. 0 passed; 0 failed; ...
... (x24)
```

After (1 line):
```
✓ cargo test: 137 passed (24 suites, 1.45s)
```

Changes:
- Add AggregatedTestResult struct with regex parsing
- Merge multiple test summaries when all pass
- Format: "N passed, M ignored, P filtered out (X suites, Ys)"
- Fallback to original behavior if parsing fails
- Failures still show full details (no aggregation)

Tests: 6 new + 1 modified, covering all cases:
- Multi-suite aggregation
- Single suite (singular "suite")
- Zero tests
- With ignored/filtered out
- Failures → no aggregation (detail preserved)
- Regex fallback

Closes #83

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* feat: add Python and Go support (#88)

* feat(cargo): aggregate test output into single line (#83)

Problem: `cargo test` shows 24+ summary lines even when all pass.
An LLM only needs to know IF something failed, not 24x "ok".

Before (24 lines):
```
✓ test result: ok. 2 passed; 0 failed; ...
✓ test result: ok. 0 passed; 0 failed; ...
... (x24)
```

After (1 line):
```
✓ cargo test: 137 passed (24 suites, 1.45s)
```

Changes:
- Add AggregatedTestResult struct with regex parsing
- Merge multiple test summaries when all pass
- Format: "N passed, M ignored, P filtered out (X suites, Ys)"
- Fallback to original behavior if parsing fails
- Failures still show full details (no aggregation)

Tests: 6 new + 1 modified, covering all cases:
- Multi-suite aggregation
- Single suite (singular "suite")
- Zero tests
- With ignored/filtered out
- Failures → no aggregation (detail preserved)
- Regex fallback

Closes #83

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* feat: add Python and Go language support

Implements comprehensive support for Python and Go development tooling
with 70-90% token reduction across all commands.

Python commands (3):
- rtk ruff: Linter/formatter with JSON (check) and text (format) parsing (80%+)
- rtk pytest: Test runner with state machine text parser (90%+)
- rtk pip: Package manager with auto-detect uv (70-85%)

Go commands (4):
- rtk go test: NDJSON streaming parser for interleaved test events (90%+)
- rtk go build: Text filter showing errors only (80%)
- rtk go vet: Text filter for issues (75%)
- rtk golangci-lint: JSON parser grouped by rule (85%)

Architecture:
- Standalone Python commands (mirror lint/prettier pattern)
- Go sub-enum (mirror git/cargo pattern)
- 5 new modules: ruff_cmd, pytest_cmd, pip_cmd, go_cmd, golangci_cmd
- Hook integration in rtk-rewrite.sh for transparent rewrites
- Comprehensive tests (47 new tests, all passing)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* feat(benchmark): add Python and Go commands

Add benchmark sections for Python (ruff, pytest, pip) and Go (go test/build/vet, golangci-lint) to validate >80% token savings in CI pipeline.

Sections conditionally execute based on project markers (pyproject.toml, go.mod) and tool availability.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>

* feat: make install-local.sh self-contained (#89)

- Build from source automatically instead of requiring a pre-built binary
- Default install dir to ~/.cargo/bin
- Skip rebuild when binary is up to date
- Warn if install dir is not in PATH

* chore(master): release 0.15.0 (#90)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* fix(vitest): robust JSON extraction for pnpm/dotenv prefixes (#92)

* fix(vitest): robust JSON extraction for pnpm/dotenv prefixes

Problem: RTK's vitest parser forces --reporter=json but pnpm/dotenv prepend
non-JSON text to stdout (banners, env messages), causing 100% Tier 1 failure
and useless 500-char passthrough.

Solution:
- Add extract_json_object() to parser/mod.rs (shared utility)
- Algorithm: find "numTotalTests" or first standalone {, brace-balance forward
- VitestParser now tries direct parse → extract+parse → regex → passthrough
- Replace hardcoded Command::new("pnpm") with package_manager_exec("vitest")
- Delete orphan doc comment on line 203

Impact:
- Before: 100% Tier 3 passthrough with pnpm workflows
- After: Tier 1 success with prefixes, maintains 99.5% token savings

Tests:
- 6 tests for extract_json_object (clean, pnpm, dotenv, nested, no-json, strings)
- 3 tests for VitestParser with prefixes
- All 277 tests pass

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* chore(benchmark): add vitest, pnpm, and gh commands

Add benchmarks for recently implemented commands:
- vitest run (PR #92 - JSON extraction fix)
- pnpm list/outdated (PR #6)
- gh pr list/run list (existing gh support)

These commands are now tested in CI to ensure token savings are maintained.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>

* fix: improve CI reliability and hook coverage (#95)

* feat(cargo): aggregate test output into single line (#83)

Problem: `cargo test` shows 24+ summary lines even when all pass.
An LLM only needs to know IF something failed, not 24x "ok".

Before (24 lines):
```
✓ test result: ok. 2 passed; 0 failed; ...
✓ test result: ok. 0 passed; 0 failed; ...
... (x24)
```

After (1 line):
```
✓ cargo test: 137 passed (24 suites, 1.45s)
```

Changes:
- Add AggregatedTestResult struct with regex parsing
- Merge multiple test summaries when all pass
- Format: "N passed, M ignored, P filtered out (X suites, Ys)"
- Fallback to original behavior if parsing fails
- Failures still show full details (no aggregation)

Tests: 6 new + 1 modified, covering all cases:
- Multi-suite aggregation
- Single suite (singular "suite")
- Zero tests
- With ignored/filtered out
- Failures → no aggregation (detail preserved)
- Regex fallback

Closes #83

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* fix(ci): prevent Python/Go benchmark sections from being silently skipped

**Problem:**
Python and Go benchmark sections were silently skipped in CI because
the RTK repository doesn't contain pyproject.toml or go.mod files.
The sections only ran when these project files existed.

**Solution:**
1. Create temporary fixtures with minimal project structure:
   - Python: pyproject.toml + sample.py + test_sample.py
   - Go: go.mod + main.go + main_test.go
2. Resolve RTK to absolute path to work after cd into temp dirs
3. Install required tools in CI workflow:
   - Python: ruff, pytest
   - Go: stable version + golangci-lint

**Impact:**
- Python/Go sections now appear in CI benchmark output
- Self-contained fixtures ensure consistent benchmarking
- No dependency on RTK project structure

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(hooks): add missing RTK command rewrites

Add 8 missing command rewrites to rtk-rewrite.sh and rtk-suggest.sh:
- cargo check/install/fmt
- tree, find, diff
- head → rtk read (with --max-lines transformation)
- wget

Fixes BSD sed compatibility for head transformation by using literal
spaces instead of \s+ (which doesn't work on macOS).

Impact: ~18.2K tokens saved on previously missed commands discovered
by `rtk discover`.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>

* chore(master): release 0.15.1 (#96)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* feat(python): add lint dispatcher + universal format command

Phase 1: Enhanced rtk lint
- Add pylint JSON2 parser (80-85% token savings)
- Add mypy text parser (75-80% token savings)
- Smart dispatcher: Python tools (pip) vs JS tools (npm)
- Reuse ruff_cmd JSON parser for rtk lint ruff

Phase 2: New rtk format command
- Universal formatter: black/ruff/prettier
- Auto-detect from pyproject.toml/package.json
- Implement black output parser (70-85% savings)
- Reuse existing prettier/ruff formatters

Phase 3: Hook integration
- Auto-rewrite: pylint → rtk lint pylint
- Auto-rewrite: mypy → rtk lint mypy
- Auto-rewrite: black --check → rtk format black

Files changed:
- src/lint_cmd.rs: +454 lines (pylint/mypy parsers, dispatcher)
- src/format_cmd.rs: +386 lines (NEW - universal formatter)
- src/ruff_cmd.rs: Export filter functions as pub
- src/prettier_cmd.rs: Export filter_prettier_output as pub
- src/main.rs: Add Commands::Format + routing
- hooks/rtk-rewrite.sh: Add Python tool rewrite rules

Testing: 10 new unit tests, all 313 tests passing
Impact: 80-90% token savings on Python workflows

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-authored-by: Michael Coen <mhcoen@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-02-14 14:22:48 +01:00
github-actions[bot] f90a1cbfa7 chore(master): release 0.15.4 (#120)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
v0.15.4
2026-02-14 13:15:47 +01:00
Florian BRUNIAUX d4cb2c0810 Merge pull request #116 from ChrisGVE/master
fix(git): Returns "Not a git repository" when git status is executed in a non-repo folder #82
2026-02-14 13:14:21 +01:00
playb0t 95677e9786 feat(security): add SHA-256 hook integrity verification
Add runtime integrity verification for rtk-rewrite.sh to detect
unauthorized modifications to the PreToolUse hook.

The hook auto-approves all rewritten commands via permissionDecision:
"allow", bypassing Claude Code's permission prompts. Any modification
by a local process (malicious dependency, compromised npm postinstall,
etc.) becomes a command injection vector.

Changes:
- New module: src/integrity.rs (SHA-256 hash, verify, runtime gate)
- rtk init: stores hash after hook installation (idempotent)
- rtk verify: new subcommand for manual integrity check
- rtk init --show: displays integrity status
- rtk uninstall: cleans up hash file
- Operational commands check integrity at startup (fail closed)
- Emergency bypass: RTK_SKIP_INTEGRITY=1

Ref: SA-2025-RTK-001 (Finding F-01)
Ref: PromptArmor hook hijacking (Oct 2025)
Ref: CVE-2025-54794, CVE-2025-54795
2026-02-14 18:37:40 +07:00
Christian C. Berclaz 04e6bb032c fix(git): fix for issue #82
Returns "Not a git repository" when git status is executed in a
non-repo folder
2026-02-14 10:27:51 +01:00
polamin 6612f22060 improve: hook coverage from 0.2% to ~80% with env prefix stripping (#97)
Two root causes for low interception rates:

1. Environment variable prefixes broke pattern matching.
   Commands like `TEST_SESSION_ID=2 npx playwright test` start
   with an env var, not the command name, so no pattern matched.
   Fix: strip leading env vars for matching, preserve for execution.

2. Missing patterns for commands RTK already supports:
   npm run/test, vue-tsc, docker compose, docker run/build/exec,
   kubectl describe/apply, gh api/release.

Also fixes vitest "run" duplication bug where `vitest run` became
`rtk vitest run run`.

Includes 50-test regression suite (hooks/test-rtk-rewrite.sh).

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 18:31:23 +01:00
github-actions[bot] 0517182f5b chore(master): release 0.15.3 (#108)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
v0.15.3
2026-02-13 18:08:26 +01:00
polamin 155e26423d fix: prevent UTF-8 panics on multi-byte characters (#93)
* fix: prevent UTF-8 panics on multi-byte characters (Thai, emoji, CJK)

Replace all byte-indexed string slicing (`&s[..n]`) with char-aware
operations across 10 locations in 7 files. Rust strings are UTF-8, so
byte slicing can land mid-character on Thai (3 bytes), emoji (4 bytes),
or CJK text and panic at runtime.

Fixes applied:
- git.rs: filter_log_output, format_status_output
- log_cmd.rs: error/warning message truncation (2 locations)
- env_cmd.rs: long value display, mask_value
- parser/mod.rs: truncate_output
- grep_cmd.rs: clean_line (pattern context + fallback truncation)
- wget_cmd.rs: compact_url, truncate_line, parse_error

Also adds safe_char_boundary() utility and 20 regression tests covering
Thai, emoji, and CJK input across all affected modules.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: collect chars once in compact_url to avoid redundant iteration

Address review feedback: collect chars into Vec once instead of
calling .chars() multiple times. Also fixes byte-vs-char length check.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: remove unused safe_char_boundary function and tests

Address review: function was defined but never called anywhere.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: convert remaining is_char_boundary to full .chars() approach

Address review: use consistent .chars() everywhere instead of
mixing byte-based is_char_boundary with char-based operations.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 18:03:32 +01:00
github-actions[bot] 737e94696f chore(master): release 0.15.2 (#104)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
v0.15.2
2026-02-13 16:06:02 +01:00
Michael Coen 4aafc832d4 fix(hook): use POSIX character classes for cross-platform grep compatibility (#98)
Replace \s with [[:space:]] in all grep -E patterns. The \s shorthand
is a PCRE extension not guaranteed by POSIX ERE, causing intermittent
match failures on macOS depending on grep version and locale settings.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 12:53:25 +01:00
Florian BRUNIAUX 5a68839486 docs: comprehensive v0.15.1 documentation update for Python/Go support
Complete documentation overhaul for RTK v0.15.1 Python and Go support
across all user-facing and technical documentation.

## Changes

### Critical (P0)
- **CLAUDE.md**: Added maintenance warning, CHANGELOG reference, hook
  coverage section, corrected module count (46 modules)
- **Hooks**: Added Python/Go rewrites (ruff, pytest, pip, go, golangci-lint)
- **CI Validation**: New workflow validates doc consistency on every PR

### User Documentation (P1)
- **README.md**: Added Python/Go Stack section, updated command tables,
  added benchmarks, explicit v0.15.1 mention

### Technical Documentation (P2)
- **ARCHITECTURE.md**: Updated metadata (v0.15.1, 2026-02-12), added
  Python/Go modules to organization table, 3 new filtering strategies
  (JSON/TEXT Dual, State Machine, NDJSON), complete Python & Go
  Module Architecture section

## Validation
- ✅ All docs mention version 0.15.1
- ✅ Module count consistent (46 across all docs)
- ✅ All Python/Go commands documented
- ✅ Hook rewrites present and tested
- ✅ scripts/validate-docs.sh passes

## Impact
- Prevents documentation drift (CI validation)
- Claude Code immediately uses Python/Go via hooks
- Clear architecture guidance for contributors
- 375 lines added across 6 files

Closes #[issue-number-if-any]

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 11:21:52 +01:00
github-actions[bot] d8227be9d1 chore(master): release 0.15.1 (#96)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-02-13 08:46:01 +01:00
Florian BRUNIAUX 50bb4943f7 fix: improve CI reliability and hook coverage (#95)
* feat(cargo): aggregate test output into single line (#83)

Problem: `cargo test` shows 24+ summary lines even when all pass.
An LLM only needs to know IF something failed, not 24x "ok".

Before (24 lines):
```
✓ test result: ok. 2 passed; 0 failed; ...
✓ test result: ok. 0 passed; 0 failed; ...
... (x24)
```

After (1 line):
```
✓ cargo test: 137 passed (24 suites, 1.45s)
```

Changes:
- Add AggregatedTestResult struct with regex parsing
- Merge multiple test summaries when all pass
- Format: "N passed, M ignored, P filtered out (X suites, Ys)"
- Fallback to original behavior if parsing fails
- Failures still show full details (no aggregation)

Tests: 6 new + 1 modified, covering all cases:
- Multi-suite aggregation
- Single suite (singular "suite")
- Zero tests
- With ignored/filtered out
- Failures → no aggregation (detail preserved)
- Regex fallback

Closes #83

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* fix(ci): prevent Python/Go benchmark sections from being silently skipped

**Problem:**
Python and Go benchmark sections were silently skipped in CI because
the RTK repository doesn't contain pyproject.toml or go.mod files.
The sections only ran when these project files existed.

**Solution:**
1. Create temporary fixtures with minimal project structure:
   - Python: pyproject.toml + sample.py + test_sample.py
   - Go: go.mod + main.go + main_test.go
2. Resolve RTK to absolute path to work after cd into temp dirs
3. Install required tools in CI workflow:
   - Python: ruff, pytest
   - Go: stable version + golangci-lint

**Impact:**
- Python/Go sections now appear in CI benchmark output
- Self-contained fixtures ensure consistent benchmarking
- No dependency on RTK project structure

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(hooks): add missing RTK command rewrites

Add 8 missing command rewrites to rtk-rewrite.sh and rtk-suggest.sh:
- cargo check/install/fmt
- tree, find, diff
- head → rtk read (with --max-lines transformation)
- wget

Fixes BSD sed compatibility for head transformation by using literal
spaces instead of \s+ (which doesn't work on macOS).

Impact: ~18.2K tokens saved on previously missed commands discovered
by `rtk discover`.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-13 08:46:01 +01:00
Florian BRUNIAUX ab43e4b823 fix(vitest): robust JSON extraction for pnpm/dotenv prefixes (#92)
* fix(vitest): robust JSON extraction for pnpm/dotenv prefixes

Problem: RTK's vitest parser forces --reporter=json but pnpm/dotenv prepend
non-JSON text to stdout (banners, env messages), causing 100% Tier 1 failure
and useless 500-char passthrough.

Solution:
- Add extract_json_object() to parser/mod.rs (shared utility)
- Algorithm: find "numTotalTests" or first standalone {, brace-balance forward
- VitestParser now tries direct parse → extract+parse → regex → passthrough
- Replace hardcoded Command::new("pnpm") with package_manager_exec("vitest")
- Delete orphan doc comment on line 203

Impact:
- Before: 100% Tier 3 passthrough with pnpm workflows
- After: Tier 1 success with prefixes, maintains 99.5% token savings

Tests:
- 6 tests for extract_json_object (clean, pnpm, dotenv, nested, no-json, strings)
- 3 tests for VitestParser with prefixes
- All 277 tests pass

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* chore(benchmark): add vitest, pnpm, and gh commands

Add benchmarks for recently implemented commands:
- vitest run (PR #92 - JSON extraction fix)
- pnpm list/outdated (PR #6)
- gh pr list/run list (existing gh support)

These commands are now tested in CI to ensure token savings are maintained.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-13 08:46:01 +01:00
github-actions[bot] 5d128cf53b chore(master): release 0.15.0 (#90)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-02-13 08:46:01 +01:00
Michael Coen 6bcdb3e586 feat: make install-local.sh self-contained (#89)
- Build from source automatically instead of requiring a pre-built binary
- Default install dir to ~/.cargo/bin
- Skip rebuild when binary is up to date
- Warn if install dir is not in PATH
2026-02-13 08:46:01 +01:00
Florian BRUNIAUX 30a30eefd9 feat: add Python and Go support (#88)
* feat(cargo): aggregate test output into single line (#83)

Problem: `cargo test` shows 24+ summary lines even when all pass.
An LLM only needs to know IF something failed, not 24x "ok".

Before (24 lines):
```
✓ test result: ok. 2 passed; 0 failed; ...
✓ test result: ok. 0 passed; 0 failed; ...
... (x24)
```

After (1 line):
```
✓ cargo test: 137 passed (24 suites, 1.45s)
```

Changes:
- Add AggregatedTestResult struct with regex parsing
- Merge multiple test summaries when all pass
- Format: "N passed, M ignored, P filtered out (X suites, Ys)"
- Fallback to original behavior if parsing fails
- Failures still show full details (no aggregation)

Tests: 6 new + 1 modified, covering all cases:
- Multi-suite aggregation
- Single suite (singular "suite")
- Zero tests
- With ignored/filtered out
- Failures → no aggregation (detail preserved)
- Regex fallback

Closes #83

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* feat: add Python and Go language support

Implements comprehensive support for Python and Go development tooling
with 70-90% token reduction across all commands.

Python commands (3):
- rtk ruff: Linter/formatter with JSON (check) and text (format) parsing (80%+)
- rtk pytest: Test runner with state machine text parser (90%+)
- rtk pip: Package manager with auto-detect uv (70-85%)

Go commands (4):
- rtk go test: NDJSON streaming parser for interleaved test events (90%+)
- rtk go build: Text filter showing errors only (80%)
- rtk go vet: Text filter for issues (75%)
- rtk golangci-lint: JSON parser grouped by rule (85%)

Architecture:
- Standalone Python commands (mirror lint/prettier pattern)
- Go sub-enum (mirror git/cargo pattern)
- 5 new modules: ruff_cmd, pytest_cmd, pip_cmd, go_cmd, golangci_cmd
- Hook integration in rtk-rewrite.sh for transparent rewrites
- Comprehensive tests (47 new tests, all passing)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

* feat(benchmark): add Python and Go commands

Add benchmark sections for Python (ruff, pytest, pip) and Go (go test/build/vet, golangci-lint) to validate >80% token savings in CI pipeline.

Sections conditionally execute based on project markers (pyproject.toml, go.mod) and tool availability.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-13 08:46:01 +01:00