rusty_commit_saver/lib.rs
1#![cfg_attr(coverage_nightly, feature(coverage_attribute))]
2//! # Rusty Commit Saver
3//!
4//! A Rust tool to automatically log Git commits into Obsidian diary entries.
5//!
6//! ## Overview
7//!
8//! Rusty Commit Saver captures each commit's metadata and appends it to a dated
9//! diary entry in your Obsidian vault. Each entry includes:
10//!
11//! - Timestamp
12//! - Commit message
13//! - Repository URL
14//! - Branch name
15//! - Commit hash
16//!
17//! ## Quick Start
18//!
19//! ```ignore
20//! use rusty_commit_saver::{run_commit_saver, config::GlobalVars};
21//! use std::path::PathBuf;
22//!
23//! // Initialize configuration
24//! let global_vars = GlobalVars::new();
25//! global_vars.set_all();
26//!
27//! // Get configuration values
28//! let obsidian_root = global_vars.get_obsidian_root_path_dir();
29//! let commit_path = global_vars.get_obsidian_commit_path();
30//! let date_template = global_vars.get_template_commit_date_path();
31//! let time_template = global_vars.get_template_commit_datetime();
32//! let excluded_repos = global_vars.get_excluded_repos();
33//!
34//! // Save the commit (skips cleanly if this repo is excluded)
35//! run_commit_saver(obsidian_root, &commit_path, &date_template, &time_template, &excluded_repos).unwrap();
36//! ```
37//!
38//! ## Configuration
39//!
40//! Configuration is stored in an INI file at:
41//! `~/.config/rusty-commit-saver/rusty-commit-saver.ini`
42//!
43//! Example configuration:
44//!
45//! ```text
46//! [obsidian]
47//! root_path_dir = ~/Documents/Obsidian
48//! commit_path = Diaries/Commits
49//!
50//! [templates]
51//! commit_date_path = %Y/%m-%B/%F.md
52//! commit_datetime = %Y-%m-%d %H:%M:%S
53//!
54//! # Optional: repos to skip (comma-separated working-directory names)
55//! [exclude]
56//! repos = claude-src
57//! ```
58//!
59//! ## Modules
60//!
61//! - [`vim_commit`] - Core commit processing and diary file operations
62//! - [`config`] - Configuration management and INI file parsing
63//!
64//! ## Features
65//!
66//! - ✅ Automatic diary entry creation with YAML frontmatter
67//! - ✅ Timestamped commit rows formatted for Obsidian
68//! - ✅ Customizable storage path with date-based organization
69//! - ✅ Pipe escaping in commit messages for Markdown table safety
70//! - ✅ Thread-safe configuration with `OnceCell`
71pub mod config;
72pub mod vim_commit;