rtk
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesertk
rtk
rtk <wrapper> <command>~/AGENTS.md~/RTK.mdEvery wrapper passes the underlying command's real exit status through, so branch on , not on the filtered text.
$?rtk <wrapper> <command>~/AGENTS.md~/RTK.md每个封装器都会传递底层命令的真实退出状态,因此请根据进行分支判断,而非过滤后的文本。
$?When to reach for it
适用场景
Wrap when the output is big, repetitive, and you only want the exceptions:
- Test suites, builds, type checks, linters: you want failures, not thousands of passing lines.
- Repository-wide search, directory walks, log files, long /
git log.git diff - list and view output, which is verbose JSON-ish prose by default.
gh
Do NOT wrap:
- Interactive commands, anything that prompts or needs a TTY.
- Output you need verbatim: a file you are about to edit by exact bytes, a config you will copy, a hash or version string, a diff you will apply.
- Short commands. Filtering a 5-line output saves nothing and adds a process.
- The one failing case you are already debugging. Once you know a specific test or error matters, run it raw and read all of it; a filter that drops the one line you needed is worse than the raw dump.
rtk proxy <cmd>rtk run <cmd>sh -c当输出内容庞大、重复,且你只关注异常情况时,使用封装:
- 测试套件、构建、类型检查、代码检查工具:你只需要查看失败信息,而非成千上万条通过的记录。
- 仓库全局搜索、目录遍历、日志文件、冗长的/
git log输出。git diff - 列表与查看输出,默认情况下是冗长类JSON格式的文本。
gh
请勿封装以下命令:
- 交互式命令、任何需要提示或TTY的操作。
- 需要完整原始输出的内容:你即将按字节编辑的文件、要复制的配置、哈希或版本字符串、要应用的diff。
- 短命令。过滤5行输出毫无意义,反而会多启动一个进程。
- 你正在调试的单个失败案例。一旦确定某个特定测试或错误需要关注,直接运行原始命令并查看全部内容;如果过滤器恰好过滤掉了你需要的那一行,反而比原始输出更糟。
rtk proxy <cmd>rtk run <cmd>sh -cWorkflows
工作流示例
Run a test suite and see only failures, then re-run the failing case raw:
bash
rtk test cargo test # only failures, exit status preserved
cargo test some_failing_test -- --nocapture # raw, once you know what to look atCompile or lint and keep only errors and warnings:
bash
rtk err cargo check --message-format short运行测试套件仅查看失败信息,然后重新运行失败案例的原始输出:
bash
rtk test cargo test # 仅显示失败信息,保留退出状态
cargo test some_failing_test -- --nocapture # 查看原始输出,当你明确关注目标后编译或代码检查仅保留错误与警告:
bash
rtk err cargo check --message-format short[ok] Command completed successfully (no errors) when clean
[ok] Command completed successfully (no errors) 当无问题时显示
Orient in an unfamiliar repository without dumping the tree:
```bash
rtk find src -name "*.rs" # compact grouped tree, not one path per line
rtk read Cargo.toml # filtered read
rtk grep -r "fn main" src # grouped by file, whitespace strippedReview repository state before committing:
bash
rtk git status # branch plus "clean - nothing to commit"
rtk git log --oneline -5
rtk git diff HEAD~1 --stat # condensed change summaryrtk diffdiff(1)rtk git diffFilter output you already have, without re-running the command:
bash
git log --oneline -20 | rtk pipeCheck whether the wrapping is actually paying for itself:
bash
rtk gain # totals plus per-command savings table
rtk gain --history # recent command history
在不熟悉的仓库中快速了解结构,无需输出完整目录树:
```bash
rtk find src -name "*.rs" # 紧凑分组的目录树,而非每行一个路径
rtk read Cargo.toml # 过滤后的内容展示
rtk grep -r "fn main" src # 按文件分组,去除空白字符提交前检查仓库状态:
bash
rtk git status # 分支信息 + "clean - nothing to commit"
rtk git log --oneline -5
rtk git diff HEAD~1 --stat # 精简的变更摘要rtk diffdiff(1)rtk git diff过滤已有的输出,无需重新运行命令:
bash
git log --oneline -20 | rtk pipe检查封装是否真正起到了作用:
bash
rtk gain # 总节省量及按命令分类的节省统计表
rtk gain --history # 近期命令历史记录Fleet conventions
集群规范
- Heavy runs go through and rtk goes INSIDE it, not around it:
fm-heavy-run.sh. The helper returns the command's real exit status; act on that.fm-heavy-run.sh --task <id> -- rtk test <runner> - is the canonical wrapper list for this box. This skill is the judgment layer on top of it; when the two disagree,
~/RTK.mdwins on which wrappers exist and this skill wins on when to use them.~/RTK.md - Wrapper coverage is not uniform. needs
rtk grepfor a directory (bare-rhits the nativertk grep <pat> <dir>error),grep: is a directoryneedsrtk rginstalled, andripgrepneedsrtk treeinstalled. When a wrapper is missing its backing binary it says so and does nothing; fall back to the raw command rather than concluding there were no results.tree - An empty filtered result is ambiguous by design. Before reporting "nothing found", re-run the underlying command raw once to distinguish "no matches" from "filtered away".
- Verify presence with (installed at
rtk --version). Absent means run commands raw, not fail the task./usr/local/bin/rtk - This repository is a fork. Open pull requests against with base
yjuyjuy/rtk, never against thedevelopupstream.rtk-ai/rtk
- 重型任务通过执行,rtk需在该脚本内部使用,而非外部:
fm-heavy-run.sh。该辅助脚本会返回命令的真实退出状态,请据此进行操作。fm-heavy-run.sh --task <id> -- rtk test <runner> - 是本机的标准封装器列表。本技能是基于该列表的判断层;若两者出现分歧,
~/RTK.md决定哪些封装器存在,而本技能决定何时使用它们。~/RTK.md - 封装器的覆盖范围并不统一。需要
rtk grep参数才能遍历目录(直接使用-r会触发原生rtk grep <pat> <dir>错误),grep: is a directory需要安装rtk rg,ripgrep需要安装rtk tree。当封装器缺少对应的底层二进制文件时,会给出提示且不执行任何操作;此时请改用原始命令,而非认为没有结果。tree - 过滤后结果为空是设计上的模糊情况。在报告“未找到内容”之前,请重新运行一次底层原始命令,以区分“无匹配结果”和“被过滤掉”两种情况。
- 使用验证是否安装(安装路径为
rtk --version)。若未安装,则直接运行原始命令,无需终止任务。/usr/local/bin/rtk - 本仓库是一个分支。请向仓库的
yjuyjuy/rtk分支提交PR,切勿提交至develop上游仓库。rtk-ai/rtk
Non-goals
非目标
- rtk filtering is lossy by design. It drops lines it judges uninteresting, and it can drop the line you needed. It is a context-budget tool, not a faithful transport. Any conclusion that depends on complete output must be drawn from a raw run.
- Not a replacement for reading a file you are about to edit. Use the normal read path for exact content.
- Not a test runner, build system, or search engine. It is a wrapper: the underlying tool must already be installed and correct on its own.
- Not a substitute for . This skill covers only the judgment calls; flags and usage come from
--help.rtk <command> --help - Not for output another program consumes. Filtered text is for human and agent eyes, never a pipeline that parses a fixed format.
- rtk过滤本质上是有损的。它会丢弃被判定为无意义的行,也可能会丢弃你需要的内容。它是一个上下文预算工具,而非忠实的传输工具。任何依赖完整输出的结论都必须基于原始运行结果。
- 不能替代查看你即将编辑的文件。如需精确内容,请使用常规读取方式。
- 不是测试运行器、构建系统或搜索引擎。它只是一个封装器:底层工具必须已安装且本身功能正常。
- 不能替代。本技能仅涵盖判断逻辑;参数与用法请查看
--help。rtk <command> --help - 不适用于供其他程序消费的输出。过滤后的文本仅面向人类和Agent查看,绝不能用于依赖固定格式解析的管道流程。