Skip to main content

Dig into any bug with full codebase context — zero LLM calls

Project description

dug

Dig into any bug with full codebase context — zero LLM calls.

PyPI version License: MIT Python 3.10+

dug takes a bug report or stack trace and generates a structured Claude Code prompt that includes the exact files, functions, and context needed to fix it — using grep, AST parsing, and a local vector index with no API calls and no LLM required.


Install

# Recommended
pipx install dug-cli

# macOS (Homebrew)
brew tap ratishjain12/dug
brew install dug-cli

# One-liner (Linux / macOS)
curl -fsSL https://raw.githubusercontent.com/ratishjain12/dug/main/install.sh | sh

# Inside a virtualenv
pip install dug-cli

Quick start

# 1. Run once in your repo root to build the index
cd /your/project
dug init

# 2. Paste any bug report or stack trace
dug "NullPointerException in UserService.authenticate at line 42"

# dug prints a ready-to-paste Claude Code prompt with ranked file context

Sample output:

You are a senior engineer debugging this issue:

  NullPointerException in UserService.authenticate at line 42

Relevant files (ranked by relevance):

1. src/auth/UserService.java:35
   authenticate() — modified 2 commits ago
   ...

2. src/config/AppConfig.java:12
   loadConfig() — error pattern match
   ...

[full function bodies + graph context follow]

How it works

dug builds a local knowledge base the first time you run dug init:

Layer What it builds Used for
Structural graph File → Symbol → Commit nodes (networkx) Import chains, recent changes
Semantic index Function embeddings in LanceDB (sentence-transformers) Meaning-level matches
History log Past bug→fix pairs Learning from outcomes

At query time, three signals are combined into a ranked list:

  • Structural score — imports your error file, was modified in a related commit
  • Semantic score — cosine similarity between bug text and function bodies
  • History boost — similar past bugs pointed here

The index stays fresh via git hooks (post-commit, post-checkout) and an optional file watcher.


Commands

Command What it does
dug init Index the current repo (builds graph + embeddings)
dug "error text" Generate a Claude Code prompt for the bug
dug update Re-index files changed since last commit
dug watch Watch for file saves and re-index in real time
dug stats Show index size (nodes, edges, chunks)
dug config View / edit configuration
dug feedback good Mark last query as helpful (improves future results)
dug feedback bad Mark last query as unhelpful

Options

dug init --local          # Use local embeddings (default, no API key needed)
dug init --openai         # Use OpenAI text-embedding-3-small (needs OPENAI_API_KEY)
dug "error" --files 3     # Limit to top 3 files in prompt
dug "error" --no-history  # Skip learning loop context

Configuration

dug init creates .dug/config.json in the repo root. You can also edit it with dug config set <key> <value>.

{
  "embedding_mode": "local",
  "languages": ["python", "java", "typescript", "javascript"],
  "max_files_in_prompt": 5,
  "git_history_depth": 50,
  "exclude_test_files": true
}

.dug/ is automatically added to .gitignore — it's machine-specific and never committed.


Contributing

git clone https://github.com/ratishjain12/dug
cd dug
uv sync
uv run dug init   # index the dug repo itself
uv run dug "your bug here"

Requires Python 3.10+ and uv.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dug_cli-0.1.6.tar.gz (39.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dug_cli-0.1.6-py3-none-any.whl (31.8 kB view details)

Uploaded Python 3

File details

Details for the file dug_cli-0.1.6.tar.gz.

File metadata

  • Download URL: dug_cli-0.1.6.tar.gz
  • Upload date:
  • Size: 39.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for dug_cli-0.1.6.tar.gz
Algorithm Hash digest
SHA256 f790a9c564199d12f628614df2b689bb0f606b4865dffc32139625b8295fc297
MD5 4daeabd7c2a1c44e9662751d2a31db96
BLAKE2b-256 621f659a83d60abf3c1505f8e8b830396a28efd92c08a33ae991d5b12abddd61

See more details on using hashes here.

File details

Details for the file dug_cli-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: dug_cli-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 31.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for dug_cli-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 89f206b81515f26bcede97d8650b176d1f854173cf65216b7ca71c06f580ac8e
MD5 2099cb677eed88b18f0a5b918a7368af
BLAKE2b-256 ab8e785db6f4538aa3b59acba226b5899b3df8e522b0b22920f4c7e3dc53920d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page