π³ Treecraft

Treecraft is a Python tool that generates directory structures from text-based tree representations. It provides an intuitive way to create project scaffolding from a visual directory tree structure.
β¨ Features
- π Generate directory structures from text-based tree representations
- π Automatic Python file initialization with docstrings
- π Dry run mode to preview changes
- β‘ Simple and intuitive CLI interface
- π‘οΈ Safe path handling and validation
π Requirements
π Installation
You can install Treecraft using pip:
pip install treecraft
For development installation:
git clone https://github.com/ashwin271/treecraft.git
cd treecraft
pip install -e .
π Usage
Command Line Interface
Create a text file with your desired directory structure:
src/
βββ agents/
β βββ __init__.py
β βββ agent.py
βββ utils/
β βββ __init__.py
β βββ helpers.py
βββ main.py
Then run Treecraft:
treecraft input.txt -o output_directory
Python API
from treecraft import TreeParser, Generator
parser = TreeParser()
generator = Generator()
with open('input.txt', 'r') as f:
tree_content = f.read()
structure = parser.parse(tree_content)
generator.generate(structure, 'output_directory')
π§ Development
Setup Development Environment
git clone https://github.com/ashwin271/treecraft.git
cd treecraft
- Install development dependencies:
pip install -r requirements.txt
Running Tests
pytest tests/
π Examples
Basic Structure
project/
βββ README.md
βββ requirements.txt
βββ src/
βββ main.py
Complex Structure
project/
βββ docs/
β βββ index.md
βββ src/
β βββ core/
β β βββ __init__.py
β β βββ main.py
β βββ utils/
β βββ __init__.py
β βββ helpers.py
βββ tests/
β βββ test_core.py
βββ README.md
π€ Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature)
- Commit your changes (
git commit -m 'Add some AmazingFeature')
- Push to the branch (
git push origin feature/AmazingFeature)
- Open a Pull Request
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π Contact
Ashwin Murali - @Ashwin_271
Project Link: https://github.com/ashwin271/treecraft
π Documentation