🌲↔️📁 x2fromx
Convert project directories ↔ text trees in one command.
Built for developers & AI enthusiasts who need to scaffold projects from LLM outputs or extract codebase structure for context analysis.
🚀 Why x2fromx?
- 🤖 AI-Ready: Paste a
tree.txtinto ChatGPT/Claude, get a modified architecture back, and rebuild it instantly. - ⚡ Zero Dependencies: Pure Python standard library. Works everywhere, instantly.
- 🧹 Smart Filtering: Automatically ignores
.git,node_modules,__pycache__, binaries, and images. - 🌱 Auto-Seeding: Creates boilerplate content (
.py,.html,.js, etc.) so your IDE doesn't complain. - 🖥️ CLI & Library: Use it in your terminal or import it directly into your Python scripts.
📦 Installation
pip install x2fromx
🛠️ CLI Usage 🔍 Scan a directory → generate a tree file
x2fromx scan ./my_existing_project -o structure.txt --print
🏗️ Build a project from a tree file
x2fromx build structure.txt -n my_new_project --overwrite
Available flags:
| Flag | Description |
|---|---|
| scan | Path to the folder to analyze |
| build | Path to the .txt tree file |
| -o, --output | Output filename (default: project_structure.txt) |
| -n, --name | Root project name for build (default: new_project) |
| Print the tree in the terminal after saving | |
| --overwrite | Force overwrite if the target folder already exists |
🤖 AI Workflow (The Killer Feature)
- Extract context: x2fromx scan ./legacy_app -o context.txt
- Ask an LLM: "Here is my project structure. Refactor it to add a /tests folder, split routes.py into a router package, and add a Dockerfile. Return the full tree."
- Save the response: Paste the LLM's output into refactored.txt
- Scaffold instantly: x2fromx build refactored.txt -n app_v2
- Start coding: Your IDE opens a ready-to-use structure with placeholders.
🐍 Python API
from x2fromx import DirectoryScanner, ProjectBuilder
# Scan
scanner = DirectoryScanner("./src", "tree.txt")
scanner.save()
# Build
builder = ProjectBuilder("tree.txt", "my_project")
count, root = builder.build(overwrite=True)
print(f"Created {count} items in {root}")
📁 Example Output
my_project/
│
├── 📁 src/
│ ├── 📁 api/
│ │ ├── 📄 routes.py # Endpoint API
│ │ └── 📄 schemas.py
│ └── 📄 main.py # TODO: Implement logic
├── 📁 tests/
│ └── 📄 test_api.py # Tests unitaires
├── 📄 README.md # Documentation
└── 📄 requirements.txt # Dépendances Python
💡 Windows users:
x2fromxauto-detects file encoding (UTF-8, cp1252, latin-1). If you create tree files withecho, they'll work out of the box. For best results, use UTF-8 when possible.
🤝 Contributing
Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.
- Fork the repo
- Create your feature branch (git checkout -b feature/amazing-feature)
- Commit your changes (git commit -m 'Add amazing feature')
- Push to the branch (git push origin feature/amazing-feature)
- Open a Pull Request
📜 License
Distributed under the MIT License. See LICENSE for more information.
💙 Support
If you use and value this tool, consider supporting its development:
Metadata
Release files for x2fromx 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| x2fromx-0.1.3.tar.gz | 13.8 kB | Without provenance | Details for x2fromx-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| x2fromx-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for x2fromx-0.1.3-py3-none-any.whl |
Total release size: 26.0 kB
Release files / x2fromx-0.1.3.tar.gz
| Download URL | x2fromx-0.1.3.tar.gz |
|---|---|
| Size | 13.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
21c2052847e11b373234eb2d26fcdd289f63ca660d199bfd254bcc5866fc24ba
|
|
BLAKE2b-256 checksum How to use checksums |
082ee4298af13b2460c48e4e604b3e1479479cf3ea0c70849343d9984ebef37b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.0
|
Release files / x2fromx-0.1.3-py3-none-any.whl
| Download URL | x2fromx-0.1.3-py3-none-any.whl |
|---|---|
| Size | 12.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3c282f4ac663fbaa440a0b26d0bfaa0d399c8e2d89568d6fb071e0b8ea6e68d6
|
|
BLAKE2b-256 checksum How to use checksums |
33be52222ccc05b370c559231197ee4fa9c84b2c64ce1ea596963d301ab822f4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.0
|
Security for x2fromx 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.