Add ConfigKit validation and diagnostics
This commit is contained in:
23
docs/cli.md
23
docs/cli.md
@@ -102,6 +102,29 @@ runtime context or acquire configuration. It reports the intersection between
|
||||
declared scope capabilities and installed handlers, so an operation is listed
|
||||
only when the corresponding command is available.
|
||||
|
||||
### Validate configuration
|
||||
|
||||
`config validate` loads and validates the selected scope. The default scope is
|
||||
`app`; `--scope all` validates every registered scope and is available when each
|
||||
scope declares validation. The command checks all selected capabilities before
|
||||
calling scope providers.
|
||||
Its default format is text; `--format yaml` emits a `scopes` sequence with
|
||||
`name` and `valid: true` for each scope that completed successfully.
|
||||
|
||||
```text
|
||||
example config validate
|
||||
example config validate --scope promptkit --format yaml
|
||||
example config validate --scope all
|
||||
```
|
||||
|
||||
Each successful scope is reported as `SCOPE: valid`. Aggregate validation stops
|
||||
at the first load or output failure; records from earlier successful scopes may
|
||||
already have been written. Provider warnings go to the diagnostic stream and do
|
||||
not alone make validation fail. `--config` and `--overlay` preserve whether an
|
||||
empty value was explicitly supplied, so a scope callback can map those inputs to
|
||||
its own ConfigKit load policy. Help and invalid syntax do not call scope
|
||||
providers.
|
||||
|
||||
## Outcome status
|
||||
|
||||
CommandKit usage failures use status `2`; operational failures use status `1`.
|
||||
|
||||
@@ -4,8 +4,9 @@ CommandKit currently contains adopted repository policies, accepted architectura
|
||||
decisions, implementation plans, identity and outcome primitives, typed command
|
||||
declarations, an instance-owned registry, a Cobra-backed routing and parsing
|
||||
adapter, public `App.Execute` coordination, and generated help/version commands.
|
||||
Configuration suite registration and scope discovery are implemented; the
|
||||
configuration operations remain pending. The
|
||||
Configuration suite registration, scope discovery, ConfigKit integration, and
|
||||
validation are implemented; other configuration and PromptKit operations remain
|
||||
pending. The
|
||||
[README](../README.md) provides project orientation; the
|
||||
[documentation policy](policy/documentation.md#canonical-ownership) assigns
|
||||
canonical documentation owners.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Initial CommandKit implementation plan
|
||||
|
||||
Status: implementation underway; Stages 1-7 complete and Stages 8-14 pending.
|
||||
Status: implementation underway; Stages 1-8 complete and Stages 9-14 pending.
|
||||
|
||||
Date: 2026-10-07.
|
||||
|
||||
@@ -551,7 +551,7 @@ sequenced in Stages 8-11.
|
||||
|
||||
## Stage 8: integrate ConfigKit and implement validation
|
||||
|
||||
**Status:** pending. **Prerequisite:** Stage 7.
|
||||
**Status:** complete. **Prerequisite:** Stage 7.
|
||||
|
||||
```go
|
||||
func NewConfigKitScope[C, T any](name, summary string,
|
||||
@@ -594,6 +594,16 @@ empty overlay callback input; warnings permit validation success; structured loa
|
||||
errors retain public identity and render once; all validates in order and stops
|
||||
on failure. Report/diagnostic short writes retain their writer errors.
|
||||
|
||||
**Completion evidence:** added the ConfigKit scope adapter and grouped diagnostic
|
||||
writer. The adapter exposes native effective/source/explanation facets, captures
|
||||
success and `LoadError` diagnostics, and preserves loader errors. `config validate`
|
||||
now installs for declared scopes, preflights all requested capabilities, acquires
|
||||
in stable order, and emits success records incrementally in text or YAML. Checks
|
||||
cover ConfigKit defaults, overlay, recorded resolution, absent/empty selections,
|
||||
warning success, load-error identity and single presentation, aggregate stop
|
||||
behavior, and report/diagnostic short writes. `go test ./...` passes; README,
|
||||
development orientation, and CLI reference describe the implemented boundary.
|
||||
|
||||
## Stage 9: implement native effective YAML display
|
||||
|
||||
**Status:** pending. **Prerequisite:** Stage 8.
|
||||
|
||||
Reference in New Issue
Block a user