feat: add base template variables to API (#26425)

This commit is contained in:
Jeremy Ruppel
2026-06-17 12:22:35 -04:00
committed by GitHub
parent 6c95a618b4
commit 87de6dc23e
11 changed files with 258 additions and 54 deletions
+12
View File
@@ -41,6 +41,7 @@ type BaseManifest struct {
DisplayName string `json:"display_name"`
OS string `json:"os"`
DefaultContext BaseDefaultContext `json:"default_context"`
Variables []ModuleVariable `json:"variables"`
}
// BaseDefaultContext holds default render values stored in base.json.
@@ -192,6 +193,17 @@ func BaseTemplateIDs() []string {
return ids
}
// BaseVariables returns the user-facing variables for a given base
// template ID. Computed variables are excluded. Returns nil if the
// base is unknown or has no variables.
func BaseVariables(exampleID string) []ModuleVariable {
bases, err := loadBases()
if err != nil || bases[exampleID] == nil {
return nil
}
return bases[exampleID].Manifest.Variables
}
// BaseTemplateFS returns a filesystem rooted at the given base template
// directory within the embedded bases catalog. Returns an error if
// exampleID is not a known base template.