Refactor: load execution profiles from YAML and split prompt definitions into promptdef repository

This commit is contained in:
2026-05-05 10:18:28 -05:00
parent a633c67538
commit 7fffdaede3
25 changed files with 567 additions and 183 deletions

View File

@@ -2,6 +2,7 @@ package usecase
import (
"context"
"os"
"path/filepath"
"testing"
@@ -9,6 +10,7 @@ import (
"gitea.maximumdirect.net/eric/scriptorium/internal/domain"
"gitea.maximumdirect.net/eric/scriptorium/internal/profile"
"gitea.maximumdirect.net/eric/scriptorium/internal/prompt"
"gitea.maximumdirect.net/eric/scriptorium/internal/promptdef"
"gitea.maximumdirect.net/eric/scriptorium/internal/validate"
)
@@ -32,11 +34,17 @@ func TestRunnerIntegrationWithProfilesFixturesAndValidation(t *testing.T) {
}
profilesDir := filepath.Join(root, "profiles")
execProfilesDir := t.TempDir()
schemasDir := filepath.Join(root, "schemas")
fixturesDir := filepath.Join(root, "examples", "fixtures")
if err := os.WriteFile(filepath.Join(execProfilesDir, "local-default.yaml"), []byte(
"id: local-default\nendpoint: http://llm/v1\nmodel: test-model\n"), 0644); err != nil {
t.Fatalf("failed to write execution profile fixture: %v", err)
}
runner := NewRunner(
profile.NewFilesystemRepository(profilesDir),
promptdef.NewFilesystemRepository(profilesDir),
profile.NewFilesystemRepository(execProfilesDir),
artifact.NewCompositeReader(),
prompt.NewGoRenderer(),
&integrationLLM{},
@@ -45,11 +53,7 @@ func TestRunnerIntegrationWithProfilesFixturesAndValidation(t *testing.T) {
res, err := runner.Run(context.Background(), domain.RunRequest{
PromptID: "generic.structured_events",
ProfileID: "exec",
Execution: &domain.ExecutionTarget{
Endpoint: "http://llm/v1",
Model: "test-model",
},
ProfileID: "local-default",
Inputs: map[string]domain.ArtifactRef{
"transcript": {
Type: domain.ArtifactRefFile,