Skip to content

Improve stdin EOF handling and add modern file search examples#697

Merged
yamadashy merged 8 commits intomainfrom
fix/stdin-eof-handling
Jun 29, 2025
Merged

Improve stdin EOF handling and add modern file search examples#697
yamadashy merged 8 commits intomainfrom
fix/stdin-eof-handling

Conversation

@yamadashy
Copy link
Owner

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:

  • Improved EOF handling in fileStdin.ts with proper resource cleanup using try/finally
  • Enhanced code comments to explain version header suppression in stdin mode for interactive tools
  • Maintained backward compatibility with existing tests

Documentation updates:

  • Added ripgrep (rg --files --type ts) examples to README and website docs
  • Added fd (fd -e ts) examples as modern find alternative
  • Updated all 11 language versions of website documentation

Technical Details

  • The for await loop naturally waits for EOF completion, ensuring reliable handling of piped input
  • Added safe resource cleanup in finally block to prevent readline interface leaks
  • All 685 tests passing with improved error handling

Usage Examples

New examples added for stdin usage:

# Using ripgrep to find files
rg --files --type ts | repomix --stdin

# Using fd to find files  
fd -e ts | repomix --stdin

These additions make it easier for users to work with modern file discovery tools and interactive selectors like fzf.

Checklist

  • Run npm run test
  • Run npm run lint

yamadashy and others added 3 commits June 29, 2025 16:22
- 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>
Copilot AI review requested due to automatic review settings June 29, 2025 08:15
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jun 29, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This 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 ripgrep and fd for file list generation. No core logic or public API changes were made.

Changes

