Expand description
Agent-First Data (AFDATA) output formatting and protocol templates.
Public APIs, grouped by concern (see each item’s own docs for details; the full symbol list is the crate root’s own rustdoc index, not repeated here — it drifts out of sync with a hand-maintained count otherwise):
- Protocol v1 builders:
json_result,json_error,json_progress,json_log(each returns a builder; call.build()) - Protocol reader:
decode_protocol_eventparses and strict-validates one protocol line into a typedDecodedEvent - Redaction:
redacted_value/Redactor::value(JSON values),redact_url_secrets/Redactor::url(URL strings) —Redactorcarries customsecret_names/policy - Output rendering:
render— the singlevalue × format × options → Stringentry point for JSON, YAML, and plain (logfmt) output - Parse utilities:
normalize_utc_offset,is_valid_rfc3339_date,is_valid_rfc3339_time,is_valid_rfc3339,is_valid_bcp47 - CLI helpers:
cli_parse_output,cli_parse_log_filters(returnsLogFilters),build_cli_error,build_cli_version,cli_render_version,cli_handle_version_or_continue - (feature
cli-help): configurable clap help rendering viacli_render_help_with_optionsandcli_handle_help_or_continue - (feature
cli-help-markdown):cli_render_help_markdown— recursive Markdown help - (feature
skill):skill::validate_skill/skill::validate_skill_named— strict Agent SkillsSKILL.mdfront-matter validation - (feature
skill-admin):skill::run_skill_admin— install/uninstall/status a spore’s embedded Agent Skill across Codex, Claude Code, opencode, and Hermes; returns a typedskill::SkillReport - (feature
tracing):afdata_tracing::try_initinitializes an AFDATA stdout logging layer with configurable format and redaction; alsoafdata_tracing::LogFormat
The shared cross-language contract (which of these exist, under what name, in each of
Rust/Python/TypeScript/Go) is tracked in spec/api-surface.json and cross-checked by
scripts/validate_api_surface.py.
Modules§
- afdata_
tracing - AFDATA-compliant tracing layer.
- document
- Format-independent document values (dot-path access, typed coercion, and
pluggable JSON/TOML/YAML/dotenv/INI backends), ported from
agent-first-config. 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. Ported from the standaloneagent-first-configcrate. - skill
- Agent Skills
SKILL.mdfront-matter validation. - stream_
redirect - Optional process stdout/stderr file redirection.
Structs§
- CliEmitter
- Stateful emitter for finite structured CLI executions.
- Decoded
Error - Decoded
kind:"error"event. - Decoded
Log - Decoded
kind:"log"event. - Decoded
Progress - Decoded
kind:"progress"event. - Decoded
Result - Decoded
kind:"result"event. - Error
Builder - Builder for error events.
- Event
- A typed, strict-valid AFDATA protocol v1 event.
- Help
Config - Configuration for pre-clap help handling.
- Help
Options - Options for rendering CLI help.
- LogBuilder
- Builder for log events.
- LogFilters
- Parsed and normalized log filters (trimmed, lowercased, deduplicated).
- Output
Options - Output options combining redaction and rendering style.
- Progress
Builder - Builder for progress events.
- Protocol
Violation - A single protocol-validation violation: a stable machine-readable
ruleslug, a JSON pointer to the offending location (""= the whole event), and a human-readablemessage. - Redactor
- Configurable redaction builder for secrets and legacy field names.
- Result
Builder - Builder for result events.
Enums§
- Build
Error - Error type for builder failures.
- CliEmitter
Error - Error returned by
CliEmitter. - Decoded
Event - A decoded, strict-valid AFDATA protocol v1 event, typed by kind.
- Event
Decode Error - Error returned by
decode_protocol_event. - Help
Format - Output format for help rendering.
- Help
Scope - How much of a command tree a help request should render.
- LogLevel
- Log level enumeration (serialized as lowercase).
- Output
Format - Output format for CLI and pipe/MCP modes.
- Plain
Style - Rendering style for plain (logfmt) output only. JSON and YAML are always structure-preserving and ignore this.
- Redaction
Policy - Which fields a
Redactorscrubs. The default isRedactionPolicy::All.
Functions§
- build_
cli_ error - Build a CLI error event with optional hint.
- build_
cli_ version - Build a standard CLI version event: a
kind:"result"event whose payload is{ "code": "version", "version": <version> }. - cli_
handle_ help_ or_ continue - Render help from raw argv if a help flag is present; otherwise return
None. - cli_
handle_ version_ or_ continue - Render version output from raw argv if
--versionor-Vis present. - cli_
parse_ log_ filters - Normalize
--logflag entries: trim, lowercase, deduplicate, remove empty. - cli_
parse_ output - Parse
--outputflag value intoOutputFormat. - cli_
render_ help - Render recursive plain-text help for a clap command tree.
- cli_
render_ help_ markdown - Render recursive Markdown help for a clap command tree.
- cli_
render_ help_ with_ options - Render help for a clap command tree with explicit scope and format.
- cli_
render_ version - Render a CLI version response.
- decode_
protocol_ event - Parse one protocol v1 line, strict-validate it, and return a typed decoded event.
- is_
valid_ bcp47 - Return true when
sis a structurally well-formed BCP 47 (RFC 5646) language tag. - is_
valid_ rfc3339 - Return true when
sis a complete RFC 3339date-time, such as2026-02-14T10:30:00Zor2026-02-14T10:30:00.5+08:00. - is_
valid_ rfc3339_ date - Return true when
sis an RFC 3339full-date(YYYY-MM-DD). - is_
valid_ rfc3339_ time - Return true when
sis an RFC 3339partial-time(HH:MM:SS[.fraction]). - json_
error - Fluent builder: start building an error event.
- json_
log - Fluent builder: start building a log event.
- json_
progress - Fluent builder: start building a progress event.
- json_
result - Fluent builder: start building a result event.
- normalize_
utc_ offset - Normalize a fixed UTC offset string to AFDATA canonical form.
- redact_
url_ secrets - Redact secret components of a single URL string, using default options.
- redacted_
value - Return a JSON value copy with default
_secretredaction applied. - render
- Render a value as a string in the given format with the given options.
- validate_
protocol_ event - Validate one protocol v1 event envelope.
- validate_
protocol_ stream - Validate a finite structured CLI event stream:
(log | progress)* -> exactly one (result | error) -> end.