Help us shape the future of Go! Take the 2026 Go Developer Survey

templates

package
v0.4.0 Latest Latest
Warning

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

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

Documentation

Overview

Package templates renders the files written by `backyard init` (and the MCP tool backyard_init): the starter page(s), .backyard.json, .backyardignore, and the instructions for coding agents — CLAUDE.md plus the embedded Backyard skill for Claude Code, AGENTS.md for Codex and other AGENTS.md-aware agents, a Cursor project rule and GitHub Copilot repository instructions.

Template sources live in templates/files and are embedded in the binary. Files ending in .tmpl are Go text/templates; the API cheat sheet, decision table and limits in the agent files are extracted from the skill's SKILL.md so they never drift from it.

Index

Constants

View Source
const (
	// TemplateBlank is a single index.html starter (the default).
	TemplateBlank = "blank"
	// TemplateApp is an app skeleton: index.html, app.js and style.css.
	TemplateApp = "app"
	// DefaultTemplate is used when InitOptions.Template is empty.
	DefaultTemplate = TemplateBlank
)

Template names accepted by Render.

View Source
const (
	AgentClaude  = "claude"  // CLAUDE.md + .claude/skills/backyard/**
	AgentCodex   = "codex"   // AGENTS.md
	AgentCursor  = "cursor"  // .cursor/rules/backyard.mdc
	AgentCopilot = "copilot" // .github/copilot-instructions.md
)

Agent integrations accepted in InitOptions.Agents.

View Source
const (
	ProjectFile    = ".backyard.json"
	IgnoreFile     = ".backyardignore"
	ClaudeFile     = "CLAUDE.md"
	ClaudeSkillDir = ".claude/skills/backyard"
	AgentsFile     = "AGENTS.md"
	CursorRuleFile = ".cursor/rules/backyard.mdc"
	CopilotFile    = ".github/copilot-instructions.md"
)

Output paths of the generated files.

Variables

This section is empty.

Functions

func DefaultAgents

func DefaultAgents() []string

DefaultAgents returns the agents used when InitOptions.Agents is empty.

func KnownAgents

func KnownAgents() []string

KnownAgents returns every agent integration Render supports.

func Render

func Render(opts InitOptions) (map[string][]byte, error)

Render returns the files to create, keyed by "/"-separated relative path. It always includes .backyard.json; index.html unless SkipIndex; CLAUDE.md and .claude/skills/backyard/** for "claude"; AGENTS.md for "codex"; .cursor/rules/backyard.mdc for "cursor"; .github/copilot-instructions.md for "copilot". Callers must not overwrite existing files without consent.

It also always includes a default .backyardignore. With the "app" template the page is index.html, app.js and style.css; SkipIndex omits all three. Invalid options (an unknown agent or template, a malformed site name or server URL) are reported as errors.

func Templates

func Templates() []string

Templates returns the available template names.

Types

type InitOptions

type InitOptions struct {
	Site      string   // site name (validated by caller)
	Server    string   // hub URL, may be ""
	Agents    []string // any of: claude, codex, cursor, copilot (default: claude, codex)
	Template  string   // blank (default) | app
	SkipIndex bool     // do not write index.html (existing project)
	// BaseDomain and URLMode describe the server (its /info base_domain
	// and url_mode) when known: host-mode sites live at
	// <scheme>://<site>.<base_domain>[:port]/, and base_domain may differ
	// from the hub's host. Empty: guessed from Server.
	BaseDomain string
	URLMode    string // host | path | ""
}

InitOptions configure Render.

Jump to

Keyboard shortcuts

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