treemk
v1.0.4
Published
A CLI tool to generate project structures from text, JSON templates, file, with boilerplate and git integration
Maintainers
Readme
🌳 treemk 📦 - Project Structure Generator
Generate complete project folders in seconds
🚀 Quick Start (3 Ways)
1. Inline Text (Easiest!)
npx treemk --text "src/index.js
src/app.js
tests/test.js
README.md" -o ./myapp2. Inline JSON
npx treemk --json-input '{"src":["index.js","app.js"],"tests":["test.js"]}' -o ./myapp3. From File
npx treemk -i structure.txt -o ./myapp📥 Installation
# Use directly (recommended)
npx treemk --help
# Or install globally
npm install -g treemk🎯 Common Use Cases
Create a Node.js API
npx treemk --template node -o ./my-api --boilerplate --install --git-initCreate React App
npx treemk --template react -o ./my-react-app --boilerplateSave Your Own Template
# Save once
npx treemk --text "src/server.js
src/routes/api.js
tests/test.js" --template-save my-api
# Reuse forever
npx treemk --template-use my-api -o ./new-apiPreview Before Creating
npx treemk -i structure.txt --preview📝 Input Formats
Plain Text (Simple)
src/index.js
src/components/App.jsx
tests/test.js
package.jsonTree Format (Visual)
my-app/
├── src/
│ ├── index.js
│ └── components/
│ └── App.jsx
└── package.jsonJSON Format
{
"src": {
"components": ["App.jsx"],
"index.js": null
},
"package.json": null
}🎨 Smart Boilerplate (--boilerplate)
Automatically generates working code for:
- server.js → Express server ready to run
- route.js → RESTful API routes
- model.js → Database models
- test.js → Jest test setup
- .env → Environment variables template
- .gitignore → Comprehensive ignore rules
- Dockerfile → Docker configuration
- And more!
📋 All Commands
Basic
-i, --input <file> # File path (works from anywhere!)
-o, --output <path> # Where to create (default: ./output)
-b, --boilerplate # Add smart code templates
-h, --help # Show helpTemplates
--template <name> # Use: react, node, python
--template-save <name> # Save for reuse
--template-use <name> # Load saved template
--template-list # Show all templates
--template-remove <name> # Delete templateInline Input (No files!)
--text "<structure>" # Pass structure directly
--json-input '<json>' # Pass JSON directlyGit
-g, --git-init # Initialize git
--git-commit # Make first commit
--git-push # Push to GitHub (needs gh CLI)Advanced
--install # Auto npm/pip install
--preview # Show tree preview
-u, --from-url <url> # Fetch from URL
-d, --dry-run # Preview without creating💡 Real Examples
Example 1: Quick Microservice
npx treemk --text "src/server.js
src/routes/users.js
src/routes/products.js
src/models/User.js
tests/api.test.js
.env
.gitignore
package.json" -o ./my-service -b --install -gExample 2: Python Project
npx treemk --template python -o ./my-python-app -b --install --git-initExample 3: From Anywhere
# File in Downloads folder? No problem!
npx treemk -i structure.txt -o ./app
# File on Desktop? Works!
npx treemk -i ~/Desktop/project.txt -o ./appExample 4: Full Automation
npx treemk --template node \
-o ./api \
--boilerplate \
--install \
--git-init \
--git-commit⚙️ Config File (Optional)
Create treemk.config.json in your project folder:
{
"output": "./app",
"boilerplate": true,
"gitInit": true,
"install": true
}Then just run:
npx treemk --template node📂 Where Templates Are Saved
~/.treemk/templates/ - Your saved templates live here
🔍 Troubleshooting
"Cannot find file"
- Try absolute path:
/home/user/structure.txt - Or just filename if in Downloads/Documents/Desktop
- Use
--textto avoid files entirely!
"No input provided"
# Use one of these:
npx treemk --text "src/index.js"
npx treemk -i file.txt
npx treemk --template node
cat file.txt | npx treemk -o ./app📦 Requirements
- Node.js 16+ (check:
node --version) - npm comes with Node.js
- Optional:
ghCLI for GitHub push
🎓 Complete Tutorial
See [QuickStart.md] for step-by-step guide.
📄 License
MIT License - Free to use for everyone!
⭐ Quick Reference Card
# Fastest ways to create projects:
npx treemk --template node -o ./app -b # Node.js
npx treemk --template react -o ./app -b # React
npx treemk --template python -o ./app -b # Python
# No file needed:
npx treemk --text "src/index.js..." -o ./app
# Save template once, use forever:
npx treemk -i my-structure.txt --template-save my-template
npx treemk --template-use my-template -o ./new-projectMade for developers who value speed! ⚡