File(s) Change Summary
README.md, website/client/src/*/guide/usage.md Documentation updated: added stdin usage examples with ripgrep and fd; some guides also introduced code compression examples.
src/cli/actions/defaultAction.ts Spinner behavior in stdin processing updated: delayed start and message adjustment.
src/cli/cliRun.ts Suppressed version header output when --stdin is used.
src/core/file/fileStdin.ts Improved resource cleanup in stdin reading and clarified comments about EOF handling.

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)
Loading

Possibly related PRs

  • yamadashy/repomix#331: Adjusts spinner behavior based on verbose logging and adds trace logs, related to spinner usage changes.
  • yamadashy/repomix#653: Introduced the --stdin flag and core logic for reading file lists from stdin, directly related to the current stdin processing improvements.
  • yamadashy/repomix#680: Modifies stdin processing to apply include/ignore filters and refactors file passing, related to stdin file list handling.
✨ Finishing Touches
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Post Copyable Unit Tests in Comment
  • Commit Unit Tests in branch fix/stdin-eof-handling

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@claude
Copy link
Contributor

claude bot commented Jun 29, 2025

Claude finished @yamadashy's task —— View job


Code Review for stdin EOF handling improvements

Review Tasks:

  • Analyze core stdin handling changes in fileStdin.ts
  • Review CLI modifications in defaultAction.ts and cliRun.ts
  • Check documentation consistency across language versions
  • Evaluate code quality and best practices
  • Identify potential bugs or edge cases
  • Provide comprehensive feedback and recommendations

✅ Overall Assessment

This 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 Practices

Excellent Improvements:

  1. Enhanced Resource Management (src/core/file/fileStdin.ts:50-61):

    try {
      for await (const line of rl) {
        lines.push(line);
      }
      return lines;
    } finally {
      // Safely close the readline interface
      if (rl && typeof rl.close === 'function') {
        rl.close();
      }
    }
    • Proper resource cleanup with try/finally ensures readline interface is closed even if errors occur
    • Safe method checking before calling rl.close() prevents potential runtime errors
    • Clear documentation explaining the EOF handling behavior
  2. Better UX for Interactive Tools (src/cli/cliRun.ts:190-193):

    // Skip version header in stdin mode to avoid interfering with piped output from interactive tools like fzf
    if (!options.stdin) {
      logger.log(pc.dim(`\n📦 Repomix v${version}\n`));
    }
    • Thoughtful UX consideration - suppressing version header prevents interference with tools like fzf
    • Well-documented rationale in the comment

Code Quality Highlights:

  • Separation of concerns: readLinesFromStream handles low-level stream reading, while readFilePathsFromStdin handles business logic
  • Testability: Functions are properly isolated and dependency-injectable
  • Error handling: Comprehensive error handling with custom RepomixError types
  • Type safety: Proper TypeScript usage with interfaces and type annotations

📚 Documentation Updates

Comprehensive Examples Added:

  • Modern tools: Added ripgrep (rg --files --type ts) and fd (fd -e ts) examples
  • Consistency: Updates applied across all 11 language versions
  • Practical value: Examples show real-world usage patterns

🔍 Technical Analysis

EOF Handling Robustness:

The for await loop implementation is architecturally sound:

  • Natural EOF waiting: The async iterator naturally waits for EOF completion
  • Stream compatibility: Works with both regular pipes and interactive tools
  • Performance: Minimal overhead compared to manual event handling

Potential Edge Cases Considered:

  1. Empty input handling - ✅ Already covered by existing validation
  2. Large input streams - ✅ Streaming approach handles large inputs efficiently
  3. Malformed input - ✅ Proper filtering and validation in place
  4. Resource leaks - ✅ Now properly handled with finally block

🚀 Suggestions for Enhancement

Minor Improvements:

  1. Consider adding timeout handling for extremely slow interactive tools:

    // Optional enhancement for future consideration
    const timeout = setTimeout(() => {
      logger.warn('Stdin input taking longer than expected...');
    }, 10000);
  2. Enhanced error context for debugging:

    } catch (error) {
      logger.trace(`Raw error details: ${error}`);
      // existing error handling...
    }

Documentation Consistency:

  • ✅ All language versions properly updated
  • ✅ Examples are practical and well-formatted
  • ✅ Consistent terminology across languages

🛡️ Security & Reliability

Security Considerations:

  • Path traversal protection: Existing path resolution and normalization
  • Input validation: Proper filtering of empty lines and comments
  • Resource limits: Streaming approach prevents memory exhaustion

Reliability Improvements:

  • Resource cleanup: Prevents file descriptor leaks
  • Error boundaries: Proper error handling and reporting
  • Backward compatibility: No breaking changes

🎯 Architecture & Design

Design Decisions Analysis:

  1. Separation of readLinesFromStream and readFilePathsFromStdin - ✅ Excellent separation of concerns
  2. Dependency injection pattern - ✅ Enables proper testing
  3. Error handling strategy - ✅ Consistent with project patterns
  4. Async/await usage - ✅ Modern, readable asynchronous code

📋 Final Recommendations

Ready to Merge:

  • ✅ Code changes are minimal, focused, and well-implemented
  • ✅ Backward compatibility maintained
  • ✅ Comprehensive documentation updates
  • ✅ Follows project coding standards
  • ✅ Addresses real user needs (interactive tool compatibility)

Post-Merge Considerations:

  • Consider adding integration tests for stdin scenarios with various tools
  • Monitor for any edge cases in production usage
  • Consider documenting the technical implementation details for future maintainers

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.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 stdin Handling: Enhanced EOF detection and resource cleanup for stdin processing, ensuring readline interfaces are properly closed after all input has been read.
  • Enhanced Interactive Tool Compatibility: Suppressed the version header output when repomix is used with stdin to prevent interference with piped data from interactive tools like fzf.
  • Expanded stdin Usage Examples: Added new documentation examples for using repomix --stdin with modern file search utilities like ripgrep (rg) and fd.
  • Documentation Updates: Updated the README.md and all 11 language versions of the website documentation to reflect the new stdin examples and clarify stdin behavior.
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

  1. 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.

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.ts with try/finally blocks for EOF handling
  • Suppressed version header output in stdin mode via src/cli/cliRun.ts for better interactive tool compatibility
  • Improved spinner behavior in src/cli/actions/defaultAction.ts to 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

This comment was marked as outdated.

@codecov
Copy link

codecov bot commented Jun 29, 2025

Codecov Report

Attention: Patch coverage is 85.71429% with 2 lines in your changes missing coverage. Please review.

Please upload report for BASE (main@6d13ef6). Learn more about missing BASE report.

Files with missing lines Patch % Lines
src/core/file/fileStdin.ts 77.77% 2 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
website/client/src/ko/guide/usage.md (2)

52-57: Add -t f to avoid directory entries in fd example

fd will emit both files and directories that match -e ts unless -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 “코드 압축” feature

The 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

📥 Commits

Reviewing files that changed from the base of the PR and between 6d13ef6 and 0653f0c.

📒 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 ripgrep and fd provide users with modern, performant alternatives to traditional find commands. 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 / fd stdin 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 ripgrep and fd examples provides users with faster, more efficient alternatives to traditional find commands. The new compression section clearly demonstrates the --compress feature 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>
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Jun 29, 2025

Deploying repomix with  Cloudflare Pages  Cloudflare Pages

Latest commit: 0c91d3a
Status: ✅  Deploy successful!
Preview URL: https://ce46e4cd.repomix.pages.dev
Branch Preview URL: https://fix-stdin-eof-handling.repomix.pages.dev

View logs

yamadashy and others added 3 commits June 29, 2025 17:43
- 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>
@yamadashy yamadashy requested a review from Copilot June 29, 2025 09:10
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@yamadashy yamadashy merged commit 44359fb into main Jun 29, 2025
65 checks passed
@yamadashy yamadashy deleted the fix/stdin-eof-handling branch June 29, 2025 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants