git_indexer/
lib.rs

1//! Git repository indexer for Helix DB graph database.
2//!
3//! This crate provides functionality to extract information from git repositories
4//! and index it into a Helix DB graph database instance.
5//!
6//! # Features
7//!
8//! - Extract branches, commits, and file changes from git repositories
9//! - Generate diffs for file changes
10//! - Push git data to Helix DB as nodes and edges
11//!
12//! # Quick Start
13//!
14//! ## Standalone Extraction
15//!
16//! Extract git information without pushing to Helix DB:
17//!
18//! ```no_run
19//! use git_indexer::extraction::extract;
20//! use std::path::Path;
21//!
22//! let git_info = extract(Path::new("/path/to/repo")).unwrap();
23//!
24//! println!("Branches: {}", git_info.branches.len());
25//! println!("Commits: {}", git_info.commits.len());
26//!
27//! for commit in &git_info.commits {
28//!     println!("{}: {}", &commit.id[..8], commit.message);
29//! }
30//! ```
31//!
32//! ## Helix DB Integration
33//!
34//! Index a repository into a Helix DB instance:
35//!
36//! ```no_run
37//! use git_indexer::GitIndexerClient;
38//!
39//! # async fn example() -> git_indexer::Result<()> {
40//! let client = GitIndexerClient::builder()
41//!     .endpoint("http://localhost:6969")
42//!     .build()?;
43//!
44//! // Extract and push to Helix DB
45//! let git_info = client.index_repository("/path/to/repo").await?;
46//! # Ok(())
47//! # }
48//! ```
49//!
50//! # Data Model
51//!
52//! The crate extracts the following git objects:
53//!
54//! - **Branches** ([`BranchInfo`]): Local and remote branch references
55//! - **Commits** ([`CommitInfo`]): Commit metadata with parent relationships
56//! - **File Changes** ([`FileChange`]): Files modified in each commit with diffs
57//! - **Diff Hunks** ([`DiffHunk`]): Individual change blocks within files
58//!
59//! # Helix DB Graph Structure
60//!
61//! When indexed to Helix DB, the data is stored as:
62//!
63//! **Nodes:**
64//! - `Branch` - Branch metadata
65//! - `Commit` - Commit metadata
66//! - `FileChange` - File modification with diff
67//!
68//! **Edges:**
69//! - `Commit -> Commit` (parent relationship)
70//! - `Branch -> Commit` (branch tip)
71//! - `Commit -> FileChange` (files changed in commit)
72
73pub mod client;
74pub mod error;
75pub mod extraction;
76pub mod models;
77
78// Re-export main types for convenience
79pub use client::{GitIndexerClient, GitIndexerClientBuilder};
80pub use error::{Error, Result};
81pub use models::{BranchInfo, ChangeType, CommitInfo, DiffHunk, FileChange, GitInfo};