Metadata-Version: 2.4
Name: termify-ai
Version: 1.0.0
Summary: Zero-Config AI-Powered Web UIs for ANY CLI Tool
Home-page: https://github.com/lakshanmuruganandam/Termify
Author: Lakshan Muruganandam
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: fastapi
Requires-Dist: uvicorn
Requires-Dist: google-genai
Requires-Dist: websockets
Dynamic: author
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

<div align="center">
  <img src="assets/logo.png" width="200" alt="Termify Logo">
  
  # Termify
  **The Zero-Config, AI-Powered Web UI Engine for ANY CLI Tool.**
  
  <p align="center">
    <a href="https://github.com/lakshanmuruganandam/Termify/stargazers"><img src="https://img.shields.io/github/stars/lakshanmuruganandam/Termify?style=for-the-badge&color=6366f1" alt="Stars"></a>
    <a href="https://github.com/lakshanmuruganandam/Termify/network/members"><img src="https://img.shields.io/github/forks/lakshanmuruganandam/Termify?style=for-the-badge&color=38bdf8" alt="Forks"></a>
    <a href="https://github.com/lakshanmuruganandam/Termify/issues"><img src="https://img.shields.io/github/issues/lakshanmuruganandam/Termify?style=for-the-badge&color=ef4444" alt="Issues"></a>
    <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-blue.svg?style=for-the-badge" alt="License"></a>
  </p>
  
  <p align="center">
    <i>Stop writing Web UIs for your scripts. Let AI do it in less than 1 second.</i>
  </p>
</div>

---

## 🚀 The Massive Problem

Developers write thousands of incredibly useful CLI scripts (Python, Bash, Node.js, Go). However, non-technical teammates (PMs, Marketers, Sales, Designers) often can't use them because:
1. The terminal is intimidating.
2. They don't know how to install package dependencies.
3. Passing complex arguments (flags, paths, enums) is highly error-prone.

Building a dedicated web dashboard (using React, Vue, Next.js, or even Streamlit) for every single internal script is a massive waste of engineering time. It takes days to build, style, and maintain.

## ⚡ The Solution: Termify

**Termify solves this instantly and automatically.** 

By simply prepending `termify` to your command (e.g., `termify python my_script.py`), Termify uses a Large Language Model (Google Gemini) to dynamically execute your script's `--help` output, generates a structured JSON schema of all arguments, and instantly boots a gorgeous, interactive Glassmorphism Web UI on `localhost:8000`. 

Your teammates can fill out a beautiful UI form, hit "Execute", and watch the terminal output stream live in their browser via WebSockets. 

**ZERO code changes required to your original script.**

### 🎬 See it in action:
<video src="https://github.com/lakshanmuruganandam/Termify/raw/main/assets/demo.mov" controls="controls" muted="muted" style="max-width:100%;">
  Your browser does not support the video tag.
</video>

---

## ✨ Why Termify is World-Class

- 🪄 **Absolute Zero-Config:** No decorators (unlike `@Gooey`), no forced UI frameworks (unlike `Gradio/Streamlit`). It just works out of the box with your existing code.
- 🌍 **100% Language Agnostic:** It doesn't care if you wrote your script in Bash, Go, Rust, Python, Node, or Ruby. If it responds to `--help`, Termify can webify it.
- 🧠 **AI-Powered Introspection:** Uses Gemini 2.5 Flash to perfectly understand argument constraints, types, choices, and descriptions, mapping them perfectly to web UI elements (Toggles, Dropdowns, Date-pickers, Number inputs).
- ⚡ **Real-time Streaming Engine:** Streams `stdout` and `stderr` via WebSockets directly to an embedded, syntax-highlighted web terminal. It forces unbuffered execution so the text streams character-by-character exactly like a real terminal.
- 🎨 **Ultra-Premium UI:** Ships with a visually stunning, responsive, dark-mode Glassmorphism UI built with Tailwind CSS. Complete with ambient glowing backgrounds and animated interactions.

---

## 🏗️ Deep Dive: How the Architecture Works

Termify operates in 5 distinct asynchronous stages:

```mermaid
graph TD
    A[User runs: termify ./script.sh] --> B(Introspection Phase);
    B -->|Executes ./script.sh --help| C(LLM Parsing Engine);
    C -->|Pipes raw text to Gemini AI| D{JSON Schema Generation};
    D -->|Identifies flags, types, defaults| E[FastAPI Server Boot];
    E -->|Serves Glassmorphism React UI| F(User Web Dashboard);
    F -->|User hits 'Execute'| G[WebSocket Command Reassembly];
    G -->|asyncio.subprocess unbuffered execution| H((Live Terminal Streaming));
    H -->|Pipes stdout/stderr| F;
```

