Bhoot Shell: My Terminal Is Haunted, and the Ghost Runs on Local Gemma
说明与用途
脚本自动读取最近的终端命令,使用本地 Gemma 4 模型生成恐怖评论,并通过 ElevenLabs 朗读,保持机密信息本地化。
问题
A terminal user wants an automated, spooky feedback loop that reads recent shell commands, generates eerie commentary, and plays it aloud without exposing sensitive data.
结果
The script delivers a fully automated haunted‑terminal experience: it reads recent commands, generates context‑aware spooky lines in Hindi or English, and whispers them aloud, all while keeping secrets local.
工作流
- Read the most recent shell history from either Git Bash (~/.bash_history) or PowerShell PSReadLine history file.
- Apply a regex pass to mask tokens, bearer keys, secret keys, and user:pass URLs.
- Send the masked commands to the local Gemma 4 model (gemma4:e4b) via Ollama on 127.0.0.1, with a prompt that casts the model as a ghost and requires mention of at least one command.
- Receive the model’s one‑two line eerie reply, send it to ElevenLabs TTS (eleven_multilingual_v2) to generate an MP3, and play it with ffplay or the system’s default player.
证据
It reads the last five commands you typed, a local Gemma model writes one or two eerie lines about them, and ElevenLabs whispers them through your speakers.
The ghost never repeats itself.
It's one file, bhoot.js, with zero npm dependencies. Node 18+ built-ins only: fetch, fs, and child_process.
Gemma 4 gave me silence. My first full run took 40 seconds and returned an empty string. Adding one field fixed it: "think": false.
Node's fetch tried IPv6 ::1 first, and Ollama listens on IPv4. Hardcoding 127.0.0.1 fixed it.
- 记录日期: 2026-11-01T13:14:14.801Z