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. Ported from the standalone `agent-first-config` crate.
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//! - **schema**: Enable the `CliSchema` trait and documentation rendering
16//!
17//! This module never redacts values on decode/encode/save — it returns and
18//! saves raw values as-is; redaction is the caller's responsibility.
19
20pub mod coerce;
21pub mod error;
22pub mod file;
23pub mod keyed;
24pub mod path;
25pub mod traverse;
26pub mod typed;
27pub mod value;
28
29pub mod format;
30
31#[cfg(feature = "schema")]
32pub mod schema;
33
34pub use coerce::{coerce_scalar, coerce_scalar_typed, coerce_values, coerce_values_typed};
35pub use error::{DocumentError, DocumentResult};
36pub use file::{Document, DocumentFile};
37pub use keyed::{KeyedList, add_keyed, remove_keyed};
38pub use path::{join_path, parse_path};
39pub use traverse::{get_path, get_path_ref, set_path, unset_path};
40pub use typed::{from_value, to_value};
41pub use value::Value;
42
43pub use format::Format;
44
45#[cfg(feature = "schema")]
46pub use schema::{
47    CliSchema, FieldDef, render_annotated_toml, render_annotated_yaml, render_doc_markdown,
48};