Documentation
¶
Overview ¶
Package scaffold writes the files of a new Backyard project (`backyard init` and the MCP tool backyard_init) and provides SafeJoin, the path guard used whenever the CLI writes files whose names come from elsewhere (templates, `backyard pull`).
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Agents = []string{"claude", "codex", "cursor", "copilot"}
Agents are the agent integrations `backyard init --agents` accepts.
Functions ¶
func ParseAgents ¶
ParseAgents splits a comma-separated agent list, validating each name.
func SafeJoin ¶
SafeJoin joins a "/"-separated relative path onto root, rejecting absolute paths, ".." segments, backslashes, drive letters, and paths whose existing parent directories inside root are symlinks or files (which could redirect writes outside root). An existing symlink as the final element is rejected as well.
Types ¶
type Options ¶
type Options struct {
// Dir is the project directory (created when missing).
Dir string
// Site is the site name (validated against config.DefaultReserved).
Site string
// Server is the hub URL recorded in generated docs ("" when unknown).
Server string
// BaseDomain and URLMode describe Server when known (its /info), so
// the docs name the exact site URL (templates.InitOptions).
BaseDomain string
URLMode string
// Agents selects agent files (default: the templates' default).
Agents []string
// Template is the template name (default: the templates' default).
Template string
// Force overwrites existing files.
Force bool
// Render renders the files (default templates.Render).
Render Renderer
}
Options configure Init.
type Renderer ¶
type Renderer func(templates.InitOptions) (map[string][]byte, error)
Renderer renders the files of a new project (templates.Render).
type Result ¶
type Result struct {
Dir string `json:"dir"`
Site string `json:"site,omitempty"`
Created []string `json:"created"`
Overwritten []string `json:"overwritten"`
Skipped []string `json:"skipped"`
}
Result reports what Init or Write did. Paths are "/"-separated and relative to Dir.
func Init ¶
Init validates the site name, renders the project files and writes them to o.Dir without overwriting existing files unless o.Force.