standard_commit/lib.rs
1//! Conventional commit parsing, validation, and formatting.
2//!
3//! Implements the [Conventional Commits](https://www.conventionalcommits.org/)
4//! specification as a pure library — no I/O, no git operations, no terminal
5//! output.
6//!
7//! # Main entry points
8//!
9//! - [`parse`] — parse a commit message into a [`ConventionalCommit`]
10//! - [`lint`] — validate a message against a [`LintConfig`]
11//! - [`format`] — render a [`ConventionalCommit`] back to a well-formed string
12//! - [`is_process_commit`] — detect automatically generated commits (merges,
13//! reverts, fixups) that should be skipped during validation
14//!
15//! # Example
16//!
17//! ```
18//! use standard_commit::{parse, format, lint, LintConfig, is_process_commit};
19//!
20//! let commit = parse("feat(auth): add OAuth2 PKCE flow").unwrap();
21//! assert_eq!(commit.r#type, "feat");
22//! assert_eq!(commit.scope.as_deref(), Some("auth"));
23//!
24//! // Round-trip: format back to string
25//! assert_eq!(format(&commit), "feat(auth): add OAuth2 PKCE flow");
26//!
27//! // Lint with default rules
28//! let errors = lint("feat: add login", &LintConfig::default());
29//! assert!(errors.is_empty());
30//!
31//! // Process commit detection
32//! assert!(is_process_commit("Merge pull request #42 from owner/branch"));
33//! assert!(!is_process_commit("feat: add login"));
34//! ```
35
36mod format;
37mod lint;
38mod parse;
39mod process;
40
41pub use format::format;
42pub use lint::{LintConfig, LintError, lint};
43pub use parse::{ConventionalCommit, Footer, ParseError, parse};
44pub use process::is_process_commit;