Improve stdin EOF handling and add modern file search examples#697
Improve stdin EOF handling and add modern file search examples#697
Conversation
- Remove TTY check that was blocking interactive tools - Replace for-await loop with Promise-based event handling - Add proper 'end' and 'close' event listeners for reliable EOF detection - Ensure stdin waits for complete input before processing This allows tools like fzf, fd, and rg to work properly with --stdin option. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Add ripgrep (rg --files --type ts) example for file discovery - Add fd (fd -e ts) example as modern find alternative - Update both README.md and all multilingual website documentation - Improve stdin section with more comprehensive tool examples - Support for 11 languages: en, de, es, fr, hi, id, ja, ko, pt-br, vi, zh-cn, zh-tw 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Revert readLinesFromStream to for-await pattern for test compatibility - Add safe close() check in finally block to handle mock interfaces - Restore TTY check to maintain existing test behavior - Add detailed comment explaining version header suppression in stdin mode - All 685 tests now passing The EOF handling improvement is preserved through the for-await pattern which naturally waits for EOF completion. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
|
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 WalkthroughThis update refines the CLI and documentation for file list input via stdin. It improves spinner and version header behavior during stdin processing, enhances resource cleanup in stdin line reading, and expands documentation with new examples using Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CLI
participant Spinner
participant FileStdin
User->>CLI: repomix --stdin
CLI->>FileStdin: readFilePathsFromStdin()
FileStdin-->>CLI: [file paths]
CLI->>Spinner: start (after stdin read)
CLI->>Spinner: set message "Packing files..."
CLI->>CLI: Process files
Spinner-->>CLI: (spinner stops after processing)
Possibly related PRs
✨ Finishing Touches🧪 Generate Unit Tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
|
Claude finished @yamadashy's task —— View job Code Review for stdin EOF handling improvementsReview Tasks:
✅ Overall AssessmentThis is a well-executed PR that makes meaningful improvements to stdin EOF handling while maintaining backward compatibility. The changes are focused, well-documented, and follow good software practices. 🔧 Code Quality & Best PracticesExcellent Improvements:
Code Quality Highlights:
📚 Documentation UpdatesComprehensive Examples Added:
🔍 Technical AnalysisEOF Handling Robustness:The
Potential Edge Cases Considered:
🚀 Suggestions for EnhancementMinor Improvements:
Documentation Consistency:
🛡️ Security & ReliabilitySecurity Considerations:
Reliability Improvements:
🎯 Architecture & DesignDesign Decisions Analysis:
📋 Final RecommendationsReady to Merge:
Post-Merge Considerations:
Verdict: This PR demonstrates excellent software engineering practices with thoughtful improvements that enhance both functionality and user experience. The changes are well-architected, properly documented, and ready for production use. |
There was a problem hiding this comment.
Summary of Changes
Hello @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 significantly improves the robustness and user experience of repomix when processing file paths via stdin. It refines the internal handling of end-of-file conditions and ensures proper resource management, while also making the tool more compatible with interactive command-line utilities. Furthermore, it enriches the documentation with practical examples demonstrating how to leverage modern file search tools to pipe input into repomix.
Highlights
- Improved
stdinHandling: Enhanced EOF detection and resource cleanup forstdinprocessing, ensuringreadlineinterfaces are properly closed after all input has been read. - Enhanced Interactive Tool Compatibility: Suppressed the version header output when
repomixis used withstdinto prevent interference with piped data from interactive tools likefzf. - Expanded
stdinUsage Examples: Added new documentation examples for usingrepomix --stdinwith modern file search utilities likeripgrep(rg) andfd. - Documentation Updates: Updated the
README.mdand all 11 language versions of the website documentation to reflect the newstdinexamples and clarifystdinbehavior.
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.
PR Summary
Enhanced stdin handling and documentation with modern file search tool examples across multiple languages, improving usability with interactive tools like fzf.
- Added proper resource cleanup in
src/core/file/fileStdin.tswith try/finally blocks for EOF handling - Suppressed version header output in stdin mode via
src/cli/cliRun.tsfor better interactive tool compatibility - Improved spinner behavior in
src/cli/actions/defaultAction.tsto only show after stdin reading begins - Added ripgrep and fd examples across 11 language versions of documentation for modern file discovery
- Enhanced documentation organization by removing redundant stdin sections and adding code compression details
15 files reviewed, 3 comments
Edit PR Review Bot Settings | Greptile
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #697 +/- ##
=======================================
Coverage ? 90.36%
=======================================
Files ? 99
Lines ? 5561
Branches ? 1186
=======================================
Hits ? 5025
Misses ? 536
Partials ? 0 ☔ 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 effectively improves the handling of stdin, particularly for interactive tools, by delaying the spinner and ensuring resource cleanup. It also adds useful documentation for modern file search tools like ripgrep and fd. The code changes are solid, but I've noted a couple of points for improvement: one is a minor code refinement for the spinner logic, and the other is a suggestion to move an unrelated documentation change to a separate PR to maintain a focused scope.
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
website/client/src/ko/guide/usage.md (2)
52-57: Add-t fto avoid directory entries infdexample
fdwill emit both files and directories that match-e tsunless-t f(files only) is supplied.
To stay consistent with the behaviour of the other examples (all emit file paths only), append the flag:-# fd를 사용하여 파일 찾기 -fd -e ts | repomix --stdin +# fd를 사용하여 파일 찾기 +fd -e ts -t f | repomix --stdin
73-80: Clarify intent of the new “코드 압축” featureThe new section introduces
--compress, but readers may not immediately understand how this differs from the default packaging flow. Consider adding a one-liner before the code block (or inline comment) describing what “코드 압축” does (e.g., minification, deduplication, gzip output, etc.).
This prevents confusion and aligns with the explanatory style used elsewhere in the guide.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (16)
README.md(2 hunks)src/cli/actions/defaultAction.ts(1 hunks)src/cli/cliRun.ts(1 hunks)src/core/file/fileStdin.ts(3 hunks)website/client/src/de/guide/usage.md(2 hunks)website/client/src/en/guide/usage.md(1 hunks)website/client/src/es/guide/usage.md(2 hunks)website/client/src/fr/guide/usage.md(1 hunks)website/client/src/hi/guide/usage.md(1 hunks)website/client/src/id/guide/usage.md(1 hunks)website/client/src/ja/guide/usage.md(1 hunks)website/client/src/ko/guide/usage.md(2 hunks)website/client/src/pt-br/guide/usage.md(2 hunks)website/client/src/vi/guide/usage.md(1 hunks)website/client/src/zh-cn/guide/usage.md(2 hunks)website/client/src/zh-tw/guide/usage.md(2 hunks)
🧰 Additional context used
🧠 Learnings (10)
website/client/src/id/guide/usage.md (1)
Learnt from: CR
PR: yamadashy/repomix#0
File: browser/CLAUDE.md:0-0
Timestamp: 2025-06-23T13:06:21.806Z
Learning: The Repomix browser extension is a cross-browser extension (Chrome, Firefox, Edge) that uses Manifest V3 and injects UI elements into GitHub repository pages via content scripts.
website/client/src/ja/guide/usage.md (1)
Learnt from: CR
PR: yamadashy/repomix#0
File: browser/CLAUDE.md:0-0
Timestamp: 2025-06-23T13:06:21.806Z
Learning: The Repomix browser extension is a cross-browser extension (Chrome, Firefox, Edge) that uses Manifest V3 and injects UI elements into GitHub repository pages via content scripts.
website/client/src/en/guide/usage.md (1)
Learnt from: CR
PR: yamadashy/repomix#0
File: browser/CLAUDE.md:0-0
Timestamp: 2025-06-23T13:06:21.806Z
Learning: The Repomix browser extension is a cross-browser extension (Chrome, Firefox, Edge) that uses Manifest V3 and injects UI elements into GitHub repository pages via content scripts.
website/client/src/fr/guide/usage.md (1)
Learnt from: CR
PR: yamadashy/repomix#0
File: browser/CLAUDE.md:0-0
Timestamp: 2025-06-23T13:06:21.806Z
Learning: The Repomix browser extension is a cross-browser extension (Chrome, Firefox, Edge) that uses Manifest V3 and injects UI elements into GitHub repository pages via content scripts.
README.md (1)
Learnt from: CR
PR: yamadashy/repomix#0
File: browser/CLAUDE.md:0-0
Timestamp: 2025-06-23T13:06:21.806Z
Learning: The Repomix browser extension is a cross-browser extension (Chrome, Firefox, Edge) that uses Manifest V3 and injects UI elements into GitHub repository pages via content scripts.
website/client/src/zh-cn/guide/usage.md (1)
Learnt from: CR
PR: yamadashy/repomix#0
File: browser/CLAUDE.md:0-0
Timestamp: 2025-06-23T13:06:21.806Z
Learning: The Repomix browser extension is a cross-browser extension (Chrome, Firefox, Edge) that uses Manifest V3 and injects UI elements into GitHub repository pages via content scripts.
website/client/src/hi/guide/usage.md (1)
Learnt from: CR
PR: yamadashy/repomix#0
File: browser/CLAUDE.md:0-0
Timestamp: 2025-06-23T13:06:21.806Z
Learning: The Repomix browser extension is a cross-browser extension (Chrome, Firefox, Edge) that uses Manifest V3 and injects UI elements into GitHub repository pages via content scripts.
website/client/src/es/guide/usage.md (1)
Learnt from: CR
PR: yamadashy/repomix#0
File: browser/CLAUDE.md:0-0
Timestamp: 2025-06-23T13:06:21.806Z
Learning: The Repomix browser extension is a cross-browser extension (Chrome, Firefox, Edge) that uses Manifest V3 and injects UI elements into GitHub repository pages via content scripts.
website/client/src/de/guide/usage.md (1)
Learnt from: CR
PR: yamadashy/repomix#0
File: browser/CLAUDE.md:0-0
Timestamp: 2025-06-23T13:06:21.806Z
Learning: The Repomix browser extension is a cross-browser extension (Chrome, Firefox, Edge) that uses Manifest V3 and injects UI elements into GitHub repository pages via content scripts.
website/client/src/ko/guide/usage.md (1)
Learnt from: CR
PR: yamadashy/repomix#0
File: browser/CLAUDE.md:0-0
Timestamp: 2025-06-23T13:06:21.806Z
Learning: The Repomix browser extension is a cross-browser extension (Chrome, Firefox, Edge) that uses Manifest V3 and injects UI elements into GitHub repository pages via content scripts.
🧬 Code Graph Analysis (1)
src/cli/actions/defaultAction.ts (2)
src/cli/cliSpinner.ts (1)
Spinner(6-69)src/core/file/fileStdin.ts (1)
readFilePathsFromStdin(69-116)
🪛 GitHub Check: codecov/patch
src/core/file/fileStdin.ts
[warning] 59-60: src/core/file/fileStdin.ts#L59-L60
Added lines #L59 - L60 were not covered by tests
⏰ Context from checks skipped due to timeout of 90000ms (16)
- GitHub Check: Build and run (macos-latest, 19.x)
- GitHub Check: Build and run (macos-latest, 23.x)
- GitHub Check: Build and run (macos-latest, 24.x)
- GitHub Check: Build and run (windows-latest, 23.x)
- GitHub Check: Build and run (windows-latest, 24.x)
- GitHub Check: Build and run (macos-latest, 20.x)
- GitHub Check: Build and run (macos-latest, 22.x)
- GitHub Check: Build and run (windows-latest, 19.x)
- GitHub Check: Build and run (ubuntu-latest, 19.x)
- GitHub Check: Test (windows-latest, 24.x)
- GitHub Check: Test (windows-latest, 21.x)
- GitHub Check: Test (windows-latest, 22.x)
- GitHub Check: Test (windows-latest, 18.x)
- GitHub Check: Test (windows-latest, 23.x)
- GitHub Check: Test (windows-latest, 20.x)
- GitHub Check: auto-review
🔇 Additional comments (18)
src/cli/cliRun.ts (1)
189-193: Excellent improvement for stdin workflows!This change properly suppresses the version header when using stdin mode, preventing interference with piped output from interactive tools. The implementation is clean, well-documented, and maintains backward compatibility.
README.md (2)
219-219: Clear wording improvement.The change from "via stdin" to "pipe via stdin" better describes the actual action and is more precise terminology.
228-233: Great addition of modern file discovery tools!The new examples for
ripgrepandfdprovide users with modern, performant alternatives to traditionalfindcommands. Both command syntaxes are correct and follow the established documentation pattern.website/client/src/id/guide/usage.md (1)
67-72: Consistent documentation update for Indonesian users.The new examples are properly translated and use correct command syntax. This maintains consistency with the main documentation while providing Indonesian users with the same modern file discovery options.
website/client/src/en/guide/usage.md (1)
52-57: Consistent addition of modern file search tools.The examples properly demonstrate ripgrep and fd usage with correct syntax, providing users with efficient alternatives to traditional file discovery methods.
website/client/src/fr/guide/usage.md (1)
56-61: Well-translated documentation enhancement.The new examples are properly translated into French while maintaining correct command syntax. This ensures French-speaking users have access to the same modern file discovery tools as other language versions.
website/client/src/ja/guide/usage.md (1)
52-57: Examples look correct – no issues found.The added ripgrep (
rg) and fd snippets are syntactically sound and align with the surrounding examples.website/client/src/vi/guide/usage.md (1)
64-69: Addition LGTM.The new
rg/fdstdin examples are accurate and consistent with prior commands.website/client/src/hi/guide/usage.md (1)
95-100: No problems detected.The Hindi translation and the ripgrep / fd command syntax are both correct.
website/client/src/es/guide/usage.md (2)
52-57: Good addition of modern search examples.Commands are correct and nicely complement existing options.
73-80: Confirmed CLI flag name
Verified that the CLI accepts--compress(see src/cli/cliRun.ts), so the Spanish docs are already using the correct flag. No changes required.website/client/src/zh-cn/guide/usage.md (1)
52-57: 新示例无误。
rg/fd用法正确,与其他示例保持一致。src/cli/actions/defaultAction.ts (1)
74-82: LGTM! Excellent UX improvement for stdin processing.The delayed spinner start prevents confusion during stdin input waiting and provides clear feedback when actual processing begins. This aligns well with the EOF handling improvements in
fileStdin.ts.website/client/src/de/guide/usage.md (1)
52-80: Excellent documentation enhancements with modern tooling examples.The addition of
ripgrepandfdexamples provides users with faster, more efficient alternatives to traditionalfindcommands. The new compression section clearly demonstrates the--compressfeature usage for both local and remote repositories.website/client/src/zh-tw/guide/usage.md (1)
52-80: Consistent and well-translated documentation improvements.The Traditional Chinese documentation properly mirrors the enhancements made to other language versions, ensuring all users have access to modern file discovery tool examples and compression feature documentation.
website/client/src/pt-br/guide/usage.md (1)
52-80: Well-maintained consistency in Portuguese documentation.The Portuguese documentation properly incorporates the modern file discovery examples and compression feature documentation, maintaining consistency across all language versions of the guide.
src/core/file/fileStdin.ts (2)
50-61: Excellent resource management improvement with try/finally pattern.The try/finally block ensures proper cleanup of the readline interface, preventing potential resource leaks. The for-await loop naturally waiting for EOF is perfect for handling interactive tools like fzf.
However, the cleanup code (lines 59-60) lacks test coverage according to static analysis. Consider adding a test case that verifies the readline interface is properly closed even when exceptions occur during line reading.
40-41: Clear and accurate comment updates.The updated comments properly clarify that the function waits for EOF completion, which helps developers understand the blocking behavior when working with interactive tools.
Also applies to: 86-86
- Add fzf examples for interactive file selection: - fzf -m | repomix --stdin (simple file selection) - find + fzf -m | repomix --stdin (filtered selection) - Improve tool naming for better clarity: - ripgrep → ripgrep (rg) to show command name - fd → sharkdp/fd to reference GitHub repository - Update README.md and all 12 language versions of website docs - Maintain consistent ordering: fd, fzf (simple), fzf (filtered), ls These examples help users leverage modern file discovery tools with interactive selection capabilities. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Deploying repomix with
|
| Latest commit: |
0c91d3a
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://ce46e4cd.repomix.pages.dev |
| Branch Preview URL: | https://fix-stdin-eof-handling.repomix.pages.dev |
- Fix German grammar in documentation comments (zum Finden von Dateien) - Optimize getVersion() call to only run when version header is needed - Improve spinner UX by combining start() and update() calls Addresses feedback from @greptile-apps, @Copilot, and @gemini-code-assist. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Revert spinner.start() call to not pass arguments (API doesn't support it) - Restore spinner constructor with proper initial message - Keep separate start() and update() calls as intended by the API This fixes the incorrect assumption about the Spinner API capabilities. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
…tion Add comprehensive examples for content-based file discovery using grep and ripgrep to README.md and all 12 language versions of website documentation. This enhances the stdin usage examples by providing users with powerful content search capabilities alongside existing file discovery tools. Changes: - Add grep example for finding files containing specific content - Add ripgrep example with multiple pattern search (TODO|FIXME) - Reorder examples to group content search tools logically - Update all 12 language versions with appropriate translations 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
Pull Request Overview
This PR improves stdin EOF handling and expands documentation with modern file search examples to support interactive tools like fzf.
- Implementation improvements in fileStdin and CLI to ensure safe resource cleanup and proper version header display in stdin mode
- Documentation updates across multiple languages adding examples for ripgrep, grep, fd, and fzf
- Minor tweaks in README wording for clarity
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| website/client/src/*/guide/usage.md | Added modern file search examples (ripgrep, grep, fd, fzf) across languages; some examples appear redundant |
| src/core/file/fileStdin.ts | Improved EOF handling with try/finally and proper resource cleanup |
| src/cli/cliRun.ts | Skips version header in stdin mode for better interactive tool support |
| src/cli/actions/defaultAction.ts | Adjusted spinner start timing during stdin processing |
| README.md | Updated wording and added modern file search examples to documentation |
Comments suppressed due to low confidence (1)
website/client/src/zh-tw/guide/usage.md:62
- [nitpick] The example for using ripgrep appears twice with identical descriptions. Consider removing the duplicate to reduce redundancy and improve clarity.
rg --files --type ts | repomix --stdin
Remove duplicate `rg --files --type ts` examples that were inadvertently added when introducing grep/ripgrep content search examples. The duplication occurred in 8 language versions of the documentation. Affected languages: - German (de) - English (en) - Spanish (es) - Japanese (ja) - Korean (ko) - Portuguese Brazil (pt-br) - Simplified Chinese (zh-cn) - Traditional Chinese (zh-tw) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Summary
This PR improves stdin EOF handling and adds examples for modern file search tools (ripgrep and fd) to better support interactive tools like fzf.
Changes
Implementation improvements:
fileStdin.tswith proper resource cleanup using try/finallyDocumentation updates:
rg --files --type ts) examples to README and website docsfd -e ts) examples as modern find alternativeTechnical Details
for awaitloop naturally waits for EOF completion, ensuring reliable handling of piped inputUsage Examples
New examples added for stdin usage:
These additions make it easier for users to work with modern file discovery tools and interactive selectors like fzf.
Checklist
npm run testnpm run lint