mirror of
https://github.com/rtk-ai/rtk.git
synced 2026-09-19 07:33:17 +08:00
dev-0.35.0-rc.86
14 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
8fae5b067d |
Release v0.31.0 — develop → master (#666)
* fix: P1 exit codes, grep regex perf, SQLite WAL (#631) * fix: P1 exit codes, grep regex perf, SQLite concurrency Exit code propagation (same pattern as existing modules): - wget_cmd: run() and run_stdout() now exit on failure - container: docker_logs, kubectl_pods/services/logs now check status before parsing JSON (was showing "No pods found" on error) - pnpm_cmd: replace bail!() with eprint + process::exit in run_list and run_install Performance: - grep_cmd: compile context regex once before loop instead of per-line in clean_line() (was N compilations per grep call) Data integrity: - tracking: add PRAGMA journal_mode=WAL and busy_timeout=5000 to prevent SQLite corruption with concurrent Claude Code instances Signed-off-by: Patrick <patrick@rtk.ai> Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu> * fix: address review findings on P1 fixes - tracking: WAL pragma non-fatal (NFS/read-only compat) - wget: forward raw stderr on failure, track raw==raw (no fake savings) - container: remove stderr shadow in docker_logs, add empty-stderr guard on all 4 new exit code paths for consistency with prisma pattern Signed-off-by: Patrick <patrick@rtk.ai> Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu> --------- Signed-off-by: Patrick <patrick@rtk.ai> Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu> * fix: raise output caps for P0 bugs (#617, #618, #620) (#630) * fix: raise output caps for grep, git status, and parser fallback (#617, #618, #620) - grep: per-file match cap 10 → 25, global max 50 → 200 - git status: file list caps 5/5/3 → 15/15/10 - parser fallback: truncate 500 → 2000 chars across all modules These P0 bugs caused LLM retry loops when RTK returned less signal than the raw command, making RTK worse than not using it. Fixes #617, #618, #620 Signed-off-by: Patrick <patrick@rtk.ai> Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu> * fix: update README example and add truncation tests for modified/untracked - parser/README.md: update example from 500 → 2000 to match code - git.rs: add test_format_status_modified_truncation (cap 15) - git.rs: add test_format_status_untracked_truncation (cap 10) Signed-off-by: Patrick <patrick@rtk.ai> Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu> * refactor: extract output caps into [limits] config section Move hardcoded caps into config.toml so users can tune them: [limits] grep_max_results = 200 # global grep match limit grep_max_per_file = 25 # per-file match limit status_max_files = 15 # staged/modified file list cap status_max_untracked = 10 # untracked file list cap passthrough_max_chars = 2000 # parser fallback truncation All 8 modules now read from config::limits() instead of hardcoded values. Defaults unchanged from previous commit. Signed-off-by: Patrick <patrick@rtk.ai> Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu> --------- Signed-off-by: Patrick <patrick@rtk.ai> Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu> * feat(.claude): add /rtk-triage skill — cross-analysis of PRs and issues (#662) * feat(.claude): add /rtk-triage skill — orchestrated PR+issue cross-analysis New skill that runs issue-triage + pr-triage in parallel then produces a cross-analysis layer that neither skill can do individually: - Double coverage detection: identifies when 2+ PRs target the same issue (via body scan + file overlap), recommends which to keep/close - Security gap detection: for security review issues, maps each finding to a PR (or flags it as uncovered) - P0/P1 bugs without PR: groups by pattern to suggest sprint batching - Our dirty PRs: identifies probable cause (conflict with sibling PR, needs rebase, missing linked issue) Output is saved automatically to claudedocs/RTK-YYYY-MM-DD.md. Usage: /rtk-triage (French, auto-save) /rtk-triage en (English output) Signed-off-by: Florian Bruniaux <florian@bel-etage.com> Signed-off-by: Florian BRUNIAUX <florian@bruniaux.com> * docs(architecture): update module count to 66 Sync ARCHITECTURE.md with current main.rs state. Previous count (60) was stale since several modules were added (dotnet_cmd, dotnet_format_report, dotnet_trx, npm_cmd, gt_cmd, etc.). Signed-off-by: Florian Bruniaux <florian@bel-etage.com> Signed-off-by: Florian BRUNIAUX <florian@bruniaux.com> --------- Signed-off-by: Florian Bruniaux <florian@bel-etage.com> Signed-off-by: Florian BRUNIAUX <florian@bruniaux.com> * fix: subcommand routing drops unrecognized subcommands (#600) (#601) - git stash: pass unknown subcommands (save, branch, clear) through instead of silently falling back to git stash push - git branch: add --show-current, --set-upstream-to, --format, --sort to flag detection so they don't get overridden by -a injection - pip: replace bail!() with passthrough for unknown subcommands (freeze, download, wheel, etc.) Fixes #600 Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu> * fix: resolve cargo fmt + 54 clippy warnings blocking CI (#663) cargo fmt diffs in config.rs, git.rs, playwright_cmd.rs were failing the fmt CI check, which cascaded to block clippy/test/security on PRs #632, #635, #638. Also fixes all clippy warnings: dead code annotations, iterator simplifications, assert patterns, and unnecessary allocations. Signed-off-by: Patrick Szymkowiak <patrick@rtk-ai.app> Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu> * fix: discover absolute paths + git global options (#485, #163) (#518) * fix: discover classifies absolute paths like /usr/bin/grep (#485) Normalize absolute binary paths before classification: /usr/bin/grep → grep, /bin/ls → ls, /usr/local/bin/git → git Adds strip_absolute_path() helper + 5 tests. Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu> * fix: discover and rewrite support git global options -C, --no-pager, etc. (#163) Strip git global options (-C <path>, -c <key=val>, --git-dir, --work-tree, --no-pager, --no-optional-locks, --bare, --literal-pathspecs) before classification so git -C /tmp status is recognized as rtk git. Rewrite preserves global options: git -C /tmp status → rtk git -C /tmp status Adds GIT_GLOBAL_OPT lazy_static regex + strip_git_global_opts() helper + 6 tests. Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu> --------- Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu> * fix: prevent double `--` separator in cargo clippy with -p flags (#519) When running `rtk cargo clippy -p my-crate -- -D warnings`, Clap with `trailing_var_arg = true` preserves the `--` in parsed args when flags precede it. `restore_double_dash()` then added a second `--`, producing `cargo clippy -p my-crate -- -- -D warnings`. This caused rustc to interpret `-D` as a filename instead of a lint flag. Fix: skip restoration when args already contain `--` (Clap preserved it). Fixes #496 Signed-off-by: Ousama Ben Younes <benyounes.ousama@gmail.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> * ci: add PR template + target branch check (#521) - PR template reminds contributors to target develop - CI workflow labels PRs targeting master with 'wrong-base' and posts a comment - Excludes develop→master PRs (maintainer releases) Signed-off-by: Patrick <patrick@rtk-ai.com> Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu> * fix: prevent rtk read from corrupting JSON/YAML/data files (#522) Add Language::Data variant for data formats (JSON, YAML, TOML, XML, CSV, etc.) with empty comment patterns to prevent comment stripping. AggressiveFilter falls back to MinimalFilter for data files. Fixes #464 Signed-off-by: Ousama Ben Younes <benyounes.ousama@gmail.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> * fix: skip rewriting find/fd in pipes to preserve xargs compatibility (#439) (#563) rtk find outputs a grouped format incompatible with pipe consumers like xargs, grep, wc, sort. Skip rewrite when find/fd is followed by a pipe, preserving native one-per-line output. Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu> * fix: add hint when git diff is truncated + fix --no-compact passthrough (#427) (#564) When compact_diff truncates output, append a hint line so Claude knows how to get the full diff: [full diff: rtk git diff --no-compact] Also fix --no-compact flag being passed to git (causing usage error) and remove decorative emoji from compact_diff output. Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu> * fix: propagate exit codes in git diff, status+args, commit, and branch (#632) 4 P1 bugs where git exit codes were swallowed: - git diff: failure silently printed empty stat output - git status (with args): failure was filtered instead of propagated - git commit: failure printed "FAILED" but returned Ok(()) breaking pre-commit hooks - git branch (list mode): failure was silently ignored All now follow the established pattern: eprint stderr, track raw==raw, process::exit(code). Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu> * feat: add 5 new TOML filters (ollama, nx, gradle, spring-boot, jira) (#635) * feat: add 5 new TOML built-in filters (ollama, nx, gradle, spring-boot, jira) New filters for commands not covered by Rust modules: - ollama: strip ANSI spinners, keep final text response (#624) - nx: strip Nx monorepo noise, keep build results (#444) - gradle/gradlew: strip UP-TO-DATE tasks, keep build summary (#147) - spring-boot: strip banner and verbose logs, keep startup/errors (#147) - jira: strip blanks, truncate wide columns (#524) All 5 filters pass inline tests via rtk verify (123/123). Updated builtin filter count: 47 -> 52. Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu> * feat: add 5 more TOML filters (turbo, mise, just, task, yadm) New filters for task runners and git wrapper: - turbo: strip cache/Tasks/Duration noise, keep task output (#531) - mise: strip install/download progress, keep task results (#607) - just: strip blanks and recipe headers, keep output (#607) - task: strip task headers and up-to-date lines, keep results (#607) - yadm: strip hint lines, compact git-like output (#567) All verified with fake binaries through catch-all TOML engine. 137/137 TOML tests pass, 934 Rust tests pass. Updated builtin filter count: 52 -> 57. Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu> --------- Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu> * fix: replace emojis with plain text in git status output (#603) (#638) Git status output used emojis (📌, 📝, ❓, ✅, ⚠️) that confuse non-Claude LLMs (GPT, etc.) causing retry loops. Replace with plain text labels (branch:, modified:, staged:, untracked:, conflicts:). Also add "clean — nothing to commit" when working tree is clean, so LLMs understand the repo state without ambiguity. Before: 📌 master After: branch: master clean — nothing to commit Fixes #603 Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu> --------- Signed-off-by: Patrick <patrick@rtk.ai> Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu> Signed-off-by: Florian Bruniaux <florian@bel-etage.com> Signed-off-by: Florian BRUNIAUX <florian@bruniaux.com> Signed-off-by: Patrick Szymkowiak <patrick@rtk-ai.app> Signed-off-by: Ousama Ben Younes <benyounes.ousama@gmail.com> Signed-off-by: Patrick <patrick@rtk-ai.com> Co-authored-by: Florian BRUNIAUX <florian@bruniaux.com> Co-authored-by: Ben Younes <benyounes.ousama@gmail.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> |
||
|
|
f8b7d52d2d |
fix: add tokens_saved to telemetry payload (#471) (#472)
* chore(master): release 0.28.1 (#466) * fix: add tokens_saved_24h and tokens_saved_total to telemetry payload Re-add Tracker::total_tokens_saved() and Tracker::tokens_saved_24h() methods lost during develop→master rebase. Telemetry pings now include actual token savings data alongside the existing install_method field. --------- Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> |
||
|
|
baff6a2334 |
feat: anonymous telemetry ping (1/day, opt-out) (#334)
* feat: add anonymous telemetry ping (1/day, opt-out) Fire-and-forget daily ping to track active installs for BPI metrics. - SHA-256 device hash (hostname:user), no PII - Opt-out: RTK_TELEMETRY_DISABLED=1 or config.toml [telemetry] enabled=false - Token injected at compile time via option_env!, not in source - 23h throttle via marker file, 2s timeout, non-blocking thread * ci: inject RTK_TELEMETRY_TOKEN at build time in release workflow All 3 build jobs (binary, DEB, RPM) now receive the token from GitHub secrets so option_env!() compiles it into release binaries. * refactor: externalize telemetry URL via option_env!(RTK_TELEMETRY_URL) URL and token are both injected at compile time — no hardcoded server address in source code. Builds without the env var simply skip telemetry silently. |
||
|
|
772b5012ed |
feat: passthrough fallback when Clap parse fails + review fixes (#200)
* feat: passthrough fallback when Clap parse fails When RTK cannot parse a command (e.g. `rtk git -C /path status`), instead of exiting with error code 2, it now falls back to running the raw command directly. This keeps developer workflows unbroken. - Replace Cli::parse() with try_parse() + run_fallback() - Add parse_failures SQLite table for failure analytics - Add `rtk gain --failures` / `-F` to view failure log - Fallback preserves stdin/stdout/stderr via Stdio::inherit() - --help and --version still work normally Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: guard RTK meta-commands from fallback to raw execution When Clap fails to parse a meta-command like `rtk gain --badtypo`, show the Clap error directly instead of trying to execute `gain` as a binary from $PATH. Adds RTK_META_COMMANDS constant listing gain, discover, learn, init, config, proxy, hook-audit, cc-economics. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: move timer start before command execution in fallback TimedExecution::start() was called after the command finished, so all fallback commands showed ~0ms in rtk gain --history. Now the timer captures actual command runtime. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: add cleanup_old() call to record_parse_failure() The parse_failures table was never cleaned up because only record() called cleanup_old(). Now parse failures also trigger 90-day retention cleanup. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: strip ANSI codes from Clap error before SQLite storage Clap errors may contain terminal color codes. Strip them with utils::strip_ansi() before storing in the parse_failures table to avoid garbled output and wasted space. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: smoke test cargo test assertion and missing skip_test calls - cargo test check now matches RTK's filtered output format ("passed") in addition to raw "test result:" and "FAILURES" - Fix undefined `skip` calls to use existing `skip_test` function with proper (name, reason) arguments Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: fmt upstream files after rebase Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: update version refs to 0.23.0 and module count to 51 Upstream v0.23.0 release bumped Cargo.toml version and added mypy_cmd module. Update docs to match for CI validation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> |
||
|
|
2b550eebd6 |
feat(gain): add per-project token savings with -p flag (#128)
* feat(gain): add per-project token savings with -p flag Record project_path (cwd) in tracking database and add filtered query methods. `rtk gain -p` shows savings scoped to the current project directory instead of global aggregates. - tracking.rs: Add project_path column with auto-migration, index, and filtered variants for all query methods (summary, daily, weekly, monthly, recent) - gain.rs: Add resolve_project_scope(), shorten_path(), scope-aware header, pass project filter to all queries and exports - main.rs: Add --project/-p flag to Gain command Backward-compatible: existing rows get empty project_path, unfiltered queries delegate to filtered(None) which returns all data. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(tracking): use GLOB instead of LIKE for project path filtering Address reviewer feedback on PR #128: 1. Replace SQL LIKE with GLOB in all project-scoped queries to prevent `_` and `%` characters in path names from being interpreted as wildcards (e.g., `my_project` matching `myXproject`). GLOB uses `*` for wildcard matching which is safer for file system paths. 2. Guard the startup `UPDATE commands SET project_path = ''` migration with an `EXISTS` check so it only runs when NULL rows actually exist, avoiding a no-op UPDATE on every startup after the first migration. 3. Add `DEFAULT ''` to the ALTER TABLE migration so new installs never create NULL project_path values. 4. Add 3 new unit tests for project_filter_params GLOB behavior. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> |
||
|
|
93364b5457 | feat(sqlite): add custom sqlite db location | ||
|
|
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> |
||
|
|
7975624d0a |
feat: audit phase 3 + tracking validation + rtk learn
## Audit Tracking Phase 3 (Steps 0-6) - Systematic tracking integration across all command modules - TimedExecution pattern enforcement (9 files) - Passthrough timing support for interactive commands - Exit code preservation for CI/CD reliability ## Tracking Validation Tests - 6 unit tests in src/tracking.rs (was 0) - estimate_tokens, args_display, DB round-trip - Passthrough non-dilution, TimedExecution timing - 2 UTF-8 tests for gh_cmd truncate() (emoji support) - scripts/test-tracking.sh: end-to-end smoke tests (9 checks) ## rtk learn (CLI Correction Detector) - New module: src/learn/ (detector, report, orchestration) - Analyzes Claude Code JSONL sessions for CLI error patterns - Auto-generates .claude/rules/cli-corrections.md - 18 new tests (detector: 15, report: 3) - Commands: rtk learn [--write-rules] [--since N] [--format json] ## Provider Extensions - ExtractedCommand: +output_content, +is_error, +sequence_index - Backward compatible with existing discover::run() - 3 new provider tests (capture, error flag, sequence) ## Test Results ✓ 201 unit tests passed (183 existing + 18 new) ✓ 9 tracking smoke tests passed ✓ cargo fmt + clippy clean ✓ No deprecation warnings Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> |
||
|
|
a27bce82f0 |
fix: allow git status to accept native flags
Previously, `rtk git status` was the only git subcommand that rejected all arguments. This fix aligns it with other git subcommands (diff, log, show, etc.) by accepting native git flags. Changes: - Extract format_status_output() as pure testable function - Add args variant to Clap Status command with trailing_var_arg - Modify run_status() to accept args parameter - Passthrough mode: if user provides flags (--short, -s, --porcelain), forward directly to git without RTK formatting - Default mode: no flags = RTK compact formatting (unchanged behavior) - Add 5 unit tests for format_status_output (clean, modified, untracked, mixed, truncation) - Add 4 smoke tests for flag passthrough (--short, -s, --porcelain) Test results: - 151 unit tests passed (5 new) - 69 smoke tests passed (4 new for status flags) Fixes the issue where commands like `rtk git status --short` were rejected with "unexpected argument" error. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> |
||
|
|
2a1e1a8ef3 |
feat: add execution time tracking to rtk gain analytics
Add exec_time_ms column to SQLite schema and track execution time for all rtk commands. Display time metrics in gain summary, daily/ weekly/monthly breakdowns, and JSON/CSV exports. Changes: - tracking.rs: Add exec_time_ms column, TimedExecution struct - display_helpers.rs: Add format_duration() helper, update tables - gain.rs: Display total/avg exec time in summary and by-command - All command modules: Apply TimedExecution timer wrapper - Exports: Include total_time_ms and avg_time_ms in JSON/CSV Example output: Total exec time: 24.6s (avg 34ms) rtk cargo test 7 -86.1% 349ms avg rtk git status 111 -84.1% 1ms avg Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> |
||
|
|
ff1c7598c2 |
feat: add discover command, auto-rewrite hook, and git show support
- New `rtk discover` command scans Claude Code JSONL session history to identify missed RTK savings and suggest unhandled commands for issues. Modular architecture: registry (RegexSet classification), provider (SessionProvider trait + ClaudeProvider), report (text/json formatting). - New PreToolUse auto-rewrite hook transparently intercepts Bash commands and rewrites them to rtk equivalents before execution, ensuring 100% adoption across all conversations including subagents. - New `rtk git show` command with compact output: one-line commit summary + stat + compacted diff (reuses compact_diff from git diff). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> |
||
|
|
5b840cca49 |
fix: comprehensive code quality improvements
Apply systematic quality fixes identified in code audit: Phase 1: Remove dead code (4 warnings → 0) - Remove unused run_compact() function in gain.rs - Remove unused track_tokens() function in tracking.rs - Remove unused TRACKER singleton (Mutex) - Clean up CommandRecord struct (remove unused fields) Phase 2: Add error context and quality fixes - Add .context() to all ? operators in cc_economics.rs (15+ callsites) - Add .context() to all ? operators in gain.rs (10+ callsites) - Fix bounds check panic risk in gain.rs:252 (week_start slice) - Reduce visibility: estimate_tokens pub → private - Replace 6 manual loops with idiomatic .collect::<Result<Vec<_>, _>>()? - Remove residual dev comment (// psk:) - Remove unnecessary .clone() in main.rs Phase 3: Refactor duplication (132 lines eliminated) - Create display_helpers.rs module with PeriodStats trait - Unify print_daily_full/weekly/monthly in gain.rs (152 lines → 9 lines) - Implement trait for DayStats, WeekStats, MonthStats - Zero-overhead compile-time dispatch (monomorphization) - Output bit-identical, all tests passing Impact: - Dead code: -20 lines - Error context: Errors now actionable instead of opaque - Duplication: -132 lines of pure duplication - Safety: Bounds check prevents potential panic - Idiomaticity: .collect() over manual loops Metrics: - Build: 0 errors, 1 warning (pre-existing cache_* fields) - Tests: 79/82 passing (3 pre-existing failures) - Clippy: 13 warnings (all pre-existing) - Functional: rtk gain --daily, rtk cc-economics validated Addresses code audit feedback from parallel session Detailed report: claudedocs/refactoring-report.md Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com> |
||
|
|
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> |
||
|
|
f8c9a8165f |
feat: add SQLite tracking, gain command, and CI/CD
- Add SQLite tracking for all commands (90-day history) - Add rtk gain command with ASCII graph visualization - Add config.rs for TOML configuration support - Integrate tracking in all command modules - Add CI/CD workflow for multi-platform releases (deb, rpm, win, mac) - Add LICENSE file and improve .gitignore |