1. **Introspection:** Termify executes your command appended with `--help` (e.g., `python script.py --help`).
2. **AI Translation:** The raw, unstructured help text is piped to Gemini, which is prompted to act as a strict structured data extractor. It returns a definitive JSON array of objects representing form fields (`name`, `type`, `required`, `default`, `choices`).
3. **Web Server Boot:** A lightweight Python FastAPI server spins up on `localhost`.
4. **Dynamic Frontend Rendering:** The frontend fetches the schema and dynamically constructs the UI. Booleans become toggle switches, enums become dropdowns, and strings become styled inputs.
5. **Execution & Streaming:** When the user clicks Execute, the payload is sent back via WebSockets. `asyncio.subprocess` executes the reconstructed command with `PYTHONUNBUFFERED=1` and streams the raw terminal output directly back to the browser's embedded terminal window.

---

## 📦 Installation

```bash
pip install termify-ai
```

---

## 🛠️ Advanced Usage Guide

### 1. Set your API Key
Termify uses Google Gemini to parse the CLI arguments dynamically. It is incredibly fast and highly cost-effective (often falling completely within the free tier).
```bash
export GEMINI_API_KEY="your_google_gemini_api_key"
```
*(Tip: Add this to your `~/.zshrc` or `~/.bashrc` so it's always ready!)*

### 2. Run Termify on ANY command
Just wrap your normal command with `termify`. 

**For Python Scripts:**
```bash
termify python train_model.py
```

**For Bash Scripts:**
```bash
termify ./deploy_infrastructure.sh
```

**For Node.js Apps:**
```bash
termify node scrape_data.js
```

**For Native Binaries (Go/Rust/C++):**
```bash
termify ./my_go_binary
```

### 3. Open the Web UI
Navigate to `http://localhost:8000`. You will instantly see a fully styled Tailwind CSS form with all the arguments, dropdowns, and toggles inferred automatically from your script.

---

## 🗺️ Roadmap & Future Vision

Termify is just getting started. Here is what we are building next:
- [ ] **Multi-Page Apps:** Support for CLI tools with subcommands (e.g., `docker run` vs `docker build`), generating a sidebar navigation for each subcommand.
- [ ] **Authentication Middleware:** Built-in basic auth so you can safely expose your Termify server to the internet for remote teams.
- [ ] **History & Logging:** A built-in SQLite database that tracks who ran what command, when, and saves the terminal output for auditing.
- [ ] **Custom Themes:** Allow passing a `--theme light` or `--theme cyberpunk` flag to instantly change the UI aesthetic.

---

## 🤝 Contributing Guidelines

We welcome all contributions! Whether it's a bug fix, UI enhancement, or documentation update, we'd love to have you on board.

1. **Fork the repository** on GitHub.
2. **Clone your fork locally:** `git clone https://github.com/your-username/Termify.git`
3. **Create a feature branch:** `git checkout -b feature/AmazingFeature`
4. **Make your changes:** Ensure you write clean, documented code.
5. **Commit your changes:** `git commit -m 'feat: Add some AmazingFeature'`
6. **Push to the branch:** `git push origin feature/AmazingFeature`
7. **Open a Pull Request** against the `main` branch.

Please ensure you test the frontend changes by running `python termify/main.py python test_cli.py` to verify the UI still dynamically generates correctly.

---

## ❓ FAQ

**Q: Do I need to modify my Python/Bash code to use Termify?**
A: **No.** Zero code changes are required. Termify entirely relies on your script's standard `--help` output. If your script doesn't have a `--help` flag, Termify won't work.

**Q: Why Gemini and not OpenAI?**
A: We currently use Gemini 2.5 Flash because it is incredibly fast (under 1 second inference) and highly accurate at structured JSON extraction. We plan to support OpenAI and local LLMs (Ollama) in a future release!

**Q: Is the API call made every time I run a command in the Web UI?**
A: **No.** The LLM is only called *once* when you start the Termify server to generate the UI schema. Executing commands from the Web UI does not trigger any LLM API calls, making it completely free and instantaneous for end-users.

---

## 📜 License
Distributed under the MIT License. Built passionately for the open-source community to make internal tooling accessible to everyone.
