How to set per-file inclusion levels (full, compressed, directory-only) in repomix?
I'm using repomix to pack a codebase and want different detail levels per file: full content for important config/build files, compressed content for less important modules, and just a directory-structure listing for the rest. Is there a built-in way to configure inclusion levels per glob pattern, and which repomix version supports it? A GitHub discussion (May 2025) proposed an output.patterns array and the feature has since been released.
Originally asked on GitHub: https://github.com/yamadashy/repomix/issues/608
4 answers
This feature is available: output.patterns shipped in repomix v1.16.0, and v1.17.0 added MCP support for per-call overrides. Repomix supports three per-file inclusion levels — full content, compressed content, and directory-structure-only — through an ordered output.patterns array where the first matching entry wins and the global output.compress acts as the catch-all:
json5{ "output": { "compress": false, "patterns": [ { "pattern": "docs/**/*", "compress": true }, { "pattern": "website/**/*", "directoryStructureOnly": true } ] } }Files are resolved in pattern order: compress: false (the default) means full content, compress: true means the compressed representation, and directoryStructureOnly: true keeps the file in the generated directory tree without its content. Files matching no pattern fall back to the global output.compress. When calling via MCP, the pack_codebase and pack_remote_repository tools accept an outputPatterns parameter so each invocation can override inclusion levels per file. One limitation acknowledged by the maintainers: output.patterns only applies to files that pass the include/ignore filtering, so a directoryStructureOnly pattern cannot bring an ignored file back into the directory listing; keep empty directories with the existing output.includeEmptyDirectories option. Documentation: https://repomix.com/guide/configuration#per-file-inclusion-levels (opens external site).
Did this work for you?What @yamadashy tried on GitHub (Worked)
Maintainer confirmed the released implementation: an ordered output.patterns array with first-match-wins and global output.compress as fallback, shipped in v1.16.0, with MCP outputPatterns support in v1.17.0; directoryStructureOnly keeps files in the tree without content.
Source: https://github.com/yamadashy/repomix/issues/608#issuecomment-5077430727 (opens external site)
Did this work for you?What @yamadashy tried on GitHub (Worked)
Maintainer proposed a backward-compatible design: keep the global output.compress setting and add an ordered output.patterns list where each entry can set compress or directoryStructureOnly per glob.
Source: https://github.com/yamadashy/repomix/issues/608#issuecomment-2925185875 (opens external site)
Did this work for you?What a GitHub user tried on GitHub (Outcome unclear)
Reporter proposed an alternative syntax using files.content, files.compress, and directory globs, and wanted directory globs to take precedence over all ignores.
Source: https://github.com/yamadashy/repomix/issues/608 (opens external site)
Did this work for you?
Related questions
- How to pack a remote repository from a specific branch or commit in repomix?
- How to pack only currently open files in VSCode with Repomix?
- Repomix: how to split packed output into multiple files for large codebases?
- Can I use multiple named configs in repomix.config.json for subdirectories?
- How do I run external commands on files before packing with repomix?