51 lines
3.1 KiB
Markdown
51 lines
3.1 KiB
Markdown
# Composed consumer
|
|
|
|
This example composes application configuration, PromptKit configuration,
|
|
PromptKit comparison and catalogs, definition and requirements inspection, and
|
|
one application-owned command:
|
|
|
|
```sh
|
|
go run . config scopes
|
|
go run . config validate --scope all --campaign spring --limit=0
|
|
go run . config diff --scope app --config fixtures/before.yml --against-config fixtures/after.yml
|
|
go run . config diff --scope app --config fixtures/before.yml --against-config fixtures/after.yml --campaign spring --limit=0
|
|
go run . config diff --scope promptkit --config fixtures/before.yml --against-config fixtures/after.yml --campaign spring
|
|
go run . promptkit list prompts --config fixtures/before.yml --campaign spring
|
|
go run . promptkit list profiles --config fixtures/after.yml --campaign autumn --format yaml
|
|
go run . promptkit show prompt briefing --campaign spring --format yaml
|
|
go run . promptkit show profile spring --campaign spring
|
|
go run . promptkit requirements show briefing --campaign spring
|
|
go run . promptkit requirements show briefing --campaign spring --var mode=full --format yaml
|
|
go run . session restore session-42 --campaign spring
|
|
```
|
|
|
|
The sources and session store are small in-memory fixtures. `--campaign` is a
|
|
typed selector shared by the app and PromptKit configuration scopes. Their
|
|
`ckconfig.Suite[*inspectionInput, *runCache]` uses `NewInput` to initialize each
|
|
selected scope's input separately and `NewState` to create one cache shared by
|
|
that invocation's acquisitions. Prompt/profile inspection prepares its input and
|
|
cache independently for its invocation, using the same application and engine
|
|
loader functions. See the
|
|
[consumer guide](https://gitea.maximumdirect.net/eric/CommandKit/src/branch/main/docs/consumers/guide.md)
|
|
and the suites' GoDoc for initialization timing and ownership.
|
|
|
|
The application-scope comparison reports the changed default campaign and the
|
|
updated `campaigns.spring.model`. The PromptKit-scope comparison selects spring
|
|
on both sides and reports the native engine change under the spring profile.
|
|
The application input check requires `--limit=0` when `--campaign` is supplied.
|
|
Catalogs use the same selection-aware loader: the prompt catalog includes
|
|
`briefing` version `1`, and the profile catalog includes the selected `autumn`
|
|
profile. The example's shared run cache keys successful results by the complete
|
|
supplied configuration/overlay selection and the supplied campaign, including
|
|
presence. The campaign override is applied through ConfigKit before loading.
|
|
These are choices for this example's loader and do not define a CommandKit cache
|
|
policy.
|
|
|
|
The first requirements command reports incomplete discovery: PromptKit records
|
|
the conditional `notes` input and a missing `mode` issue. Supplying `mode=full`
|
|
selects that branch, classifies the undeclared `notes` input as required, and
|
|
completes discovery. Both commands return successful reports; the result does
|
|
not execute the prompt or establish input, credential, or execution readiness.
|
|
See the [CLI reference](../../../../docs/cli.md#promptkit-requirements) for the
|
|
command and report contract.
|