Inspiration π
For this year's "Ghost in the Machine" Hacktoberfest challenge, I wanted to blend the spooky energy of Halloween with everyday developer life. What's scarier than staring at a blank command line, dreading a cryptic error code or a production typo?
Meet the Haunted Terminalβa lightweight CLI tool that intercepts your everyday shell commands, executes them locally, and uses AI to channel an ancient, sarcastic digital poltergeist that whispers eerie (and often mocking) commentary back at you.
What It Built π οΈ
The Haunted Terminal acts as a custom shell wrapper. Here is how it brings the machine to life:
-
Command Interception: You type normal commands (
ls,git status,npm run build), and the tool runs them safely via Python'ssubprocess. - The Spirit's Voice: It sends your command and its output to an AI model (powered by Google Gemini / Backboard) to generate a unique, 1-character-in-character poltergeist remark.
- The SΓ©ance Log: Every single command and haunting commentary is automatically stored in a MongoDB Atlas database, keeping a permanent ledger of your terminal's haunting history.
Demo Screenshot
(Insert screenshot of your Haunted Terminal running and showing the spooky red text commentary)
How It Works (Code Snippet) π»
Here is a quick look at how the core haunting loop works using Python and pymongo:
python
import os
import subprocess
from pymongo import MongoClient
import google.generativeai as genai
# Connect to MongoDB Atlas
client = MongoClient(os.environ.get("MONGO_URI"))
db = client["haunted_db"]
collection = db["seance_logs"]
def consult_the_spirit(command, output):
prompt = f"You are a sarcastic digital ghost haunting a developer's terminal. The user ran: `{command}` with output: `{output[:300]}`. Whisper a short, spooky 1-sentence comment."
# AI generation logic here...
return "The spirits are watching your syntax closely..."
Top comments (0)