1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
//! # adrs-core
//!
//! The engine behind the [`adrs`] command-line tool: a standalone library for
//! creating, reading, linking, validating, and exporting Architecture Decision
//! Records (ADRs).
//!
//! Depend on `adrs-core` directly when you want to manage ADRs from your own
//! program -- a build tool, an editor integration, or an AI agent -- instead of
//! shelling out to the CLI. The CLI is a thin layer over this crate, so anything
//! `adrs` does is available here as a normal Rust API.
//!
//! [`adrs`]: https://crates.io/crates/adrs
//!
//! ## Key types
//!
//! - [`Repository`] -- the main entry point. Open or initialize a directory of
//! ADRs, then [`list`](Repository::list), [`new_adr`](Repository::new_adr),
//! [`link`](Repository::link), [`supersede`](Repository::supersede), and
//! [`set_status`](Repository::set_status).
//! - [`Adr`] -- a single decision record: number, title, [`AdrStatus`], body
//! sections, [`AdrLink`]s, tags, and MADR metadata (deciders, consulted,
//! informed).
//! - [`AdrStatus`] and [`LinkKind`] -- typed status values and link
//! relationships (e.g. `Supersedes` / `SupersededBy`).
//! - [`Config`] and [`discover`] -- repository configuration and upward
//! directory discovery (find the ADR directory from a nested path).
//! - [`Parser`] -- parse an ADR from markdown, in either legacy (adr-tools) or
//! YAML-frontmatter form.
//! - The [`export`] module -- convert ADRs to and from the **JSON-ADR**
//! interchange format, handy for feeding a decision log to other tools or to
//! an AI agent that reasons over it.
//! - The [`lint`] module -- repository health checks via [`check_all`]:
//! broken links, duplicate numbers, numbering gaps, and missing fields.
//! - [`Error`] and [`Result`] -- the library's error type, built on `thiserror`.
//!
//! ## Modes
//!
//! ADRs can be stored in two on-disk formats:
//!
//! - **Compatible mode** (default): markdown-only, interoperable with
//! [adr-tools]. Reads both legacy and next-gen files; writes legacy.
//! - **Next-gen mode**: YAML frontmatter for structured metadata, enabling
//! richer features like typed links, tags, and stronger validation.
//!
//! The mode is chosen at [`Repository::init`] time (the `ng` argument) or via
//! [`Config`], and the parser transparently reads either format.
//!
//! [adr-tools]: https://github.com/npryce/adr-tools
//!
//! ## Quick start
//!
//! ```
//! use adrs_core::Repository;
//!
//! # fn main() -> adrs_core::Result<()> {
//! # let tmp = tempfile::tempdir().unwrap();
//! // Initialize a repository (compatible mode).
//! let repo = Repository::init(tmp.path(), None, false)?;
//!
//! // Create a decision record.
//! let (adr, _path) = repo.new_adr("Use PostgreSQL for persistence")?;
//! assert_eq!(adr.title, "Use PostgreSQL for persistence");
//!
//! // List all ADRs (`init` seeds the first one).
//! let all = repo.list()?;
//! assert!(all.len() >= 2);
//! # Ok(())
//! # }
//! ```
//!
//! ## Exporting to JSON-ADR
//!
//! [`export_repository`] converts an open [`Repository`] to the JSON-ADR format.
//! For a plain directory that isn't an initialized adrs repository, use
//! [`export_directory`] (or [`export_directory_with_warnings`] to also receive a
//! message for every file that failed to parse, rather than skipping silently).
//!
//! ## More examples
//!
//! The [`examples`](https://github.com/joshrotenberg/adrs/tree/main/crates/adrs-core/examples)
//! directory has runnable programs: `create_and_list`, `link_adrs`,
//! `export_json`, and `lint_repository`.
pub use ;
pub use ;
pub use ;
pub use ;
pub use Parser;
pub use Repository;
pub use ;
pub use ;
// Legacy doctor module - deprecated, use lint module instead
pub use ;