Compose reusable configuration rules at the PromptKit path

This commit is contained in:
2026-11-21 14:18:15 +00:00
parent 76c8789e65
commit 34c0cf3f14
7 changed files with 207 additions and 88 deletions

View File

@@ -40,20 +40,20 @@ func (state *loaded) materializePrompts() error {
}
return metadata.Lookup(path)
}
applicationRoot, err := state.captureSchemaRoot(state.result.Config.SchemaRoot, configkit.Keys("schema_root"), lookupOrigin)
applicationRoot, err := state.captureSchemaRoot(state.result.Config.PromptKit.SchemaRoot, configkit.Keys("promptkit", "schema_root"), lookupOrigin)
if err != nil {
return err
}
roots := make(map[string]*domain.ResourceBinding, len(state.result.Config.Collections))
for _, name := range sortedKeys(state.result.Config.Collections) {
collection := state.result.Config.Collections[name]
root, err := state.captureSchemaRoot(collection.SchemaRoot, configkit.Keys("collections", name, "schema_root"), lookupOrigin)
roots := make(map[string]*domain.ResourceBinding, len(state.result.Config.PromptKit.Collections))
for _, name := range sortedKeys(state.result.Config.PromptKit.Collections) {
collection := state.result.Config.PromptKit.Collections[name]
root, err := state.captureSchemaRoot(collection.SchemaRoot, configkit.Keys("promptkit", "collections", name, "schema_root"), lookupOrigin)
if err != nil {
return err
}
roots[name] = root
}
for _, resources := range resourceSets(&state.result.Config) {
for _, resources := range resourceSets(&state.result.Config.PromptKit) {
root := applicationRoot
if selected := roots[resources.namespace]; resources.isCollection && selected != nil {
root = selected