CLI & library to convert project directories โ text trees. Ideal for AI scaffolding & codebase analysis.
Project description
๐ฒโ๏ธ๐ 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
<!-- TREEVIEW START -->
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
๐ค 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:
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file x2fromx-0.1.0.tar.gz.
File metadata
- Download URL: x2fromx-0.1.0.tar.gz
- Upload date:
- Size: 9.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8bff7017e6f7e5c64ad2bb5f68db47fa82c3e5cbbdc981da62473a345c65c9d6
|
|
| MD5 |
a9e32237d311afbf44c9fe21e942516e
|
|
| BLAKE2b-256 |
c6a78fbeb88055d8b88b55b44a78366fb523a4c74e042e7eb7817d76f396b5a2
|
File details
Details for the file x2fromx-0.1.0-py3-none-any.whl.
File metadata
- Download URL: x2fromx-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ced9aeff415cf6d0177c24c03315ad75023c8bcea2bbcdff32985675460f5356
|
|
| MD5 |
68582ef47ab4b878ed13a79e6d149519
|
|
| BLAKE2b-256 |
52370c2f84518072b50ed740d84db69874bd468311667de454c26f94da7cd033
|