Skip to main content

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/akris15/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:

Ko-Fi

Your support helps keep this project alive and actively maintained.

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

ktrex-0.1.69.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

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

ktrex-0.1.69-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file ktrex-0.1.69.tar.gz.

File metadata

  • Download URL: ktrex-0.1.69.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for ktrex-0.1.69.tar.gz
Algorithm Hash digest
SHA256 34a0f7229d465190480c12d9abbf0e25c42b0c6eb879848ec874530b32d8cf49
MD5 6689f2c8690f56f475078bb41a854190
BLAKE2b-256 adce00383d8b7613617945ab4419d0bc43452a3e0875d0671d0016e2b18458f6

See more details on using hashes here.

File details

Details for the file ktrex-0.1.69-py3-none-any.whl.

File metadata

  • Download URL: ktrex-0.1.69-py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for ktrex-0.1.69-py3-none-any.whl
Algorithm Hash digest
SHA256 554dec123c5c2e5bfaf4449848f39c6102df20c0021d644d119fe5abf0e3a591
MD5 781f77db44d5cd2a9a7fe90e3c9b1db5
BLAKE2b-256 60695ea0fd6c585bd2872f7d0fa7fc1f0a6504c54a192ac9115c12f858324265

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