fix: use getClaudePaths for multi-directory support#129
Conversation
- Remove claudePath parameter from data loading functions in all commands - This allows the data loader to check multiple Claude directories automatically - Supports both ~/.config/claude and ~/.claude paths - Fixes 'No Claude usage data found' error when data exists in alternate locations
There was a problem hiding this comment.
Summary of Changes
Hello @nicobailon, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request refactors how Claude usage data is located and loaded by various commands. It removes the need for commands to explicitly provide a claudePath, instead enabling the data loader to automatically discover usage data across multiple common directory locations. This change resolves issues where data might not be found if stored in alternative, yet valid, paths.
Highlights
- Data Loading Enhancement: The
claudePathparameter has been removed from data loading function calls acrossblocks,daily,monthly, andsessioncommands. This delegates the responsibility of path discovery to the underlying data loader, which now supports multiple Claude data directories. - Multi-Directory Support: The system now automatically checks common Claude data locations (e.g.,
~/.config/claudeand~/.claude), improving robustness and user experience by preventing 'No Claude usage data found' errors when data exists in alternate, yet valid, paths. - Simplified Command Logic: Commands like
blocks,daily,monthly, andsessionare simplified by no longer needing to manage or pass theclaudePath, making their code cleaner and more maintainable. - Improved Debugging: The
detectMismatchesfunction indaily,monthly, andsessioncommands has also been updated to leverage the new automatic path discovery, ensuring debug information is gathered from all relevant locations.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Code Review
The pull request removes the claudePath parameter from data loading functions, enabling the data loader to automatically check multiple Claude directories, supporting both ~/.config/claude and ~/.claude paths. This fixes the 'No Claude usage data found' error when data exists in alternate locations. I have suggested a few minor improvements to the code.
| // Show debug information if requested | ||
| if (ctx.values.debug && !ctx.values.json) { | ||
| const mismatchStats = await detectMismatches(getDefaultClaudePath()); | ||
| const mismatchStats = await detectMismatches(undefined); |
There was a problem hiding this comment.
Passing undefined explicitly here might not be the most readable approach. Consider if there's a way to omit the parameter entirely when ctx.values.debug is false to simplify the call.
| const mismatchStats = await detectMismatches(undefined); | |
| const mismatchStats = await detectMismatches(); |
| // Show debug information if requested | ||
| if (ctx.values.debug && !ctx.values.json) { | ||
| const mismatchStats = await detectMismatches(getDefaultClaudePath()); | ||
| const mismatchStats = await detectMismatches(undefined); |
There was a problem hiding this comment.
Passing undefined explicitly here might not be the most readable approach. Consider if there's a way to omit the parameter entirely when ctx.values.debug is false to simplify the call.
| const mismatchStats = await detectMismatches(undefined); | |
| const mismatchStats = await detectMismatches(); |
| // Show debug information if requested | ||
| if (ctx.values.debug && !ctx.values.json) { | ||
| const mismatchStats = await detectMismatches(getDefaultClaudePath()); | ||
| const mismatchStats = await detectMismatches(undefined); |
There was a problem hiding this comment.
Passing undefined explicitly here might not be the most readable approach. Consider if there's a way to omit the parameter entirely when ctx.values.debug is false to simplify the call.
| const mismatchStats = await detectMismatches(undefined); | |
| const mismatchStats = await detectMismatches(); |
commit: |
There was a problem hiding this comment.
Pull Request Overview
This PR removes the explicit usage of the default Claude path in several commands to enable multi-directory support, allowing for automatic detection of usage data in both ~/.config/claude and ~/.claude.
- Removed the claudePath parameter from data loading functions and their corresponding calls.
- Updated debug functionality to pass an undefined value instead of getDefaultClaudePath.
- Similar changes applied across session, monthly, daily, and blocks commands.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/commands/session.ts | Removed claudePath parameter and updated detectMismatches call. |
| src/commands/monthly.ts | Removed claudePath parameter and updated detectMismatches call. |
| src/commands/daily.ts | Removed claudePath parameter and updated detectMismatches call. |
| src/commands/blocks.ts | Removed claudePath parameter from session block loading. |
| // Show debug information if requested | ||
| if (ctx.values.debug && !ctx.values.json) { | ||
| const mismatchStats = await detectMismatches(getDefaultClaudePath()); | ||
| const mismatchStats = await detectMismatches(undefined); |
There was a problem hiding this comment.
[nitpick] If detectMismatches has a default parameter for handling undefined, consider omitting the argument entirely to enhance clarity.
| const mismatchStats = await detectMismatches(undefined); | |
| const mismatchStats = await detectMismatches(); |
| // Show debug information if requested | ||
| if (ctx.values.debug && !ctx.values.json) { | ||
| const mismatchStats = await detectMismatches(getDefaultClaudePath()); | ||
| const mismatchStats = await detectMismatches(undefined); |
There was a problem hiding this comment.
[nitpick] If detectMismatches supports a default value when no argument is provided, consider calling it without passing undefined directly.
| const mismatchStats = await detectMismatches(undefined); | |
| const mismatchStats = await detectMismatches(); |
| // Show debug information if requested | ||
| if (ctx.values.debug && !ctx.values.json) { | ||
| const mismatchStats = await detectMismatches(getDefaultClaudePath()); | ||
| const mismatchStats = await detectMismatches(undefined); |
There was a problem hiding this comment.
[nitpick] To improve code clarity, consider invoking detectMismatches without parameters if the function already defaults to checking multiple directories.
fix: use getClaudePaths for multi-directory support

Summary by CodeRabbit