@hasna/terminal 2.0.5 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (263) hide show
  1. package/dist/cli.js +52 -21
  2. package/package.json +1 -1
  3. package/src/ai.ts +77 -130
  4. package/src/cli.tsx +51 -21
  5. package/src/command-validator.ts +11 -0
  6. package/src/context-hints.ts +291 -0
  7. package/src/discover.ts +238 -0
  8. package/src/economy.ts +53 -0
  9. package/src/output-processor.ts +7 -18
  10. package/src/output-store.ts +65 -0
  11. package/src/providers/base.ts +3 -1
  12. package/src/providers/groq.ts +108 -0
  13. package/src/providers/index.ts +26 -2
  14. package/src/providers/providers.test.ts +4 -2
  15. package/src/providers/xai.ts +108 -0
  16. package/src/sessions-db.ts +81 -0
  17. package/temp/rtk/.claude/agents/code-reviewer.md +221 -0
  18. package/temp/rtk/.claude/agents/debugger.md +519 -0
  19. package/temp/rtk/.claude/agents/rtk-testing-specialist.md +461 -0
  20. package/temp/rtk/.claude/agents/rust-rtk.md +511 -0
  21. package/temp/rtk/.claude/agents/technical-writer.md +355 -0
  22. package/temp/rtk/.claude/commands/diagnose.md +352 -0
  23. package/temp/rtk/.claude/commands/test-routing.md +362 -0
  24. package/temp/rtk/.claude/hooks/bash/pre-commit-format.sh +16 -0
  25. package/temp/rtk/.claude/hooks/rtk-rewrite.sh +70 -0
  26. package/temp/rtk/.claude/hooks/rtk-suggest.sh +152 -0
  27. package/temp/rtk/.claude/rules/cli-testing.md +526 -0
  28. package/temp/rtk/.claude/skills/issue-triage/SKILL.md +348 -0
  29. package/temp/rtk/.claude/skills/issue-triage/templates/issue-comment.md +134 -0
  30. package/temp/rtk/.claude/skills/performance.md +435 -0
  31. package/temp/rtk/.claude/skills/pr-triage/SKILL.md +315 -0
  32. package/temp/rtk/.claude/skills/pr-triage/templates/review-comment.md +71 -0
  33. package/temp/rtk/.claude/skills/repo-recap.md +206 -0
  34. package/temp/rtk/.claude/skills/rtk-tdd/SKILL.md +78 -0
  35. package/temp/rtk/.claude/skills/rtk-tdd/references/testing-patterns.md +124 -0
  36. package/temp/rtk/.claude/skills/security-guardian.md +503 -0
  37. package/temp/rtk/.claude/skills/ship.md +404 -0
  38. package/temp/rtk/.github/workflows/benchmark.yml +34 -0
  39. package/temp/rtk/.github/workflows/dco-check.yaml +12 -0
  40. package/temp/rtk/.github/workflows/release-please.yml +51 -0
  41. package/temp/rtk/.github/workflows/release.yml +343 -0
  42. package/temp/rtk/.github/workflows/security-check.yml +135 -0
  43. package/temp/rtk/.github/workflows/validate-docs.yml +78 -0
  44. package/temp/rtk/.release-please-manifest.json +3 -0
  45. package/temp/rtk/ARCHITECTURE.md +1491 -0
  46. package/temp/rtk/CHANGELOG.md +640 -0
  47. package/temp/rtk/CLAUDE.md +605 -0
  48. package/temp/rtk/CONTRIBUTING.md +199 -0
  49. package/temp/rtk/Cargo.lock +1668 -0
  50. package/temp/rtk/Cargo.toml +64 -0
  51. package/temp/rtk/Formula/rtk.rb +43 -0
  52. package/temp/rtk/INSTALL.md +390 -0
  53. package/temp/rtk/LICENSE +21 -0
  54. package/temp/rtk/README.md +386 -0
  55. package/temp/rtk/README_es.md +159 -0
  56. package/temp/rtk/README_fr.md +197 -0
  57. package/temp/rtk/README_ja.md +159 -0
  58. package/temp/rtk/README_ko.md +159 -0
  59. package/temp/rtk/README_zh.md +167 -0
  60. package/temp/rtk/ROADMAP.md +15 -0
  61. package/temp/rtk/SECURITY.md +217 -0
  62. package/temp/rtk/TEST_EXEC_TIME.md +102 -0
  63. package/temp/rtk/build.rs +57 -0
  64. package/temp/rtk/docs/AUDIT_GUIDE.md +432 -0
  65. package/temp/rtk/docs/FEATURES.md +1410 -0
  66. package/temp/rtk/docs/TROUBLESHOOTING.md +309 -0
  67. package/temp/rtk/docs/filter-workflow.md +102 -0
  68. package/temp/rtk/docs/images/gain-dashboard.jpg +0 -0
  69. package/temp/rtk/docs/tracking.md +583 -0
  70. package/temp/rtk/hooks/opencode-rtk.ts +39 -0
  71. package/temp/rtk/hooks/rtk-awareness.md +29 -0
  72. package/temp/rtk/hooks/rtk-rewrite.sh +61 -0
  73. package/temp/rtk/hooks/test-rtk-rewrite.sh +442 -0
  74. package/temp/rtk/install.sh +124 -0
  75. package/temp/rtk/release-please-config.json +10 -0
  76. package/temp/rtk/scripts/benchmark.sh +592 -0
  77. package/temp/rtk/scripts/check-installation.sh +162 -0
  78. package/temp/rtk/scripts/install-local.sh +37 -0
  79. package/temp/rtk/scripts/rtk-economics.sh +137 -0
  80. package/temp/rtk/scripts/test-all.sh +561 -0
  81. package/temp/rtk/scripts/test-aristote.sh +227 -0
  82. package/temp/rtk/scripts/test-tracking.sh +79 -0
  83. package/temp/rtk/scripts/update-readme-metrics.sh +32 -0
  84. package/temp/rtk/scripts/validate-docs.sh +73 -0
  85. package/temp/rtk/src/aws_cmd.rs +880 -0
  86. package/temp/rtk/src/binlog.rs +1645 -0
  87. package/temp/rtk/src/cargo_cmd.rs +1727 -0
  88. package/temp/rtk/src/cc_economics.rs +1157 -0
  89. package/temp/rtk/src/ccusage.rs +340 -0
  90. package/temp/rtk/src/config.rs +187 -0
  91. package/temp/rtk/src/container.rs +855 -0
  92. package/temp/rtk/src/curl_cmd.rs +134 -0
  93. package/temp/rtk/src/deps.rs +268 -0
  94. package/temp/rtk/src/diff_cmd.rs +367 -0
  95. package/temp/rtk/src/discover/mod.rs +274 -0
  96. package/temp/rtk/src/discover/provider.rs +388 -0
  97. package/temp/rtk/src/discover/registry.rs +2022 -0
  98. package/temp/rtk/src/discover/report.rs +202 -0
  99. package/temp/rtk/src/discover/rules.rs +667 -0
  100. package/temp/rtk/src/display_helpers.rs +402 -0
  101. package/temp/rtk/src/dotnet_cmd.rs +1771 -0
  102. package/temp/rtk/src/dotnet_format_report.rs +133 -0
  103. package/temp/rtk/src/dotnet_trx.rs +593 -0
  104. package/temp/rtk/src/env_cmd.rs +204 -0
  105. package/temp/rtk/src/filter.rs +462 -0
  106. package/temp/rtk/src/filters/README.md +52 -0
  107. package/temp/rtk/src/filters/ansible-playbook.toml +34 -0
  108. package/temp/rtk/src/filters/basedpyright.toml +47 -0
  109. package/temp/rtk/src/filters/biome.toml +45 -0
  110. package/temp/rtk/src/filters/brew-install.toml +37 -0
  111. package/temp/rtk/src/filters/composer-install.toml +40 -0
  112. package/temp/rtk/src/filters/df.toml +16 -0
  113. package/temp/rtk/src/filters/dotnet-build.toml +64 -0
  114. package/temp/rtk/src/filters/du.toml +16 -0
  115. package/temp/rtk/src/filters/fail2ban-client.toml +15 -0
  116. package/temp/rtk/src/filters/gcc.toml +49 -0
  117. package/temp/rtk/src/filters/gcloud.toml +22 -0
  118. package/temp/rtk/src/filters/hadolint.toml +24 -0
  119. package/temp/rtk/src/filters/helm.toml +29 -0
  120. package/temp/rtk/src/filters/iptables.toml +27 -0
  121. package/temp/rtk/src/filters/jj.toml +28 -0
  122. package/temp/rtk/src/filters/jq.toml +24 -0
  123. package/temp/rtk/src/filters/make.toml +41 -0
  124. package/temp/rtk/src/filters/markdownlint.toml +24 -0
  125. package/temp/rtk/src/filters/mix-compile.toml +27 -0
  126. package/temp/rtk/src/filters/mix-format.toml +15 -0
  127. package/temp/rtk/src/filters/mvn-build.toml +44 -0
  128. package/temp/rtk/src/filters/oxlint.toml +43 -0
  129. package/temp/rtk/src/filters/ping.toml +63 -0
  130. package/temp/rtk/src/filters/pio-run.toml +40 -0
  131. package/temp/rtk/src/filters/poetry-install.toml +50 -0
  132. package/temp/rtk/src/filters/pre-commit.toml +35 -0
  133. package/temp/rtk/src/filters/ps.toml +16 -0
  134. package/temp/rtk/src/filters/quarto-render.toml +41 -0
  135. package/temp/rtk/src/filters/rsync.toml +48 -0
  136. package/temp/rtk/src/filters/shellcheck.toml +27 -0
  137. package/temp/rtk/src/filters/shopify-theme.toml +29 -0
  138. package/temp/rtk/src/filters/skopeo.toml +45 -0
  139. package/temp/rtk/src/filters/sops.toml +16 -0
  140. package/temp/rtk/src/filters/ssh.toml +44 -0
  141. package/temp/rtk/src/filters/stat.toml +34 -0
  142. package/temp/rtk/src/filters/swift-build.toml +41 -0
  143. package/temp/rtk/src/filters/systemctl-status.toml +33 -0
  144. package/temp/rtk/src/filters/terraform-plan.toml +35 -0
  145. package/temp/rtk/src/filters/tofu-fmt.toml +16 -0
  146. package/temp/rtk/src/filters/tofu-init.toml +38 -0
  147. package/temp/rtk/src/filters/tofu-plan.toml +35 -0
  148. package/temp/rtk/src/filters/tofu-validate.toml +17 -0
  149. package/temp/rtk/src/filters/trunk-build.toml +39 -0
  150. package/temp/rtk/src/filters/ty.toml +50 -0
  151. package/temp/rtk/src/filters/uv-sync.toml +37 -0
  152. package/temp/rtk/src/filters/xcodebuild.toml +99 -0
  153. package/temp/rtk/src/filters/yamllint.toml +25 -0
  154. package/temp/rtk/src/find_cmd.rs +598 -0
  155. package/temp/rtk/src/format_cmd.rs +386 -0
  156. package/temp/rtk/src/gain.rs +723 -0
  157. package/temp/rtk/src/gh_cmd.rs +1651 -0
  158. package/temp/rtk/src/git.rs +2012 -0
  159. package/temp/rtk/src/go_cmd.rs +592 -0
  160. package/temp/rtk/src/golangci_cmd.rs +254 -0
  161. package/temp/rtk/src/grep_cmd.rs +288 -0
  162. package/temp/rtk/src/gt_cmd.rs +810 -0
  163. package/temp/rtk/src/hook_audit_cmd.rs +283 -0
  164. package/temp/rtk/src/hook_check.rs +171 -0
  165. package/temp/rtk/src/init.rs +1859 -0
  166. package/temp/rtk/src/integrity.rs +537 -0
  167. package/temp/rtk/src/json_cmd.rs +231 -0
  168. package/temp/rtk/src/learn/detector.rs +628 -0
  169. package/temp/rtk/src/learn/mod.rs +119 -0
  170. package/temp/rtk/src/learn/report.rs +184 -0
  171. package/temp/rtk/src/lint_cmd.rs +694 -0
  172. package/temp/rtk/src/local_llm.rs +316 -0
  173. package/temp/rtk/src/log_cmd.rs +248 -0
  174. package/temp/rtk/src/ls.rs +324 -0
  175. package/temp/rtk/src/main.rs +2482 -0
  176. package/temp/rtk/src/mypy_cmd.rs +389 -0
  177. package/temp/rtk/src/next_cmd.rs +241 -0
  178. package/temp/rtk/src/npm_cmd.rs +236 -0
  179. package/temp/rtk/src/parser/README.md +267 -0
  180. package/temp/rtk/src/parser/error.rs +46 -0
  181. package/temp/rtk/src/parser/formatter.rs +336 -0
  182. package/temp/rtk/src/parser/mod.rs +311 -0
  183. package/temp/rtk/src/parser/types.rs +119 -0
  184. package/temp/rtk/src/pip_cmd.rs +302 -0
  185. package/temp/rtk/src/playwright_cmd.rs +479 -0
  186. package/temp/rtk/src/pnpm_cmd.rs +573 -0
  187. package/temp/rtk/src/prettier_cmd.rs +221 -0
  188. package/temp/rtk/src/prisma_cmd.rs +482 -0
  189. package/temp/rtk/src/psql_cmd.rs +382 -0
  190. package/temp/rtk/src/pytest_cmd.rs +384 -0
  191. package/temp/rtk/src/read.rs +217 -0
  192. package/temp/rtk/src/rewrite_cmd.rs +50 -0
  193. package/temp/rtk/src/ruff_cmd.rs +402 -0
  194. package/temp/rtk/src/runner.rs +271 -0
  195. package/temp/rtk/src/summary.rs +297 -0
  196. package/temp/rtk/src/tee.rs +405 -0
  197. package/temp/rtk/src/telemetry.rs +248 -0
  198. package/temp/rtk/src/toml_filter.rs +1655 -0
  199. package/temp/rtk/src/tracking.rs +1416 -0
  200. package/temp/rtk/src/tree.rs +209 -0
  201. package/temp/rtk/src/tsc_cmd.rs +259 -0
  202. package/temp/rtk/src/utils.rs +432 -0
  203. package/temp/rtk/src/verify_cmd.rs +47 -0
  204. package/temp/rtk/src/vitest_cmd.rs +385 -0
  205. package/temp/rtk/src/wc_cmd.rs +401 -0
  206. package/temp/rtk/src/wget_cmd.rs +260 -0
  207. package/temp/rtk/tests/fixtures/dotnet/build_failed.txt +11 -0
  208. package/temp/rtk/tests/fixtures/dotnet/format_changes.json +31 -0
  209. package/temp/rtk/tests/fixtures/dotnet/format_empty.json +1 -0
  210. package/temp/rtk/tests/fixtures/dotnet/format_success.json +12 -0
  211. package/temp/rtk/tests/fixtures/dotnet/test_failed.txt +18 -0
  212. package/dist/App.js +0 -404
  213. package/dist/Browse.js +0 -79
  214. package/dist/FuzzyPicker.js +0 -47
  215. package/dist/Onboarding.js +0 -51
  216. package/dist/Spinner.js +0 -12
  217. package/dist/StatusBar.js +0 -49
  218. package/dist/ai.js +0 -368
  219. package/dist/cache.js +0 -41
  220. package/dist/command-rewriter.js +0 -64
  221. package/dist/command-validator.js +0 -77
  222. package/dist/compression.js +0 -107
  223. package/dist/diff-cache.js +0 -107
  224. package/dist/economy.js +0 -79
  225. package/dist/expand-store.js +0 -38
  226. package/dist/file-cache.js +0 -72
  227. package/dist/file-index.js +0 -62
  228. package/dist/history.js +0 -62
  229. package/dist/lazy-executor.js +0 -54
  230. package/dist/line-dedup.js +0 -59
  231. package/dist/loop-detector.js +0 -75
  232. package/dist/mcp/install.js +0 -98
  233. package/dist/mcp/server.js +0 -569
  234. package/dist/noise-filter.js +0 -86
  235. package/dist/output-processor.js +0 -136
  236. package/dist/output-router.js +0 -41
  237. package/dist/parsers/base.js +0 -2
  238. package/dist/parsers/build.js +0 -64
  239. package/dist/parsers/errors.js +0 -101
  240. package/dist/parsers/files.js +0 -78
  241. package/dist/parsers/git.js +0 -99
  242. package/dist/parsers/index.js +0 -48
  243. package/dist/parsers/tests.js +0 -89
  244. package/dist/providers/anthropic.js +0 -39
  245. package/dist/providers/base.js +0 -4
  246. package/dist/providers/cerebras.js +0 -95
  247. package/dist/providers/index.js +0 -49
  248. package/dist/recipes/model.js +0 -20
  249. package/dist/recipes/storage.js +0 -136
  250. package/dist/search/content-search.js +0 -68
  251. package/dist/search/file-search.js +0 -61
  252. package/dist/search/filters.js +0 -34
  253. package/dist/search/index.js +0 -5
  254. package/dist/search/semantic.js +0 -320
  255. package/dist/session-boot.js +0 -59
  256. package/dist/session-context.js +0 -55
  257. package/dist/sessions-db.js +0 -120
  258. package/dist/smart-display.js +0 -286
  259. package/dist/snapshots.js +0 -51
  260. package/dist/supervisor.js +0 -112
  261. package/dist/test-watchlist.js +0 -131
  262. package/dist/tree.js +0 -94
  263. package/dist/usage-cache.js +0 -65
