Repository navigation
Conversation
When `registry::rewrite_command()` returns None (no built-in Rust handler), check `toml_filter::find_matching_filter()` before giving up. Commands with user-defined TOML filters (e.g. ssh, jq, just) now get rewritten to `rtk <cmd>` so the hook can route them through the TOML filter engine. Built-in Rust registry retains priority over TOML filters. Fixes #820
8da6283 to
e4b48ee
Compare
|
This pull request has been automatically marked as stale due to 90 days of inactivity. If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. Your contribution is very much appreciated — we're sorry we haven't been able to review it yet. |
|
Thanks for this. The TOML filter fallback landed on develop in #2748 (merged 2026-07-03), which implements it inside the rewrite registry in src/discover/registry.rs so |
Summary
rtk rewritenow checks user TOML filters when no built-in Rust handler matchesssh,jq,just) get rewritten tortk <cmd>so the hook routes them through the TOML filter engineTest plan
cargo fmt --all -- --checkcargo clippy --all-targetscargo test --all(1131 passed)What changed
In
src/hooks/rewrite_cmd.rs, theNonebranch ofregistry::rewrite_command()now callstoml_filter::find_matching_filter(cmd)before exiting with code 1. If a TOML filter matches, the command is rewritten asrtk <cmd>and printed to stdout with the same permission verdict handling as built-in commands.Three new unit tests verify:
ssh root@host ls(TOML-only) is matched byfind_matching_filterbut not byrewrite_commandhtophas neither registry nor TOML matchgit status(registry command) is handled by the registry, never reaching the TOML fallbackThis contribution was developed with AI assistance (Claude Code).
Fixes #820