Skip to content

๐Ÿ” Git Unearth โ€‹

AI-powered git blame enhancer โ€” understand WHY code was written, not just WHO wrote it.

npm versionlicense

The Problem โ€‹

Traditional git blame tells you who and when, but not why:

src/index.ts:42  alice  2024-06-15  abc123

Questions 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:

LayerCapabilityOutput
Data CollectionParse git commands into structured dataCommitInfo, FileBlame, FileDiff
Semantic AnalysisGroup commits, classify intentCommit groups, decision points
Narrative GenerationExplain with evidence chainsConfidence: ๐ŸŸข 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:

CommandPurpose
/why <file:line>Why was this code written?
/history <path>Evolution timeline
/context <hash>Related changes network
/decisionsArchitecture Decision Records

Confidence Levels โ€‹

LevelSourceMeaning
๐ŸŸข HighPR/Issue documentationVerified business requirement
๐ŸŸก MediumClear commit messageExplicit intent in commit
๐Ÿ”ด LowAI inference onlyPattern-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 def456

Comparison โ€‹

Dimensiongit blameGit Unearth
Outputauthor date codeStructured 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:

bash
# Plugin marketplace
/plugin marketplace add saqqdy/git-unearth
/plugin install git-unearth

2. NPM Package โ€‹

bash
pnpm add git-unearth

3. CLI (Zero-Install) โ€‹

bash
npx git-unearth blame src/index.ts
npx git-unearth log --max-count 5

4. Clone & Explore โ€‹

bash
git clone https://github.com/saqqdy/git-unearth.git
cd git-unearth
pnpm install
npx tsx examples/basic-usage.ts

Project Status โ€‹

VersionThemeStatus
v0.1.0Data collection layerโœ… Released
v0.2.0Analysis engine๐Ÿ“‹ Planned
v0.3.0Decision timeline + ADR๐Ÿ“‹ Planned
v1.0.0Production-ready๐Ÿ“‹ Planned

See Roadmap for details.

License โ€‹

MIT โ€” use freely in personal and commercial projects.

MIT License