Skip to content

Commit 52b4ed3

Browse files
authored
Merge pull request #8 from FlorianBruniaux/docs/installation-guide
Add installation guide for AI coding assistants
2 parents 09b9390 + 542eca5 commit 52b4ed3

2 files changed

Lines changed: 225 additions & 39 deletions

File tree

INSTALL.md

Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
# RTK Installation Guide - For AI Coding Assistants
2+
3+
## Pre-Installation Check (REQUIRED)
4+
5+
**AI assistants should ALWAYS verify if RTK is already installed before attempting installation.**
6+
7+
```bash
8+
# Check if RTK is installed
9+
rtk --version
10+
11+
# Check installation path
12+
which rtk
13+
```
14+
15+
If RTK is already installed and working, **DO NOT reinstall**. Skip directly to "Project Initialization" section.
16+
17+
## Installation (only if RTK not available)
18+
19+
### Option 1: Install from fork (RECOMMENDED currently)
20+
21+
This fork includes critical fixes and pnpm/Vitest support not yet merged upstream.
22+
23+
```bash
24+
# Clone the fork
25+
git clone https://github.com/FlorianBruniaux/rtk.git
26+
cd rtk
27+
28+
# Check branch (should be master or feat/vitest-support)
29+
git branch
30+
31+
# Compile and install
32+
cargo install --path . --force
33+
34+
# Verify installation
35+
rtk --version
36+
```
37+
38+
### Option 2: Install from upstream (when PRs are merged)
39+
40+
```bash
41+
cargo install rtk
42+
```
43+
44+
## Project Initialization
45+
46+
**For each project where you want to use RTK:**
47+
48+
```bash
49+
# Navigate to project directory
50+
cd /path/to/your/project
51+
52+
# Initialize RTK for this project (creates ./CLAUDE.md)
53+
rtk init
54+
55+
# OR initialize globally (creates ~/CLAUDE.md for all projects)
56+
rtk init --global
57+
```
58+
59+
## Installation Verification
60+
61+
```bash
62+
# Basic test
63+
rtk ls .
64+
65+
# Test with git
66+
rtk git status
67+
68+
# Test with pnpm (fork only)
69+
rtk pnpm list
70+
71+
# Test with Vitest (feat/vitest-support branch only)
72+
rtk vitest run
73+
```
74+
75+
## Essential Commands
76+
77+
### Files
78+
```bash
79+
rtk ls . # Compact tree view
80+
rtk read file.rs # Optimized reading
81+
rtk grep "pattern" . # Grouped search results
82+
```
83+
84+
### Git
85+
```bash
86+
rtk git status # Compact status
87+
rtk git log -n 10 # Condensed logs
88+
rtk git diff # Optimized diff
89+
rtk git add . # → "ok ✓"
90+
rtk git commit -m "msg" # → "ok ✓ abc1234"
91+
rtk git push # → "ok ✓ main"
92+
```
93+
94+
### Pnpm (fork only)
95+
```bash
96+
rtk pnpm list # Dependency tree (-70% tokens)
97+
rtk pnpm outdated # Available updates (-80-90%)
98+
rtk pnpm install pkg # Silent installation
99+
```
100+
101+
### Tests
102+
```bash
103+
rtk test cargo test # Failures only (-90%)
104+
rtk vitest run # Filtered Vitest output (-99.6%)
105+
```
106+
107+
### Statistics
108+
```bash
109+
rtk gain # Token savings
110+
rtk gain --graph # With ASCII graph
111+
rtk gain --history # With command history
112+
```
113+
114+
## Validated Token Savings
115+
116+
### Production T3 Stack Project
117+
| Operation | Standard | RTK | Reduction |
118+
|-----------|----------|-----|-----------|
119+
| `vitest run` | 102,199 chars | 377 chars | **-99.6%** |
120+
| `git status` | 529 chars | 217 chars | **-59%** |
121+
| `pnpm list` | ~8,000 tokens | ~2,400 | **-70%** |
122+
| `pnpm outdated` | ~12,000 tokens | ~1,200-2,400 | **-80-90%** |
123+
124+
### Typical Claude Code Session (30 min)
125+
- **Without RTK**: ~150,000 tokens
126+
- **With RTK**: ~45,000 tokens
127+
- **Savings**: **70% reduction**
128+
129+
## Troubleshooting
130+
131+
### RTK command not found after installation
132+
```bash
133+
# Check PATH
134+
echo $PATH | grep -o '[^:]*\.cargo[^:]*'
135+
136+
# Add to PATH if needed (~/.bashrc or ~/.zshrc)
137+
export PATH="$HOME/.cargo/bin:$PATH"
138+
139+
# Reload shell
140+
source ~/.bashrc # or source ~/.zshrc
141+
```
142+
143+
### RTK command not available (e.g., vitest)
144+
```bash
145+
# Check branch
146+
cd /path/to/rtk
147+
git branch
148+
149+
# Switch to feat/vitest-support if needed
150+
git checkout feat/vitest-support
151+
152+
# Reinstall
153+
cargo install --path . --force
154+
```
155+
156+
### Compilation error
157+
```bash
158+
# Update Rust
159+
rustup update stable
160+
161+
# Clean and recompile
162+
cargo clean
163+
cargo build --release
164+
cargo install --path . --force
165+
```
166+
167+
## Support and Contributing
168+
169+
- **Issues**: https://github.com/pszymkowiak/rtk/issues (upstream)
170+
- **Fork issues**: https://github.com/FlorianBruniaux/rtk/issues
171+
- **Pull Requests**: Create on fork then propose upstream
172+
173+
## AI Assistant Checklist
174+
175+
Before each session:
176+
177+
- [ ] Verify RTK is installed: `rtk --version`
178+
- [ ] If not installed → follow "Install from fork"
179+
- [ ] If project not initialized → `rtk init`
180+
- [ ] Use `rtk` for ALL git/pnpm/test/vitest commands
181+
- [ ] Check savings: `rtk gain`
182+
183+
**Golden Rule**: AI coding assistants should ALWAYS use `rtk` as a proxy for shell commands that generate verbose output (git, pnpm, npm, cargo test, vitest, docker, kubectl).

