Commit Graph

44 Commits

Author SHA1 Message Date
aesoft 2e401ac38f fix(docs): add missing docs for exclude commands patterns 2026-04-19 13:59:03 +02:00
aesoft 176ceb4a7d Merge pull request #1310 from JBF1991/feat/curl-cmd-no-filter
Simplified `rtk curl` Filter
2026-04-18 18:35:39 +02:00
Joshua 80bc7fbd61 documentation 2026-04-15 14:45:30 -05:00
Florian BRUNIAUX 4c9b528206 docs: Adrien review — hierarchy, counts, consistency, gaps
Hierarchy:
- Move troubleshooting.md and what-rtk-covers.md to guide/resources/
- Add guide/resources/telemetry.md (adapted from docs/TELEMETRY.md,
  user-facing: consent, opt-out, GDPR rights — without internal sections)

Content fixes:
- Remove all hardcoded counts (9 ecosystems, 12 agents, 60+, 7 more)
  replaced with qualitative language throughout
- Unify DB filename: tracking.db → history.db everywhere
  (canonical: src/core/constants.rs HISTORY_DB)
- installation.md: replace bare `cargo install rtk` with warning +
  explicit git URL to avoid Rust Type Kit name collision
- supported-agents.md: remove hardcoded agent count
- quick-start.md: remove hardcoded ecosystem list, link to what-rtk-covers

New content:
- gain.md: add --quota section explaining pro/5x/20x tier meanings
- gain.md: add callout linking to discover.md (find missed savings)
- index.md: add "Analyze your usage" section (rtk discover, rtk session)
- configuration.md: clarify ignore_dirs/ignore_files scope, add prose
  link to telemetry.md
- what-rtk-covers.md: clarify --ultra-compact vs git -u short flag conflict

Cross-references:
- All internal links updated for new resources/ paths
- index.md: link to troubleshooting, telemetry, what-rtk-covers, analytics
- discover.md: updated relative link to troubleshooting

README:
- Add Core team section (Patrick Szymkowiak, Florian Bruniaux, Adrien Eppling)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-14 14:17:58 +02:00
aesoft 9e96caa0a1 Merge pull request #355 from KuSh/pnpx+dlx
feat(discover): handle more npm/npx/pnpm/pnpx patterns
2026-04-13 20:31:12 +02:00
Florian BRUNIAUX e09a53e5f7 Merge pull request #1181 from rtk-ai/rgpd-telemetry 2026-04-13 09:26:46 +02:00
Florian BRUNIAUX 4093d5c13d Merge pull request #1094 from rtk-ai/docs/windows-instructions 2026-04-13 09:26:05 +02:00
Nicolas Le Cam 45938b2a4d feat(js): distinguish between jest and vitest and don't rewrite npm test commands as we don't know which test framework is used under the hood
Signed-off-by: Nicolas Le Cam <niko.lecam@gmail.com>
2026-04-12 22:03:39 +02:00
aesoft 2e4cc4bb52 fix(telemetry): consent, erasure, auth, docs 2026-04-12 12:59:22 +02:00
aesoft 6a5bc847e0 fix(telemetry): RGPD-compliant, consent gate, erasure, privacy controls
+ docs update
2026-04-10 16:04:08 +02:00
aesoft cce04811c7 Update troubleshooting.md 2026-04-10 14:22:19 +02:00
Patrick szymkowiak b73506867e docs: add Windows setup instructions and troubleshooting
Windows users downloading the pre-built binary had no guidance —
double-clicking rtk.exe flashes a terminal and exits immediately.

- README: add warning under Windows binary link, add full Windows section
  with WSL vs native comparison table
- installation.md: add pre-built binaries section with Windows note
- supported-agents.md: add Windows support section (CLAUDE.md fallback)
- troubleshooting.md: add "double-click does nothing" and "hook not working"
  entries for Windows users

