Documentation
¶
Overview ¶
Package scaffold implements `lidza new`: it copies a template and writes the Go entrypoint, lidza.json and the agent instruction files.
Index ¶
- Constants
- Variables
- func AgentStamp(dir string) string
- func DeployFiles(dir string, cfg *config.Config, force bool) (written, kept []string, err error)
- func E2EEnv(packs []string) []string
- func EnsureMerging(dir string) ([]string, error)
- func K8sFiles(dir string, cfg *config.Config, force bool) (written, kept []string, err error)
- func New(ctx context.Context, opt Options) error
- func RecipesLine(rs []recipes.Recipe) string
- func Refresh(dir string, cfg *config.Config) ([]string, error)
- func Release() string
- func ReleaseFor(dir string) string
- func TestEnv(packs []string) []string
- type Options
- type Versions
Constants ¶
const AgentGuidanceLine = "" /* 364-byte string literal not displayed */
AgentGuidanceLine says where durable instructions go: one file every agent reads.
const BriefLine = "Read `" + brief.File + "` first: what the app is for, who owns the data, the design, the services and the working agreements below. While it has open questions, start a session with the interview (recipe \"Start with the brief\": MCP `lidza_brief` and `lidza_brief_answer`; `lidza brief` in a terminal), asking the developer with suggestions, offering to skip any question or the whole brief, and never inventing an answer; a skipped question is never asked again. Lasting facts the developer states go in `docs/notes.md` (`lidza note add`, MCP `lidza_note_add`; `lidza note list --grep word`, MCP `lidza_notes`, finds the ones for an area), never in an agent's local memory: these files and `docs/` are shared through git."
BriefLine is the agent files' first line: the brief, the interview while it is open, and the rule that app knowledge is shared through git; Refresh adds it to apps that predate it.
const DecisionsLine = "" /* 353-byte string literal not displayed */
DecisionsLine is the agent files' line about the decision log; Refresh adds it to apps that predate it.
const LayoutLine = "" /* 743-byte string literal not displayed */
LayoutLine places app-owned Go code without moving generated contracts.
const MergeDriver = "lidza gen --merge-lock %O %A %B"
MergeDriver is the git configuration of the lock's merge driver: git does not version it, so every clone gets it from lidza gen.
const Module = "github.com/agim/lidza"
Module is the framework's Go module path, required by every app.
Variables ¶
var AgentPaths = []string{brief.AgentFile, "CLAUDE.md", "GEMINI.md", recipes.GuideFile, recipes.File, ".mcp.json", ".gemini/settings.json", ".codex/config.toml"}
AgentPaths are the files the framework keeps current for the agents: the instructions, the guide, each agent's MCP configuration.
Functions ¶
func AgentStamp ¶
AgentStamp is the release named in the agent file's framework marker, "" when there is none.
func DeployFiles ¶
DeployFiles renders the deployment files from the current templates: the Dockerfile, .dockerignore and deploy/<name>.service. A missing file is written; one that matches the template is left; one the app edited (or an older template wrote) is replaced only with force, else reported in kept, so `lidza update` can say which deployment files the new release would change.
The builder is pinned to the app's own versions (go.mod's framework release and Go version), not the CLI's, so the image builds what the app was tested with.
func E2EEnv ¶
E2EEnv are settings the browser suite runs the app with, on top of .env.test: sign-in and analytics limits it does not hit, since every account it signs up comes from one address. The Go tests keep the real limits, so a test of the throttle still sees it.
func EnsureMerging ¶
EnsureMerging adds the merge rules .gitattributes lacks and, in a git checkout without it, registers the lock's merge driver. It returns what it changed.
func K8sFiles ¶ added in v0.1.102
K8sFiles is DeployFiles plus deploy/k8s/<name>.yaml: a Deployment, Service and PodDisruptionBudget from the same contract.
func RecipesLine ¶
RecipesLine lists recipe names for the agent files: the framework's, then the app's own.
func Refresh ¶
Refresh brings an existing app up to date after the framework or the guide changed: the framework's recipes in the guide are replaced from the template (the app's own section is untouched), the skills and commands are rewritten, and the recipe list in the agent files is updated between its markers. It returns what changed, for the log.
func Release ¶
func Release() string
Release is the framework release this CLI is, "" for a build from source (a pseudo-version): only a release is recorded in the agent file, so building from a checkout never rewrites it.
func ReleaseFor ¶
ReleaseFor is Release for the app at dir: "" when its go.mod points the framework at a local checkout (the reference app, an app made with --lidza-dir), whose code a release number does not describe.
Types ¶
type Options ¶
type Options struct {
// Name is the app name: also the directory, the Go module path and the
// npm package name.
Name string
// Dir is where the app is created. Defaults to Name under the current
// directory.
Dir string
// Template is the template name (config.Default knows them).
Template string
// LidzaDir, when set, is a local checkout of the framework that the app's
// go.mod points at with a replace directive, instead of the published
// module. Used while developing Līdza itself.
LidzaDir string
// Out receives progress output. Defaults to io.Discard.
Out io.Writer
// SkipModTidy leaves go.mod without running the go tool (tests).
SkipModTidy bool
}
Options for New.
type Versions ¶
type Versions struct {
Lidza, Go, LocalPath string
}
goMinor returns the running toolchain's "1.N" for the go directive. Versions are what an app's go.mod pins: the framework release (with a versioned replace applied), the Go minor version (the toolchain line when newer than the go line), and the path of a local framework checkout a replace points at, which a container build cannot reach.
func AppVersions ¶
AppVersions reads dir/go.mod; a field it cannot tell is empty.