@@ -13,14 +13,26 @@ import (
1313)
1414
1515// builtinSource is the template source used by generation and the template
16- // tooling: custom templates in the store (~/.devstack/templates) override the
17- // embedded built-ins by name; the embedded set is always the fallback.
16+ // tooling. Resolution priority is embedded < store < remote (first match wins in
17+ // the chain, so the highest-priority source is listed first): a digest-pinned
18+ // REMOTE template (spec 19) overrides a store template, which overrides an
19+ // embedded built-in of the same name. A cold/missing remote cache contributes
20+ // nothing, keeping generation offline-first and deterministic (with no remote
21+ // templates registered the chain is byte-identical to the pre-spec-19 behavior).
1822func builtinSource () template.TemplateSource {
1923 embedded := template .NewFSSource (templates .FS )
24+ var chain []template.TemplateSource
25+ if remote := remoteTemplateSource (); remote != nil {
26+ chain = append (chain , remote )
27+ }
2028 if dir := userTemplatesDir (); dir != "" {
21- return template .NewChainSource (template .NewFSSource (os .DirFS (dir )), embedded )
29+ chain = append (chain , template .NewFSSource (os .DirFS (dir )))
30+ }
31+ if len (chain ) == 0 {
32+ return embedded
2233 }
23- return embedded
34+ chain = append (chain , embedded )
35+ return template .NewChainSource (chain ... )
2436}
2537
2638// newGenerateCmd wires `devstack generate` — the M1 deterministic pipeline entry
0 commit comments