Hambugsy: The CLI That Tells You WHO Is Wrong—Your Test or Your Code

Published: (February 15, 2026 at 12:00 PM EST)
7 min read
Source: Dev.to

Source: Dev.to

Hambugsy is a CLI tool that answers the question every developer asks when a test fails:

“Is my test wrong, or is my code wrong?”

Instead of spending 30 + minutes investigating, Hambugsy gives you an instant verdict with confidence scores and recommended fixes.


The Problem

Every developer has seen this:

❌ FAILED: testCalculateDiscount
   Expected: 90
   Actual: 85

Now begins the investigation:

  • Was the test written correctly?
  • Did someone change the business logic?
  • Is this a regression?
  • Which file do I need to fix?

This investigation typically takes 30‑60 minutes per failing test.


Example Run

$ hambugsy analyze ./src/OrderService.java

🍔 HAMBUGSY - Finding the bug in your stack...

┌─────────────────────────────────────────────────────────────────┐
  📍 calculateTotal() - line 47
  ├── Test FAILS: testCalculateTotal_WithDiscount
  ├── 🔬 Analysis:
 Test expects: 10% discount (written: 2025-03-15)         │
 Code applies: 15% discount (changed: 2026-01-22)         │
 Git blame: "Updated discount per new pricing policy"

  └── 🎯 VERDICT: Code CHANGED Test OUTDATED
      └── 💡 Fix: Update test assertion line 23: 90 85
└─────────────────────────────────────────────────────────────────┘

📊 Summary: 1 outdated test | Time saved: ~45 minutes

Core Features

FeatureDescription
analyzeDiagnose test failures and decide whether the test or the code is wrong
--run-testsExecute real tests for accurate failure detection
suggestFind missing tests and generate suggestions
fixAuto‑fix detected issues (with --dry-run preview)
Output formatsConsole, JSON, Markdown, GitHub Actions annotations

Installation

npm install -g hambugsy

Quick Start

# Analyze your whole project
hambugsy analyze ./src

How Hambugsy Uses GitHub Copilot CLI

When Hambugsy needs to understand what a test expects vs. what the code does, it calls Copilot:

// Using Copilot to analyze test intent
const testAnalysis = await exec(`
  gh copilot explain "What behavior does this test verify: ${testCode}"
`);
// Using Copilot to analyze code behavior
const codeAnalysis = await exec(`
  gh copilot explain "What does this function actually do: ${sourceCode}"
`);
// Generate a fix suggestion
const fixSuggestion = await exec(`
  gh copilot suggest -t code "
    The test expects: ${testExpectation}
    The code does: ${actualBehavior}
    Generate a fix for the ${isTestWrong ? 'test' : 'code'}
  "
`);
// Determine whether a change was intentional
const intentAnalysis = await exec(`
  gh copilot explain "
    Was this change intentional or accidental based on the commit message: 
    '${commitMessage}'
  "
`);
// Human‑readable explanation for every verdict
const explanation = await exec(`
  gh copilot explain "
    Explain why the test '${testName}' fails:
    - Test expects: ${expected}
    - Code returns: ${actual}
    - Test was written: ${testDate}
    - Code was changed: ${codeDate}
    Explain in plain English for a developer.
  "
`);

Verdict Classification

VerdictIconMeaning
Code Bug🐛Test is correct, code has a defect
Outdated Test📜Code changed intentionally, test needs update
Flaky Test🎲Test passes/fails inconsistently
Environment Issue🌐External dependency problem

Decision Flowchart

                Test Failure

        ┌────────────┴────────────┐
        │                         │
   Code changed?            Code unchanged
        │                         │
   ┌────┴────┐               ┌────┴────┐
   │         │               │         │
Intentional?  Regression   Test valid?  Test invalid?
   │         │               │         │
   ▼         ▼               ▼         ▼
OUTDATED   CODE            CODE      TEST
 TEST      BUG             BUG       BUG

Language & Framework Support

LanguageFrameworksStatus
JavaJUnit 4/5, TestNG✅ Full
TypeScriptJest, Mocha, Vitest✅ Full
Pythonpytest, unittest✅ Full
Gogo test, testify✅ Full
Rust#[test], tokio::test✅ Full
C#NUnit, xUnit, MSTest✅ Full

Example Commands per Language

# Java / JUnit
hambugsy analyze ./src/main/java/
# TypeScript / Jest
hambugsy analyze ./src/ --framework=jest
# Python / pytest
hambugsy analyze ./tests/

Finding Missing Test Coverage

$ hambugsy suggest ./src/PaymentService.java

🍔 Finding gaps in your test coverage...

