Commit Graph

91 Commits

Author SHA1 Message Date
Sam Severance f2da381ae2 fix: correct ARCHITECTURE.md path in README links
The file lives at docs/contributing/ARCHITECTURE.md, not at the repo
root — both the nav header and Documentation section pointed to the
wrong location.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-07 10:02:49 -04:00
aesoft 176ceb4a7d Merge pull request #1310 from JBF1991/feat/curl-cmd-no-filter
Simplified `rtk curl` Filter
2026-04-18 18:35:39 +02:00
Joshua 80bc7fbd61 documentation 2026-04-15 14:45:30 -05:00
Florian BRUNIAUX 4c9b528206 docs: Adrien review — hierarchy, counts, consistency, gaps
Hierarchy:
- Move troubleshooting.md and what-rtk-covers.md to guide/resources/
- Add guide/resources/telemetry.md (adapted from docs/TELEMETRY.md,
  user-facing: consent, opt-out, GDPR rights — without internal sections)

Content fixes:
- Remove all hardcoded counts (9 ecosystems, 12 agents, 60+, 7 more)
  replaced with qualitative language throughout
- Unify DB filename: tracking.db → history.db everywhere
  (canonical: src/core/constants.rs HISTORY_DB)
- installation.md: replace bare `cargo install rtk` with warning +
  explicit git URL to avoid Rust Type Kit name collision
- supported-agents.md: remove hardcoded agent count
- quick-start.md: remove hardcoded ecosystem list, link to what-rtk-covers

New content:
- gain.md: add --quota section explaining pro/5x/20x tier meanings
- gain.md: add callout linking to discover.md (find missed savings)
- index.md: add "Analyze your usage" section (rtk discover, rtk session)
- configuration.md: clarify ignore_dirs/ignore_files scope, add prose
  link to telemetry.md
- what-rtk-covers.md: clarify --ultra-compact vs git -u short flag conflict

Cross-references:
- All internal links updated for new resources/ paths
- index.md: link to troubleshooting, telemetry, what-rtk-covers, analytics
- discover.md: updated relative link to troubleshooting

README:
- Add Core team section (Patrick Szymkowiak, Florian Bruniaux, Adrien Eppling)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 14:17:58 +02:00
aesoft 9e96caa0a1 Merge pull request #355 from KuSh/pnpx+dlx
feat(discover): handle more npm/npx/pnpm/pnpx patterns
2026-04-13 20:31:12 +02:00
Florian BRUNIAUX e09a53e5f7 Merge pull request #1181 from rtk-ai/rgpd-telemetry 2026-04-13 09:26:46 +02:00
Florian BRUNIAUX 4093d5c13d Merge pull request #1094 from rtk-ai/docs/windows-instructions 2026-04-13 09:26:05 +02:00
Nicolas Le Cam 45938b2a4d feat(js): distinguish between jest and vitest and don't rewrite npm test commands as we don't know which test framework is used under the hood
Signed-off-by: Nicolas Le Cam <niko.lecam@gmail.com>
2026-04-12 22:03:39 +02:00
aesoft 2e4cc4bb52 fix(telemetry): consent, erasure, auth, docs 2026-04-12 12:59:22 +02:00
Patrick szymkowiak b73506867e docs: add Windows setup instructions and troubleshooting
Windows users downloading the pre-built binary had no guidance —
double-clicking rtk.exe flashes a terminal and exits immediately.

- README: add warning under Windows binary link, add full Windows section
  with WSL vs native comparison table
- installation.md: add pre-built binaries section with Windows note
- supported-agents.md: add Windows support section (CLAUDE.md fallback)
- troubleshooting.md: add "double-click does nothing" and "hook not working"
  entries for Windows users

Prompted by Discord user report (PedroLyra).

Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>
2026-04-09 09:30:58 +02:00
aesoft 66b90f1ed3 Merge pull request #802 from Yosoyepa/feat/add-new-agents
feat(init): add support for kilocode and antigravity agents
2026-04-09 09:28:11 +02:00
aesoft 644c50f786 Merge pull request #1001 from rtk-ai/feat/telemetry-enrichment
feat(telemetry): enrich daily ping with gap detection and quality metrics
2026-04-09 08:57:21 +02:00
yosoyepa d0a3797ec5 feat(init): add native support for Kilo Code and Google Antigravity
Add rtk init --agent kilocode and rtk init --agent antigravity commands.

