@hasna/terminal 2.3.0 → 2.3.1
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 +64 -16
- package/package.json +1 -1
- package/src/ai.ts +8 -0
- package/src/cli.tsx +57 -18
- package/src/output-processor.ts +6 -1
- package/src/output-store.ts +58 -12
- package/src/tool-profiles.ts +139 -0
- package/temp/rtk/.claude/agents/code-reviewer.md +0 -221
- package/temp/rtk/.claude/agents/debugger.md +0 -519
- package/temp/rtk/.claude/agents/rtk-testing-specialist.md +0 -461
- package/temp/rtk/.claude/agents/rust-rtk.md +0 -511
- package/temp/rtk/.claude/agents/technical-writer.md +0 -355
- package/temp/rtk/.claude/commands/diagnose.md +0 -352
- package/temp/rtk/.claude/commands/test-routing.md +0 -362
- package/temp/rtk/.claude/hooks/bash/pre-commit-format.sh +0 -16
- package/temp/rtk/.claude/hooks/rtk-rewrite.sh +0 -70
- package/temp/rtk/.claude/hooks/rtk-suggest.sh +0 -152
- package/temp/rtk/.claude/rules/cli-testing.md +0 -526
- package/temp/rtk/.claude/skills/issue-triage/SKILL.md +0 -348
- package/temp/rtk/.claude/skills/issue-triage/templates/issue-comment.md +0 -134
- package/temp/rtk/.claude/skills/performance.md +0 -435
- package/temp/rtk/.claude/skills/pr-triage/SKILL.md +0 -315
- package/temp/rtk/.claude/skills/pr-triage/templates/review-comment.md +0 -71
- package/temp/rtk/.claude/skills/repo-recap.md +0 -206
- package/temp/rtk/.claude/skills/rtk-tdd/SKILL.md +0 -78
- package/temp/rtk/.claude/skills/rtk-tdd/references/testing-patterns.md +0 -124
- package/temp/rtk/.claude/skills/security-guardian.md +0 -503
- package/temp/rtk/.claude/skills/ship.md +0 -404
- package/temp/rtk/.github/workflows/benchmark.yml +0 -34
- package/temp/rtk/.github/workflows/dco-check.yaml +0 -12
- package/temp/rtk/.github/workflows/release-please.yml +0 -51
- package/temp/rtk/.github/workflows/release.yml +0 -343
- package/temp/rtk/.github/workflows/security-check.yml +0 -135
- package/temp/rtk/.github/workflows/validate-docs.yml +0 -78
- package/temp/rtk/.release-please-manifest.json +0 -3
- package/temp/rtk/ARCHITECTURE.md +0 -1491
- package/temp/rtk/CHANGELOG.md +0 -640
- package/temp/rtk/CLAUDE.md +0 -605
- package/temp/rtk/CONTRIBUTING.md +0 -199
- package/temp/rtk/Cargo.lock +0 -1668
- package/temp/rtk/Cargo.toml +0 -64
- package/temp/rtk/Formula/rtk.rb +0 -43
- package/temp/rtk/INSTALL.md +0 -390
- package/temp/rtk/LICENSE +0 -21
- package/temp/rtk/README.md +0 -386
- package/temp/rtk/README_es.md +0 -159
- package/temp/rtk/README_fr.md +0 -197
- package/temp/rtk/README_ja.md +0 -159
- package/temp/rtk/README_ko.md +0 -159
- package/temp/rtk/README_zh.md +0 -167
- package/temp/rtk/ROADMAP.md +0 -15
- package/temp/rtk/SECURITY.md +0 -217
- package/temp/rtk/TEST_EXEC_TIME.md +0 -102
- package/temp/rtk/build.rs +0 -57
- package/temp/rtk/docs/AUDIT_GUIDE.md +0 -432
- package/temp/rtk/docs/FEATURES.md +0 -1410
- package/temp/rtk/docs/TROUBLESHOOTING.md +0 -309
- package/temp/rtk/docs/filter-workflow.md +0 -102
- package/temp/rtk/docs/images/gain-dashboard.jpg +0 -0
- package/temp/rtk/docs/tracking.md +0 -583
- package/temp/rtk/hooks/opencode-rtk.ts +0 -39
- package/temp/rtk/hooks/rtk-awareness.md +0 -29
- package/temp/rtk/hooks/rtk-rewrite.sh +0 -61
- package/temp/rtk/hooks/test-rtk-rewrite.sh +0 -442
- package/temp/rtk/install.sh +0 -124
- package/temp/rtk/release-please-config.json +0 -10
- package/temp/rtk/scripts/benchmark.sh +0 -592
- package/temp/rtk/scripts/check-installation.sh +0 -162
- package/temp/rtk/scripts/install-local.sh +0 -37
- package/temp/rtk/scripts/rtk-economics.sh +0 -137
- package/temp/rtk/scripts/test-all.sh +0 -561
- package/temp/rtk/scripts/test-aristote.sh +0 -227
- package/temp/rtk/scripts/test-tracking.sh +0 -79
- package/temp/rtk/scripts/update-readme-metrics.sh +0 -32
- package/temp/rtk/scripts/validate-docs.sh +0 -73
- package/temp/rtk/src/aws_cmd.rs +0 -880
- package/temp/rtk/src/binlog.rs +0 -1645
- package/temp/rtk/src/cargo_cmd.rs +0 -1727
- package/temp/rtk/src/cc_economics.rs +0 -1157
- package/temp/rtk/src/ccusage.rs +0 -340
- package/temp/rtk/src/config.rs +0 -187
- package/temp/rtk/src/container.rs +0 -855
- package/temp/rtk/src/curl_cmd.rs +0 -134
- package/temp/rtk/src/deps.rs +0 -268
- package/temp/rtk/src/diff_cmd.rs +0 -367
- package/temp/rtk/src/discover/mod.rs +0 -274
- package/temp/rtk/src/discover/provider.rs +0 -388
- package/temp/rtk/src/discover/registry.rs +0 -2022
- package/temp/rtk/src/discover/report.rs +0 -202
- package/temp/rtk/src/discover/rules.rs +0 -667
- package/temp/rtk/src/display_helpers.rs +0 -402
- package/temp/rtk/src/dotnet_cmd.rs +0 -1771
- package/temp/rtk/src/dotnet_format_report.rs +0 -133
- package/temp/rtk/src/dotnet_trx.rs +0 -593
- package/temp/rtk/src/env_cmd.rs +0 -204
- package/temp/rtk/src/filter.rs +0 -462
- package/temp/rtk/src/filters/README.md +0 -52
- package/temp/rtk/src/filters/ansible-playbook.toml +0 -34
- package/temp/rtk/src/filters/basedpyright.toml +0 -47
- package/temp/rtk/src/filters/biome.toml +0 -45
- package/temp/rtk/src/filters/brew-install.toml +0 -37
- package/temp/rtk/src/filters/composer-install.toml +0 -40
- package/temp/rtk/src/filters/df.toml +0 -16
- package/temp/rtk/src/filters/dotnet-build.toml +0 -64
- package/temp/rtk/src/filters/du.toml +0 -16
- package/temp/rtk/src/filters/fail2ban-client.toml +0 -15
- package/temp/rtk/src/filters/gcc.toml +0 -49
- package/temp/rtk/src/filters/gcloud.toml +0 -22
- package/temp/rtk/src/filters/hadolint.toml +0 -24
- package/temp/rtk/src/filters/helm.toml +0 -29
- package/temp/rtk/src/filters/iptables.toml +0 -27
- package/temp/rtk/src/filters/jj.toml +0 -28
- package/temp/rtk/src/filters/jq.toml +0 -24
- package/temp/rtk/src/filters/make.toml +0 -41
- package/temp/rtk/src/filters/markdownlint.toml +0 -24
- package/temp/rtk/src/filters/mix-compile.toml +0 -27
- package/temp/rtk/src/filters/mix-format.toml +0 -15
- package/temp/rtk/src/filters/mvn-build.toml +0 -44
- package/temp/rtk/src/filters/oxlint.toml +0 -43
- package/temp/rtk/src/filters/ping.toml +0 -63
- package/temp/rtk/src/filters/pio-run.toml +0 -40
- package/temp/rtk/src/filters/poetry-install.toml +0 -50
- package/temp/rtk/src/filters/pre-commit.toml +0 -35
- package/temp/rtk/src/filters/ps.toml +0 -16
- package/temp/rtk/src/filters/quarto-render.toml +0 -41
- package/temp/rtk/src/filters/rsync.toml +0 -48
- package/temp/rtk/src/filters/shellcheck.toml +0 -27
- package/temp/rtk/src/filters/shopify-theme.toml +0 -29
- package/temp/rtk/src/filters/skopeo.toml +0 -45
- package/temp/rtk/src/filters/sops.toml +0 -16
- package/temp/rtk/src/filters/ssh.toml +0 -44
- package/temp/rtk/src/filters/stat.toml +0 -34
- package/temp/rtk/src/filters/swift-build.toml +0 -41
- package/temp/rtk/src/filters/systemctl-status.toml +0 -33
- package/temp/rtk/src/filters/terraform-plan.toml +0 -35
- package/temp/rtk/src/filters/tofu-fmt.toml +0 -16
- package/temp/rtk/src/filters/tofu-init.toml +0 -38
- package/temp/rtk/src/filters/tofu-plan.toml +0 -35
- package/temp/rtk/src/filters/tofu-validate.toml +0 -17
- package/temp/rtk/src/filters/trunk-build.toml +0 -39
- package/temp/rtk/src/filters/ty.toml +0 -50
- package/temp/rtk/src/filters/uv-sync.toml +0 -37
- package/temp/rtk/src/filters/xcodebuild.toml +0 -99
- package/temp/rtk/src/filters/yamllint.toml +0 -25
- package/temp/rtk/src/find_cmd.rs +0 -598
- package/temp/rtk/src/format_cmd.rs +0 -386
- package/temp/rtk/src/gain.rs +0 -723
- package/temp/rtk/src/gh_cmd.rs +0 -1651
- package/temp/rtk/src/git.rs +0 -2012
- package/temp/rtk/src/go_cmd.rs +0 -592
- package/temp/rtk/src/golangci_cmd.rs +0 -254
- package/temp/rtk/src/grep_cmd.rs +0 -288
- package/temp/rtk/src/gt_cmd.rs +0 -810
- package/temp/rtk/src/hook_audit_cmd.rs +0 -283
- package/temp/rtk/src/hook_check.rs +0 -171
- package/temp/rtk/src/init.rs +0 -1859
- package/temp/rtk/src/integrity.rs +0 -537
- package/temp/rtk/src/json_cmd.rs +0 -231
- package/temp/rtk/src/learn/detector.rs +0 -628
- package/temp/rtk/src/learn/mod.rs +0 -119
- package/temp/rtk/src/learn/report.rs +0 -184
- package/temp/rtk/src/lint_cmd.rs +0 -694
- package/temp/rtk/src/local_llm.rs +0 -316
- package/temp/rtk/src/log_cmd.rs +0 -248
- package/temp/rtk/src/ls.rs +0 -324
- package/temp/rtk/src/main.rs +0 -2482
- package/temp/rtk/src/mypy_cmd.rs +0 -389
- package/temp/rtk/src/next_cmd.rs +0 -241
- package/temp/rtk/src/npm_cmd.rs +0 -236
- package/temp/rtk/src/parser/README.md +0 -267
- package/temp/rtk/src/parser/error.rs +0 -46
- package/temp/rtk/src/parser/formatter.rs +0 -336
- package/temp/rtk/src/parser/mod.rs +0 -311
- package/temp/rtk/src/parser/types.rs +0 -119
- package/temp/rtk/src/pip_cmd.rs +0 -302
- package/temp/rtk/src/playwright_cmd.rs +0 -479
- package/temp/rtk/src/pnpm_cmd.rs +0 -573
- package/temp/rtk/src/prettier_cmd.rs +0 -221
- package/temp/rtk/src/prisma_cmd.rs +0 -482
- package/temp/rtk/src/psql_cmd.rs +0 -382
- package/temp/rtk/src/pytest_cmd.rs +0 -384
- package/temp/rtk/src/read.rs +0 -217
- package/temp/rtk/src/rewrite_cmd.rs +0 -50
- package/temp/rtk/src/ruff_cmd.rs +0 -402
- package/temp/rtk/src/runner.rs +0 -271
- package/temp/rtk/src/summary.rs +0 -297
- package/temp/rtk/src/tee.rs +0 -405
- package/temp/rtk/src/telemetry.rs +0 -248
- package/temp/rtk/src/toml_filter.rs +0 -1655
- package/temp/rtk/src/tracking.rs +0 -1416
- package/temp/rtk/src/tree.rs +0 -209
- package/temp/rtk/src/tsc_cmd.rs +0 -259
- package/temp/rtk/src/utils.rs +0 -432
- package/temp/rtk/src/verify_cmd.rs +0 -47
- package/temp/rtk/src/vitest_cmd.rs +0 -385
- package/temp/rtk/src/wc_cmd.rs +0 -401
- package/temp/rtk/src/wget_cmd.rs +0 -260
- package/temp/rtk/tests/fixtures/dotnet/build_failed.txt +0 -11
- package/temp/rtk/tests/fixtures/dotnet/format_changes.json +0 -31
- package/temp/rtk/tests/fixtures/dotnet/format_empty.json +0 -1
- package/temp/rtk/tests/fixtures/dotnet/format_success.json +0 -12
- package/temp/rtk/tests/fixtures/dotnet/test_failed.txt +0 -18
package/temp/rtk/CLAUDE.md
DELETED
|
@@ -1,605 +0,0 @@
|
|
|
1
|
-
# CLAUDE.md
|
|
2
|
-
|
|
3
|
-
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
-
|
|
5
|
-
## Project Overview
|
|
6
|
-
|
|
7
|
-
**rtk (Rust Token Killer)** is a high-performance CLI proxy that minimizes LLM token consumption by filtering and compressing command outputs. It achieves 60-90% token savings on common development operations through smart filtering, grouping, truncation, and deduplication.
|
|
8
|
-
|
|
9
|
-
This is a fork with critical fixes for git argument parsing and modern JavaScript stack support (pnpm, vitest, Next.js, TypeScript, Playwright, Prisma).
|
|
10
|
-
|
|
11
|
-
### ⚠️ Name Collision Warning
|
|
12
|
-
|
|
13
|
-
**Two different "rtk" projects exist:**
|
|
14
|
-
- ✅ **This project**: Rust Token Killer (rtk-ai/rtk)
|
|
15
|
-
- ❌ **reachingforthejack/rtk**: Rust Type Kit (DIFFERENT - generates Rust types)
|
|
16
|
-
|
|
17
|
-
**Verify correct installation:**
|
|
18
|
-
```bash
|
|
19
|
-
rtk --version # Should show "rtk 0.28.0" (or newer)
|
|
20
|
-
rtk gain # Should show token savings stats (NOT "command not found")
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
If `rtk gain` fails, you have the wrong package installed.
|
|
24
|
-
|
|
25
|
-
## Development Commands
|
|
26
|
-
|
|
27
|
-
> **Note**: If rtk is installed, prefer `rtk <cmd>` over raw commands for token-optimized output.
|
|
28
|
-
> All commands work with passthrough support even for subcommands rtk doesn't specifically handle.
|
|
29
|
-
|
|
30
|
-
### Build & Run
|
|
31
|
-
```bash
|
|
32
|
-
# Development build
|
|
33
|
-
cargo build # raw
|
|
34
|
-
rtk cargo build # preferred (token-optimized)
|
|
35
|
-
|
|
36
|
-
# Release build (optimized)
|
|
37
|
-
cargo build --release
|
|
38
|
-
rtk cargo build --release
|
|
39
|
-
|
|
40
|
-
# Run directly
|
|
41
|
-
cargo run -- <command>
|
|
42
|
-
|
|
43
|
-
# Install locally
|
|
44
|
-
cargo install --path .
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
### Testing
|
|
48
|
-
```bash
|
|
49
|
-
# Run all tests
|
|
50
|
-
cargo test # raw
|
|
51
|
-
rtk cargo test # preferred (token-optimized)
|
|
52
|
-
|
|
53
|
-
# Run specific test
|
|
54
|
-
cargo test <test_name>
|
|
55
|
-
rtk cargo test <test_name>
|
|
56
|
-
|
|
57
|
-
# Run tests with output
|
|
58
|
-
cargo test -- --nocapture
|
|
59
|
-
rtk cargo test -- --nocapture
|
|
60
|
-
|
|
61
|
-
# Run tests in specific module
|
|
62
|
-
cargo test <module_name>::
|
|
63
|
-
rtk cargo test <module_name>::
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
### Linting & Quality
|
|
67
|
-
```bash
|
|
68
|
-
# Check without building
|
|
69
|
-
cargo check # raw
|
|
70
|
-
rtk cargo check # preferred (token-optimized)
|
|
71
|
-
|
|
72
|
-
# Format code
|
|
73
|
-
cargo fmt # passthrough (0% savings, but works)
|
|
74
|
-
|
|
75
|
-
# Run clippy lints
|
|
76
|
-
cargo clippy # raw
|
|
77
|
-
rtk cargo clippy # preferred (token-optimized)
|
|
78
|
-
|
|
79
|
-
# Check all targets
|
|
80
|
-
cargo clippy --all-targets
|
|
81
|
-
rtk cargo clippy --all-targets
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
### Package Building
|
|
85
|
-
```bash
|
|
86
|
-
# Build DEB package (Linux)
|
|
87
|
-
cargo install cargo-deb
|
|
88
|
-
cargo deb
|
|
89
|
-
|
|
90
|
-
# Build RPM package (Fedora/RHEL)
|
|
91
|
-
cargo install cargo-generate-rpm
|
|
92
|
-
cargo build --release
|
|
93
|
-
cargo generate-rpm
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
## Architecture
|
|
97
|
-
|
|
98
|
-
### Core Design Pattern
|
|
99
|
-
|
|
100
|
-
rtk uses a **command proxy architecture** with specialized modules for each output type:
|
|
101
|
-
|
|
102
|
-
```
|
|
103
|
-
main.rs (CLI entry)
|
|
104
|
-
→ Clap command parsing
|
|
105
|
-
→ Route to specialized modules
|
|
106
|
-
→ tracking.rs (SQLite) records token savings
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
### Key Architectural Components
|
|
110
|
-
|
|
111
|
-
**1. Command Modules** (src/*_cmd.rs, src/git.rs, src/container.rs)
|
|
112
|
-
- Each module handles a specific command type (git, grep, etc.)
|
|
113
|
-
- Responsible for executing underlying commands and transforming output
|
|
114
|
-
- Implement token-optimized formatting strategies
|
|
115
|
-
|
|
116
|
-
**2. Core Filtering** (src/filter.rs)
|
|
117
|
-
- Language-aware code filtering (Rust, Python, JavaScript, etc.)
|
|
118
|
-
- Filter levels: `none`, `minimal`, `aggressive`
|
|
119
|
-
- Strips comments, whitespace, and function bodies (aggressive mode)
|
|
120
|
-
- Used by `read` and `smart` commands
|
|
121
|
-
|
|
122
|
-
**3. Token Tracking** (src/tracking.rs)
|
|
123
|
-
- SQLite-based persistent storage (~/.local/share/rtk/tracking.db)
|
|
124
|
-
- Records: original_cmd, rtk_cmd, input_tokens, output_tokens, savings_pct
|
|
125
|
-
- 90-day retention policy with automatic cleanup
|
|
126
|
-
- Powers the `rtk gain` analytics command
|
|
127
|
-
- **Configurable database path**: Via `RTK_DB_PATH` env var or `config.toml`
|
|
128
|
-
- Priority: env var > config file > default location
|
|
129
|
-
|
|
130
|
-
**4. Configuration System** (src/config.rs, src/init.rs)
|
|
131
|
-
- Manages CLAUDE.md initialization (global vs local)
|
|
132
|
-
- Reads ~/.config/rtk/config.toml for user preferences
|
|
133
|
-
- `rtk init` command bootstraps LLM integration
|
|
134
|
-
- **New**: `tracking.database_path` field for custom DB location
|
|
135
|
-
|
|
136
|
-
**5. Tee Output Recovery** (src/tee.rs)
|
|
137
|
-
- Saves raw unfiltered output to `~/.local/share/rtk/tee/` on command failure
|
|
138
|
-
- Prints one-line hint `[full output: ~/.local/share/rtk/tee/...]` so LLMs can read instead of re-run
|
|
139
|
-
- Configurable via `[tee]` section in config.toml or env vars (`RTK_TEE`, `RTK_TEE_DIR`)
|
|
140
|
-
- Default mode: failures only, skip outputs < 500 chars, 20 file rotation, 1MB cap
|
|
141
|
-
- Silent error handling: tee failure never affects command output or exit code
|
|
142
|
-
|
|
143
|
-
**6. Shared Utilities** (src/utils.rs)
|
|
144
|
-
- Common functions for command modules: truncate, strip_ansi, execute_command
|
|
145
|
-
- Package manager auto-detection (pnpm/yarn/npm/npx)
|
|
146
|
-
- Consistent error handling and output formatting
|
|
147
|
-
- Used by all modern JavaScript/TypeScript tooling commands
|
|
148
|
-
|
|
149
|
-
### Command Routing Flow
|
|
150
|
-
|
|
151
|
-
All commands follow this pattern:
|
|
152
|
-
```rust
|
|
153
|
-
main.rs:Commands enum
|
|
154
|
-
→ match statement routes to module
|
|
155
|
-
→ module::run() executes logic
|
|
156
|
-
→ tracking::track_command() records metrics
|
|
157
|
-
→ Result<()> propagates errors
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
### Proxy Mode
|
|
161
|
-
|
|
162
|
-
**Purpose**: Execute commands without filtering but track usage for metrics.
|
|
163
|
-
|
|
164
|
-
**Usage**: `rtk proxy <command> [args...]`
|
|
165
|
-
|
|
166
|
-
**Benefits**:
|
|
167
|
-
- **Bypass RTK filtering**: Workaround bugs or get full unfiltered output
|
|
168
|
-
- **Track usage metrics**: Measure which commands Claude uses most (visible in `rtk gain --history`)
|
|
169
|
-
- **Guaranteed compatibility**: Always works even if RTK doesn't implement the command
|
|
170
|
-
- **Prototyping**: Test new commands before implementing optimized filtering
|
|
171
|
-
|
|
172
|
-
**Examples**:
|
|
173
|
-
```bash
|
|
174
|
-
# Full git log output (no truncation)
|
|
175
|
-
rtk proxy git log --oneline -20
|
|
176
|
-
|
|
177
|
-
# Raw npm output (no filtering)
|
|
178
|
-
rtk proxy npm install express
|
|
179
|
-
|
|
180
|
-
# Any command works
|
|
181
|
-
rtk proxy curl https://api.example.com/data
|
|
182
|
-
|
|
183
|
-
# Tracking shows 0% savings (expected)
|
|
184
|
-
rtk gain --history | grep proxy
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
**Tracking**: All proxy commands appear in `rtk gain --history` with 0% savings (input = output) but preserve usage statistics.
|
|
188
|
-
|
|
189
|
-
### Critical Implementation Details
|
|
190
|
-
|
|
191
|
-
**Git Argument Handling** (src/git.rs)
|
|
192
|
-
- Uses `trailing_var_arg = true` + `allow_hyphen_values = true` to properly handle git flags
|
|
193
|
-
- Auto-detects `--merges` flag to avoid conflicting with `--no-merges` injection
|
|
194
|
-
- Propagates git exit codes for CI/CD reliability (PR #5 fix)
|
|
195
|
-
|
|
196
|
-
**Output Filtering Strategy**
|
|
197
|
-
- Compact mode: Show only summary/failures
|
|
198
|
-
- Full mode: Available with `-v` verbosity flags
|
|
199
|
-
- Test output: Show only failures (90% token reduction)
|
|
200
|
-
- Git operations: Ultra-compressed confirmations ("ok ✓")
|
|
201
|
-
|
|
202
|
-
**Language Detection** (src/filter.rs)
|
|
203
|
-
- File extension-based with fallback heuristics
|
|
204
|
-
- Supports Rust, Python, JS/TS, Java, Go, C/C++, etc.
|
|
205
|
-
- Tokenization rules vary by language (comments, strings, blocks)
|
|
206
|
-
|
|
207
|
-
### Module Responsibilities
|
|
208
|
-
|
|
209
|
-
| Module | Purpose | Token Strategy |
|
|
210
|
-
|--------|---------|----------------|
|
|
211
|
-
| git.rs | Git operations | Stat summaries + compact diffs |
|
|
212
|
-
| grep_cmd.rs | Code search | Group by file, truncate lines |
|
|
213
|
-
| ls.rs | Directory listing | Tree format, aggregate counts |
|
|
214
|
-
| read.rs | File reading | Filter-level based stripping |
|
|
215
|
-
| runner.rs | Command execution | Stderr only (err), failures only (test) |
|
|
216
|
-
| log_cmd.rs | Log parsing | Deduplication with counts |
|
|
217
|
-
| json_cmd.rs | JSON inspection | Structure without values |
|
|
218
|
-
| lint_cmd.rs | ESLint/Biome linting | Group by rule, file summary (84% reduction) |
|
|
219
|
-
| tsc_cmd.rs | TypeScript compiler | Group by file/error code (83% reduction) |
|
|
220
|
-
| next_cmd.rs | Next.js build/dev | Route metrics, bundle stats only (87% reduction) |
|
|
221
|
-
| prettier_cmd.rs | Format checking | Files needing changes only (70% reduction) |
|
|
222
|
-
| playwright_cmd.rs | E2E test results | Failures only, grouped by suite (94% reduction) |
|
|
223
|
-
| prisma_cmd.rs | Prisma CLI | Strip ASCII art and verbose output (88% reduction) |
|
|
224
|
-
| gh_cmd.rs | GitHub CLI | Compact PR/issue/run views (26-87% reduction) |
|
|
225
|
-
| vitest_cmd.rs | Vitest test runner | Failures only with ANSI stripping (99.5% reduction) |
|
|
226
|
-
| pnpm_cmd.rs | pnpm package manager | Compact dependency trees (70-90% reduction) |
|
|
227
|
-
| ruff_cmd.rs | Ruff linter/formatter | JSON for check, text for format (80%+ reduction) |
|
|
228
|
-
| pytest_cmd.rs | Pytest test runner | State machine text parser (90%+ reduction) |
|
|
229
|
-
| mypy_cmd.rs | Mypy type checker | Group by file/error code (80% reduction) |
|
|
230
|
-
| pip_cmd.rs | pip/uv package manager | JSON parsing, auto-detect uv (70-85% reduction) |
|
|
231
|
-
| go_cmd.rs | Go commands | NDJSON for test, text for build/vet (80-90% reduction) |
|
|
232
|
-
| golangci_cmd.rs | golangci-lint | JSON parsing, group by rule (85% reduction) |
|
|
233
|
-
| tee.rs | Full output recovery | Save raw output to file on failure, print hint for LLM re-read |
|
|
234
|
-
| utils.rs | Shared utilities | Package manager detection, common formatting |
|
|
235
|
-
| discover/ | Claude Code history analysis | Scan JSONL sessions, classify commands, report missed savings |
|
|
236
|
-
|
|
237
|
-
## Performance Constraints
|
|
238
|
-
|
|
239
|
-
RTK has **strict performance targets** to maintain zero-overhead CLI experience:
|
|
240
|
-
|
|
241
|
-
| Metric | Target | Verification Method |
|
|
242
|
-
|--------|--------|---------------------|
|
|
243
|
-
| **Startup time** | <10ms | `hyperfine 'rtk git status' 'git status'` |
|
|
244
|
-
| **Memory overhead** | <5MB resident | `/usr/bin/time -l rtk git status` (macOS) |
|
|
245
|
-
| **Token savings** | 60-90% | Verify in tests with `count_tokens()` assertions |
|
|
246
|
-
| **Binary size** | <5MB stripped | `ls -lh target/release/rtk` |
|
|
247
|
-
|
|
248
|
-
**Performance regressions are release blockers** - always benchmark before/after changes:
|
|
249
|
-
|
|
250
|
-
```bash
|
|
251
|
-
# Before changes
|
|
252
|
-
hyperfine 'rtk git log -10' --warmup 3 > /tmp/before.txt
|
|
253
|
-
|
|
254
|
-
# After changes
|
|
255
|
-
cargo build --release
|
|
256
|
-
hyperfine 'target/release/rtk git log -10' --warmup 3 > /tmp/after.txt
|
|
257
|
-
|
|
258
|
-
# Compare (should be <10ms)
|
|
259
|
-
diff /tmp/before.txt /tmp/after.txt
|
|
260
|
-
```
|
|
261
|
-
|
|
262
|
-
**Why <10ms matters**: Claude Code users expect CLI tools to be instant. Any perceptible delay (>10ms) breaks the developer flow. RTK achieves this through:
|
|
263
|
-
- **Zero async overhead**: Single-threaded, no tokio runtime
|
|
264
|
-
- **Lazy regex compilation**: Compile once with `lazy_static!`, reuse forever
|
|
265
|
-
- **Minimal allocations**: Borrow over clone, in-place filtering
|
|
266
|
-
- **No user config**: Zero file I/O on startup (config loaded on-demand)
|
|
267
|
-
|
|
268
|
-
## Error Handling
|
|
269
|
-
|
|
270
|
-
RTK follows Rust best practices for error handling:
|
|
271
|
-
|
|
272
|
-
**Rules**:
|
|
273
|
-
- **anyhow::Result** for CLI binary (RTK is an application, not a library)
|
|
274
|
-
- **ALWAYS** use `.context("description")` with `?` operator
|
|
275
|
-
- **NO unwrap()** in production code (tests only - use `expect("explanation")` if needed)
|
|
276
|
-
- **Graceful degradation**: If filter fails, fallback to raw command execution
|
|
277
|
-
|
|
278
|
-
**Example**:
|
|
279
|
-
|
|
280
|
-
```rust
|
|
281
|
-
use anyhow::{Context, Result};
|
|
282
|
-
|
|
283
|
-
pub fn filter_git_log(input: &str) -> Result<String> {
|
|
284
|
-
let lines: Vec<_> = input
|
|
285
|
-
.lines()
|
|
286
|
-
.filter(|line| !line.is_empty())
|
|
287
|
-
.collect();
|
|
288
|
-
|
|
289
|
-
// ✅ RIGHT: Context on error
|
|
290
|
-
let hash = extract_hash(lines[0])
|
|
291
|
-
.context("Failed to extract commit hash from git log")?;
|
|
292
|
-
|
|
293
|
-
// ❌ WRONG: No context
|
|
294
|
-
let hash = extract_hash(lines[0])?;
|
|
295
|
-
|
|
296
|
-
// ❌ WRONG: Panic in production
|
|
297
|
-
let hash = extract_hash(lines[0]).unwrap();
|
|
298
|
-
|
|
299
|
-
Ok(format!("Commit: {}", hash))
|
|
300
|
-
}
|
|
301
|
-
```
|
|
302
|
-
|
|
303
|
-
**Fallback pattern** (critical for all filters):
|
|
304
|
-
|
|
305
|
-
```rust
|
|
306
|
-
// ✅ RIGHT: Fallback to raw command if filter fails
|
|
307
|
-
pub fn execute_with_filter(cmd: &str, args: &[&str]) -> Result<()> {
|
|
308
|
-
match get_filter(cmd) {
|
|
309
|
-
Some(filter) => match filter.apply(cmd, args) {
|
|
310
|
-
Ok(output) => println!("{}", output),
|
|
311
|
-
Err(e) => {
|
|
312
|
-
eprintln!("Filter failed: {}, falling back to raw", e);
|
|
313
|
-
execute_raw(cmd, args)?;
|
|
314
|
-
}
|
|
315
|
-
},
|
|
316
|
-
None => execute_raw(cmd, args)?,
|
|
317
|
-
}
|
|
318
|
-
Ok(())
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
// ❌ WRONG: Panic if no filter
|
|
322
|
-
pub fn execute_with_filter(cmd: &str, args: &[&str]) -> Result<()> {
|
|
323
|
-
let filter = get_filter(cmd).expect("Filter must exist");
|
|
324
|
-
filter.apply(cmd, args)?;
|
|
325
|
-
Ok(())
|
|
326
|
-
}
|
|
327
|
-
```
|
|
328
|
-
|
|
329
|
-
## Common Pitfalls
|
|
330
|
-
|
|
331
|
-
**Don't add async dependencies** (kills startup time)
|
|
332
|
-
- RTK is single-threaded by design
|
|
333
|
-
- Adding tokio/async-std adds ~5-10ms startup overhead
|
|
334
|
-
- Use blocking I/O with fallback to raw command
|
|
335
|
-
|
|
336
|
-
**Don't recompile regex at runtime** (kills performance)
|
|
337
|
-
- ❌ WRONG: `let re = Regex::new(r"pattern").unwrap();` inside function
|
|
338
|
-
- ✅ RIGHT: `lazy_static! { static ref RE: Regex = Regex::new(r"pattern").unwrap(); }`
|
|
339
|
-
|
|
340
|
-
**Don't panic on filter failure** (breaks user workflow)
|
|
341
|
-
- Always fallback to raw command execution
|
|
342
|
-
- Log error to stderr, execute original command unchanged
|
|
343
|
-
|
|
344
|
-
**Don't assume command output format** (breaks across versions)
|
|
345
|
-
- Test with real fixtures from multiple versions
|
|
346
|
-
- Use flexible regex patterns that tolerate format changes
|
|
347
|
-
|
|
348
|
-
**Don't skip cross-platform testing** (macOS ≠ Linux ≠ Windows)
|
|
349
|
-
- Shell escaping differs: bash/zsh vs PowerShell
|
|
350
|
-
- Path separators differ: `/` vs `\`
|
|
351
|
-
- Line endings differ: LF vs CRLF
|
|
352
|
-
|
|
353
|
-
**Don't break pipe compatibility** (users expect Unix behavior)
|
|
354
|
-
- `rtk git status | grep modified` must work
|
|
355
|
-
- Preserve stdout/stderr separation
|
|
356
|
-
- Respect exit codes (0 = success, non-zero = failure)
|
|
357
|
-
|
|
358
|
-
## Fork-Specific Features
|
|
359
|
-
|
|
360
|
-
### PR #5: Git Argument Parsing Fix (CRITICAL)
|
|
361
|
-
- **Problem**: Git flags like `--oneline`, `--cached` were rejected
|
|
362
|
-
- **Solution**: Fixed Clap parsing with proper trailing_var_arg configuration
|
|
363
|
-
- **Impact**: All git commands now accept native git flags
|
|
364
|
-
|
|
365
|
-
### PR #6: pnpm Support
|
|
366
|
-
- **New Commands**: `rtk pnpm list`, `rtk pnpm outdated`, `rtk pnpm install`
|
|
367
|
-
- **Token Savings**: 70-90% reduction on package manager operations
|
|
368
|
-
- **Security**: Package name validation prevents command injection
|
|
369
|
-
|
|
370
|
-
### PR #9: Modern JavaScript/TypeScript Tooling (2026-01-29)
|
|
371
|
-
- **New Commands**: 6 commands for T3 Stack workflows
|
|
372
|
-
- `rtk lint`: ESLint/Biome with grouped rule violations (84% reduction)
|
|
373
|
-
- `rtk tsc`: TypeScript compiler errors grouped by file/code (83% reduction)
|
|
374
|
-
- `rtk next`: Next.js build with route/bundle metrics (87% reduction)
|
|
375
|
-
- `rtk prettier`: Format checker showing files needing changes (70% reduction)
|
|
376
|
-
- `rtk playwright`: E2E test results showing failures only (94% reduction)
|
|
377
|
-
- `rtk prisma`: Prisma CLI without ASCII art (88% reduction)
|
|
378
|
-
- **Shared Infrastructure**: utils.rs module for package manager auto-detection
|
|
379
|
-
- **Features**: Exit code preservation, error grouping, consistent formatting
|
|
380
|
-
- **Testing**: Validated on a production T3 Stack project
|
|
381
|
-
|
|
382
|
-
### Python & Go Support (2026-02-12)
|
|
383
|
-
- **Python Commands**: 3 commands for Python development workflows
|
|
384
|
-
- `rtk ruff check/format`: Ruff linter/formatter with JSON (check) and text (format) parsing (80%+ reduction)
|
|
385
|
-
- `rtk pytest`: Pytest test runner with state machine text parser (90%+ reduction)
|
|
386
|
-
- `rtk pip list/outdated/install`: pip package manager with auto-detect uv (70-85% reduction)
|
|
387
|
-
- **Go Commands**: 4 commands via sub-enum for Go ecosystem
|
|
388
|
-
- `rtk go test`: NDJSON line-by-line parser for interleaved events (90%+ reduction)
|
|
389
|
-
- `rtk go build`: Text filter showing errors only (80% reduction)
|
|
390
|
-
- `rtk go vet`: Text filter for issues (75% reduction)
|
|
391
|
-
- `rtk golangci-lint`: JSON parsing grouped by rule (85% reduction)
|
|
392
|
-
- **Architecture**: Standalone Python commands (mirror lint/prettier), Go sub-enum (mirror git/cargo)
|
|
393
|
-
- **Patterns**: JSON for structured output (ruff check, golangci-lint, pip), NDJSON streaming (go test), text state machine (pytest), text filters (go build/vet, ruff format)
|
|
394
|
-
|
|
395
|
-
## Testing Strategy
|
|
396
|
-
|
|
397
|
-
### TDD Workflow (mandatory)
|
|
398
|
-
All code follows Red-Green-Refactor. See `.claude/skills/rtk-tdd/` for the full workflow and Rust-idiomatic patterns. See `.claude/skills/rtk-tdd/references/testing-patterns.md` for RTK-specific patterns and untested module backlog.
|
|
399
|
-
|
|
400
|
-
### Test Architecture
|
|
401
|
-
- **Unit tests**: Embedded `#[cfg(test)] mod tests` in each module (105+ tests, 25+ files)
|
|
402
|
-
- **Smoke tests**: `scripts/test-all.sh` (69 assertions on all commands)
|
|
403
|
-
- **Dominant pattern**: raw string input -> filter function -> assert output contains/excludes
|
|
404
|
-
|
|
405
|
-
### Pre-commit gate
|
|
406
|
-
```bash
|
|
407
|
-
cargo fmt --all --check && rtk cargo clippy --all-targets && rtk cargo test
|
|
408
|
-
```
|
|
409
|
-
|
|
410
|
-
### Test commands
|
|
411
|
-
```bash
|
|
412
|
-
cargo test # All tests
|
|
413
|
-
cargo test filter::tests:: # Module-specific
|
|
414
|
-
cargo test -- --nocapture # With stdout
|
|
415
|
-
bash scripts/test-all.sh # Smoke tests (installed binary required)
|
|
416
|
-
```
|
|
417
|
-
|
|
418
|
-
## Dependencies
|
|
419
|
-
|
|
420
|
-
Core dependencies (see Cargo.toml):
|
|
421
|
-
- **clap**: CLI parsing with derive macros
|
|
422
|
-
- **anyhow**: Error handling
|
|
423
|
-
- **rusqlite**: SQLite for tracking database
|
|
424
|
-
- **regex**: Pattern matching for filtering
|
|
425
|
-
- **ignore**: gitignore-aware file traversal
|
|
426
|
-
- **colored**: Terminal output formatting
|
|
427
|
-
- **serde/serde_json**: Configuration and JSON parsing
|
|
428
|
-
|
|
429
|
-
## Build Optimizations
|
|
430
|
-
|
|
431
|
-
Release profile (Cargo.toml:31-36):
|
|
432
|
-
- `opt-level = 3`: Maximum optimization
|
|
433
|
-
- `lto = true`: Link-time optimization
|
|
434
|
-
- `codegen-units = 1`: Single codegen for better optimization
|
|
435
|
-
- `strip = true`: Remove debug symbols
|
|
436
|
-
- `panic = "abort"`: Smaller binary size
|
|
437
|
-
|
|
438
|
-
## CI/CD
|
|
439
|
-
|
|
440
|
-
GitHub Actions workflow (.github/workflows/release.yml):
|
|
441
|
-
- Multi-platform builds (macOS, Linux x86_64/ARM64, Windows)
|
|
442
|
-
- DEB/RPM package generation
|
|
443
|
-
- Automated releases on version tags (v*)
|
|
444
|
-
- Checksums for binary verification
|
|
445
|
-
|
|
446
|
-
## Build Verification (Mandatory)
|
|
447
|
-
|
|
448
|
-
**CRITICAL**: After ANY Rust file edits, ALWAYS run the full quality check pipeline before committing:
|
|
449
|
-
|
|
450
|
-
```bash
|
|
451
|
-
cargo fmt --all && cargo clippy --all-targets && cargo test --all
|
|
452
|
-
```
|
|
453
|
-
|
|
454
|
-
**Rules**:
|
|
455
|
-
- Never commit code that hasn't passed all 3 checks
|
|
456
|
-
- Fix ALL clippy warnings before moving on (zero tolerance)
|
|
457
|
-
- If build fails, fix it immediately before continuing to next task
|
|
458
|
-
- Pre-commit hook will auto-enforce this (see `.claude/hooks/bash/pre-commit-format.sh`)
|
|
459
|
-
|
|
460
|
-
**Why**: RTK is a production CLI tool used by developers in their workflows. Bugs break developer productivity. Quality gates prevent regressions and maintain user trust.
|
|
461
|
-
|
|
462
|
-
**Performance verification** (for filter changes):
|
|
463
|
-
|
|
464
|
-
```bash
|
|
465
|
-
# Benchmark before/after
|
|
466
|
-
hyperfine 'rtk git log -10' --warmup 3
|
|
467
|
-
cargo build --release
|
|
468
|
-
hyperfine 'target/release/rtk git log -10' --warmup 3
|
|
469
|
-
|
|
470
|
-
# Memory profiling
|
|
471
|
-
/usr/bin/time -l target/release/rtk git status # macOS
|
|
472
|
-
/usr/bin/time -v target/release/rtk git status # Linux
|
|
473
|
-
```
|
|
474
|
-
|
|
475
|
-
## Testing Policy
|
|
476
|
-
|
|
477
|
-
**Manual testing is REQUIRED** for filter changes and new commands:
|
|
478
|
-
|
|
479
|
-
- **For new filters**: Test with real command (`rtk <cmd>`), verify output matches expectations
|
|
480
|
-
- Example: `rtk git log -10` → inspect output, verify condensed correctly
|
|
481
|
-
- Example: `rtk cargo test` → verify only failures shown, not full output
|
|
482
|
-
|
|
483
|
-
- **For hook changes**: Test in real Claude Code session, verify command rewriting works
|
|
484
|
-
- Create test Claude Code session
|
|
485
|
-
- Type raw command (e.g., `git status`)
|
|
486
|
-
- Verify hook rewrites to `rtk git status`
|
|
487
|
-
|
|
488
|
-
- **For performance**: Run `hyperfine` comparison (before/after), verify <10ms startup
|
|
489
|
-
- Benchmark baseline: `hyperfine 'rtk git status' --warmup 3`
|
|
490
|
-
- Make changes, rebuild
|
|
491
|
-
- Benchmark again: `hyperfine 'target/release/rtk git status' --warmup 3`
|
|
492
|
-
- Compare results: startup time should be <10ms
|
|
493
|
-
|
|
494
|
-
- **For cross-platform**: Test on macOS + Linux (Docker) + Windows (CI), verify shell escaping
|
|
495
|
-
- macOS (zsh): Test locally
|
|
496
|
-
- Linux (bash): Use Docker `docker run --rm -v $(pwd):/rtk -w /rtk rust:latest cargo test`
|
|
497
|
-
- Windows (PowerShell): Trust CI/CD pipeline or test manually if available
|
|
498
|
-
|
|
499
|
-
**Anti-pattern**: Running only automated tests (`cargo test`, `cargo clippy`) without actually executing `rtk <cmd>` and inspecting output.
|
|
500
|
-
|
|
501
|
-
**Example**: If fixing the `git log` filter, run `rtk git log -10` and verify:
|
|
502
|
-
1. Output is condensed (shorter than raw `git log -10`)
|
|
503
|
-
2. Critical info preserved (commit hashes, messages)
|
|
504
|
-
3. Format is readable and consistent
|
|
505
|
-
4. Exit code matches git's exit code (0 for success)
|
|
506
|
-
|
|
507
|
-
## Working Directory Confirmation
|
|
508
|
-
|
|
509
|
-
**ALWAYS confirm working directory before starting any work**:
|
|
510
|
-
|
|
511
|
-
```bash
|
|
512
|
-
pwd # Verify you're in the rtk project root
|
|
513
|
-
git branch # Verify correct branch (main, feature/*, etc.)
|
|
514
|
-
```
|
|
515
|
-
|
|
516
|
-
**Never assume** which project to work in. Always verify before file operations.
|
|
517
|
-
|
|
518
|
-
## Avoiding Rabbit Holes
|
|
519
|
-
|
|
520
|
-
**Stay focused on the task**. Do not make excessive operations to verify external APIs, documentation, or edge cases unless explicitly asked.
|
|
521
|
-
|
|
522
|
-
**Rule**: If verification requires more than 3-4 exploratory commands, STOP and ask the user whether to continue or trust available info.
|
|
523
|
-
|
|
524
|
-
**Examples of rabbit holes to avoid**:
|
|
525
|
-
- Excessive regex pattern testing (trust snapshot tests, don't manually verify 20 edge cases)
|
|
526
|
-
- Deep diving into external command documentation (use fixtures, don't research git/cargo internals)
|
|
527
|
-
- Over-testing cross-platform behavior (test macOS + Linux, trust CI for Windows)
|
|
528
|
-
- Verifying API signatures across multiple crate versions (use docs.rs if needed, don't clone repos)
|
|
529
|
-
|
|
530
|
-
**When to stop and ask**:
|
|
531
|
-
- "Should I research X external API behavior?" → ASK if it requires >3 commands
|
|
532
|
-
- "Should I test Y edge case?" → ASK if not mentioned in requirements
|
|
533
|
-
- "Should I verify Z across N platforms?" → ASK if N > 2
|
|
534
|
-
|
|
535
|
-
## Plan Execution Protocol
|
|
536
|
-
|
|
537
|
-
When user provides a numbered plan (QW1-QW4, Phase 1-5, sprint tasks, etc.):
|
|
538
|
-
|
|
539
|
-
1. **Execute sequentially**: Follow plan order unless explicitly told otherwise
|
|
540
|
-
2. **Commit after each logical step**: One commit per completed phase/task
|
|
541
|
-
3. **Never skip or reorder**: If a step is blocked, report it and ask before proceeding
|
|
542
|
-
4. **Track progress**: Use task list (TaskCreate/TaskUpdate) for plans with 3+ steps
|
|
543
|
-
5. **Validate assumptions**: Before starting, verify all referenced file paths exist and working directory is correct
|
|
544
|
-
|
|
545
|
-
**Why**: Plan-driven execution produces better outcomes than ad-hoc implementation. Structured plans help maintain focus and prevent scope creep.
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
## Filter Development Checklist
|
|
549
|
-
|
|
550
|
-
When adding a new filter (e.g., `rtk newcmd`):
|
|
551
|
-
|
|
552
|
-
### Implementation
|
|
553
|
-
- [ ] Create filter module in `src/<cmd>_cmd.rs` (or extend existing)
|
|
554
|
-
- [ ] Add `lazy_static!` regex patterns for parsing (compile once, reuse)
|
|
555
|
-
- [ ] Implement fallback to raw command on error (graceful degradation)
|
|
556
|
-
- [ ] Preserve exit codes (`std::process::exit(code)` if non-zero)
|
|
557
|
-
|
|
558
|
-
### Testing
|
|
559
|
-
- [ ] Write snapshot test with real command output fixture (`tests/fixtures/<cmd>_raw.txt`)
|
|
560
|
-
- [ ] Verify token savings ≥60% with `count_tokens()` assertion
|
|
561
|
-
- [ ] Test cross-platform shell escaping (macOS, Linux, Windows)
|
|
562
|
-
- [ ] Write unit tests for edge cases (empty output, errors, unicode, ANSI codes)
|
|
563
|
-
|
|
564
|
-
### Integration
|
|
565
|
-
- [ ] Register filter in main.rs Commands enum
|
|
566
|
-
- [ ] Update README.md with new command support and token savings %
|
|
567
|
-
- [ ] Update CHANGELOG.md with feature description
|
|
568
|
-
|
|
569
|
-
### Quality Gates
|
|
570
|
-
- [ ] Run `cargo fmt --all && cargo clippy --all-targets && cargo test`
|
|
571
|
-
- [ ] Benchmark startup time with `hyperfine` (verify <10ms)
|
|
572
|
-
- [ ] Test manually: `rtk <cmd>` and inspect output for correctness
|
|
573
|
-
- [ ] Verify fallback: Break filter intentionally, confirm raw command executes
|
|
574
|
-
|
|
575
|
-
### Documentation
|
|
576
|
-
- [ ] Add command to this CLAUDE.md Module Responsibilities table
|
|
577
|
-
- [ ] Document token savings % (from tests)
|
|
578
|
-
- [ ] Add usage examples to README.md
|
|
579
|
-
|
|
580
|
-
**Example workflow** (adding `rtk newcmd`):
|
|
581
|
-
|
|
582
|
-
```bash
|
|
583
|
-
# 1. Create module
|
|
584
|
-
touch src/newcmd_cmd.rs
|
|
585
|
-
|
|
586
|
-
# 2. Write test first (TDD)
|
|
587
|
-
echo 'raw command output fixture' > tests/fixtures/newcmd_raw.txt
|
|
588
|
-
# Add test in src/newcmd_cmd.rs
|
|
589
|
-
|
|
590
|
-
# 3. Implement filter
|
|
591
|
-
# Add lazy_static regex, implement logic, add fallback
|
|
592
|
-
|
|
593
|
-
# 4. Quality checks
|
|
594
|
-
cargo fmt --all && cargo clippy --all-targets && cargo test
|
|
595
|
-
|
|
596
|
-
# 5. Benchmark
|
|
597
|
-
hyperfine 'rtk newcmd args'
|
|
598
|
-
|
|
599
|
-
# 6. Manual test
|
|
600
|
-
rtk newcmd args
|
|
601
|
-
# Inspect output, verify condensed
|
|
602
|
-
|
|
603
|
-
# 7. Document
|
|
604
|
-
# Update README.md, CHANGELOG.md, this file
|
|
605
|
-
```
|