scaffold

package
v0.4.0-rc.15 Latest Latest
Warning

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

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

Documentation

Overview

Package scaffold materializes agent project templates.

Index

Constants

View Source
const (
	// TemplVersion pins the templ CLI and runtime library. The generator and
	// the linked library MUST match — generated *_templ.go calls runtime
	// symbols the library must expose.
	TemplVersion = "v0.3.1020"
	// TailwindVersion pins the standalone Tailwind v4 binary (Rust, no Node).
	TailwindVersion = "v4.1.0"
	// DaisyUIVersion pins the DaisyUI plugin (daisyui.mjs / daisyui-theme.mjs)
	// the standalone Tailwind binary loads by path.
	DaisyUIVersion = "v5.5.23"
	// GoVersion is the toolchain version stamped into a scaffolded agent's
	// go.mod `go` directive and its Dockerfile `FROM golang:` tag. Three-
	// component form matches what `go mod tidy` rewrites the directive to on
	// Go 1.21+, so go.work/go.mod version checks don't trip.
	GoVersion = "1.26.0"
)

Frontend/build toolchain versions a scaffolded agent is pinned to. This is the single source of truth: the scaffold templates render from these consts (go.mod.tmpl's templ require, Dockerfile.tmpl's tailwind/daisyui ARGs), so a materialized agent can never drift from them. The airlock agent-builder image bakes the same toolchain at fixed paths for its iterative codegen loop; its Dockerfile ARGs are literals validated against these consts by airlock/scripts/check-versions.sh (Docker can't read a Go const, so the ARG stays a literal and the check enforces equality).

HTMXVersion lives in the agentsdk root package (assets.go) because htmx ships as an embedded runtime asset, not a build-time fetch.

View Source
const NoticesFilename = "THIRD_PARTY_NOTICES.generated.md"

NoticesFilename is the airlock-owned third-party notices file written into each agent. It is deliberately distinct from the conventional THIRD_PARTY_NOTICES.md so a user can keep their own notices there (for deps they add) without airlock's regeneration overwriting them.

Variables

This section is empty.

Functions

func GenerateAgentsMD

func GenerateAgentsMD(dir string, data ScaffoldData) error

GenerateAgentsMD renders the AGENTS.md template into dir/AGENTS.md. Called at scaffold time and by the build pipeline's housekeeping so previously built agents pick up doc updates — AGENTS.md is airlock-managed, not agent-owned. The template carries no substitutions today, but it's rendered (not copied) so future {{.Field}} additions Just Work.

func GenerateDockerfile

func GenerateDockerfile(dir string, data ScaffoldData) error

GenerateDockerfile renders the Dockerfile template into dir/Dockerfile. Called by the build pipeline before every docker build so agents always get the latest Dockerfile — even on upgrades of previously-built agents.

func GenerateNotices

func GenerateNotices(dir string) error

GenerateNotices writes the agent's third-party notices into dir as NoticesFilename. It's a verbatim copy of the embedded template (generated from the dep graph by scripts/gen-notices.sh), called at scaffold time and by the build pipeline's housekeeping so previously built agents pick up license updates. Airlock-owned — it never touches a user-authored THIRD_PARTY_NOTICES.md.

func Materialize

func Materialize(dir string, data ScaffoldData) error

Materialize renders all scaffold templates into dir using data. Panics if a template references a missing field in data.

Types

type ScaffoldData

type ScaffoldData struct {
	AgentID         string // UUID
	Module          string // Go module name for the agent (typically "agent")
	GoVersion       string // e.g., "1.26.0"; defaults to the GoVersion const when empty
	AgentSDKVersion string // displayed in the agent's go.mod require line (informational — replace directives are unconditional)
	AgentBaseImage  string // runtime base image referenced by the agent's Dockerfile (FROM line). Threaded from cfg.AgentBaseImage so operators can pin it (typically a versioned ghcr ref).

	// Toolchain versions rendered into go.mod.tmpl / Dockerfile.tmpl. Callers
	// leave these zero; applyToolchainVersions fills them from the package
	// consts (the single source of truth) before rendering.
	TemplVersion    string
	TailwindVersion string
	DaisyUIVersion  string
}

ScaffoldData holds values substituted into templates.

Jump to

Keyboard shortcuts

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