Skip to content

SoufyanRachdi/mkarchi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

37 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ—๏ธ mkarchi

mkarchi logo

Design your architecture once, apply it anywhere

PyPI Downloads PyPI version Python License GitHub Stars

Documentation โ€ข Latest Version โ€ข FAQ โ€ข Community


๐ŸŒŸ What is mkarchi?

mkarchi (make architecture) is a powerful command-line tool that generates complete project structures from simple tree-format text files. With v0.1.7, you can also reverse-engineer your existing projects back into mkarchi format โ€” making project scaffolding and documentation effortless.

mkarchi diagram


โœจ Key Features

๐Ÿ“‹ Generation

  • ๐Ÿ“ Create directories from tree structures
  • ๐Ÿ“„ Generate files with or without content
  • โœ๏ธ Content embedding using (begincontenu) tags
  • ๐ŸŽฏ Indentation preservation for Python, YAML, JSON
  • ๐Ÿ’ฌ Comments support in structure files

๐Ÿ”„ Reverse Engineering

  • ๐Ÿ”„ Generate mkarchi files from existing projects
  • ๐Ÿšซ Smart .gitignore integration (NEW v0.1.7)
  • โšก Improved performance and error handling
  • ๐Ÿš€ Fast, simple, and AI-friendly
  • ๐Ÿ“ฆ Reusable templates for any project

๐Ÿš€ Quick Start

Installation

pip install mkarchi
๐Ÿ“ฆ Alternative Installation Methods

Install from source:

git clone https://github.com/SoufyanRachdi/mkarchi.git
cd mkarchi
pip install -e .

Run as module (no installation):

git clone https://github.com/SoufyanRachdi/mkarchi.git
cd mkarchi
python -m mkarchi apply structure.txt

Create Your First Project

1. Create a structure file (structure.txt):

my_project/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ main.py(begincontenu)
โ”‚   โ”‚   def main():
โ”‚   โ”‚       print("Hello, World!")
โ”‚   โ”‚
โ”‚   โ”‚   if __name__ == "__main__":
โ”‚   โ”‚       main()
โ”‚   (endcontenu)
โ”‚   โ””โ”€โ”€ utils.py
โ”œโ”€โ”€ tests/
โ”‚   โ””โ”€โ”€ test_main.py
โ”œโ”€โ”€ README.md(begincontenu)
โ”‚   # My Project
โ”‚
โ”‚   This is an awesome project!
โ”‚   (endcontenu)
โ””โ”€โ”€ requirements.txt(begincontenu)
    pytest>=7.0.0
    requests>=2.28.0
(endcontenu)

2. Apply the structure:

mkarchi apply structure.txt

3. See the magic โœจ

๐Ÿš€ Creating structure from structure.txt...

๐Ÿ“ Created directory: my_project
๐Ÿ“ Created directory: my_project/src
๐Ÿ“„ Created file with content: my_project/src/main.py
๐Ÿ“„ Created file: my_project/src/utils.py
๐Ÿ“ Created directory: my_project/tests
๐Ÿ“„ Created file: my_project/tests/test_main.py
๐Ÿ“„ Created file with content: my_project/README.md
๐Ÿ“„ Created file with content: my_project/requirements.txt

โœ… Architecture created successfully!

๐Ÿ“– Commands

# Apply a structure file to create project
mkarchi apply structure.txt

# Generate structure file from current directory
mkarchi give

# Generate without file contents
mkarchi give -c

# Save to custom file
mkarchi give myproject.txt

# Get help
mkarchi --help

# Check version
mkarchi --version

๐Ÿ”„ Reverse Engineering with mkarchi give

Generate mkarchi syntax from your existing project structure.

Default Behavior

mkarchi give

โœ… Generates structure.txt
โœ… Includes file contents
โœ… Respects .gitignore automatically

Without File Contents

mkarchi give -c

Custom Output File

mkarchi give -c myproject.txt

๐Ÿšซ Smart .gitignore Integration (v0.1.7)

mkarchi automatically reads your .gitignore and excludes:

  • node_modules/, venv/, __pycache__/
  • .git/ directories
  • Build artifacts and cache files
  • Binary files and dependencies

Example .gitignore:

node_modules/
*.pyc
__pycache__/
.env

Running mkarchi give automatically skips all these files! ๐ŸŽ‰


๐Ÿ“ Structure File Syntax

Directories

Directories must end with /:

my_folder/
โ”œโ”€โ”€ subfolder/
โ””โ”€โ”€ another_folder/

Empty Files

Files without content tags are created empty:

my_folder/
โ”œโ”€โ”€ empty_file.txt
โ””โ”€โ”€ config.json

Files with Content

Use (begincontenu) and (endcontenu):

