$ show yamadashy/repomix
Repomix is a multi-interface tool that packs code repositories into a single AI-optimized file for consumption by large language models (LLMs) like ChatGPT, Claude, and Gemini. It operates as a CLI tool, a library, an MCP (Model Context Protocol) server, a GitHub Action, a browser extension, and a web service. The core pipeline discovers files respecting ignore patterns, reads them with binary and encoding detection, optionally compresses code via tree-sitter (removing implementation details while preserving signatures), scans for secrets with Secretlint, and generates output in XML, Markdown, JSON, or plain text formats. It also provides token counting with configurable encodings and disk-backed caching, git integration (diffs, logs, change-frequency sorting), and skill generation for Claude Agent. Architecturally, the project is modular with a clear separation between the core library (src/core/), CLI interface (src/cli/), MCP server (src/mcp/), website (website/), and browser extension (browser/). The core uses dependency injection for testability, worker threads (tinypool) for parallel file processing and metrics, and a strategy pattern for language-specific tree-sitter parsing. Configuration is loaded from JSON/JS/TS files and merged with CLI options. The codebase demonstrates strong engineering practices including comprehensive test coverage, security hardening (SSRF protection, git command sanitization, sandboxed MCP tools), and performance optimizations (token count cache, bounded concurrency, fast binary detection). The project is actively maintained with frequent releases, a large community (28k+ stars), and extensive documentation in 15 languages. While the core is well-architected, the multiple distribution channels and large dependency surface introduce maintenance overhead. Some duplication exists between the website and CLI validation logic, and the tree-sitter WASM management is fragile. Overall, it is a high-quality, production-ready tool with several reusable components.
The LLM identified 5 files worth highlighting for reuse:
Provides a bounded concurrency map function that limits the number of in-flight asynchronous tasks, preventing resource exhaustion. It is self-contained and can be extracted into any TypeScript project needing controlled parallelism.
Sanitizes URLs and error messages by redacting credentials (passwords, tokens) before logging, preventing accidental credential exposure. Uses regex patterns and is independent of the rest of the codebase.
A generic key-value cache with FIFO eviction, atomic file persistence, and a warm-likely heuristic. Designed for token counts but reusable for any expensive computation that benefits from disk-backed caching with bounded memory.
Defines a custom error hierarchy (RepomixError, RepomixConfigValidationError, OperationCancelledError) with duck-typed detection across worker thread boundaries. Demonstrates robust error handling in a multi-process environment.
Abstract base class for language-specific tree-sitter parse strategies. Provides a clean interface for extracting code structure (classes, functions, signatures) while removing implementation details. Each language strategy extends this base, making it easy to add new languages.