kittemplates

package
v0.41.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 24, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

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

View Source
const CanonicalDir = "foundation/templates"

CanonicalDir is the repo-relative path to the canonical template source.

Variables

View Source
var Kits = []Kit{{Slug: "basement-kit"}, {Slug: "cloud-kit"}}

Kits is the ordered set of kits derived from the canonical templates.

Functions

func DisplayName

func DisplayName(slug string) string

DisplayName returns the human kit name for a slug, e.g. "basement-kit" -> "Basement Kit".

func DisplayUpper

func DisplayUpper(slug string) string

DisplayUpper returns the all-caps banner form, e.g. "basement-kit" -> "BASEMENT KIT".

func FindRepoRoot

func FindRepoRoot(start string) (string, error)

FindRepoRoot walks up from start to locate the directory containing go.mod.

func Generate

func Generate(repoRoot string) error

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

func RenderBytes(slug string, content []byte) []byte

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.

func RenderKit

func RenderKit(canonicalDir, slug string) (map[string][]byte, error)

RenderKit returns the materialized file set for one kit as a map of canonical-relative (slash-separated) path -> content.

Types

type Kit

type Kit struct{ Slug string }

Kit identifies a derived product kit. Slug is also the output directory name and matches the kit's stackkit.yaml metadata.name.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL