Skip to main content

agent_first_data/document/
mod.rs

1//! Format-independent document values: dot-path get/set/add/remove, type-directed
2//! CLI-string coercion, keyed-list (slug-addressed array) helpers, and typed
3//! serde adapters, backed by pluggable JSON/TOML/YAML/dotenv/INI format readers
4//! and writers, plus a read-only CommonMark block reader.
5//!
6//! # Features
7//!
8//! JSON support is always compiled in — `agent_first_data` already depends on
9//! `serde_json` as a core dependency.
10//!
11//! - **toml**: Enable TOML format support (format-preserving with toml_edit)
12//! - **yaml**: Enable YAML format support with CST-backed source-preserving mutation
13//! - **dotenv**: Enable source-preserving dotenv format support
14//! - **ini**: Enable INI Core v1 format support
15//! - **markdown**: Enable the read-only CommonMark block reader
16//! - **schema**: Enable the `CliSchema` trait and documentation rendering
17//!
18//! This module never redacts values on decode/encode/save — it returns and
19//! saves raw values as-is; redaction is the caller's responsibility.
20
21pub mod coerce;
22pub mod error;
23pub mod file;
24pub mod keyed;
25pub mod path;
26pub mod traverse;
27pub mod typed;
28pub mod value;
29
30pub mod format;
31
32#[cfg(feature = "schema")]
33pub mod schema;
34
35pub use coerce::{
36    BareOverwrite, ScalarKind, ValueType, coerce_toward, coerce_values_toward,
37    guard_bare_overwrite, scalar_kind, value_from_type, value_matches_type,
38};
39pub use error::{DocumentError, DocumentResult};
40pub use file::{Document, DocumentFile};
41pub use keyed::{Addressing, ArrayRule, KeyedList, MatchKind, add_keyed, remove_keyed};
42pub use path::{PatternSegment, join_path, parse_path, parse_path_pattern};
43pub(crate) use traverse::keyed_prefix_matches;
44pub use traverse::{get_path, get_path_ref, resolve_path, set_path, unset_path};
45pub use typed::{from_value, to_value};
46pub use value::Value;
47
48pub use format::Format;
49
50#[cfg(feature = "schema")]
51pub use schema::{
52    CliSchema, FieldDef, render_annotated_toml, render_annotated_yaml, render_doc_markdown,
53};