@hasna/terminal 2.2.0 → 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 +29 -12
- package/package.json +1 -1
- package/src/ai.ts +50 -36
- package/src/cli.tsx +29 -12
- package/src/context-hints.ts +89 -0
- package/src/discover.ts +238 -0
- package/src/economy.ts +53 -0
- package/src/output-store.ts +65 -0
- package/src/providers/index.ts +4 -4
- 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
|
@@ -0,0 +1,1410 @@
|
|
|
1
|
+
# RTK - Documentation fonctionnelle complete
|
|
2
|
+
|
|
3
|
+
> **rtk (Rust Token Killer)** -- Proxy CLI haute performance qui reduit la consommation de tokens LLM de 60 a 90%.
|
|
4
|
+
|
|
5
|
+
Binaire Rust unique, zero dependances externes, overhead < 10ms par commande.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Table des matieres
|
|
10
|
+
|
|
11
|
+
1. [Vue d'ensemble](#vue-densemble)
|
|
12
|
+
2. [Drapeaux globaux](#drapeaux-globaux)
|
|
13
|
+
3. [Commandes Fichiers](#commandes-fichiers)
|
|
14
|
+
4. [Commandes Git](#commandes-git)
|
|
15
|
+
5. [Commandes GitHub CLI](#commandes-github-cli)
|
|
16
|
+
6. [Commandes Test](#commandes-test)
|
|
17
|
+
7. [Commandes Build et Lint](#commandes-build-et-lint)
|
|
18
|
+
8. [Commandes Formatage](#commandes-formatage)
|
|
19
|
+
9. [Gestionnaires de paquets](#gestionnaires-de-paquets)
|
|
20
|
+
10. [Conteneurs et orchestration](#conteneurs-et-orchestration)
|
|
21
|
+
11. [Donnees et reseau](#donnees-et-reseau)
|
|
22
|
+
12. [Cloud et bases de donnees](#cloud-et-bases-de-donnees)
|
|
23
|
+
13. [Stacked PRs (Graphite)](#stacked-prs-graphite)
|
|
24
|
+
14. [Analytique et suivi](#analytique-et-suivi)
|
|
25
|
+
15. [Systeme de hooks](#systeme-de-hooks)
|
|
26
|
+
16. [Configuration](#configuration)
|
|
27
|
+
17. [Systeme Tee (recuperation de sortie)](#systeme-tee)
|
|
28
|
+
18. [Telemetrie](#telemetrie)
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Vue d'ensemble
|
|
33
|
+
|
|
34
|
+
rtk agit comme un proxy entre un LLM (Claude Code, Gemini CLI, etc.) et les commandes systeme. Quatre strategies de filtrage sont appliquees selon le type de commande :
|
|
35
|
+
|
|
36
|
+
| Strategie | Description | Exemple |
|
|
37
|
+
|-----------|-------------|---------|
|
|
38
|
+
| **Filtrage intelligent** | Supprime le bruit (commentaires, espaces, boilerplate) | `ls -la` -> arbre compact |
|
|
39
|
+
| **Regroupement** | Agregation par repertoire, par type d'erreur, par regle | Tests groupes par fichier |
|
|
40
|
+
| **Troncature** | Conserve le contexte pertinent, supprime la redondance | Diff condense |
|
|
41
|
+
| **Deduplication** | Fusionne les lignes de log repetees avec compteurs | `error x42` |
|
|
42
|
+
|
|
43
|
+
### Mecanisme de fallback
|
|
44
|
+
|
|
45
|
+
Si rtk ne reconnait pas une sous-commande, il execute la commande brute (passthrough) et enregistre l'evenement dans la base de suivi. Cela garantit que rtk est **toujours sur** a utiliser -- aucune commande ne sera bloquee.
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Drapeaux globaux
|
|
50
|
+
|
|
51
|
+
Ces drapeaux s'appliquent a **toutes** les sous-commandes :
|
|
52
|
+
|
|
53
|
+
| Drapeau | Court | Description |
|
|
54
|
+
|---------|-------|-------------|
|
|
55
|
+
| `--verbose` | `-v` | Augmenter la verbosite (-v, -vv, -vvv). Montre les details de filtrage. |
|
|
56
|
+
| `--ultra-compact` | `-u` | Mode ultra-compact : icones ASCII, format inline. Economies supplementaires. |
|
|
57
|
+
| `--skip-env` | -- | Definit `SKIP_ENV_VALIDATION=1` pour les processus enfants (Next.js, tsc, lint, prisma). |
|
|
58
|
+
|
|
59
|
+
**Exemples :**
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
rtk -v git status # Status compact + details de filtrage sur stderr
|
|
63
|
+
rtk -vvv cargo test # Verbosite maximale (debug)
|
|
64
|
+
rtk -u git log # Log ultra-compact, icones ASCII
|
|
65
|
+
rtk --skip-env next build # Desactive la validation d'env de Next.js
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Commandes Fichiers
|
|
71
|
+
|
|
72
|
+
### `rtk ls` -- Listage de repertoire
|
|
73
|
+
|
|
74
|
+
**Objectif :** Remplace `ls` et `tree` avec une sortie optimisee en tokens.
|
|
75
|
+
|
|
76
|
+
**Syntaxe :**
|
|
77
|
+
```bash
|
|
78
|
+
rtk ls [args...]
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Tous les drapeaux natifs de `ls` sont supportes (`-l`, `-a`, `-h`, `-R`, etc.).
|
|
82
|
+
|
|
83
|
+
**Economies :** ~80% de reduction de tokens
|
|
84
|
+
|
|
85
|
+
**Avant / Apres :**
|
|
86
|
+
```
|
|
87
|
+
# ls -la (45 lignes, ~800 tokens) # rtk ls (12 lignes, ~150 tokens)
|
|
88
|
+
drwxr-xr-x 15 user staff 480 ... my-project/
|
|
89
|
+
-rw-r--r-- 1 user staff 1234 ... +-- src/ (8 files)
|
|
90
|
+
-rw-r--r-- 1 user staff 567 ... | +-- main.rs
|
|
91
|
+
...40 lignes de plus... +-- Cargo.toml
|
|
92
|
+
+-- README.md
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
### `rtk tree` -- Arbre de repertoire
|
|
98
|
+
|
|
99
|
+
**Objectif :** Proxy vers `tree` natif avec sortie filtree.
|
|
100
|
+
|
|
101
|
+
**Syntaxe :**
|
|
102
|
+
```bash
|
|
103
|
+
rtk tree [args...]
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Supporte tous les drapeaux natifs de `tree` (`-L`, `-d`, `-a`, etc.).
|
|
107
|
+
|
|
108
|
+
**Economies :** ~80%
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
### `rtk read` -- Lecture de fichier
|
|
113
|
+
|
|
114
|
+
**Objectif :** Remplace `cat`, `head`, `tail` avec un filtrage intelligent du contenu.
|
|
115
|
+
|
|
116
|
+
**Syntaxe :**
|
|
117
|
+
```bash
|
|
118
|
+
rtk read <fichier> [options]
|
|
119
|
+
rtk read - [options] # Lecture depuis stdin
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
**Options :**
|
|
123
|
+
|
|
124
|
+
| Option | Court | Defaut | Description |
|
|
125
|
+
|--------|-------|--------|-------------|
|
|
126
|
+
| `--level` | `-l` | `minimal` | Niveau de filtrage : `none`, `minimal`, `aggressive` |
|
|
127
|
+
| `--max-lines` | `-m` | illimite | Nombre maximum de lignes |
|
|
128
|
+
| `--line-numbers` | `-n` | non | Afficher les numeros de ligne |
|
|
129
|
+
|
|
130
|
+
**Niveaux de filtrage :**
|
|
131
|
+
|
|
132
|
+
| Niveau | Description | Economies |
|
|
133
|
+
|--------|-------------|-----------|
|
|
134
|
+
| `none` | Aucun filtrage, sortie brute | 0% |
|
|
135
|
+
| `minimal` | Supprime commentaires et lignes vides excessives | ~30% |
|
|
136
|
+
| `aggressive` | Signatures uniquement (supprime les corps de fonctions) | ~74% |
|
|
137
|
+
|
|
138
|
+
**Avant / Apres (mode aggressive) :**
|
|
139
|
+
```
|
|
140
|
+
# cat main.rs (~200 lignes) # rtk read main.rs -l aggressive (~50 lignes)
|
|
141
|
+
fn main() -> Result<()> { fn main() -> Result<()> { ... }
|
|
142
|
+
let config = Config::load()?; fn process_data(input: &str) -> Vec<u8> { ... }
|
|
143
|
+
let data = process_data(&input); struct Config { ... }
|
|
144
|
+
for item in data { impl Config { fn load() -> Result<Self> { ... } }
|
|
145
|
+
println!("{}", item);
|
|
146
|
+
}
|
|
147
|
+
Ok(())
|
|
148
|
+
}
|
|
149
|
+
...
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
**Langages supportes pour le filtrage :** Rust, Python, JavaScript, TypeScript, Go, C, C++, Java, Ruby, Shell.
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
### `rtk smart` -- Resume heuristique
|
|
157
|
+
|
|
158
|
+
**Objectif :** Genere un resume technique de 2 lignes pour un fichier source.
|
|
159
|
+
|
|
160
|
+
**Syntaxe :**
|
|
161
|
+
```bash
|
|
162
|
+
rtk smart <fichier> [--model heuristic] [--force-download]
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
**Economies :** ~95%
|
|
166
|
+
|
|
167
|
+
**Exemple :**
|
|
168
|
+
```
|
|
169
|
+
$ rtk smart src/tracking.rs
|
|
170
|
+
SQLite-based token tracking system for command executions.
|
|
171
|
+
Records input/output tokens, savings %, execution times with 90-day retention.
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
### `rtk find` -- Recherche de fichiers
|
|
177
|
+
|
|
178
|
+
**Objectif :** Remplace `find` et `fd` avec une sortie compacte groupee par repertoire.
|
|
179
|
+
|
|
180
|
+
**Syntaxe :**
|
|
181
|
+
```bash
|
|
182
|
+
rtk find [args...]
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
Supporte a la fois la syntaxe RTK et la syntaxe native `find` (`-name`, `-type`, etc.).
|
|
186
|
+
|
|
187
|
+
**Economies :** ~80%
|
|
188
|
+
|
|
189
|
+
**Avant / Apres :**
|
|
190
|
+
```
|
|
191
|
+
# find . -name "*.rs" (30 lignes) # rtk find "*.rs" . (8 lignes)
|
|
192
|
+
./src/main.rs src/ (12 .rs)
|
|
193
|
+
./src/git.rs main.rs, git.rs, config.rs
|
|
194
|
+
./src/config.rs tracking.rs, filter.rs, utils.rs
|
|
195
|
+
./src/tracking.rs ...6 more
|
|
196
|
+
./src/filter.rs tests/ (3 .rs)
|
|
197
|
+
./src/utils.rs test_git.rs, test_ls.rs, test_filter.rs
|
|
198
|
+
...24 lignes de plus...
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
### `rtk grep` -- Recherche dans le contenu
|
|
204
|
+
|
|
205
|
+
**Objectif :** Remplace `grep` et `rg` avec une sortie groupee par fichier, tronquee.
|
|
206
|
+
|
|
207
|
+
**Syntaxe :**
|
|
208
|
+
```bash
|
|
209
|
+
rtk grep <pattern> [chemin] [options]
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
**Options :**
|
|
213
|
+
|
|
214
|
+
| Option | Court | Defaut | Description |
|
|
215
|
+
|--------|-------|--------|-------------|
|
|
216
|
+
| `--max-len` | `-l` | 80 | Longueur maximale de ligne |
|
|
217
|
+
| `--max` | `-m` | 50 | Nombre maximum de resultats |
|
|
218
|
+
| `--context-only` | `-c` | non | Afficher uniquement le contexte du match |
|
|
219
|
+
| `--file-type` | `-t` | tous | Filtrer par type (ts, py, rust, etc.) |
|
|
220
|
+
| `--line-numbers` | `-n` | oui | Numeros de ligne (toujours actif) |
|
|
221
|
+
|
|
222
|
+
Les arguments supplementaires sont transmis a `rg` (ripgrep).
|
|
223
|
+
|
|
224
|
+
**Economies :** ~80%
|
|
225
|
+
|
|
226
|
+
**Avant / Apres :**
|
|
227
|
+
```
|
|
228
|
+
# rg "fn run" (20 lignes) # rtk grep "fn run" (10 lignes)
|
|
229
|
+
src/git.rs:45:pub fn run(...) src/git.rs
|
|
230
|
+
src/git.rs:120:fn run_status(...) 45: pub fn run(...)
|
|
231
|
+
src/ls.rs:12:pub fn run(...) 120: fn run_status(...)
|
|
232
|
+
src/ls.rs:25:fn run_tree(...) src/ls.rs
|
|
233
|
+
... 12: pub fn run(...)
|
|
234
|
+
25: fn run_tree(...)
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
### `rtk diff` -- Diff condense
|
|
240
|
+
|
|
241
|
+
**Objectif :** Diff ultra-condense entre deux fichiers (uniquement les lignes modifiees).
|
|
242
|
+
|
|
243
|
+
**Syntaxe :**
|
|
244
|
+
```bash
|
|
245
|
+
rtk diff <fichier1> <fichier2>
|
|
246
|
+
rtk diff <fichier1> # Stdin comme second fichier
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
**Economies :** ~60%
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
### `rtk wc` -- Comptage compact
|
|
254
|
+
|
|
255
|
+
**Objectif :** Remplace `wc` avec une sortie compacte (supprime les chemins et le padding).
|
|
256
|
+
|
|
257
|
+
**Syntaxe :**
|
|
258
|
+
```bash
|
|
259
|
+
rtk wc [args...]
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
Supporte tous les drapeaux natifs de `wc` (`-l`, `-w`, `-c`, etc.).
|
|
263
|
+
|
|
264
|
+
---
|
|
265
|
+
|
|
266
|
+
## Commandes Git
|
|
267
|
+
|
|
268
|
+
### Vue d'ensemble
|
|
269
|
+
|
|
270
|
+
Toutes les sous-commandes git sont supportees. Les commandes non reconnues sont transmises directement a git (passthrough).
|
|
271
|
+
|
|
272
|
+
**Options globales git :**
|
|
273
|
+
|
|
274
|
+
| Option | Description |
|
|
275
|
+
|--------|-------------|
|
|
276
|
+
| `-C <path>` | Changer de repertoire avant execution |
|
|
277
|
+
| `-c <key=value>` | Surcharger une config git |
|
|
278
|
+
| `--git-dir <path>` | Chemin vers le repertoire .git |
|
|
279
|
+
| `--work-tree <path>` | Chemin vers le working tree |
|
|
280
|
+
| `--no-pager` | Desactiver le pager |
|
|
281
|
+
| `--no-optional-locks` | Ignorer les locks optionnels |
|
|
282
|
+
| `--bare` | Traiter comme repo bare |
|
|
283
|
+
| `--literal-pathspecs` | Pathspecs literals |
|
|
284
|
+
|
|
285
|
+
---
|
|
286
|
+
|
|
287
|
+
### `rtk git status` -- Status compact
|
|
288
|
+
|
|
289
|
+
**Economies :** ~80%
|
|
290
|
+
|
|
291
|
+
```bash
|
|
292
|
+
rtk git status [args...] # Supporte tous les drapeaux git status
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
**Avant / Apres :**
|
|
296
|
+
```
|
|
297
|
+
# git status (~20 lignes, ~400 tokens) # rtk git status (~5 lignes, ~80 tokens)
|
|
298
|
+
On branch main main | 3M 1? 1A
|
|
299
|
+
Your branch is up to date with M src/main.rs
|
|
300
|
+
'origin/main'. M src/git.rs
|
|
301
|
+
M tests/test_git.rs
|
|
302
|
+
Changes not staged for commit: ? new_file.txt
|
|
303
|
+
(use "git add <file>..." to update) A staged_file.rs
|
|
304
|
+
modified: src/main.rs
|
|
305
|
+
modified: src/git.rs
|
|
306
|
+
...
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
### `rtk git log` -- Historique compact
|
|
312
|
+
|
|
313
|
+
**Economies :** ~80%
|
|
314
|
+
|
|
315
|
+
```bash
|
|
316
|
+
rtk git log [args...] # Supporte --oneline, --graph, --all, -n, etc.
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
**Avant / Apres :**
|
|
320
|
+
```
|
|
321
|
+
# git log (50+ lignes) # rtk git log -n 5 (5 lignes)
|
|
322
|
+
commit abc123def... (HEAD -> main) abc123 Fix token counting bug
|
|
323
|
+
Author: User <user@email.com> def456 Add vitest support
|
|
324
|
+
Date: Mon Jan 15 10:30:00 2024 789abc Refactor filter engine
|
|
325
|
+
012def Update README
|
|
326
|
+
Fix token counting bug 345ghi Initial commit
|
|
327
|
+
...
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
---
|
|
331
|
+
|
|
332
|
+
### `rtk git diff` -- Diff compact
|
|
333
|
+
|
|
334
|
+
**Economies :** ~75%
|
|
335
|
+
|
|
336
|
+
```bash
|
|
337
|
+
rtk git diff [args...] # Supporte --stat, --cached, --staged, etc.
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
**Avant / Apres :**
|
|
341
|
+
```
|
|
342
|
+
# git diff (~100 lignes) # rtk git diff (~25 lignes)
|
|
343
|
+
diff --git a/src/main.rs b/src/main.rs src/main.rs (+5/-2)
|
|
344
|
+
index abc123..def456 100644 + let config = Config::load()?;
|
|
345
|
+
--- a/src/main.rs + config.validate()?;
|
|
346
|
+
+++ b/src/main.rs - // old code
|
|
347
|
+
@@ -10,6 +10,8 @@ - let x = 42;
|
|
348
|
+
fn main() { src/git.rs (+1/-1)
|
|
349
|
+
+ let config = Config::load()?; ~ format!("ok {}", branch)
|
|
350
|
+
...30 lignes de headers et contexte...
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
---
|
|
354
|
+
|
|
355
|
+
### `rtk git show` -- Show compact
|
|
356
|
+
|
|
357
|
+
**Economies :** ~80%
|
|
358
|
+
|
|
359
|
+
```bash
|
|
360
|
+
rtk git show [args...]
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
Affiche le resume du commit + stat + diff compact.
|
|
364
|
+
|
|
365
|
+
---
|
|
366
|
+
|
|
367
|
+
### `rtk git add` -- Add ultra-compact
|
|
368
|
+
|
|
369
|
+
**Economies :** ~92%
|
|
370
|
+
|
|
371
|
+
```bash
|
|
372
|
+
rtk git add [args...] # Supporte -A, -p, --all, etc.
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
**Sortie :** `ok` (un seul mot)
|
|
376
|
+
|
|
377
|
+
---
|
|
378
|
+
|
|
379
|
+
### `rtk git commit` -- Commit ultra-compact
|
|
380
|
+
|
|
381
|
+
**Economies :** ~92%
|
|
382
|
+
|
|
383
|
+
```bash
|
|
384
|
+
rtk git commit -m "message" [args...] # Supporte -a, --amend, --allow-empty, etc.
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
**Sortie :** `ok abc1234` (confirmation + hash court)
|
|
388
|
+
|
|
389
|
+
---
|
|
390
|
+
|
|
391
|
+
### `rtk git push` -- Push ultra-compact
|
|
392
|
+
|
|
393
|
+
**Economies :** ~92%
|
|
394
|
+
|
|
395
|
+
```bash
|
|
396
|
+
rtk git push [args...] # Supporte -u, remote, branch, etc.
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
**Avant / Apres :**
|
|
400
|
+
```
|
|
401
|
+
# git push (15 lignes, ~200 tokens) # rtk git push (1 ligne, ~10 tokens)
|
|
402
|
+
Enumerating objects: 5, done. ok main
|
|
403
|
+
Counting objects: 100% (5/5), done.
|
|
404
|
+
Delta compression using up to 8 threads
|
|
405
|
+
...
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
---
|
|
409
|
+
|
|
410
|
+
### `rtk git pull` -- Pull ultra-compact
|
|
411
|
+
|
|
412
|
+
**Economies :** ~92%
|
|
413
|
+
|
|
414
|
+
```bash
|
|
415
|
+
rtk git pull [args...]
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
**Sortie :** `ok 3 files +10 -2`
|
|
419
|
+
|
|
420
|
+
---
|
|
421
|
+
|
|
422
|
+
### `rtk git branch` -- Branches compact
|
|
423
|
+
|
|
424
|
+
```bash
|
|
425
|
+
rtk git branch [args...] # Supporte -d, -D, -m, etc.
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
Affiche branche courante, branches locales, branches distantes de facon compacte.
|
|
429
|
+
|
|
430
|
+
---
|
|
431
|
+
|
|
432
|
+
### `rtk git fetch` -- Fetch compact
|
|
433
|
+
|
|
434
|
+
```bash
|
|
435
|
+
rtk git fetch [args...]
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
**Sortie :** `ok fetched (N new refs)`
|
|
439
|
+
|
|
440
|
+
---
|
|
441
|
+
|
|
442
|
+
### `rtk git stash` -- Stash compact
|
|
443
|
+
|
|
444
|
+
```bash
|
|
445
|
+
rtk git stash [list|show|pop|apply|drop|push] [args...]
|
|
446
|
+
```
|
|
447
|
+
|
|
448
|
+
---
|
|
449
|
+
|
|
450
|
+
### `rtk git worktree` -- Worktree compact
|
|
451
|
+
|
|
452
|
+
```bash
|
|
453
|
+
rtk git worktree [add|remove|prune|list] [args...]
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
---
|
|
457
|
+
|
|
458
|
+
### Passthrough git
|
|
459
|
+
|
|
460
|
+
Toute sous-commande git non listee ci-dessus est executee directement :
|
|
461
|
+
|
|
462
|
+
```bash
|
|
463
|
+
rtk git rebase main # Execute git rebase main
|
|
464
|
+
rtk git cherry-pick abc # Execute git cherry-pick abc
|
|
465
|
+
rtk git tag v1.0.0 # Execute git tag v1.0.0
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
---
|
|
469
|
+
|
|
470
|
+
## Commandes GitHub CLI
|
|
471
|
+
|
|
472
|
+
### `rtk gh` -- GitHub CLI compact
|
|
473
|
+
|
|
474
|
+
**Objectif :** Remplace `gh` avec une sortie optimisee.
|
|
475
|
+
|
|
476
|
+
**Syntaxe :**
|
|
477
|
+
```bash
|
|
478
|
+
rtk gh <sous-commande> [args...]
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
**Sous-commandes supportees :**
|
|
482
|
+
|
|
483
|
+
| Commande | Description | Economies |
|
|
484
|
+
|----------|-------------|-----------|
|
|
485
|
+
| `rtk gh pr list` | Liste des PRs compacte | ~80% |
|
|
486
|
+
| `rtk gh pr view <num>` | Details d'une PR + checks | ~87% |
|
|
487
|
+
| `rtk gh pr checks` | Status des checks CI | ~79% |
|
|
488
|
+
| `rtk gh issue list` | Liste des issues compacte | ~80% |
|
|
489
|
+
| `rtk gh run list` | Status des workflow runs | ~82% |
|
|
490
|
+
| `rtk gh api <endpoint>` | Reponse API compacte | ~26% |
|
|
491
|
+
|
|
492
|
+
**Avant / Apres :**
|
|
493
|
+
```
|
|
494
|
+
# gh pr list (~30 lignes) # rtk gh pr list (~10 lignes)
|
|
495
|
+
Showing 10 of 15 pull requests in org/repo #42 feat: add vitest (open, 2d)
|
|
496
|
+
#41 fix: git diff crash (open, 3d)
|
|
497
|
+
#42 feat: add vitest support #40 chore: update deps (merged, 5d)
|
|
498
|
+
user opened about 2 days ago #39 docs: add guide (merged, 1w)
|
|
499
|
+
... labels: enhancement
|
|
500
|
+
...
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
---
|
|
504
|
+
|
|
505
|
+
## Commandes Test
|
|
506
|
+
|
|
507
|
+
### `rtk test` -- Wrapper de tests generique
|
|
508
|
+
|
|
509
|
+
**Objectif :** Execute n'importe quelle commande de test et affiche uniquement les echecs.
|
|
510
|
+
|
|
511
|
+
**Syntaxe :**
|
|
512
|
+
```bash
|
|
513
|
+
rtk test <commande...>
|
|
514
|
+
```
|
|
515
|
+
|
|
516
|
+
**Economies :** ~90%
|
|
517
|
+
|
|
518
|
+
**Exemple :**
|
|
519
|
+
```bash
|
|
520
|
+
rtk test cargo test
|
|
521
|
+
rtk test npm test
|
|
522
|
+
rtk test bun test
|
|
523
|
+
rtk test pytest
|
|
524
|
+
```
|
|
525
|
+
|
|
526
|
+
**Avant / Apres :**
|
|
527
|
+
```
|
|
528
|
+
# cargo test (200+ lignes en cas d'echec) # rtk test cargo test (~20 lignes)
|
|
529
|
+
running 15 tests FAILED: 2/15 tests
|
|
530
|
+
test utils::test_parse ... ok test_edge_case: assertion failed
|
|
531
|
+
test utils::test_format ... ok test_overflow: panic at utils.rs:18
|
|
532
|
+
test utils::test_edge_case ... FAILED
|
|
533
|
+
...150 lignes de backtrace...
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
---
|
|
537
|
+
|
|
538
|
+
### `rtk err` -- Erreurs/avertissements uniquement
|
|
539
|
+
|
|
540
|
+
**Objectif :** Execute une commande et ne montre que les erreurs et avertissements.
|
|
541
|
+
|
|
542
|
+
**Syntaxe :**
|
|
543
|
+
```bash
|
|
544
|
+
rtk err <commande...>
|
|
545
|
+
```
|
|
546
|
+
|
|
547
|
+
**Economies :** ~80%
|
|
548
|
+
|
|
549
|
+
**Exemple :**
|
|
550
|
+
```bash
|
|
551
|
+
rtk err npm run build
|
|
552
|
+
rtk err cargo build
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
---
|
|
556
|
+
|
|
557
|
+
### `rtk cargo test` -- Tests Rust
|
|
558
|
+
|
|
559
|
+
**Economies :** ~90%
|
|
560
|
+
|
|
561
|
+
```bash
|
|
562
|
+
rtk cargo test [args...]
|
|
563
|
+
```
|
|
564
|
+
|
|
565
|
+
N'affiche que les echecs. Supporte tous les arguments de `cargo test`.
|
|
566
|
+
|
|
567
|
+
---
|
|
568
|
+
|
|
569
|
+
### `rtk cargo nextest` -- Tests Rust (nextest)
|
|
570
|
+
|
|
571
|
+
```bash
|
|
572
|
+
rtk cargo nextest [run|list|--lib] [args...]
|
|
573
|
+
```
|
|
574
|
+
|
|
575
|
+
Filtre la sortie de `cargo nextest` pour n'afficher que les echecs.
|
|
576
|
+
|
|
577
|
+
---
|
|
578
|
+
|
|
579
|
+
### `rtk vitest run` -- Tests Vitest
|
|
580
|
+
|
|
581
|
+
**Economies :** ~99.5%
|
|
582
|
+
|
|
583
|
+
```bash
|
|
584
|
+
rtk vitest run [args...]
|
|
585
|
+
```
|
|
586
|
+
|
|
587
|
+
---
|
|
588
|
+
|
|
589
|
+
### `rtk playwright test` -- Tests E2E Playwright
|
|
590
|
+
|
|
591
|
+
**Economies :** ~94%
|
|
592
|
+
|
|
593
|
+
```bash
|
|
594
|
+
rtk playwright [args...]
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
---
|
|
598
|
+
|
|
599
|
+
### `rtk pytest` -- Tests Python
|
|
600
|
+
|
|
601
|
+
**Economies :** ~90%
|
|
602
|
+
|
|
603
|
+
```bash
|
|
604
|
+
rtk pytest [args...]
|
|
605
|
+
```
|
|
606
|
+
|
|
607
|
+
---
|
|
608
|
+
|
|
609
|
+
### `rtk go test` -- Tests Go
|
|
610
|
+
|
|
611
|
+
**Economies :** ~90%
|
|
612
|
+
|
|
613
|
+
```bash
|
|
614
|
+
rtk go test [args...]
|
|
615
|
+
```
|
|
616
|
+
|
|
617
|
+
Utilise le streaming JSON NDJSON de Go pour un filtrage precis.
|
|
618
|
+
|
|
619
|
+
---
|
|
620
|
+
|
|
621
|
+
## Commandes Build et Lint
|
|
622
|
+
|
|
623
|
+
### `rtk cargo build` -- Build Rust
|
|
624
|
+
|
|
625
|
+
**Economies :** ~80%
|
|
626
|
+
|
|
627
|
+
```bash
|
|
628
|
+
rtk cargo build [args...]
|
|
629
|
+
```
|
|
630
|
+
|
|
631
|
+
Supprime les lignes "Compiling...", ne conserve que les erreurs et le resultat final.
|
|
632
|
+
|
|
633
|
+
---
|
|
634
|
+
|
|
635
|
+
### `rtk cargo check` -- Check Rust
|
|
636
|
+
|
|
637
|
+
**Economies :** ~80%
|
|
638
|
+
|
|
639
|
+
```bash
|
|
640
|
+
rtk cargo check [args...]
|
|
641
|
+
```
|
|
642
|
+
|
|
643
|
+
Supprime les lignes "Checking...", ne conserve que les erreurs.
|
|
644
|
+
|
|
645
|
+
---
|
|
646
|
+
|
|
647
|
+
### `rtk cargo clippy` -- Clippy Rust
|
|
648
|
+
|
|
649
|
+
**Economies :** ~80%
|
|
650
|
+
|
|
651
|
+
```bash
|
|
652
|
+
rtk cargo clippy [args...]
|
|
653
|
+
```
|
|
654
|
+
|
|
655
|
+
Regroupe les avertissements par regle de lint.
|
|
656
|
+
|
|
657
|
+
---
|
|
658
|
+
|
|
659
|
+
### `rtk cargo install` -- Install Rust
|
|
660
|
+
|
|
661
|
+
```bash
|
|
662
|
+
rtk cargo install [args...]
|
|
663
|
+
```
|
|
664
|
+
|
|
665
|
+
Supprime la compilation des dependances, ne conserve que le resultat d'installation et les erreurs.
|
|
666
|
+
|
|
667
|
+
---
|
|
668
|
+
|
|
669
|
+
### `rtk tsc` -- TypeScript Compiler
|
|
670
|
+
|
|
671
|
+
**Economies :** ~83%
|
|
672
|
+
|
|
673
|
+
```bash
|
|
674
|
+
rtk tsc [args...]
|
|
675
|
+
```
|
|
676
|
+
|
|
677
|
+
Regroupe les erreurs TypeScript par fichier et par code d'erreur.
|
|
678
|
+
|
|
679
|
+
**Avant / Apres :**
|
|
680
|
+
```
|
|
681
|
+
# tsc --noEmit (50 lignes) # rtk tsc (15 lignes)
|
|
682
|
+
src/api.ts(12,5): error TS2345: ... src/api.ts (3 errors)
|
|
683
|
+
src/api.ts(15,10): error TS2345: ... TS2345: Argument type mismatch (x2)
|
|
684
|
+
src/api.ts(20,3): error TS7006: ... TS7006: Parameter implicitly has 'any'
|
|
685
|
+
src/utils.ts(5,1): error TS2304: ... src/utils.ts (1 error)
|
|
686
|
+
... TS2304: Cannot find name 'foo'
|
|
687
|
+
```
|
|
688
|
+
|
|
689
|
+
---
|
|
690
|
+
|
|
691
|
+
### `rtk lint` -- ESLint / Biome
|
|
692
|
+
|
|
693
|
+
**Economies :** ~84%
|
|
694
|
+
|
|
695
|
+
```bash
|
|
696
|
+
rtk lint [args...]
|
|
697
|
+
rtk lint biome [args...]
|
|
698
|
+
```
|
|
699
|
+
|
|
700
|
+
Regroupe les violations par regle et par fichier. Auto-detecte le linter.
|
|
701
|
+
|
|
702
|
+
---
|
|
703
|
+
|
|
704
|
+
### `rtk prettier` -- Verification du formatage
|
|
705
|
+
|
|
706
|
+
**Economies :** ~70%
|
|
707
|
+
|
|
708
|
+
```bash
|
|
709
|
+
rtk prettier [args...] # ex: rtk prettier --check .
|
|
710
|
+
```
|
|
711
|
+
|
|
712
|
+
Affiche uniquement les fichiers necessitant un formatage.
|
|
713
|
+
|
|
714
|
+
---
|
|
715
|
+
|
|
716
|
+
### `rtk format` -- Formateur universel
|
|
717
|
+
|
|
718
|
+
```bash
|
|
719
|
+
rtk format [args...]
|
|
720
|
+
```
|
|
721
|
+
|
|
722
|
+
Auto-detecte le formateur du projet (prettier, black, ruff format) et applique un filtre compact.
|
|
723
|
+
|
|
724
|
+
---
|
|
725
|
+
|
|
726
|
+
### `rtk next build` -- Build Next.js
|
|
727
|
+
|
|
728
|
+
**Economies :** ~87%
|
|
729
|
+
|
|
730
|
+
```bash
|
|
731
|
+
rtk next [args...]
|
|
732
|
+
```
|
|
733
|
+
|
|
734
|
+
Sortie compacte avec metriques de routes.
|
|
735
|
+
|
|
736
|
+
---
|
|
737
|
+
|
|
738
|
+
### `rtk ruff` -- Linter/formateur Python
|
|
739
|
+
|
|
740
|
+
**Economies :** ~80%
|
|
741
|
+
|
|
742
|
+
```bash
|
|
743
|
+
rtk ruff check [args...]
|
|
744
|
+
rtk ruff format --check [args...]
|
|
745
|
+
```
|
|
746
|
+
|
|
747
|
+
Sortie JSON compressee.
|
|
748
|
+
|
|
749
|
+
---
|
|
750
|
+
|
|
751
|
+
### `rtk mypy` -- Type checker Python
|
|
752
|
+
|
|
753
|
+
```bash
|
|
754
|
+
rtk mypy [args...]
|
|
755
|
+
```
|
|
756
|
+
|
|
757
|
+
Regroupe les erreurs de type par fichier.
|
|
758
|
+
|
|
759
|
+
---
|
|
760
|
+
|
|
761
|
+
### `rtk golangci-lint` -- Linter Go
|
|
762
|
+
|
|
763
|
+
**Economies :** ~85%
|
|
764
|
+
|
|
765
|
+
```bash
|
|
766
|
+
rtk golangci-lint run [args...]
|
|
767
|
+
```
|
|
768
|
+
|
|
769
|
+
Sortie JSON compressee.
|
|
770
|
+
|
|
771
|
+
---
|
|
772
|
+
|
|
773
|
+
## Commandes Formatage
|
|
774
|
+
|
|
775
|
+
### `rtk prettier` -- Prettier
|
|
776
|
+
|
|
777
|
+
```bash
|
|
778
|
+
rtk prettier --check .
|
|
779
|
+
rtk prettier --write src/
|
|
780
|
+
```
|
|
781
|
+
|
|
782
|
+
---
|
|
783
|
+
|
|
784
|
+
### `rtk format` -- Detecteur universel
|
|
785
|
+
|
|
786
|
+
```bash
|
|
787
|
+
rtk format [args...]
|
|
788
|
+
```
|
|
789
|
+
|
|
790
|
+
Detecte automatiquement : prettier, black, ruff format, rustfmt. Applique un filtre compact unifie.
|
|
791
|
+
|
|
792
|
+
---
|
|
793
|
+
|
|
794
|
+
## Gestionnaires de paquets
|
|
795
|
+
|
|
796
|
+
### `rtk pnpm` -- pnpm
|
|
797
|
+
|
|
798
|
+
| Commande | Description | Economies |
|
|
799
|
+
|----------|-------------|-----------|
|
|
800
|
+
| `rtk pnpm list [-d N]` | Arbre de dependances compact | ~70% |
|
|
801
|
+
| `rtk pnpm outdated` | Paquets obsoletes : `pkg: old -> new` | ~80% |
|
|
802
|
+
| `rtk pnpm install [pkgs...]` | Filtre les barres de progression | ~60% |
|
|
803
|
+
| `rtk pnpm build` | Delegue au filtre Next.js | ~87% |
|
|
804
|
+
| `rtk pnpm typecheck` | Delegue au filtre tsc | ~83% |
|
|
805
|
+
|
|
806
|
+
Les sous-commandes non reconnues sont transmises directement a pnpm (passthrough).
|
|
807
|
+
|
|
808
|
+
---
|
|
809
|
+
|
|
810
|
+
### `rtk npm` -- npm
|
|
811
|
+
|
|
812
|
+
```bash
|
|
813
|
+
rtk npm [args...] # ex: rtk npm run build
|
|
814
|
+
```
|
|
815
|
+
|
|
816
|
+
Filtre le boilerplate npm (barres de progression, en-tetes, etc.).
|
|
817
|
+
|
|
818
|
+
---
|
|
819
|
+
|
|
820
|
+
### `rtk npx` -- npx avec routage intelligent
|
|
821
|
+
|
|
822
|
+
```bash
|
|
823
|
+
rtk npx [args...]
|
|
824
|
+
```
|
|
825
|
+
|
|
826
|
+
Route intelligemment vers les filtres specialises :
|
|
827
|
+
- `rtk npx tsc` -> filtre tsc
|
|
828
|
+
- `rtk npx eslint` -> filtre lint
|
|
829
|
+
- `rtk npx prisma` -> filtre prisma
|
|
830
|
+
- Autres -> passthrough filtre
|
|
831
|
+
|
|
832
|
+
---
|
|
833
|
+
|
|
834
|
+
### `rtk pip` -- pip / uv
|
|
835
|
+
|
|
836
|
+
```bash
|
|
837
|
+
rtk pip list # Liste des paquets (auto-detecte uv)
|
|
838
|
+
rtk pip outdated # Paquets obsoletes
|
|
839
|
+
rtk pip install <pkg> # Installation
|
|
840
|
+
```
|
|
841
|
+
|
|
842
|
+
Auto-detecte `uv` si disponible et l'utilise a la place de `pip`.
|
|
843
|
+
|
|
844
|
+
---
|
|
845
|
+
|
|
846
|
+
### `rtk deps` -- Resume des dependances
|
|
847
|
+
|
|
848
|
+
**Objectif :** Resume compact des dependances du projet.
|
|
849
|
+
|
|
850
|
+
```bash
|
|
851
|
+
rtk deps [chemin] # Defaut: repertoire courant
|
|
852
|
+
```
|
|
853
|
+
|
|
854
|
+
Auto-detecte : `Cargo.toml`, `package.json`, `pyproject.toml`, `go.mod`, `Gemfile`, etc.
|
|
855
|
+
|
|
856
|
+
**Economies :** ~70%
|
|
857
|
+
|
|
858
|
+
---
|
|
859
|
+
|
|
860
|
+
### `rtk prisma` -- ORM Prisma
|
|
861
|
+
|
|
862
|
+
| Commande | Description |
|
|
863
|
+
|----------|-------------|
|
|
864
|
+
| `rtk prisma generate` | Generation du client (supprime l'ASCII art) |
|
|
865
|
+
| `rtk prisma migrate dev [--name N]` | Creer et appliquer une migration |
|
|
866
|
+
| `rtk prisma migrate status` | Status des migrations |
|
|
867
|
+
| `rtk prisma migrate deploy` | Deployer en production |
|
|
868
|
+
| `rtk prisma db-push` | Push du schema |
|
|
869
|
+
|
|
870
|
+
---
|
|
871
|
+
|
|
872
|
+
## Conteneurs et orchestration
|
|
873
|
+
|
|
874
|
+
### `rtk docker` -- Docker
|
|
875
|
+
|
|
876
|
+
| Commande | Description | Economies |
|
|
877
|
+
|----------|-------------|-----------|
|
|
878
|
+
| `rtk docker ps` | Liste compacte des conteneurs | ~80% |
|
|
879
|
+
| `rtk docker images` | Liste compacte des images | ~80% |
|
|
880
|
+
| `rtk docker logs <conteneur>` | Logs dedupliques | ~70% |
|
|
881
|
+
| `rtk docker compose ps` | Services Compose compacts | ~80% |
|
|
882
|
+
| `rtk docker compose logs [service]` | Logs Compose dedupliques | ~70% |
|
|
883
|
+
| `rtk docker compose build [service]` | Resume du build | ~60% |
|
|
884
|
+
|
|
885
|
+
Les sous-commandes non reconnues sont transmises directement (passthrough).
|
|
886
|
+
|
|
887
|
+
**Avant / Apres :**
|
|
888
|
+
```
|
|
889
|
+
# docker ps (lignes longues, ~30 tokens/ligne) # rtk docker ps (~10 tokens/ligne)
|
|
890
|
+
CONTAINER ID IMAGE COMMAND ... web nginx:1.25 Up 2d (healthy)
|
|
891
|
+
abc123def456 nginx:1.25 "/dock..." ... db postgres:16 Up 2d (healthy)
|
|
892
|
+
789012345678 postgres:16 "docker..." redis redis:7 Up 1d
|
|
893
|
+
```
|
|
894
|
+
|
|
895
|
+
---
|
|
896
|
+
|
|
897
|
+
### `rtk kubectl` -- Kubernetes
|
|
898
|
+
|
|
899
|
+
| Commande | Description | Options |
|
|
900
|
+
|----------|-------------|---------|
|
|
901
|
+
| `rtk kubectl pods [-n ns] [-A]` | Liste compacte des pods | Namespace ou tous |
|
|
902
|
+
| `rtk kubectl services [-n ns] [-A]` | Liste compacte des services | Namespace ou tous |
|
|
903
|
+
| `rtk kubectl logs <pod> [-c container]` | Logs dedupliques | Container specifique |
|
|
904
|
+
|
|
905
|
+
Les sous-commandes non reconnues sont transmises directement (passthrough).
|
|
906
|
+
|
|
907
|
+
---
|
|
908
|
+
|
|
909
|
+
## Donnees et reseau
|
|
910
|
+
|
|
911
|
+
### `rtk json` -- Structure JSON
|
|
912
|
+
|
|
913
|
+
**Objectif :** Affiche la structure d'un fichier JSON sans les valeurs.
|
|
914
|
+
|
|
915
|
+
```bash
|
|
916
|
+
rtk json <fichier> [--depth N] # Defaut: profondeur 5
|
|
917
|
+
rtk json - # Depuis stdin
|
|
918
|
+
```
|
|
919
|
+
|
|
920
|
+
**Economies :** ~60%
|
|
921
|
+
|
|
922
|
+
**Avant / Apres :**
|
|
923
|
+
```
|
|
924
|
+
# cat package.json (50 lignes) # rtk json package.json (10 lignes)
|
|
925
|
+
{ {
|
|
926
|
+
"name": "my-app", name: string
|
|
927
|
+
"version": "1.0.0", version: string
|
|
928
|
+
"dependencies": { dependencies: { 15 keys }
|
|
929
|
+
"react": "^18.2.0", devDependencies: { 8 keys }
|
|
930
|
+
"next": "^14.0.0", scripts: { 6 keys }
|
|
931
|
+
...15 dependances... }
|
|
932
|
+
},
|
|
933
|
+
...
|
|
934
|
+
}
|
|
935
|
+
```
|
|
936
|
+
|
|
937
|
+
---
|
|
938
|
+
|
|
939
|
+
### `rtk env` -- Variables d'environnement
|
|
940
|
+
|
|
941
|
+
```bash
|
|
942
|
+
rtk env # Toutes les variables (sensibles masquees)
|
|
943
|
+
rtk env -f AWS # Filtrer par nom
|
|
944
|
+
rtk env --show-all # Inclure les valeurs sensibles
|
|
945
|
+
```
|
|
946
|
+
|
|
947
|
+
Les variables sensibles (tokens, secrets, mots de passe) sont masquees par defaut : `AWS_SECRET_ACCESS_KEY=***`.
|
|
948
|
+
|
|
949
|
+
---
|
|
950
|
+
|
|
951
|
+
### `rtk log` -- Logs dedupliques
|
|
952
|
+
|
|
953
|
+
**Objectif :** Filtre et deduplique la sortie de logs.
|
|
954
|
+
|
|
955
|
+
```bash
|
|
956
|
+
rtk log <fichier> # Depuis un fichier
|
|
957
|
+
rtk log # Depuis stdin (pipe)
|
|
958
|
+
```
|
|
959
|
+
|
|
960
|
+
Les lignes repetees sont fusionnees : `[ERROR] Connection refused (x42)`.
|
|
961
|
+
|
|
962
|
+
**Economies :** ~60-80% (selon la repetitivite)
|
|
963
|
+
|
|
964
|
+
---
|
|
965
|
+
|
|
966
|
+
### `rtk curl` -- HTTP avec detection JSON
|
|
967
|
+
|
|
968
|
+
```bash
|
|
969
|
+
rtk curl [args...]
|
|
970
|
+
```
|
|
971
|
+
|
|
972
|
+
Auto-detecte les reponses JSON et affiche le schema au lieu du contenu complet.
|
|
973
|
+
|
|
974
|
+
---
|
|
975
|
+
|
|
976
|
+
### `rtk wget` -- Telechargement compact
|
|
977
|
+
|
|
978
|
+
```bash
|
|
979
|
+
rtk wget <url> [args...]
|
|
980
|
+
rtk wget -O - <url> # Sortie vers stdout
|
|
981
|
+
```
|
|
982
|
+
|
|
983
|
+
Supprime les barres de progression et le bruit.
|
|
984
|
+
|
|
985
|
+
---
|
|
986
|
+
|
|
987
|
+
### `rtk summary` -- Resume heuristique
|
|
988
|
+
|
|
989
|
+
**Objectif :** Execute une commande et genere un resume heuristique de la sortie.
|
|
990
|
+
|
|
991
|
+
```bash
|
|
992
|
+
rtk summary <commande...>
|
|
993
|
+
```
|
|
994
|
+
|
|
995
|
+
Utile pour les commandes longues dont la sortie n'a pas de filtre dedie.
|
|
996
|
+
|
|
997
|
+
---
|
|
998
|
+
|
|
999
|
+
### `rtk proxy` -- Passthrough avec suivi
|
|
1000
|
+
|
|
1001
|
+
**Objectif :** Execute une commande **sans filtrage** mais enregistre l'utilisation pour le suivi.
|
|
1002
|
+
|
|
1003
|
+
```bash
|
|
1004
|
+
rtk proxy <commande...>
|
|
1005
|
+
```
|
|
1006
|
+
|
|
1007
|
+
Utile pour le debug : comparer la sortie brute avec la sortie filtree.
|
|
1008
|
+
|
|
1009
|
+
---
|
|
1010
|
+
|
|
1011
|
+
## Cloud et bases de donnees
|
|
1012
|
+
|
|
1013
|
+
### `rtk aws` -- AWS CLI
|
|
1014
|
+
|
|
1015
|
+
```bash
|
|
1016
|
+
rtk aws <service> [args...]
|
|
1017
|
+
```
|
|
1018
|
+
|
|
1019
|
+
Force la sortie JSON et compresse le resultat. Supporte tous les services AWS (sts, s3, ec2, ecs, rds, cloudformation, etc.).
|
|
1020
|
+
|
|
1021
|
+
---
|
|
1022
|
+
|
|
1023
|
+
### `rtk psql` -- PostgreSQL
|
|
1024
|
+
|
|
1025
|
+
```bash
|
|
1026
|
+
rtk psql [args...]
|
|
1027
|
+
```
|
|
1028
|
+
|
|
1029
|
+
Supprime les bordures de tableaux et compresse la sortie.
|
|
1030
|
+
|
|
1031
|
+
---
|
|
1032
|
+
|
|
1033
|
+
## Stacked PRs (Graphite)
|
|
1034
|
+
|
|
1035
|
+
### `rtk gt` -- Graphite
|
|
1036
|
+
|
|
1037
|
+
| Commande | Description |
|
|
1038
|
+
|----------|-------------|
|
|
1039
|
+
| `rtk gt log` | Stack log compact |
|
|
1040
|
+
| `rtk gt submit` | Submit compact |
|
|
1041
|
+
| `rtk gt sync` | Sync compact |
|
|
1042
|
+
| `rtk gt restack` | Restack compact |
|
|
1043
|
+
| `rtk gt create` | Create compact |
|
|
1044
|
+
| `rtk gt branch` | Branch info compact |
|
|
1045
|
+
|
|
1046
|
+
Les sous-commandes non reconnues sont transmises directement ou detectees comme passthrough git.
|
|
1047
|
+
|
|
1048
|
+
---
|
|
1049
|
+
|
|
1050
|
+
## Analytique et suivi
|
|
1051
|
+
|
|
1052
|
+
### Systeme de tracking
|
|
1053
|
+
|
|
1054
|
+
RTK enregistre chaque execution de commande dans une base SQLite :
|
|
1055
|
+
|
|
1056
|
+
- **Emplacement :** `~/.local/share/rtk/tracking.db` (Linux), `~/Library/Application Support/rtk/tracking.db` (macOS)
|
|
1057
|
+
- **Retention :** 90 jours automatique
|
|
1058
|
+
- **Metriques :** tokens entree/sortie, pourcentage d'economies, temps d'execution, projet
|
|
1059
|
+
|
|
1060
|
+
---
|
|
1061
|
+
|
|
1062
|
+
### `rtk gain` -- Statistiques d'economies
|
|
1063
|
+
|
|
1064
|
+
```bash
|
|
1065
|
+
rtk gain # Resume global
|
|
1066
|
+
rtk gain -p # Filtre par projet courant
|
|
1067
|
+
rtk gain --graph # Graphe ASCII (30 derniers jours)
|
|
1068
|
+
rtk gain --history # Historique recent des commandes
|
|
1069
|
+
rtk gain --daily # Ventilation jour par jour
|
|
1070
|
+
rtk gain --weekly # Ventilation par semaine
|
|
1071
|
+
rtk gain --monthly # Ventilation par mois
|
|
1072
|
+
rtk gain --all # Toutes les ventilations
|
|
1073
|
+
rtk gain --quota -t pro # Estimation d'economies sur le quota mensuel
|
|
1074
|
+
rtk gain --failures # Log des echecs de parsing (commandes en fallback)
|
|
1075
|
+
rtk gain --format json # Export JSON (pour dashboards)
|
|
1076
|
+
rtk gain --format csv # Export CSV
|
|
1077
|
+
```
|
|
1078
|
+
|
|
1079
|
+
**Options :**
|
|
1080
|
+
|
|
1081
|
+
| Option | Court | Description |
|
|
1082
|
+
|--------|-------|-------------|
|
|
1083
|
+
| `--project` | `-p` | Filtrer par repertoire courant |
|
|
1084
|
+
| `--graph` | `-g` | Graphe ASCII des 30 derniers jours |
|
|
1085
|
+
| `--history` | `-H` | Historique recent des commandes |
|
|
1086
|
+
| `--quota` | `-q` | Estimation d'economies sur le quota mensuel |
|
|
1087
|
+
| `--tier` | `-t` | Tier d'abonnement : `pro`, `5x`, `20x` (defaut: `20x`) |
|
|
1088
|
+
| `--daily` | `-d` | Ventilation quotidienne |
|
|
1089
|
+
| `--weekly` | `-w` | Ventilation hebdomadaire |
|
|
1090
|
+
| `--monthly` | `-m` | Ventilation mensuelle |
|
|
1091
|
+
| `--all` | `-a` | Toutes les ventilations |
|
|
1092
|
+
| `--format` | `-f` | Format de sortie : `text`, `json`, `csv` |
|
|
1093
|
+
| `--failures` | `-F` | Affiche les commandes en fallback |
|
|
1094
|
+
|
|
1095
|
+
**Exemple de sortie :**
|
|
1096
|
+
```
|
|
1097
|
+
$ rtk gain
|
|
1098
|
+
RTK Token Savings Summary
|
|
1099
|
+
Total commands: 1,247
|
|
1100
|
+
Total input: 2,341,000 tokens
|
|
1101
|
+
Total output: 468,200 tokens
|
|
1102
|
+
Total saved: 1,872,800 tokens (80%)
|
|
1103
|
+
Avg per command: 1,501 tokens saved
|
|
1104
|
+
|
|
1105
|
+
Top commands:
|
|
1106
|
+
git status 312x -82%
|
|
1107
|
+
cargo test 156x -91%
|
|
1108
|
+
git diff 98x -76%
|
|
1109
|
+
```
|
|
1110
|
+
|
|
1111
|
+
---
|
|
1112
|
+
|
|
1113
|
+
### `rtk discover` -- Opportunites manquees
|
|
1114
|
+
|
|
1115
|
+
**Objectif :** Analyse l'historique Claude Code pour trouver les commandes qui auraient pu etre optimisees par rtk.
|
|
1116
|
+
|
|
1117
|
+
```bash
|
|
1118
|
+
rtk discover # Projet courant, 30 derniers jours
|
|
1119
|
+
rtk discover --all --since 7 # Tous les projets, 7 derniers jours
|
|
1120
|
+
rtk discover -p /chemin/projet # Filtrer par projet
|
|
1121
|
+
rtk discover --limit 20 # Max commandes par section
|
|
1122
|
+
rtk discover --format json # Export JSON
|
|
1123
|
+
```
|
|
1124
|
+
|
|
1125
|
+
**Options :**
|
|
1126
|
+
|
|
1127
|
+
| Option | Court | Description |
|
|
1128
|
+
|--------|-------|-------------|
|
|
1129
|
+
| `--project` | `-p` | Filtrer par chemin de projet |
|
|
1130
|
+
| `--limit` | `-l` | Max commandes par section (defaut: 15) |
|
|
1131
|
+
| `--all` | `-a` | Scanner tous les projets |
|
|
1132
|
+
| `--since` | `-s` | Derniers N jours (defaut: 30) |
|
|
1133
|
+
| `--format` | `-f` | Format : `text`, `json` |
|
|
1134
|
+
|
|
1135
|
+
---
|
|
1136
|
+
|
|
1137
|
+
### `rtk learn` -- Apprendre des erreurs
|
|
1138
|
+
|
|
1139
|
+
**Objectif :** Analyse l'historique d'erreurs CLI de Claude Code pour detecter les corrections recurrentes.
|
|
1140
|
+
|
|
1141
|
+
```bash
|
|
1142
|
+
rtk learn # Projet courant
|
|
1143
|
+
rtk learn --all --since 7 # Tous les projets
|
|
1144
|
+
rtk learn --write-rules # Generer .claude/rules/cli-corrections.md
|
|
1145
|
+
rtk learn --min-confidence 0.8 # Seuil de confiance (defaut: 0.6)
|
|
1146
|
+
rtk learn --min-occurrences 3 # Occurrences minimales (defaut: 1)
|
|
1147
|
+
rtk learn --format json # Export JSON
|
|
1148
|
+
```
|
|
1149
|
+
|
|
1150
|
+
---
|
|
1151
|
+
|
|
1152
|
+
### `rtk cc-economics` -- Analyse economique Claude Code
|
|
1153
|
+
|
|
1154
|
+
**Objectif :** Compare les depenses Claude Code (via ccusage) avec les economies RTK.
|
|
1155
|
+
|
|
1156
|
+
```bash
|
|
1157
|
+
rtk cc-economics # Resume
|
|
1158
|
+
rtk cc-economics --daily # Ventilation quotidienne
|
|
1159
|
+
rtk cc-economics --weekly # Ventilation hebdomadaire
|
|
1160
|
+
rtk cc-economics --monthly # Ventilation mensuelle
|
|
1161
|
+
rtk cc-economics --all # Toutes les ventilations
|
|
1162
|
+
rtk cc-economics --format json # Export JSON
|
|
1163
|
+
```
|
|
1164
|
+
|
|
1165
|
+
---
|
|
1166
|
+
|
|
1167
|
+
### `rtk hook-audit` -- Metriques du hook
|
|
1168
|
+
|
|
1169
|
+
**Prerequis :** Necessite `RTK_HOOK_AUDIT=1` dans l'environnement.
|
|
1170
|
+
|
|
1171
|
+
```bash
|
|
1172
|
+
rtk hook-audit # 7 derniers jours (defaut)
|
|
1173
|
+
rtk hook-audit --since 30 # 30 derniers jours
|
|
1174
|
+
rtk hook-audit --since 0 # Tout l'historique
|
|
1175
|
+
```
|
|
1176
|
+
|
|
1177
|
+
---
|
|
1178
|
+
|
|
1179
|
+
## Systeme de hooks
|
|
1180
|
+
|
|
1181
|
+
### Fonctionnement
|
|
1182
|
+
|
|
1183
|
+
Le hook RTK intercepte les commandes Bash dans Claude Code **avant leur execution** et les reecrit automatiquement en equivalent RTK.
|
|
1184
|
+
|
|
1185
|
+
**Flux :**
|
|
1186
|
+
```
|
|
1187
|
+
Claude Code "git status"
|
|
1188
|
+
|
|
|
1189
|
+
v
|
|
1190
|
+
settings.json -> PreToolUse hook
|
|
1191
|
+
|
|
|
1192
|
+
v
|
|
1193
|
+
rtk-rewrite.sh (bash)
|
|
1194
|
+
|
|
|
1195
|
+
v
|
|
1196
|
+
rtk rewrite "git status" -> "rtk git status"
|
|
1197
|
+
|
|
|
1198
|
+
v
|
|
1199
|
+
Claude Code execute "rtk git status"
|
|
1200
|
+
|
|
|
1201
|
+
v
|
|
1202
|
+
Sortie filtree retournee a Claude (~10 tokens vs ~200)
|
|
1203
|
+
```
|
|
1204
|
+
|
|
1205
|
+
**Points cles :**
|
|
1206
|
+
- Claude ne voit jamais la recriture -- il recoit simplement une sortie optimisee
|
|
1207
|
+
- Le hook est un delegateur leger (~50 lignes bash) qui appelle `rtk rewrite`
|
|
1208
|
+
- Toute la logique de recriture est dans le registre Rust (`src/discover/registry.rs`)
|
|
1209
|
+
- Les commandes deja prefixees par `rtk` passent sans modification
|
|
1210
|
+
- Les heredocs (`<<`) ne sont pas modifies
|
|
1211
|
+
- Les commandes non reconnues passent sans modification
|
|
1212
|
+
|
|
1213
|
+
### Installation
|
|
1214
|
+
|
|
1215
|
+
```bash
|
|
1216
|
+
rtk init -g # Installation recommandee (hook + RTK.md)
|
|
1217
|
+
rtk init -g --auto-patch # Non-interactif (CI/CD)
|
|
1218
|
+
rtk init -g --hook-only # Hook seul, sans RTK.md
|
|
1219
|
+
rtk init --show # Verifier l'installation
|
|
1220
|
+
rtk init -g --uninstall # Desinstaller
|
|
1221
|
+
```
|
|
1222
|
+
|
|
1223
|
+
### Fichiers installes
|
|
1224
|
+
|
|
1225
|
+
| Fichier | Description |
|
|
1226
|
+
|---------|-------------|
|
|
1227
|
+
| `~/.claude/hooks/rtk-rewrite.sh` | Script hook (delegue a `rtk rewrite`) |
|
|
1228
|
+
| `~/.claude/RTK.md` | Instructions minimales pour le LLM |
|
|
1229
|
+
| `~/.claude/settings.json` | Enregistrement du hook PreToolUse |
|
|
1230
|
+
|
|
1231
|
+
### `rtk rewrite` -- Recriture de commande
|
|
1232
|
+
|
|
1233
|
+
Commande interne utilisee par le hook. Imprime la commande reecrite sur stdout (exit 0) ou sort avec exit 1 si aucun equivalent RTK n'existe.
|
|
1234
|
+
|
|
1235
|
+
```bash
|
|
1236
|
+
rtk rewrite "git status" # -> "rtk git status" (exit 0)
|
|
1237
|
+
rtk rewrite "terraform plan" # -> (exit 1, pas de recriture)
|
|
1238
|
+
rtk rewrite "rtk git status" # -> "rtk git status" (exit 0, inchange)
|
|
1239
|
+
```
|
|
1240
|
+
|
|
1241
|
+
### `rtk verify` -- Verification d'integrite
|
|
1242
|
+
|
|
1243
|
+
Verifie l'integrite du hook installe via un controle SHA-256.
|
|
1244
|
+
|
|
1245
|
+
```bash
|
|
1246
|
+
rtk verify
|
|
1247
|
+
```
|
|
1248
|
+
|
|
1249
|
+
### Commandes reecrites automatiquement
|
|
1250
|
+
|
|
1251
|
+
| Commande brute | Reecrite en |
|
|
1252
|
+
|----------------|-------------|
|
|
1253
|
+
| `git status/diff/log/add/commit/push/pull` | `rtk git ...` |
|
|
1254
|
+
| `gh pr/issue/run` | `rtk gh ...` |
|
|
1255
|
+
| `cargo test/build/clippy/check` | `rtk cargo ...` |
|
|
1256
|
+
| `cat/head/tail <fichier>` | `rtk read <fichier>` |
|
|
1257
|
+
| `rg/grep <pattern>` | `rtk grep <pattern>` |
|
|
1258
|
+
| `ls` | `rtk ls` |
|
|
1259
|
+
| `tree` | `rtk tree` |
|
|
1260
|
+
| `wc` | `rtk wc` |
|
|
1261
|
+
| `vitest/jest` | `rtk vitest run` |
|
|
1262
|
+
| `tsc` | `rtk tsc` |
|
|
1263
|
+
| `eslint/biome` | `rtk lint` |
|
|
1264
|
+
| `prettier` | `rtk prettier` |
|
|
1265
|
+
| `playwright` | `rtk playwright` |
|
|
1266
|
+
| `prisma` | `rtk prisma` |
|
|
1267
|
+
| `ruff check/format` | `rtk ruff ...` |
|
|
1268
|
+
| `pytest` | `rtk pytest` |
|
|
1269
|
+
| `mypy` | `rtk mypy` |
|
|
1270
|
+
| `pip list/install` | `rtk pip ...` |
|
|
1271
|
+
| `go test/build/vet` | `rtk go ...` |
|
|
1272
|
+
| `golangci-lint` | `rtk golangci-lint` |
|
|
1273
|
+
| `docker ps/images/logs` | `rtk docker ...` |
|
|
1274
|
+
| `kubectl get/logs` | `rtk kubectl ...` |
|
|
1275
|
+
| `curl` | `rtk curl` |
|
|
1276
|
+
| `pnpm list/outdated` | `rtk pnpm ...` |
|
|
1277
|
+
|
|
1278
|
+
### Exclusion de commandes
|
|
1279
|
+
|
|
1280
|
+
Pour empecher certaines commandes d'etre reecrites, ajoutez-les dans `config.toml` :
|
|
1281
|
+
|
|
1282
|
+
```toml
|
|
1283
|
+
[hooks]
|
|
1284
|
+
exclude_commands = ["curl", "playwright"]
|
|
1285
|
+
```
|
|
1286
|
+
|
|
1287
|
+
---
|
|
1288
|
+
|
|
1289
|
+
## Configuration
|
|
1290
|
+
|
|
1291
|
+
### Fichier de configuration
|
|
1292
|
+
|
|
1293
|
+
**Emplacement :** `~/.config/rtk/config.toml` (Linux) ou `~/Library/Application Support/rtk/config.toml` (macOS)
|
|
1294
|
+
|
|
1295
|
+
**Commandes :**
|
|
1296
|
+
```bash
|
|
1297
|
+
rtk config # Afficher la configuration actuelle
|
|
1298
|
+
rtk config --create # Creer le fichier avec les valeurs par defaut
|
|
1299
|
+
```
|
|
1300
|
+
|
|
1301
|
+
### Structure complete
|
|
1302
|
+
|
|
1303
|
+
```toml
|
|
1304
|
+
[tracking]
|
|
1305
|
+
enabled = true # Activer/desactiver le suivi
|
|
1306
|
+
history_days = 90 # Jours de retention (nettoyage automatique)
|
|
1307
|
+
database_path = "/custom/path/tracking.db" # Chemin personnalise (optionnel)
|
|
1308
|
+
|
|
1309
|
+
[display]
|
|
1310
|
+
colors = true # Sortie coloree
|
|
1311
|
+
emoji = true # Utiliser les emojis
|
|
1312
|
+
max_width = 120 # Largeur maximale de sortie
|
|
1313
|
+
|
|
1314
|
+
[filters]
|
|
1315
|
+
ignore_dirs = [".git", "node_modules", "target", "__pycache__", ".venv", "vendor"]
|
|
1316
|
+
ignore_files = ["*.lock", "*.min.js", "*.min.css"]
|
|
1317
|
+
|
|
1318
|
+
[tee]
|
|
1319
|
+
enabled = true # Activer la sauvegarde de sortie brute
|
|
1320
|
+
mode = "failures" # "failures" (defaut), "always", ou "never"
|
|
1321
|
+
max_files = 20 # Rotation : garder les N derniers fichiers
|
|
1322
|
+
# directory = "/custom/tee/path" # Chemin personnalise (optionnel)
|
|
1323
|
+
|
|
1324
|
+
[telemetry]
|
|
1325
|
+
enabled = true # Telemetrie anonyme (1 ping/jour, opt-out possible)
|
|
1326
|
+
|
|
1327
|
+
[hooks]
|
|
1328
|
+
exclude_commands = [] # Commandes a exclure de la recriture automatique
|
|
1329
|
+
```
|
|
1330
|
+
|
|
1331
|
+
### Variables d'environnement
|
|
1332
|
+
|
|
1333
|
+
| Variable | Description |
|
|
1334
|
+
|----------|-------------|
|
|
1335
|
+
| `RTK_TEE_DIR` | Surcharge le repertoire tee |
|
|
1336
|
+
| `RTK_TELEMETRY_DISABLED=1` | Desactiver la telemetrie |
|
|
1337
|
+
| `RTK_HOOK_AUDIT=1` | Activer l'audit du hook |
|
|
1338
|
+
| `SKIP_ENV_VALIDATION=1` | Desactiver la validation d'env (Next.js, etc.) |
|
|
1339
|
+
|
|
1340
|
+
---
|
|
1341
|
+
|
|
1342
|
+
## Systeme Tee
|
|
1343
|
+
|
|
1344
|
+
### Recuperation de sortie brute
|
|
1345
|
+
|
|
1346
|
+
Quand une commande echoue, RTK sauvegarde automatiquement la sortie brute complete dans un fichier log. Cela permet au LLM de lire la sortie sans re-executer la commande.
|
|
1347
|
+
|
|
1348
|
+
**Fonctionnement :**
|
|
1349
|
+
1. La commande echoue (exit code != 0)
|
|
1350
|
+
2. RTK sauvegarde la sortie brute dans `~/.local/share/rtk/tee/`
|
|
1351
|
+
3. Le chemin du fichier est affiche dans la sortie filtree
|
|
1352
|
+
4. Le LLM peut lire le fichier si besoin de plus de details
|
|
1353
|
+
|
|
1354
|
+
**Sortie :**
|
|
1355
|
+
```
|
|
1356
|
+
FAILED: 2/15 tests
|
|
1357
|
+
[full output: ~/.local/share/rtk/tee/1707753600_cargo_test.log]
|
|
1358
|
+
```
|
|
1359
|
+
|
|
1360
|
+
**Configuration :**
|
|
1361
|
+
|
|
1362
|
+
| Parametre | Defaut | Description |
|
|
1363
|
+
|-----------|--------|-------------|
|
|
1364
|
+
| `tee.enabled` | `true` | Activer/desactiver |
|
|
1365
|
+
| `tee.mode` | `"failures"` | `"failures"`, `"always"`, `"never"` |
|
|
1366
|
+
| `tee.max_files` | `20` | Rotation : garder les N derniers |
|
|
1367
|
+
| Taille min | 500 octets | Les sorties trop courtes ne sont pas sauvegardees |
|
|
1368
|
+
| Taille max fichier | 1 Mo | Troncature au-dela |
|
|
1369
|
+
|
|
1370
|
+
---
|
|
1371
|
+
|
|
1372
|
+
## Telemetrie
|
|
1373
|
+
|
|
1374
|
+
RTK envoie un ping anonyme une fois par jour (23h d'intervalle) pour des statistiques d'utilisation.
|
|
1375
|
+
|
|
1376
|
+
**Donnees envoyees :** hash de device, version, OS, architecture, nombre de commandes/24h, top commandes, pourcentage d'economies.
|
|
1377
|
+
|
|
1378
|
+
**Desactiver :**
|
|
1379
|
+
```bash
|
|
1380
|
+
# Via variable d'environnement
|
|
1381
|
+
export RTK_TELEMETRY_DISABLED=1
|
|
1382
|
+
|
|
1383
|
+
# Via config.toml
|
|
1384
|
+
[telemetry]
|
|
1385
|
+
enabled = false
|
|
1386
|
+
```
|
|
1387
|
+
|
|
1388
|
+
Aucune donnee personnelle, aucun contenu de commande, aucun chemin de fichier n'est transmis.
|
|
1389
|
+
|
|
1390
|
+
---
|
|
1391
|
+
|
|
1392
|
+
## Resume des economies par categorie
|
|
1393
|
+
|
|
1394
|
+
| Categorie | Commandes | Economies typiques |
|
|
1395
|
+
|-----------|-----------|-------------------|
|
|
1396
|
+
| **Fichiers** | ls, tree, read, find, grep, diff | 60-80% |
|
|
1397
|
+
| **Git** | status, log, diff, show, add, commit, push, pull | 75-92% |
|
|
1398
|
+
| **GitHub** | pr, issue, run, api | 26-87% |
|
|
1399
|
+
| **Tests** | cargo test, vitest, playwright, pytest, go test | 90-99% |
|
|
1400
|
+
| **Build/Lint** | cargo build, tsc, eslint, prettier, next, ruff, clippy | 70-87% |
|
|
1401
|
+
| **Paquets** | pnpm, npm, pip, deps, prisma | 60-80% |
|
|
1402
|
+
| **Conteneurs** | docker, kubectl | 70-80% |
|
|
1403
|
+
| **Donnees** | json, env, log, curl, wget | 60-80% |
|
|
1404
|
+
| **Analytique** | gain, discover, learn, cc-economics | N/A (meta) |
|
|
1405
|
+
|
|
1406
|
+
---
|
|
1407
|
+
|
|
1408
|
+
## Nombre total de commandes
|
|
1409
|
+
|
|
1410
|
+
RTK supporte **45+ commandes** reparties en 9 categories, avec passthrough automatique pour les sous-commandes non reconnues. Cela en fait un proxy universel : il est toujours sur a utiliser en prefixe.
|