repomix-unmixer
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseRepomix Unmixer
Repomix Unmixer
Overview
概述
This skill extracts files from repomix-packed repositories and restores their original directory structure. Repomix packs entire repositories into single AI-friendly files (XML, Markdown, or JSON), and this skill reverses that process to restore individual files.
该工具从repomix打包的仓库中提取文件,并恢复其原始目录结构。Repomix会将整个仓库打包为单个AI友好型文件(XML、Markdown或JSON格式),而本工具则逆向该流程以恢复单个文件。
When to Use This Skill
使用场景
This skill activates when:
- Unmixing a repomix output file (*.xml, *.md, *.json)
- Extracting files from a packed repository
- Restoring original directory structure from repomix format
- Reviewing or validating repomix-packed content
- Converting repomix output back to usable files
当以下情况时可使用本工具:
- 拆分repomix输出文件(.xml、.md、*.json)
- 从打包的仓库中提取文件
- 从repomix格式恢复原始目录结构
- 审查或验证repomix打包的内容
- 将repomix输出转换回可用文件
Core Workflow
核心工作流程
Standard Unmixing Process
标准拆分流程
Extract all files from a repomix file and restore the original directory structure using the bundled script:
unmix_repomix.pybash
python3 scripts/unmix_repomix.py \
"<path_to_repomix_file>" \
"<output_directory>"Parameters:
- : Path to the repomix output file (XML, Markdown, or JSON)
<path_to_repomix_file> - : Directory where files will be extracted (will be created if doesn't exist)
<output_directory>
Example:
bash
python3 scripts/unmix_repomix.py \
"/path/to/repomix-output.xml" \
"/tmp/extracted-files"使用附带的脚本从repomix文件中提取所有文件并恢复原始目录结构:
unmix_repomix.pybash
python3 scripts/unmix_repomix.py \
"<path_to_repomix_file>" \
"<output_directory>"参数说明:
- :repomix输出文件的路径(XML、Markdown或JSON格式)
<path_to_repomix_file> - :文件提取后的输出目录(若不存在将自动创建)
<output_directory>
示例:
bash
python3 scripts/unmix_repomix.py \
"/path/to/repomix-output.xml" \
"/tmp/extracted-files"What the Script Does
脚本工作原理
- Parses the repomix file format (XML, Markdown, or JSON)
- Extracts each file path and content
- Creates the original directory structure
- Writes each file to its original location
- Reports extraction progress and statistics
- 解析repomix文件格式(XML、Markdown或JSON)
- 提取每个文件的路径和内容
- 创建原始目录结构
- 写入每个文件到其原始位置
- 报告提取进度和统计信息
Output
输出结果
The script will:
- Create all necessary parent directories
- Extract all files maintaining their paths
- Print extraction progress for each file
- Display total count of extracted files
Example output:
Unmixing /path/to/skill.xml...
Output directory: /tmp/extracted-files
✓ Extracted: github-ops/SKILL.md
✓ Extracted: github-ops/references/api_reference.md
✓ Extracted: markdown-tools/SKILL.md
...
✅ Successfully extracted 20 files!
Extracted files are in: /tmp/extracted-files脚本将:
- 创建所有必要的父目录
- 保留文件路径提取所有文件
- 打印每个文件的提取进度
- 显示提取文件的总数
示例输出:
Unmixing /path/to/skill.xml...
Output directory: /tmp/extracted-files
✓ Extracted: github-ops/SKILL.md
✓ Extracted: github-ops/references/api_reference.md
✓ Extracted: markdown-tools/SKILL.md
...
✅ Successfully extracted 20 files!
Extracted files are in: /tmp/extracted-filesSupported Formats
支持的格式
XML Format (default)
XML格式(默认)
Repomix XML format structure:
xml
<file path="relative/path/to/file.ext">
file content here
</file>The script uses regex to match blocks.
<file path="...">content</file>Repomix XML格式结构:
xml
<file path="relative/path/to/file.ext">
file content here
</file>脚本使用正则表达式匹配块。
<file path="...">content</file>Markdown Format
Markdown格式
For markdown-style repomix output with file markers:
markdown
undefined适用于带有文件标记的Markdown风格repomix输出:
markdown
undefinedFile: relative/path/to/file.ext
File: relative/path/to/file.ext
file content
Refer to `references/repomix-format.md` for detailed format specifications.file content
详细格式规范请参考`references/repomix-format.md`。JSON Format
JSON格式
For JSON-style repomix output:
json
{
"files": [
{
"path": "relative/path/to/file.ext",
"content": "file content here"
}
]
}适用于JSON风格的repomix输出:
json
{
"files": [
{
"path": "relative/path/to/file.ext",
"content": "file content here"
}
]
}Common Use Cases
常见使用场景
Use Case 1: Unmix Claude Skills
场景1:拆分Claude技能
Extract skills that were shared as a repomix file:
bash
python3 scripts/unmix_repomix.py \
"/path/to/skills.xml" \
"/tmp/unmixed-skills"Then review, validate, or install the extracted skills.
提取以repomix文件分享的技能:
bash
python3 scripts/unmix_repomix.py \
"/path/to/skills.xml" \
"/tmp/unmixed-skills"之后可审查、验证或安装提取的技能。
Use Case 2: Extract Repository for Review
场景2:提取仓库用于审查
Extract a packed repository to review its structure and contents:
bash
python3 scripts/unmix_repomix.py \
"/path/to/repo-output.xml" \
"/tmp/review-repo"提取打包的仓库以审查其结构和内容:
bash
python3 scripts/unmix_repomix.py \
"/path/to/repo-output.xml" \
"/tmp/review-repo"Review the structure
查看目录结构
tree /tmp/review-repo
undefinedtree /tmp/review-repo
undefinedUse Case 3: Restore Working Files
场景3:恢复工作文件
Restore files from a repomix backup to a working directory:
bash
python3 scripts/unmix_repomix.py \
"/path/to/backup.xml" \
"~/workspace/restored-project"从repomix备份中恢复文件到工作目录:
bash
python3 scripts/unmix_repomix.py \
"/path/to/backup.xml" \
"~/workspace/restored-project"Validation Workflow
验证流程
After unmixing, validate the extracted files are correct:
- Check file count: Verify the number of extracted files matches expectations
- Review structure: Use or
treeto inspect directory layoutls -R - Spot check content: Read a few key files to verify content integrity
- Run validation: For skills, use the skill-creator validation tools
Refer to for detailed validation procedures, especially for unmixing Claude skills.
references/validation-workflow.md拆分完成后,验证提取的文件是否正确:
- 检查文件数量:确认提取的文件数量符合预期
- 审查目录结构:使用或
tree检查目录布局ls -R - 抽查内容:读取几个关键文件以验证内容完整性
- 运行验证:对于技能,使用skill-creator验证工具
详细验证流程请参考,尤其是拆分Claude技能时。
references/validation-workflow.mdImportant Principles
重要原则
Always Specify Output Directory
始终指定输出目录
Always provide an output directory to avoid cluttering the current working directory:
bash
undefined始终提供输出目录,避免混乱当前工作目录:
bash
undefinedGood: Explicit output directory
推荐:明确指定输出目录
python3 scripts/unmix_repomix.py
"input.xml" "/tmp/output"
"input.xml" "/tmp/output"
python3 scripts/unmix_repomix.py
"input.xml" "/tmp/output"
"input.xml" "/tmp/output"
Avoid: Default output (may clutter current directory)
避免:使用默认输出(可能混乱当前目录)
python3 scripts/unmix_repomix.py "input.xml"
undefinedpython3 scripts/unmix_repomix.py "input.xml"
undefinedUse Temporary Directories for Review
使用临时目录进行审查
Extract to temporary directories first for review:
bash
undefined先提取到临时目录进行审查:
bash
undefinedExtract to /tmp for review
提取到/tmp目录进行审查
python3 scripts/unmix_repomix.py
"skills.xml" "/tmp/review-skills"
"skills.xml" "/tmp/review-skills"
python3 scripts/unmix_repomix.py
"skills.xml" "/tmp/review-skills"
"skills.xml" "/tmp/review-skills"
Review the contents
查看内容
tree /tmp/review-skills
tree /tmp/review-skills
If satisfied, copy to final destination
若满意,复制到最终目标位置
cp -r /tmp/review-skills ~/.claude/skills/
undefinedcp -r /tmp/review-skills ~/.claude/skills/
undefinedVerify Before Overwriting
覆盖前先验证
Never extract directly to important directories without review:
bash
undefined未经审查,切勿直接提取到重要目录:
bash
undefinedBad: Might overwrite existing files
不推荐:可能覆盖现有文件
python3 scripts/unmix_repomix.py
"repo.xml" "~/workspace/my-project"
"repo.xml" "~/workspace/my-project"
python3 scripts/unmix_repomix.py
"repo.xml" "~/workspace/my-project"
"repo.xml" "~/workspace/my-project"
Good: Extract to temp, review, then move
推荐:先提取到临时目录,审查后再移动
python3 scripts/unmix_repomix.py
"repo.xml" "/tmp/extracted"
"repo.xml" "/tmp/extracted"
python3 scripts/unmix_repomix.py
"repo.xml" "/tmp/extracted"
"repo.xml" "/tmp/extracted"
Review, then:
审查后执行:
mv /tmp/extracted ~/workspace/my-project
undefinedmv /tmp/extracted ~/workspace/my-project
undefinedTroubleshooting
故障排除
No Files Extracted
未提取任何文件
Issue: Script completes but no files are extracted.
Possible causes:
- Wrong file format (not a repomix file)
- Unsupported repomix format version
- File path pattern doesn't match
Solution:
- Verify the input file is a repomix output file
- Check the format (XML/Markdown/JSON)
- Examine the file structure manually
- Refer to for format details
references/repomix-format.md
问题:脚本执行完成但未提取任何文件。
可能原因:
- 文件格式错误(不是repomix文件)
- 不支持的repomix格式版本
- 文件路径模式不匹配
解决方案:
- 验证输入文件是否为repomix输出文件
- 检查格式(XML/Markdown/JSON)
- 手动检查文件结构
- 参考了解格式细节
references/repomix-format.md
Permission Errors
权限错误
Issue: Cannot write to output directory.
Solution:
bash
undefined问题:无法写入输出目录。
解决方案:
bash
undefinedEnsure output directory is writable
确保输出目录可写
mkdir -p /tmp/output
chmod 755 /tmp/output
mkdir -p /tmp/output
chmod 755 /tmp/output
Or use a directory you own
或使用您拥有权限的目录
python3 scripts/unmix_repomix.py
"input.xml" "$HOME/extracted"
"input.xml" "$HOME/extracted"
undefinedpython3 scripts/unmix_repomix.py
"input.xml" "$HOME/extracted"
"input.xml" "$HOME/extracted"
undefinedEncoding Issues
编码问题
Issue: Special characters appear garbled in extracted files.
Solution:
The script uses UTF-8 encoding by default. If issues persist:
- Check the original repomix file encoding
- Verify the file was created correctly
- Report the issue with specific character examples
问题:提取的文件中特殊字符显示乱码。
解决方案:
脚本默认使用UTF-8编码。若问题仍然存在:
- 检查原始repomix文件的编码
- 验证文件是否正确创建
- 提供具体字符示例报告问题
Path Already Exists
路径已存在
Issue: Files exist at extraction path.
Solution:
bash
undefined问题:提取路径下已存在文件。
解决方案:
bash
undefinedOption 1: Use a fresh output directory
选项1:使用新的输出目录
python3 scripts/unmix_repomix.py
"input.xml" "/tmp/output-$(date +%s)"
"input.xml" "/tmp/output-$(date +%s)"
python3 scripts/unmix_repomix.py
"input.xml" "/tmp/output-$(date +%s)"
"input.xml" "/tmp/output-$(date +%s)"
Option 2: Clear the directory first
选项2:先清空目录
rm -rf /tmp/output && mkdir /tmp/output
python3 scripts/unmix_repomix.py
"input.xml" "/tmp/output"
"input.xml" "/tmp/output"
undefinedrm -rf /tmp/output && mkdir /tmp/output
python3 scripts/unmix_repomix.py
"input.xml" "/tmp/output"
"input.xml" "/tmp/output"
undefinedBest Practices
最佳实践
- Extract to temp directories - Always extract to or similar for initial review
/tmp - Verify file count - Check that extracted file count matches expectations
- Review structure - Use to inspect directory layout before use
tree - Check content - Spot-check a few files to ensure content is intact
- Use validation tools - For skills, use skill-creator validation after unmixing
- Preserve originals - Keep the original repomix file as backup
- 提取到临时目录 - 始终先提取到或类似目录进行初始审查
/tmp - 验证文件数量 - 检查提取的文件数量是否符合预期
- 审查目录结构 - 在使用前用检查目录布局
tree - 检查内容 - 抽查几个文件确保内容完整
- 使用验证工具 - 对于技能,拆分后使用skill-creator验证
- 保留原始文件 - 将原始repomix文件作为备份保存
Resources
资源
scripts/unmix_repomix.py
scripts/unmix_repomix.py
Main unmixing script that:
- Parses repomix XML/Markdown/JSON formats
- Extracts file paths and content using regex
- Creates directory structures automatically
- Writes files to their original locations
- Reports extraction progress and statistics
The script is self-contained and requires only Python 3 standard library.
主拆分脚本功能:
- 解析repomix XML/Markdown/JSON格式
- 使用正则表达式提取文件路径和内容
- 自动创建目录结构
- 将文件写入原始位置
- 报告提取进度和统计信息
该脚本为独立脚本,仅需Python 3标准库即可运行。
references/repomix-format.md
references/repomix-format.md
Comprehensive documentation of repomix file formats including:
- XML format structure and examples
- Markdown format patterns
- JSON format schema
- File path encoding rules
- Content extraction patterns
- Format version differences
Load this reference when dealing with format-specific issues or supporting new repomix versions.
Repomix文件格式的综合文档,包括:
- XML格式结构和示例
- Markdown格式模式
- JSON格式 schema
- 文件路径编码规则
- 内容提取模式
- 格式版本差异
处理格式特定问题或支持新repomix版本时,请参考该文档。
references/validation-workflow.md
references/validation-workflow.md
Detailed validation procedures for extracted content including:
- File count verification steps
- Directory structure validation
- Content integrity checks
- Skill-specific validation using skill-creator tools
- Quality assurance checklists
Load this reference when users need to validate unmixed skills or verify extraction quality.
提取内容的详细验证流程,包括:
- 文件数量验证步骤
- 目录结构验证
- 内容完整性检查
- 使用skill-creator工具进行技能特定验证
- 质量保证检查表
当用户需要验证拆分后的技能或检查提取质量时,请参考该文档。