feat(core): Replace istextorbinary with is-binary-path and isbinaryfile#1006
feat(core): Replace istextorbinary with is-binary-path and isbinaryfile#1006
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughThe pull request replaces the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Possibly related PRs
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary of ChangesHello @yamadashy, 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 the core binary file detection mechanism by replacing an outdated dependency with a pair of modern, actively maintained libraries. This change aims to improve the accuracy and efficiency of binary file identification, particularly through expanded extension coverage, while preserving the existing detection logic. Highlights
Using Gemini Code AssistThe 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 by creating a comment using either
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 Limitations & Feedback Gemini Code Assist 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. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. 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
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1006 +/- ##
=======================================
Coverage 89.83% 89.83%
=======================================
Files 120 120
Lines 9234 9235 +1
Branches 1683 1683
=======================================
+ Hits 8295 8296 +1
Misses 939 939 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Code Review
This pull request successfully replaces the istextorbinary package with the more modern is-binary-path and isbinaryfile packages. The implementation correctly adapts to the new APIs, including handling asynchronous operations, and the tests have been updated accordingly. However, I've identified a critical compatibility issue with the chosen version of isbinaryfile, which requires a newer Node.js version than what is specified for this project. This could break the setup for developers on older Node.js versions.
PR Review: refactor(core): Replace istextorbinary with is-binary-path and isbinaryfileSummaryThis is a well-structured refactoring PR that replaces the ✅ Strengths
|
| Risk | Likelihood | Impact | Mitigation |
|---|---|---|---|
| Node.js engine mismatch | Medium | High | Test on Node 20 before merging |
| Different binary detection behavior | Low | Medium | The new packages use similar heuristics; already tested |
| Edge case: file misclassified | Low | Low | Both extension and content checks provide redundancy |
Checklist
- Code follows Airbnb style guidelines
- Tests updated appropriately
- No security concerns introduced
- Verify Node.js 20 compatibility
Overall, this is a solid refactoring PR. Just verify the Node.js compatibility concern before merging.
Deploying repomix with
|
| Latest commit: |
7f0d05d
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://91b02ecb.repomix.pages.dev |
| Branch Preview URL: | https://refactor-replace-istextorbin.repomix.pages.dev |
Migrate from istextorbinary (last updated 2023-12) to actively maintained packages: - is-binary-path: Extension-based binary detection (updated 2024-04) - isbinaryfile: Content-based binary detection with zero dependencies (updated 2025-12) Improvements: - Binary extension coverage: 13 → 262 extensions (~20x increase) - Content detection: Better UTF-16/CJK support, statistical analysis (512 bytes vs 72 bytes) The two-stage detection logic (extension check → content check) is preserved.
de6ac28 to
7f0d05d
Compare
PR Review: feat(core): Replace istextorbinary with is-binary-path and isbinaryfileSummaryThis is a well-executed dependency modernization PR that replaces ✅ Strengths
|
| Risk | Likelihood | Impact | Status |
|---|---|---|---|
| Node.js engine mismatch | Low | Medium | Mitigated by CI |
| Different binary detection behavior | Low | Low | Same heuristics, redundant checks |
| Edge case file misclassification | Low | Low | Two-stage detection provides safety net |
Checklist
- Code follows Airbnb style guidelines
- Tests updated appropriately
- No security concerns
- CI passing on multiple Node versions
Overall: This PR is ready to merge. The code is clean, well-tested, and the dependency upgrade provides tangible benefits (20x more binary extension coverage, actively maintained packages).
🤖 Generated with Claude Code
Remove the confidence < 0.2 check that was causing valid UTF-8/ASCII files to be incorrectly skipped. Files are now only skipped if they contain actual decode errors (U+FFFD replacement characters). This fixes issues where: - Valid Python files were skipped with confidence=0.00 (#869) - HTML files with Thymeleaf syntax (~{}) were incorrectly detected as binary (#847) The isbinaryfile library (added in PR #1006) now handles binary detection more accurately, making the confidence-based heuristic unnecessary. Fixes #869
isbinaryfile v6.0.0 requires Node.js >= 24.0.0, but repomix supports Node.js >= 20.0.0. Downgrade to v5.0.2 (requires Node.js >= 18.0.0) to maintain compatibility with current LTS versions. Addresses gemini-code-assist review on PR #1006
Summary
Replace
istextorbinarypackage (last updated Dec 2023) with actively maintained alternatives:is-binary-path: Extension-based binary detection (updated Apr 2024)isbinaryfile: Content-based binary detection with zero dependencies (updated Dec 2025)Why this change?
Binary extension coverage improvement
The new setup provides ~20x more binary extension coverage, reducing unnecessary content checks for common binary formats.
Behavior
The two-stage detection logic remains the same:
Checklist
npm run testnpm run lint