scaffold

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package scaffold provides shared template functions for generating eval suites, task files, and fixtures used by waza new skill/eval.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EvalYAML

func EvalYAML(name, engine, model string) string

EvalYAML returns a default eval.yaml template for the given skill name.

func Fixture

func Fixture() string

Fixture returns the default sample.py fixture content.

func ParseTriggerPhrases

func ParseTriggerPhrases(description string) (useFor []TriggerPhrase, doNotUseFor []TriggerPhrase)

ParseTriggerPhrases extracts USE FOR and DO NOT USE FOR phrases from a skill description field. Phrases may be quoted or comma-separated.

func ReadProjectDefaults

func ReadProjectDefaults() (engine, model string)

ReadProjectDefaults reads engine and model from .waza.yaml if it exists. Falls back to copilot-sdk and claude-sonnet-4.6.

func TaskFiles

func TaskFiles(_ string) map[string]string

TaskFiles returns a map of task filename to content.

func TitleCase

func TitleCase(s string) string

TitleCase converts a kebab-case name to Title Case.

func TriggerTestsYAML

func TriggerTestsYAML(skillName string, useFor, doNotUseFor []TriggerPhrase) string

TriggerTestsYAML generates a trigger_tests.yaml file from parsed phrases.

func ValidateName

func ValidateName(name string) error

ValidateName rejects names with path-traversal characters or empty names.

Types

type FileEntry

type FileEntry struct {
	Path    string // absolute path on disk
	Label   string // human-readable description
	IsDir   bool   // true for directories, false for files
	Content string // file content (ignored for directories)
}

FileEntry describes a file or directory to be written.

type FileOutcome

type FileOutcome int

FileOutcome describes what happened when processing a file entry.

const (
	// OutcomeCreated means the file or directory was newly created.
	OutcomeCreated FileOutcome = iota
	// OutcomeSkipped means the file or directory already existed.
	OutcomeSkipped
)

type FileWriter

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

FileWriter creates files and directories that don't exist, skipping those that do. It records an inventory of outcomes for each entry.

func NewFileWriter

func NewFileWriter(baseDir string) *FileWriter

NewFileWriter creates a FileWriter rooted at baseDir. Relative display paths in the inventory are computed against baseDir.

func (*FileWriter) Write

func (fw *FileWriter) Write(entries []FileEntry) (*Inventory, error)

Write processes each entry: creates missing files/directories and skips existing ones. Returns a structured Inventory of outcomes.

type Inventory

type Inventory struct {
	Items   []InventoryItem
	BaseDir string
}

Inventory holds the results of a FileWriter.Write call.

func (*Inventory) CreatedCount

func (inv *Inventory) CreatedCount() int

CreatedCount returns the number of items that were created.

func (*Inventory) Fprint

func (inv *Inventory) Fprint(w io.Writer)

Fprint writes the inventory table to w using emoji indicators.

type InventoryItem

type InventoryItem struct {
	Entry   FileEntry
	Outcome FileOutcome
	RelPath string // path relative to the base directory, used for display
}

InventoryItem records the outcome for a single file entry.

type TriggerPhrase

type TriggerPhrase struct {
	Prompt string
	Reason string
}

TriggerPhrase holds a parsed trigger or anti-trigger phrase.

Jump to

Keyboard shortcuts

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