A TypeScript/Node.js tool to extract files from a Repomix output file, recreating the original directory structure and files.
Repomix is a tool that packs repository files into a single text file for easy sharing and AI analysis. This unpacker reverses that process, extracting the individual files back to their original structure.
# Clone the repository
git clone <repository-url>
cd repomix-unpack
# Install dependencies
npm install
# Build the project
npm run build
# Link globally (optional)
npm link# Using npx (after building)
npx . repomix-output.txt
# If linked globally
repomix-unpack repomix-output.txt
# Using npm run
npm run start repomix-output.txtrepomix-unpack <input-file> [options]
Options:
-o, --output <dir> Output directory (default: ./repomix-extracted)
-d, --dry-run Show what would be extracted without creating files
-v, --verbose Enable verbose output
-h, --help Display help
-V, --version Display version# Extract to default directory (./repomix-extracted)
repomix-unpack repomix-output.txt
# Extract to specific directory
repomix-unpack repomix-output.txt --output ./my-extracted-files
# Dry run to see what would be extracted
repomix-unpack repomix-output.txt --dry-run
# Verbose output for debugging
repomix-unpack repomix-output.txt --verbose- ✅ Parses Repomix format with line number handling
- ✅ Recreates original directory structure
- ✅ Progress indication during extraction
- ✅ Dry-run mode for preview
- ✅ Verbose mode for debugging
- ✅ Comprehensive error handling
- ✅ Summary report after extraction
# Install dependencies
npm install
# Run in development mode
npm run dev repomix-output.txt
# Build the project
npm run build
# Run tests (when implemented)
npm test- Validation: Validates the input file is a valid Repomix output
- Parsing: Reads the file line by line, extracting file entries
- Line Number Removal: Strips line number prefixes (e.g.,
123→) from content - Directory Creation: Creates necessary directories recursively
- File Writing: Writes each file to its original location
- Summary: Reports on files created, directories created, and any errors
The tool expects Repomix files with the following structure:
================
File: path/to/file.ext
================
[file contents with optional line numbers]
================
File: another/file.ext
================
[file contents]
The tool handles various error scenarios:
- Invalid Repomix file format
- Missing input file
- No write permissions
- Invalid output directory
- File writing errors
Do whatever you want