跳到正文
DEV Community· Anush Deotare·· 3 小時前AI 評分43

我為棄置的 Git 儲存庫建造墓園,由 Gemma 離線撰寫墓誌銘

I Built a Graveyard for My Abandoned Git Repos (Gemma Writes the Epitaphs, Offline)

AI 導讀

作者開發 Repo Graveyard,以本機方式掃描 Git 儲存庫,按最後提交時間分類,並根據 Git 歷史判定死因及復活評分。Gemma 3 4B 經 Ollama 在本機撰寫墓誌銘和鬼故事,工具亦能串流輸出復活計劃,並將墓園匯出為可選擇隱去儲存庫名稱的 HTML 檔案。所有處理均可離線進行,歷史資料不會離開用戶的裝置。

正文

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 4: Ghost in the Machine

What I Built

Every developer has a graveyard. Mine is a folder of projects that started with a burst of commits and a confident README, then stopped. Nobody announced it. The last commit just sat there, and the project quietly died.

Repo Graveyard points at a folder of git repositories and turns the abandoned ones into a night-time graveyard. Each dead project gets a tombstone with its birth and death years, a cause of death, an epitaph, and a short ghost story told in the project's own voice. It scans, it mourns, and it can try to bring something back.

For the theme, I read "Ghost in the Machine" literally. Every abandoned repo is a ghost: code that still exists, still has a history, and has no one left to talk to. The git log is the only thing left of it, so the log is what the ghost speaks from.

A few things it does:

  • Finds your dead. Repos are sorted by days since the last commit: Alive (under 30), Sleeping (30–180), Dead (180–365), Ancient (over 365).
  • Assigns a cause of death. "Abandoned mid-sentence" for a last commit like wip or fix later. "Died young" for under 10 commits. "Death by TODO" for repos buried in unfinished notes. "Sudden death" for heavy activity followed by silence. "Fizzled out" for everything else.
  • Writes epitaphs and ghost stories with a local model, based only on facts from git.
  • Resurrects. A rule-based revival score picks the dead project most worth saving, and a séance animation streams a concrete 3-step plan to bring it back.
  • Exports the whole graveyard as a single self-contained HTML file, with an option to redact repo names so you can share it without exposing private projects.

Code

🪦 Repo Graveyard

"Ghost in the Machine" Hackathon Project
A 100% local, air-gapped forensic inspection tool that scans your folders for abandoned Git repositories and resurrects them into an atmospheric, dark-humored virtual graveyard.


📸 Preview

+-----------------------------------------------------------------------------------+
|  🕯️  REPO GRAVEYARD                 [100% Local & Private] [🟢 Gemma 3:4b Ready]  |
|  Where dead code rests, unresolved TODOs haunt, and local spirits speak.          |
+-----------------------------------------------------------------------------------+
|  [ C:\Projects                            ]  [ Scan Projects ]  [ 🔮 Séance ]    |
+-----------------------------------------------------------------------------------+
|  🌱 Still Among the Living (Recent commits detected)                             |
|  [● spectral-cli  4d ago]  [● pixel-roguelike-core  75d ago]                      |
+-----------------------------------------------------------------------------------+
|  ⚰️ The Cemetery Grounds                                                          |
|                                                                                   |
|    +-------------------+    +-------------------+    +-------------------+        |
|   /       R.I.P.        \   |      R.I.P.       |   ✝       R.I.P.        |       |
|  |   neural-toaster      |  | crypto-tamagotchi |  | vim-exit-simulator   |       |
|  |    2021 — 2022        |  |    2022 — 2023    |  |    2023 — 2023        |       |

…

Run it with Python and Ollama. The README has the setup steps: install Ollama, ollama pull gemma3:4b, then python run.py.

How I Built It

The model: Gemma 3 4B (gemma3:4b), running locally through Ollama. I built this on a laptop with an RTX 3050 and 4 GB of VRAM, so a small model that runs without a datacenter was the point.

The stack: Python and FastAPI on the backend, and a vanilla HTML/CSS/JS frontend with no frameworks, no CDN and no external fonts. The only network call in the whole app is to localhost:11434, where Ollama lives. Scan results and generated text are cached as JSON, so the graveyard loads instantly the second time.

The main design decision: the model doesn't know anything. Git does.

I didn't want an LLM guessing what happened to my projects, so I split the work:

  • Rules decide the facts. Dates, commit counts, the status (alive, dead, ancient), the cause of death and the revival score are all computed deterministically from git history. There's nothing for the model to make up.
  • The model only gives those facts a voice. Gemma gets a short list of allowed facts (name, lifespan, commit count, cause of death, last commit message, TODO count, first line of the README) and writes a two-line epitaph or an ~80-word ghost story from them.
  • A grounding check catches invention. If the output names a technology that isn't in the facts it was given, the app regenerates once with a stricter prompt, then falls back to a plain account built from the git data.
  • Honest fallbacks. If Ollama isn't running, the app doesn't pretend. Stories fall back to a deterministic version, and the UI labels it "written without the model."

Epitaphs are generated in a background queue after each scan, while ghost stories and Resurrect plans stream token by token over server-sent events. On my machine the first token of a warm ghost story shows up in about 1.3 seconds.

The Resurrect plan only sees three inputs: the README's first lines, the TODO lines, and the last five commit messages. It never sees the source code.

Why Does Open Innovation Matter?

A tool that reads your commit history is reading something private. Commit messages, TODOs, the names of side projects you never told anyone about, the half-finished idea from 2 a.m.: it's a fairly intimate record of what you worked on and what you gave up on.

That's why this had to be open and local:

  • Your history never leaves your machine. Gemma runs through Ollama on localhost. There are no API keys, no accounts and no telemetry. A closed API would mean sending the names of my abandoned projects and their last commit messages to a server I don't control, just to get a joke about them.
  • It works with the internet off. I ran the whole thing with Wi-Fi turned off: scan, epitaphs, ghost stories and Resurrect. A graveyard that needs a server to stay online felt like the wrong kind of ghost.
  • It costs nothing to run. No per-token bill, no quota. It can write an epitaph for every dead repo you have.
  • The model is one line of config. If a better small model comes out, you change one value.
  • The output can't be locked in. The export is a plain HTML file. It will still open in ten years, whether or not any service survives.

Prize Categories

Best Use of Gemma: the whole project runs on gemma3:4b locally through Ollama, as the voice that gives each abandoned repo its epitaph, ghost story and revival plan, while git supplies every fact.

來源:DEV Community · dev.to