templates

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package templates provides embedded templates for role contexts and messages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommandNames

func CommandNames() ([]string, error)

CommandNames returns the list of embedded slash commands.

func GetAllRoleTemplates

func GetAllRoleTemplates() (map[string][]byte, error)

GetAllRoleTemplates returns all role templates as a map of filename to content.

func HasCommands

func HasCommands(workspacePath string) bool

HasCommands checks if a workspace has the .cursor/commands/ directory provisioned.

func MissingCommands

func MissingCommands(workspacePath string) ([]string, error)

MissingCommands returns the list of embedded commands missing from the workspace.

func ProvisionCommands

func ProvisionCommands(workspacePath string) error

ProvisionCommands creates the .cursor/commands/ directory with standard slash commands. This ensures crew/polecat workspaces have the handoff command and other utilities even if the source repo doesn't have them tracked. If a command already exists, it is skipped (no overwrite).

Types

type EscalationData

type EscalationData struct {
	Polecat     string
	Issue       string
	Reason      string
	NudgeCount  int
	LastStatus  string
	Suggestions []string
}

EscalationData contains information for escalation messages.

type HandoffData

type HandoffData struct {
	Role        string
	CurrentWork string
	Status      string
	NextSteps   []string
	Notes       string
	PendingMail int
	GitBranch   string
	GitDirty    bool
}

HandoffData contains information for session handoff messages.

type NudgeData

type NudgeData struct {
	Polecat    string
	Reason     string
	NudgeCount int
	MaxNudges  int
	Issue      string
	Status     string
}

NudgeData contains information for nudge messages.

type RoleData

type RoleData struct {
	Role          string   // mayor, witness, refinery, polecat, crew, deacon
	RigName       string   // e.g., "greenplace"
	TownRoot      string   // e.g., "/Users/steve/ai"
	TownName      string   // e.g., "ai" - the town identifier for session names
	WorkDir       string   // current working directory
	DefaultBranch string   // default branch for merges (e.g., "main", "develop")
	Polecat       string   // polecat name (for polecat role)
	Polecats      []string // list of polecats (for witness role)
	BeadsDir      string   // BEADS_DIR path
	IssuePrefix   string   // beads issue prefix
	MayorSession  string   // e.g., "gt-ai-mayor" - dynamic mayor session name
	DeaconSession string   // e.g., "gt-ai-deacon" - dynamic deacon session name
	Provider      string   // model provider: "anthropic", "openai", "google" (for template selection)
	Model         string   // specific model being used
}

RoleData contains information for rendering role contexts.

type SpawnData

type SpawnData struct {
	Issue       string
	Title       string
	Priority    int
	Description string
	Branch      string
	RigName     string
	Polecat     string
}

SpawnData contains information for spawn assignment messages.

type Templates

type Templates struct {
	// contains filtered or unexported fields
}

Templates manages role and message templates.

func New

func New() (*Templates, error)

New creates a new Templates instance.

func (*Templates) MessageNames

func (t *Templates) MessageNames() []string

MessageNames returns the list of available message templates.

func (*Templates) ProviderTemplateNames

func (t *Templates) ProviderTemplateNames() map[string][]string

ProviderTemplateNames returns the list of provider-specific role templates.

func (*Templates) RenderMessage

func (t *Templates) RenderMessage(name string, data interface{}) (string, error)

RenderMessage renders a message template.

func (*Templates) RenderRole

func (t *Templates) RenderRole(role string, data RoleData) (string, error)

RenderRole renders a role context template. If data.Provider is set and a provider-specific template exists, it uses that. Otherwise, it falls back to the default template.

func (*Templates) RenderRoleForProvider

func (t *Templates) RenderRoleForProvider(role, provider string, data RoleData) (string, error)

RenderRoleForProvider renders a role template optimized for a specific provider. Falls back to default template if no provider-specific template exists.

func (*Templates) RoleNames

func (t *Templates) RoleNames() []string

RoleNames returns the list of available role templates.

Jump to

Keyboard shortcuts

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