Commit Graph

158 Commits

Author SHA1 Message Date
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
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
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
Ed Saipetch 461856c8fd fix(playwright): fix JSON parser and binary resolution (#215)
Three bugs fixed:

1. JSON struct mismatch: The parser expected `suites[].tests[]` but
   Playwright's JSON reporter outputs `suites[].specs[].tests[]`.
   Added PlaywrightSpec layer, use `spec.ok` for failure detection,
   and `errors: Vec<PlaywrightError>` (array, not Option).

2. Float duration: Playwright emits `duration` as f64, not u64.
   Changed struct field type to avoid deserialization failures.

3. pyenv shim collision: `which playwright` can resolve to a pyenv
   shim (Python's playwright) which lacks a `test` subcommand.
   Bypass `which` entirely and resolve through the detected package
   manager (npx/pnpm/yarn).

Also strips user-supplied `--reporter` flags to avoid conflicts with
the forced `--reporter=json`.
2026-02-20 17:31:12 +01:00
polamin f1be88565e fix: propagate rg exit code in rtk grep for CLI parity (#227)
rtk grep previously returned exit 0 for all failure modes (no match,
invalid regex, missing file) where rg returns non-zero. This broke
shell workflows relying on exit code semantics.

Now propagates rg exit codes: 1 (no match), 2 (error) and surfaces
stderr for error cases so users see why the command failed.

Fixes #162

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 17:15:17 +01:00
aesoft 03ca65e9a5 Merge branch 'master' into fix/grep-accept-n-flag 2026-02-20 10:54:04 +01:00
aesoft 292225f2dd Merge pull request #203 from axelbellec/master
fix(git): support multiple -m flags in git commit
2026-02-19 15:52:14 +01:00
Jean-Baptiste Ronssin 4208015cce fix: smart markdown body filter for gh issue/pr view (#188) (#214)
Replace truncated body display (3 lines + 80 chars) with intelligent
markdown filtering that preserves all meaningful content while removing
noise (HTML comments, badges, image-only lines, horizontal rules,
excessive blank lines). Code blocks are preserved untouched.

Closes #188

Co-authored-by: Jb <jb@Jbs-MacBook-Pro.local>
2026-02-19 15:51:35 +01:00
Axel Bellec c18553a55c fix(git): support multiple -m flags in git commit
Change message from String to Vec<String> so Clap accepts repeated
-m flags, matching native git behavior for multi-paragraph commits.
Extract build_commit_command() for testability. Add 6 tests covering
Clap parsing and command construction. Closes #202.
2026-02-19 14:16:35 +01:00
Guillaume Deslandes 88dc752220 fix: git branch creation silently swallowed by list mode (#194)
`rtk git branch <name>` fell into the listing code path which injected
`-a --no-color`, turning the creation into a pattern-filtered listing
(silent no-op with exit 0). Detect positional args without list-mode
flags and route them to direct passthrough so branch creation, including
`git branch <name> <start-point>`, works correctly.

Adds regression integration tests for both cases.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 23:56:36 +01:00
heAdz0r 70d1b04093 fix(grep): translate BRE \| alternation and strip -r flag for rg (#206)
Two bugs when passing grep-idiom arguments to rtk grep:

1. Pattern alternation `\|` (BRE syntax) returns 0 results because rg
   uses PCRE-style `|`, not BRE `\|`. Users coming from grep/awk muscle
   memory naturally write `rtk grep "fn foo\|fn bar" src/` and get
   empty output with no error.
   Fix: translate `\|` → `|` in pattern before passing to rg.

2. `-r`/`--recursive` flag (grep idiom) silently breaks the search.
   In rg, `-r` means `--replace` and requires an argument — passing it
   alone causes rg to exit with an error. The `.or_else(|_| ...)` fallback
   only catches IO errors (command not found), so the grep fallback never
   triggers; stdout is empty and rtk reports "0 for '<pattern>'".
   Fix: filter out `-r`/`--recursive` from extra_args before building
   the rg command (rg is recursive by default, flag is a no-op).

Adds two regression tests documenting both behaviours.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-18 23:47:23 +01:00
polamin 8e826fc89f fix: propagate linter exit code in rtk lint (#207)
rtk lint was always returning exit code 0 regardless of the underlying
linter's exit status, causing false-green CI behavior when lint should fail.

Uses !output.status.success() pattern consistent with all other RTK modules,
which correctly handles both non-zero exit codes and signal termination.

Fixes #185

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 23:41:06 +01:00
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
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
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
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 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
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
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
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
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
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 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
Florian BRUNIAUX e5adba8b21 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-12 23:11:24 +01:00
Florian BRUNIAUX a005bb15c0 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-12 21:51:10 +01:00
Florian BRUNIAUX 06b10491f9 feat(cargo): aggregate test output into single line (#83) (#85)
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>
2026-02-12 20:36:13 +01:00
Joan Bordeau 93364b5457 feat(sqlite): add custom sqlite db location 2026-02-10 21:42:46 +01:00
Florian BRUNIAUX 645a773a65 feat(cargo): add cargo install filtering with 80-90% token reduction
Strip dep compilation, downloading, locking noise from cargo install output.
Keep only installed/replaced/error lines with compact summary format.

Closes #69

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 11:36:14 +01:00
Florian BRUNIAUX 848a63dfac feat(init): auto-patch settings.json for frictionless hook installation
## Summary

Eliminates manual settings.json setup friction by automating hook
registration with safety (backup, atomic writes, idempotency).

## Changes

### Core Features
- **Auto-patch**: Default `rtk init -g` prompts to patch settings.json [y/N]
- **CLI flags**: `--auto-patch` (no prompt), `--no-patch` (manual), `--uninstall` (full cleanup)
- **Safety**: Automatic backup to `settings.json.bak` before modification
- **Idempotency**: Detects existing hook, skips modification
- **Status check**: `rtk init --show` now displays settings.json registration

### Implementation
- New types: `PatchMode` (Ask/Auto/Skip), `PatchResult` (tracking outcomes)
- New functions in `src/init.rs`:
  - `hook_already_present()` - Detects RTK hook via substring match
  - `insert_hook_entry()` - Deep-merges hook using idiomatic `entry()` API
  - `atomic_write()` - Crash-safe writes with tempfile
  - `patch_settings_json()` - Main orchestrator
  - `uninstall()` - Complete cleanup (hook, RTK.md, settings.json)
- Modified functions: `run()`, `run_default_mode()`, `run_hook_only_mode()`, `show_config()`

### Code Quality Improvements
- Refactored `insert_hook_entry()` to use Rust `entry()` API (no manual unwraps)
- Simplified `hook_already_present()` with iterator chains (3x shorter)
- Improved error messages with file paths and actionable hints
- Fixed string allocation (to_str() vs to_string())

### Dependencies
- Added `preserve_order` feature to `serde_json` (key order preservation)
- Moved `tempfile` to production dependencies (atomic writes)

### Documentation
- **README.md**: Updated Quick Install, added Installation Flags, Uninstalling, Troubleshooting, What Are Hooks sections
- **INSTALL.md**: Updated Recommended Setup, added Common User Flows, Uninstalling sections
- **CHANGELOG.md**: Documented new feature under Unreleased

### Testing
- 11 new unit tests for hook detection, insertion, atomic writes, cleanup
- All 249 tests passing
- Smoke tested: install, idempotency, show, uninstall

## User Impact

**Before**: Users had to manually copy JSON snippet to settings.json
**After**: Single command with prompt, automatic backup, clean uninstall

## Breaking Changes

None. Backwards compatible - manual setup still works via `--no-patch`.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-07 16:12:40 +01:00
Florian BRUNIAUX 38fc860c31 refactor(init): eliminate DRY violations and improve error handling
## Code Quality Improvements

**Extracted helper functions:**
- `prepare_hook_paths()`: Prepare hook directory and paths (DRY)
- `ensure_hook_installed()`: Idempotent hook installation with chmod
- `write_if_changed()`: Generic file write with idempotence

**Before (duplicated):**
- Hook path logic repeated in default_mode + hook_only_mode
- Hook write logic repeated (lost idempotence in hook-only)
- RTK.md write logic duplicated

**After (DRY):**
- Single source of truth for each operation
- Consistent idempotence across all modes
- Reusable helpers for future file operations

## Error Handling Enhancements

**Improved error context:**
- `.with_context(|| format!("Failed to write hook to {}", path))`
- All fs operations now include the path that failed
- Migration warnings include line numbers and actionable steps

**Better Windows messaging:**
- Clear explanation of platform limitations
- Explicit fallback behavior

## API Improvements

**Idiomatic Rust:**
- `&PathBuf` → `&Path` for all function parameters
- Pattern match tuple instead of if/else chain
- `anyhow::bail!` for Windows hook-only error

## Impact

- **Maintainability**: Single place to update hook/file logic
- **Debuggability**: Error messages show exact paths
- **Robustness**: Consistent idempotence prevents conflicts

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-07 15:28:24 +01:00
Florian BRUNIAUX 9620f66cd6 feat(init): refactor to hook-first with slim RTK.md
## Changes

**New default mode (hook + RTK.md):**
- Embed hook script in binary (include_str!)
- Write hook + chmod +x with guards (rtk/jq check before set -e)
- Write slim RTK.md (10 lines: meta commands only)
- Add @RTK.md reference to CLAUDE.md
- Print settings.json instructions (no auto-patch)

**Migration:**
- Auto-detect old <!-- rtk-instructions --> block
- Remove 137-line block, preserve user content
- Replace with @RTK.md reference

**New CLI flags:**
- `--claude-md`: Legacy mode (full injection)
- `--hook-only`: Hook only, no RTK.md
- Default (no flags): Hook + RTK.md (recommended)

**Enhanced --show:**
- Detect hook executable status (Unix)
- Detect hook guards (rtk/jq)
- Detect @RTK.md vs old block
- Show slim vs legacy mode

**Files added:**
- hooks/rtk-rewrite.sh (embedded, with guards)
- hooks/rtk-awareness.md (slim RTK.md content)

**Token savings:**
~2000 tokens → ~10 tokens in context (99.5% reduction)
Hook rewrites commands transparently (0 tokens overhead)

**Tests:** 9 new tests, all passing (236 total)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-07 15:11:24 +01:00
Florian BRUNIAUX d5f8a94604 fix(discover): add cargo check support, wire RtkStatus::Passthrough, enhance rtk init
## Discover Registry Fixes
- Add `check` to cargo pattern (registry.rs:52)
- Add `("check", 80.0)` savings to cargo rule
- Wire `RtkStatus::Passthrough` for `cargo fmt` (0% savings, passthrough mode)
- Add `status: RtkStatus` field to `Classification::Supported`
- Extract status from subcommand rules in classify_command()
- Fix UTF-8 truncation bug in report.rs truncate_str() (panic on multi-byte chars)

## Tests (7 new)
- test_classify_cargo_check()
- test_classify_cargo_check_all_targets()
- test_classify_cargo_fmt_passthrough() → status = Passthrough
- test_classify_cargo_clippy_savings()
- test_patterns_rules_length_match() → assert PATTERNS.len() == RULES.len()
- test_registry_covers_all_cargo_subcommands() → coupling test
- test_registry_covers_all_git_subcommands() → coupling test

## RTK Init Rewrite
- Rewrite template in English with 32+ commands grouped by workflow
- Add version marker `<!-- rtk-instructions v2 -->` for idempotency
- Fix idempotency detection: use marker instead of French text
- Add tests:
  - test_init_mentions_all_top_level_commands() → 15 key commands
  - test_init_has_version_marker()

## Documentation
- CLAUDE.md: dual format (raw + rtk) for all dev commands
- CLAUDE.md: pre-commit gate uses rtk
- ~/.claude/CLAUDE.md: add Cargo section (80-90% savings)

## Verification
✅ 229 tests pass (7 new)
✅ 88 smoke tests pass
✅ cargo fmt + clippy clean
✅ All coupling tests enforce registry/Commands alignment

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-06 16:28:13 +01:00
Florian BRUNIAUX 60d2d252ef fix: P0 crashes + cargo check + dedup utilities + discover status
Phase 1: Fix P0 crashes (3 bugs)
- Add external_subcommand fallback for cargo/docker/kubectl
- Fixes crashes on unsupported subcommands (e.g., cargo fmt, docker build)
- All passthroughs now route gracefully instead of Clap parse errors

Phase 2: cargo check handler + refactor (-40 lines)
- Add dedicated cargo check handler (most frequently used missing command)
- Extract run_cargo_filtered() to eliminate 90 lines of duplication
- Fix filter_cargo_build() to handle "Checking" prefix (not just "Compiling")
- Normalize exit code propagation in run_test()

Phase 3: Utility deduplication (-60 lines)
- Fix utils::truncate() Unicode handling (char-aware, not byte-based)
- Remove 5 duplicated utility functions across modules:
  - 3x truncate() → use crate::utils::truncate
  - 1x strip_ansi() → use crate::utils::strip_ansi
- Replace ~60 lines of inline package manager detection with utils::package_manager_exec()
- Clean: lint_cmd, prettier_cmd, playwright_cmd now use shared utils

Phase 4: Discover reporting improvements
- Add RtkStatus enum (Existing/Passthrough/NotSupported)
- Show status column in discover report to distinguish handler types
- Prevents future misleading "build 9 git subcommands" false analyses

Cleanup:
- Remove 2 unused imports (parser::ParseError, std::collections::HashMap)
- Reduce clippy warnings from 23 to 19

Testing:
- 220 tests pass
- 88 smoke tests pass
- All manual verification complete

Net: +10 lines, -3 P0 bugs, -5 duplications, +1 feature, +1 enum

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-06 10:37:50 +01:00
Florian BRUNIAUX 40e7eadbaf fix(git): accept native git flags in add command (including -A)
Problem:
- `rtk git add -A` failed with "unexpected argument '-A' found"
- Git flags like -A, -p, --all were rejected by Clap parser
- Only filenames could be passed to `git add`

Solution:
- Add `allow_hyphen_values = true` to Add command args (following PR #5 pattern)
- Change Add enum variant from `Add { files }` to `Add` (unified with other git commands)
- Modify run_add() to accept args slice and pass all arguments to git
- Add exit code propagation for consistency with other git commands

Impact:
- All native git add flags now work: -A, -p, --all, --update, etc.
- Maintains RTK compact output format ("ok ✓ 2 files changed, ...")
- Preserves backward compatibility (no args defaults to ".")

Testing:
- Manual: `rtk git add -A` works correctly
- All existing tests pass (154 passed)
- Smoke tests unchanged (git add not included in test-all.sh)

Fixes: Argument parsing error for git add with native flags

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-05 15:54:20 +01:00
patrick szymkowiak 3df8ce5525 Merge pull request #57 from FlorianBruniaux/fix/rtk-tsc-show-all-errors
fix(tsc): show every TypeScript error instead of collapsing by code
2026-02-04 18:23:45 +01:00
Florian BRUNIAUX 67e8de8732 fix(tsc): show every TypeScript error instead of collapsing by code
The previous implementation grouped errors by error code within each
file, showing only the first message when multiple errors shared the
same code (e.g. TS2322). This hid critical debugging information and
forced users to bypass rtk entirely.

Changes:
- Show each error individually with line number and full message
- Capture and display tsc continuation/context lines
- Increase message truncation from 60 to 120 chars
- Remove artificial limits (was: 3 codes/file, 10 files max)
- Compact top-codes summary to a single line

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 18:12:46 +01:00
patrick szymkowiak a5d0fd19fd Merge pull request #55 from LivioGama/fix/rtk-init-global-path
Fix rtk init global path
2026-02-03 17:40:11 +01:00
Patrick szymkowiak ea7cdb7a3b fix(ls): compact output (-72% tokens) + fix discover panic
- ls: rewrite to strip permissions/owner/group/dates, show only
  names with dir/ suffix and human sizes. Properly handle flag
  ordering (path -l), -lh, multi-paths, --all.
- discover: remove orphan diff pattern that caused index out of
  bounds panic (PATTERNS had 22 entries vs RULES 21)
- benchmark: add 8 ls test cases
- test-all: add 5 ls smoke tests

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 17:05:01 +01:00
Patrick szymkowiak ffe0d2e037 chore: cleanup diff references, fix docker ps, widen diff truncation
- Remove rtk diff from docs, tests, discover registry (command exists
  but was over-promoted)
- docker ps: include container ID in compact output
- diff_cmd: widen truncation from 35 to 70 chars per side

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 15:38:56 +01:00
Patrick szymkowiak fcc14624f8 fix(find): rewrite with ignore crate + fix json stdin + benchmark pipeline
- find: replace fd/find subprocess with ignore::WalkBuilder for native
  .gitignore support, fix "." pattern, fix --max file counting
- json: add stdin support via "-" path (same pattern as read)
- benchmark: one-line-per-test format with icons for CI logs,
  local debug files only when not in CI, remove md upload/PR steps

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 15:38:17 +01:00
Florian BRUNIAUX b13d92c9ea fix(docs): escape HTML tags in rustdoc comments
Fixes 6 rustdoc warnings:
- Escape <action>, <detail>, <hash>, <branch>, <stats> tags
- Use backticks for [RTK:PASSTHROUGH] marker

All rustdoc warnings now resolved.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-03 11:33:40 +01:00
Florian BRUNIAUX 521eb1b9bc docs(tracking): complete API documentation + rustdoc comments
Add comprehensive documentation for tracking.rs public APIs:

**New Files:**
- docs/tracking.md (12 pages)
  - Architecture & data flow
  - All public APIs (12 methods, 7 types)
  - Usage examples (basic, CI/CD, dashboards, Rust lib)
  - JSON/CSV export schemas
  - Database schema & migrations
  - Integration examples (GitHub Actions, Python, Rust)
  - Security, performance, troubleshooting

- claudedocs/TRACKING_DOCUMENTATION.md
  - Documentation summary & metrics

**Updated Files:**
- src/tracking.rs
  - Module-level docs (//!)
  - Comprehensive doc comments (///) for all public APIs
  - Examples with error handling
  - Deprecation notices for legacy functions

- README.md
  - Pointer to docs/tracking.md after rtk gain section

**Coverage:**
- 7 public structs documented
- 12 public methods documented
- 3 utility functions documented
- 20+ code examples
- 3 integration examples (CI/CD, dashboards, Rust lib)
- JSON/CSV/SQL schemas

**Testing:**
- All 6 tracking tests still pass
- 100% coverage maintained

Closes gap: CLI was documented, but public APIs were not.
Now fully documented for external integration (CI/CD, dashboards, Rust lib usage).

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-03 11:22:20 +01:00