@@ -0,0 +1,667 @@
1
+ use super::report::RtkStatus;
2
+
3
+ /// A rule mapping a shell command pattern to its RTK equivalent.
4
+ pub struct RtkRule {
5
+ pub rtk_cmd: &'static str,
6
+ /// Original command prefixes to replace with rtk_cmd (longest first for correct matching).
7
+ pub rewrite_prefixes: &'static [&'static str],
8
+ pub category: &'static str,
9
+ pub savings_pct: f64,
10
+ pub subcmd_savings: &'static [(&'static str, f64)],
11
+ pub subcmd_status: &'static [(&'static str, RtkStatus)],
12
+ }
13
+
14
+ // Patterns ordered to match RULES indices exactly.
15
+ pub const PATTERNS: &[&str] = &[
16
+ r"^git\s+(status|log|diff|show|add|commit|push|pull|branch|fetch|stash|worktree)",
17
+ r"^gh\s+(pr|issue|run|repo|api|release)",
18
+ r"^cargo\s+(build|test|clippy|check|fmt|install)",
19
+ r"^pnpm\s+(list|ls|outdated|install)",
20
+ r"^npm\s+(run|exec)",
21
+ r"^npx\s+",
22
+ r"^(cat|head|tail)\s+",
23
+ r"^(rg|grep)\s+",
24
+ r"^ls(\s|$)",
25
+ r"^find\s+",
26
+ r"^(npx\s+|pnpm\s+)?tsc(\s|$)",
27
+ r"^(npx\s+|pnpm\s+)?(eslint|biome|lint)(\s|$)",
28
+ r"^(npx\s+|pnpm\s+)?prettier",
29
+ r"^(npx\s+|pnpm\s+)?next\s+build",
30
+ r"^(pnpm\s+|npx\s+)?(vitest|jest|test)(\s|$)",
31
+ r"^(npx\s+|pnpm\s+)?playwright",
32
+ r"^(npx\s+|pnpm\s+)?prisma",
33
+ r"^docker\s+(ps|images|logs|run|exec|build|compose\s+(ps|logs|build))",
34
+ r"^kubectl\s+(get|logs|describe|apply)",
35
+ r"^tree(\s|$)",
36
+ r"^diff\s+",
37
+ r"^curl\s+",
38
+ r"^wget\s+",
39
+ r"^(python3?\s+-m\s+)?mypy(\s|$)",
40
+ // Python tooling
41
+ r"^ruff\s+(check|format)",
42
+ r"^(python\s+-m\s+)?pytest(\s|$)",
43
+ r"^(pip3?|uv\s+pip)\s+(list|outdated|install)",
44
+ // Go tooling
45
+ r"^go\s+(test|build|vet)",
46
+ r"^golangci-lint(\s|$)",
47
+ // AWS CLI
48
+ r"^aws\s+",
49
+ // PostgreSQL
50
+ r"^psql(\s|$)",
51
+ // TOML-filtered commands
52
+ r"^ansible-playbook\b",
53
+ r"^brew\s+(install|upgrade)\b",
54
+ r"^composer\s+(install|update|require)\b",
55
+ r"^df(\s|$)",
56
+ r"^dotnet\s+build\b",
57
+ r"^du\b",
58
+ r"^fail2ban-client\b",
59
+ r"^gcloud\b",
60
+ r"^hadolint\b",
61
+ r"^helm\b",
62
+ r"^iptables\b",
63
+ r"^make\b",
64
+ r"^markdownlint\b",
65
+ r"^mix\s+(compile|format)(\s|$)",
66
+ r"^mvn\s+(compile|package|clean|install)\b",
67
+ r"^ping\b",
68
+ r"^pio\s+run",
69
+ r"^poetry\s+(install|lock|update)\b",
70
+ r"^pre-commit\b",
71
+ r"^ps(\s|$)",
72
+ r"^quarto\s+render",
73
+ r"^rsync\b",
74
+ r"^shellcheck\b",
75
+ r"^shopify\s+theme\s+(push|pull)",
76
+ r"^sops\b",
77
+ r"^swift\s+build\b",
78
+ r"^systemctl\s+status\b",
79
+ r"^terraform\s+plan",
80
+ r"^tofu\s+(fmt|init|plan|validate)(\s|$)",
81
+ r"^trunk\s+build",
82
+ r"^uv\s+(sync|pip\s+install)\b",
83
+ r"^yamllint\b",
84
+ ];
85
+
86
+ pub const RULES: &[RtkRule] = &[
87
+ RtkRule {
88
+ rtk_cmd: "rtk git",
89
+ rewrite_prefixes: &["git"],
90
+ category: "Git",
91
+ savings_pct: 70.0,
92
+ subcmd_savings: &[
93
+ ("diff", 80.0),
94
+ ("show", 80.0),
95
+ ("add", 59.0),
96
+ ("commit", 59.0),
97
+ ],
98
+ subcmd_status: &[],
99
+ },
100
+ RtkRule {
101
+ rtk_cmd: "rtk gh",
102
+ rewrite_prefixes: &["gh"],
103
+ category: "GitHub",
104
+ savings_pct: 82.0,
105
+ subcmd_savings: &[("pr", 87.0), ("run", 82.0), ("issue", 80.0)],
106
+ subcmd_status: &[],
107
+ },
108
+ RtkRule {
109
+ rtk_cmd: "rtk cargo",
110
+ rewrite_prefixes: &["cargo"],
111
+ category: "Cargo",
112
+ savings_pct: 80.0,
113
+ subcmd_savings: &[("test", 90.0), ("check", 80.0)],
114
+ subcmd_status: &[("fmt", RtkStatus::Passthrough)],
115
+ },
116
+ RtkRule {
117
+ rtk_cmd: "rtk pnpm",
118
+ rewrite_prefixes: &["pnpm"],
119
+ category: "PackageManager",
120
+ savings_pct: 80.0,
121
+ subcmd_savings: &[],
122
+ subcmd_status: &[],
123
+ },
124
+ RtkRule {
125
+ rtk_cmd: "rtk npm",
126
+ rewrite_prefixes: &["npm"],
127
+ category: "PackageManager",
128
+ savings_pct: 70.0,
129
+ subcmd_savings: &[],
130
+ subcmd_status: &[],
131
+ },
132
+ RtkRule {
133
+ rtk_cmd: "rtk npx",
134
+ rewrite_prefixes: &["npx"],
135
+ category: "PackageManager",
136
+ savings_pct: 70.0,
137
+ subcmd_savings: &[],
138
+ subcmd_status: &[],
139
+ },
140
+ RtkRule {
141
+ rtk_cmd: "rtk read",
142
+ rewrite_prefixes: &["cat", "head", "tail"],
143
+ category: "Files",
144
+ savings_pct: 60.0,
145
+ subcmd_savings: &[],
146
+ subcmd_status: &[],
147
+ },
148
+ RtkRule {
149
+ rtk_cmd: "rtk grep",
150
+ rewrite_prefixes: &["rg", "grep"],
151
+ category: "Files",
152
+ savings_pct: 75.0,
153
+ subcmd_savings: &[],
154
+ subcmd_status: &[],
155
+ },
156
+ RtkRule {
157
+ rtk_cmd: "rtk ls",
158
+ rewrite_prefixes: &["ls"],
159
+ category: "Files",
160
+ savings_pct: 65.0,
161
+ subcmd_savings: &[],
162
+ subcmd_status: &[],
163
+ },
164
+ RtkRule {
165
+ rtk_cmd: "rtk find",
166
+ rewrite_prefixes: &["find"],
167
+ category: "Files",
168
+ savings_pct: 70.0,
169
+ subcmd_savings: &[],
170
+ subcmd_status: &[],
171
+ },
172
+ RtkRule {
173
+ // Longest prefixes first for correct matching
174
+ rtk_cmd: "rtk tsc",
175
+ rewrite_prefixes: &["pnpm tsc", "npx tsc", "tsc"],
176
+ category: "Build",
177
+ savings_pct: 83.0,
178
+ subcmd_savings: &[],
179
+ subcmd_status: &[],
180
+ },
181
+ RtkRule {
182
+ rtk_cmd: "rtk lint",
183
+ rewrite_prefixes: &[
184
+ "npx eslint",
185
+ "pnpm lint",
186
+ "npx biome",
187
+ "eslint",
188
+ "biome",
189
+ "lint",
190
+ ],
191
+ category: "Build",
192
+ savings_pct: 84.0,
193
+ subcmd_savings: &[],
194
+ subcmd_status: &[],
195
+ },
196
+ RtkRule {
197
+ rtk_cmd: "rtk prettier",
198
+ rewrite_prefixes: &["npx prettier", "pnpm prettier", "prettier"],
199
+ category: "Build",
200
+ savings_pct: 70.0,
201
+ subcmd_savings: &[],
202
+ subcmd_status: &[],
203
+ },
204
+ RtkRule {
205
+ // "next build" is stripped to "rtk next" — the build subcommand is internal
206
+ rtk_cmd: "rtk next",
207
+ rewrite_prefixes: &["npx next build", "pnpm next build", "next build"],
208
+ category: "Build",
209
+ savings_pct: 87.0,
210
+ subcmd_savings: &[],
211
+ subcmd_status: &[],
212
+ },
213
+ RtkRule {
214
+ rtk_cmd: "rtk vitest",
215
+ rewrite_prefixes: &["pnpm vitest", "npx vitest", "vitest", "jest"],
216
+ category: "Tests",
217
+ savings_pct: 99.0,
218
+ subcmd_savings: &[],
219
+ subcmd_status: &[],
220
+ },
221
+ RtkRule {
222
+ rtk_cmd: "rtk playwright",
223
+ rewrite_prefixes: &["npx playwright", "pnpm playwright", "playwright"],
224
+ category: "Tests",
225
+ savings_pct: 94.0,
226
+ subcmd_savings: &[],
227
+ subcmd_status: &[],
228
+ },
229
+ RtkRule {
230
+ rtk_cmd: "rtk prisma",
231
+ rewrite_prefixes: &["npx prisma", "pnpm prisma", "prisma"],
232
+ category: "Build",
233
+ savings_pct: 88.0,
234
+ subcmd_savings: &[],
235
+ subcmd_status: &[],
236
+ },
237
+ RtkRule {
238
+ rtk_cmd: "rtk docker",
239
+ rewrite_prefixes: &["docker"],
240
+ category: "Infra",
241
+ savings_pct: 85.0,
242
+ subcmd_savings: &[],
243
+ subcmd_status: &[],
244
+ },
245
+ RtkRule {
246
+ rtk_cmd: "rtk kubectl",
247
+ rewrite_prefixes: &["kubectl"],
248
+ category: "Infra",
249
+ savings_pct: 85.0,
250
+ subcmd_savings: &[],
251
+ subcmd_status: &[],
252
+ },
253
+ RtkRule {
254
+ rtk_cmd: "rtk tree",
255
+ rewrite_prefixes: &["tree"],
256
+ category: "Files",
257
+ savings_pct: 70.0,
258
+ subcmd_savings: &[],
259
+ subcmd_status: &[],
260
+ },
261
+ RtkRule {
262
+ rtk_cmd: "rtk diff",
263
+ rewrite_prefixes: &["diff"],
264
+ category: "Files",
265
+ savings_pct: 60.0,
266
+ subcmd_savings: &[],
267
+ subcmd_status: &[],
268
+ },
269
+ RtkRule {
270
+ rtk_cmd: "rtk curl",
271
+ rewrite_prefixes: &["curl"],
272
+ category: "Network",
273
+ savings_pct: 70.0,
274
+ subcmd_savings: &[],
275
+ subcmd_status: &[],
276
+ },
277
+ RtkRule {
278
+ rtk_cmd: "rtk wget",
279
+ rewrite_prefixes: &["wget"],
280
+ category: "Network",
281
+ savings_pct: 65.0,
282
+ subcmd_savings: &[],
283
+ subcmd_status: &[],
284
+ },
285
+ RtkRule {
286
+ rtk_cmd: "rtk mypy",
287
+ rewrite_prefixes: &["python3 -m mypy", "python -m mypy", "mypy"],
288
+ category: "Build",
289
+ savings_pct: 80.0,
290
+ subcmd_savings: &[],
291
+ subcmd_status: &[],
292
+ },
293
+ // Python tooling
294
+ RtkRule {
295
+ rtk_cmd: "rtk ruff",
296
+ rewrite_prefixes: &["ruff"],
297
+ category: "Python",
298
+ savings_pct: 80.0,
299
+ subcmd_savings: &[("check", 80.0), ("format", 75.0)],
300
+ subcmd_status: &[],
301
+ },
302
+ RtkRule {
303
+ rtk_cmd: "rtk pytest",
304
+ rewrite_prefixes: &["python -m pytest", "pytest"],
305
+ category: "Python",
306
+ savings_pct: 90.0,
307
+ subcmd_savings: &[],
308
+ subcmd_status: &[],
309
+ },
310
+ RtkRule {
311
+ rtk_cmd: "rtk pip",
312
+ rewrite_prefixes: &["pip3", "pip", "uv pip"],
313
+ category: "Python",
314
+ savings_pct: 75.0,
315
+ subcmd_savings: &[("list", 75.0), ("outdated", 80.0)],
316
+ subcmd_status: &[],
317
+ },
318
+ // Go tooling
319
+ RtkRule {
320
+ rtk_cmd: "rtk go",
321
+ rewrite_prefixes: &["go"],
322
+ category: "Go",
323
+ savings_pct: 85.0,
324
+ subcmd_savings: &[("test", 90.0), ("build", 80.0), ("vet", 75.0)],
325
+ subcmd_status: &[],
326
+ },
327
+ RtkRule {
328
+ rtk_cmd: "rtk golangci-lint",
329
+ rewrite_prefixes: &["golangci-lint", "golangci"],
330
+ category: "Go",
331
+ savings_pct: 85.0,
332
+ subcmd_savings: &[],
333
+ subcmd_status: &[],
334
+ },
335
+ // AWS CLI
336
+ RtkRule {
337
+ rtk_cmd: "rtk aws",
338
+ rewrite_prefixes: &["aws"],
339
+ category: "Infra",
340
+ savings_pct: 80.0,
341
+ subcmd_savings: &[],
342
+ subcmd_status: &[],
343
+ },
344
+ // PostgreSQL
345
+ RtkRule {
346
+ rtk_cmd: "rtk psql",
347
+ rewrite_prefixes: &["psql"],
348
+ category: "Infra",
349
+ savings_pct: 75.0,
350
+ subcmd_savings: &[],
351
+ subcmd_status: &[],
352
+ },
353
+ // TOML-filtered commands
354
+ RtkRule {
355
+ rtk_cmd: "rtk ansible-playbook",
356
+ rewrite_prefixes: &["ansible-playbook"],
357
+ category: "Infra",
358
+ savings_pct: 70.0,
359
+ subcmd_savings: &[],
360
+ subcmd_status: &[],
361
+ },
362
+ RtkRule {
363
+ rtk_cmd: "rtk brew",
364
+ rewrite_prefixes: &["brew"],
365
+ category: "PackageManager",
366
+ savings_pct: 65.0,
367
+ subcmd_savings: &[],
368
+ subcmd_status: &[],
369
+ },
370
+ RtkRule {
371
+ rtk_cmd: "rtk composer",
372
+ rewrite_prefixes: &["composer"],
373
+ category: "PackageManager",
374
+ savings_pct: 65.0,
375
+ subcmd_savings: &[],
376
+ subcmd_status: &[],
377
+ },
378
+ RtkRule {
379
+ rtk_cmd: "rtk df",
380
+ rewrite_prefixes: &["df"],
381
+ category: "System",
382
+ savings_pct: 60.0,
383
+ subcmd_savings: &[],
384
+ subcmd_status: &[],
385
+ },
386
+ RtkRule {
387
+ rtk_cmd: "rtk dotnet",
388
+ rewrite_prefixes: &["dotnet"],
389
+ category: "Build",
390
+ savings_pct: 70.0,
391
+ subcmd_savings: &[],
392
+ subcmd_status: &[],
393
+ },
394
+ RtkRule {
395
+ rtk_cmd: "rtk du",
396
+ rewrite_prefixes: &["du"],
397
+ category: "System",
398
+ savings_pct: 60.0,
399
+ subcmd_savings: &[],
400
+ subcmd_status: &[],
401
+ },
402
+ RtkRule {
403
+ rtk_cmd: "rtk fail2ban-client",
404
+ rewrite_prefixes: &["fail2ban-client"],
405
+ category: "Infra",
406
+ savings_pct: 60.0,
407
+ subcmd_savings: &[],
408
+ subcmd_status: &[],
409
+ },
410
+ RtkRule {
411
+ rtk_cmd: "rtk gcloud",
412
+ rewrite_prefixes: &["gcloud"],
413
+ category: "Infra",
414
+ savings_pct: 65.0,
415
+ subcmd_savings: &[],
416
+ subcmd_status: &[],
417
+ },
418
+ RtkRule {
419
+ rtk_cmd: "rtk hadolint",
420
+ rewrite_prefixes: &["hadolint"],
421
+ category: "Build",
422
+ savings_pct: 65.0,
423
+ subcmd_savings: &[],
424
+ subcmd_status: &[],
425
+ },
426
+ RtkRule {
427
+ rtk_cmd: "rtk helm",
428
+ rewrite_prefixes: &["helm"],
429
+ category: "Infra",
430
+ savings_pct: 65.0,
431
+ subcmd_savings: &[],
432
+ subcmd_status: &[],
433
+ },
434
+ RtkRule {
435
+ rtk_cmd: "rtk iptables",
436
+ rewrite_prefixes: &["iptables"],
437
+ category: "Infra",
438
+ savings_pct: 60.0,
439
+ subcmd_savings: &[],
440
+ subcmd_status: &[],
441
+ },
442
+ RtkRule {
443
+ rtk_cmd: "rtk make",
444
+ rewrite_prefixes: &["make"],
445
+ category: "Build",
446
+ savings_pct: 65.0,
447
+ subcmd_savings: &[],
448
+ subcmd_status: &[],
449
+ },
450
+ RtkRule {
451
+ rtk_cmd: "rtk markdownlint",
452
+ rewrite_prefixes: &["markdownlint"],
453
+ category: "Build",
454
+ savings_pct: 65.0,
455
+ subcmd_savings: &[],
456
+ subcmd_status: &[],
457
+ },
458
+ RtkRule {
459
+ rtk_cmd: "rtk mix",
460
+ rewrite_prefixes: &["mix"],
461
+ category: "Build",
462
+ savings_pct: 65.0,
463
+ subcmd_savings: &[],
464
+ subcmd_status: &[],
465
+ },
466
+ RtkRule {
467
+ rtk_cmd: "rtk mvn",
468
+ rewrite_prefixes: &["mvn"],
469
+ category: "Build",
470
+ savings_pct: 70.0,
471
+ subcmd_savings: &[],
472
+ subcmd_status: &[],
473
+ },
474
+ RtkRule {
475
+ rtk_cmd: "rtk ping",
476
+ rewrite_prefixes: &["ping"],
477
+ category: "Network",
478
+ savings_pct: 60.0,
479
+ subcmd_savings: &[],
480
+ subcmd_status: &[],
481
+ },
482
+ RtkRule {
483
+ rtk_cmd: "rtk pio",
484
+ rewrite_prefixes: &["pio"],
485
+ category: "Build",
486
+ savings_pct: 65.0,
487
+ subcmd_savings: &[],
488
+ subcmd_status: &[],
489
+ },
490
+ RtkRule {
491
+ rtk_cmd: "rtk poetry",
492
+ rewrite_prefixes: &["poetry"],
493
+ category: "Python",
494
+ savings_pct: 65.0,
495
+ subcmd_savings: &[],
496
+ subcmd_status: &[],
497
+ },
498
+ RtkRule {
499
+ rtk_cmd: "rtk pre-commit",
500
+ rewrite_prefixes: &["pre-commit"],
501
+ category: "Build",
502
+ savings_pct: 65.0,
503
+ subcmd_savings: &[],
504
+ subcmd_status: &[],
505
+ },
506
+ RtkRule {
507
+ rtk_cmd: "rtk ps",
508
+ rewrite_prefixes: &["ps"],
509
+ category: "System",
510
+ savings_pct: 60.0,
511
+ subcmd_savings: &[],
512
+ subcmd_status: &[],
513
+ },
514
+ RtkRule {
515
+ rtk_cmd: "rtk quarto",
516
+ rewrite_prefixes: &["quarto"],
517
+ category: "Build",
518
+ savings_pct: 65.0,
519
+ subcmd_savings: &[],
520
+ subcmd_status: &[],
521
+ },
522
+ RtkRule {
523
+ rtk_cmd: "rtk rsync",
524
+ rewrite_prefixes: &["rsync"],
525
+ category: "Network",
526
+ savings_pct: 65.0,
527
+ subcmd_savings: &[],
528
+ subcmd_status: &[],
529
+ },
530
+ RtkRule {
531
+ rtk_cmd: "rtk shellcheck",
532
+ rewrite_prefixes: &["shellcheck"],
533
+ category: "Build",
534
+ savings_pct: 65.0,
535
+ subcmd_savings: &[],
536
+ subcmd_status: &[],
537
+ },
538
+ RtkRule {
539
+ rtk_cmd: "rtk shopify",
540
+ rewrite_prefixes: &["shopify"],
541
+ category: "Build",
542
+ savings_pct: 65.0,
543
+ subcmd_savings: &[],
544
+ subcmd_status: &[],
545
+ },
546
+ RtkRule {
547
+ rtk_cmd: "rtk sops",
548
+ rewrite_prefixes: &["sops"],
549
+ category: "Infra",
550
+ savings_pct: 60.0,
551
+ subcmd_savings: &[],
552
+ subcmd_status: &[],
553
+ },
554
+ RtkRule {
555
+ rtk_cmd: "rtk swift",
556
+ rewrite_prefixes: &["swift"],
557
+ category: "Build",
558
+ savings_pct: 65.0,
559
+ subcmd_savings: &[],
560
+ subcmd_status: &[],
561
+ },
562
+ RtkRule {
563
+ rtk_cmd: "rtk systemctl",
564
+ rewrite_prefixes: &["systemctl"],
565
+ category: "System",
566
+ savings_pct: 65.0,
567
+ subcmd_savings: &[],
568
+ subcmd_status: &[],
569
+ },
570
+ RtkRule {
571
+ rtk_cmd: "rtk terraform",
572
+ rewrite_prefixes: &["terraform"],
573
+ category: "Infra",
574
+ savings_pct: 70.0,
575
+ subcmd_savings: &[],
576
+ subcmd_status: &[],
577
+ },
578
+ RtkRule {
579
+ rtk_cmd: "rtk tofu",
580
+ rewrite_prefixes: &["tofu"],
581
+ category: "Infra",
582
+ savings_pct: 70.0,
583
+ subcmd_savings: &[],
584
+ subcmd_status: &[],
585
+ },
586
+ RtkRule {
587
+ rtk_cmd: "rtk trunk",
588
+ rewrite_prefixes: &["trunk"],
589
+ category: "Build",
590
+ savings_pct: 65.0,
591
+ subcmd_savings: &[],
592
+ subcmd_status: &[],
593
+ },
594
+ RtkRule {
595
+ rtk_cmd: "rtk uv",
596
+ rewrite_prefixes: &["uv"],
597
+ category: "Python",
598
+ savings_pct: 65.0,
599
+ subcmd_savings: &[],
600
+ subcmd_status: &[],
601
+ },
602
+ RtkRule {
603
+ rtk_cmd: "rtk yamllint",
604
+ rewrite_prefixes: &["yamllint"],
605
+ category: "Build",
606
+ savings_pct: 65.0,
607
+ subcmd_savings: &[],
608
+ subcmd_status: &[],
609
+ },
610
+ ];
611
+
612
+ /// Commands to ignore (shell builtins, trivial, already rtk).
613
+ pub const IGNORED_PREFIXES: &[&str] = &[
614
+ "cd ",
615
+ "cd\t",
616
+ "echo ",
617
+ "printf ",
618
+ "export ",
619
+ "source ",
620
+ "mkdir ",
621
+ "rm ",
622
+ "mv ",
623
+ "cp ",
624
+ "chmod ",
625
+ "chown ",
626
+ "touch ",
627
+ "which ",
628
+ "type ",
629
+ "command ",
630
+ "test ",
631
+ "true",
632
+ "false",
633
+ "sleep ",
634
+ "wait",
635
+ "kill ",
636
+ "set ",
637
+ "unset ",
638
+ "wc ",
639
+ "sort ",
640
+ "uniq ",
641
+ "tr ",
642
+ "cut ",
643
+ "awk ",
644
+ "sed ",
645
+ "python3 -c",
646
+ "python -c",
647
+ "node -e",
648
+ "ruby -e",
649
+ "rtk ",
650
+ "pwd",
651
+ "bash ",
652
+ "sh ",
653
+ "then\n",
654
+ "then ",
655
+ "else\n",
656
+ "else ",
657
+ "do\n",
658
+ "do ",
659
+ "for ",
660
+ "while ",
661
+ "if ",
662
+ "case ",
663
+ ];
664
+
665
+ pub const IGNORED_EXACT: &[&str] = &[
666
+ "cd", "echo", "true", "false", "wait", "pwd", "bash", "sh", "fi", "done",
667
+ ];