Compose runtime glossary files with native configuration

This commit is contained in:
2026-11-26 18:17:16 +00:00
parent b1cde637a2
commit a4b8fd0976
26 changed files with 292 additions and 92 deletions

View File

@@ -29,11 +29,11 @@ func TestEngineCapturesAutomaticPromptSources(t *testing.T) {
write("prompts.yml", "collections:\n audita:\n prompts:\n - id: modules.grammar.proposal\n messages:\n - role: user\n content_file: message.txt\n output:\n format: text\n validation_mode: none\n")
write("message.txt", "first")
write("prompts/nested/extra.yml", "prompts:\n - id: extra\n messages:\n - role: user\n content: extra\n output:\n format: text\n validation_mode: none\n")
loaded, _, err := appconfig.Load(context.Background(), ck.Input{Source: ck.File(main)}, "")
loaded, _, err := appconfig.Load(context.Background(), ck.Input{Source: ck.File(main)}, appconfig.Options{})
if err != nil {
t.Fatal(err)
}
first, err := NewRuntime(context.Background(), loaded, nil)
first, err := NewRuntime(context.Background(), loaded.Result, nil)
if err != nil {
t.Fatal(err)
}
@@ -60,7 +60,7 @@ func TestEngineCapturesAutomaticPromptSources(t *testing.T) {
t.Fatal(err)
}
write("message.txt", "second")
second, err := NewRuntime(context.Background(), loaded, nil)
second, err := NewRuntime(context.Background(), loaded.Result, nil)
if err != nil {
t.Fatal(err)
}
@@ -70,11 +70,11 @@ func TestEngineCapturesAutomaticPromptSources(t *testing.T) {
}
func TestEngineWithoutMainUsesEmbeddedPrompts(t *testing.T) {
loaded, _, err := appconfig.Load(context.Background(), ck.Input{Source: ck.NoSource()}, "")
loaded, _, err := appconfig.Load(context.Background(), ck.Input{Source: ck.NoSource()}, appconfig.Options{})
if err != nil {
t.Fatal(err)
}
runtime, err := NewRuntime(context.Background(), loaded, nil)
runtime, err := NewRuntime(context.Background(), loaded.Result, nil)
if err != nil {
t.Fatal(err)
}
@@ -103,11 +103,11 @@ func TestEngineCapturesInheritedMessageAndRejectsPeerConflicts(t *testing.T) {
write("shared/catalog.yml", "prompts:\n - id: parent\n messages:\n - role: user\n content_file: instruction.md\n output:\n format: text\n validation_mode: none\n")
write("shared/instruction.md", "inherited content")
write("prompts/child.yml", "prompts:\n - id: child\n extends: {id: parent}\n")
loaded, _, err := appconfig.Load(context.Background(), ck.Input{Source: ck.File(filepath.Join(dir, "config.yml"))}, "")
loaded, _, err := appconfig.Load(context.Background(), ck.Input{Source: ck.File(filepath.Join(dir, "config.yml"))}, appconfig.Options{})
if err != nil {
t.Fatal(err)
}
runtime, err := NewRuntime(context.Background(), loaded, nil)
runtime, err := NewRuntime(context.Background(), loaded.Result, nil)
if err != nil {
t.Fatal(err)
}
@@ -121,7 +121,7 @@ func TestEngineCapturesInheritedMessageAndRejectsPeerConflicts(t *testing.T) {
}
}
write("prompts/duplicate.yml", "prompts:\n - id: parent\n messages:\n - role: user\n content: duplicate\n output:\n format: text\n validation_mode: none\n")
if _, _, err := appconfig.Load(context.Background(), ck.Input{Source: ck.File(filepath.Join(dir, "config.yml"))}, ""); err == nil || appconfig.IsAssetError(err) {
if _, _, err := appconfig.Load(context.Background(), ck.Input{Source: ck.File(filepath.Join(dir, "config.yml"))}, appconfig.Options{}); err == nil || appconfig.IsAssetError(err) {
t.Fatalf("peer conflict classification: %v", err)
}
}
@@ -144,12 +144,12 @@ func TestEngineUsesRecordedContextWithWiderRoot(t *testing.T) {
t.Fatal(err)
}
source := ck.SearchConfig("audita", ck.SearchDirectory(project))
loaded, _, err := appconfig.Load(context.Background(), ck.Input{Source: source, Filesystem: &ck.FilesystemContext{Root: root}}, "")
loaded, _, err := appconfig.Load(context.Background(), ck.Input{Source: source, Filesystem: &ck.FilesystemContext{Root: root}}, appconfig.Options{})
if err != nil {
t.Fatal(err)
}
t.Chdir(t.TempDir())
runtime, err := NewRuntime(context.Background(), loaded, nil)
runtime, err := NewRuntime(context.Background(), loaded.Result, nil)
if err != nil {
t.Fatal(err)
}
@@ -181,11 +181,11 @@ func TestEngineResolvesLinkedPromptMessageBesideDefinition(t *testing.T) {
if err := os.Symlink("defs/resources.yml", filepath.Join(root, "prompts.yml")); err != nil {
t.Fatal(err)
}
loaded, _, err := appconfig.Load(context.Background(), ck.Input{Source: ck.File(filepath.Join(root, "config.yml"))}, "")
loaded, _, err := appconfig.Load(context.Background(), ck.Input{Source: ck.File(filepath.Join(root, "config.yml"))}, appconfig.Options{})
if err != nil {
t.Fatal(err)
}
runtime, err := NewRuntime(context.Background(), loaded, nil)
runtime, err := NewRuntime(context.Background(), loaded.Result, nil)
if err != nil {
t.Fatal(err)
}
@@ -211,11 +211,11 @@ func TestRepairPromptReplacementUsesMessageFile(t *testing.T) {
t.Fatal(err)
}
}
loaded, _, err := appconfig.Load(context.Background(), ck.Input{Source: ck.File(filepath.Join(dir, "config.yml"))}, "")
loaded, _, err := appconfig.Load(context.Background(), ck.Input{Source: ck.File(filepath.Join(dir, "config.yml"))}, appconfig.Options{})
if err != nil {
t.Fatal(err)
}
runtime, err := NewRuntime(context.Background(), loaded, nil)
runtime, err := NewRuntime(context.Background(), loaded.Result, nil)
if err != nil {
t.Fatal(err)
}