fix\!: remove all deprecated functions#150
Conversation
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Summary of Changes
Hello @ryoppippi, 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 focuses on cleaning up the codebase by removing deprecated functions and their associated test cases. I've systematically replaced all usages of dateSchema with filterDateSchema and getDefaultClaudePath() with getClaudePaths(), ensuring the system uses the most current and robust APIs. This change, while introducing breaking changes, improves maintainability and prepares the project for future enhancements by eliminating legacy code paths.
Highlights
- Deprecated Schema Removal: I've removed the deprecated
dateSchemafromsrc/_types.tsand updated all its usages tofilterDateSchemainsrc/_shared-args.tsandsrc/mcp.ts. - Deprecated Path Function Removal: I've removed the deprecated
getDefaultClaudePath()function and its associated test cases fromsrc/data-loader.ts. All calls to this function have been replaced withgetClaudePaths(). - Migration to
getClaudePaths(): The codebase has been updated to usegetClaudePaths()instead ofgetDefaultClaudePath(). This includes changes insrc/commands/blocks.ts,src/commands/mcp.ts,src/debug.ts, andsrc/mcp.ts. Error handling has been added wheregetClaudePaths()might return an empty array, ensuring that a valid Claude data directory is found. - Breaking Changes: This PR introduces breaking changes by removing
dateSchemaandgetDefaultClaudePath(). Consumers must update their code to usefilterDateSchemaandgetClaudePaths()respectively, as detailed in the PR description's migration guide.
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. ↩
commit: |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
ccusage-guide | a6edcbe | Commit Preview URL | Jun 22 2025, 09:40 AM |
There was a problem hiding this comment.
Code Review
This pull request removes deprecated functions and updates the codebase to use the new filterDateSchema and getClaudePaths functions. The changes include updates to shared arguments, commands, data loading, debugging, and MCP server functionalities. The removal of the deprecated functions and their associated tests ensures a cleaner and more maintainable codebase.
There was a problem hiding this comment.
There was a problem hiding this comment.
It's good that you're throwing an error when no Claude data directory is found, but consider if it would be better to handle this case more gracefully, perhaps by logging a warning and exiting the function instead of throwing an error. This might prevent the application from crashing in certain situations.
logger.error('No valid Claude data directory found');
return;
}There was a problem hiding this comment.
It's good that you're throwing an error when no Claude data directory is found, but consider if it would be better to handle this case more gracefully, perhaps by logging a warning and exiting the function instead of throwing an error. This might prevent the application from crashing in certain situations.
logger.error('No valid Claude data directory found');
return;
}There was a problem hiding this comment.
It's good that you're throwing an error when no Claude data directory is found, but consider if it would be better to handle this case more gracefully, perhaps by logging a warning and exiting the function instead of throwing an error. This might prevent the application from crashing in certain situations.
logger.error('No valid Claude data directory found');
return;
}There was a problem hiding this comment.
Pull Request Overview
This PR removes deprecated functions and updates the codebase to use their modern equivalents. Key changes include replacing dateSchema with filterDateSchema, replacing getDefaultClaudePath() with getClaudePaths(), and updating associated tests and command logic accordingly.
Reviewed Changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/mcp.ts | Updated imports and usage of deprecated functions, but error handling may be inconsistent. |
| src/debug.ts | Updated usage of getClaudePaths with proper null checks. |
| src/data-loader.ts | Removed deprecated getDefaultClaudePath and its tests. |
| src/commands/mcp.ts | Updated to use getClaudePaths with error handling when no paths exist. |
| src/commands/blocks.ts | Updated to use getClaudePaths with error handling when no paths exist. |
| src/_types.ts | Removed inline deprecated dateSchema definition. |
| src/_shared-args.ts | Updated parseDateArg to use filterDateSchema. |
| docs/package.json | Updated dependency version for typedoc. |
There was a problem hiding this comment.
Consider handling the case where getClaudePaths() might return an empty array. Using an empty string as a fallback can lead to inconsistent behavior compared to other modules that throw an error if no valid path is found. A uniform error handling strategy would improve code maintainability.
| claudePath: getClaudePaths()[0] ?? '', | |
| claudePath: (() => { | |
| const paths = getClaudePaths(); | |
| if (paths.length === 0) { | |
| throw new Error('No valid Claude path found. Ensure getClaudePaths() returns at least one valid path.'); | |
| } | |
| return paths[0]; | |
| })(), |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub. |
BREAKING CHANGE: dateSchema has been removed. Use filterDateSchema instead for date validation. - Replace dateSchema with filterDateSchema in _shared-args.ts - Replace dateSchema with filterDateSchema in mcp.ts - Remove deprecated dateSchema export from _types.ts
BREAKING CHANGE: getDefaultClaudePath() has been replaced with getClaudePaths() which returns an array of paths. - Replace getDefaultClaudePath with getClaudePaths in mcp.ts - Replace getDefaultClaudePath with getClaudePaths in commands/mcp.ts - Replace getDefaultClaudePath with getClaudePaths in blocks.ts - Replace getDefaultClaudePath with getClaudePaths in debug.ts - Add proper error handling for empty path arrays
BREAKING CHANGE: getDefaultClaudePath() has been completely removed. Use getClaudePaths() instead. - Remove getDefaultClaudePath function definition - Remove all test cases for getDefaultClaudePath - Remove unused imports (homedir, join)
… defaultOptions Replace fallback empty string with proper error throwing to match behavior in other modules. This prevents inconsistent behavior when no valid Claude data directory is found. Addresses feedback from Copilot PR review comment.
a74d8ee to
a6edcbe
Compare

Summary
dateSchemain favor offilterDateSchemagetDefaultClaudePath()withgetClaudePaths()Breaking Changes
This PR contains breaking changes that require users to update their code:
dateSchemaremoved: UsefilterDateSchemainstead for date validationgetDefaultClaudePath()removed: UsegetClaudePaths()which returns an array of pathsMigration Guide
dateSchema → filterDateSchema
getDefaultClaudePath → getClaudePaths
Test Plan
Summary by CodeRabbit
Bug Fixes
Refactor
Chores