@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.
- package/dist/cli.js +52 -21
- package/package.json +1 -1
- package/src/ai.ts +77 -130
- package/src/cli.tsx +51 -21
- package/src/command-validator.ts +11 -0
- package/src/context-hints.ts +291 -0
- package/src/discover.ts +238 -0
- package/src/economy.ts +53 -0
- package/src/output-processor.ts +7 -18
- package/src/output-store.ts +65 -0
- package/src/providers/base.ts +3 -1
- package/src/providers/groq.ts +108 -0
- package/src/providers/index.ts +26 -2
- package/src/providers/providers.test.ts +4 -2
- package/src/providers/xai.ts +108 -0
- package/src/sessions-db.ts +81 -0
- package/temp/rtk/.claude/agents/code-reviewer.md +221 -0
- package/temp/rtk/.claude/agents/debugger.md +519 -0
- package/temp/rtk/.claude/agents/rtk-testing-specialist.md +461 -0
- package/temp/rtk/.claude/agents/rust-rtk.md +511 -0
- package/temp/rtk/.claude/agents/technical-writer.md +355 -0
- package/temp/rtk/.claude/commands/diagnose.md +352 -0
- package/temp/rtk/.claude/commands/test-routing.md +362 -0
- package/temp/rtk/.claude/hooks/bash/pre-commit-format.sh +16 -0
- package/temp/rtk/.claude/hooks/rtk-rewrite.sh +70 -0
- package/temp/rtk/.claude/hooks/rtk-suggest.sh +152 -0
- package/temp/rtk/.claude/rules/cli-testing.md +526 -0
- package/temp/rtk/.claude/skills/issue-triage/SKILL.md +348 -0
- package/temp/rtk/.claude/skills/issue-triage/templates/issue-comment.md +134 -0
- package/temp/rtk/.claude/skills/performance.md +435 -0
- package/temp/rtk/.claude/skills/pr-triage/SKILL.md +315 -0
- package/temp/rtk/.claude/skills/pr-triage/templates/review-comment.md +71 -0
- package/temp/rtk/.claude/skills/repo-recap.md +206 -0
- package/temp/rtk/.claude/skills/rtk-tdd/SKILL.md +78 -0
- package/temp/rtk/.claude/skills/rtk-tdd/references/testing-patterns.md +124 -0
- package/temp/rtk/.claude/skills/security-guardian.md +503 -0
- package/temp/rtk/.claude/skills/ship.md +404 -0
- package/temp/rtk/.github/workflows/benchmark.yml +34 -0
- package/temp/rtk/.github/workflows/dco-check.yaml +12 -0
- package/temp/rtk/.github/workflows/release-please.yml +51 -0
- package/temp/rtk/.github/workflows/release.yml +343 -0
- package/temp/rtk/.github/workflows/security-check.yml +135 -0
- package/temp/rtk/.github/workflows/validate-docs.yml +78 -0
- package/temp/rtk/.release-please-manifest.json +3 -0
- package/temp/rtk/ARCHITECTURE.md +1491 -0
- package/temp/rtk/CHANGELOG.md +640 -0
- package/temp/rtk/CLAUDE.md +605 -0
- package/temp/rtk/CONTRIBUTING.md +199 -0
- package/temp/rtk/Cargo.lock +1668 -0
- package/temp/rtk/Cargo.toml +64 -0
- package/temp/rtk/Formula/rtk.rb +43 -0
- package/temp/rtk/INSTALL.md +390 -0
- package/temp/rtk/LICENSE +21 -0
- package/temp/rtk/README.md +386 -0
- package/temp/rtk/README_es.md +159 -0
- package/temp/rtk/README_fr.md +197 -0
- package/temp/rtk/README_ja.md +159 -0
- package/temp/rtk/README_ko.md +159 -0
- package/temp/rtk/README_zh.md +167 -0
- package/temp/rtk/ROADMAP.md +15 -0
- package/temp/rtk/SECURITY.md +217 -0
- package/temp/rtk/TEST_EXEC_TIME.md +102 -0
- package/temp/rtk/build.rs +57 -0
- package/temp/rtk/docs/AUDIT_GUIDE.md +432 -0
- package/temp/rtk/docs/FEATURES.md +1410 -0
- package/temp/rtk/docs/TROUBLESHOOTING.md +309 -0
- package/temp/rtk/docs/filter-workflow.md +102 -0
- package/temp/rtk/docs/images/gain-dashboard.jpg +0 -0
- package/temp/rtk/docs/tracking.md +583 -0
- package/temp/rtk/hooks/opencode-rtk.ts +39 -0
- package/temp/rtk/hooks/rtk-awareness.md +29 -0
- package/temp/rtk/hooks/rtk-rewrite.sh +61 -0
- package/temp/rtk/hooks/test-rtk-rewrite.sh +442 -0
- package/temp/rtk/install.sh +124 -0
- package/temp/rtk/release-please-config.json +10 -0
- package/temp/rtk/scripts/benchmark.sh +592 -0
- package/temp/rtk/scripts/check-installation.sh +162 -0
- package/temp/rtk/scripts/install-local.sh +37 -0
- package/temp/rtk/scripts/rtk-economics.sh +137 -0
- package/temp/rtk/scripts/test-all.sh +561 -0
- package/temp/rtk/scripts/test-aristote.sh +227 -0
- package/temp/rtk/scripts/test-tracking.sh +79 -0
- package/temp/rtk/scripts/update-readme-metrics.sh +32 -0
- package/temp/rtk/scripts/validate-docs.sh +73 -0
- package/temp/rtk/src/aws_cmd.rs +880 -0
- package/temp/rtk/src/binlog.rs +1645 -0
- package/temp/rtk/src/cargo_cmd.rs +1727 -0
- package/temp/rtk/src/cc_economics.rs +1157 -0
- package/temp/rtk/src/ccusage.rs +340 -0
- package/temp/rtk/src/config.rs +187 -0
- package/temp/rtk/src/container.rs +855 -0
- package/temp/rtk/src/curl_cmd.rs +134 -0
- package/temp/rtk/src/deps.rs +268 -0
- package/temp/rtk/src/diff_cmd.rs +367 -0
- package/temp/rtk/src/discover/mod.rs +274 -0
- package/temp/rtk/src/discover/provider.rs +388 -0
- package/temp/rtk/src/discover/registry.rs +2022 -0
- package/temp/rtk/src/discover/report.rs +202 -0
- package/temp/rtk/src/discover/rules.rs +667 -0
- package/temp/rtk/src/display_helpers.rs +402 -0
- package/temp/rtk/src/dotnet_cmd.rs +1771 -0
- package/temp/rtk/src/dotnet_format_report.rs +133 -0
- package/temp/rtk/src/dotnet_trx.rs +593 -0
- package/temp/rtk/src/env_cmd.rs +204 -0
- package/temp/rtk/src/filter.rs +462 -0
- package/temp/rtk/src/filters/README.md +52 -0
- package/temp/rtk/src/filters/ansible-playbook.toml +34 -0
- package/temp/rtk/src/filters/basedpyright.toml +47 -0
- package/temp/rtk/src/filters/biome.toml +45 -0
- package/temp/rtk/src/filters/brew-install.toml +37 -0
- package/temp/rtk/src/filters/composer-install.toml +40 -0
- package/temp/rtk/src/filters/df.toml +16 -0
- package/temp/rtk/src/filters/dotnet-build.toml +64 -0
- package/temp/rtk/src/filters/du.toml +16 -0
- package/temp/rtk/src/filters/fail2ban-client.toml +15 -0
- package/temp/rtk/src/filters/gcc.toml +49 -0
- package/temp/rtk/src/filters/gcloud.toml +22 -0
- package/temp/rtk/src/filters/hadolint.toml +24 -0
- package/temp/rtk/src/filters/helm.toml +29 -0
- package/temp/rtk/src/filters/iptables.toml +27 -0
- package/temp/rtk/src/filters/jj.toml +28 -0
- package/temp/rtk/src/filters/jq.toml +24 -0
- package/temp/rtk/src/filters/make.toml +41 -0
- package/temp/rtk/src/filters/markdownlint.toml +24 -0
- package/temp/rtk/src/filters/mix-compile.toml +27 -0
- package/temp/rtk/src/filters/mix-format.toml +15 -0
- package/temp/rtk/src/filters/mvn-build.toml +44 -0
- package/temp/rtk/src/filters/oxlint.toml +43 -0
- package/temp/rtk/src/filters/ping.toml +63 -0
- package/temp/rtk/src/filters/pio-run.toml +40 -0
- package/temp/rtk/src/filters/poetry-install.toml +50 -0
- package/temp/rtk/src/filters/pre-commit.toml +35 -0
- package/temp/rtk/src/filters/ps.toml +16 -0
- package/temp/rtk/src/filters/quarto-render.toml +41 -0
- package/temp/rtk/src/filters/rsync.toml +48 -0
- package/temp/rtk/src/filters/shellcheck.toml +27 -0
- package/temp/rtk/src/filters/shopify-theme.toml +29 -0
- package/temp/rtk/src/filters/skopeo.toml +45 -0
- package/temp/rtk/src/filters/sops.toml +16 -0
- package/temp/rtk/src/filters/ssh.toml +44 -0
- package/temp/rtk/src/filters/stat.toml +34 -0
- package/temp/rtk/src/filters/swift-build.toml +41 -0
- package/temp/rtk/src/filters/systemctl-status.toml +33 -0
- package/temp/rtk/src/filters/terraform-plan.toml +35 -0
- package/temp/rtk/src/filters/tofu-fmt.toml +16 -0
- package/temp/rtk/src/filters/tofu-init.toml +38 -0
- package/temp/rtk/src/filters/tofu-plan.toml +35 -0
- package/temp/rtk/src/filters/tofu-validate.toml +17 -0
- package/temp/rtk/src/filters/trunk-build.toml +39 -0
- package/temp/rtk/src/filters/ty.toml +50 -0
- package/temp/rtk/src/filters/uv-sync.toml +37 -0
- package/temp/rtk/src/filters/xcodebuild.toml +99 -0
- package/temp/rtk/src/filters/yamllint.toml +25 -0
- package/temp/rtk/src/find_cmd.rs +598 -0
- package/temp/rtk/src/format_cmd.rs +386 -0
- package/temp/rtk/src/gain.rs +723 -0
- package/temp/rtk/src/gh_cmd.rs +1651 -0
- package/temp/rtk/src/git.rs +2012 -0
- package/temp/rtk/src/go_cmd.rs +592 -0
- package/temp/rtk/src/golangci_cmd.rs +254 -0
- package/temp/rtk/src/grep_cmd.rs +288 -0
- package/temp/rtk/src/gt_cmd.rs +810 -0
- package/temp/rtk/src/hook_audit_cmd.rs +283 -0
- package/temp/rtk/src/hook_check.rs +171 -0
- package/temp/rtk/src/init.rs +1859 -0
- package/temp/rtk/src/integrity.rs +537 -0
- package/temp/rtk/src/json_cmd.rs +231 -0
- package/temp/rtk/src/learn/detector.rs +628 -0
- package/temp/rtk/src/learn/mod.rs +119 -0
- package/temp/rtk/src/learn/report.rs +184 -0
- package/temp/rtk/src/lint_cmd.rs +694 -0
- package/temp/rtk/src/local_llm.rs +316 -0
- package/temp/rtk/src/log_cmd.rs +248 -0
- package/temp/rtk/src/ls.rs +324 -0
- package/temp/rtk/src/main.rs +2482 -0
- package/temp/rtk/src/mypy_cmd.rs +389 -0
- package/temp/rtk/src/next_cmd.rs +241 -0
- package/temp/rtk/src/npm_cmd.rs +236 -0
- package/temp/rtk/src/parser/README.md +267 -0
- package/temp/rtk/src/parser/error.rs +46 -0
- package/temp/rtk/src/parser/formatter.rs +336 -0
- package/temp/rtk/src/parser/mod.rs +311 -0
- package/temp/rtk/src/parser/types.rs +119 -0
- package/temp/rtk/src/pip_cmd.rs +302 -0
- package/temp/rtk/src/playwright_cmd.rs +479 -0
- package/temp/rtk/src/pnpm_cmd.rs +573 -0
- package/temp/rtk/src/prettier_cmd.rs +221 -0
- package/temp/rtk/src/prisma_cmd.rs +482 -0
- package/temp/rtk/src/psql_cmd.rs +382 -0
- package/temp/rtk/src/pytest_cmd.rs +384 -0
- package/temp/rtk/src/read.rs +217 -0
- package/temp/rtk/src/rewrite_cmd.rs +50 -0
- package/temp/rtk/src/ruff_cmd.rs +402 -0
- package/temp/rtk/src/runner.rs +271 -0
- package/temp/rtk/src/summary.rs +297 -0
- package/temp/rtk/src/tee.rs +405 -0
- package/temp/rtk/src/telemetry.rs +248 -0
- package/temp/rtk/src/toml_filter.rs +1655 -0
- package/temp/rtk/src/tracking.rs +1416 -0
- package/temp/rtk/src/tree.rs +209 -0
- package/temp/rtk/src/tsc_cmd.rs +259 -0
- package/temp/rtk/src/utils.rs +432 -0
- package/temp/rtk/src/verify_cmd.rs +47 -0
- package/temp/rtk/src/vitest_cmd.rs +385 -0
- package/temp/rtk/src/wc_cmd.rs +401 -0
- package/temp/rtk/src/wget_cmd.rs +260 -0
- package/temp/rtk/tests/fixtures/dotnet/build_failed.txt +11 -0
- package/temp/rtk/tests/fixtures/dotnet/format_changes.json +31 -0
- package/temp/rtk/tests/fixtures/dotnet/format_empty.json +1 -0
- package/temp/rtk/tests/fixtures/dotnet/format_success.json +12 -0
- package/temp/rtk/tests/fixtures/dotnet/test_failed.txt +18 -0
- package/dist/App.js +0 -404
- package/dist/Browse.js +0 -79
- package/dist/FuzzyPicker.js +0 -47
- package/dist/Onboarding.js +0 -51
- package/dist/Spinner.js +0 -12
- package/dist/StatusBar.js +0 -49
- package/dist/ai.js +0 -368
- package/dist/cache.js +0 -41
- package/dist/command-rewriter.js +0 -64
- package/dist/command-validator.js +0 -77
- package/dist/compression.js +0 -107
- package/dist/diff-cache.js +0 -107
- package/dist/economy.js +0 -79
- package/dist/expand-store.js +0 -38
- package/dist/file-cache.js +0 -72
- package/dist/file-index.js +0 -62
- package/dist/history.js +0 -62
- package/dist/lazy-executor.js +0 -54
- package/dist/line-dedup.js +0 -59
- package/dist/loop-detector.js +0 -75
- package/dist/mcp/install.js +0 -98
- package/dist/mcp/server.js +0 -569
- package/dist/noise-filter.js +0 -86
- package/dist/output-processor.js +0 -136
- package/dist/output-router.js +0 -41
- package/dist/parsers/base.js +0 -2
- package/dist/parsers/build.js +0 -64
- package/dist/parsers/errors.js +0 -101
- package/dist/parsers/files.js +0 -78
- package/dist/parsers/git.js +0 -99
- package/dist/parsers/index.js +0 -48
- package/dist/parsers/tests.js +0 -89
- package/dist/providers/anthropic.js +0 -39
- package/dist/providers/base.js +0 -4
- package/dist/providers/cerebras.js +0 -95
- package/dist/providers/index.js +0 -49
- package/dist/recipes/model.js +0 -20
- package/dist/recipes/storage.js +0 -136
- package/dist/search/content-search.js +0 -68
- package/dist/search/file-search.js +0 -61
- package/dist/search/filters.js +0 -34
- package/dist/search/index.js +0 -5
- package/dist/search/semantic.js +0 -320
- package/dist/session-boot.js +0 -59
- package/dist/session-context.js +0 -55
- package/dist/sessions-db.js +0 -120
- package/dist/smart-display.js +0 -286
- package/dist/snapshots.js +0 -51
- package/dist/supervisor.js +0 -112
- package/dist/test-watchlist.js +0 -131
- package/dist/tree.js +0 -94
- package/dist/usage-cache.js +0 -65
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://avatars.githubusercontent.com/u/258253854?v=4" alt="RTK - Rust Token Killer" width="500">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<strong>Proxy CLI haute performance qui reduit la consommation de tokens LLM de 60-90%</strong>
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<a href="https://github.com/rtk-ai/rtk/actions"><img src="https://github.com/rtk-ai/rtk/workflows/Security%20Check/badge.svg" alt="CI"></a>
|
|
11
|
+
<a href="https://github.com/rtk-ai/rtk/releases"><img src="https://img.shields.io/github/v/release/rtk-ai/rtk" alt="Release"></a>
|
|
12
|
+
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
|
|
13
|
+
<a href="https://discord.gg/gFwRPEKq4p"><img src="https://img.shields.io/discord/1478373640461488159?label=Discord&logo=discord" alt="Discord"></a>
|
|
14
|
+
<a href="https://formulae.brew.sh/formula/rtk"><img src="https://img.shields.io/homebrew/v/rtk" alt="Homebrew"></a>
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
<p align="center">
|
|
18
|
+
<a href="https://www.rtk-ai.app">Site web</a> •
|
|
19
|
+
<a href="#installation">Installer</a> •
|
|
20
|
+
<a href="docs/TROUBLESHOOTING.md">Depannage</a> •
|
|
21
|
+
<a href="ARCHITECTURE.md">Architecture</a> •
|
|
22
|
+
<a href="https://discord.gg/gFwRPEKq4p">Discord</a>
|
|
23
|
+
</p>
|
|
24
|
+
|
|
25
|
+
<p align="center">
|
|
26
|
+
<a href="README.md">English</a> •
|
|
27
|
+
<a href="README_fr.md">Francais</a> •
|
|
28
|
+
<a href="README_zh.md">中文</a> •
|
|
29
|
+
<a href="README_ja.md">日本語</a> •
|
|
30
|
+
<a href="README_ko.md">한국어</a> •
|
|
31
|
+
<a href="README_es.md">Espanol</a>
|
|
32
|
+
</p>
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
rtk filtre et compresse les sorties de commandes avant qu'elles n'atteignent le contexte de votre LLM. Binaire Rust unique, zero dependance, <10ms d'overhead.
|
|
37
|
+
|
|
38
|
+
## Economies de tokens (session Claude Code de 30 min)
|
|
39
|
+
|
|
40
|
+
| Operation | Frequence | Standard | rtk | Economies |
|
|
41
|
+
|-----------|-----------|----------|-----|-----------|
|
|
42
|
+
| `ls` / `tree` | 10x | 2 000 | 400 | -80% |
|
|
43
|
+
| `cat` / `read` | 20x | 40 000 | 12 000 | -70% |
|
|
44
|
+
| `grep` / `rg` | 8x | 16 000 | 3 200 | -80% |
|
|
45
|
+
| `git status` | 10x | 3 000 | 600 | -80% |
|
|
46
|
+
| `git diff` | 5x | 10 000 | 2 500 | -75% |
|
|
47
|
+
| `git log` | 5x | 2 500 | 500 | -80% |
|
|
48
|
+
| `git add/commit/push` | 8x | 1 600 | 120 | -92% |
|
|
49
|
+
| `cargo test` / `npm test` | 5x | 25 000 | 2 500 | -90% |
|
|
50
|
+
| **Total** | | **~118 000** | **~23 900** | **-80%** |
|
|
51
|
+
|
|
52
|
+
> Estimations basees sur des projets TypeScript/Rust de taille moyenne.
|
|
53
|
+
|
|
54
|
+
## Installation
|
|
55
|
+
|
|
56
|
+
### Homebrew (recommande)
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
brew install rtk
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Installation rapide (Linux/macOS)
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
curl -fsSL https://raw.githubusercontent.com/rtk-ai/rtk/refs/heads/master/install.sh | sh
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Cargo
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
cargo install --git https://github.com/rtk-ai/rtk
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Verification
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
rtk --version # Doit afficher "rtk 0.27.x"
|
|
78
|
+
rtk gain # Doit afficher les statistiques d'economies
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
> **Attention** : Un autre projet "rtk" (Rust Type Kit) existe sur crates.io. Si `rtk gain` echoue, vous avez le mauvais package.
|
|
82
|
+
|
|
83
|
+
## Demarrage rapide
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
# 1. Installer le hook pour Claude Code (recommande)
|
|
87
|
+
rtk init --global
|
|
88
|
+
# Suivre les instructions pour enregistrer dans ~/.claude/settings.json
|
|
89
|
+
|
|
90
|
+
# 2. Redemarrer Claude Code, puis tester
|
|
91
|
+
git status # Automatiquement reecrit en rtk git status
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Le hook reecrit de maniere transparente les commandes (ex: `git status` -> `rtk git status`) avant execution.
|
|
95
|
+
|
|
96
|
+
## Comment ca marche
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
Sans rtk : Avec rtk :
|
|
100
|
+
|
|
101
|
+
Claude --git status--> shell --> git Claude --git status--> RTK --> git
|
|
102
|
+
^ | ^ | |
|
|
103
|
+
| ~2 000 tokens (brut) | | ~200 tokens | filtre |
|
|
104
|
+
+-----------------------------------+ +------- (filtre) -----+----------+
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Quatre strategies appliquees par type de commande :
|
|
108
|
+
|
|
109
|
+
1. **Filtrage intelligent** - Supprime le bruit (commentaires, espaces, boilerplate)
|
|
110
|
+
2. **Regroupement** - Agregat d'elements similaires (fichiers par dossier, erreurs par type)
|
|
111
|
+
3. **Troncature** - Conserve le contexte pertinent, coupe la redondance
|
|
112
|
+
4. **Deduplication** - Fusionne les lignes de log repetees avec compteurs
|
|
113
|
+
|
|
114
|
+
## Commandes
|
|
115
|
+
|
|
116
|
+
### Fichiers
|
|
117
|
+
```bash
|
|
118
|
+
rtk ls . # Arbre de repertoires optimise
|
|
119
|
+
rtk read file.rs # Lecture intelligente
|
|
120
|
+
rtk read file.rs -l aggressive # Signatures uniquement
|
|
121
|
+
rtk find "*.rs" . # Resultats compacts
|
|
122
|
+
rtk grep "pattern" . # Resultats groupes par fichier
|
|
123
|
+
rtk diff file1 file2 # Diff condense
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Git
|
|
127
|
+
```bash
|
|
128
|
+
rtk git status # Status compact
|
|
129
|
+
rtk git log -n 10 # Commits sur une ligne
|
|
130
|
+
rtk git diff # Diff condense
|
|
131
|
+
rtk git add # -> "ok"
|
|
132
|
+
rtk git commit -m "msg" # -> "ok abc1234"
|
|
133
|
+
rtk git push # -> "ok main"
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Tests
|
|
137
|
+
```bash
|
|
138
|
+
rtk test cargo test # Echecs uniquement (-90%)
|
|
139
|
+
rtk vitest run # Vitest compact
|
|
140
|
+
rtk pytest # Tests Python (-90%)
|
|
141
|
+
rtk go test # Tests Go (-90%)
|
|
142
|
+
rtk cargo test # Tests Cargo (-90%)
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Build & Lint
|
|
146
|
+
```bash
|
|
147
|
+
rtk lint # ESLint groupe par regle
|
|
148
|
+
rtk tsc # Erreurs TypeScript groupees
|
|
149
|
+
rtk cargo build # Build Cargo (-80%)
|
|
150
|
+
rtk cargo clippy # Clippy (-80%)
|
|
151
|
+
rtk ruff check # Linting Python (-80%)
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Conteneurs
|
|
155
|
+
```bash
|
|
156
|
+
rtk docker ps # Liste compacte
|
|
157
|
+
rtk docker logs <container> # Logs dedupliques
|
|
158
|
+
rtk kubectl pods # Pods compacts
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Analytics
|
|
162
|
+
```bash
|
|
163
|
+
rtk gain # Statistiques d'economies
|
|
164
|
+
rtk gain --graph # Graphique ASCII (30 jours)
|
|
165
|
+
rtk discover # Trouver les economies manquees
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Configuration
|
|
169
|
+
|
|
170
|
+
```toml
|
|
171
|
+
# ~/.config/rtk/config.toml
|
|
172
|
+
[tracking]
|
|
173
|
+
database_path = "/chemin/custom.db"
|
|
174
|
+
|
|
175
|
+
[hooks]
|
|
176
|
+
exclude_commands = ["curl", "playwright"]
|
|
177
|
+
|
|
178
|
+
[tee]
|
|
179
|
+
enabled = true
|
|
180
|
+
mode = "failures"
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Documentation
|
|
184
|
+
|
|
185
|
+
- **[TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md)** - Resoudre les problemes courants
|
|
186
|
+
- **[INSTALL.md](INSTALL.md)** - Guide d'installation detaille
|
|
187
|
+
- **[ARCHITECTURE.md](ARCHITECTURE.md)** - Architecture technique
|
|
188
|
+
|
|
189
|
+
## Contribuer
|
|
190
|
+
|
|
191
|
+
Les contributions sont les bienvenues ! Ouvrez une issue ou une PR sur [GitHub](https://github.com/rtk-ai/rtk).
|
|
192
|
+
|
|
193
|
+
Rejoignez la communaute sur [Discord](https://discord.gg/pvHdzAec).
|
|
194
|
+
|
|
195
|
+
## Licence
|
|
196
|
+
|
|
197
|
+
Licence MIT - voir [LICENSE](LICENSE) pour les details.
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://avatars.githubusercontent.com/u/258253854?v=4" alt="RTK - Rust Token Killer" width="500">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<strong>LLM トークン消費を 60-90% 削減する高性能 CLI プロキシ</strong>
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<a href="https://github.com/rtk-ai/rtk/actions"><img src="https://github.com/rtk-ai/rtk/workflows/Security%20Check/badge.svg" alt="CI"></a>
|
|
11
|
+
<a href="https://github.com/rtk-ai/rtk/releases"><img src="https://img.shields.io/github/v/release/rtk-ai/rtk" alt="Release"></a>
|
|
12
|
+
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
|
|
13
|
+
<a href="https://discord.gg/gFwRPEKq4p"><img src="https://img.shields.io/discord/1478373640461488159?label=Discord&logo=discord" alt="Discord"></a>
|
|
14
|
+
<a href="https://formulae.brew.sh/formula/rtk"><img src="https://img.shields.io/homebrew/v/rtk" alt="Homebrew"></a>
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
<p align="center">
|
|
18
|
+
<a href="https://www.rtk-ai.app">ウェブサイト</a> •
|
|
19
|
+
<a href="#インストール">インストール</a> •
|
|
20
|
+
<a href="docs/TROUBLESHOOTING.md">トラブルシューティング</a> •
|
|
21
|
+
<a href="ARCHITECTURE.md">アーキテクチャ</a> •
|
|
22
|
+
<a href="https://discord.gg/gFwRPEKq4p">Discord</a>
|
|
23
|
+
</p>
|
|
24
|
+
|
|
25
|
+
<p align="center">
|
|
26
|
+
<a href="README.md">English</a> •
|
|
27
|
+
<a href="README_fr.md">Francais</a> •
|
|
28
|
+
<a href="README_zh.md">中文</a> •
|
|
29
|
+
<a href="README_ja.md">日本語</a> •
|
|
30
|
+
<a href="README_ko.md">한국어</a> •
|
|
31
|
+
<a href="README_es.md">Espanol</a>
|
|
32
|
+
</p>
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
rtk はコマンド出力を LLM コンテキストに届く前にフィルタリング・圧縮します。単一の Rust バイナリ、依存関係ゼロ、オーバーヘッド 10ms 未満。
|
|
37
|
+
|
|
38
|
+
## トークン節約(30分の Claude Code セッション)
|
|
39
|
+
|
|
40
|
+
| 操作 | 頻度 | 標準 | rtk | 節約 |
|
|
41
|
+
|------|------|------|-----|------|
|
|
42
|
+
| `ls` / `tree` | 10x | 2,000 | 400 | -80% |
|
|
43
|
+
| `cat` / `read` | 20x | 40,000 | 12,000 | -70% |
|
|
44
|
+
| `grep` / `rg` | 8x | 16,000 | 3,200 | -80% |
|
|
45
|
+
| `git status` | 10x | 3,000 | 600 | -80% |
|
|
46
|
+
| `cargo test` / `npm test` | 5x | 25,000 | 2,500 | -90% |
|
|
47
|
+
| **合計** | | **~118,000** | **~23,900** | **-80%** |
|
|
48
|
+
|
|
49
|
+
## インストール
|
|
50
|
+
|
|
51
|
+
### Homebrew(推奨)
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
brew install rtk
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### クイックインストール(Linux/macOS)
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
curl -fsSL https://raw.githubusercontent.com/rtk-ai/rtk/refs/heads/master/install.sh | sh
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Cargo
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
cargo install --git https://github.com/rtk-ai/rtk
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### 確認
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
rtk --version # "rtk 0.27.x" と表示されるはず
|
|
73
|
+
rtk gain # トークン節約統計が表示されるはず
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## クイックスタート
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
# 1. Claude Code 用フックをインストール(推奨)
|
|
80
|
+
rtk init --global
|
|
81
|
+
|
|
82
|
+
# 2. Claude Code を再起動してテスト
|
|
83
|
+
git status # 自動的に rtk git status に書き換え
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## 仕組み
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
rtk なし: rtk あり:
|
|
90
|
+
|
|
91
|
+
Claude --git status--> shell --> git Claude --git status--> RTK --> git
|
|
92
|
+
^ | ^ | |
|
|
93
|
+
| ~2,000 tokens(生出力) | | ~200 tokens | フィルタ |
|
|
94
|
+
+-----------------------------------+ +------- (圧縮済)----+----------+
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
4つの戦略:
|
|
98
|
+
|
|
99
|
+
1. **スマートフィルタリング** - ノイズを除去(コメント、空白、ボイラープレート)
|
|
100
|
+
2. **グルーピング** - 類似項目を集約(ディレクトリ別ファイル、タイプ別エラー)
|
|
101
|
+
3. **トランケーション** - 関連コンテキストを保持、冗長性をカット
|
|
102
|
+
4. **重複排除** - 繰り返しログ行をカウント付きで統合
|
|
103
|
+
|
|
104
|
+
## コマンド
|
|
105
|
+
|
|
106
|
+
### ファイル
|
|
107
|
+
```bash
|
|
108
|
+
rtk ls . # 最適化されたディレクトリツリー
|
|
109
|
+
rtk read file.rs # スマートファイル読み取り
|
|
110
|
+
rtk find "*.rs" . # コンパクトな検索結果
|
|
111
|
+
rtk grep "pattern" . # ファイル別グループ化検索
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Git
|
|
115
|
+
```bash
|
|
116
|
+
rtk git status # コンパクトなステータス
|
|
117
|
+
rtk git log -n 10 # 1行コミット
|
|
118
|
+
rtk git diff # 圧縮された diff
|
|
119
|
+
rtk git push # -> "ok main"
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### テスト
|
|
123
|
+
```bash
|
|
124
|
+
rtk test cargo test # 失敗のみ表示(-90%)
|
|
125
|
+
rtk vitest run # Vitest コンパクト
|
|
126
|
+
rtk pytest # Python テスト(-90%)
|
|
127
|
+
rtk go test # Go テスト(-90%)
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### ビルド & リント
|
|
131
|
+
```bash
|
|
132
|
+
rtk lint # ESLint ルール別グループ化
|
|
133
|
+
rtk tsc # TypeScript エラーグループ化
|
|
134
|
+
rtk cargo build # Cargo ビルド(-80%)
|
|
135
|
+
rtk ruff check # Python リント(-80%)
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### 分析
|
|
139
|
+
```bash
|
|
140
|
+
rtk gain # 節約統計
|
|
141
|
+
rtk gain --graph # ASCII グラフ(30日間)
|
|
142
|
+
rtk discover # 見逃した節約機会を発見
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## ドキュメント
|
|
146
|
+
|
|
147
|
+
- **[TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md)** - よくある問題の解決
|
|
148
|
+
- **[INSTALL.md](INSTALL.md)** - 詳細インストールガイド
|
|
149
|
+
- **[ARCHITECTURE.md](ARCHITECTURE.md)** - 技術アーキテクチャ
|
|
150
|
+
|
|
151
|
+
## コントリビュート
|
|
152
|
+
|
|
153
|
+
コントリビューション歓迎 で issue または PR を作成してください。
|
|
154
|
+
|
|
155
|
+
[Discord](https://discord.gg/pvHdzAec) コミュニティに参加。
|
|
156
|
+
|
|
157
|
+
## ライセンス
|
|
158
|
+
|
|
159
|
+
MIT ライセンス - 詳細は [LICENSE](LICENSE) を参照。
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://avatars.githubusercontent.com/u/258253854?v=4" alt="RTK - Rust Token Killer" width="500">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<strong>LLM 토큰 소비를 60-90% 줄이는 고성능 CLI 프록시</strong>
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<a href="https://github.com/rtk-ai/rtk/actions"><img src="https://github.com/rtk-ai/rtk/workflows/Security%20Check/badge.svg" alt="CI"></a>
|
|
11
|
+
<a href="https://github.com/rtk-ai/rtk/releases"><img src="https://img.shields.io/github/v/release/rtk-ai/rtk" alt="Release"></a>
|
|
12
|
+
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
|
|
13
|
+
<a href="https://discord.gg/gFwRPEKq4p"><img src="https://img.shields.io/discord/1478373640461488159?label=Discord&logo=discord" alt="Discord"></a>
|
|
14
|
+
<a href="https://formulae.brew.sh/formula/rtk"><img src="https://img.shields.io/homebrew/v/rtk" alt="Homebrew"></a>
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
<p align="center">
|
|
18
|
+
<a href="https://www.rtk-ai.app">웹사이트</a> •
|
|
19
|
+
<a href="#설치">설치</a> •
|
|
20
|
+
<a href="docs/TROUBLESHOOTING.md">문제 해결</a> •
|
|
21
|
+
<a href="ARCHITECTURE.md">아키텍처</a> •
|
|
22
|
+
<a href="https://discord.gg/gFwRPEKq4p">Discord</a>
|
|
23
|
+
</p>
|
|
24
|
+
|
|
25
|
+
<p align="center">
|
|
26
|
+
<a href="README.md">English</a> •
|
|
27
|
+
<a href="README_fr.md">Francais</a> •
|
|
28
|
+
<a href="README_zh.md">中文</a> •
|
|
29
|
+
<a href="README_ja.md">日本語</a> •
|
|
30
|
+
<a href="README_ko.md">한국어</a> •
|
|
31
|
+
<a href="README_es.md">Espanol</a>
|
|
32
|
+
</p>
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
rtk는 명령 출력이 LLM 컨텍스트에 도달하기 전에 필터링하고 압축합니다. 단일 Rust 바이너리, 의존성 없음, 10ms 미만의 오버헤드.
|
|
37
|
+
|
|
38
|
+
## 토큰 절약 (30분 Claude Code 세션)
|
|
39
|
+
|
|
40
|
+
| 작업 | 빈도 | 표준 | rtk | 절약 |
|
|
41
|
+
|------|------|------|-----|------|
|
|
42
|
+
| `ls` / `tree` | 10x | 2,000 | 400 | -80% |
|
|
43
|
+
| `cat` / `read` | 20x | 40,000 | 12,000 | -70% |
|
|
44
|
+
| `grep` / `rg` | 8x | 16,000 | 3,200 | -80% |
|
|
45
|
+
| `git status` | 10x | 3,000 | 600 | -80% |
|
|
46
|
+
| `cargo test` / `npm test` | 5x | 25,000 | 2,500 | -90% |
|
|
47
|
+
| **합계** | | **~118,000** | **~23,900** | **-80%** |
|
|
48
|
+
|
|
49
|
+
## 설치
|
|
50
|
+
|
|
51
|
+
### Homebrew (권장)
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
brew install rtk
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### 빠른 설치 (Linux/macOS)
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
curl -fsSL https://raw.githubusercontent.com/rtk-ai/rtk/refs/heads/master/install.sh | sh
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Cargo
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
cargo install --git https://github.com/rtk-ai/rtk
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### 확인
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
rtk --version # "rtk 0.27.x" 표시되어야 함
|
|
73
|
+
rtk gain # 토큰 절약 통계 표시되어야 함
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## 빠른 시작
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
# 1. Claude Code용 hook 설치 (권장)
|
|
80
|
+
rtk init --global
|
|
81
|
+
|
|
82
|
+
# 2. Claude Code 재시작 후 테스트
|
|
83
|
+
git status # 자동으로 rtk git status로 재작성
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## 작동 원리
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
rtk 없이: rtk 사용:
|
|
90
|
+
|
|
91
|
+
Claude --git status--> shell --> git Claude --git status--> RTK --> git
|
|
92
|
+
^ | ^ | |
|
|
93
|
+
| ~2,000 tokens (원본) | | ~200 tokens | 필터 |
|
|
94
|
+
+-----------------------------------+ +------- (필터링) -----+----------+
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
네 가지 전략:
|
|
98
|
+
|
|
99
|
+
1. **스마트 필터링** - 노이즈 제거 (주석, 공백, 보일러플레이트)
|
|
100
|
+
2. **그룹화** - 유사 항목 집계 (디렉토리별 파일, 유형별 에러)
|
|
101
|
+
3. **잘라내기** - 관련 컨텍스트 유지, 중복 제거
|
|
102
|
+
4. **중복 제거** - 반복 로그 라인을 카운트와 함께 통합
|
|
103
|
+
|
|
104
|
+
## 명령어
|
|
105
|
+
|
|
106
|
+
### 파일
|
|
107
|
+
```bash
|
|
108
|
+
rtk ls . # 최적화된 디렉토리 트리
|
|
109
|
+
rtk read file.rs # 스마트 파일 읽기
|
|
110
|
+
rtk find "*.rs" . # 컴팩트한 검색 결과
|
|
111
|
+
rtk grep "pattern" . # 파일별 그룹화 검색
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Git
|
|
115
|
+
```bash
|
|
116
|
+
rtk git status # 컴팩트 상태
|
|
117
|
+
rtk git log -n 10 # 한 줄 커밋
|
|
118
|
+
rtk git diff # 압축된 diff
|
|
119
|
+
rtk git push # -> "ok main"
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### 테스트
|
|
123
|
+
```bash
|
|
124
|
+
rtk test cargo test # 실패만 표시 (-90%)
|
|
125
|
+
rtk vitest run # Vitest 컴팩트
|
|
126
|
+
rtk pytest # Python 테스트 (-90%)
|
|
127
|
+
rtk go test # Go 테스트 (-90%)
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### 빌드 & 린트
|
|
131
|
+
```bash
|
|
132
|
+
rtk lint # ESLint 규칙별 그룹화
|
|
133
|
+
rtk tsc # TypeScript 에러 그룹화
|
|
134
|
+
rtk cargo build # Cargo 빌드 (-80%)
|
|
135
|
+
rtk ruff check # Python 린트 (-80%)
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### 분석
|
|
139
|
+
```bash
|
|
140
|
+
rtk gain # 절약 통계
|
|
141
|
+
rtk gain --graph # ASCII 그래프 (30일)
|
|
142
|
+
rtk discover # 놓친 절약 기회 발견
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## 문서
|
|
146
|
+
|
|
147
|
+
- **[TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md)** - 일반적인 문제 해결
|
|
148
|
+
- **[INSTALL.md](INSTALL.md)** - 상세 설치 가이드
|
|
149
|
+
- **[ARCHITECTURE.md](ARCHITECTURE.md)** - 기술 아키텍처
|
|
150
|
+
|
|
151
|
+
## 기여
|
|
152
|
+
|
|
153
|
+
기여를 환영합니다! [GitHub](https://github.com/rtk-ai/rtk)에서 issue 또는 PR을 생성해 주세요.
|
|
154
|
+
|
|
155
|
+
[Discord](https://discord.gg/pvHdzAec) 커뮤니티에 참여하세요.
|
|
156
|
+
|
|
157
|
+
## 라이선스
|
|
158
|
+
|
|
159
|
+
MIT 라이선스 - 자세한 내용은 [LICENSE](LICENSE)를 참조하세요.
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://avatars.githubusercontent.com/u/258253854?v=4" alt="RTK - Rust Token Killer" width="500">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<strong>高性能 CLI 代理,将 LLM token 消耗降低 60-90%</strong>
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<a href="https://github.com/rtk-ai/rtk/actions"><img src="https://github.com/rtk-ai/rtk/workflows/Security%20Check/badge.svg" alt="CI"></a>
|
|
11
|
+
<a href="https://github.com/rtk-ai/rtk/releases"><img src="https://img.shields.io/github/v/release/rtk-ai/rtk" alt="Release"></a>
|
|
12
|
+
<a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
|
|
13
|
+
<a href="https://discord.gg/gFwRPEKq4p"><img src="https://img.shields.io/discord/1478373640461488159?label=Discord&logo=discord" alt="Discord"></a>
|
|
14
|
+
<a href="https://formulae.brew.sh/formula/rtk"><img src="https://img.shields.io/homebrew/v/rtk" alt="Homebrew"></a>
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
<p align="center">
|
|
18
|
+
<a href="https://www.rtk-ai.app">官网</a> •
|
|
19
|
+
<a href="#安装">安装</a> •
|
|
20
|
+
<a href="docs/TROUBLESHOOTING.md">故障排除</a> •
|
|
21
|
+
<a href="ARCHITECTURE.md">架构</a> •
|
|
22
|
+
<a href="https://discord.gg/gFwRPEKq4p">Discord</a>
|
|
23
|
+
</p>
|
|
24
|
+
|
|
25
|
+
<p align="center">
|
|
26
|
+
<a href="README.md">English</a> •
|
|
27
|
+
<a href="README_fr.md">Francais</a> •
|
|
28
|
+
<a href="README_zh.md">中文</a> •
|
|
29
|
+
<a href="README_ja.md">日本語</a> •
|
|
30
|
+
<a href="README_ko.md">한국어</a> •
|
|
31
|
+
<a href="README_es.md">Espanol</a>
|
|
32
|
+
</p>
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
rtk 在命令输出到达 LLM 上下文之前进行过滤和压缩。单一 Rust 二进制文件,零依赖,<10ms 开销。
|
|
37
|
+
|
|
38
|
+
## Token 节省(30 分钟 Claude Code 会话)
|
|
39
|
+
|
|
40
|
+
| 操作 | 频率 | 标准 | rtk | 节省 |
|
|
41
|
+
|------|------|------|-----|------|
|
|
42
|
+
| `ls` / `tree` | 10x | 2,000 | 400 | -80% |
|
|
43
|
+
| `cat` / `read` | 20x | 40,000 | 12,000 | -70% |
|
|
44
|
+
| `grep` / `rg` | 8x | 16,000 | 3,200 | -80% |
|
|
45
|
+
| `git status` | 10x | 3,000 | 600 | -80% |
|
|
46
|
+
| `git diff` | 5x | 10,000 | 2,500 | -75% |
|
|
47
|
+
| `cargo test` / `npm test` | 5x | 25,000 | 2,500 | -90% |
|
|
48
|
+
| **总计** | | **~118,000** | **~23,900** | **-80%** |
|
|
49
|
+
|
|
50
|
+
## 安装
|
|
51
|
+
|
|
52
|
+
### Homebrew(推荐)
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
brew install rtk
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### 快速安装(Linux/macOS)
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
curl -fsSL https://raw.githubusercontent.com/rtk-ai/rtk/refs/heads/master/install.sh | sh
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Cargo
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
cargo install --git https://github.com/rtk-ai/rtk
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### 验证
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
rtk --version # 应显示 "rtk 0.27.x"
|
|
74
|
+
rtk gain # 应显示 token 节省统计
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## 快速开始
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
# 1. 为 Claude Code 安装 hook(推荐)
|
|
81
|
+
rtk init --global
|
|
82
|
+
|
|
83
|
+
# 2. 重启 Claude Code,然后测试
|
|
84
|
+
git status # 自动重写为 rtk git status
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## 工作原理
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
没有 rtk: 使用 rtk:
|
|
91
|
+
|
|
92
|
+
Claude --git status--> shell --> git Claude --git status--> RTK --> git
|
|
93
|
+
^ | ^ | |
|
|
94
|
+
| ~2,000 tokens(原始) | | ~200 tokens | 过滤 |
|
|
95
|
+
+-----------------------------------+ +------- (已过滤)-----+----------+
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
四种策略:
|
|
99
|
+
|
|
100
|
+
1. **智能过滤** - 去除噪音(注释、空白、样板代码)
|
|
101
|
+
2. **分组** - 聚合相似项(按目录分文件,按类型分错误)
|
|
102
|
+
3. **截断** - 保留相关上下文,删除冗余
|
|
103
|
+
4. **去重** - 合并重复日志行并计数
|
|
104
|
+
|
|
105
|
+
## 命令
|
|
106
|
+
|
|
107
|
+
### 文件
|
|
108
|
+
```bash
|
|
109
|
+
rtk ls . # 优化的目录树
|
|
110
|
+
rtk read file.rs # 智能文件读取
|
|
111
|
+
rtk find "*.rs" . # 紧凑的查找结果
|
|
112
|
+
rtk grep "pattern" . # 按文件分组的搜索结果
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Git
|
|
116
|
+
```bash
|
|
117
|
+
rtk git status # 紧凑状态
|
|
118
|
+
rtk git log -n 10 # 单行提交
|
|
119
|
+
rtk git diff # 精简 diff
|
|
120
|
+
rtk git push # -> "ok main"
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### 测试
|
|
124
|
+
```bash
|
|
125
|
+
rtk test cargo test # 仅显示失败(-90%)
|
|
126
|
+
rtk vitest run # Vitest 紧凑输出
|
|
127
|
+
rtk pytest # Python 测试(-90%)
|
|
128
|
+
rtk go test # Go 测试(-90%)
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### 构建 & 检查
|
|
132
|
+
```bash
|
|
133
|
+
rtk lint # ESLint 按规则分组
|
|
134
|
+
rtk tsc # TypeScript 错误分组
|
|
135
|
+
rtk cargo build # Cargo 构建(-80%)
|
|
136
|
+
rtk ruff check # Python lint(-80%)
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### 容器
|
|
140
|
+
```bash
|
|
141
|
+
rtk docker ps # 紧凑容器列表
|
|
142
|
+
rtk docker logs <container> # 去重日志
|
|
143
|
+
rtk kubectl pods # 紧凑 Pod 列表
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### 分析
|
|
147
|
+
```bash
|
|
148
|
+
rtk gain # 节省统计
|
|
149
|
+
rtk gain --graph # ASCII 图表(30 天)
|
|
150
|
+
rtk discover # 发现遗漏的节省机会
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## 文档
|
|
154
|
+
|
|
155
|
+
- **[TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md)** - 解决常见问题
|
|
156
|
+
- **[INSTALL.md](INSTALL.md)** - 详细安装指南
|
|
157
|
+
- **[ARCHITECTURE.md](ARCHITECTURE.md)** - 技术架构
|
|
158
|
+
|
|
159
|
+
## 贡献
|
|
160
|
+
|
|
161
|
+
欢迎贡献!请在 [GitHub](https://github.com/rtk-ai/rtk) 上提交 issue 或 PR。
|
|
162
|
+
|
|
163
|
+
加入 [Discord](https://discord.gg/pvHdzAec) 社区。
|
|
164
|
+
|
|
165
|
+
## 许可证
|
|
166
|
+
|
|
167
|
+
MIT 许可证 - 详见 [LICENSE](LICENSE)。
|