Kilo Code: installs .kilocode/rules/rtk-rules.md (project-scoped)
Google Antigravity: installs .agents/rules/antigravity-rtk-rules.md (project-scoped)

Both follow the same prompt-level guidance pattern as Cline and Windsurf,
using rules files that instruct the agent to prefix shell commands with rtk.
2026-04-08 15:37:29 -05:00
Florian BRUNIAUX cea6e2093d docs: add Star History and StarMapper to README
Signed-off-by: Florian BRUNIAUX <florian@bruniaux.com>
2026-04-06 18:48:43 +02:00
Florian BRUNIAUX 6938a9dacc docs: fix broken README links and reduce redundancy, point to docs site
- Fix broken links: docs/TROUBLESHOOTING.md and docs/AUDIT_GUIDE.md were
  removed in previous commit; update nav header and Documentation section
- Condense Supported AI Tools: keep the summary table, replace 12 per-agent
  detail blocks with a single link to rtk-ai.app/guide/supported-agents
- Condense Configuration: keep essential snippet and tee recovery example,
  link to rtk-ai.app/guide/configuration for full reference
- Update Documentation section: lead with rtk-ai.app/guide as primary entry,
  keep INSTALL.md, ARCHITECTURE.md, CONTRIBUTING.md, SECURITY.md

Signed-off-by: Florian BRUNIAUX <florian@bruniaux.com>
2026-04-06 18:37:05 +02:00
aesoft a919335519 Merge pull request #978 from rtk-ai/fix/batch-priority-issues
fix(main): kill zombie processes + path for rtk md + missing intergrations
2026-04-04 12:03:29 +02:00
Patrick szymkowiak e766ab2b2d docs(telemetry): add dedicated TELEMETRY.md with full field reference
Comprehensive telemetry documentation covering:
- Why we collect (roadmap prioritization, filter quality, value measurement)
- How it works (daily ping, background thread, fire-and-forget)
- Every field with example values and purpose
- What is NOT collected (explicit exclusion list)
- Opt-out instructions
- Data handling and privacy guarantees
- Contributor guide for adding new fields

Link added from README.md privacy section.

Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>
2026-04-03 14:01:29 +02:00
Patrick szymkowiak 450ed107ab feat(telemetry): add retention, ecosystem, economics, and config metrics
Extend the daily anonymous ping with product-piloting metrics:

Retention: first_seen_days, active_days_30d, commands_total
Ecosystem: ecosystem_mix (category distribution percentages)
Economics: tokens_saved_30d, estimated_savings_usd_30d
Config: has_config_toml, exclude_commands_count, projects_count
Features: meta_usage (gain, discover, proxy, verify, learn counts)

Update README.md privacy section with full field-by-field table
explaining what is collected and why it helps improve RTK.

Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>
2026-04-03 13:58:45 +02:00
aesoft deda44f736 fix(docs): clean some docs + disclaimer 2026-04-02 21:33:38 +02:00
Jb d1b37ced01 feat(aws): expand CLI filters from 8 to 25 subcommands
Add 17 specialized filters for high-token-waste AWS operations:
- CloudWatch Logs (get-log-events, filter-log-events, get-query-results)
- CloudFormation describe-stack-events (failures-first)
- Lambda list-functions, get-function (strips Environment secrets)
- IAM list-roles (extract principals), list-users
- DynamoDB scan/query/get-item (recursive type unwrapping)
- ECS describe-tasks (stoppedReason + exitCode)
- EC2 describe-security-groups (compact rule notation)
- S3API list-objects-v2, S3 sync/cp (text summary)
- EKS describe-cluster, SQS receive-message
- Secrets Manager get-secret-value

Architecture:
- Extract run_aws_filtered() shared runner with Result<i32> return
- Add force_tee_hint() for truncation recovery (no dead ends for LLMs)
- Follow six-phase contract (stderr tracking, tee on failure, exit codes)
- Migrate existing 8 handlers to shared runner

