Expand description
Schema-derived path bindings: every path in the config-file schema is
also settable as an env var and as a generic --<path> flag, with names
derived mechanically from the path — so a re-defined parameter set needs no
per-field plumbing here.
For a config path limits.max_steps:
| source | name |
|---|---|
| file | limits: { max_steps: 5 } (YAML or JSON) |
| env | AGENTD_LIMITS_MAX_STEPS > AGENT_LIMITS_MAX_STEPS > LIMITS_MAX_STEPS |
| flag | --limits.max_steps 5 / --limits.max-steps 5 / --limits-max-steps 5 |
The env candidates are the branded, the neutral, and the bare spelling of
the upper-cased path with . → _; the first present wins.
A flag is the path with ./_ → - (any of the three spellings above
canonicalizes to the same flag). Values are typed by the schema’s declared
type (Kind): integers/numbers/booleans parse, enums are checked against
their allowed set, arrays take a [a, b] literal or a comma-separated list,
objects take a {k: v} / JSON literal — everything else is the verbatim
string. The typed super::file::ConfigFile then re-validates the merged
document exactly as it does the file (unknown keys, ranges).
A dotted flag may also reach INTO a free-form map (a schema object with
additionalProperties): --intelligence_headers.x-team ops sets ONE key of
that map (the key keeps its exact spelling — no canonicalization past the
schema path), typed by the map’s value type. Array elements are not
addressable by path (set the whole list, or use the named repeatable flag).
The single source of truth is super::file::config_schema — the same
JSON Schema --config-schema prints — walked once at startup.
Structs§
- Binding
- One config-file path with its schema type and (optional) description.
- Flag
Target - A resolved
--<path>[.<key>]flag: the schema binding it addresses and, when the flag reaches into a free-form map, the entry key (exact spelling).
Enums§
- Kind
- The value type a config path takes, per its JSON Schema.
Constants§
- ENV_
PREFIXES - The env-name prefixes tried for every path, most-specific first: branded
(
AGENTD_), neutral (AGENT_), then the bare path. Most-specific-first is what makes a branded name beat a neutral one that happens to collide.
Functions§
- bindings
- Every path in the (v1) config-file schema, in schema order (nested objects are walked; arrays and free-form maps are leaves).
- bindings_
of - Every path of an arbitrary JSON Schema document (the same walk, for the v2 settings schema or any future one).
- coerce
- Type a raw string per
kind(see the module docs for the rules). - env_
document - The env layer as a config DOCUMENT: for every schema path, the first present
env candidate (
AGENTD_…>AGENT_…> bare) is coerced and set at its path. Returns the document (an empty object when nothing is set) plus the(env name, path)pairs that were applied. An untypeable value is an error naming the variable. - env_
document_ in env_documentover a given binding set (a schema other than v1’s).- help_
section - The
--helpsection listing every config path with its flag and env name. - help_
section_ in help_sectionover a given binding set.- resolve_
flag - Resolve a
--flag(with or without the leading dashes) to the schema path it addresses — canonicalizing./_/-— or, for a dotted flag whose longest schema-path prefix is a free-form map, to that map plus the remaining segments as ONE entry key with its exact spelling (--intelligence_headers.x-team⇒ pathintelligence_headers, keyx-team).Ok(None)when it is not a config path at all (the caller reports an unknown argument);Errwhen it names a config path but reaches into something that is not a map (an array element, a scalar). - resolve_
flag_ in resolve_flagover a given binding set.- set_
path - Set
valueat the dottedpathinsideroot, creating intermediate objects (a non-object in the way is replaced).