feat: add rtk session command for adoption overview#547
feat: add rtk session command for adoption overview#547aeppling merged 5 commits intortk-ai:developfrom
Conversation
|
Hello, I'm checking with maintainers if we want to implement this, but if we do you will need to document this in rtk documentation. |
|
We want to implement this commands in RTK, however there is some point to be addressed first: Adoption metric always look very low
DOCSDo not forget document this command ! Thanks for contributing ! |
|
Closed the git -C related PR, just add correct documentation and fix and we will merge this PR for both the "rtk session" command and "git -C " fix |
|
Thanks @aeppling! All 3 points addressed: 1. Adoption metric fixed 2. Documentation 3. git -C fix Example output with the fix: |
|
Hey ! I retried with your latest fix, indeed it work better ! But got some trouble with chained commands that still display 0% adoption (example , claude running "cd ./your/app/path && rtk ls" The discover module already handles chained commands. In let parts = split_command_chain(&ext_cmd.command);Could you implement this so our adoption metric always make sense and does not display 0% on chained commands ? If you could also add a testing for those chained command which is kind of edge case for your adoption metric. |
Shows last 10 Claude Code sessions with RTK vs raw command ratio, adoption percentage, and output token count. Reuses ClaudeProvider from discover module — zero JSONL parsing duplication. Also fixes missing `truncate` import in cargo_cmd.rs (pre-existing build error on develop). Closes rtk-ai#487 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Ousama Ben Younes <benyounes.ousama@gmail.com>
Replace trivial progress bar tests with meaningful tests: - Parse JSONL with mixed rtk/raw commands, verify counts - Verify non-Bash tools (Read/Grep) are ignored - Verify empty sessions produce no commands - Test count_rtk_commands with all-rtk, no-rtk, mixed, empty Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Ousama Ben Younes <benyounes.ousama@gmail.com>
The regex pattern for git commands now accepts -C and -c flags before the subcommand, using a non-capturing group to preserve subcommand extraction. Closes rtk-ai#555 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Ousama Ben Younes <benyounes.ousama@gmail.com>
The hook rewrites "git status" → "rtk git status" but JSONL logs the original command. count_rtk_commands now uses classify_command() to also count commands the hook would rewrite, giving realistic adoption percentages (68% vs previous 2%). Also adds rtk session to README.md documentation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Ousama Ben Younes <benyounes.ousama@gmail.com>
Commands like "cd ./path && rtk ls" are now split via split_command_chain() before classification, matching the discover module's behavior. Each part is counted independently. 4 tests added: chain with &&, semicolons, all-supported, and JSONL integration with chained command. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Ousama Ben Younes <benyounes.ousama@gmail.com>
0bfc728 to
127f85c
Compare
|
Thanks @aeppling! Chained commands are already handled in the latest push.
let parts = split_command_chain(&c.command);
for part in &parts {
if part.starts_with("rtk ")
|| matches!(classify_command(part), Classification::Supported { .. })
{ ... }
}So Tests covering this:
|
|
Work well ! Thanks for contributing Merged will be available in next release |
Summary
rtk sessioncommand that displays the last 10 Claude Code sessions with RTK adoption metricsClaudeProviderfromdiscovermodule — zero JSONL parsing duplicationtruncateimport incargo_cmd.rsOutput example
Test plan
cargo run -- sessionon real Claude Code sessionscargo fmt --all && cargo clippy --all-targetsclean (no new warnings)scripts/test-all.shCloses #487
🤖 Generated with Claude Code