agent-first-data 0.41.0

Self-describing data and structured CLI contracts for AI agents — field-name suffixes for units and secrets, the afdata CLI for rendering, validation, path guards, and reading or editing structured documents (JSON, TOML, YAML, dotenv, INI, Markdown), plus libraries for Rust, Go, Python, TypeScript, and Bash.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//! Closed-reader probe: write a large raw payload to the process stdout, then
//! finish with an `error` event and the intended exit code 3.
//!
//! `tests/closed_reader_e2e.sh` pipes this into `head -c 10` and expects exit 0:
//! a reader that stopped reading is not a failure of the command.

use agent_first_data::{CliEmitter, OutputFormat, OutputTo, build_cli_error};
use std::process::ExitCode;

fn main() -> ExitCode {
    let mut emitter = CliEmitter::from_output_to(OutputTo::Split, OutputFormat::Json);
    let _ = emitter.write_raw(&vec![b'x'; 2 * 1024 * 1024]);
    ExitCode::from(emitter.finish(build_cli_error("intended failure", None), 3))
}