Documentation
¶
Overview ¶
Package kittemplates renders the per-kit OpenTofu/Terramate template trees from the single canonical source under foundation/templates/.
foundation/templates/ is the source of truth. The committed per-kit trees (basement-kit/templates/, cloud-kit/templates/) are generated artifacts: edit foundation/templates/, then run `go generate ./...` (or `go run ./cmd/gen-kit-templates`). The freshness test in this package fails if a per-kit tree drifts from what the canonical source would produce, so the duplication can never be edited out of sync.
The canonical files carry three literal sentinels — substituted per kit — and are otherwise byte-identical to every kit. Sentinels are plain literals (not Go template directives) so the historical runtime `{{ ... }}` directives and HCL `${ ... }` interpolations pass through untouched. Native v2 generation does not consume these compatibility trees.
Index ¶
- Constants
- Variables
- func DisplayName(slug string) string
- func DisplayUpper(slug string) string
- func FindRepoRoot(start string) (string, error)
- func Generate(repoRoot string) error
- func RenderBytes(slug string, content []byte) []byte
- func RenderKit(canonicalDir, slug string) (map[string][]byte, error)
- type Kit
Constants ¶
const CanonicalDir = "foundation/templates"
CanonicalDir is the repo-relative path to the canonical template source.
Variables ¶
var Kits = []Kit{{Slug: "basement-kit"}, {Slug: "cloud-kit"}}
Kits is the ordered set of kits derived from the canonical templates.
Functions ¶
func DisplayName ¶
DisplayName returns the human kit name for a slug, e.g. "basement-kit" -> "Basement Kit".
func DisplayUpper ¶
DisplayUpper returns the all-caps banner form, e.g. "basement-kit" -> "BASEMENT KIT".
func FindRepoRoot ¶
FindRepoRoot walks up from start to locate the directory containing go.mod.
func Generate ¶
Generate (re)writes every kit's templates/ tree under repoRoot from the canonical source. Each kit's templates/ directory is removed and recreated so stale files cannot survive a regeneration.
func RenderBytes ¶
RenderBytes applies the kit substitutions to one canonical file's content and re-aligns any box-bordered banner line whose length changed as a result.