Document PromptKit requirements discovery
This commit is contained in:
@@ -36,7 +36,9 @@ type ProfileRequest struct {
|
||||
type RequirementsRequest struct {
|
||||
// Selection carries the configuration and overlay values supplied to the command.
|
||||
Selection ckconfig.Selection
|
||||
// Inspection carries PromptKit's discovery context for the selected prompt.
|
||||
// Inspection forwards PromptKit's native prompt, version, profile, variable,
|
||||
// and session discovery context. Optional version, profile, and session
|
||||
// strings retain PromptKit's empty-value semantics.
|
||||
Inspection promptkit.RequirementInspectionRequest
|
||||
}
|
||||
|
||||
@@ -156,13 +158,15 @@ func promptKitContextError(ctx context.Context) error {
|
||||
return ctx.Err()
|
||||
}
|
||||
|
||||
// FromEngine supplies callbacks for prompt and profile catalogs, named
|
||||
// inspections, and requirements inspection backed by a PromptKit engine loader.
|
||||
// It does not call the loader during construction. Each selected operation
|
||||
// passes its context, supplied selection, initialized input, and shared
|
||||
// invocation state to the loader before calling PromptKit's public listing or
|
||||
// inspection method. Applications can narrow these callbacks before Command
|
||||
// captures them. A nil loader is retained as an adapter issue.
|
||||
// FromEngine supplies prompt and profile catalog callbacks, named inspection
|
||||
// callbacks, and a requirements inspection callback backed by a PromptKit engine
|
||||
// loader. The requirements callback forwards RequirementsRequest.Inspection to
|
||||
// Engine.InspectRequirements. FromEngine does not call the loader during
|
||||
// construction. Each selected operation passes its context, supplied
|
||||
// selection, initialized input, and shared invocation state to the loader before
|
||||
// calling PromptKit's public listing or inspection method. Applications can
|
||||
// narrow, wrap, or replace these callbacks before Command captures them. 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