๐ Git Unearth โ
AI-powered git blame enhancer โ understand WHY code was written, not just WHO wrote it.
Quick Links โ
- Installation โ Get started in minutes
- Quick Start โ See it in action
- API Reference โ Programmatic usage
- Skill Commands โ Interactive unearth
The Problem โ
Traditional git blame tells you who and when, but not why:
src/index.ts:42 alice 2024-06-15 abc123Questions it can't answer:
- Why does this code exist?
- What business requirement drove it?
- Is this intentional or a workaround?
- How did it evolve over time?
The Solution โ
Git Unearth traces decision history through three layers:
| Layer | Capability | Output |
|---|---|---|
| Data Collection | Parse git commands into structured data | CommitInfo, FileBlame, FileDiff |
| Semantic Analysis | Group commits, classify intent | Commit groups, decision points |
| Narrative Generation | Explain with evidence chains | Confidence: ๐ข High / ๐ก Medium / ๐ด Low |
Key Features โ
๐ Git Data Collection โ
Structured parsing with zero configuration:
- Line-level blame โ
collectBlame()with commit metadata - Commit history โ
collectLog()with RS/US delimiter parsing - Unified diffs โ
collectDiff()/collectDiffBetween() - Rename tracking โ
collectFollow()for file evolution - Full commit detail โ
collectCommitDetail()in one call
๐พ Three-Tier Caching โ
Session โ Filesystem โ None. Eliminate redundant git operations.
๐ง Semantic Analysis โ
- Commit grouping by merge/PR/time window
- Intent classification: feat/fix/refactor/perf/workaround
- Decision timeline construction
๐ Interactive Commands โ
In Claude Code, use natural language unearth:
| Command | Purpose |
|---|---|
/why <file:line> | Why was this code written? |
/history <path> | Evolution timeline |
/context <hash> | Related changes network |
/decisions | Architecture Decision Records |
Confidence Levels โ
| Level | Source | Meaning |
|---|---|---|
| ๐ข High | PR/Issue documentation | Verified business requirement |
| ๐ก Medium | Clear commit message | Explicit intent in commit |
| ๐ด Low | AI inference only | Pattern-based reasoning |
Example Output โ
/why src/utils/format.ts:32
๐ Analyzing formatDuration()...
๐ Reason Trace:
1. [2024-06-10] Add formatDuration helper (def456)
โ Shared time formatting across reporters
2. [2024-06-05] PR #42 โ Issue #18
โ User reported unfriendly time display
๐ก Conclusion: Utility function for consistent time display (๐ข High confidence)
๐ญ Follow up:
- /history src/utils/format.ts
- /context def456Comparison โ
| Dimension | git blame | Git Unearth |
|---|---|---|
| Output | author date code | Structured CommitInfo + evidence chain |
| Why? | โ No | โ Trace PR/Issue/business context |
| Grouping | โ No | โ Commit groups, decision points |
| Confidence | โ No | โ ๐ข๐ก๐ด levels |
| Caching | โ No | โ Three-tier cache |
| API | โ No | โ TypeScript/Node.js API |
Get Started โ
Choose your path:
1. Claude Code Plugin (Recommended) โ
bash
# Plugin marketplace
/plugin marketplace add saqqdy/git-unearth
/plugin install git-unearth2. NPM Package โ
bash
pnpm add git-unearth3. CLI (Zero-Install) โ
bash
npx git-unearth blame src/index.ts
npx git-unearth log --max-count 54. Clone & Explore โ
bash
git clone https://github.com/saqqdy/git-unearth.git
cd git-unearth
pnpm install
npx tsx examples/basic-usage.tsProject Status โ
| Version | Theme | Status |
|---|---|---|
| v0.1.0 | Data collection layer | โ Released |
| v0.2.0 | Analysis engine | ๐ Planned |
| v0.3.0 | Decision timeline + ADR | ๐ Planned |
| v1.0.0 | Production-ready | ๐ Planned |
See Roadmap for details.
License โ
MIT โ use freely in personal and commercial projects.