Expand description
kranz config — inspect and edit the layered configuration.
Configuration resolves from three layers, later layers winning (see
kranz_engine::config): compiled-in defaults ← ~/.kranz/config.json
(the GLOBAL layer) ← <repo>/.kranz/config.json (the PROJECT layer).
Four verbs:
show— the effective merged config (or one layer with--global/--project).set <path> <value>— set ONE dotted key in a layer file. The dotted path is checked against the config SCHEMA first (a typo’d key would deep-merge, validate green — unknown keys are ignored on deserialize — and be a silent no-op). The edit then happens on the raw JSON tree (never aMissionConfiground-trip), so every other key already IN the file — including keys kranz doesn’t know about — survives untouched. The candidate merge is validated BEFORE anything is written; an invalid value leaves the file byte-identical. A--globalwrite is validated TWICE: standalone (defaults + candidate global — what every OTHER repo sees) and merged with this repo’s project layer; either failure refuses the write, so a project override can never mask a global value that would poison other repos.unset <path>— remove one dotted key from a layer file, pruning parent objects the removal left empty. Removing the last key leaves an empty{}file (the file is never deleted). The dotted path gets the same schema check asset(a typo’d key should say “unknown key”, not “not set”). Unset is NOT validity-gated: removal converges toward the defaults, and gating it could deadlock (an invalid VALUE in one layer would block its own removal). The schema-path gate cannot deadlock: an unknown key never affects validation in the first place.role <role> <model> [effort]— the MID-MISSION path: enqueue aconfig-changecontrol command on a running mission (the CLI twin of Slack’s/kranz config). File edits only shape FUTURE missions;rolereshapes the one that is running, at its next spawn of that role.
Structs§
- Layers
- The two editable config layer files, resolved once so every verb — and
every test — operates on explicit paths instead of re-deriving
$HOME.
Enums§
- Config
Command - Subcommands under
kranz config— the configuration surface.
Functions§
- cmd_
config - Dispatch a
kranz config …subcommand.missionis the global –mission flag, consumed only byrole. - render_
effective - Pretty-print the effective config merged from explicit layer paths over
the compiled-in defaults (missing files are skipped, like
config::load), with each layer’s provenance so the operator-only key rule applies here exactly as it does at load time. - render_
layer_ file - Pretty-print one layer file. A missing file renders as
{}withexists = falseso the caller can add a note without polluting stdout. - render_
layer_ file_ redacted render_layer_filewith secret-shaped values replaced by[REDACTED].- role_
change - Resolve the target ACTIVE mission (shared engine resolver — the same policy
as Slack: an explicit id must exist and be non-terminal; a bare command
needs exactly one active mission) and enqueue ONE
config-changecontrol command carrying the same camelCase patch shape Slack produces (kranz_slack::inbound::config_patch). A refused target enqueues NOTHING. Returns the mission id the change was applied to. - set_key
- Set
dottedtoraw(JSON-parsed, string fallback) in the chosen layer file. The dotted path must exist in the config schema (a typo’d key would otherwise merge, validate green, and be a silent no-op). The candidate state is validated BEFORE writing — for--globalboth standalone and merged with this repo’s project layer; on any failure the file is left byte-identical. Returns the file written. - unset_
key - Remove
dottedfrom the chosen layer file, pruning parents the removal left empty. The dotted path gets the same schema check asset— a typo’d key errors as “unknown key”, not “not set”. A schema-valid key that is not set is an error too (and nothing is written). Removing the last key leaves{}— the file is never deleted. Returns the file written.