Expand description
Format-independent document values (dot-path access, typed coercion, and pluggable JSON/TOML/YAML/dotenv/INI backends). Format-independent document values: dot-path get/set/add/remove, type-directed CLI-string coercion, keyed-list (slug-addressed array) helpers, and typed serde adapters, backed by pluggable JSON/TOML/YAML/dotenv/INI format readers and writers.
§Features
JSON support is always compiled in — agent_first_data already depends on
serde_json as a core dependency.
- toml: Enable TOML format support (format-preserving with toml_edit)
- yaml: Enable YAML format support with CST-backed source-preserving mutation
- dotenv: Enable source-preserving dotenv format support
- ini: Enable INI Core v1 format support
- schema: Enable the
CliSchematrait and documentation rendering
This module never redacts values on decode/encode/save — it returns and saves raw values as-is; redaction is the caller’s responsibility.
Re-exports§
pub use coerce::ScalarKind;pub use coerce::ValueType;pub use coerce::coerce_toward;pub use coerce::coerce_values_toward;pub use coerce::guard_bare_overwrite;pub use coerce::scalar_kind;pub use coerce::value_from_type;pub use coerce::value_matches_type;pub use error::DocumentError;pub use error::DocumentResult;pub use file::Document;pub use file::DocumentFile;pub use keyed::KeyedList;pub use keyed::add_keyed;pub use keyed::remove_keyed;pub use path::join_path;pub use path::parse_path;pub use traverse::get_path;pub use traverse::get_path_ref;pub use traverse::set_path;pub use traverse::unset_path;pub use typed::from_value;pub use typed::to_value;pub use value::Value;pub use format::Format;
Modules§
- coerce
- CLI-facing value construction for
set/add(cli-shell-config-todo.md§3, which supersedes the earliercli-design-review-todo.mdD3): a bare VALUE/FIELD=VALUE is alwaysValue::Stringwith zero coercion — no shape-guessing, no type prefixes. An exact type is requested explicitly viaValueType(set’s--value-typeflag);guard_bare_overwriteimplements the “异型覆盖守卫” (heterogeneous-overwrite guard) that turns a bare VALUE silently changing an existing scalar’s type into an argument error instead. - error
- Error types with context and helpful hints.
- file
- Format-neutral document editing: an in-memory
Documentwith source-preserving edits, and aDocumentFilethat adds the file boundary. - format
- Format detection and backend selection.
- keyed
- KeyedList operations for slug-based array access.
- path
- The single path grammar used by every traversal operation.
- traverse
- Core dot-path traversal for get/set operations.
- typed
- Fallible serde adapters over the format-independent
ValueIR. - value
- Custom Value type — zero external format dependencies.