Prompted by Discord user report (PedroLyra).

Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>
2026-04-09 09:30:58 +02:00
aesoft 66b90f1ed3 Merge pull request #802 from Yosoyepa/feat/add-new-agents
feat(init): add support for kilocode and antigravity agents
2026-04-09 09:28:11 +02:00
aesoft 644c50f786 Merge pull request #1001 from rtk-ai/feat/telemetry-enrichment
feat(telemetry): enrich daily ping with gap detection and quality metrics
2026-04-09 08:57:21 +02:00
yosoyepa d0a3797ec5 feat(init): add native support for Kilo Code and Google Antigravity
Add rtk init --agent kilocode and rtk init --agent antigravity commands.

Kilo Code: installs .kilocode/rules/rtk-rules.md (project-scoped)
Google Antigravity: installs .agents/rules/antigravity-rtk-rules.md (project-scoped)

Both follow the same prompt-level guidance pattern as Cline and Windsurf,
using rules files that instruct the agent to prefix shell commands with rtk.
2026-04-08 15:37:29 -05:00
Patrick szymkowiak be5c0576d9 fix(docs): update TELEMETRY.md to match code after review fixes
- passthrough_top example: "npm ci:8" -> "npm:8" (first word only)
- estimated_savings_usd_30d: $5/Mtok -> $3/Mtok (input pricing)
- Remove needless borrow in build_meta_usage (clippy)

Signed-off-by: Patrick Szymkowiak <patrick@rtk-ai.app>
Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>
2026-04-08 17:30:24 +02:00
Florian BRUNIAUX 6e55f8984c docs: address Adrien's review — structure, missing content, agents
Structure:
- Move docs/README.md → .github/docs-pipeline-contract.md (interface
  contract is not user-facing content)
- Rewrite docs/guide/index.md as a proper landing page with RTK intro,
  flow diagram, and navigation (replaces empty nav stub)
