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//!
13//! # Example
14//!
15//! ```
16//! use standard_commit::{parse, format, lint, LintConfig};
17//!
18//! let commit = parse("feat(auth): add OAuth2 PKCE flow").unwrap();
19//! assert_eq!(commit.r#type, "feat");
20//! assert_eq!(commit.scope.as_deref(), Some("auth"));
21//!
22//! // Round-trip: format back to string
23//! assert_eq!(format(&commit), "feat(auth): add OAuth2 PKCE flow");
24//!
25//! // Lint with default rules
26//! let errors = lint("feat: add login", &LintConfig::default());
27//! assert!(errors.is_empty());
28//! ```
29
30mod format;
31mod lint;
32mod parse;
33
34pub use format::format;
35pub use lint::{LintConfig, LintError, lint};
36pub use parse::{ConventionalCommit, Footer, ParseError, parse};