📍 processPayment() @ line 5
├── TESTED: Happy path
├── MISSING: null request handling
├── MISSING: negative amount validation
└── MISSING: large amount threshold

💡 SUGGESTED TESTS: (generates actual test code)

Hambugsy not only analyzes failures—it also prevents future bugs by identifying untested code paths.


GitHub Actions Integration

- name: Analyze Tests
  run: hambugsy analyze ./src --format=github

The tool can emit GitHub Actions annotations, e.g.:

::error file=src/Service.java,line=47::CODE BUG: Missing null check

Configuration (.hambugsy.yml)

patterns:
  source: ["src/**/*.java"]
  test:   ["test/**/*.java"]

analysis:
  git_history_days: 90
  confidence_threshold: 0.7

ci:
  fail_on_bugs: true
  fail_on_outdated_tests: false

Architecture Overview

┌─────────────────────────────────────┐
│            Hambugsy CLI              │
├─────────────────────────────────────┤
│  ┌─────────┐  ┌─────────┐  ┌─────────┐ │
│  │ Parser  │  │ Analyzer│  │ Reporter│ │
│  └────┬────┘  └────┬────┘  └────┬────┘ │
│       └─────────────┼───────────────┘ │
│                     │               │
│            ┌────────▼─────────┐     │
│            │ Copilot Bridge   │     │
└─────────────────────────────────────┘

Hambugsy is fundamentally built around GitHub Copilot CLI’s capabilities. It leverages Copilot to understand intent, generate fixes, and produce clear explanations—making debugging faster and more reliable.


Hambugsy

The CLI tool that tells you WHO is wrong: your test or your code.

 │                   │
 │           └────────┬────────┘                   │
 ├────────────────────┼────────────────────────────┤
 │                    │                            │
 │  ┌─────────┐  ┌────▼────┐  ┌─────────┐          │
 │  │   Git   │  │ Copilot │  │  File   │          │
 │  │ History │  │   CLI   │  │ System  │          │
 │  └─────────┘  └─────────┘  └─────────┘          │
 └─────────────────────────────────────────────────┘

🍔 Ham + 🐛 Bug + 🎩 Bugsy
Like a hamburger with layers – bugs hide between the test layer and the code layer.

We hunt bugs – finding who’s guilty.
Bugsy Siegel – the gangster who always found the guilty party.

“Finding the bug in your stack”


Quick Install

npm install -g hambugsy
hambugsy analyze ./src

📦 View on npm🌐 Website⚡ Quick Start


The Problem

Every developer knows this pain:

❌ FAILED: testCalculateDiscount
   Expected: 90
   Actual:   85

Now what?

  • Is the test wrong?
  • Is the code wrong?
  • Did someone change the business logic?
  • Is the test outdated?

You spend ~30 minutes investigating, only to discover the test was written for the old discount logic.


The Solution

$ hambugsy analyze ./src/OrderService.java
🍔 HAMBUGSY - Test Failure Diagnostics 🍔
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

┌────────────────────────────────────────────────────────────────────┐
  📍 Method: calculateDiscount() @ line 32
├────────────────────────────────────────────────────────────────────┤
 FAILING TEST: testPremiumDiscount

  🔬 ANALYSIS:
  ├── Test expects: 10% discount (written: 2024‑03‑15)                  │
  └── Code applies: 15% discount (changed: 2024‑11‑22)                  │

  🎯 VERDICT: 📜 OUTDATED TEST

└───────────────────────────────────────────────────────────────────────┘

View on GitHub📦 npm Package🌐 Website📖 Documentation🐛 Issue Tracker


What’s Next

  • VS Code Extension (included!)
  • Auto‑fix mode (hambugsy fix)
  • IntelliJ Plugin
  • Team analytics dashboard
  • Slack/Teams notifications

Prerequisites

gh extension install github/gh-copilot

Install Hambugsy

npm install -g hambugsy

Run on Your Project

hambugsy analyze ./src

See what’s really causing your test failures.


We’d love your feedback!

  • Is this useful for your workflow?
  • What languages/frameworks would you need?
  • Any features you’d like to see?

Drop a comment below or open an issue on GitHub! 👇

Built with ❤️ for the GitHub Copilot CLI Challenge

0 views
Back to Blog

Related posts

Read more »

🐾GitPet - No more lonely debuging

!Cover image for 🐾GitPet - No more lonely debuginghttps://media2.dev.to/dynamic/image/width=1000,height=420,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fde...

snip - Terminal Snippet Manager

What I Built snip is a CLI snippet manager that lets developers save, search, and safely execute code snippets directly from the terminal—with fuzzy search, a...