dug-cli 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dug_cli-0.1.0/.github/homebrew/dug-cli.rb +31 -0
- dug_cli-0.1.0/.github/scoop/dug-cli.json +23 -0
- dug_cli-0.1.0/.github/workflows/release.yml +132 -0
- dug_cli-0.1.0/.github/workflows/update-homebrew.yml +51 -0
- dug_cli-0.1.0/.gitignore +16 -0
- dug_cli-0.1.0/.python-version +1 -0
- dug_cli-0.1.0/LICENSE +21 -0
- dug_cli-0.1.0/PKG-INFO +178 -0
- dug_cli-0.1.0/README.md +139 -0
- dug_cli-0.1.0/RELEASING.md +186 -0
- dug_cli-0.1.0/TODO.md +24 -0
- dug_cli-0.1.0/install.sh +86 -0
- dug_cli-0.1.0/plan.md +889 -0
- dug_cli-0.1.0/pyproject.toml +51 -0
- dug_cli-0.1.0/src/dug/__init__.py +0 -0
- dug_cli-0.1.0/src/dug/__main__.py +297 -0
- dug_cli-0.1.0/src/dug/chunker.py +137 -0
- dug_cli-0.1.0/src/dug/config.py +77 -0
- dug_cli-0.1.0/src/dug/embeddings.py +97 -0
- dug_cli-0.1.0/src/dug/git_context.py +56 -0
- dug_cli-0.1.0/src/dug/graph.py +423 -0
- dug_cli-0.1.0/src/dug/history.py +231 -0
- dug_cli-0.1.0/src/dug/hooks.py +112 -0
- dug_cli-0.1.0/src/dug/indexer.py +294 -0
- dug_cli-0.1.0/src/dug/prompt_builder.py +106 -0
- dug_cli-0.1.0/src/dug/retriever.py +249 -0
- dug_cli-0.1.0/src/dug/vector_store.py +79 -0
- dug_cli-0.1.0/src/dug/verifier.py +73 -0
- dug_cli-0.1.0/src/dug/watcher.py +103 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# This file lives in a separate repo: github.com/ratishjain12/homebrew-dug
|
|
2
|
+
# Create that repo and put this file at: Formula/dug-cli.rb
|
|
3
|
+
#
|
|
4
|
+
# Users install with:
|
|
5
|
+
# brew tap ratishjain12/dug
|
|
6
|
+
# brew install dug-cli
|
|
7
|
+
|
|
8
|
+
class DugCli < Formula
|
|
9
|
+
desc "Dig into any bug with full codebase context — zero LLM calls"
|
|
10
|
+
homepage "https://github.com/ratishjain12/dug"
|
|
11
|
+
version "0.1.0"
|
|
12
|
+
|
|
13
|
+
on_macos do
|
|
14
|
+
on_arm do
|
|
15
|
+
url "https://github.com/ratishjain12/dug/releases/download/v#{version}/dug-macos-arm64"
|
|
16
|
+
sha256 "REPLACE_WITH_ARM64_SHA256"
|
|
17
|
+
end
|
|
18
|
+
on_intel do
|
|
19
|
+
url "https://github.com/ratishjain12/dug/releases/download/v#{version}/dug-macos-amd64"
|
|
20
|
+
sha256 "REPLACE_WITH_AMD64_SHA256"
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def install
|
|
25
|
+
bin.install Dir["dug-macos-*"].first => "dug"
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
test do
|
|
29
|
+
system "#{bin}/dug", "--help"
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "0.1.0",
|
|
3
|
+
"description": "Dig into any bug with full codebase context — zero LLM calls",
|
|
4
|
+
"homepage": "https://github.com/ratishjain12/dug",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"architecture": {
|
|
7
|
+
"64bit": {
|
|
8
|
+
"url": "https://github.com/ratishjain12/dug/releases/download/v0.1.0/dug-windows-amd64.exe",
|
|
9
|
+
"hash": "REPLACE_WITH_SHA256"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"bin": "dug-windows-amd64.exe",
|
|
13
|
+
"checkver": {
|
|
14
|
+
"github": "https://github.com/ratishjain12/dug"
|
|
15
|
+
},
|
|
16
|
+
"autoupdate": {
|
|
17
|
+
"architecture": {
|
|
18
|
+
"64bit": {
|
|
19
|
+
"url": "https://github.com/ratishjain12/dug/releases/download/v$version/dug-windows-amd64.exe"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: write # needed to create GitHub Release and upload assets
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
# -----------------------------------------------------------------------
|
|
13
|
+
# 1. Publish to PyPI
|
|
14
|
+
# -----------------------------------------------------------------------
|
|
15
|
+
pypi:
|
|
16
|
+
name: Publish to PyPI
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v4
|
|
20
|
+
|
|
21
|
+
- uses: astral-sh/setup-uv@v3
|
|
22
|
+
with:
|
|
23
|
+
version: "latest"
|
|
24
|
+
|
|
25
|
+
- name: Build
|
|
26
|
+
run: uv build
|
|
27
|
+
|
|
28
|
+
- name: Publish
|
|
29
|
+
run: uv publish
|
|
30
|
+
env:
|
|
31
|
+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
|
|
32
|
+
|
|
33
|
+
# -----------------------------------------------------------------------
|
|
34
|
+
# 2. Build standalone binaries with PyInstaller
|
|
35
|
+
# -----------------------------------------------------------------------
|
|
36
|
+
binaries:
|
|
37
|
+
name: Build binary — ${{ matrix.target }}
|
|
38
|
+
runs-on: ${{ matrix.os }}
|
|
39
|
+
strategy:
|
|
40
|
+
fail-fast: false
|
|
41
|
+
matrix:
|
|
42
|
+
include:
|
|
43
|
+
- os: macos-14 # Apple Silicon (arm64)
|
|
44
|
+
target: macos-arm64
|
|
45
|
+
bin: dug
|
|
46
|
+
|
|
47
|
+
- os: macos-13 # Intel (amd64)
|
|
48
|
+
target: macos-amd64
|
|
49
|
+
bin: dug
|
|
50
|
+
|
|
51
|
+
- os: ubuntu-latest
|
|
52
|
+
target: linux-amd64
|
|
53
|
+
bin: dug
|
|
54
|
+
|
|
55
|
+
- os: windows-latest
|
|
56
|
+
target: windows-amd64
|
|
57
|
+
bin: dug.exe
|
|
58
|
+
|
|
59
|
+
steps:
|
|
60
|
+
- uses: actions/checkout@v4
|
|
61
|
+
|
|
62
|
+
- uses: astral-sh/setup-uv@v3
|
|
63
|
+
with:
|
|
64
|
+
version: "latest"
|
|
65
|
+
|
|
66
|
+
- name: Install dependencies + PyInstaller
|
|
67
|
+
# Install base deps only (no sentence-transformers/openai/torch)
|
|
68
|
+
run: uv pip install --system -e "." pyinstaller
|
|
69
|
+
|
|
70
|
+
- name: Build binary
|
|
71
|
+
# Exclude heavy ML packages — they auto-install on first use instead
|
|
72
|
+
run: >
|
|
73
|
+
pyinstaller
|
|
74
|
+
--onefile
|
|
75
|
+
--name dug
|
|
76
|
+
--collect-submodules dug
|
|
77
|
+
--hidden-import=dug.__main__
|
|
78
|
+
--exclude-module torch
|
|
79
|
+
--exclude-module transformers
|
|
80
|
+
--exclude-module sentence_transformers
|
|
81
|
+
--exclude-module tokenizers
|
|
82
|
+
--exclude-module scipy
|
|
83
|
+
--exclude-module sklearn
|
|
84
|
+
--exclude-module openai
|
|
85
|
+
src/dug/__main__.py
|
|
86
|
+
|
|
87
|
+
- name: Rename binary with target suffix
|
|
88
|
+
shell: bash
|
|
89
|
+
run: |
|
|
90
|
+
mkdir -p release
|
|
91
|
+
cp dist/${{ matrix.bin }} release/dug-${{ matrix.target }}${{ matrix.os == 'windows-latest' && '.exe' || '' }}
|
|
92
|
+
|
|
93
|
+
- name: Upload binary artifact
|
|
94
|
+
uses: actions/upload-artifact@v4
|
|
95
|
+
with:
|
|
96
|
+
name: binary-${{ matrix.target }}
|
|
97
|
+
path: release/
|
|
98
|
+
|
|
99
|
+
# -----------------------------------------------------------------------
|
|
100
|
+
# 3. Create GitHub Release with all assets
|
|
101
|
+
# -----------------------------------------------------------------------
|
|
102
|
+
release:
|
|
103
|
+
name: Create GitHub Release
|
|
104
|
+
needs: [pypi, binaries]
|
|
105
|
+
runs-on: ubuntu-latest
|
|
106
|
+
steps:
|
|
107
|
+
- uses: actions/checkout@v4
|
|
108
|
+
|
|
109
|
+
- uses: astral-sh/setup-uv@v3
|
|
110
|
+
|
|
111
|
+
- name: Build wheel for release assets
|
|
112
|
+
run: uv build
|
|
113
|
+
|
|
114
|
+
- name: Download all binaries
|
|
115
|
+
uses: actions/download-artifact@v4
|
|
116
|
+
with:
|
|
117
|
+
pattern: binary-*
|
|
118
|
+
merge-multiple: true
|
|
119
|
+
path: release/
|
|
120
|
+
|
|
121
|
+
- name: Show release assets
|
|
122
|
+
run: ls -lh release/ dist/
|
|
123
|
+
|
|
124
|
+
- name: Create GitHub Release
|
|
125
|
+
uses: softprops/action-gh-release@v2
|
|
126
|
+
with:
|
|
127
|
+
name: ${{ github.ref_name }}
|
|
128
|
+
generate_release_notes: true
|
|
129
|
+
files: |
|
|
130
|
+
dist/*.whl
|
|
131
|
+
dist/*.tar.gz
|
|
132
|
+
release/*
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
name: Update Homebrew Formula
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
update-formula:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
steps:
|
|
11
|
+
- name: Get release assets and compute SHA256
|
|
12
|
+
id: hashes
|
|
13
|
+
run: |
|
|
14
|
+
TAG="${{ github.event.release.tag_name }}"
|
|
15
|
+
VERSION="${TAG#v}"
|
|
16
|
+
|
|
17
|
+
ARM64_URL="https://github.com/ratishjain12/dug/releases/download/${TAG}/dug-macos-arm64"
|
|
18
|
+
AMD64_URL="https://github.com/ratishjain12/dug/releases/download/${TAG}/dug-macos-amd64"
|
|
19
|
+
|
|
20
|
+
ARM64_SHA=$(curl -fsSL "$ARM64_URL" | sha256sum | cut -d' ' -f1)
|
|
21
|
+
AMD64_SHA=$(curl -fsSL "$AMD64_URL" | sha256sum | cut -d' ' -f1)
|
|
22
|
+
|
|
23
|
+
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
24
|
+
echo "arm64_sha=$ARM64_SHA" >> $GITHUB_OUTPUT
|
|
25
|
+
echo "amd64_sha=$AMD64_SHA" >> $GITHUB_OUTPUT
|
|
26
|
+
|
|
27
|
+
- name: Checkout homebrew-dug repo
|
|
28
|
+
uses: actions/checkout@v4
|
|
29
|
+
with:
|
|
30
|
+
repository: ratishjain12/homebrew-dug
|
|
31
|
+
token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
|
|
32
|
+
path: homebrew-dug
|
|
33
|
+
|
|
34
|
+
- name: Update formula
|
|
35
|
+
run: |
|
|
36
|
+
cd homebrew-dug
|
|
37
|
+
sed -i "s/version \".*\"/version \"${{ steps.hashes.outputs.version }}\"/" Formula/dug-cli.rb
|
|
38
|
+
sed -i "s/REPLACE_WITH_ARM64_SHA256/${{ steps.hashes.outputs.arm64_sha }}/" Formula/dug-cli.rb
|
|
39
|
+
sed -i "s/REPLACE_WITH_AMD64_SHA256/${{ steps.hashes.outputs.amd64_sha }}/" Formula/dug-cli.rb
|
|
40
|
+
# Also update existing sha256 lines
|
|
41
|
+
sed -i "/on_arm/,/end/{s/sha256 \".*\"/sha256 \"${{ steps.hashes.outputs.arm64_sha }}\"/}" Formula/dug-cli.rb
|
|
42
|
+
sed -i "/on_intel/,/end/{s/sha256 \".*\"/sha256 \"${{ steps.hashes.outputs.amd64_sha }}\"/}" Formula/dug-cli.rb
|
|
43
|
+
|
|
44
|
+
- name: Commit and push
|
|
45
|
+
run: |
|
|
46
|
+
cd homebrew-dug
|
|
47
|
+
git config user.name "ratishjain12"
|
|
48
|
+
git config user.email "ratishjain6@gmail.com"
|
|
49
|
+
git add Formula/dug-cli.rb
|
|
50
|
+
git diff --staged --quiet || git commit -m "Update dug-cli to ${{ github.event.release.tag_name }}"
|
|
51
|
+
git push
|
dug_cli-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Python-generated files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[oc]
|
|
4
|
+
build/
|
|
5
|
+
dist/
|
|
6
|
+
wheels/
|
|
7
|
+
*.egg-info
|
|
8
|
+
|
|
9
|
+
# Virtual environments
|
|
10
|
+
.venv
|
|
11
|
+
|
|
12
|
+
# dug local index — machine-specific, never commit
|
|
13
|
+
.dug/
|
|
14
|
+
|
|
15
|
+
# uv lockfile — not needed for a CLI tool's consumers
|
|
16
|
+
uv.lock
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.12
|
dug_cli-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Ratish Jain
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
dug_cli-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dug-cli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Dig into any bug with full codebase context — zero LLM calls
|
|
5
|
+
Project-URL: Homepage, https://github.com/ratishjain12/dug
|
|
6
|
+
Project-URL: Repository, https://github.com/ratishjain12/dug
|
|
7
|
+
Project-URL: Bug Tracker, https://github.com/ratishjain12/dug/issues
|
|
8
|
+
Author-email: Ratish Jain <ratishjain6@gmail.com>
|
|
9
|
+
License: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: claude,cli,code-search,debugging,developer-tools
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Topic :: Software Development :: Debuggers
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Requires-Dist: click
|
|
23
|
+
Requires-Dist: lancedb
|
|
24
|
+
Requires-Dist: networkx
|
|
25
|
+
Requires-Dist: tree-sitter-java
|
|
26
|
+
Requires-Dist: tree-sitter-javascript
|
|
27
|
+
Requires-Dist: tree-sitter-python
|
|
28
|
+
Requires-Dist: tree-sitter-typescript>=0.23.2
|
|
29
|
+
Requires-Dist: tree-sitter>=0.22
|
|
30
|
+
Requires-Dist: watchdog
|
|
31
|
+
Provides-Extra: all
|
|
32
|
+
Requires-Dist: openai; extra == 'all'
|
|
33
|
+
Requires-Dist: sentence-transformers; extra == 'all'
|
|
34
|
+
Provides-Extra: local
|
|
35
|
+
Requires-Dist: sentence-transformers; extra == 'local'
|
|
36
|
+
Provides-Extra: openai
|
|
37
|
+
Requires-Dist: openai; extra == 'openai'
|
|
38
|
+
Description-Content-Type: text/markdown
|
|
39
|
+
|
|
40
|
+
# dug
|
|
41
|
+
|
|
42
|
+
**Dig into any bug with full codebase context — zero LLM calls.**
|
|
43
|
+
|
|
44
|
+
[](https://pypi.org/project/dug-cli/)
|
|
45
|
+
[](LICENSE)
|
|
46
|
+
[](https://pypi.org/project/dug-cli/)
|
|
47
|
+
|
|
48
|
+
`dug` takes a bug report or stack trace and generates a structured [Claude Code](https://claude.ai/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**.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Install
|
|
53
|
+
|
|
54
|
+
```sh
|
|
55
|
+
# Recommended
|
|
56
|
+
pipx install dug-cli
|
|
57
|
+
|
|
58
|
+
# macOS (Homebrew)
|
|
59
|
+
brew tap ratishjain12/dug
|
|
60
|
+
brew install dug-cli
|
|
61
|
+
|
|
62
|
+
# One-liner (Linux / macOS)
|
|
63
|
+
curl -fsSL https://raw.githubusercontent.com/ratishjain12/dug/main/install.sh | sh
|
|
64
|
+
|
|
65
|
+
# Inside a virtualenv
|
|
66
|
+
pip install dug-cli
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Quick start
|
|
72
|
+
|
|
73
|
+
```sh
|
|
74
|
+
# 1. Run once in your repo root to build the index
|
|
75
|
+
cd /your/project
|
|
76
|
+
dug init
|
|
77
|
+
|
|
78
|
+
# 2. Paste any bug report or stack trace
|
|
79
|
+
dug "NullPointerException in UserService.authenticate at line 42"
|
|
80
|
+
|
|
81
|
+
# dug prints a ready-to-paste Claude Code prompt with ranked file context
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
**Sample output:**
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
You are a senior engineer debugging this issue:
|
|
88
|
+
|
|
89
|
+
NullPointerException in UserService.authenticate at line 42
|
|
90
|
+
|
|
91
|
+
Relevant files (ranked by relevance):
|
|
92
|
+
|
|
93
|
+
1. src/auth/UserService.java:35
|
|
94
|
+
authenticate() — modified 2 commits ago
|
|
95
|
+
...
|
|
96
|
+
|
|
97
|
+
2. src/config/AppConfig.java:12
|
|
98
|
+
loadConfig() — error pattern match
|
|
99
|
+
...
|
|
100
|
+
|
|
101
|
+
[full function bodies + graph context follow]
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## How it works
|
|
107
|
+
|
|
108
|
+
`dug` builds a **local knowledge base** the first time you run `dug init`:
|
|
109
|
+
|
|
110
|
+
| Layer | What it builds | Used for |
|
|
111
|
+
|---|---|---|
|
|
112
|
+
| Structural graph | File → Symbol → Commit nodes (networkx) | Import chains, recent changes |
|
|
113
|
+
| Semantic index | Function embeddings in LanceDB (sentence-transformers) | Meaning-level matches |
|
|
114
|
+
| History log | Past bug→fix pairs | Learning from outcomes |
|
|
115
|
+
|
|
116
|
+
At query time, three signals are combined into a ranked list:
|
|
117
|
+
|
|
118
|
+
- **Structural score** — imports your error file, was modified in a related commit
|
|
119
|
+
- **Semantic score** — cosine similarity between bug text and function bodies
|
|
120
|
+
- **History boost** — similar past bugs pointed here
|
|
121
|
+
|
|
122
|
+
The index stays fresh via git hooks (`post-commit`, `post-checkout`) and an optional file watcher.
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Commands
|
|
127
|
+
|
|
128
|
+
| Command | What it does |
|
|
129
|
+
|---|---|
|
|
130
|
+
| `dug init` | Index the current repo (builds graph + embeddings) |
|
|
131
|
+
| `dug "error text"` | Generate a Claude Code prompt for the bug |
|
|
132
|
+
| `dug update` | Re-index files changed since last commit |
|
|
133
|
+
| `dug watch` | Watch for file saves and re-index in real time |
|
|
134
|
+
| `dug stats` | Show index size (nodes, edges, chunks) |
|
|
135
|
+
| `dug config` | View / edit configuration |
|
|
136
|
+
| `dug feedback good` | Mark last query as helpful (improves future results) |
|
|
137
|
+
| `dug feedback bad` | Mark last query as unhelpful |
|
|
138
|
+
|
|
139
|
+
### Options
|
|
140
|
+
|
|
141
|
+
```sh
|
|
142
|
+
dug init --local # Use local embeddings (default, no API key needed)
|
|
143
|
+
dug init --openai # Use OpenAI text-embedding-3-small (needs OPENAI_API_KEY)
|
|
144
|
+
dug "error" --files 3 # Limit to top 3 files in prompt
|
|
145
|
+
dug "error" --no-history # Skip learning loop context
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## Configuration
|
|
151
|
+
|
|
152
|
+
`dug init` creates `.dug/config.json` in the repo root. You can also edit it with `dug config set <key> <value>`.
|
|
153
|
+
|
|
154
|
+
```json
|
|
155
|
+
{
|
|
156
|
+
"embedding_mode": "local",
|
|
157
|
+
"languages": ["python", "java", "typescript", "javascript"],
|
|
158
|
+
"max_files_in_prompt": 5,
|
|
159
|
+
"git_history_depth": 50,
|
|
160
|
+
"exclude_test_files": true
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
`.dug/` is automatically added to `.gitignore` — it's machine-specific and never committed.
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## Contributing
|
|
169
|
+
|
|
170
|
+
```sh
|
|
171
|
+
git clone https://github.com/ratishjain12/dug
|
|
172
|
+
cd dug
|
|
173
|
+
uv sync
|
|
174
|
+
uv run dug init # index the dug repo itself
|
|
175
|
+
uv run dug "your bug here"
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Requires Python 3.10+ and [uv](https://docs.astral.sh/uv/).
|
dug_cli-0.1.0/README.md
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# dug
|
|
2
|
+
|
|
3
|
+
**Dig into any bug with full codebase context — zero LLM calls.**
|
|
4
|
+
|
|
5
|
+
[](https://pypi.org/project/dug-cli/)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
[](https://pypi.org/project/dug-cli/)
|
|
8
|
+
|
|
9
|
+
`dug` takes a bug report or stack trace and generates a structured [Claude Code](https://claude.ai/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**.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```sh
|
|
16
|
+
# Recommended
|
|
17
|
+
pipx install dug-cli
|
|
18
|
+
|
|
19
|
+
# macOS (Homebrew)
|
|
20
|
+
brew tap ratishjain12/dug
|
|
21
|
+
brew install dug-cli
|
|
22
|
+
|
|
23
|
+
# One-liner (Linux / macOS)
|
|
24
|
+
curl -fsSL https://raw.githubusercontent.com/ratishjain12/dug/main/install.sh | sh
|
|
25
|
+
|
|
26
|
+
# Inside a virtualenv
|
|
27
|
+
pip install dug-cli
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Quick start
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
# 1. Run once in your repo root to build the index
|
|
36
|
+
cd /your/project
|
|
37
|
+
dug init
|
|
38
|
+
|
|
39
|
+
# 2. Paste any bug report or stack trace
|
|
40
|
+
dug "NullPointerException in UserService.authenticate at line 42"
|
|
41
|
+
|
|
42
|
+
# dug prints a ready-to-paste Claude Code prompt with ranked file context
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
**Sample output:**
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
You are a senior engineer debugging this issue:
|
|
49
|
+
|
|
50
|
+
NullPointerException in UserService.authenticate at line 42
|
|
51
|
+
|
|
52
|
+
Relevant files (ranked by relevance):
|
|
53
|
+
|
|
54
|
+
1. src/auth/UserService.java:35
|
|
55
|
+
authenticate() — modified 2 commits ago
|
|
56
|
+
...
|
|
57
|
+
|
|
58
|
+
2. src/config/AppConfig.java:12
|
|
59
|
+
loadConfig() — error pattern match
|
|
60
|
+
...
|
|
61
|
+
|
|
62
|
+
[full function bodies + graph context follow]
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## How it works
|
|
68
|
+
|
|
69
|
+
`dug` builds a **local knowledge base** the first time you run `dug init`:
|
|
70
|
+
|
|
71
|
+
| Layer | What it builds | Used for |
|
|
72
|
+
|---|---|---|
|
|
73
|
+
| Structural graph | File → Symbol → Commit nodes (networkx) | Import chains, recent changes |
|
|
74
|
+
| Semantic index | Function embeddings in LanceDB (sentence-transformers) | Meaning-level matches |
|
|
75
|
+
| History log | Past bug→fix pairs | Learning from outcomes |
|
|
76
|
+
|
|
77
|
+
At query time, three signals are combined into a ranked list:
|
|
78
|
+
|
|
79
|
+
- **Structural score** — imports your error file, was modified in a related commit
|
|
80
|
+
- **Semantic score** — cosine similarity between bug text and function bodies
|
|
81
|
+
- **History boost** — similar past bugs pointed here
|
|
82
|
+
|
|
83
|
+
The index stays fresh via git hooks (`post-commit`, `post-checkout`) and an optional file watcher.
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Commands
|
|
88
|
+
|
|
89
|
+
| Command | What it does |
|
|
90
|
+
|---|---|
|
|
91
|
+
| `dug init` | Index the current repo (builds graph + embeddings) |
|
|
92
|
+
| `dug "error text"` | Generate a Claude Code prompt for the bug |
|
|
93
|
+
| `dug update` | Re-index files changed since last commit |
|
|
94
|
+
| `dug watch` | Watch for file saves and re-index in real time |
|
|
95
|
+
| `dug stats` | Show index size (nodes, edges, chunks) |
|
|
96
|
+
| `dug config` | View / edit configuration |
|
|
97
|
+
| `dug feedback good` | Mark last query as helpful (improves future results) |
|
|
98
|
+
| `dug feedback bad` | Mark last query as unhelpful |
|
|
99
|
+
|
|
100
|
+
### Options
|
|
101
|
+
|
|
102
|
+
```sh
|
|
103
|
+
dug init --local # Use local embeddings (default, no API key needed)
|
|
104
|
+
dug init --openai # Use OpenAI text-embedding-3-small (needs OPENAI_API_KEY)
|
|
105
|
+
dug "error" --files 3 # Limit to top 3 files in prompt
|
|
106
|
+
dug "error" --no-history # Skip learning loop context
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Configuration
|
|
112
|
+
|
|
113
|
+
`dug init` creates `.dug/config.json` in the repo root. You can also edit it with `dug config set <key> <value>`.
|
|
114
|
+
|
|
115
|
+
```json
|
|
116
|
+
{
|
|
117
|
+
"embedding_mode": "local",
|
|
118
|
+
"languages": ["python", "java", "typescript", "javascript"],
|
|
119
|
+
"max_files_in_prompt": 5,
|
|
120
|
+
"git_history_depth": 50,
|
|
121
|
+
"exclude_test_files": true
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
`.dug/` is automatically added to `.gitignore` — it's machine-specific and never committed.
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## Contributing
|
|
130
|
+
|
|
131
|
+
```sh
|
|
132
|
+
git clone https://github.com/ratishjain12/dug
|
|
133
|
+
cd dug
|
|
134
|
+
uv sync
|
|
135
|
+
uv run dug init # index the dug repo itself
|
|
136
|
+
uv run dug "your bug here"
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Requires Python 3.10+ and [uv](https://docs.astral.sh/uv/).
|