<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: DHRUV GUPTA</title>
    <description>The latest articles on DEV Community by DHRUV GUPTA (@dhruvguptadev).</description>
    <link>https://dev.to/dhruvguptadev</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4157064%2F97e74c47-791b-482a-af74-404c6430a747.jpg</url>
      <title>DEV Community: DHRUV GUPTA</title>
      <link>https://dev.to/dhruvguptadev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dhruvguptadev"/>
    <language>en</language>
    <item>
      <title>Haunted Shell: Communing with Dead Code &amp; Crashed Processes via Local Gemma 3</title>
      <dc:creator>DHRUV GUPTA</dc:creator>
      <pubDate>Fri, 30 Oct 2026 08:40:34 +0000</pubDate>
      <link>https://dev.to/dhruvguptadev/haunted-shell-communing-with-dead-code-crashed-processes-via-local-gemma-3-14ob</link>
      <guid>https://dev.to/dhruvguptadev/haunted-shell-communing-with-dead-code-crashed-processes-via-local-gemma-3-14ob</guid>
      <description>&lt;p&gt;&lt;em&gt;This article is submitted for the &lt;a href="https://dev.to/events/challenges/hacktoberfest-week4-2026-10-26"&gt;Hacktoberfest Open-Source AI Challenge: Week 4&lt;/a&gt; (Theme: Ghost in the Machine).&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  👻 What I Built: Haunted Shell
&lt;/h2&gt;

