rtk gain reports a missing hook on only one of its five views — never on the empty report, where it matters most
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 81.1k
- Forks
- 5.1k
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 40
Description
Summary
rtk gain reports a missing or outdated hook on only one of its five invocations: the default view, and only when there is tracking data. --daily, --weekly, --monthly, --all and the empty report all stay silent.
The empty report is the worst case. With no hook installed nothing is tracked, so "no data" is usually caused by the missing hook — and that is exactly the run where the user is told nothing:
$ rtk gain
No tracking data yet.
Run some rtk commands to start tracking savings.
The advice never appears, because rtk gain is also exempt from the daily [rtk] /!\ No hook installed reminder — it is exempt on the grounds that it prints its own.
Cause
In src/analytics/gain.rs, the hook_check::status() block sits inside the default-view branch (if !daily && !weekly && !monthly && !all), which is itself after the summary.total_commands == 0 early return. Two gates, so four of five views and the empty report never reach it.
Reproduction
Measured with an isolated HOME holding a .claude directory and no hook registered, counting [warn] No hook installed lines:
| invocation | warnings |
|---|---|
rtk gain (with data) |
1 |
rtk gain --daily |
0 |
rtk gain --weekly |
0 |
rtk gain --all |
0 |
rtk gain (empty database) |
0 |
Expected
Every text view reports it, including the empty one. The JSON and CSV exports return before this point and should stay free of it.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/analytics/gain.rs and trace the summary.total_commands == 0 early return and the hook_check::status() block inside the default-view branch. Check each text invocation listed in the reproduction, while preserving the early returns for JSON and CSV exports. Done means every text view, including an empty report, reports the missing or outdated hook.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 85/100