configcmd: config show, Doctor, KnownKey and a Layered hook

"config show [--json] [--show-secrets]" prints the configuration with
the origin of every value (secrets redacted), for every program.
Spec.Layered lets a program whose configuration is merged from several
inputs (family file, a section of it, its own file -- the yamase
family) run path, validate and show over all layers, with its own
unknown-option rules; unknown options are warnings there. Doctor(report,
spec, explicit) is the config part of a doctor command. UnknownKey
carries the layer it is in; KnownKey tells whether a dotted key is an
option of a config struct.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
terminarandClaude Opus 5.5 committed 2026-10-25 17:29:19 +01:00
1 parent 185211e304
commit fa52990e3e
7 files changed
+758 -11

No files matched your search

+18
View File
@@ -355,6 +355,24 @@ in the full template -- that is what keeps `config upgrade` useful.
report options the program ignores. Taken over from
`yamase-core/pkg/configcmd`, which now wraps it.
`config show [--json] [--show-secrets]` prints the configuration with
the file every value comes from (`Effective.Show`; secrets -- keys
`secrets`, `secret`, `token`, `password` -- are redacted unless
`--show-secrets`, references like `env:X` stay visible), and
`configcmd.Doctor(report, spec, explicit)` is the config part of a
`doctor` command (paths, layers, "config file found", unknown options).
A program whose configuration is merged from more than one file name
per directory -- a family-wide file, a section of it and a per-program
file, as in the yamase family -- sets `Spec.Layered`: `Layers` (what
`config path` lists), `Load` (merge, e.g. with `config.Merge`, into an
`Effective`), optionally `Unknown` (its own unknown-option rules),
`Validate(merged)` and `Used(key)`. `path`, `validate` and `show` then
work on all layers, unknown options become warnings (shared files carry
options of other programs), and `create`/`upgrade` keep working on the
program's own file. `KnownKey(schema, "a.b[0].c")` tells whether a
dotted key is an option of a config struct.
## core/version: "<program> version [--json]"
The values stay in each program's `internal/version` (stamped with