Document PromptKit comparison and catalogs
This commit is contained in:
@@ -36,15 +36,18 @@ type ProfileRequest struct {
|
||||
// construction failures.
|
||||
// Factory results and callback effects remain caller-owned: Command does not
|
||||
// deep-copy arbitrary objects or repair aliases returned by factories.
|
||||
// A reached operation prepares one input, applies its captured selectors, and
|
||||
// checks the input before creating state and calling the selected provider.
|
||||
// Factories are not invoked during construction, installation, help, or version,
|
||||
// and need not run after failure.
|
||||
type Suite[I, S any] struct {
|
||||
// NewInput is called once when definition input preparation is reached,
|
||||
// before applying selectors and calling CheckInput.
|
||||
// NewInput is called once when definition or catalog input preparation is
|
||||
// reached, before applying selectors and calling CheckInput.
|
||||
// If nil, input is the zero value of I, including nil for pointer types.
|
||||
NewInput func() I
|
||||
// NewState is called once when inspection is reached, after input checks
|
||||
// pass. If nil, state is the zero value of S, including nil for pointer types.
|
||||
// NewState is called once when an inspection or catalog callback is reached,
|
||||
// after input checks pass. If nil, state is the zero value of S, including
|
||||
// nil for pointer types.
|
||||
NewState func() S
|
||||
// Selectors declares the original typed flags accepted by definition and
|
||||
// catalog commands.
|
||||
@@ -69,11 +72,12 @@ 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 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.
|
||||
// standard configuration commands, including native comparison when the scope
|
||||
// declares Diff. 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 supported error identity are returned through ckconfig's
|
||||
// acquisition and comparison contracts.
|
||||
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",
|
||||
@@ -139,11 +143,12 @@ func promptKitContextError(ctx context.Context) error {
|
||||
return ctx.Err()
|
||||
}
|
||||
|
||||
// FromEngine creates prompt and profile catalog and inspection callbacks 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. A nil loader is retained as an adapter
|
||||
// FromEngine supplies callbacks for prompt and profile catalogs and named
|
||||
// inspections 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. The callbacks can be
|
||||
// narrowed 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 {
|
||||
|
||||
Reference in New Issue
Block a user