A minimalist, high-performance shell implemented in C++, featuring a native C process executor and a Python-embedded CLI interface. This project demonstrates Hybrid Systems Architecture: combining low-level C memory management with high-level Python metadata visualization.
Mini-Shell utilizes a Layered Architecture:
- Command Dispatcher (C): A centralized logic hub (
ui_actions.c) that separates "Built-in" commands (Help, Stats, Clear) from "External" system commands. - Native Executor (C++): Manages process lifecycles using
_spawnvp(Windows) orfork/exec(POSIX), bypassing insecuresystem()calls for external binaries. - Embedded Python Bridge: A zero-latency bridge that reloads Python UI modules at runtime, allowing for "Hot-Swapping" the interface without restarting the shell.
- Dynamic Build Pipeline: A PowerShell-driven CI/CD script that automatically discovers source files and resolves Python headers dynamically from the local virtual environment.
Mini-Shell/
├── build/ # Compiled binary output
├── deps/ # Third-party dependency headers
├── include/ # Header files (.h, .hpp)
├── scripts/
│ └── run.ps1 # Dynamic build audit & launch script
├── src/ # Implementation (main.cpp, pybridge.c, ui_actions.c)
├── ui/ # Python UI logic (rich_ui.py)
└── mysys_venv/ # Isolated Python environment
Mini-Shell handles its own dependency management. It automatically detects, creates, and configures a local virtual environment (mysys_venv) based on the root requirements.txt.
Ensure your requirements.txt contains the necessary UI libraries:
rich
The project features an Atomic Build Pipeline. The run.ps1 script performs a full build audit, resolves Python headers dynamically from your venv, and compiles all source modules in a single pass.
./scripts/run.ps1- Compiler: g++ (MinGW-w64)
- Dynamic Discovery: Automatically locates and compiles all
.cand.cppfiles within thesrc/directory - Python Bridge: Dynamically links against the specific Python interpreter version found in the local environment (e.g.,
python313) - Static Linking: Utilizes
-static-libgccand-static-libstdc++to ensure the binary remains portable across Windows environments
-
Command Dispatcher: Internal commands (
help,stats,cls) are intercepted by a central dispatcher inui_actions.c, which orchestrates the Embedded Python Bridge -
Native Execution Logic: For external system commands, the shell bypasses the insecure
system()wrapper. Instead, it utilizes a native C++ executor that leverages_spawnvp(Windows) to manage child process lifecycles and parent-wait states directly
This project is licensed under the MIT License. See the LICENSE file for details.