package projecttype // prompt.go builds the Layer 4 AI detection prompt. The prompt text itself is // the canonical `get-project-type` entry in the prompt library // (internal/prompts); this file only maps the catalog + tree + description into // the library's render input so there is a single reviewable source of truth // for the instruction string (auditable via `eeco show prompt get-project-type`). import ( "strings" "github.com/ajhahnde/eeco/internal/prompts" ) // buildDetectPrompt renders the full Layer 4 prompt: instructions + the // canonical-layouts catalog + the tree listing + optional operator free-text. // It is deterministic for a given (catalog, tree, description) triple so the // prompt_test.go golden stays stable. func buildDetectPrompt(cat *Catalog, tree []string, description string) (string, error) { data := prompts.GetProjectTypeData{ Categories: toPromptCategories(cat), Tree: tree, Description: strings.TrimSpace(description), } return prompts.Render(prompts.GetProjectType, data) } // toPromptCategories maps the embedded catalog into the prompt library's // render input shape (decoupled so the prompts package takes no projecttype // dependency). Categories are walked in the catalog's sorted order so the // rendered prompt is deterministic. func toPromptCategories(cat *Catalog) []prompts.Category { cats := cat.Categories() out := make([]prompts.Category, 0, len(cats)) for _, c := range cats { e, _ := cat.Get(c) out = append(out, prompts.Category{ Category: string(e.Category), Description: e.Description, PickWhen: e.PickWhen, Dirs: e.Dirs, }) } return out }