repomix-unmixer

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Repomix 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
unmix_repomix.py
script:
bash
python3 scripts/unmix_repomix.py \
  "<path_to_repomix_file>" \
  "<output_directory>"
Parameters:
  • <path_to_repomix_file>
    : Path to the repomix output file (XML, Markdown, or JSON)
  • <output_directory>
    : Directory where files will be extracted (will be created if doesn't exist)
Example:
bash
python3 scripts/unmix_repomix.py \
  "/path/to/repomix-output.xml" \
  "/tmp/extracted-files"
使用附带的
unmix_repomix.py
脚本从repomix文件中提取所有文件并恢复原始目录结构:
bash
python3 scripts/unmix_repomix.py \
  "<path_to_repomix_file>" \
  "<output_directory>"
参数说明:
  • <path_to_repomix_file>
    :repomix输出文件的路径(XML、Markdown或JSON格式)
  • <output_directory>
    :文件提取后的输出目录(若不存在将自动创建)
示例:
bash
python3 scripts/unmix_repomix.py \
  "/path/to/repomix-output.xml" \
  "/tmp/extracted-files"

What the Script Does

脚本工作原理

  1. Parses the repomix file format (XML, Markdown, or JSON)
  2. Extracts each file path and content
  3. Creates the original directory structure
  4. Writes each file to its original location
  5. Reports extraction progress and statistics
  1. 解析repomix文件格式(XML、Markdown或JSON)
  2. 提取每个文件的路径和内容
  3. 创建原始目录结构
  4. 写入每个文件到其原始位置
  5. 报告提取进度和统计信息

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-files

Supported 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
<file path="...">content</file>
blocks.
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
undefined

File: 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
undefined
tree /tmp/review-repo
undefined

Use 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:
  1. Check file count: Verify the number of extracted files matches expectations
  2. Review structure: Use
    tree
    or
    ls -R
    to inspect directory layout
  3. Spot check content: Read a few key files to verify content integrity
  4. Run validation: For skills, use the skill-creator validation tools
Refer to
references/validation-workflow.md
for detailed validation procedures, especially for unmixing Claude skills.
拆分完成后,验证提取的文件是否正确:
  1. 检查文件数量:确认提取的文件数量符合预期
  2. 审查目录结构:使用
    tree
    ls -R
    检查目录布局
  3. 抽查内容:读取几个关键文件以验证内容完整性
  4. 运行验证:对于技能,使用skill-creator验证工具
详细验证流程请参考
references/validation-workflow.md
,尤其是拆分Claude技能时。

Important Principles

重要原则

Always Specify Output Directory

始终指定输出目录

Always provide an output directory to avoid cluttering the current working directory:
bash
undefined
始终提供输出目录,避免混乱当前工作目录:
bash
undefined

Good: Explicit output directory

推荐:明确指定输出目录

python3 scripts/unmix_repomix.py
"input.xml" "/tmp/output"
python3 scripts/unmix_repomix.py
"input.xml" "/tmp/output"

Avoid: Default output (may clutter current directory)

避免:使用默认输出(可能混乱当前目录)

python3 scripts/unmix_repomix.py "input.xml"
undefined
python3 scripts/unmix_repomix.py "input.xml"
undefined

Use Temporary Directories for Review

使用临时目录进行审查

Extract to temporary directories first for review:
bash
undefined
先提取到临时目录进行审查:
bash
undefined

Extract to /tmp for review

提取到/tmp目录进行审查

python3 scripts/unmix_repomix.py
"skills.xml" "/tmp/review-skills"
python3 scripts/unmix_repomix.py
"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/
undefined
cp -r /tmp/review-skills ~/.claude/skills/
undefined

Verify Before Overwriting

覆盖前先验证

Never extract directly to important directories without review:
bash
undefined
未经审查,切勿直接提取到重要目录:
bash
undefined

Bad: Might overwrite existing files

不推荐:可能覆盖现有文件

python3 scripts/unmix_repomix.py
"repo.xml" "~/workspace/my-project"
python3 scripts/unmix_repomix.py
"repo.xml" "~/workspace/my-project"

Good: Extract to temp, review, then move

推荐:先提取到临时目录,审查后再移动

python3 scripts/unmix_repomix.py
"repo.xml" "/tmp/extracted"
python3 scripts/unmix_repomix.py
"repo.xml" "/tmp/extracted"

Review, then:

审查后执行:

mv /tmp/extracted ~/workspace/my-project
undefined
mv /tmp/extracted ~/workspace/my-project
undefined

Troubleshooting

故障排除

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:
  1. Verify the input file is a repomix output file
  2. Check the format (XML/Markdown/JSON)
  3. Examine the file structure manually
  4. Refer to
    references/repomix-format.md
    for format details
问题:脚本执行完成但未提取任何文件。
可能原因:
  • 文件格式错误(不是repomix文件)
  • 不支持的repomix格式版本
  • 文件路径模式不匹配
解决方案:
  1. 验证输入文件是否为repomix输出文件
  2. 检查格式(XML/Markdown/JSON)
  3. 手动检查文件结构
  4. 参考
    references/repomix-format.md
    了解格式细节

Permission Errors

权限错误

Issue: Cannot write to output directory.
Solution:
bash
undefined
问题:无法写入输出目录。
解决方案:
bash
undefined

Ensure 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"
undefined
python3 scripts/unmix_repomix.py
"input.xml" "$HOME/extracted"
undefined

Encoding 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
undefined

Option 1: Use a fresh output directory

选项1:使用新的输出目录

python3 scripts/unmix_repomix.py
"input.xml" "/tmp/output-$(date +%s)"
python3 scripts/unmix_repomix.py
"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"
undefined
rm -rf /tmp/output && mkdir /tmp/output python3 scripts/unmix_repomix.py
"input.xml" "/tmp/output"
undefined

Best Practices

最佳实践

  1. Extract to temp directories - Always extract to
    /tmp
    or similar for initial review
  2. Verify file count - Check that extracted file count matches expectations
  3. Review structure - Use
    tree
    to inspect directory layout before use
  4. Check content - Spot-check a few files to ensure content is intact
  5. Use validation tools - For skills, use skill-creator validation after unmixing
  6. Preserve originals - Keep the original repomix file as backup
  1. 提取到临时目录 - 始终先提取到
    /tmp
    或类似目录进行初始审查
  2. 验证文件数量 - 检查提取的文件数量是否符合预期
  3. 审查目录结构 - 在使用前用
    tree
    检查目录布局
  4. 检查内容 - 抽查几个文件确保内容完整
  5. 使用验证工具 - 对于技能,拆分后使用skill-creator验证
  6. 保留原始文件 - 将原始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工具进行技能特定验证
  • 质量保证检查表
当用户需要验证拆分后的技能或检查提取质量时,请参考该文档。