Inspiration

The Linux terminal is the most powerful tool for developers, but it is also the most unforgiving. Beginners are terrified of the "black box," while even experts waste time looking up complex tar or ffmpeg flags. We wanted to bridge the gap between the raw power of the CLI and the safety of a modern IDE. TermEdit was born from the idea that your terminal shouldn't just execute commands, it should understand your intent, visualize your system's health, and protect you from mistakes.

What it does

TermEdit is an AI-powered "Command Cockpit" that runs entirely in your terminal. Natural Language Shell: You can type "Find all large video files and delete them," and it translates this into the precise Bash command (find . -size +100M...), offering a safety check before execution. Visual System Monitoring: Unlike a standard static shell, TermEdit displays real-time CPU, Memory, and PID stats for every command you run. Integrated Code Editor: A full-featured text editor with syntax highlighting (Dracula theme) allows you to fix scripts without leaving the dashboard. Predictive AI Workflow: Using Gemini, the app predicts your next move. If you run git init, it proactively suggests git add ., turning a sequence of manual commands into a single click.

How we built it

Frontend (TUI): We used the Textual library to create a beautiful, VS Code-like interface that runs inside the terminal, complete with split panes, mouse support, and reactive widgets. AI Brain: We integrated the Google Gemini API (specifically gemini-2.0-flash) to handle natural language translation and workflow prediction. System Backend: We used psutil for real-time resource monitoring and asyncio with Python's subprocess module to ensure the UI remains responsive while heavy commands run in the background.

Challenges we ran into

The "0% CPU" Bug: Initially, our monitoring widget showed 0% CPU for heavy tasks. We realized we were monitoring the parent shell process, not the actual command. We had to implement a recursive process tree lookup using psutil to aggregate stats from all child processes. Async Concurrency: Mixing a real-time UI loop (60fps) with blocking network calls (API requests) caused the interface to freeze. We solved this by moving all AI and System IO operations to background workers using Textual's @work(exclusive=True) decorator. Prompt Engineering: Getting the AI to output only the raw command without conversational filler ("Here is your command...") required strict system prompting and robust error handling.

Accomplishments that we're proud of

The "Living" Terminal: Seeing the CPU graph update dynamically while the AI is typing a response felt like magic. Safety First: We successfully built a "Human-in-the-Loop" architecture where dangerous commands are staged for review, potentially saving users from accidental data loss. Universal Prediction: The AI doesn't just know Git; it can predict workflows for Docker, Python, and Node.js automatically, making the tool feel "smart" regardless of the tech stack.

What we learned

Process Management: We gained a deep understanding of Linux process hierarchies, PIDs, and signal handling. Event-Driven Architecture: We learned how to manage complex state in a TUI, ensuring that a file click in the sidebar, a keystroke in the editor, and a background API call can all happen simultaneously without race conditions. The Power of Context: We realized that an AI agent is only as good as the context you give it (e.g., current directory files, previous commands).

What's next for TermEdit App

"Ghostwriter" Mode: We plan to integrate Gemini directly into the text editor pane. Users will be able to press Ctrl+Space to trigger AI Code Completion, where the model reads the current file context and auto-completes functions or writes documentation strings in real-time. Smart Autocomplete: We want to replace standard shell history with a context-aware autocomplete that learns from your habits. If you often run a specific build command in a specific folder, TermEdit will suggest it as soon as you type the first letter. Voice Command Support: Since Gemini is multimodal, we plan to add a feature where you can simply speak your intent to the terminal, making it accessible for hands-free operation.

Built With

Share this project:

Updates