repomix-unmixer 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 darizae
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,131 @@
1
+ Metadata-Version: 2.4
2
+ Name: repomix-unmixer
3
+ Version: 0.1.0
4
+ Summary: Reconstruct static file trees from Repomix exports without running recovered code
5
+ Author: darizae
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/darizae/repomix-unmixer
8
+ Project-URL: Repository, https://github.com/darizae/repomix-unmixer
9
+ Project-URL: Issues, https://github.com/darizae/repomix-unmixer/issues
10
+ Keywords: repomix,unmix,unpack,static,offline,repository,export
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Software Development :: Build Tools
21
+ Classifier: Topic :: Utilities
22
+ Requires-Python: >=3.10
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Provides-Extra: dev
26
+ Requires-Dist: build; extra == "dev"
27
+ Requires-Dist: twine; extra == "dev"
28
+ Dynamic: license-file
29
+
30
+ <div align="center">
31
+ <picture>
32
+ <source media="(prefers-color-scheme: dark)" srcset="assets/brand/wordmark-dark.svg">
33
+ <img src="assets/brand/wordmark-light.svg" alt="repomix-unmixer logo" width="530">
34
+ </picture>
35
+ </div>
36
+
37
+ # repomix-unmixer
38
+
39
+ **Unmix Repomix. Inspect the code, not its side effects.**
40
+
41
+ **Security-first, offline unpacking:** reconstruct [Repomix](https://repomix.com/) Markdown, XML and JSON exports into readable file trees—**without ever executing recovered code**. The extractor rejects unsafe paths, refuses overwrites, enforces resource limits and omits common auto-activating configurations.
42
+
43
+ Built for **safer static inspection** of untrusted exports in a trusted local output directory; not a sandbox, malware scanner or guarantee that recovered files are confidential.
44
+
45
+ ## Core features
46
+
47
+ - **Three export formats:** reconstruct text files and directories from Repomix **Markdown, XML and JSON**.
48
+ - **Block unsafe paths:** reject traversal, Windows-special names, duplicate/case-colliding paths and file/directory conflicts before writing.
49
+ - **Protect existing files:** dry-run first; fresh-output-only staged writes refuse existing destinations, with file-count and byte limits.
50
+ - **Reduce accidental auto-execution:** exclude common agent/IDE auto-start configuration and environment files; never run recovered code or make network requests.
51
+ - **CLI, batches and agents:** `unmix-repomix` for individual exports, `reconstruct-all` for Markdown batches, plus the portable Agent Skill.
52
+
53
+ ## Quick start
54
+
55
+ Requires **Python 3.10+**. From a trusted checkout (not from a recovered repository):
56
+
57
+ ```bash
58
+ python3 -m pip install .
59
+ ```
60
+
61
+ **One export (Markdown, XML or JSON)**
62
+
63
+ ```bash
64
+ unmix-repomix ./repomix-output.md ./restored-tree --dry-run
65
+ unmix-repomix ./repomix-output.md ./restored-tree
66
+ # Other supported formats:
67
+ unmix-repomix ./repomix-output.xml ./restored-xml
68
+ unmix-repomix ./repomix-output.json ./restored-json
69
+ ```
70
+
71
+ The CLI detects the input format automatically. For XML, Repomix `--parsable-style` is recommended when content is ambiguous. Plain-text and line-numbered exports are unsupported.
72
+
73
+ **Batch Markdown exports**
74
+
75
+ Place your own `.md` exports inside `repomix-files/` (ignored by Git), then:
76
+
77
+ ```bash
78
+ reconstruct-all --dry-run
79
+ reconstruct-all
80
+ ```
81
+
82
+ Batch output appears in `reconstructed/`. The original export and any reconstructed files remain your responsibility; never commit or publish them without review.
83
+
84
+ ## Use it with an AI coding agent
85
+
86
+ This repository includes a [portable Agent Skill](skills/repomix-unmixer/SKILL.md). Agent-host integration is not yet verified on every platform (tracked as P1-08).
87
+
88
+ **Agent setup prompt — copy and paste:**
89
+
90
+ ```text
91
+ Work in this trusted repomix-unmixer repository.
92
+ Read AGENTS.md, SECURITY.md, and
93
+ skills/repomix-unmixer/SKILL.md.
94
+
95
+ Set up the Python CLI in an isolated environment from this trusted
96
+ checkout, check --version and --help, and run only the included
97
+ synthetic extractor tests. If this agent host supports Agent Skills,
98
+ register the existing skill using its documented mechanism; otherwise
99
+ use the CLI directly. Do not invent host-specific installation steps.
100
+
101
+ Never execute, import, build, install, test, or run tools from files
102
+ reconstructed from a Repomix export. Keep the repository private,
103
+ never commit input/output snapshots, and report what you verified
104
+ and which host checks remain deferred.
105
+ ```
106
+
107
+ For development tasks, tell the agent to read [AGENTS.md](AGENTS.md) and tackle one ID from [the backlog](docs/BACKLOG.md), using a branch, tests, commit, push and PR.
108
+
109
+ ## How it fits
110
+
111
+ | | Repomix | repomix-unmixer |
112
+ |---|---|---|
113
+ | Direction | Repository → packed export | Packed export → file tree |
114
+ | Main job | Prepare an aggregated code snapshot | Recreate individual files for inspection |
115
+ | Execution | Separate tool | Never runs recovered code |
116
+
117
+ repomix-unmixer is **independent of the Repomix project**, not an official Repomix component.
118
+
119
+ ## Safety and limitations
120
+
121
+ Reconstructed content is **untrusted** and may include secrets. Exclusions are not secret scanning; neither input nor output is automatically safe to share. Avoid opening output in tools that run workspace tasks or auto-load plugins. Use a fresh directory that other users cannot modify.
122
+
123
+ Parser fixtures were checked against Repomix **1.17.0–1.19.0**. Plain-text and line-numbered exports are unsupported; original Git history, omitted binaries and information removed by Repomix cannot be recovered.
124
+
125
+ Read [Security](SECURITY.md), [static inspection](docs/STATIC_INSPECTION.md), [parser compatibility](docs/PARSER_COMPATIBILITY.md), and [exclusion rules](docs/EXCLUSIONS.md) before handling untrusted inputs.
126
+
127
+ ## Documentation
128
+
129
+ [Docs preview](docs/site/README.md) · [FAQ](docs/FAQ.md) · [Agent Skill](skills/repomix-unmixer/SKILL.md) · [Contributing](CONTRIBUTING.md) · [Backlog](docs/BACKLOG.md) · [Release checklist](docs/RELEASE_CHECKLIST.md)
130
+
131
+ **Status:** private pre-release, [MIT-licensed](LICENSE). No PyPI release is claimed. Public release requires completion of the remaining security and provenance checks.
@@ -0,0 +1,102 @@
1
+ <div align="center">
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="assets/brand/wordmark-dark.svg">
4
+ <img src="assets/brand/wordmark-light.svg" alt="repomix-unmixer logo" width="530">
5
+ </picture>
6
+ </div>
7
+
8
+ # repomix-unmixer
9
+
10
+ **Unmix Repomix. Inspect the code, not its side effects.**
11
+
12
+ **Security-first, offline unpacking:** reconstruct [Repomix](https://repomix.com/) Markdown, XML and JSON exports into readable file trees—**without ever executing recovered code**. The extractor rejects unsafe paths, refuses overwrites, enforces resource limits and omits common auto-activating configurations.
13
+
14
+ Built for **safer static inspection** of untrusted exports in a trusted local output directory; not a sandbox, malware scanner or guarantee that recovered files are confidential.
15
+
16
+ ## Core features
17
+
18
+ - **Three export formats:** reconstruct text files and directories from Repomix **Markdown, XML and JSON**.
19
+ - **Block unsafe paths:** reject traversal, Windows-special names, duplicate/case-colliding paths and file/directory conflicts before writing.
20
+ - **Protect existing files:** dry-run first; fresh-output-only staged writes refuse existing destinations, with file-count and byte limits.
21
+ - **Reduce accidental auto-execution:** exclude common agent/IDE auto-start configuration and environment files; never run recovered code or make network requests.
22
+ - **CLI, batches and agents:** `unmix-repomix` for individual exports, `reconstruct-all` for Markdown batches, plus the portable Agent Skill.
23
+
24
+ ## Quick start
25
+
26
+ Requires **Python 3.10+**. From a trusted checkout (not from a recovered repository):
27
+
28
+ ```bash
29
+ python3 -m pip install .
30
+ ```
31
+
32
+ **One export (Markdown, XML or JSON)**
33
+
34
+ ```bash
35
+ unmix-repomix ./repomix-output.md ./restored-tree --dry-run
36
+ unmix-repomix ./repomix-output.md ./restored-tree
37
+ # Other supported formats:
38
+ unmix-repomix ./repomix-output.xml ./restored-xml
39
+ unmix-repomix ./repomix-output.json ./restored-json
40
+ ```
41
+
42
+ The CLI detects the input format automatically. For XML, Repomix `--parsable-style` is recommended when content is ambiguous. Plain-text and line-numbered exports are unsupported.
43
+
44
+ **Batch Markdown exports**
45
+
46
+ Place your own `.md` exports inside `repomix-files/` (ignored by Git), then:
47
+
48
+ ```bash
49
+ reconstruct-all --dry-run
50
+ reconstruct-all
51
+ ```
52
+
53
+ Batch output appears in `reconstructed/`. The original export and any reconstructed files remain your responsibility; never commit or publish them without review.
54
+
55
+ ## Use it with an AI coding agent
56
+
57
+ This repository includes a [portable Agent Skill](skills/repomix-unmixer/SKILL.md). Agent-host integration is not yet verified on every platform (tracked as P1-08).
58
+
59
+ **Agent setup prompt — copy and paste:**
60
+
61
+ ```text
62
+ Work in this trusted repomix-unmixer repository.
63
+ Read AGENTS.md, SECURITY.md, and
64
+ skills/repomix-unmixer/SKILL.md.
65
+
66
+ Set up the Python CLI in an isolated environment from this trusted
67
+ checkout, check --version and --help, and run only the included
68
+ synthetic extractor tests. If this agent host supports Agent Skills,
69
+ register the existing skill using its documented mechanism; otherwise
70
+ use the CLI directly. Do not invent host-specific installation steps.
71
+
72
+ Never execute, import, build, install, test, or run tools from files
73
+ reconstructed from a Repomix export. Keep the repository private,
74
+ never commit input/output snapshots, and report what you verified
75
+ and which host checks remain deferred.
76
+ ```
77
+
78
+ For development tasks, tell the agent to read [AGENTS.md](AGENTS.md) and tackle one ID from [the backlog](docs/BACKLOG.md), using a branch, tests, commit, push and PR.
79
+
80
+ ## How it fits
81
+
82
+ | | Repomix | repomix-unmixer |
83
+ |---|---|---|
84
+ | Direction | Repository → packed export | Packed export → file tree |
85
+ | Main job | Prepare an aggregated code snapshot | Recreate individual files for inspection |
86
+ | Execution | Separate tool | Never runs recovered code |
87
+
88
+ repomix-unmixer is **independent of the Repomix project**, not an official Repomix component.
89
+
90
+ ## Safety and limitations
91
+
92
+ Reconstructed content is **untrusted** and may include secrets. Exclusions are not secret scanning; neither input nor output is automatically safe to share. Avoid opening output in tools that run workspace tasks or auto-load plugins. Use a fresh directory that other users cannot modify.
93
+
94
+ Parser fixtures were checked against Repomix **1.17.0–1.19.0**. Plain-text and line-numbered exports are unsupported; original Git history, omitted binaries and information removed by Repomix cannot be recovered.
95
+
96
+ Read [Security](SECURITY.md), [static inspection](docs/STATIC_INSPECTION.md), [parser compatibility](docs/PARSER_COMPATIBILITY.md), and [exclusion rules](docs/EXCLUSIONS.md) before handling untrusted inputs.
97
+
98
+ ## Documentation
99
+
100
+ [Docs preview](docs/site/README.md) · [FAQ](docs/FAQ.md) · [Agent Skill](skills/repomix-unmixer/SKILL.md) · [Contributing](CONTRIBUTING.md) · [Backlog](docs/BACKLOG.md) · [Release checklist](docs/RELEASE_CHECKLIST.md)
101
+
102
+ **Status:** private pre-release, [MIT-licensed](LICENSE). No PyPI release is claimed. Public release requires completion of the remaining security and provenance checks.
@@ -0,0 +1,88 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "repomix-unmixer"
7
+ version = "0.1.0"
8
+ description = "Reconstruct static file trees from Repomix exports without running recovered code"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = "MIT"
12
+ license-files = ["LICENSE"]
13
+ authors = [{ name = "darizae" }]
14
+ keywords = ["repomix", "unmix", "unpack", "static", "offline", "repository", "export"]
15
+ classifiers = [
16
+ "Development Status :: 3 - Alpha",
17
+ "Environment :: Console",
18
+ "Intended Audience :: Developers",
19
+ "Operating System :: OS Independent",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3.10",
22
+ "Programming Language :: Python :: 3.11",
23
+ "Programming Language :: Python :: 3.12",
24
+ "Programming Language :: Python :: 3.13",
25
+ "Topic :: Software Development :: Build Tools",
26
+ "Topic :: Utilities",
27
+ ]
28
+
29
+ [project.urls]
30
+ Homepage = "https://github.com/darizae/repomix-unmixer"
31
+ Repository = "https://github.com/darizae/repomix-unmixer"
32
+ Issues = "https://github.com/darizae/repomix-unmixer/issues"
33
+
34
+ [project.scripts]
35
+ unmix-repomix = "repomix_unmixer.extractor:main"
36
+ reconstruct-all = "repomix_unmixer.batch:main"
37
+
38
+ [project.optional-dependencies]
39
+ dev = ["build", "twine"]
40
+
41
+ [tool.setuptools]
42
+ package-dir = { "" = "src" }
43
+ packages = ["repomix_unmixer"]
44
+
45
+ [tool.setuptools.package-data]
46
+ repomix_unmixer = ["py.typed"]
47
+
48
+ [tool.ruff]
49
+ target-version = "py310"
50
+ line-length = 100
51
+
52
+ [tool.ruff.lint]
53
+ # Explicit selection, not default evolution: CI results stay stable across ruff
54
+ # releases. Extend this list deliberately when adopting new rule families.
55
+ select = [
56
+ "E", # pycodestyle errors
57
+ "W", # pycodestyle warnings
58
+ "F", # pyflakes
59
+ "I", # isort
60
+ "B", # flake8-bugbear
61
+ "UP", # pyupgrade
62
+ "SIM", # flake8-simplify
63
+ "RUF", # ruff-specific
64
+ "PIE", # flake8-pie
65
+ "PLW", # pylint warnings
66
+ "EXE", # flake8-executable
67
+ ]
68
+ ignore = [
69
+ # Tests insert sys.path before package imports by design.
70
+ "E402",
71
+ # Deliberate: subprocess return codes are asserted by hand for diagnostics.
72
+ "PLW1510",
73
+ ]
74
+
75
+ [tool.ruff.lint.per-file-ignores]
76
+ # package __init__ re-exports intentionally grouped by module of origin
77
+ "src/repomix_unmixer/__init__.py" = ["I001", "RUF022"]
78
+
79
+ [tool.mypy]
80
+ python_version = "3.10"
81
+ warn_unused_configs = true
82
+ warn_redundant_casts = true
83
+ warn_unused_ignores = true
84
+ check_untyped_defs = true
85
+
86
+ [[tool.mypy.overrides]]
87
+ module = "tests.*"
88
+ disable_error_code = ["no-untyped-def"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,54 @@
1
+ """Static reconstruction of files from Repomix exports.
2
+
3
+ Reconstruct repository-shaped, static files from Repomix Markdown, XML, or
4
+ JSON exports for offline inspection only. This package never executes
5
+ recovered code, never contacts the network, and never rewrites retained
6
+ paths or contents.
7
+ """
8
+
9
+ from __future__ import annotations
10
+
11
+ from repomix_unmixer.extractor import (
12
+ DEFAULT_MAX_FILE_MIB,
13
+ DEFAULT_MAX_FILES,
14
+ DEFAULT_MAX_INPUT_MIB,
15
+ DEFAULT_MAX_TOTAL_MIB,
16
+ PreparedEntry,
17
+ ParsedEntry,
18
+ UnmixError,
19
+ UnmixResult,
20
+ detect_format,
21
+ exclusion_category,
22
+ mib_to_bytes,
23
+ normalize_archive_path,
24
+ parse_json,
25
+ parse_markdown,
26
+ parse_repomix,
27
+ parse_xml,
28
+ preflight_entries,
29
+ unmix_repomix,
30
+ )
31
+
32
+ __version__ = "0.1.0"
33
+
34
+ __all__ = [
35
+ "DEFAULT_MAX_FILE_MIB",
36
+ "DEFAULT_MAX_FILES",
37
+ "DEFAULT_MAX_INPUT_MIB",
38
+ "DEFAULT_MAX_TOTAL_MIB",
39
+ "ParsedEntry",
40
+ "PreparedEntry",
41
+ "UnmixError",
42
+ "UnmixResult",
43
+ "__version__",
44
+ "detect_format",
45
+ "exclusion_category",
46
+ "mib_to_bytes",
47
+ "normalize_archive_path",
48
+ "parse_json",
49
+ "parse_markdown",
50
+ "parse_repomix",
51
+ "parse_xml",
52
+ "preflight_entries",
53
+ "unmix_repomix",
54
+ ]
@@ -0,0 +1,8 @@
1
+ """Static reconstruction of Repomix exports (console entry point)."""
2
+
3
+ import sys
4
+
5
+ from repomix_unmixer.cli import main
6
+
7
+ if __name__ == "__main__":
8
+ sys.exit(main())
@@ -0,0 +1,156 @@
1
+ #!/usr/bin/env python3
2
+ """Reconstruct Repomix Markdown exports from ../repomix-files/.
3
+
4
+ This driver ONLY calls the local static Repomix extractor. It does not execute,
5
+ build, install, test, lint, containerize, or otherwise run reconstructed projects.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ import argparse
11
+ import re
12
+ import sys
13
+ from pathlib import Path
14
+
15
+ from repomix_unmixer.extractor import (
16
+ UnmixError,
17
+ UnmixResult,
18
+ unmix_repomix,
19
+ )
20
+
21
+ BUNDLE_ROOT = Path(__file__).resolve().parent.parent.parent
22
+ DEFAULT_INPUT_DIR = BUNDLE_ROOT / "repomix-files"
23
+ DEFAULT_OUTPUT_DIR = BUNDLE_ROOT / "reconstructed"
24
+
25
+
26
+ def output_name(stem: str) -> str:
27
+ name = re.sub(r"[^A-Za-z0-9._-]+", "-", stem).strip(".-")
28
+ return name or "repository"
29
+
30
+
31
+ def safe_output_name(path: Path) -> str:
32
+ # Derive a filesystem-safe folder label from the input export's filename.
33
+ # This is NOT a transformation of recovered repository names/content.
34
+ return output_name(path.stem)
35
+
36
+
37
+ def discover_markdown_files(input_dir: Path) -> list[Path]:
38
+ return sorted(p for p in input_dir.iterdir() if p.is_file() and p.suffix.lower() == ".md")
39
+
40
+
41
+ def write_report(
42
+ output_root: Path, rows: list[tuple[Path, Path, UnmixResult]], dry_run: bool
43
+ ) -> None:
44
+ if dry_run:
45
+ return
46
+ report = output_root / "RECONSTRUCTION_REPORT.md"
47
+ lines = [
48
+ "# Static Repomix Reconstruction Report",
49
+ "",
50
+ "No reconstructed repository code was executed by this workflow.",
51
+ "",
52
+ "| Repomix input | Output | Files | Skipped |",
53
+ "|---|---|---:|---:|",
54
+ ]
55
+ for index, (_, target, result) in enumerate(rows, start=1):
56
+ lines.append(
57
+ f"| `input-{index}.md` | `{target.name}/` | {len(result.extracted)} | "
58
+ f"{len(result.skipped)} |"
59
+ )
60
+ lines.extend(
61
+ [
62
+ "",
63
+ "## Rules",
64
+ "",
65
+ "- These outputs are static example code only.",
66
+ "- Do not run package managers, scripts, builds, tests, containers, CI, MCP,",
67
+ " or applications inside them.",
68
+ "- Paths and text are not rewritten; original sensitive content can remain.",
69
+ "- Safety exclusions omitted agent/IDE configuration, credential-bearing",
70
+ " environment files, .git/, and OS metadata. They affect only this output,",
71
+ " not the original export.",
72
+ "",
73
+ ]
74
+ )
75
+ with report.open("x", encoding="utf-8") as handle:
76
+ handle.write("\n".join(lines))
77
+
78
+
79
+ def build_parser() -> argparse.ArgumentParser:
80
+ parser = argparse.ArgumentParser(
81
+ description="Statically reconstruct all Repomix .md files in repomix-files/."
82
+ )
83
+ parser.add_argument("--input-dir", type=Path, default=DEFAULT_INPUT_DIR)
84
+ parser.add_argument("--output-dir", type=Path, default=DEFAULT_OUTPUT_DIR)
85
+ parser.add_argument("--dry-run", action="store_true")
86
+ return parser
87
+
88
+
89
+ def main(argv: list[str] | None = None) -> int:
90
+ args = build_parser().parse_args(argv)
91
+ input_dir = args.input_dir.resolve()
92
+ raw_output_root = args.output_dir.expanduser()
93
+ if raw_output_root.is_symlink():
94
+ print(
95
+ f"Error: output root must not be a symlink: {raw_output_root}",
96
+ file=sys.stderr,
97
+ )
98
+ return 1
99
+ output_root = raw_output_root.resolve(strict=False)
100
+
101
+ if not input_dir.exists() or not input_dir.is_dir():
102
+ print(f"Error: input directory does not exist: {input_dir}", file=sys.stderr)
103
+ return 1
104
+
105
+ files = discover_markdown_files(input_dir)
106
+ if not files:
107
+ print(f"No .md files found in {input_dir}")
108
+ return 0
109
+
110
+ # No deletion or replacement of existing output trees.
111
+ if output_root.is_symlink() or (output_root.exists() and not output_root.is_dir()):
112
+ print(
113
+ f"Error: output root is not a regular directory: {output_root}",
114
+ file=sys.stderr,
115
+ )
116
+ return 1
117
+ report = output_root / "RECONSTRUCTION_REPORT.md"
118
+ if report.exists() or report.is_symlink():
119
+ print(
120
+ f"Error: reconstruction report already exists (will not replace): {report}",
121
+ file=sys.stderr,
122
+ )
123
+ return 1
124
+ if not args.dry_run:
125
+ output_root.mkdir(parents=True, exist_ok=True)
126
+
127
+ rows: list[tuple[Path, Path, UnmixResult]] = []
128
+ used_names: set[str] = set()
129
+
130
+ for source in files:
131
+ base_name = safe_output_name(source)
132
+ name = base_name
133
+ suffix = 2
134
+ while name.casefold() in used_names:
135
+ name = f"{base_name}-{suffix}"
136
+ suffix += 1
137
+ used_names.add(name.casefold())
138
+
139
+ target = output_root / name
140
+ print(f"\n=== {source.name} -> {target.name}/ ===")
141
+ try:
142
+ result = unmix_repomix(source, target, dry_run=args.dry_run)
143
+ except UnmixError as exc:
144
+ print(f"Error reconstructing {source.name}: {exc}", file=sys.stderr)
145
+ return 1
146
+
147
+ print(f"Files: {len(result.extracted)} | skipped: {len(result.skipped)}")
148
+ rows.append((source, target, result))
149
+
150
+ write_report(output_root, rows, args.dry_run)
151
+ print("\nDone. Reconstructed repositories are STATIC EXAMPLES ONLY; do not execute them.")
152
+ return 0
153
+
154
+
155
+ if __name__ == "__main__":
156
+ raise SystemExit(main())
@@ -0,0 +1,15 @@
1
+ """Single-export CLI (`unmix-repomix`).
2
+
3
+ A thin console-script wrapper around :func:`repomix_unmixer.
4
+ extractor.main` so installed distributions expose a stable command while the
5
+ parsing/extracting logic stays in one auditable module.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ import sys
11
+
12
+ from repomix_unmixer.extractor import main
13
+
14
+ if __name__ == "__main__":
15
+ sys.exit(main())