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.
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::{
35 ScalarKind, ValueType, coerce_toward, coerce_values_toward, guard_bare_overwrite, scalar_kind,
36 value_from_type, value_matches_type,
37};
38pub use error::{DocumentError, DocumentResult};
39pub use file::{Document, DocumentFile};
40pub use keyed::{KeyedList, add_keyed, remove_keyed};
41pub use path::{join_path, parse_path};
42pub use traverse::{get_path, get_path_ref, set_path, unset_path};
43pub use typed::{from_value, to_value};
44pub use value::Value;
45
46pub use format::Format;
47
48#[cfg(feature = "schema")]
49pub use schema::{
50 CliSchema, FieldDef, render_annotated_toml, render_annotated_yaml, render_doc_markdown,
51};