script.py(begincontenu)
    def hello():
        print("Hello, World!")
(endcontenu)

Indentation Preservation

Indentation is automatically preserved:

utils.py(begincontenu)
    def greet(name):
        if name:
            print(f"Hello, {name}!")
        else:
            print("Hello, World!")
(endcontenu)

Result (utils.py):

def greet(name):
    if name:
        print(f"Hello, {name}!")
    else:
        print("Hello, World!")

Comments

Use # for comments:

project/
โ”œโ”€โ”€ src/          # Source code
โ”‚   โ””โ”€โ”€ main.py   # Entry point
โ””โ”€โ”€ tests/        # Tests

๐ŸŽฏ Use Cases

โšก Rapid Scaffolding

Spin up new projects in seconds with predefined templates.

๐Ÿค– AI Integration

Perfect for AI-generated project structures and code scaffolding.

๐Ÿ“ฆ Reusable Templates

Create once, reuse everywhere. Share templates with your team.

๐Ÿงฉ Microservices

Set up multiple services with consistent structure:

mkarchi apply service1.txt
mkarchi apply service2.txt

๐Ÿ“˜ Documentation

Generate clean project documentation:

mkarchi give docs.txt

๐ŸŽ“ Tutorials

Create step-by-step project structures for teaching and learning.


๐Ÿ”ง Advanced Example: Python Project

python_project/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ main.py(begincontenu)
โ”‚   โ”‚   """Main application module."""
โ”‚   โ”‚
โ”‚   โ”‚   def main():
โ”‚   โ”‚       print("Starting application...")
โ”‚   โ”‚       return 0
โ”‚   โ”‚
โ”‚   โ”‚   if __name__ == "__main__":
โ”‚   โ”‚       main()
โ”‚   (endcontenu)
โ”‚   โ””โ”€โ”€ config.py(begincontenu)
โ”‚       """Configuration module."""
โ”‚   
โ”‚       DEBUG = True
โ”‚       VERSION = "0.1.0"
โ”‚   (endcontenu)
โ”œโ”€โ”€ tests/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ””โ”€โ”€ test_main.py(begincontenu)
โ”‚       import pytest
โ”‚       from src.main import main
โ”‚
โ”‚       def test_main():
โ”‚           """Test main function."""
โ”‚           assert main() == 0
โ”‚   (endcontenu)
โ”œโ”€โ”€ .gitignore(begincontenu)
โ”‚   __pycache__/
โ”‚   *.pyc
โ”‚   .pytest_cache/
โ”‚   venv/
โ”‚   (endcontenu)
โ”œโ”€โ”€ setup.py(begincontenu)
โ”‚   from setuptools import setup, find_packages
โ”‚
โ”‚   setup(
โ”‚       name="my-project",
โ”‚       version="0.1.0",
โ”‚       packages=find_packages(),
โ”‚       install_requires=[
โ”‚           "pytest>=7.0.0",
โ”‚       ],
โ”‚   )
โ”‚   (endcontenu)
โ””โ”€โ”€ README.md(begincontenu)
    # Python Project
    
    A well-structured Python project template.
(endcontenu)

๐Ÿ†• What's New in v0.1.7?

๐Ÿšซ .gitignore Support

Automatically respects .gitignore patterns

โšก Performance Boost

Faster processing and optimized traversal

๐Ÿ› Bug Fixes

Enhanced error handling and Unicode support

View full changelog โ†’

Learn more about v0.1.7 โ†’


๐Ÿ“š Documentation & Resources

Resource Description
๐Ÿ“– Documentation Complete guide and tutorials
๐Ÿ”„ Version History All releases and updates
๐Ÿ“˜ v0.1.7 Guide Latest version features
๐Ÿ“— v0.1.6 Guide Previous version features
โ“ FAQ Frequently asked questions
๐Ÿ‘ฅ Community Join the community
๐Ÿ“ง Contact Get in touch

๐Ÿค Contributing

Contributions are welcome! We appreciate your help in making mkarchi better.

  1. Fork the repository
  2. Create a feature branch
    git checkout -b feature/amazing-feature
  3. Commit your changes
    git commit -m "Add amazing feature"
  4. Push to your branch
    git push origin feature/amazing-feature
  5. Open a Pull Request

๐Ÿ“„ License

This project is licensed under the MIT License. See the LICENSE file for details.


๐Ÿ› Issues & Support

Found a bug or have a feature request?


โญ Star Us!

If you find mkarchi useful, please consider giving it a โญ on GitHub!


Made with โค๏ธ by Soufyan Rachdi

GitHub Website

Documentation โ€ข Community โ€ข Contact

About

mkarchi is a CLI tool that creates a directory and file architecture from a tree structure text file.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

โšก