&lt;p&gt;Every git repository is an obituary column. Behind every clean &lt;code&gt;main&lt;/code&gt; branch lie buried functions, excised logic, hasty hotfixes, and broken promises commemorated in cryptic commit messages. And when builds crash or tests fail, those buried spirits wail through unholy stack traces.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Haunted Shell&lt;/strong&gt; is a lightweight, zero-dependency Node.js command-line medium that awakens the &lt;strong&gt;Spectral Chronicler&lt;/strong&gt;—a Victorian necromancer inhabiting your terminal. It connects your git diffs, excised code, and crashed process &lt;code&gt;stderr&lt;/code&gt; logs to &lt;strong&gt;Google Gemma 3&lt;/strong&gt; running 100% locally via &lt;strong&gt;Ollama&lt;/strong&gt; (&lt;code&gt;http://localhost:11434/v1/chat/completions&lt;/code&gt;) or &lt;strong&gt;LM Studio&lt;/strong&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GitHub Repository:&lt;/strong&gt; &lt;a href="https://github.com/dhruv-gupta-dev/haunted-shell" rel="noopener noreferrer"&gt;https://github.com/dhruv-gupta-dev/haunted-shell&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Prize Category Entry:&lt;/strong&gt; &lt;strong&gt;Best Use of Gemma&lt;/strong&gt; (Featured Category)
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;         ___
        /   \
       | o o |
       |  ^  |
       | '-' |
        \   /
      __|   |__
     /  |   |  \
    /   | . |   \
   (    (   )    )
    '---'   '---'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  🔮 The Three Spectral Rites
&lt;/h2&gt;

&lt;p&gt;Haunted Shell provides three specialized commands:&lt;/p&gt;
&lt;h3&gt;
  
  
  1. &lt;code&gt;haunted-shell autopsy&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Performs a forensic post-mortem on the git graveyard. It scans recent commits, extracts excised lines (&lt;code&gt;-&lt;/code&gt; diffs), inspects working tree wounds, and invokes Gemma 3 to deliver:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The Exhumation:&lt;/strong&gt; Summary of what functionality was killed and buried.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Haunted Bug Warnings:&lt;/strong&gt; Latent regressions or broken references introduced by recent deletions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Healing Rite:&lt;/strong&gt; Practical git actions and code fixes to restore peace to the codebase.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
  
  
  Live Terminal Transcript:
&lt;/h4&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ haunted-shell autopsy

⚰️  BEGINNING POST-MORTEM AUTOPSY ON THE REPOSITORY...
Inspecting branch 'main', recent commits, and deleted code tombs...

(A chilling gust of wind rustles through the repository...)

Hark! I, the Spectral Chronicler, have surveyed the wreckage. 
The echoes of these revisions… disturbing.

1. The Exhumation (Summary of What Was Killed)
The recent activity reveals a frantic attempt to deliver a "zero-dependency haunted-shell CLI". 
The initial commit appears to be a rudimentary placeholder. The subsequent addition represents 
a complete architecture. Crucially, empty fields from package.json were deliberate removals.

2. Haunted Bug Warnings (Specific Defects &amp;amp; Regressions)
• Regression: Absence of Testing: The "Error: no test specified" test remains.
• Spectral Echoes: The shell designation suggests deep system integration—ensure the bin 
  field properly summons the CLI from any directory.

3. The Healing Rite (Concrete Code &amp;amp; Git Actions)
• Package.json Verification: Ensure description, license, and scripts are purified.
• Surgical Refactoring: Prioritize modularity and clear error propagation.

⚰️  Autopsy complete. May the deleted code rest in peace.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. &lt;code&gt;haunted-shell exorcise &amp;lt;cmd&amp;gt;&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Spawns any shell command inside an isolated execution chamber and captures real-time outputs.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If the command succeeds (&lt;code&gt;exit code 0&lt;/code&gt;), it confirms the process was purified with no demons remaining.&lt;/li&gt;
&lt;li&gt;If the command crashes (&lt;code&gt;exit code != 0&lt;/code&gt;), it traps &lt;code&gt;stderr&lt;/code&gt;, isolates the stack trace, and invokes Gemma 3:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The Curse Identified:&lt;/strong&gt; A dramatic summary of what brought the process down.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Forensic Breakdown:&lt;/strong&gt; Exact technical root cause behind the stack trace.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The Banishing Incantation:&lt;/strong&gt; The exact code patch or shell command to purge the defect.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
  
  
  Live Terminal Transcript:
&lt;/h4&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ haunted-shell exorcise "node -e 'throw new ReferenceError(\"spectral_pointer is not defined\")'"

⚡ INITIATING TRIAL FOR COMMAND: node -e 'throw new ReferenceError("spectral_pointer is not defined")'
Executing in process chamber...


throw new ReferenceError("spectral_pointer is not defined")
^
ReferenceError: spectral_pointer is not defined
    at [eval]:1:7

────────────────────────────────────────────────────────────

⚡ CRASH DETECTED! A curse has possessed the process (Exit Code: 1).
Summoning spectral diagnosis from gemma3:4b...

1. The Curse Identified:
The spectral curse is one of unfulfilled expectation. The process sought to summon 
a variable—spectral_pointer—only to meet with a chilling silence in memory.

2. The Forensic Breakdown:
A ReferenceError was explicitly thrown during evaluation. The identifier was not
allocated in the lexical scope before execution.

3. The Banishing Incantation:
Declare the variable or wrap within a protective try/catch ward:

  try {
    invoke(spectral_pointer);
  } catch (e) {
    console.warn("The spirit was absent:", e.message);
  }

🔮 The exorcism rite concludes. Cast the incantation above to banish the error.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. &lt;code&gt;haunted-shell seance&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Opens an interactive, multi-turn readline REPL directly in your terminal. It pre-loads:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Active git branch &amp;amp; working tree status&lt;/li&gt;
&lt;li&gt;Recent 5 commit logs&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;package.json&lt;/code&gt; scripts and metadata&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It maintains conversation context across turns and includes built-in spectral shortcut rites (&lt;code&gt;/status&lt;/code&gt;, &lt;code&gt;/diff&lt;/code&gt;, &lt;code&gt;/log&lt;/code&gt;, &lt;code&gt;/clear&lt;/code&gt;, &lt;code&gt;/exit&lt;/code&gt;).&lt;/p&gt;
&lt;h4&gt;
  
  
  Live Terminal Transcript:
&lt;/h4&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ haunted-shell seance

🔮 THE CIRCLE IS CAST. COMMUNE WITH THE SPIRITS OF YOUR REPOSITORY.
   Branch: main | Tree: Working tree clean
   Recent Commits: 152ed19 feat: implement zero-dependency haunted-shell CLI for local open-weight AI

Special Rites: /help, /status, /diff, /log, /clear, /exit

👻 seance&amp;gt; What spirits haunt this repository?

The repository whispers of a nascent CLI medium, forged in the fires of 
Hacktoberfest Week 4. Its bloodline is pure Node.js ES modules, untainted by external 
dependencies. Yet I sense uncommitted diffs stirring beneath the surface...

👻 seance&amp;gt; /exit
🕯️ Blowing out the candles. The spirits return to the void.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  ⚡ Architecture: Zero Dependencies
&lt;/h2&gt;

&lt;p&gt;Haunted Shell requires &lt;strong&gt;zero npm packages&lt;/strong&gt;. It is built entirely on modern &lt;strong&gt;Node.js 24 LTS native built-ins&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;
&lt;pre data-lang="mermaid"&gt;&lt;code&gt;flowchart TD
    subgraph Terminal ["🖥️ Developer Terminal"]
        User["Developer"] --&amp;gt;|Command| CLI["haunted-shell (Node.js ES Module)"]
    end

    subgraph NativeNode ["⚙️ Native Node.js Built-ins (0 Dependencies)"]
        CLI --&amp;gt; NativeProc["node:child_process (spawn, execSync)"]
        CLI --&amp;gt; NativeRL["node:readline/promises (Interactive REPL)"]
        CLI --&amp;gt; NativeFetch["Global fetch + SSE Stream Reader"]
        CLI --&amp;gt; NativeColors["ANSI Spectral Palette (NO_COLOR safe)"]
    end

    subgraph GitTree ["📁 Local Git Repository"]
        NativeProc --&amp;gt; GitLog["git log -p (Deleted Code &amp;amp; Diffs)"]
        NativeProc --&amp;gt; GitStatus["git status &amp;amp; branch"]
        NativeProc --&amp;gt; ProcessChamber["Process Execution &amp;amp; Stderr Trap"]
    end

    subgraph LocalAI ["🧠 100% Offline Open-Weight Inference"]
        NativeFetch --&amp;gt;|/v1/chat/completions (OpenAI compatible)| Engine{"Local AI Provider"}
        Engine --&amp;gt;|Port 11434| Ollama["Ollama (gemma3:4b / qwen3:4b)"]
        Engine --&amp;gt;|Port 1234| LMStudio["LM Studio"]
    end&lt;/code&gt;&lt;/pre&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Global &lt;code&gt;fetch&lt;/code&gt; + &lt;code&gt;ReadableStream&lt;/code&gt;:&lt;/strong&gt; Consumes Server-Sent Events (SSE) token-by-token directly from Ollama's &lt;code&gt;/v1/chat/completions&lt;/code&gt; endpoint.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Native &lt;code&gt;node:readline/promises&lt;/code&gt;:&lt;/strong&gt; Powers the interactive &lt;code&gt;seance&lt;/code&gt; REPL.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Native &lt;code&gt;node:child_process&lt;/code&gt;:&lt;/strong&gt; Safely traps &lt;code&gt;stderr&lt;/code&gt; in a subprocess chamber without polluting the main shell.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;ANSI Spectral Engine:&lt;/strong&gt; Full terminal coloring with graceful degradation for non-TTY or &lt;code&gt;NO_COLOR&lt;/code&gt; environments.&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  🛡️ Why Local Open-Weight Inference (Gemma 3) Matters
&lt;/h2&gt;

&lt;p&gt;When building developer tools that inspect git histories and crash dumps, open innovation and local models are not just nice to have—they are essential:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Absolute Privacy:&lt;/strong&gt; Your git diffs, commit logs, and terminal crash traces contain proprietary intellectual property, internal file paths, and occasionally leaked tokens or credentials. With &lt;strong&gt;Gemma 3:4b&lt;/strong&gt; running via Ollama, &lt;strong&gt;zero bytes ever leave &lt;code&gt;localhost&lt;/code&gt;&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;100% Offline Resilience:&lt;/strong&gt; Development happens on flights, subways, remote trains, and off-grid locations. Haunted Shell works completely offline with the lights and internet turned off.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Zero Token Billing:&lt;/strong&gt; No API subscriptions, rate limits, or surprise bills from cloud AI providers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Permanent Ownership:&lt;/strong&gt; The model is stored locally on disk. It cannot be deprecated, modified, or price-hiked by an upstream API vendor.&lt;/li&gt;
&lt;/ol&gt;


&lt;h2&gt;
  
  
  🤖 DevRelay Agent Session
&lt;/h2&gt;

&lt;p&gt;The entire development and testing lifecycle of Haunted Shell—from initial zero-dependency architecture to live Gemma 3 streaming integration and commit diff forensic testing—was recorded using DevRelay:&lt;/p&gt;


&lt;div class="ltag-agent-session"&gt;
  &lt;div class="agent-session-header"&gt;
    
    &lt;span class="agent-session-tool-icon-badge" title="Gemini CLI"&gt;
&lt;/span&gt;
    &lt;span class="agent-session-title"&gt;Building Haunted Shell: Zero-Dependency Node.js CLI with Gemma 3 &amp;amp; Ollama&lt;/span&gt;
  &lt;/div&gt;

  &lt;div class="agent-session-scroll"&gt;

      &lt;div class="agent-session-message agent-session-user"&gt;
        &lt;div class="agent-session-role-badge agent-session-role-user"&gt;
          You
        &lt;/div&gt;
        &lt;div class="agent-session-content"&gt;
                &lt;div class="agent-session-text"&gt;
                  &lt;p&gt;Create a zero-dependency Node.js ES module CLI for "haunted-shell" (Hacktoberfest Week 4: Ghost in the Machine) connecting to local open-weight models via Ollama (gemma3:4b) or LM Studio, supporting autopsy, exorcise, and seance.&lt;/p&gt;

                &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;

      &lt;div class="agent-session-message agent-session-assistant"&gt;
        &lt;div class="agent-session-role-badge agent-session-role-assistant"&gt;
          Agent
        &lt;/div&gt;
        &lt;div class="agent-session-content"&gt;
                &lt;div class="agent-session-text"&gt;
                  &lt;p&gt;Designed and implemented package.json, index.js, and README.md. Built native streaming SSE client, git diff and deleted-line extraction for 'autopsy', process chamber and stderr crash trapping for 'exorcise', and interactive readline REPL for 'seance'—all with 0 external dependencies using Node 24 built-ins.&lt;/p&gt;

                &lt;/div&gt;
              &lt;div class="agent-session-tool-call"&gt;
                
                  &lt;span class="agent-session-chevron"&gt;▸&lt;/span&gt;
                  &lt;span class="tool-name tool-name-runcommand"&gt;run_command&lt;/span&gt;
                    &lt;span class="tool-input-preview"&gt;git status; node index.js --help&lt;/span&gt;
                
                &lt;div class="agent-session-tool-detail"&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Input&lt;/div&gt;
                      &lt;pre class="agent-session-pre agent-session-terminal"&gt;&lt;code&gt;$ git status; node index.js --help&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Output&lt;/div&gt;
                      &lt;pre class="agent-session-pre"&gt;&lt;code&gt;haunted-shell commands registered and help banner verified&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;

      &lt;div class="agent-session-message agent-session-user"&gt;
        &lt;div class="agent-session-role-badge agent-session-role-user"&gt;
          You
        &lt;/div&gt;
        &lt;div class="agent-session-content"&gt;
                &lt;div class="agent-session-text"&gt;
                  &lt;p&gt;Run autopsy and exorcise with local open-weight model Gemma 3:4b in Ollama.&lt;/p&gt;

                &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;

      &lt;div class="agent-session-message agent-session-assistant"&gt;
        &lt;div class="agent-session-role-badge agent-session-role-assistant"&gt;
          Agent
        &lt;/div&gt;
        &lt;div class="agent-session-content"&gt;
                &lt;div class="agent-session-text"&gt;
                  &lt;p&gt;Executed autopsy on the git commit tree and exorcised a failing Node.js eval command with Gemma 3:4b via Ollama. Gemma successfully delivered the in-character forensic breakdown, identified the curse, and provided banishing incantations.&lt;/p&gt;

                &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;

  &lt;div class="agent-session-footer"&gt;
    &lt;span class="agent-session-meta"&gt;
        4 of 4 messages
    &lt;/span&gt;
  &lt;/div&gt;
&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Direct Session Link:&lt;/em&gt; &lt;a href="https://dev.to/agent_sessions/building-haunted-shell-zero-dependency-nodejs-cli-with-gemma-3-ollama-zug42e"&gt;View full DevRelay Agent Session on DEV&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  🚀 Try It Yourself
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# 1. Pull Gemma 3 in Ollama&lt;/span&gt;
ollama run gemma3:4b

&lt;span class="c"&gt;# 2. Clone and run Haunted Shell&lt;/span&gt;
git clone https://github.com/dhruv-gupta-dev/haunted-shell.git
&lt;span class="nb"&gt;cd &lt;/span&gt;haunted-shell
npm &lt;span class="nb"&gt;link&lt;/span&gt;

&lt;span class="c"&gt;# 3. Commune with your repository&lt;/span&gt;
haunted-shell autopsy
haunted-shell exorcise npm &lt;span class="nb"&gt;test
&lt;/span&gt;haunted-shell seance
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;May your deleted code rest in peace! 🕯️👻🕯️&lt;/p&gt;

</description>
      <category>hf26challenge</category>
      <category>devchallenge</category>
      <category>ai</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