README.md

Lines changed: 42 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -176,13 +176,21 @@ FAILED: 2/15 tests
176176
3. **Truncation**: Keeps relevant context, cuts redundancy
177177
4. **Deduplication**: Collapses repeated log lines with counts
178178

179-
## Fork Features
179+
## Improvements in This Fork
180180

181-
This fork adds critical fixes and modern JavaScript stack support, validated on production T3 Stack codebases.
181+
This fork adds critical fixes and modern JavaScript stack support to RTK, validated on production T3 Stack codebases.
182182

183-
### 🔧 Git Argument Parsing Fix
183+
### 🔧 PR #5: Git Argument Parsing Fix (CRITICAL)
184184

185-
**Problem**: Git flags like `--oneline`, `--cached`, `--graph` were rejected as invalid arguments.
185+
**Status**: [Open](https://github.com/pszymkowiak/rtk/pull/5) | **Priority**: Critical
186+
187+
Fixes a major bug where git flags were rejected as invalid arguments.
188+
189+
**Problem**:
190+
```bash
191+
rtk git log --oneline -20
192+
# Error: unexpected argument '--oneline' found
193+
```
186194

187195
**Solution**:
188196
- Fixed Clap argument parsing with `trailing_var_arg + allow_hyphen_values`
@@ -197,11 +205,15 @@ rtk git log --graph --all # Branch visualization
197205
rtk git status --short # Ultra-compact status
198206
```
199207

200-
### 📦 pnpm Support for T3 Stack
208+
**Impact**: All git flags now work correctly, preventing workflow disruptions.
209+
210+
### 📦 PR #6: pnpm Support for Modern JavaScript Stacks
211+
212+
**Status**: [Open](https://github.com/pszymkowiak/rtk/pull/6) | **Target**: T3 Stack users
201213

202214
Adds first-class pnpm support with security hardening.
203215

204-
**Commands**:
216+
**New Commands**:
205217
```bash
206218
rtk pnpm list # Dependency tree (70% token reduction)
207219
rtk pnpm outdated # Update candidates (80-90% reduction)
@@ -218,45 +230,32 @@ rtk pnpm install <pkg> # Silent success confirmation
218230
**Security**:
219231
- Package name validation (prevents command injection)
220232
- Proper error propagation (fixes CI/CD reliability)
233+
- Comprehensive test coverage
221234

222-
### 🧪 Vitest Test Runner Support
223-
224-
Modern test runner integration for JavaScript/TypeScript projects.
225-
226-
**Command**:
227-
```bash
228-
rtk vitest run # Filtered test output (99.6% token reduction)
229-
```
230-
231-
**Token Savings** (validated on production codebase):
232-
| Test Suite | Standard Output | rtk Output | Reduction |
233-
|------------|----------------|------------|-----------|
234-
| 250 tests (2 failures) | 102,199 chars | 377 chars | **-99.6%**|
235-
236-
**Output Format**:
237-
```
238-
PASS (10) FAIL (2)
239-
240-
1. FAIL tests/unit/api/services/activity.test.ts
241-
Error: env.OPENAI_API_KEY accessed on client
242-
at line 73
235+
### 🐛 Related Upstream Issues
243236

244-
2. FAIL tests/unit/lib/utils/validator.test.ts
245-
should be a readonly array
237+
This fork addresses issues reported upstream:
238+
- [Issue #2](https://github.com/pszymkowiak/rtk/issues/2): Git argument parsing bug
239+
- [Issue #3](https://github.com/pszymkowiak/rtk/issues/3): T3 Stack support request (pnpm + Vitest)
240+
- [Issue #4](https://github.com/pszymkowiak/rtk/issues/4): grep/ls filtering improvements
246241

247-
Time: 3.05s
248-
```
242+
### 🧪 Testing
249243

250-
**What's Preserved**:
251-
- ✅ Pass/fail counts
252-
- ✅ Failure details with file paths
253-
- ✅ Error context (line numbers + code snippets)
254-
- ✅ Execution timing
244+
**Production Validation**: All improvements tested on a production T3 Stack codebase:
245+
- Framework: Next.js 15.1.5 + TypeScript
246+
- Package Manager: pnpm 10.0.0
247+
- Test Runner: Vitest
248+
- Repository: 50+ files, 10,000+ lines of code
255249

256-
### 📥 Installation (This Fork)
250+
**Test Coverage**:
251+
- Unit tests for all new commands
252+
- Integration tests with real pnpm/git outputs
253+
- Security validation for command injection prevention
254+
- CI/CD pipeline validation (exit code propagation)
257255

258-
**Recommended** until upstream merges these features:
256+
### 📥 Installation
259257

258+
**Use This Fork** (recommended until PRs are merged):
260259
```bash
261260
# Clone and build
262261
git clone https://github.com/FlorianBruniaux/rtk.git
@@ -270,7 +269,11 @@ cargo install --path .
270269
./target/release/rtk --version
271270
```
272271

273-
**Switch to Upstream** (once features are merged):
272+
**Track Upstream Merge Status**:
273+
- Watch [PR #5](https://github.com/pszymkowiak/rtk/pull/5) for git fixes
274+
- Watch [PR #6](https://github.com/pszymkowiak/rtk/pull/6) for pnpm support
275+
276+
**Switch to Upstream** (once merged):
274277
```bash
275278
cargo install rtk --force
276279
```

0 commit comments

Comments
 (0)