Demonstrate entry-declared import destinations

This commit is contained in:
2026-10-14 17:41:35 +00:00
parent a20ba0af27
commit 08e03f6a38
14 changed files with 143 additions and 28 deletions

View File

@@ -43,9 +43,9 @@ type CollectionProfile struct {
}
// LoadCollectionBundle demonstrates one layered collection load. Its main
// document owns the application schema version; imported collection metadata,
// prompt/profile peers, and an operator prompt-version override use ordinary
// destinations and domain fields.
// document owns the application schema version; the mounted entry declares
// relative destinations for collection metadata, prompt/profile peers, and
// their nested imports. The operator version override remains a separate tier.
func LoadCollectionBundle() (*configkit.Result[CollectionBundleConfig], error) {
files, err := fs.Sub(bundledFiles, "testdata/collection-bundle")
if err != nil {
@@ -54,7 +54,6 @@ func LoadCollectionBundle() (*configkit.Result[CollectionBundleConfig], error) {
bundle := configkit.NewFilesystem("collection bundle", files)
collectionDestination := configkit.Keys("collections", "weatherreporter")
promptDestination := collectionDestination.Key("prompts")
profileDestination := collectionDestination.Key("profiles")
return configkit.LoadLayered(
configkit.Input{Source: configkit.Bytes("application main", []byte("version: 1\n"))},
configkit.LayeredOptions[CollectionBundleConfig]{
@@ -69,13 +68,9 @@ func LoadCollectionBundle() (*configkit.Result[CollectionBundleConfig], error) {
Validate: validateCollectionBundle,
},
Underlays: []configkit.Underlay{
{Inputs: []configkit.Input{
{Source: bundle.File("collections/weather/collection.yml"), Imports: true, Destination: collectionDestination},
{Source: bundle.File("collections/weather/prompts/brief.yml"), Destination: promptDestination},
{Source: bundle.File("collections/weather/prompts/custom.yml"), Destination: promptDestination},
{Source: bundle.File("collections/weather/profiles/compact.yml"), Destination: profileDestination},
{Source: bundle.File("collections/weather/profiles/weather.yml"), Destination: profileDestination},
}},
{Inputs: []configkit.Input{{
Source: bundle.File("collections/weather/collection.yml"), Imports: true, Destination: collectionDestination,
}}},
{Inputs: []configkit.Input{{
Source: bundle.File("operators/weather-prompt-version.yml"), Destination: promptDestination,
}}},