Skip to main content

CLI & library to convert project directories โ†” text trees. Ideal for AI scaffolding & codebase analysis.

Project description

๐ŸŒฒโ†”๏ธ๐Ÿ“ x2fromx

PyPI version Python 3.8+ License: MIT

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.txt into 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 Print the tree in the terminal after saving
--overwrite Force overwrite if the target folder already exists

๐Ÿค– AI Workflow (The Killer Feature)

  1. Extract context: x2fromx scan ./legacy_app -o context.txt
  2. 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."
  3. Save the response: Paste the LLM's output into refactored.txt
  4. Scaffold instantly: x2fromx build refactored.txt -n app_v2
  5. 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

๐Ÿค Contributing

Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.

  1. Fork the repo
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. 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:
Sponsor

Python Flask TypeScript AI Founder

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

x2fromx-0.1.1.tar.gz (9.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

x2fromx-0.1.1-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file x2fromx-0.1.1.tar.gz.

File metadata

  • Download URL: x2fromx-0.1.1.tar.gz
  • Upload date:
  • Size: 9.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for x2fromx-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b81b74fe7e67231b4a719a44055cfba37ebc93e693316c7fe816c0b05df97b2a
MD5 00c3717503bf30b2014ddfac73616c9d
BLAKE2b-256 5028590d7466181118ac665b497d1f496e35ea23c3546581831553fa2157d5a2

See more details on using hashes here.

File details

Details for the file x2fromx-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: x2fromx-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for x2fromx-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9958d35aa6c04858572215a2dc58776a5e63b20c5fba6a10a95668b1c1f451d7
MD5 b3e95c72b7f421d6d0d0cb84faffd83e
BLAKE2b-256 8886f3ab401624af51893ea2b14b82f77e715864f29e32693519484049558d9b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page