Inspired by #644 for DynamoDB get-item, S3 transfer, Secrets Manager,
query-results, and N-type precision.
2026-03-30 20:38:32 +02:00
aesoft f7ec883a78 fix(telemetry): docs + real info from "rtk init -g" 2026-03-27 19:28:43 +01:00
aesoft d9be630bef Merge branch 'develop' of https://github.com/rtk-ai/rtk into refacto-folders-and-documentation 2026-03-26 18:11:34 +01:00
aesoft 967d2bfcf9 Merge branch 'develop' of https://github.com/rtk-ai/rtk into refacto-folders-and-documentation 2026-03-25 19:55:42 +01:00
aesoft 0925cf21e0 fix(docs): last review 2026-03-25 19:12:46 +01:00
Patrick szymkowiak 19d35f57d3 docs(readme): fix Copilot setup instructions + add Vibe status
- Split Copilot into VS Code (transparent rewrite) and CLI (deny-with-suggestion)
- Use --copilot flag (consistent with --gemini, --codex, --opencode)
- Add Mistral Vibe as planned (blocked on upstream #531)
- Fix Copilot section with VS Code vs CLI details
- Update tool count from 9 to 10
- Verified all 10 tools against actual codebase

Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>
2026-03-25 17:36:16 +01:00
Patrick szymkowiak e666d3ebd1 docs: add all 9 AI tool integrations to README
Document Copilot, Cursor, Codex, Windsurf, Cline, OpenClaw setup.
Unified table with install commands for each tool.
Updated Quick Start with all agent options.

Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>
2026-03-23 16:36:34 +01:00
patrick szymkowiak 0eecee5bf3 fix: add telemetry documentation and init notice (#640) (#788)
- Add "Privacy & Telemetry" section to README explaining what is
  collected, what is NOT, and how to opt-out
- Show telemetry notice during rtk init so users are informed

Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>
2026-03-23 11:52:26 +01:00
patrick szymkowiak af56573ae2 fix: update Discord invite link (#711) (#786)
Replace expired invite links across all README translations.

Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>
2026-03-23 10:13:44 +01:00
Navid EMAD 15bc0f8d6e feat(ruby): add Ruby on Rails support (rspec, rubocop, rake, bundle) (#724)
* feat(ruby): add Ruby on Rails support (rspec, rubocop, rake, bundle)

Unifies 5 competing PRs (#198, #292, #379, #534, #643) into a single
coherent implementation.

New commands:
- rtk rspec: JSON parsing with text fallback (60%+ savings)
- rtk rubocop: JSON parsing, group by cop/severity (60%+ savings)
- rtk rake test: Minitest state machine parser (85-90% savings)
- rtk bundle install: TOML filter, strip Using lines (90%+ savings)

Shared infrastructure: ruby_exec(), fallback_tail(),
exit_code_from_output(), count_tokens() in utils.rs.

Discover/rewrite rules for rspec, rubocop, rake, rails, bundle
including bundle exec and bin/ variants.

E2E smoke tests (scripts/test-ruby.sh) covering all 4 commands.
56 new unit tests + 4 inline TOML tests. All 1035 tests passing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Navid EMAD <navid.emad@yespark.fr>

* fix(ruby): use TEST= env var for rake single-file test in smoke tests

Rails' `rake test` ignores positional file args; use `TEST=path` syntax.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Navid EMAD <navid.emad@yespark.fr>

* docs(ruby): add Ruby module architecture and update attribution

Integrate ARCHITECTURE.md Ruby Module Architecture section and CLAUDE.md
module table/fork-features from PR #643. Update PR description attribution.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Navid EMAD <navid.emad@yespark.fr>

* chore: remove PULL_REQUEST_DESCRIPTION.md from repo

PR description lives on GitHub, no need to track in the codebase.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Navid EMAD <navid.emad@yespark.fr>

---------

Signed-off-by: Navid EMAD <navid.emad@yespark.fr>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 15:04:59 +01:00
Ben Younes f16853ae8a feat: add Gemini CLI support via rtk init --gemini (#573)
- Add `rtk hook gemini` command: native Rust hook processor for Gemini CLI
  BeforeTool hooks. Reads JSON from stdin, delegates to `rewrite_command()`
  (single source of truth), outputs Gemini-format JSON response.
- Add `--gemini` flag to `rtk init`: installs hook wrapper script, GEMINI.md,
  and patches ~/.gemini/settings.json with BeforeTool hook entry.
- Add `rtk init -g --gemini --uninstall`: clean removal of all Gemini artifacts.
- 6 unit tests covering hook format, rewrite delegation, and exclusions.

Replaces PR #174 which had too many conflicts after upstream restructuring.

Signed-off-by: Ousama Ben Younes <benyounes.ousama@gmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-18 15:18:33 +01:00
Ousama Ben Younes eb8a2c4a71 fix: improve adoption metric by detecting hook-rewritten commands
The hook rewrites "git status" → "rtk git status" but JSONL logs the
original command. count_rtk_commands now uses classify_command() to
also count commands the hook would rewrite, giving realistic adoption
percentages (68% vs previous 2%).

Also adds rtk session to README.md documentation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Ousama Ben Younes <benyounes.ousama@gmail.com>
2026-03-13 14:09:38 +00:00
aesoft 2223eca224 Merge pull request #413 from tsubasakong/lucas/docs-387-tool-rewrite-clarify
docs: clarify Bash-only auto-rewrite scope
2026-03-13 11:41:09 +01:00
Florian BRUNIAUX 7b7a5ae4b6 feat: Claude Code tooling — 2 agents, 7 commands, 2 rules, 4 skills (#491)
* feat: add Claude Code tooling — agents, commands, rules, skills

Port and adapt 15 Claude Code artifacts from MethodeAristote/ccboard
to RTK's Rust/CLI context. All TypeScript/web-specific references
replaced with Rust idioms, cargo toolchain, and RTK constraints.

## Agents (2)

- **code-reviewer** (rewrite): RTK-specific red flags table
  (Regex::new in fn, unwrap in prod, async deps, no fallback, no savings
  test), defensive patterns with before/after examples, adversarial
  questions for RTK (savings ≥60%, fallback, startup, exit code,
  cross-platform, ANSI, fixtures)

- **system-architect** (new): RTK architecture map, filter module
  pattern (Pattern 1-4), TOML DSL vs Rust decision guide, performance
  budget (<10ms startup, <5MB binary), module boundary definitions

## Commands (7, under .claude/commands/tech/)

- **worktree**: Creates git worktrees with background `cargo check
  --all-targets`, `--fast`/`--no-check` flags, branch naming
  `feature/xxx` → `.worktrees/feature-xxx`

- **worktree-status**: Checks background cargo check log
  (`/tmp/worktree-cargo-check-{branch}.log`)

- **remove-worktree**: Removes worktree + git ref + branch, protected
  branches: `master`/`main`

- **clean-worktrees**: Auto-removes worktrees on branches merged into
  master (`git branch --merged master`)

- **clean-worktree**: Interactive cleanup with `y/N` prompt

- **codereview**: Pre-PR review, base `master`, 🔴 checks for
  `unwrap()`, non-lazy regex, missing `.context()`, async deps, missing
  token savings tests; `--auto` mode runs `cargo fmt + clippy + test`

- **audit-codebase**: 7-category health audit scored 0-10 (secrets,
  security, deps via cargo audit, structure, tests, perf <10ms, AI
  patterns), weighted global score

## Rules (2, under .claude/rules/)

- **search-strategy**: Navigation codebase RTK — module map, priority
  order (Grep > Glob > Read > Explore), patterns for finding commands,
  filter functions, lazy_static regexes, test coverage, TOML filters

- **rust-patterns**: RTK non-negotiables (no async, lazy_static
  mandatory, fallback pattern, exit code propagation) + idiomatic Rust
  (iterators, ownership, error handling, module structure template,
  anti-patterns table)

## Skills (4, under .claude/skills/)

- **code-simplifier**: Rust simplification patterns (iterator chains,
  string joining, Option/Result chaining, early returns, clone removal),
  RTK guard-rails (never simplify away lazy_static, .context(), fallback)

- **performance**: Startup benchmark (hyperfine), binary size
  (cargo-bloat), memory profiling (/usr/bin/time), regex compilation
  audit, forbidden deps table, before/after regression template

- **design-patterns**: Rust patterns for RTK — Newtype (type safety),
  Builder (complex config), State Machine (multi-phase output parsing),
  Trait Object (command dispatch), RAII, Extension Trait; selection guide
  + anti-patterns

- **tdd-rust**: Full Red-Green-Refactor workflow — real fixtures capture,
  snapshot tests (insta), count_tokens() savings assertion (≥60%),
  fallback test, ANSI stripping test, Arrange-Act-Assert pattern,
  "done" checklist

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Florian BRUNIAUX <florian@bruniaux.com>

* chore: update version references to 0.28.2

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Florian BRUNIAUX <florian@bruniaux.com>

---------

Signed-off-by: Florian BRUNIAUX <florian@bruniaux.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-13 09:43:38 +01:00
Frank 992f2cee1b docs: clarify Bash-only auto-rewrite scope
Signed-off-by: Frank <97429702+tsubasakong@users.noreply.github.com>
2026-03-11 20:53:02 -07:00
José Almeida 064cb3ea65 feat: add OpenCode plugin support (#300)
* feat(opencode): add OpenCode plugin support

Add `--opencode` flag to `rtk init` for installing a global OpenCode
plugin that rewrites Bash/shell commands through `rtk rewrite`.

- New plugin: hooks/opencode-rtk.ts (thin delegator to rtk rewrite)
- New init modes: --opencode (OpenCode only), combinable with Claude modes
- Plugin install/update/remove lifecycle with idempotent writes
- Uninstall cleans up OpenCode plugin alongside Claude Code artifacts
- `rtk init --show` reports OpenCode plugin status
- Replace unreachable!() with bail!() in match exhaustiveness guard

* docs: add OpenCode plugin documentation

- README: OpenCode plugin section, install flags, troubleshooting
- TROUBLESHOOTING: OpenCode-specific checklist
- Update init mode table to reflect Claude Code default
2026-03-11 22:13:03 +01:00
patrick szymkowiak 7d76af84b9 fix: 4 critical bugs + telemetry enrichment (#462)
* fix(cicd): Add security check on dev branch PR

add security check cicd on dev branch PR

Signed-off-by: aesoft <43991222+aeppling@users.noreply.github.com>

* fix: enrich telemetry with install_method and token savings

- Add install_method detection (homebrew/cargo/script/nix/other)
- Add tokens_saved_24h and tokens_saved_total to payload
- Add Tracker::total_tokens_saved() and Tracker::tokens_saved_24h() methods
- Point telemetry to new dedicated rtk-telemetry service

Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>

* fix: detect install method on Windows paths

Add backslash variants for .cargo\bin and .local\bin detection

Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>

* fix: enrich telemetry with install_method and token savings (#432)

- Add install_method detection (homebrew/cargo/script/nix/other)
- Add tokens_saved_24h and tokens_saved_total to payload
- Add Tracker::total_tokens_saved() and Tracker::tokens_saved_24h() methods
- Point telemetry to new dedicated rtk-telemetry service

Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>

* fix: 4 critical bugs — git exit code, jq warning, npm run doubling, pnpm build filter (#458)

* fix: propagate exit code 128 when rtk git status runs outside a repo (#435)

Previously printed "Not a git repository" to stdout and returned exit 0.
Now prints to stderr and exits with git's actual exit code (128).

Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>

* fix: warn when jq is not installed instead of silent exit (#430)

Hook now prints a warning to stderr before exiting cleanly,
so users know the rewrite pipeline is not functioning.

Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>

* fix: strip leading 'run' arg to prevent npm run run doubling (#438)

When user types 'rtk npm run build', args contain ["run", "build"].
Since npm_cmd always prepends 'run', this caused 'npm run run build'.
Now strips the leading 'run' from args if present.

Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>

* fix: route pnpm build through generic passthrough instead of Next.js filter (#454)

pnpm build was hardcoded to next_cmd::run which misparses Vite/other
framework output as errors. Now uses generic passthrough.

Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>

* docs: bump README version to 0.28.0

Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>

---------

Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>

* fix: warn when rtk binary is not in PATH instead of silent exit (#430) (#465)

Applies the same fix as jq — all silent exits now warn on stderr.

Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>

---------

Signed-off-by: aesoft <43991222+aeppling@users.noreply.github.com>
Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>
Co-authored-by: aesoft <43991222+aeppling@users.noreply.github.com>
2026-03-10 16:46:54 +01:00
Florian BRUNIAUX 926e6a0dd4 feat: TOML Part 2 — user-global config, shadow warning, rtk init templates, 4 new built-in filters (#351)
* docs: update module count to 58 (toml_filter + verify_cmd)

* docs: bump version refs to 0.27.1, fix module count to 59

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

* feat: TOML DSL PR 2 — user-global config, shadow warning, init templates, 4 new filters

- toml_filter: add ~/.config/rtk/filters.toml (priority 2, between project and built-in)
- toml_filter: shadow warning when match_command overlaps a Rust-handled command
- init: rtk init generates .rtk/filters.toml template (local) and ~/.config/rtk/filters.toml (global)
- builtin_filters: add pre-commit, helm, gcloud, ansible-playbook (46/46 inline tests)
- README: add "Custom Filters" section with lookup table, primitives, examples, built-in list

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

* feat(filters): add quarto-render, pnpm-build, trunk-build from rtk discover data (52/52 tests)

* feat(filters): add docker-inspect, sops, docker-compose-ps built-in filters

Resolves issues #279, #277, #276 as TOML-native filters (no Rust required).

- docker-inspect: strip_ansi + truncate_lines_at=120 + max_lines=60
- sops: strip_ansi + strip_lines_matching blank lines + max_lines=40
- docker-compose-ps: strip_ansi + truncate_lines_at=120 + max_lines=40

6 inline tests added (2 per filter), all passing.

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

* refactor(filters): split monolithic builtin_filters.toml into 28 individual files

Replace the 848-line src/builtin_filters.toml monolith with individual
files under src/filters/<name>.toml (1 filter + tests per file).

Files are concatenated alphabetically by build.rs at compile time into
OUT_DIR/builtin_filters.toml, then embedded via a BUILTIN_TOML constant
in toml_filter.rs. The build step validates TOML syntax and detects
duplicate filter names across files.

Benefits:
- Zero merge conflicts when multiple PRs add filters (different files)
- Clear PR diffs: "+1 file of 30 lines" vs "+30 lines in 850-line file"
- Easy onboarding: copy any .toml, rename, edit 3 fields — done
- Build-time TOML validation catches syntax errors before tests run

Changes:
- build.rs (new): concat + validate src/filters/*.toml
- Cargo.toml: add [build-dependencies] toml = "0.8"
- src/filters/*.toml (28 files): split from monolith
- src/filters/README.md (new): contributor guide
- src/toml_filter.rs: BUILTIN_TOML const + 5 include_str replacements
- src/builtin_filters.toml: deleted

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

* test(filters): add 5 new unit tests for multi-file architecture + wget filter

Unit tests added (toml_filter.rs):
- test_builtin_toml_has_schema_version: ensures build.rs injects schema_version
- test_builtin_all_expected_filters_present: guards against accidental file deletion
- test_builtin_filter_count: exact count check (fails if filter added/removed without update)
- test_builtin_all_filters_have_inline_tests: prevents shipping filters with no tests
- test_new_filter_discoverable_after_concat: simulates build.rs concat, verifies lookup

New built-in filter:
- src/filters/wget.toml: compact wget download output (strips connection/resolution
  noise, short-circuits on 'saved [' to 'ok (downloaded)', 2 inline tests)

Test results: 661/661 unit tests, 60/60 inline TOML filter tests

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

* docs: add filter-workflow.md with Mermaid diagrams

Build pipeline + runtime lookup priority, both as Mermaid flowcharts.
Shows the full path from src/filters/*.toml to binary to execution.

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

* fix: remove dead TOML filters — wget, git-checkout, git-merge, git-remote, cargo-run

These filters were never reachable: Clap routes rtk git/cargo commands
to their dedicated Rust modules before run_fallback is called. The TOML
engine only fires for unknown commands. Shipping dead filters gives false
confidence (inline tests pass, but filters never activate in production).

Also fixes P1-1 from the PR #386 review: wget was in RUST_HANDLED_COMMANDS
and the shadow warning fired at compile time but did not block the build.

Removed: cargo-run.toml, git-checkout.toml, git-merge.toml,
         git-remote.toml, wget.toml

Updated test guards: count 29→24, expected list -5 names,
concat test 30→25.

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

* fix: remove 3 dead TOML filters + update guards (PR #351)

docker-inspect, docker-compose-ps, and pnpm-build are handled by
container.rs and pnpm_cmd.rs before run_fallback is reached — their
TOML filters never fire. Remove the files to avoid false documentation.

Update toml_filter.rs guards: expected list -3 names, count 24→21,
concat test 25→22. Update CONTRIBUTING.md example count to match.

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

* fix: rebase on PR #349 — apply regex anchors, make on_empty, build.rs clippy, docs macOS path

- Add (\\s|$) word-boundary anchors to 6 tofu/mix match_command regexes
  (tofu-plan, tofu-init, tofu-validate, tofu-fmt, mix-format, mix-compile)
- Add on_empty = "make: ok" to make.toml + update existing empty-output test
- Fix build.rs clippy: map_or(false, ...) → is_some_and(..)
- Add macOS alt path note to filter-workflow.md Mermaid diagram

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

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-10 11:02:18 +01:00
Florian BRUNIAUX adda2537be feat: TOML Part 1 — filter DSL engine + 14 built-in filters (#349)
* feat: TOML filter DSL + 14 built-in filters (#299)

Add a declarative TOML-based filter engine for zero-Rust command
filtering, plus 14 built-in filters targeting open issues.

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

* docs: update module count to 58 (toml_filter + verify_cmd)

* docs(changelog): add TOML DSL + 14 built-in filters entry

* chore: ignore worktrees directory

* fix: address PR #349 code review (P1 + P2)

P1-1: println! — add trailing newline to TOML-filtered output
  print!("{}", filtered) → println!("{}", filtered). Fixes broken
  pipe compatibility (rtk make all | wc -l returned 0 for 1 line).

P1-2: remove dead filters — git-checkout, git-remote, git-merge, cargo-run
  Clap routes these commands to git.rs/cargo_cmd.rs before run_fallback
  is reached, so these TOML filters never activate. Tests passed but
  gave false confidence. Removed filter definitions and test sections.

P1-3: map_or instead of is_none_or (MSRV compatibility)
  is_none_or requires Rust 1.82+. Replaced with map_or(true, ...) which
  compiles on all supported toolchain versions.

P1-4: print tee hint for TOML-filtered commands on failure
  let _ = tee::tee_and_hint(...) silently discarded the hint path.
  Now follows the same pattern as runner.rs: if let Some(hint) = ... {
  println!("{}", hint); }. LLMs can now find the full output file.

P1-5: --require-all now runs integrity check
  Previously, `rtk verify --require-all` branched away from
  integrity::run_verify(). Now: filter-specific mode (--filter foo)
  skips integrity, but default and --require-all always run it first.

P2-1: RTK_NO_TOML checks value not presence
  .is_ok() matched any value including RTK_NO_TOML=0.
  Replaced with .ok().as_deref() == Some("1").

P2-5: terraform-plan regex — add word boundary after "plan"
  ^terraform\s+plan → ^terraform\s+plan(\s|$) to prevent matching
  "terraform planning" or other plan-prefixed subcommands.

P2-6: iptables regex — \b → (\s|$)
  ^iptables\b matched iptables-save and iptables-restore (\b fires at
  hyphen). Fixed to ^iptables(\s|$).

All 715 tests pass.

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

* fix: add word-boundary anchors to 6 tofu/mix match_command regexes

Prevents overmatch on subcommands (e.g. `tofu planet` or `mix formats`).
Mirrors the same `(\s|$)` pattern already used by terraform-plan.

Fixes: tofu-plan, tofu-init, tofu-validate, tofu-fmt, mix-format, mix-compile

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

* docs(changelog): add round 2 fix for tofu/mix regex overmatch (PR #349)

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

* fix: address PR #349 round 3 review (BUG-1 + BUG-2 + P2 items)

- println! trailing newline on TOML-filtered output (BUG-1)
- RTK_NO_TOML check presence→value (as_deref==Ok("1")) (BUG-2)
- make filter: add on_empty="make: ok" + test (P2-3)
- TOML lookup: use basename of args[0] for absolute path support (P2-8)
- utils.rs: translate French docstrings to English (P2-9)
- main.rs: single error message on command-not-found, exit(127) (NEW)

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

* docs: bump version refs to 0.27.2 and module count to 60

Fixes pre-push validation: README, CLAUDE.md, ARCHITECTURE.md were
still referencing 0.27.1 (Cargo.toml is 0.27.2). Also updates module
count from 59 to 60 to match main.rs (toml_filter + verify_cmd).

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

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-10 10:24:07 +01:00
aesoft 949104d502 Update README.md 2026-03-06 15:18:59 +01:00
aesoft ae03bb4565 Update README.md 2026-03-06 15:16:21 +01:00
aesoft a097d36f51 Update README.md 2026-03-06 15:13:26 +01:00
aesoft e6ce6e6a14 Merge branch 'master' into doc/add-contributing 2026-03-06 14:31:21 +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
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 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
aesoft d318006d77 Update README.md 2026-03-05 15:24:51 +01:00
aesoft 7bd27b98bd Update README.md 2026-03-05 15:22:13 +01:00
aesoft 3f5cdb4334 Update README.md 2026-03-05 15:21:46 +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