Commit 60ec2ae
committed
fix(cli): wire /tokens and /cache as aliases for /stats; implement /stats
Dogfood found that /tokens and /cache had spec entries (resume_supported:
true) but no parse arms in the command parser, resulting in:
'Unknown slash command: /tokens — Did you mean /tokens'
(the suggestion engine found the spec entry but parsing always failed)
Fix three things:
1. Add 'tokens' | 'cache' as aliases for 'stats' in the parse match so
the commands actually resolve to SlashCommand::Stats
2. Implement SlashCommand::Stats in the REPL dispatch — previously fell
through to 'Command registered but not yet implemented'. Now shows
cumulative token usage for the session.
3. Implement SlashCommand::Stats in run_resume_command — previously
returned 'unsupported resumed slash command'. Now emits:
text: Cost / Input tokens / Output tokens / Cache create / Cache read
json: {kind:stats, input_tokens, output_tokens, cache_*, total_tokens}
159 CLI tests pass, fmt clean.1 parent 5f6f453 commit 60ec2ae
2 files changed
Lines changed: 21 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1340 | 1340 | | |
1341 | 1341 | | |
1342 | 1342 | | |
1343 | | - | |
| 1343 | + | |
1344 | 1344 | | |
1345 | 1345 | | |
1346 | 1346 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2811 | 2811 | | |
2812 | 2812 | | |
2813 | 2813 | | |
| 2814 | + | |
| 2815 | + | |
| 2816 | + | |
| 2817 | + | |
| 2818 | + | |
| 2819 | + | |
| 2820 | + | |
| 2821 | + | |
| 2822 | + | |
| 2823 | + | |
| 2824 | + | |
| 2825 | + | |
| 2826 | + | |
| 2827 | + | |
| 2828 | + | |
2814 | 2829 | | |
2815 | 2830 | | |
2816 | 2831 | | |
| |||
2847 | 2862 | | |
2848 | 2863 | | |
2849 | 2864 | | |
2850 | | - | |
2851 | 2865 | | |
2852 | 2866 | | |
2853 | 2867 | | |
| |||
3847 | 3861 | | |
3848 | 3862 | | |
3849 | 3863 | | |
| 3864 | + | |
| 3865 | + | |
| 3866 | + | |
| 3867 | + | |
| 3868 | + | |
3850 | 3869 | | |
3851 | 3870 | | |
3852 | 3871 | | |
3853 | 3872 | | |
3854 | | - | |
3855 | 3873 | | |
3856 | 3874 | | |
3857 | 3875 | | |
| |||
0 commit comments