Add PromptKit definition inspection

This commit is contained in:
2026-10-07 14:40:41 +00:00
parent 6ad723cde1
commit 0af44a1172
7 changed files with 924 additions and 23 deletions

View File

@@ -225,6 +225,76 @@ environment-variable name; effective and historical secret fragments remain
redacted. Empty location, inheritance, history, reason, and dependency lists are
serialized as `[]`.
## PromptKit definition inspection
Applications can install prompt and profile inspection independently with
`RegisterPromptKit`. Each installed handler constructs the selected engine once
and asks PromptKit to inspect the named definition. Inspection reads the
engine's captured configuration; it does not generate a prompt, contact a
provider, or look up credentials.
Prompt definitions and profile resolution remain owned by
[PromptKit](https://pkg.go.dev/gitea.maximumdirect.net/eric/promptkit).
```text
example promptkit show prompt customer/summary --version 2 --format yaml
example promptkit show prompt customer/summary
example promptkit show profile customer-support --format yaml
```
Both commands require one ID operand and accept `--config`, `--overlay`, and
`--format text|yaml` (default `text`). Prompt inspection also accepts singleton
`--version`, defaulting to the empty string. PromptKit owns version selection:
an omitted version works for a single-version ID, while an ambiguous ID is an
operational error. These commands do not accept `--scope`; their namespace is
`promptkit`.
Prompt YAML has these fields. Input order is preserved and an empty input list is
`[]`. The prompt hash is an opaque owning-library equality value.
```yaml
prompt_id: customer/summary
prompt_version: "2"
prompt_hash: opaque-value
default_profile_id: customer-support
inputs:
- name: topic
required: true
content_type: text/plain
description: Topic to summarize
output_contract:
format: json
validation_mode: basic
schema_path: ""
repair_attempts: 2
```
Profile YAML preserves the effective values reported by PromptKit, including
zero values and nested provider parameters. `api_key_env` is only an
environment-variable name. `api_key_required` reports a direct credential
requirement; neither field reports credential availability. A nil provider
parameter map is displayed as `{}`.
```yaml
profile_id: customer-support
effective_model_params:
backend_id: local
endpoint: https://example.invalid/v1
model: support-model
temperature: 0
max_tokens: 0
top_p: 0
timeout_seconds: 600
service_tier: ""
reasoning_effort: ""
api_key_env: ""
extra_params: {}
api_key_required: true
```
Text uses labeled fields and includes nested `extra_params` values. A missing ID
is a usage error. Blank, unknown, ambiguous, and canceled selections are
operational inspection results from PromptKit and retain its error identity.
## Outcome status
CommandKit usage failures use status `2`; operational failures use status `1`.

View File

@@ -6,8 +6,8 @@ declarations, an instance-owned registry, a Cobra-backed routing and parsing
adapter, public `App.Execute` coordination, and generated help/version commands.
Configuration suite registration, scope discovery, ConfigKit integration,
validation, native effective YAML display, source inventory, and path
explanation reports, and PromptKit engine configuration inspection are
implemented; named prompt/profile inspection remains pending. The
explanation reports, PromptKit engine configuration inspection, and optional
PromptKit prompt/profile inspection commands are implemented. The
[README](../README.md) provides project orientation; the
[documentation policy](policy/documentation.md#canonical-ownership) assigns
canonical documentation owners.

View File

@@ -1,6 +1,6 @@
# Initial CommandKit implementation plan
Status: implementation underway; Stages 1-12 complete and Stages 13-14 pending.
Status: implementation underway; Stages 1-13 complete and Stage 14 pending.
Date: 2026-10-07.
@@ -750,7 +750,7 @@ PromptKit/ConfigKit error identities. `go test ./...` passes.
## Stage 13: implement named prompt/profile inspection
**Status:** pending. **Prerequisite:** Stage 12.
**Status:** complete. **Prerequisite:** Stage 12.
```go
type PromptKitSuite[C any] struct {
@@ -811,6 +811,11 @@ formats, nil/empty parameters, independently installed prompt/profile capability
definition-only registration, and help without engine construction. Assert no
handler enters generation rather than exercising paid/network execution paths.
**Completion evidence:** `promptkit_test.go` exercises real captured prompt and
profile definitions, both report formats, inheritance and provider parameters,
selection errors, optional capabilities, and help without engine construction.
`go test ./...` passes.
## Stage 14: substantiate consumer fit and complete documentation
**Status:** pending. **Prerequisite:** Stage 13.