feat: implement stats command#3832
Conversation
| return yargs.option("days", { | ||
| describe: "show stats for the last N days (default: 7)", | ||
| type: "number", | ||
| default: 7, | ||
| }) |
There was a problem hiding this comment.
can we default to all time, also can we have some breakdown per project? Or have a global or some other flag
There was a problem hiding this comment.
Hey! Removed the default days to all time.
Quick question about the project breakdown. I've implemented an --all flag that toggles between current project and all projects. But I'm wondering if you wanted a more detailed breakdown showing stats for each project separately?
Current implementation:
opencode stats→ current project onlyopencode stats --all→ all projects combined
Let me know if you'd prefer a different approach!
|
there have definitely been context7 calls in the past year I think I had some yesterday are we hiding some number of tools? |
c69a308 to
9edc1ed
Compare
Yes! The original code was limiting this to top 10 tools with How should we approach to this? |
|
we could add some flag for # of tools and default to all |
| .option("all", { | ||
| describe: "show stats across all projects (default: current project only)", | ||
| type: "boolean", | ||
| default: false, | ||
| }) |
There was a problem hiding this comment.
let's make this a project flag, that is a string,
if not added:
- all
if added but empty:
- current project
if added and has a value:
- use that project id
There was a problem hiding this comment.
Perfect, changed it to --project flag with the behavior you described:
- Not provided → all projects
- Empty string → current project (
opencode stats --project "") - Specific value → that project ID (
opencode stats --project <id>)
Let me know if this works!
9edc1ed to
fb3b75a
Compare
Done! Added Usage:
|
|
looking good! should be good to merge when i get back from grocery store |



Description
Closes #1634
Implements the
/statscommand to aggregate token usage and costs across all sessions.Usage
What it shows
Implementation
--daysflag (default: 7 days)Performance
Tested on M4 Pro, 24GB RAM:
Unsure how it scales with 100+ or 1000+ sessions.
Feedback welcome if anyone's willing to test at scale.
Screenshots