跳到正文
DEV Community· Faheem Musthafa P·· 2 小時前AI 評分41

CodeNecromancer:以開放權重 Gemma 復活棄置程式碼庫

CodeNecromancer: Resurrecting Dead Repositories with Open-Weight Gemma

AI 導讀

CodeNecromancer 是一個以本機運行的開放權重 Google Gemma 驅動、用來檢查及復活棄置程式碼庫的自主 Agent。它會審核過時依賴、分析程式碼庫狀況、更新舊語法,並產生 GitHub Actions v4 工作流程及 RESURRECTION.md。項目透過本機 Ollama 使用 gemma4:e4b 或 gemma:2b。

正文

Faheem Musthafa P

Hacktoberfest Open-Source AI Challenge: Ghost in the Machine Submission 👻🌼

This is a submission for the Hacktoberfest Open-Source AI Challenge: Week 4.


💀 Ghost in the Machine: What I Built

Every developer knows the sorrow of wandering through the open-source graveyard. Repositories that once powered thousands of applications sit abandoned in digital purgatory—strangled by bitrot, deprecated packages, vulnerable cryptographic primitives, and broken CI systems like Travis CI.

For Hacktoberfest 2026: Week 4 (Ghost in the Machine), I built CodeNecromancer: an autonomous digital mortician and repository resurrection agent powered by Google Gemma (open-weight) running locally on-device.

CodeNecromancer does three things:

  1. The Autopsy Chamber (codenecromancer autopsy): Inspects a repository's git burial ground, calculates a Necro-Score (0–100), audits rotting dependencies, and channels Gemma to issue a Certificate of Digital Death with deep technical post-mortem analysis.
  2. The Séance Circle (codenecromancer seance): Holds an interactive séance with the Ghost of the Original Maintainer, allowing you to interrogate the ghost about their architecture, unmerged plans, and regrets.
  3. The Resurrection Ritual (codenecromancer resurrect): Autonomously mutates rotting manifests, synthesizes modern GitHub Actions v4 CI workflows, refactors deprecated syntax (such as Python 2 or obsolete APIs), and generates a commemorative RESURRECTION.md on a fresh git branch.

It includes both a Rich Gothic Terminal CLI and a web portal with dark ethereal styling.


🔮 Why Open Innovation Matters

Code bases are among the most sensitive intellectual property developers create. In this project, relying on open-weight models (Google Gemma via Ollama) wasn't just a design choice—it was the only ethical and practical architecture:

  1. Zero Source Code Exfiltration: When auditing an internal or private abandoned repository, sending entire git histories, environment variables, and proprietary code to cloud LLMs violates security policies. With open-weight Gemma running locally on an RTX GPU, zero bytes leave the machine.
  2. No Token Tax on Deep AST Analysis: Performing full-repo dependency graphs, changelog forensics, and multi-file code refactoring consumes hundreds of thousands of tokens. Running on-device is 100% free, unlimited, and runs even with the lights and internet turned off.
  3. Perpetual Digital Preservation: Proprietary APIs alter model weights, introduce new safety guardrails that break syntax parsing, or shut down entirely. Open-weight models guarantee that software archaeology tools remain functional decades into the future.

⚡ Demo & Screenshots

Terminal Autopsy Output

╭──────────────────────────────────────────────────────────────────────────────╮
│                       📜 CERTIFICATE OF DIGITAL DEATH                        │
│ ┌───────────────────────────┬──────────────────────────────────────────────┐ │
│ │ Repository Subject        │ zombie_microservice                          │ │
│ │ Necro-Score               │ 100 / 100 (Fossilized Lich)                  │ │
│ │ Time in Purgatory         │ 3,487 days (Last breath: 2017-04-12)         │ │
│ │ Defunct CI/CD             │ Travis CI (Defunct/Abandoned)                │ │
│ │ Dead / Vulnerable         │ • flask==0.12.2 • pycrypto==2.6.1            │ │
│ │ Packages                  │ • requests==2.11.1 • nose==1.3.7             │ │
│ │ ⚰️ Official Cause of Death │ Succumbed to digital entropy, rotting in... │ │
│ └───────────────────────────┴──────────────────────────────────────────────┘ │
╰──────────────────────────────────────────────────────────────────────────────╯

The Séance with the Ghost of the Maintainer

User: "Why did you abandon this repository?"

Ghost of zombie_microservice: "I built this thing to serve, but time turned my function into a mausoleum. My dependencies are whispers of vulnerability, and my CI/CD is a forgotten crypt. The pull requests stopped coming in 2017..."


🛠️ Partner Technology & Tracks Entered

  • Best Use of Gemma ($200 Featured Track):
    • Powered by Google Gemma (gemma4:e4b / gemma:2b) running via local Ollama.
    • Gemma handles:
    • The qualitative post-mortem autopsy analysis and cause-of-death diagnosis.
    • Dynamic roleplay as the Departed Maintainer in the séance chat.
    • Code modernization refactoring (transforming legacy syntax into modern standard Python).

🧪 Testing Instructions for Judges

To run CodeNecromancer locally:

# 1. Clone & install
git clone https://github.com/FM9447/CodeNecromancer.git
cd CodeNecromancer
pip install -e .

# 2. Ensure Ollama is running with Gemma
ollama pull gemma4:e4b  # or gemma:2b

# 3. Autopsy the included 2017 zombie microservice
codenecromancer autopsy examples/zombie_microservice

# 4. Hold a séance
codenecromancer seance examples/zombie_microservice

# 5. Perform the resurrection ritual
codenecromancer resurrect examples/zombie_microservice

# 6. Launch the Web Portal
codenecromancer serve --port 8000

Visit http://localhost:8000 to interact with the visual necrology lab!


🔗 Code Repository & MLH Project

Built with 🖤 for Hacktoberfest 2026: Week 4.

來源:DEV Community · dev.to