Construct prompt engines from shared configuration

This commit is contained in:
2026-11-23 04:23:59 +00:00
parent 1ca5011049
commit 9977cd9130
21 changed files with 153 additions and 253 deletions

View File

@@ -13,6 +13,17 @@ import (
pk "go.maximumdirect.net/promptkit"
)
// AssetError reports a failure to access an embedded application resource.
type AssetError struct{ Err error }
func (e *AssetError) Error() string { return e.Err.Error() }
func (e *AssetError) Unwrap() error { return e.Err }
func IsAssetError(err error) bool {
var target *AssetError
return errors.As(err, &target)
}
// Config combines Audita's root settings with native PromptKit settings.
type Config struct {
Application config.Config `yaml:",inline"`
@@ -74,7 +85,7 @@ func Load(ctx context.Context, input ck.Input, overlay string, overrides ...ck.O
input.Source = prepared
embedded, err := pk.FilesystemInputs("Audita embedded prompts", prompts.Filesystem(), prompts.AssetRoot)
if err != nil {
return nil, report, fmt.Errorf("discover embedded prompts: %w", err)
return nil, report, &AssetError{Err: fmt.Errorf("discover embedded prompts: %w", err)}
}
for i := range embedded {
embedded[i].Destination = ck.Keys("promptkit")