repo2file

A utility for merging repository files into a single text file for interacting with it using large-context neural networks, e.g. qwen.ai

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:

  1. A single text file (repository_content.txt) containing all the project code
  2. File statistics (statistics.json)
  3. Filtered-out binary and unsupported files

The results are intended for use with large-context neural networks.

Installation

  1. Ensure Node.js (version 14+) is installed
  2. Install dependencies:
npm install  

Usage

  1. Configure the settings file
  2. Run the analyzer:
npm start  
  1. 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

Stats

1 Likes
1 Downloads

Sources