Repository to File
A utility for merging repository files into a single text file for interacting with it using large-context neural networks, e.g. qwen.ai
Description
This tool analyzes the repository structure and generates:
- A single text file (
repository_content.txt) containing all the project code - File statistics (
statistics.json) - Filtered-out binary and unsupported files
The results are intended for use with large-context neural networks.
Installation
- Ensure Node.js (version 14+) is installed
- Install dependencies:
npm install
Usage
- Configure the settings file
- Run the analyzer:
npm start
- Results will be saved in the specified files
Configuration
Adjust parameters in config.json:
{
"repoPath": "./", // Path to the analyzed repository
"supportedExtensions": [], // List of supported file extensions
"supportedHiddenFiles": [], // Supported hidden files
"excludedExtensions": [] // Extensions to exclude entirely
}
Supported Formats
Text Files
- Common code extensions (JS, TS, Python, Java, C++, etc.)
- Configuration files (JSON, YAML, ENV, XML)
- Scripts (Bash, PowerShell, Batch)
- Markup (HTML, CSS, Markdown)
Hidden Files
- System configurations (
.gitignore,.dockerignore) - Linter and formatter settings
- Package manager configs
Exclusions
- Media files (images, videos, audio)
- Archives (ZIP, RAR, 7z)
- Documents (PDF, DOC, XLS)
- Executables (EXE, DLL, APK)
- 3D models and design files (PSD, AI, Blend)
Statistics
The statistics.json file contains:
- File distribution by extension
- Total repository size
- List of unsupported files
- Percentage breakdown of file types
Example:
{
"extensions": {
".js": {
"count": 42,
"size": "128.45 KB",
"percentage": "34.12%"
}
},
"totalFiles": 123,
"totalSize": "376.12 KB",
"unsupportedFiles": []
}
Usage Example
# Analyze the current directory
{
"repoPath": "./",
...
}
# After running
npm start
# Resulting files:
# - repository_content.txt
# - statistics.json
Limitations
- Files >10 KB are excluded from the output
- Binary files are automatically filtered
- For very large repositories, the resulting TXT file may be too big for neural networks