Reconcile module docs and release materials
This commit is contained in:
@@ -15,25 +15,36 @@ import (
|
||||
|
||||
// PromptRequest selects one named prompt for inspection.
|
||||
type PromptRequest struct {
|
||||
// Selection carries the configuration and overlay values supplied to the command.
|
||||
Selection ckconfig.Selection
|
||||
ID string
|
||||
Version commandkit.Supplied[string]
|
||||
// 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.
|
||||
type ProfileRequest struct {
|
||||
// Selection carries the configuration and overlay values supplied to the command.
|
||||
Selection ckconfig.Selection
|
||||
ID string
|
||||
// ID is the selected named profile.
|
||||
ID string
|
||||
}
|
||||
|
||||
// Suite describes application-owned input, shared state, and named inspection
|
||||
// capabilities. Its private issues retain adapter construction failures.
|
||||
type Suite[I, S any] struct {
|
||||
NewInput func() I
|
||||
NewState func() S
|
||||
Selectors []commandkit.Flag[I]
|
||||
CheckInput func(ckconfig.Selection, I) error
|
||||
InspectPrompt func(context.Context, PromptRequest, I, S) (commandkit.Acquired[*promptkit.PromptInspection], error)
|
||||
// NewInput creates input storage once for the selected definition command.
|
||||
NewInput func() I
|
||||
// NewState creates shared inspection state once for that invocation.
|
||||
NewState func() S
|
||||
// Selectors declares the original typed flags accepted by definition commands.
|
||||
Selectors []commandkit.Flag[I]
|
||||
// CheckInput validates the selected definition inputs before state creation.
|
||||
CheckInput func(ckconfig.Selection, I) error
|
||||
// InspectPrompt inspects the selected prompt after input and state preparation.
|
||||
InspectPrompt func(context.Context, PromptRequest, I, S) (commandkit.Acquired[*promptkit.PromptInspection], error)
|
||||
// InspectProfile inspects the selected profile after input and state preparation.
|
||||
InspectProfile func(context.Context, ProfileRequest, I, S) (commandkit.Acquired[*promptkit.ProfileInspection], error)
|
||||
|
||||
issues []error
|
||||
@@ -42,8 +53,11 @@ type Suite[I, S any] struct {
|
||||
type engineLoader[I, S any] func(context.Context, ckconfig.Selection, I, S) (*promptkit.Engine, error)
|
||||
|
||||
// ConfigScope adapts PromptKit's captured configuration inspection to the
|
||||
// standard configuration commands. The engine is acquired only when an
|
||||
// operation selects this scope.
|
||||
// standard configuration commands. The loader is not called during declaration
|
||||
// construction or installation; it is called only when a config operation
|
||||
// selects the promptkit scope, with that operation's input and shared state.
|
||||
// PromptKit diagnostics and error identity are returned through ckconfig's
|
||||
// acquisition contract.
|
||||
func ConfigScope[I, S any](load func(context.Context, ckconfig.Selection, I, S) (*promptkit.Engine, error)) ckconfig.Scope[I, S] {
|
||||
scope := ckconfig.Scope[I, S]{
|
||||
Name: "promptkit",
|
||||
@@ -72,7 +86,10 @@ func ConfigScope[I, S any](load func(context.Context, ckconfig.Selection, I, S)
|
||||
}
|
||||
|
||||
// FromEngine creates named prompt and profile inspection callbacks backed by a
|
||||
// PromptKit engine loader. A nil loader is retained as an adapter issue.
|
||||
// PromptKit engine loader. It does not call the loader during construction. Each
|
||||
// selected inspection passes its context, supplied selection, initialized input,
|
||||
// and shared invocation state to the loader before calling PromptKit's public
|
||||
// inspection method. A nil loader is retained as an adapter issue.
|
||||
func FromEngine[I, S any](load func(context.Context, ckconfig.Selection, I, S) (*promptkit.Engine, error)) Suite[I, S] {
|
||||
if load == nil {
|
||||
return Suite[I, S]{issues: []error{errors.New("PromptKit engine loader is nil")}}
|
||||
|
||||
Reference in New Issue
Block a user