326 Commits

Author SHA1 Message Date
github-actions[bot] 34b2474d4c chore(master): release 0.27.2 (#365)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
v0.27.2
2026-03-06 12:54:04 +01:00
Florian BRUNIAUX e356c1280d fix: reduce gh diff / git diff / gh api truncation (#354) (#370)
* fix: reduce gh diff / git diff / gh api truncation (#354)

- compact_diff: increase max_hunk_lines 10→30, max_lines default 100→500
- gh api: passthrough instead of JSON→schema destruction
- gh pr diff: add --no-compact flag + increase limit to 500
- gh pr view: passthrough when --json/--jq/--web provided by user

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

* docs: update version reference 0.26.0→0.27.1 in README

* docs: update version reference 0.26.0→0.27.1 in CLAUDE.md

* docs: update version reference 0.26.0→0.27.1 in ARCHITECTURE.md

* fix: resolve compile errors in gh_cmd.rs (type mismatches)

* fix: use explicit .iter() in pr_diff loop (avoids &&[String] ambiguity)

* docs: fix version reference 0.27.x→0.27.1 in README

* fix: remove shadowed extra_args in view_pr (was &&[String] not iterator)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-06 12:36:42 +01:00
patrick szymkowiak a22fe7b31f docs: revamp README with logo, badges, and structure cleanup (#371)
* docs: revamp README with logo, badges, and cleaner structure

- Add centered logo (og-image) and tagline
- Add badges: CI, release version, license, Discord, Homebrew
- Add language links placeholder (fr, zh, ja, ko, es)
- Fix Linux binary filename (gnu -> musl) — fixes #323
- Put Homebrew as recommended install method
- Simplify and reorganize all sections (871 -> ~360 lines)
- Add Discord invite link
- Remove verbose troubleshooting (link to TROUBLESHOOTING.md instead)
- Remove detailed security review section (link to SECURITY.md)

* docs: add translated READMEs (fr, zh, ja, ko, es)

Add localized README files linked from the main README language selector:
- README_fr.md (French)
- README_zh.md (Chinese)
- README_ja.md (Japanese)
- README_ko.md (Korean)
- README_es.md (Spanish)

Each translation includes: installation, quick start, commands overview,
how it works diagram, and links to documentation.

* docs: use rtk-ai org avatar as logo in all READMEs
2026-03-06 12:01:06 +01:00
Alex Tsanis 884e37edbf stream proxy output while command is running (#268) 2026-03-06 11:02:59 +01:00
patrick szymkowiak 27b35d84a3 fix: strip npx/bunx/pnpm prefixes in lint linter detection (#186) (#366)
When running `rtk lint npx eslint ...`, args[0] was "npx" instead of
"eslint", causing no JSON format flag injection and duplicated output.

Extract strip_pm_prefix() and detect_linter() helpers, skip package
manager prefixes before identifying the actual linter name.
2026-03-06 10:51:11 +01:00
Radu Ursache 0a1bcb05e5 fix: pass through -R/--repo flag in gh view commands (#328)
gh view/checks commands (pr view, issue view, pr checks, run view)
were ignoring extra flags like -R/--repo, causing failures outside
git repositories where gh needs -R to know which repo to query.

The root cause: these functions took args[0] as the identifier and
discarded everything else, while constructing hardcoded gh commands.

Changes:
- Add extract_identifier_and_extra_args() to separate the positional
  identifier from flags, handling both `view 123 -R owner/repo` and
  `view -R owner/repo 123` argument orders
- Pass extra args through to gh in view_pr, view_issue, pr_checks,
  and view_run
- Add has_json_flag() check at top of run() to passthrough when user
  explicitly requests --json output (related fix from #313)

Fixes #223
2026-03-06 10:31:10 +01:00
Sam Kvale 799f0856e4 fix: gh pr edit/comment pass correct subcommand to gh (#332)
* fix: gh pr edit/comment pass correct subcommand to gh

pr_action was receiving the past-tense display label ("edited",
"commented") and using it as both the gh subcommand and the
ok_confirmation message. This caused `gh pr edited` to be invoked
instead of `gh pr edit`, which fails with "unknown flag" errors.

Split the parameter into subcmd (for the gh invocation) and
display_label (for ok_confirmation output).

* smaller diff
2026-03-06 09:59:00 +01:00
github-actions[bot] 093e431193 chore(master): release 0.27.1 (#362)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
v0.27.1
2026-03-06 09:46:33 +01:00
patrick szymkowiak 409aed6dbc fix: support git commit -am, --amend and other flags (#327) (#360)
Clap was rejecting -a, --amend, --allow-empty etc. because Commit only
declared -m/--message. Switch to trailing_var_arg like other git
subcommands so all flags pass through to git directly.

Fixes #327
2026-03-06 09:41:23 +01:00
patrick szymkowiak 85b0b3eb0b fix: prettier false positive when not installed (#221) (#359)
* fix: prettier reports "All OK" when not installed (#221)

Empty or failed prettier output was incorrectly treated as "all files
formatted". Now detects empty output and non-zero exit code, shows the
actual error message instead of a false positive.

* test: add smoke tests for rewrite, verify, proxy, discover, diff, wc, smart, docker, json edge cases

Covers bug fixes #196, #344, #345, #346, #347 and previously untested
commands. Adds assert_fails helper. 118 assertions total (was 69).

* chore: update benchmark.sh with missing commands and fix paths

- Add cargo (build/test/clippy/check), diff, smart, wc, curl, wget sections
- Fix Python commands: use dedicated rtk ruff/pytest instead of rtk test
- Fix Go commands: use dedicated rtk go/golangci-lint, add go build/vet
- Make BENCH_DIR absolute so debug files work from temp fixture dirs
- Fallback to installed rtk if target/release/rtk not found
2026-03-06 09:40:24 +01:00
patrick szymkowiak dbc950395e fix: only rewrite docker compose ps/logs/build, skip unsupported subcommands (#336) (#363)
The rewrite pattern matched all `docker` commands but the regex didn't
cover `docker compose`, so compose subcommands were never rewritten.
Meanwhile unsupported compose commands (up, down, config) would fail
if manually prefixed with rtk.

- Extend regex to match `docker compose (ps|logs|build)`
- Unsupported compose subcommands (up, down, config, exec, etc.) are
  correctly skipped by the regex and not rewritten
- 6 new tests covering supported and unsupported compose subcommands

Fixes #336
2026-03-06 09:24:28 +01:00
Radu Ursache 45f9344f03 fix: preserve -- separator for cargo commands and silence fallback (#326)
Two fixes for command passthrough issues:

1. Restore `--` separator stripped by clap (#287): When running
   `rtk cargo test -- --nocapture`, clap consumes `--` and passes only
   `["--nocapture"]` to cargo, which rejects it. Now detect `--` from
   the original command line and re-insert it in the correct position.

2. Remove noisy `[rtk: parse failed, running raw]` stderr message (#286):
   Unrecognized commands like `rtk make` or `rtk ruby` pass through
   silently via the fallback, matching the documented behavior.

Fixes #286
Fixes #287
2026-03-06 09:00:13 +01:00
github-actions[bot] f693e060c6 chore(master): release 0.27.0 (#353)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
v0.27.0
2026-03-05 23:17:41 +01:00
Patrick szymkowiak 8953af0fc0 fix: bugs #196 #344 #345 #346 #347 — gh --json, hook check, RTK_DISABLED, 2>&1, json TOML 2026-03-05 23:08:41 +01:00
Patrick szymkowiak 079ee9a4ea fix: skip rewrite for gh --json/--jq/--template (#196)
gh commands with --json, --jq, or --template produce structured output
that rtk gh filtering would corrupt. Skip rewrite so callers get raw JSON.
2026-03-05 23:08:08 +01:00
Florian BRUNIAUX 7ad291bab5 docs: bump version refs to 0.26.0, fix module count to 57
Version mentions (README.md, CLAUDE.md, ARCHITECTURE.md) were still
on 0.25.0. Module count was 56 (missed hook_check module added in #350).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-05 22:52:15 +01:00
Florian BRUNIAUX 6c13d23436 fix: RTK_DISABLED ignored, 2>&1 broken, json TOML error (#345, #346, #347)
- #345: rewrite_segment() now returns None when env_prefix contains
  RTK_DISABLED= — prevents rewriting commands the user explicitly
  opted out of
- #346: rewrite_compound() detects redirect operators (2>&1, >&2,
  &>/dev/null, &>>) before treating bare & as background operator —
  fixes corrupted compound commands containing stderr redirects
- #347: validate_json_extension() helper added to json_cmd.rs — early
  rejection with clear error message for TOML/YAML/XML/CSV/etc. files,
  with a dedicated tip for Cargo.toml (suggests rtk deps)

Tests: 16 new unit tests (4 + 6 + 6), 7 new hook integration tests.
All 672 tests pass. Quality gate clean.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-05 22:50:17 +01:00
patrick szymkowiak 3141fecf95 feat: warn when installed hook is outdated (#344) (#350)
- Add `# rtk-hook-version: 2` header to hook file
- New `hook_check` module: detect outdated hook on startup, warn 1/day
- Homebrew caveats: remind users to run `rtk init -g` after upgrade
2026-03-05 22:33:17 +01:00
github-actions[bot] 32ade38e0a chore(master): release 0.26.0 (#337)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
v0.26.0
2026-03-05 21:02:37 +01:00
Florian BRUNIAUX 6ad6ffecce feat: add Claude Code skills for PR and issue triage (#343)
* feat: add Claude Code skills for PR and issue triage

Two skills that power structured audits directly in Claude Code sessions.
They replace ad-hoc manual reviews with a repeatable, documented workflow.

**`/pr-triage`** — Pull request audit
Scans open PRs, runs deep review on selected ones, and posts formatted
review comments to GitHub. Covers code quality, test coverage, security
surface, and alignment with CLAUDE.md conventions. Useful before every
merge and for contributor onboarding.

**`/issue-triage`** — Issue audit
Audits open issues, auto-categorizes (bug/feature/doc/question), detects
duplicates, cross-references related PRs, and estimates risk/priority.
Posts structured comments so maintainers have a clear action queue.

Both skills integrate with the `gh` CLI and can be invoked with args:
  /pr-triage 42 57        — deep review of specific PRs
  /pr-triage all          — full audit of all open PRs
  /issue-triage           — audit-only mode (no comments posted)
  /issue-triage all en    — deep analysis, English output

These reduce the overhead of code review and issue management to a single
slash command, keeping context inside the Claude Code session.

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

* docs: fix version references 0.24.0 → 0.25.0 and module count (pre-existing)

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-05 20:51:15 +01:00
Florian BRUNIAUX a8d6106f73 fix: curl JSON size guard (#297) + exclude_commands config (#243) (#342)
* fix: curl size guard (#297) + exclude_commands config (#243)

**#297 — curl JSON inflation guard**
- `rtk curl` no longer replaces small JSON responses with a type schema
  that is larger than the original payload
- Size guard in `filter_curl_output()`: only return schema when
  `schema.len() <= original.len()`
- Inspired by PR #324 (@rursache)

**#243 — exclude_commands config**
- Add `[hooks] exclude_commands = ["curl"]` in config.toml to prevent
  the auto-rewrite hook from rewriting specific commands
- Survives `rtk init -g` re-runs (config.toml is user-owned)
- Implemented in `rewrite_cmd::run()` via `HooksConfig` struct
- Threaded through `rewrite_command()` → `rewrite_compound()` → `rewrite_segment()`

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

* docs: add #297 and #243 to CHANGELOG + exclude_commands in README

* docs: fix version references 0.24.0 → 0.25.0 across all docs

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-05 20:46:40 +01:00
patrick szymkowiak baff6a2334 feat: anonymous telemetry ping (1/day, opt-out) (#334)
* feat: add anonymous telemetry ping (1/day, opt-out)

Fire-and-forget daily ping to track active installs for BPI metrics.
- SHA-256 device hash (hostname:user), no PII
- Opt-out: RTK_TELEMETRY_DISABLED=1 or config.toml [telemetry] enabled=false
- Token injected at compile time via option_env!, not in source
- 23h throttle via marker file, 2s timeout, non-blocking thread

* ci: inject RTK_TELEMETRY_TOKEN at build time in release workflow

All 3 build jobs (binary, DEB, RPM) now receive the token from
GitHub secrets so option_env!() compiles it into release binaries.

* refactor: externalize telemetry URL via option_env!(RTK_TELEMETRY_URL)

URL and token are both injected at compile time — no hardcoded
server address in source code. Builds without the env var simply
skip telemetry silently.
2026-03-05 15:34:49 +01:00
github-actions[bot] 99b9f9f926 chore(master): release 0.25.0 (#321)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
v0.25.0
2026-03-05 14:32:19 +01:00
Florian BRUNIAUX f447a3d5b1 feat: rtk rewrite — single source of truth for LLM hook rewrites (#241)
* feat: add `rtk rewrite` command — single source of truth for hook rewrites

Implements `rtk rewrite <cmd>` as the canonical rewrite engine for all
LLM hook integrations (Claude Code, Gemini CLI, future tools).

- Add `rewrite_prefixes` field to `RtkRule` in discover/registry.rs
- Add public `rewrite_command()` with compound command support (&&, ||, ;, |)
- Add `rewrite_segment()`, `rewrite_compound()`, `strip_word_prefix()` helpers
- Handle already-rtk commands (exit 0, identical output)
- Handle unsupported/ignored commands (exit 1, no output)
- Add 20 unit tests covering all branches and edge cases
- Create `src/rewrite_cmd.rs` thin CLI wrapper
- Register `Commands::Rewrite` in main.rs
- Simplify `.claude/hooks/rtk-rewrite.sh` from 357 → 60 lines

Hooks no longer need duplicate mapping logic — a single
`REWRITTEN=$(rtk rewrite "$CMD") || exit 0` handles everything.

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

* docs: fix version references and module count for 0.22.2

- README.md, CLAUDE.md, ARCHITECTURE.md: 0.20.1 → 0.22.2
- ARCHITECTURE.md: module count 48 → 51 (added rewrite_cmd + 2 from master)

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

* ci: update hook coverage check to verify registry (not hook script)

Since PR #241, the hook delegates to `rtk rewrite` — command mappings
live in src/discover/registry.rs, not the bash hook script.

Update the "Verify hook coverage" CI step to:
- Check that the hook calls `rtk rewrite` (new architecture)
- Check that registry.rs has rewrite_prefixes for all Python/Go commands

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

* feat: support single `&` background operator in compound rewrites

Per feedback from @xDelph: AI agents increasingly use `cmd1 & cmd2`
for parallel execution. This commit adds support alongside existing
`&&`, `||`, `;`, and `|` operators.

Changes:
- rewrite_compound: add match arm for single `&` (after `&&` check)
- rewrite_command: add `" & "` to has_compound detection
- init: show "installed/updated" vs "already up to date" so users
  know whether rtk init changed the hook on re-run

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

* fix: add Python/Go commands to rewrite registry

Add `ruff`, `pytest`, `pip`, `go`, and `golangci-lint` to both
PATTERNS and RULES in registry.rs so the CI coverage check passes
and `rtk rewrite` correctly identifies these commands.

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

* docs: update version reference to 0.23.0 in README

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

* docs: update version reference to 0.23.0 in CLAUDE.md

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

* docs: update version and module count to 0.23.0/52 in ARCHITECTURE.md

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

* fix: address P0 review feedback on rtk-rewrite PR

P0.1 - Replace 218-line bash hook with 58-line thin delegating hook.
  All rewrite logic now lives exclusively in `rtk rewrite` (Rust registry).
  `rtk init` installs the thin hook via include_str!.

P0.2 - Fix `head -20 file` crash at runtime.
  Generic prefix replacement produced `rtk read -20 file` (invalid clap args).
  Now translates `head -N file` → `rtk read file --max-lines N` and skips
  unsupported head flags (e.g. -c) by returning exit 1.

P0.3 - Add version guard in hook for rtk < 0.23.0.
  Prints a warning to stderr instead of silently doing nothing.

Also adds missing registry entries vs old hook:
  - gh release, cargo install
  - docker run/exec/build, kubectl describe/apply
  - tree, diff

474 tests pass, 0 clippy warnings.

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

* style: cargo fmt

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

* refactor(discover): extract rules/patterns into rules.rs

Per aeppling review: registry.rs was too large (~1500 lines).
Extract all static data into src/discover/rules.rs:
- RtkRule struct (with pub fields)
- PATTERNS const array
- RULES const array
- IGNORED_PREFIXES and IGNORED_EXACT const arrays

registry.rs now contains only logic + tests.
rules.rs is the single place to add a new command mapping.

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

* docs: update version reference to 0.24.0 in README

* docs: update version references to 0.24.0 in CLAUDE.md and ARCHITECTURE.md

* fix(discover): add aws and psql to rewrite registry

rtk aws and rtk psql modules exist since PR #216 but were missing
from the registry rules — rewrite was silently skipping them.

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

* test(discover): exhaustive regression tests for rewrite registry

Cover all command categories added in PR #241 and missing from
the previous test suite:
- aws / psql (PR #216 modules, gap detected during non-reg run)
- Python: ruff, pytest, python -m pytest, pip, uv pip
- Go: go test/build/vet, golangci-lint
- JS/TS: vitest, pnpm vitest, prisma, prettier, pnpm list
- Compound operators: || and ; rewrites, 4-segment chains,
  mixed supported/unsupported segments, all-unsupported → None
- sudo prefix rewrite, env var prefix rewrite
- find with native flags
- Registry invariants: PATTERNS/RULES aligned, all rules valid,
  all patterns are valid regex

Before: 559 tests. After: 607 tests.

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

* feat(migration): document breaking change + detect outdated hook in rtk config

CHANGELOG [Unreleased]:
- Migration required: rtk init --global needed after upgrade
- Documents upgrade path and explains no immediate breakage

rtk init --show / rtk config now detects old hook (inline if-else)
vs new thin delegator (rtk rewrite) and prints actionable warning:

  ⚠️  Hook: ~/.claude/hooks/rtk-rewrite.sh (outdated — inline logic, not thin delegator)
     → Run `rtk init --global` to upgrade to the single source of truth hook

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

* docs: update hook references for thin delegator (0.24.0)

- ARCHITECTURE.md: fix hook description (shell script → thin delegator)
- INSTALL.md: add upgrade path for old hook users (pre-0.24 breaking change)
- SECURITY.md: add registry.rs + hook files to Tier 1 critical files

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

* docs(arch): fix module count 52→55, add aws/psql/rewrite to module map

Adds aws_cmd, psql_cmd (PR #216) and rewrite_cmd (this PR) to the
Complete Module Map table. Updates total from 52 to 55 to match main.rs.

Fixes CI validate-docs.sh module count mismatch.

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

* ci: fix hook coverage check to search rules.rs instead of registry.rs

After the PR #241 refactor, rewrite_prefixes constants moved from
registry.rs to rules.rs. Update grep to search the whole discover/
directory so it finds them in the right file.

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

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-05 14:20:01 +01:00
Sahil Gandhi 7ac5bc4bd3 fix(find): accept native find flags (-name, -type, etc.) (#211)
* fix(find): accept native find flags (-name, -type, etc.)

* fix: apply cargo fmt after merge

* Merge master into fix/find-positional-args

Update git -C test for new global options support, apply fmt.
2026-03-05 09:10:01 +01:00
github-actions[bot] dd643d2322 chore(master): release 0.24.0 (#302)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
v0.24.0
2026-03-04 12:48:19 +01:00
USerik 4eb6cf4b1a fix(playwright): fix JSON parser to match real Playwright output format (#193)
Three bugs caused `rtk playwright test` to always fail with EXIT: 1:

1. **Wrong argument order**: `--reporter=json` was inserted before the
   subcommand (e.g. `playwright --reporter=json test`), but Playwright
   requires flags after the subcommand (`playwright test --reporter=json`).

2. **Float duration deserialization**: `PlaywrightStats.duration` was typed
   as `u64`, but real Playwright output emits a float (e.g. `3519.703...`),
   causing serde_json to fail with a type error.

3. **Wrong suite structure**: Suites contain `specs` (not `tests`). Each
   spec has `ok: bool` and `tests` (per-browser executions). The old struct
   used `tests: Vec<PlaywrightTest>` directly in suites, which never matched
   real output and always failed JSON parsing.

Fixes:
- Move `--reporter=json` to after the first arg (the subcommand)
- Change `duration: u64` to `duration: f64` in `PlaywrightStats`
- Rewrite `PlaywrightSuite` → `specs: Vec<PlaywrightSpec>`
- Add `PlaywrightSpec` with `ok: bool` and `tests: Vec<PlaywrightExecution>`
- Add `PlaywrightExecution` with `status` and `results: Vec<PlaywrightAttempt>`
- Update `PlaywrightAttempt` to use `errors: Vec<PlaywrightError>` (array)
- Add tests covering float duration, real suite structure, and failure details

Co-authored-by: devkeruse <devkeruse@gmail.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-04 12:14:11 +01:00
Itai b934466364 feat: add AWS CLI and psql modules with token-optimized output (#216)
AWS CLI (rtk aws):
- Specialized filters for sts, s3 ls, ec2, ecs, rds, cloudformation
- Generic fallback injects --output json for structured ops only
  (describe-*, list-*, get-*); mutating ops (s3 cp, deploy) pass through
- join_with_overflow() and truncate_iso_date() helpers in utils.rs

psql (rtk psql):
- Table format: strips separators/padding, outputs tab-separated
- Expanded format: compresses -[ RECORD N ]- blocks to key=val one-liners
- Passthrough for COPY results, notices, and non-table output
- 40%+ savings (table), 60%+ savings (expanded display)

Co-authored-by: itai.sagi <itai.sagi@clarityo.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-04 11:12:25 +01:00
Guillaume Deslandes 772b5012ed feat: passthrough fallback when Clap parse fails + review fixes (#200)
* feat: passthrough fallback when Clap parse fails

When RTK cannot parse a command (e.g. `rtk git -C /path status`),
instead of exiting with error code 2, it now falls back to running
the raw command directly. This keeps developer workflows unbroken.

- Replace Cli::parse() with try_parse() + run_fallback()
- Add parse_failures SQLite table for failure analytics
- Add `rtk gain --failures` / `-F` to view failure log
- Fallback preserves stdin/stdout/stderr via Stdio::inherit()
- --help and --version still work normally

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

* fix: guard RTK meta-commands from fallback to raw execution

When Clap fails to parse a meta-command like `rtk gain --badtypo`,
show the Clap error directly instead of trying to execute `gain`
as a binary from $PATH. Adds RTK_META_COMMANDS constant listing
gain, discover, learn, init, config, proxy, hook-audit, cc-economics.

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

* fix: move timer start before command execution in fallback

TimedExecution::start() was called after the command finished,
so all fallback commands showed ~0ms in rtk gain --history.
Now the timer captures actual command runtime.

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

* fix: add cleanup_old() call to record_parse_failure()

The parse_failures table was never cleaned up because only record()
called cleanup_old(). Now parse failures also trigger 90-day retention
cleanup.

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

* fix: strip ANSI codes from Clap error before SQLite storage

Clap errors may contain terminal color codes. Strip them with
utils::strip_ansi() before storing in the parse_failures table
to avoid garbled output and wasted space.

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

* fix: smoke test cargo test assertion and missing skip_test calls

- cargo test check now matches RTK's filtered output format ("passed")
  in addition to raw "test result:" and "FAILURES"
- Fix undefined `skip` calls to use existing `skip_test` function
  with proper (name, reason) arguments

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

* chore: fmt upstream files after rebase

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

* fix: update version refs to 0.23.0 and module count to 51

Upstream v0.23.0 release bumped Cargo.toml version and added mypy_cmd
module. Update docs to match for CI validation.

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 10:38:33 +01:00
aesoft a6ccefe8e7 Merge pull request #192 from guillaumedeslandes/fix/git-global-options
fix: support git global options (-C, -c, --git-dir, --work-tree, --no-pager, --no-optional-locks, --bare, --literal-pathspecs)
2026-03-03 15:38:13 +01:00
aesoft f2caca3abc Merge pull request #119 from playb0t/feat/hook-integrity
feat(security): add SHA-256 hook integrity verification
2026-03-03 11:30:02 +01:00
aesoft a413e57301 missing bracket 2026-03-03 10:49:54 +01:00
aesoft c9087a4b07 Merge branch 'master' into feat/hook-integrity 2026-03-03 09:48:54 +01:00
polamin 5cfaeccaba fix(git): propagate exit codes in push/pull/fetch/stash/worktree (#234)
run_push, run_pull, run_fetch, run_stash (pop/apply/drop/push and
default), and run_worktree all printed FAILED messages on error but
returned Ok(()) instead of propagating git's exit code.

This breaks CI/CD pipelines and shell scripts that rely on exit code
semantics (e.g. `git push || handle_error`).

Fix: call std::process::exit(output.status.code().unwrap_or(1)) in
each failure branch, matching the pattern already used in run_log,
run_diff, run_add, and run_branch.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-02 15:52:38 +01:00
Guillaume Deslandes eed018814b fix: update version refs to 0.23.0, module count to 51, fmt upstream files
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 12:55:40 +01:00
Guillaume Deslandes 68ca7126d4 fix: support additional git global options (--no-pager, --no-optional-locks, --bare, --literal-pathspecs)
Extends the existing git global options support to accept boolean flags
that the hook already strips for subcommand matching but Clap was rejecting.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 12:54:39 +01:00
Guillaume Deslandes 982084ee34 fix: support git global options (-C, -c, --git-dir, --work-tree)
git -C <path> and other global options were rejected because Clap
expected a subcommand immediately after `git`. Add these options to
the Git command variant and thread them through all git subcommand
handlers via a git_cmd() helper that prepends global args before
the subcommand.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 12:54:39 +01:00
github-actions[bot] 44cb9ec44c chore(master): release 0.23.0 (#250)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
v0.23.0
2026-02-28 22:10:06 +01:00
heAdz0r 2b550eebd6 feat(gain): add per-project token savings with -p flag (#128)
* feat(gain): add per-project token savings with -p flag

Record project_path (cwd) in tracking database and add filtered query
methods. `rtk gain -p` shows savings scoped to the current project
directory instead of global aggregates.

- tracking.rs: Add project_path column with auto-migration, index,
  and filtered variants for all query methods (summary, daily, weekly,
  monthly, recent)
- gain.rs: Add resolve_project_scope(), shorten_path(), scope-aware
  header, pass project filter to all queries and exports
- main.rs: Add --project/-p flag to Gain command

Backward-compatible: existing rows get empty project_path, unfiltered
queries delegate to filtered(None) which returns all data.

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

* fix(tracking): use GLOB instead of LIKE for project path filtering

Address reviewer feedback on PR #128:

1. Replace SQL LIKE with GLOB in all project-scoped queries to prevent
   `_` and `%` characters in path names from being interpreted as
   wildcards (e.g., `my_project` matching `myXproject`). GLOB uses `*`
   for wildcard matching which is safer for file system paths.

2. Guard the startup `UPDATE commands SET project_path = ''` migration
   with an `EXISTS` check so it only runs when NULL rows actually exist,
   avoiding a no-op UPDATE on every startup after the first migration.

3. Add `DEFAULT ''` to the ALTER TABLE migration so new installs never
   create NULL project_path values.

4. Add 3 new unit tests for project_filter_params GLOB behavior.

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 20:07:01 +01:00
Rmohid e8ef341853 feat: add mypy command with grouped error output (#109)
* feat: add mypy command with grouped error output (80% token reduction)

Add rtk mypy module that parses mypy type checker output, groups errors
by file and error code, and produces compact summaries. Includes
discovery registry pattern, hook rewrites, and 11 new tests (324 total).

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

* fix: address review - remove specs/ and clean CLAUDE.md

Remove process docs (spec, plan, tasks, research, checklists) from
specs/001-mypy-cmd/ and strip "Active Technologies" / "Recent Changes"
sections from CLAUDE.md per PR #109 review feedback.

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

* fix: address review - deduplicate mypy handler, delegate from lint_cmd

Make lint_cmd.rs delegate to mypy_cmd::filter_mypy_output() instead of
maintaining a separate, less capable implementation. The mypy_cmd version
handles column numbers, note continuations, file-less errors, and shows
full error details. Removes 145 lines of duplicate code + 2 redundant tests.

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

---------

Co-authored-by: Robert Mohid <rmohid@Roberts-Mini.ht.home>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 19:51:40 +01:00
stringer fan a6f65f11da fix: eliminate duplicate output when grep-ing function names from git show (#248) 2026-02-28 18:55:50 +01:00
Ricardo Liberato b405e48ca6 fix: surface build failures in go test summary (#274)
`go test -json` emits build failures as `build-output`/`build-fail`
actions with `ImportPath` (not `Package`/`Test`), followed by a
package-level `fail` with a `FailedBuild` field. The JSON parser
only counted failures when `event.test.is_some()`, so build errors
were silently dropped from the summary — showing "891 passed" when
a package failed to compile.

Now parses `build-output`, `build-fail`, and `FailedBuild` fields.
Build failures count toward the total and display with `[build failed]`
plus the compiler error lines.

Before:
  ✓ Go test: 891 passed in 74 packages

After:
  Go test: 891 passed, 1 failed in 74 packages
  ═══════════════════════════════════════

  📦 stream [build failed]
    handler_test.go:64:9: undefined: undefinedVariable

Co-authored-by: Ricardo Liberato <ricardo@liberato.pt>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 18:50:48 +01:00
mercierj dbbf980f3b fix: filter docker compose hook rewrites to supported subcommands (#245)
The hook was rewriting all `docker compose` commands to `rtk docker
compose`, but rtk only supports ps, logs, and build. Unsupported
subcommands (up, down, exec, restart...) and compose-level flags
(-f, --project-name) caused hard failures.

Now matches the approach used by the regular docker branch: only
rewrite when the subcommand is known to be supported.

Fixes #244

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 18:49:24 +01:00
hoklims 48965c85d2 fix(registry): "fi" in IGNORED_PREFIXES shadows find commands (#246)
The shell keyword "fi" was listed as a bare prefix in IGNORED_PREFIXES,
causing classify_command("find ...") to return Ignored because
"find".starts_with("fi") is true. This prevented find commands from
being rewritten by rtk rewrite and the hook system.

Move "fi" and "done" from IGNORED_PREFIXES to IGNORED_EXACT so they
only match as exact standalone keywords, not as prefixes of other
commands.

Fixes #170, #204, #236 (partially — find classification was the root
blocker for rtk rewrite).

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 18:45:30 +01:00
Vincent Vanackere 3b84b33e3c ci: replace x86_64-unknown-linux-gnu with musl target for static binaries (#267)
The current x86_64-unknown-linux-gnu release binary dynamically links against glibc, which causes failures on systems with an older glibc version:

rtk: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.39' not found (required by rtk)

Replace the x86_64-unknown-linux-gnu build target with x86_64-unknown-linux-musl, producing a fully statically-linked binary with no libc dependency.

Fixes rtk-ai/rtk#265 - binary fails on systems with old glibc.
2026-02-28 18:38:52 +01:00
Florian BRUNIAUX 5b597002dc Merge pull request #251 from rtk-ai/fix/remove-personal-refs-claude-md
fix: remove remaining personal project reference from CLAUDE.md
2026-02-22 15:21:28 +01:00
Florian BRUNIAUX dc092655fb fix: remove remaining personal project reference from CLAUDE.md
Remove `methode-aristote/app` project name from the JS/TS tooling
section. Project-specific CLAUDE.md should not reference personal
projects or contributor-specific context.

Follow-up to #242.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-22 15:09:57 +01:00
Florian BRUNIAUX 3a8044ef69 Merge pull request #242 from edsai/fix/claude-md-personal-prefs
fix: remove personal preferences from project CLAUDE.md
2026-02-22 15:09:09 +01:00
Florian BRUNIAUX 6bbb786d4b Merge pull request #249 from rtk-ai/docs/add-ascii-diagrams
docs: add ASCII diagrams to README, INSTALL and ARCHITECTURE
2026-02-22 14:59:13 +01:00
Florian BRUNIAUX a9889bca08 docs: fix version and module count to pass CI validation
- README.md, CLAUDE.md: update version 0.20.1 → 0.22.2
- ARCHITECTURE.md: update version 0.20.1 → 0.22.2 + date
- ARCHITECTURE.md: update module count 48 → 50 (added hook_audit_cmd, wc_cmd)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-22 14:47:20 +01:00