Skip to content

Conversation

@prosdev
Copy link
Collaborator

@prosdev prosdev commented Nov 27, 2025

Summary

Adds the foundational types and infrastructure for Git history integration as part of Epic #90 (Intelligent Git History v0.4.0).

Changes

New Types (packages/core/src/git/types.ts)

  • GitCommit - Complete commit information with author, committer, files, stats, refs
  • GitFileChange - File change details (path, status, additions, deletions)
  • GitPerson - Author/committer information
  • GitRefs - Extracted issue/PR references from commit messages
  • GitBlame / GitBlameLine - Line-level blame information
  • ContributorStats - Contributor statistics (for future use)
  • GitRepositoryInfo - Repository metadata

GitExtractor Interface (packages/core/src/git/extractor.ts)

  • Abstract GitExtractor interface for future pluggability (GitHub API, etc.)
  • LocalGitExtractor implementation that shells out to git commands
  • Supports:
    • getCommits(options) - Fetch commits with filtering (limit, since, until, author, path)
    • getCommit(hash) - Get single commit by hash
    • getBlame(file, options) - Line-level blame information
    • getRepositoryInfo() - Repository metadata
  • Automatic extraction of issue (feat(core): implement incremental indexing #123) and PR (PR #456) references from commit messages
  • Parses --numstat output for accurate file change statistics

Tests

  • 19 comprehensive unit tests covering:
    • Commit fetching and parsing
    • Author/committer information
    • File change tracking
    • Issue/PR reference extraction
    • Empty repository handling
    • Blame functionality
    • Repository info detection

Design Decisions

  1. Extensible Interface: GitExtractor is an interface to allow future swapping of local git for GitHub API
  2. Rich Metadata: Types include fields for future features (cross-repo, contributor stats)
  3. Robust Parsing: Uses custom markers for reliable multi-line commit message parsing
  4. Reference Extraction: Automatically identifies issue/PR refs for future linking

Closes

Closes #91

Part of

Epic: Intelligent Git History (v0.4.0) #90

- Add GitCommit, GitFileChange, GitBlame, ContributorStats types
- Implement LocalGitExtractor for shelling out to git commands
- Support getCommits, getCommit, getBlame, getRepositoryInfo
- Extract issue/PR references from commit messages
- Parse numstat for file change details
- Add 19 comprehensive unit tests

Part of Epic: Intelligent Git History (v0.4.0) #90
@prosdev prosdev merged commit 813f37e into main Nov 27, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Git types and extractor infrastructure

1 participant