- Move configuration.md → getting-started/configuration.md (sidebar order 4,
  after supported-agents per Adrien's suggestion)

Missing content:
- Add docs/guide/analytics/discover.md: rtk discover (missed savings analysis)
  and rtk session (adoption tracking across sessions)
- Add uninstall instructions to installation.md (rtk init -g --uninstall,
  cargo uninstall, brew uninstall)
- Add global flags section to what-rtk-covers.md (-u/--ultra-compact,
  -v/--verbose)
- Add rtk smart command to what-rtk-covers.md Files section

Agents:
- Update supported-agents.md: 10 agents (was 9)
- Add OpenClaw (TypeScript plugin, before_tool_call)
- Add Mistral Vibe (planned, issue #800)
- Fix GitHub Copilot: VS Code = transparent rewrite via PreToolUse,
  Copilot CLI = deny-with-suggestion (upstream limitation)

Signed-off-by: Florian BRUNIAUX <florian@bruniaux.com>
2026-04-06 11:16:24 +02:00
aesoft f5e7a41046 Merge branch 'develop' into feat/refac-doc 2026-04-06 10:15:32 +02:00
Florian BRUNIAUX a94e9493b3 docs: consolidate to user-facing guide, remove duplicates and legacy flat docs
- Remove docs/reference/ (10 files): duplicates CONTRIBUTING.md, SECURITY.md,
  ARCHITECTURE.md, src/*/README.md (distributed pattern from PR #869)
- Remove docs/architecture/ (5 files): duplicates ARCHITECTURE.md ADRs and diagrams
- Remove docs/guide/commands/ (12 files): showed rtk <cmd> syntax users never type
  (hooks rewrite transparently); content was derived from FEATURES.md
- Remove docs/guide/filters/ (2 files): contributor content, belongs with src/filters/
- Remove docs/guide/analytics/discover.md, economics.md: implementation details
- Remove legacy flat docs/ (6 files): FEATURES.md (FR), TECHNICAL.md, TROUBLESHOOTING.md,
  AUDIT_GUIDE.md, tracking.md, filter-workflow.md — all superseded by guide/ rewrites
  or codebase distributed docs

- Add docs/guide/what-rtk-covers.md: replaces 12 command pages with one user-facing
  overview of 60+ commands by ecosystem, no rtk <cmd> syntax
- Enrich docs/guide/analytics/gain.md: absorb advanced workflows from AUDIT_GUIDE.md
  (CI integration, pandas analysis, cron snapshots)
- Adapt docs/guide/getting-started/quick-start.md: remove rtk <cmd> examples,
  explain hook transparency instead
- Update docs/README.md: single-tab contract, pointer to codebase for technical docs
- Update docs/guide/index.md: clean navigation matching final structure
- Add Mermaid diagrams to src/filters/README.md: build pipeline + filter lookup
  (preserves content from filter-workflow.md in its natural home)

Result: 9 files in docs/guide/ (was 39), zero legacy flat docs, zero duplicates.
Codebase distributed docs (ARCHITECTURE.md, CONTRIBUTING.md, src/*/README.md)
remain the source of truth for technical and contributor content.

Signed-off-by: Florian BRUNIAUX <florian@bruniaux.com>
2026-04-05 21:26:07 +02:00
Florian BRUNIAUX 974db2ff0b docs(phase-4): complete reference, architecture tabs and remaining commands
Guide — 10 new command and analytics pages:
- commands/go.md: go test (NDJSON), golangci-lint
- commands/ruby.md: rspec, rubocop, rake
- commands/dotnet.md: dotnet build/test, binlog, format
- commands/containers.md: docker ps/images/logs/compose, kubectl pods/services/logs
- commands/github-cli.md: gh pr/issue/run, Graphite gt commands
- commands/data.md: json, env, log, curl, wget, aws, psql, summary
- commands/utilities.md: proxy passthrough, global flags, RTK_DISABLED
- filters/creating-filters.md: TOML DSL guide, field reference, inline tests
- analytics/discover.md: rtk discover — missed savings analysis
- analytics/economics.md: rtk cc-economics — dollar savings vs ccusage

Reference tab (9 pages):
- contributing/guide.md: design philosophy, PR process, TOML vs Rust decision
- contributing/security.md: vulnerability reporting, dangerous patterns, dep criteria
- contributing/coding-standards.md: Rust rules, error handling, lazy_static, fallback pattern
- contributing/testing.md: snapshot tests, token accuracy, cross-platform, benchmarks
- internals/command-routing.md: 6-phase lifecycle, exit codes, verbosity, module map
- internals/filter-pipeline.md: 12 filtering strategies, TOML stages, savings by ecosystem
- internals/tracking-system.md: SQLite schema, data flow, token estimation, Tracker API
- internals/hook-engine.md: rewrite registry, compound commands, exit code contract, rtk init
- toml-dsl/specification.md: complete field reference, pipeline order, build compilation

Architecture tab (4 pages):
- diagrams/command-flow.md: end-to-end Mermaid — hook → RTK → LLM
- diagrams/filter-pipeline.md: build pipeline + 8-stage runtime Mermaid
- decisions/why-no-async.md: ADR — single-threaded, <10ms startup constraint
- decisions/proxy-architecture.md: ADR — why CLI proxy over aliases/LD_PRELOAD/hooks-only

All pages carry valid frontmatter (title, description, sidebar.order).
No existing files modified.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Florian BRUNIAUX <florian@bruniaux.com>
2026-04-05 00:18:59 +02:00
Florian BRUNIAUX 25438b29ae docs(guide): add 11 Phase 1 guide pages — full MVP content
Creates the complete user-facing guide for the docs website:

Getting started:
- quick-start.md: 5-minute walkthrough (init, first commands, rtk gain)
- supported-agents.md: Claude Code, Cursor, Copilot, Gemini, Cline, Windsurf,
  Codex, OpenCode — integration tiers, install commands, graceful degradation

Commands (adapted from FEATURES.md, English, --help-first format):
- git.md: status/log/diff/show/add/commit/push/pull/branch + gh CLI
- cargo.md: test/nextest/build/check/clippy/install + generic test/err wrappers
- files.md: ls/read/grep/find/diff/wc/smart with before/after examples
- javascript.md: vitest/playwright/tsc/eslint/prettier/next/pnpm/npm/npx/prisma
- python.md: pytest/ruff/mypy/pip/deps

Reference:
- filters/using-filters.md: 8-stage pipeline, lookup priority, TOML DSL reference,
  Mermaid diagram (adapted from docs/filter-workflow.md)
- analytics/gain.md: rtk gain flags, daily/weekly/monthly breakdowns, export
  formats, token estimation, database management (from docs/AUDIT_GUIDE.md)
- configuration.md: full config.toml reference, env vars, tee system, telemetry
- troubleshooting.md: common issues and fixes (from docs/TROUBLESHOOTING.md)

All pages carry valid frontmatter (title, description, sidebar.order).
No existing files modified.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Florian BRUNIAUX <florian@bruniaux.com>
2026-04-05 00:09:14 +02:00
Florian BRUNIAUX 9c9879c2da docs: add interface contract and Phase 0 stubs for docs reorganization
Creates docs/README.md (interface contract defining 3-tab structure,
required frontmatter, and conventions) and 4 stub pages with valid
frontmatter for docs/guide/, docs/reference/, and docs/architecture/.
These are the prerequisites for the prepare-docs.mjs pipeline (Plan B)
and for Adrien's Phase 1 content work.

No existing files modified.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Florian BRUNIAUX <florian@bruniaux.com>
2026-04-04 23:54:16 +02:00
Patrick szymkowiak e766ab2b2d docs(telemetry): add dedicated TELEMETRY.md with full field reference
Comprehensive telemetry documentation covering:
- Why we collect (roadmap prioritization, filter quality, value measurement)
- How it works (daily ping, background thread, fire-and-forget)
- Every field with example values and purpose
- What is NOT collected (explicit exclusion list)
- Opt-out instructions
- Data handling and privacy guarantees
- Contributor guide for adding new fields

Link added from README.md privacy section.

Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>
2026-04-03 14:01:29 +02:00
aesoft deda44f736 fix(docs): clean some docs + disclaimer 2026-04-02 21:33:38 +02:00
aesoft bae7930119 fix(review): PR #934 2026-03-31 20:43:59 +02:00
aesoft 14265b48c3 Merge pull request #933 from rtk-ai/maintainers-apply-doc
fix(docs): add maintainers docs
2026-03-30 19:56:32 +02:00
aesoft 0c3aad8156 Update MAINTAINERS_APPLY.md 2026-03-30 19:45:04 +02:00
aesoft 2f7278ac59 fix(docs): add documentation 2026-03-30 19:36:27 +02:00
Adrien Eppling f3217a467b fix(registry): quoted env prefix + inline regex cleanup + routing docs
- ENV_PREFIX now handles FOO="bar baz", FOO='val', escaped quotes
- Move 6 inline lazy_static regex to module level
- Merge rewrite_head_numeric + rewrite_tail_lines → rewrite_line_range
- Consolidate head/tail call sites in rewrite_segment
- Add rewrite pipeline documentation to TECHNICAL.md
- Rewrite discover README as concept/flow documentation
- Add lexer-based tokenizer for shell command parsing

Co-Authored-By: Andrew Hundt <ATHundt@gmail.com>
2026-03-30 17:58:03 +02:00
aesoft f7ec883a78 fix(telemetry): docs + real info from "rtk init -g" 2026-03-27 19:28:43 +01:00
aesoft 0925cf21e0 fix(docs): last review 2026-03-25 19:12:46 +01:00
aesoft 46fa31c4b8 chore(refacto-codebase): Folders + Technical docs
- codebase more clear for humans and AI agents
- alignement on vision and filter quality in technical docs
2026-03-24 22:14:35 +01:00
aesoft f1ac236e46 fix: start folder & docs refacto 2026-03-23 19:00:52 +01:00
Artiom Tofan 2e194efb3a fix: resolve Windows command wrapper execution (#269)
- add PATHEXT-aware command resolution via which\n- migrate affected command runners to resolved_command\n- add regression coverage for wrapper/fallback behavior
2026-03-12 15:36:19 +01:00
José Almeida 064cb3ea65 feat: add OpenCode plugin support (#300)
* feat(opencode): add OpenCode plugin support

Add `--opencode` flag to `rtk init` for installing a global OpenCode
plugin that rewrites Bash/shell commands through `rtk rewrite`.

- New plugin: hooks/opencode-rtk.ts (thin delegator to rtk rewrite)
- New init modes: --opencode (OpenCode only), combinable with Claude modes
- Plugin install/update/remove lifecycle with idempotent writes
- Uninstall cleans up OpenCode plugin alongside Claude Code artifacts
- `rtk init --show` reports OpenCode plugin status
- Replace unreachable!() with bail!() in match exhaustiveness guard

* docs: add OpenCode plugin documentation

- README: OpenCode plugin section, install flags, troubleshooting
- TROUBLESHOOTING: OpenCode-specific checklist
- Update init mode table to reflect Claude Code default
2026-03-11 22:13:03 +01:00
Florian BRUNIAUX 926e6a0dd4 feat: TOML Part 2 — user-global config, shadow warning, rtk init templates, 4 new built-in filters (#351)
* docs: update module count to 58 (toml_filter + verify_cmd)

* docs: bump version refs to 0.27.1, fix module count to 59

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat: TOML DSL PR 2 — user-global config, shadow warning, init templates, 4 new filters

- toml_filter: add ~/.config/rtk/filters.toml (priority 2, between project and built-in)
- toml_filter: shadow warning when match_command overlaps a Rust-handled command
- init: rtk init generates .rtk/filters.toml template (local) and ~/.config/rtk/filters.toml (global)
- builtin_filters: add pre-commit, helm, gcloud, ansible-playbook (46/46 inline tests)
- README: add "Custom Filters" section with lookup table, primitives, examples, built-in list

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* feat(filters): add quarto-render, pnpm-build, trunk-build from rtk discover data (52/52 tests)

* feat(filters): add docker-inspect, sops, docker-compose-ps built-in filters

Resolves issues #279, #277, #276 as TOML-native filters (no Rust required).

- docker-inspect: strip_ansi + truncate_lines_at=120 + max_lines=60
- sops: strip_ansi + strip_lines_matching blank lines + max_lines=40
- docker-compose-ps: strip_ansi + truncate_lines_at=120 + max_lines=40

6 inline tests added (2 per filter), all passing.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* refactor(filters): split monolithic builtin_filters.toml into 28 individual files

Replace the 848-line src/builtin_filters.toml monolith with individual
files under src/filters/<name>.toml (1 filter + tests per file).

Files are concatenated alphabetically by build.rs at compile time into
OUT_DIR/builtin_filters.toml, then embedded via a BUILTIN_TOML constant
in toml_filter.rs. The build step validates TOML syntax and detects
duplicate filter names across files.

Benefits:
- Zero merge conflicts when multiple PRs add filters (different files)
- Clear PR diffs: "+1 file of 30 lines" vs "+30 lines in 850-line file"
- Easy onboarding: copy any .toml, rename, edit 3 fields — done
- Build-time TOML validation catches syntax errors before tests run

Changes:
- build.rs (new): concat + validate src/filters/*.toml
- Cargo.toml: add [build-dependencies] toml = "0.8"
- src/filters/*.toml (28 files): split from monolith
- src/filters/README.md (new): contributor guide
- src/toml_filter.rs: BUILTIN_TOML const + 5 include_str replacements
- src/builtin_filters.toml: deleted

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* test(filters): add 5 new unit tests for multi-file architecture + wget filter

Unit tests added (toml_filter.rs):
- test_builtin_toml_has_schema_version: ensures build.rs injects schema_version
- test_builtin_all_expected_filters_present: guards against accidental file deletion
- test_builtin_filter_count: exact count check (fails if filter added/removed without update)
- test_builtin_all_filters_have_inline_tests: prevents shipping filters with no tests
- test_new_filter_discoverable_after_concat: simulates build.rs concat, verifies lookup

New built-in filter:
- src/filters/wget.toml: compact wget download output (strips connection/resolution
  noise, short-circuits on 'saved [' to 'ok (downloaded)', 2 inline tests)

Test results: 661/661 unit tests, 60/60 inline TOML filter tests

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* docs: add filter-workflow.md with Mermaid diagrams

Build pipeline + runtime lookup priority, both as Mermaid flowcharts.
Shows the full path from src/filters/*.toml to binary to execution.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: remove dead TOML filters — wget, git-checkout, git-merge, git-remote, cargo-run

These filters were never reachable: Clap routes rtk git/cargo commands
to their dedicated Rust modules before run_fallback is called. The TOML
engine only fires for unknown commands. Shipping dead filters gives false
confidence (inline tests pass, but filters never activate in production).

Also fixes P1-1 from the PR #386 review: wget was in RUST_HANDLED_COMMANDS
and the shadow warning fired at compile time but did not block the build.

Removed: cargo-run.toml, git-checkout.toml, git-merge.toml,
         git-remote.toml, wget.toml

Updated test guards: count 29→24, expected list -5 names,
concat test 30→25.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: remove 3 dead TOML filters + update guards (PR #351)

docker-inspect, docker-compose-ps, and pnpm-build are handled by
container.rs and pnpm_cmd.rs before run_fallback is reached — their
TOML filters never fire. Remove the files to avoid false documentation.

Update toml_filter.rs guards: expected list -3 names, count 24→21,
concat test 25→22. Update CONTRIBUTING.md example count to match.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix: rebase on PR #349 — apply regex anchors, make on_empty, build.rs clippy, docs macOS path

- Add (\\s|$) word-boundary anchors to 6 tofu/mix match_command regexes
  (tofu-plan, tofu-init, tofu-validate, tofu-fmt, mix-format, mix-compile)
- Add on_empty = "make: ok" to make.toml + update existing empty-output test
- Fix build.rs clippy: map_or(false, ...) → is_some_and(..)
- Add macOS alt path note to filter-workflow.md Mermaid diagram

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-10 11:02:18 +01:00
patrick szymkowiak b11fb00cde docs: add comprehensive functional and user guide documentation (#389)
- Create docs/FEATURES.md with all 45+ commands documented (syntax, options, examples, token savings)
- Create docs/GUIDE.md with getting started, workflows per language, Claude Code integration, FAQ, troubleshooting
2026-03-06 19:00:50 +01:00
heAdz0r 606b86ed43 feat(gain): colored dashboard with efficiency meter and impact bars (#129)
* feat(gain): add colored dashboard with efficiency meter and impact bars

Upgrade `rtk gain` output with rich terminal visualization:
- Colored percentage cells (green ≥70%, yellow ≥40%, red <40%)
- Efficiency meter: ASCII progress bar with savings percentage
- Impact bars: proportional block charts per command
- Styled section headers (bold green)
- Command names in bright cyan
- History tier indicators (▲/■/•)
- Dynamic column widths for clean table alignment
- KPI-style key-value layout for summary metrics

All visual features are TTY-aware via std::io::IsTerminal — output
degrades gracefully to plain text when piped or redirected.

No new dependencies (uses existing `colored` crate).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Add dashboard visualization screenshot

Shows colored terminal output of `rtk gain -p` with:
- Project-scoped token savings header
- Efficiency meter with color gradient
- Per-command table with colored Avg% and Impact bars

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 15:50:24 +01:00
Florian BRUNIAUX 8c67a2f1e7 docs: update for hook-first installation mode
## README.md Updates

**Quick Start section:**
- Clear 3-step process: verify → install hook → test
- Prominently recommend `rtk init -g` (hook-first mode)
- Explain 99.5% token savings (2000 → 10 tokens)
- Show alternative modes (--claude-md, local init)

**Configuration section:**
- New comparison table: 4 modes with token costs
- Migration instructions for existing users
- Clarify hook vs CLAUDE.md injection differences

**Auto-Rewrite Hook section:**
- Promote automated install (`rtk init -g`) as primary method
- Keep manual install as fallback
- Add verification step (`rtk init --show`)

## INSTALL.md Updates

**Project Initialization:**
- Recommend global hook-first setup (with rationale)
- Show token savings: 99.5% reduction
- Document local setup as alternative
- Add upgrade/migration guide for existing users

## TROUBLESHOOTING.md Updates

**RTK not working section:**
- Option A: Automated (`rtk init -g`) - recommended
- Option B: Manual install - fallback
- Clarify absolute path requirement in settings.json
- Add verification step

## Fixes Documentation Gaps

Before:
- ❌ No mode comparison
- ❌ No migration guide
- ❌ Manual install only
- ❌ Unclear token impact

After:
- ✅ Clear mode comparison with use cases
- ✅ Automatic migration documented
- ✅ Automated install prioritized
- ✅ Quantified token savings (99.5%)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-07 15:28:39 +01:00
Florian BRUNIAUX 521eb1b9bc docs(tracking): complete API documentation + rustdoc comments
Add comprehensive documentation for tracking.rs public APIs:

**New Files:**
- docs/tracking.md (12 pages)
  - Architecture & data flow
  - All public APIs (12 methods, 7 types)
  - Usage examples (basic, CI/CD, dashboards, Rust lib)
  - JSON/CSV export schemas
  - Database schema & migrations
  - Integration examples (GitHub Actions, Python, Rust)
  - Security, performance, troubleshooting

- claudedocs/TRACKING_DOCUMENTATION.md
  - Documentation summary & metrics

**Updated Files:**
- src/tracking.rs
  - Module-level docs (//!)
  - Comprehensive doc comments (///) for all public APIs
  - Examples with error handling
  - Deprecation notices for legacy functions

- README.md
  - Pointer to docs/tracking.md after rtk gain section

**Coverage:**
- 7 public structs documented
- 12 public methods documented
- 3 utility functions documented
- 20+ code examples
- 3 integration examples (CI/CD, dashboards, Rust lib)
- JSON/CSV/SQL schemas

**Testing:**
- All 6 tracking tests still pass
- 100% coverage maintained

Closes gap: CLI was documented, but public APIs were not.
Now fully documented for external integration (CI/CD, dashboards, Rust lib usage).

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-03 11:22:20 +01:00
patrick szymkowiak 15a34aef04 Fix installation script URL and update project info
Updated installation instructions and clarified project details.
2026-02-02 20:19:41 +01:00
Florian BRUNIAUX 00623cb80e docs: point all documentation to upstream instead of fork
## Problem
Documentation incorrectly promoted the fork over upstream for installation,
creating confusion about which repository is the source of truth.

## Changes

### Installation Instructions
- **README.md**: Restored curl install pointing to upstream (pszymkowiak/rtk)
- **README.md**: Removed "Fork with All Features" section
- **INSTALL.md**: Added curl install, removed fork recommendation
- **TROUBLESHOOTING.md**: All installation paths → upstream

### Repository References
- **README.md**: Removed fork from repo list, issues → rtk-ai/rtk
- **CLAUDE.md**: Removed fork mention from project list
- **CHANGELOG.md**: Repository and issues → rtk-ai/rtk
- **ROADMAP.md**: Installation instructions → upstream curl

### Scripts
- **check-installation.sh**: Install instructions → upstream curl

## Result
All documentation now consistently points to upstream (rtk-ai/rtk, pszymkowiak/rtk)
as the source of truth for installation and issues.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-02 18:39:18 +01:00
Florian BRUNIAUX e2e8be42a7 docs: clarify rtk name collision and fix installation confusion
## Problem
Users are accidentally installing the wrong "rtk" package:
- Rust Type Kit (reachingforthejack/rtk) - type generation tool
- Rust Token Killer (rtk-ai/rtk) - LLM token optimizer

This causes confusion when `rtk gain` doesn't exist after installation.

## Changes

### Documentation Updates
- **README.md**: Add prominent warning about name collision at top
- **README.md**: Fix installation instructions with mandatory verification
- **CLAUDE.md**: Add name collision warning with verification steps
- **INSTALL.md**: Clarify pre-installation checks and wrong package handling

### New Files
- **docs/TROUBLESHOOTING.md**: Comprehensive troubleshooting guide covering:
  - Wrong rtk installed (Type Kit vs Token Killer)
  - cargo install rtk pitfalls
  - Missing commands (vitest, pnpm, etc.)
  - PATH issues and compilation errors

- **scripts/check-installation.sh**: Automated diagnostic script that verifies:
  - RTK installed and in PATH
  - Correct version (Token Killer with `rtk gain`)
  - Available features
  - Claude Code integration status
  - Auto-rewrite hook configuration

## Verification
After these changes, users can quickly diagnose installation issues:
```bash
bash scripts/check-installation.sh
```

Fixes installation confusion reported by multiple users.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-02 15:20:39 +01:00
Florian BRUNIAUX 76703ca3f5 feat: add comprehensive temporal audit system for token savings analytics
Implement day-by-day, week-by-week, and monthly breakdowns with JSON/CSV export
capabilities for in-depth token savings analysis and reporting.

New Features:
- Daily breakdown (--daily): Complete day-by-day statistics without 30-day limit
- Weekly breakdown (--weekly): Sunday-to-Saturday week aggregations with date ranges
- Monthly breakdown (--monthly): Calendar month aggregations (YYYY-MM format)
- Combined view (--all): All temporal breakdowns in single output
- JSON export (--format json): Structured data for APIs, dashboards, scripts
- CSV export (--format csv): Tabular data for Excel, Google Sheets, data science

Technical Implementation:
- src/tracking.rs: Add DayStats, WeekStats, MonthStats structures with Serialize
- src/tracking.rs: Implement get_all_days(), get_by_week(), get_by_month() SQL queries
- src/main.rs: Extend Commands::Gain with --daily, --weekly, --monthly, --all, --format flags
- src/gain.rs: Add print_daily_full(), print_weekly(), print_monthly() display functions
- src/gain.rs: Implement export_json() and export_csv() for data export

Documentation:
- docs/AUDIT_GUIDE.md: Comprehensive guide with examples, workflows, integrations
- README.md: Update Data section with new audit commands and export formats
- claudedocs/audit-feature-summary.md: Technical summary and implementation details

Database Scope:
- Global machine storage: ~/.local/share/rtk/history.db
- Shared across all projects, worktrees, and Claude sessions
- 90-day retention policy with automatic cleanup
- SQLite with indexed timestamp for fast aggregations

Use Cases:
- Trend analysis: identify daily/weekly patterns in token usage
- Cost reporting: monthly savings reports for budget tracking
- Data science: export CSV/JSON for pandas, R, Excel analysis
- Dashboards: integrate JSON export with Chart.js, D3.js, Grafana
- CI/CD: automated weekly/monthly savings reports via GitHub Actions

Examples:
  rtk gain --daily                    # Day-by-day breakdown
  rtk gain --weekly                   # Weekly aggregations
  rtk gain --all                      # All breakdowns combined
  rtk gain --all --format json | jq . # JSON export with jq
  rtk gain --all --format csv         # CSV for Excel/analysis

Backwards Compatibility:
- All existing flags (--graph, --history, --quota) preserved
- Default behavior unchanged (summary view)
- No database migration required
- Zero breaking changes

Performance:
- Efficient SQL aggregations with timestamp index
- No impact on rtk command execution speed
- Instant queries even with 90 days of data

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-30 11:12:45 +01:00