Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <hash>]`, 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).
Expand Down
37 changes: 26 additions & 11 deletions src/discover/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}
);
}
Expand All @@ -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())
);
}

Expand Down
7 changes: 5 additions & 2 deletions src/discover/rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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: &[
Expand Down
Loading