Migrate prompt integration to PromptKit 0.16

This commit is contained in:
2026-10-17 18:34:03 +00:00
parent b56cae70b9
commit 66b2994e48
7 changed files with 25 additions and 28 deletions

View File

@@ -19,8 +19,6 @@ type PromptRequest struct {
Selection ckconfig.Selection
// ID is the selected named prompt.
ID string
// Version carries the explicitly supplied prompt version, if present.
Version commandkit.Supplied[string]
}
// ProfileRequest selects one named profile for inspection.
@@ -265,7 +263,7 @@ func FromEngine[I, S any](load func(context.Context, ckconfig.Selection, I, S) (
if err != nil {
return commandkit.Acquired[*promptkit.PromptInspection]{Diagnostics: diagnostics}, err
}
inspection, err := engine.InspectPrompt(ctx, request.ID, request.Version.Value)
inspection, err := engine.InspectPrompt(ctx, request.ID)
return commandkit.Acquired[*promptkit.PromptInspection]{Value: inspection, Diagnostics: diagnostics}, err
},
InspectProfile: func(ctx context.Context, request ProfileRequest, input I, state S) (commandkit.Acquired[*promptkit.ProfileInspection], error) {

View File

@@ -18,7 +18,6 @@ import (
type definitionInput[I any] struct {
selection ckconfig.Selection
id string
version commandkit.Supplied[string]
format string
captured commandkit.FlagValues[I]
selected I
@@ -191,11 +190,6 @@ func newDefinitionCommand[I, S any](suite Suite[I, S], name string, prompt bool)
commandkit.ValueFlag(commandkit.FlagMeta{Name: "format", Usage: "Report format: text or yaml."}, stringDefault("text"), parseDefinitionString,
func(input **definitionInput[I], value commandkit.Supplied[string]) { (*input).format = value.Value }),
)
if prompt {
flags = append(flags, commandkit.ValueFlag(commandkit.FlagMeta{Name: "version", Usage: "Prompt version to inspect."}, (*string)(nil), parseDefinitionString,
func(input **definitionInput[I], value commandkit.Supplied[string]) { (*input).version = value }))
}
spec := commandkit.CommandSpec[*definitionInput[I]]{
Name: name,
Summary: "Inspect a named PromptKit " + name + ".",
@@ -241,10 +235,6 @@ func newRequirementsCommand[I, S any](suite Suite[I, S]) commandkit.Command {
func(input **requirementsInput[I], value commandkit.Supplied[string]) {
(*input).selection.Overlay = value
}),
commandkit.ValueFlag(commandkit.FlagMeta{Name: "version", Usage: "Prompt version to inspect."}, stringDefault(""), parseDefinitionString,
func(input **requirementsInput[I], value commandkit.Supplied[string]) {
(*input).inspection.PromptVersion = value.Value
}),
commandkit.ValueFlag(commandkit.FlagMeta{Name: "profile", Usage: "Profile identity for discovery."}, stringDefault(""), parseDefinitionString,
func(input **requirementsInput[I], value commandkit.Supplied[string]) {
(*input).inspection.ProfileID = value.Value
@@ -371,7 +361,7 @@ func runDefinitionInspection[I, S any](invocation commandkit.Invocation, suite S
}
if prompt {
request := PromptRequest{Selection: input.selection, ID: input.id, Version: input.version}
request := PromptRequest{Selection: input.selection, ID: input.id}
acquired, err := suite.InspectPrompt(invocation.Context, request, input.selected, state)
if err != nil {
return definitionFailure(err, acquired.Diagnostics)
@@ -419,7 +409,7 @@ type promptOutputContractReport struct {
type promptInspectionReport struct {
PromptID string `yaml:"prompt_id"`
PromptVersion string `yaml:"prompt_version"`
PromptVersion *string `yaml:"version,omitempty"`
PromptHash string `yaml:"prompt_hash"`
DefaultProfileID string `yaml:"default_profile_id"`
Inputs []promptInputReport `yaml:"inputs"`
@@ -428,7 +418,7 @@ type promptInspectionReport struct {
type requirementsInspectionReport struct {
PromptID string `yaml:"prompt_id"`
PromptVersion string `yaml:"prompt_version"`
PromptVersion *string `yaml:"version,omitempty"`
ProfileID string `yaml:"profile_id"`
Complete bool `yaml:"complete"`
Inputs []requirementInputReport `yaml:"inputs"`
@@ -623,7 +613,9 @@ func renderProfileReport(invocation commandkit.Invocation, report profileInspect
func formatPromptText(report promptInspectionReport) string {
var output strings.Builder
fmt.Fprintf(&output, "Prompt ID: %s\n", strconv.Quote(report.PromptID))
fmt.Fprintf(&output, "Prompt version: %s\n", strconv.Quote(report.PromptVersion))
if report.PromptVersion != nil {
fmt.Fprintf(&output, "Prompt version: %s\n", strconv.Quote(*report.PromptVersion))
}
fmt.Fprintf(&output, "Prompt hash: %s\n", strconv.Quote(report.PromptHash))
fmt.Fprintf(&output, "Default profile ID: %s\n", strconv.Quote(report.DefaultProfileID))
output.WriteString("Inputs:\n")
@@ -664,8 +656,8 @@ func encodePromptYAML(writer io.Writer, value any) error {
}
type promptCatalogEntry struct {
ID string `yaml:"id"`
Version string `yaml:"version"`
ID string `yaml:"id"`
Version *string `yaml:"version,omitempty"`
}
func encodePromptCatalog(prompts []promptkit.PromptIdentity) ([]byte, error) {

View File

@@ -2,16 +2,16 @@
## PromptKit
Selected module: `gitea.maximumdirect.net/eric/promptkit` at `v0.15.0`.
Selected module: `gitea.maximumdirect.net/eric/promptkit` at `v0.16.0`.
Copyright (C) 2026 Eric Rakestraw
SPDX-License-Identifier: LGPL-3.0-or-later
License and notices: [LGPL v3.0](../../LICENSE) |
[LICENSE](https://gitea.maximumdirect.net/eric/promptkit/src/commit/635674c066d0b432187f96e72b9c03d085443ac5/LICENSE).
[LICENSE](https://gitea.maximumdirect.net/eric/promptkit/src/commit/9178f3eb91c2b2138caa78e22be93c048b4bc992/LICENSE).
[Source](https://gitea.maximumdirect.net/eric/promptkit/src/commit/635674c066d0b432187f96e72b9c03d085443ac5).
[Source](https://gitea.maximumdirect.net/eric/promptkit/src/commit/9178f3eb91c2b2138caa78e22be93c048b4bc992).
## ConfigKit

View File

@@ -6,7 +6,7 @@ require (
gitea.maximumdirect.net/eric/CommandKit v0.2.0
gitea.maximumdirect.net/eric/CommandKit/integrations/ckconfig v0.1.0
gitea.maximumdirect.net/eric/ConfigKit v0.8.0
gitea.maximumdirect.net/eric/promptkit v0.15.0
gitea.maximumdirect.net/eric/promptkit v0.16.0
go.yaml.in/yaml/v4 v4.0.0-rc.6
)

View File

@@ -4,6 +4,8 @@ gitea.maximumdirect.net/eric/ConfigKit v0.8.0 h1:xCIhYnOHjw7rFvB+vIremPKGeROOxKT
gitea.maximumdirect.net/eric/ConfigKit v0.8.0/go.mod h1:C82sbyKHYMV1OwaD2GJanFrwTfcZfjlW2JsGze5b0kA=
gitea.maximumdirect.net/eric/promptkit v0.15.0 h1:PhG8F4SQNyxuHDZ++nLKjtObMfkz9f38/DuSVv45bHM=
gitea.maximumdirect.net/eric/promptkit v0.15.0/go.mod h1:2YGvNca3bNXZP+e+pJeGzsNUcxwkHvzvuoc+LNNiT3E=
gitea.maximumdirect.net/eric/promptkit v0.16.0 h1:g3dhN0QfzQriaVOBmGUZCw2iBM9Mli2AAU4CbMfzcuY=
gitea.maximumdirect.net/eric/promptkit v0.16.0/go.mod h1:yGSi8nhksSNrCYZ0RTSZaVHkrF43R77g1CG1LFaNJfI=
gitea.maximumdirect.net/eric/promptkit-backend-openrouter/v3 v3.20260930.0 h1:lzfCDbzJQRGzIlRPRprnAV9hVVL5zUQy80VMQ0kbYa0=
gitea.maximumdirect.net/eric/promptkit-backend-openrouter/v3 v3.20260930.0/go.mod h1:HjS0f+3q0IdHCTEz+VVAEgIwIWJFAZUjuKdAtvtqKdg=
gitea.maximumdirect.net/eric/promptkit-backend-rakestrawhome/v3 v3.20260930.0 h1:h12ZTRldAmpLAomj0oQRGteFxHLN1LPE6XDl9zJNbm8=

View File

@@ -36,10 +36,6 @@ func newValidationCommand[I, S any](suite Suite[I, S]) commandkit.Command {
func(input **validationCommandInput[I], value commandkit.Supplied[string]) {
(*input).request.Selection.Overlay = value
}),
commandkit.ValueFlag(commandkit.FlagMeta{Name: "version", Usage: "Prompt version to validate."}, stringDefault(""), parseDefinitionString,
func(input **validationCommandInput[I], value commandkit.Supplied[string]) {
(*input).request.Request.PromptVersion = value.Value
}),
commandkit.ValueFlag(commandkit.FlagMeta{Name: "profile", Usage: "Profile identity for validation."}, stringDefault(""), parseDefinitionString,
func(input **validationCommandInput[I], value commandkit.Supplied[string]) {
(*input).request.Request.ProfileID = value.Value