monopack is a CLI tool that packs an entire directory structure into a single Markdown file — and can unpack it back into its original files.
It is designed for developers who want to easily archive, share, and version entire codebases as readable and LLM-friendly Markdown documents.
-
📦 Pack directories into Markdown
- Recursively scans source files based on include/exclude patterns.
- Preserves directory hierarchy in a tree view.
- Embeds file contents in fenced code blocks with language tags.
-
📂 Unpack Markdown back into files
- Fully restores the directory and file structure from the Markdown archive.
- Detects and safely handles overwriting with the
--forceoption.
-
⚙️ Flexible include/exclude configuration
- Include/exclude patterns can be defined via command line options or configuration files.
-
🔒 Encryption/decryption options (not yet implemented)
- CLI flags for --encrypt / --decrypt are defined but not yet implemented.
You can build and install monopack using Cargo:
cd <monopack>
cargo install --path .monopack pack ./src -o project.md --include "**/*.rs,**/*.py" --exclude "target/*"This command:
- Recursively scans
src/ - Includes only
.rsand.pyfiles - Excludes the
target/directory - Writes the result to
project.md
monopack unpack project.md -o ./restoredThis restores all files from the Markdown archive into ./restored.
You can specify include/exclude patterns directly:
--include "**/*.rs,**/*.py" --exclude "target/*"monopack can also read configuration files from the current directory or a specified path:
.monopack_include— patterns of files to include.monopack_ignore— patterns of files to exclude
Each file should contain one glob pattern per line.
Blank lines and lines starting with # are ignored.
.monopack_include:
**/*.rs
**/*.pyThis example tells monopack to include all Rust (.rs) and Python (.py) files recursively.
.monopack_ignore:
target/*
**/__pycache__/*
.git/*This example excludes the build directory, Python cache folders, and the .git directory.
--config-dirCLI optionMONOPACK_CONFIG_DIRenvironment variable- Current working directory (
.)
The include/exclude patterns can be specified in two ways:
- CLI options —
--include,--exclude - Config files —
.monopack_include,.monopack_ignore
If both are present, CLI options always take precedence.
When CLI patterns are given, monopack completely ignores the config files.
| Source | Priority | Description |
|---|---|---|
--include, --exclude |
High | Explicit patterns passed from the command line |
.monopack_include, .monopack_ignore |
Medium | Loaded automatically from the config directory |
| (Default) | Low | Includes all files (**/*) if no patterns are specified |
You can specify a custom directory for config files using --config-dir
or the environment variable MONOPACK_CONFIG_DIR.
You may provide only one of the config files — for example,
use .monopack_include alone if you only need inclusion rules,
or .monopack_ignore alone if you only need exclusions.
monopack will automatically fall back to defaults for the missing file.
If neither CLI options nor config files are provided,
monopack includes all files recursively by default (**/*).
monopack automatically detects file extensions and applies
language-specific fenced code blocks for syntax highlighting.
Common languages such as Rust, Python, C/C++, Markdown, JavaScript, TypeScript, Go, Java, and Shell scripts are supported out of the box.
Files with unsupported extensions are written as fenced code blocks without a language tag.
monopack pack <SRC_DIR> -o <OUTPUT> [OPTIONS]| Option | Description |
|---|---|
--include |
Comma-separated glob patterns to include (default: **/*) |
--exclude |
Comma-separated glob patterns to exclude (default: None) |
--config-dir |
Directory to search for .monopack_include / .monopack_ignore |
--force |
Overwrite existing output file or create missing directories |
--encrypt / --passphrase |
(Not implemented yet) |
monopack unpack <INPUT> -o <OUTPUT> [OPTIONS]| Option | Description |
|---|---|
--force |
Overwrite existing files |
--decrypt / --passphrase |
(Not implemented yet) |
This project is distributed under the MIT License.