diff --git a/README.md b/README.md index 3c8841e9db..fa2e59f898 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,7 @@ Each change has a regression test, except `grep_max_results`. | `git diff` | Shown verbatim up to `agent_output_max_chars`. Above it, a compacted diff or show ends with `[full output: rtk recall ]`, or `[full diff: rtk git diff --no-compact]` when recall cannot store it. | | `rtk read` | Exact line ranges, and a missing-file error worded as `cat` words it. | | `gh api` | GitHub API `*_url` links are dropped, with the whole response kept for `rtk recall`. Anything left unfiltered is written back byte for byte, and `--jq` and `--template` are untouched. | +| `yadm` | Removed from the `git` rewrite rule, which would run git on the current project instead of yadm's dotfiles repository. It goes through `rtk yadm`, and `rtk discover` lists it as unhandled, as it does `jq` and other commands with only a TOML filter. From [kylehgc/rtk](https://github.com/kylehgc/rtk/commit/1d672725f8cf9d43da32212310dd7abb5bca814d) by RawNuke (Apache-2.0); see [rtk-ai/rtk#3408](https://github.com/rtk-ai/rtk/issues/3408). | | `rtk gain` | The summary, per-command and daily, weekly and monthly tables count an oversised row at a fixed 7,500-token cap, and the headline figure is net. | Generally useful fixes are offered upstream as draft pull requests, listed in [FORKS.md](https://github.com/EquityBot/EquityBot/blob/main/FORKS.md). diff --git a/src/discover/registry.rs b/src/discover/registry.rs index edff9b0775..7af278bd5e 100644 --- a/src/discover/registry.rs +++ b/src/discover/registry.rs @@ -3033,13 +3033,12 @@ mod tests { #[test] fn test_classify_yadm_status() { + // yadm manages a separate dotfiles repository; it must never be + // rewritten to `rtk git`, which would act on the current project. assert_eq!( classify_command("yadm status"), - Classification::Supported { - rtk_equivalent: "rtk git", - category: "Git", - estimated_savings_pct: 70.0, - status: RtkStatus::Existing, + Classification::Unsupported { + base_command: "yadm status".to_string(), } ); } @@ -3048,20 +3047,36 @@ mod tests { fn test_classify_yadm_diff() { assert_eq!( classify_command("yadm diff"), - Classification::Supported { - rtk_equivalent: "rtk git", - category: "Git", - estimated_savings_pct: 80.0, - status: RtkStatus::Existing, + Classification::Unsupported { + base_command: "yadm diff".to_string(), } ); } #[test] fn test_rewrite_yadm_status() { + // Regression for rtk-ai/rtk#3408: yadm subcommands must route through + // the yadm filter to the yadm binary, never to git in the current + // directory. Tests adapted from kylehgc/rtk 1d672725 by RawNuke (Apache-2.0). assert_eq!( rewrite_command_no_prefixes("yadm status", &[]), - Some("rtk git status".to_string()) + Some("rtk yadm status".to_string()) + ); + } + + #[test] + fn test_rewrite_yadm_commit() { + assert_eq!( + rewrite_command_no_prefixes("yadm commit -m x", &[]), + Some("rtk yadm commit -m x".to_string()) + ); + } + + #[test] + fn test_rewrite_yadm_add() { + assert_eq!( + rewrite_command_no_prefixes("yadm add .", &[]), + Some("rtk yadm add .".to_string()) ); } diff --git a/src/discover/rules.rs b/src/discover/rules.rs index 976d5abf8f..467626f925 100644 --- a/src/discover/rules.rs +++ b/src/discover/rules.rs @@ -58,10 +58,13 @@ impl Default for RtkRule { /// `core::tracking::SUBCOMMAND_ROUTERS`, or its telemetry label stops at the tool name. pub const RULES: &[RtkRule] = &[ RtkRule { - pattern: r"^(?:git|yadm)\s+(?:-[Cc]\s+\S+\s+)*(status|log|diff|show|add|commit|checkout|push|pull|branch|fetch|stash|worktree)(?:\s|$|[;|&()<>])", + // yadm stays out of this rule: `rtk git` would run git on the current + // project, not yadm's dotfiles repository. Change adapted from + // kylehgc/rtk 1d672725 by RawNuke (Apache-2.0); see rtk-ai/rtk#3408. + pattern: r"^git\s+(?:-[Cc]\s+\S+\s+)*(status|log|diff|show|add|commit|checkout|push|pull|branch|fetch|stash|worktree)(?:\s|$|[;|&()<>])", rtk_cmd: "rtk git", pipeline_safety: PipelineSafety::ProducerOnly, - rewrite_prefixes: &["git", "yadm"], + rewrite_prefixes: &["git"], category: "Git", savings_pct: 70.0, subcmd_savings: &[