Skip to content

Conversation

@vtemian
Copy link
Contributor

@vtemian vtemian commented Jan 9, 2026

Summary

  • Split monolithic ripgrep.ts (400+ lines) into modular directory structure
  • Add Global.Platform helpers for cross-platform binary handling
  • Add integration tests for ripgrep functionality

Changes

  • src/file/ripgrep.tssrc/file/ripgrep/
    • index.ts - Public API (files, tree, search, rg)
    • binary.ts - Binary download/extraction logic
    • tree.ts - Tree building and BFS truncation
    • io.ts - Stream line parsing utility
  • src/global/index.ts - Added Platform.isWindows and Platform.binExt
  • test/file/ripgrep.test.ts - 14 integration tests

vtemian added 10 commits January 9, 2026 11:32
- Extract platform config, download, and extraction into separate functions
- Split extraction logic into extractPosix and extractWindows
- Simplify filepath export by removing unnecessary wrapper
- Replace deprecated Bun.readableStreamToText with Response.text()
- Remove duplicate conditional check for zip extraction
- Group all exports at bottom of file with clear sections
- Extract buildFilesArgs helper for ripgrep argument construction
- Extract streamLines helper for async line streaming
- Add FilesInput interface and MAX_BUFFER_BYTES constant
- Rename internal Match schema to MatchSchema to avoid conflict
Split ripgrep.ts into a directory structure for better organization:
- binary.ts: Platform config, download, extract, filepath
- schema.ts: Zod schemas for ripgrep JSON output
- tree.ts: TreeNode interface and tree helpers (build, sort, truncate, render)
- index.ts: Public API (files, tree, search) and re-exports
@github-actions
Copy link
Contributor

github-actions bot commented Jan 9, 2026

The following comment was made by an LLM, it may be inaccurate:

Potential Related PR Found:

This PR (#6507) may have relevant changes to the tree building logic that should be considered alongside the refactoring in PR #7453. However, they appear to be addressing different concerns (optimization vs. modularization), so they may be complementary rather than duplicate.

Replace shell command execution with Bun.spawn to avoid
cross-platform shell quoting issues. The previous approach
used embedded single quotes in glob patterns which behaved
differently on macOS vs Ubuntu.
@vtemian vtemian force-pushed the cleanup/ripgrep-refactor branch from 95a3715 to 5f467a6 Compare January 9, 2026 09:50
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.

1 participant