scaffold

package
v0.1.124 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 29 Imported by: 0

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

View Source
const AgentGuidanceLine = "" /* 362-byte string literal not displayed */

AgentGuidanceLine says where durable instructions go: one file every agent reads.

View Source
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 the Team notes below (`lidza note add`, MCP `lidza_note_add`), 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.

View Source
const DecisionsLine = "" /* 282-byte string literal not displayed */

DecisionsLine is the agent files' line about the decision log; Refresh adds it to apps that predate it.

View Source
const LayoutLine = "" /* 743-byte string literal not displayed */

LayoutLine places app-owned Go code without moving generated contracts.

View Source
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.

View Source
const Module = "github.com/agim/lidza"

Module is the framework's Go module path, required by every app.

Variables

View Source
var AgentPaths = []string{brief.AgentFile, "CLAUDE.md", "GEMINI.md", recipes.GuideFile, ".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

func AgentStamp(dir string) string

AgentStamp is the release named in the agent file's framework marker, "" when there is none.

func DeployFiles

func DeployFiles(dir string, cfg *config.Config, force bool) (written, kept []string, err error)

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

func E2EEnv(packs []string) []string

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

func EnsureMerging(dir string) ([]string, error)

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

func K8sFiles(dir string, cfg *config.Config, force bool) (written, kept []string, err error)

K8sFiles is DeployFiles plus deploy/k8s/<name>.yaml: a Deployment, Service and PodDisruptionBudget from the same contract.

func New

func New(ctx context.Context, opt Options) error

New creates an app.

func RecipesLine

func RecipesLine(rs []recipes.Recipe) string

RecipesLine lists recipe names for the agent files: the framework's, then the app's own.

func Refresh

func Refresh(dir string, cfg *config.Config) ([]string, error)

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

func ReleaseFor(dir string) string

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.

func TestEnv

func TestEnv(packs []string) []string

TestEnv are the .env.test lines the enabled packs need, so tests reach no service and no provider set in .env (which applies to tests too): the cache in memory, mail to the outbox, the fake model for chat and embeddings, storage on local disk.

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

func AppVersions(dir string) Versions

AppVersions reads dir/go.mod; a field it cannot tell is empty.

Jump to

Keyboard shortcuts

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