Interactive terminal-based directory structure builder
Project description
KTrex
KTrex is an interactive, terminal-based directory and file structure builder.
It lets you visually create, navigate, undo, save, load, and reuse project layouts
directly from a curses-based TUI — safely and deterministically.
Think:
mkdir+tree+undo+presets+resume, all in one tool.
Features
- Interactive terminal UI (arrow-key driven)
- Create directories and files visually
- Safe undo (never deletes non-empty directories)
- Presets (builtin or external JSON)
- Save project structure to JSON
- Load and resume saved structures
- Non-destructive by design (no overwrites, no forced deletes)
- Works offline, zero runtime dependencies
- Scrollable tree view (keyboard + mouse)
Installation
Using pip (recommended)
pip install KTrex
Editable install (for development)
git clone https://github.com/yourusername/KTrex.git
cd KTrex
pip install -e .
▶️ Usage
Run KTrex inside any directory:
KTrex
You’ll be dropped into an interactive TUI showing your project tree and available actions.
Controls
| Key | Action |
|---|---|
| ↑ / ↓ | Navigate menu |
| Enter | Select highlighted action |
| PageUp / PageDown | Scroll tree view |
| Ctrl + U / Ctrl + D | Scroll tree view |
| Mouse Wheel | Scroll tree view |
| Any key | Dismiss messages / dialogs |
| Quit | Exit KTrex safely |
Actions Explained
Create Directory
- Creates a new directory in the current location
- Automatically enters the directory
Create File
- Creates a file in the current directory
- Does not change navigation
Undo
- Reverts the most recent create action
- Only removes files or empty directories
- Never deletes non-empty directories
Load Preset
- Load a predefined structure by name or file path
- Presets are additive, never destructive
Save Structure
- Serialize the entire project tree to a JSON file
- Useful for reuse, backups, or AI-assisted generation
Load Structure
- Load a previously saved structure JSON
- Applies safely without removing existing files
Go Back
- Navigate to parent directory
- Cannot escape project root
Help
- View built-in documentation and keybindings
Presets
Built-in presets
ml_project
Usage:
Load Preset → ml_project
External presets
Load Preset → /path/to/custom_preset.json
Preset format is documented below.
Preset / Structure Format
KTrex uses a simple, declarative JSON format:
{
"name": "project",
"type": "dir",
"children": [
{
"name": "src",
"type": "dir",
"children": [
{ "name": "main.py", "type": "file" }
]
}
]
}
This format is shared by:
- presets
- saved structures
- AI-generated layouts
Safety Guarantees
KTrex is designed to be safe by default:
- ❌ Never overwrites files
- ❌ Never deletes non-empty directories
- ❌ Never escapes project root
- ✅ Undo is leaf-only and predictable
- ✅ All destructive actions are explicit
Nice question — README polish matters a lot, especially if you want your repo to look professional + sponsor-friendly.
Below are clean, modern ways to upgrade both the License and Sponsor sections without overdoing it.
📜 License
This project is licensed under the MIT License.
You are free to use, modify, and distribute this software with proper attribution.
See the LICENSE file for details.
💖 Sponsor
If you find this project useful and want to support its development:
Your support helps keep this project alive and actively maintained.
Project details
Release history Release notifications | RSS feed
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 ktrex-0.1.5.tar.gz.
File metadata
- Download URL: ktrex-0.1.5.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e29b4096805a6a547d8c08b0c53990622b6ea7f900a9ee1089ae87c763f39e9b
|
|
| MD5 |
dbff0ea3282a56ad1264a16495bbb0ef
|
|
| BLAKE2b-256 |
2fca29977327d381325e59e8b6fc56765a2320ac85b9b9da71e8777d7563c1e4
|
File details
Details for the file ktrex-0.1.5-py3-none-any.whl.
File metadata
- Download URL: ktrex-0.1.5-py3-none-any.whl
- Upload date:
- Size: 9.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a28b8fcf36eaa01d11166b9e4ec7c0d141bd7d4a7fd43de6954652ac9802495e
|
|
| MD5 |
2653ea47ffe89f4abea48100a4e5a3ed
|
|
| BLAKE2b-256 |
1510c2b53c9e93176e0495fbf044335526ccd6ed005c5ed64ffd449afb8f64a1
|