specs

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// Default values for the spec.
	DefaultVersion = 1
	// DefaultName is the default filename for the spec file. It can be changed in the builder configuration.
	DefaultName = ".builder.yml"
	// DefaultFolder is the default folder where the spec file is stored.
	DefaultFolder = ".builder"
)

Variables

View Source
var Files embed.FS

Functions

func Write

func Write(s *Spec, file string, force bool) error

Write is the write function for the spec.

Types

type Context

type Context struct {
	// Requires is the list of requirements for the task.
	Requires []string `json:"requires,omitempty" yaml:"requires,omitempty"`
	// Instruction is the instruction for the task.
	Instruction string `json:"instruction" yaml:"instruction"`
	// TrackBy is the list of fields to track by.
	TrackBy []string `json:"trackBy,omitempty" yaml:"trackBy,omitempty"`
	// Documents is the list of documents for the task.
	Documents Documents `json:"documents" yaml:"documents"`
}

Context is the context for a task.

type Deploy

type Deploy struct {
	// Path is the path to the deployment configuration file.
	Path string `json:"path" yaml:"path"`
	// Site is the name of the site to deploy to.
	Site string `json:"site" yaml:"site"`
	// Ignore is a list of files to ignore during deployment.
	Ignore []string `json:"ignore" yaml:"ignore"`
}

Deploy defines the deployment configuration for the specification.

type Document

type Document struct {
	// ID identifies a document in the specification.
	ID string `json:"id" yaml:"id"`
	// Generates the document from the task's output.
	Generates string `json:"generates" yaml:"generates"`
	// Description is the description of the document.
	Description string `json:"description,omitempty" yaml:"description,omitempty"`
	// Instruction is the instruction for generating the document.
	Instruction string `json:"instruction" yaml:"instruction"`
	// Template is the basis for the document.
	Template string `json:"template" yaml:"template"`
}

Documents is the documents for the specification.

type Documents

type Documents []Document

Documents is the documents for the specification.

type Model

type Model struct {
	RequestOptions map[string]any `json:"requestOptions,omitempty" yaml:"requestOptions,omitempty"`
	ID             string         `json:"id" yaml:"id"`
	Name           string         `json:"name" yaml:"name"`
	URL            string         `json:"url" yaml:"url"`
	Provider       Provider       `json:"provider" yaml:"provider"`
	Roles          []string       `json:"roles" yaml:"roles"`
}

Model specifies a model.

type Provider

type Provider string

Provider is a string that specifies the provider for a model. For example, openai, azure, etc.

type Rule

type Rule string

Rule defines a rule for the specification.

type Rules

type Rules map[string][]Rule

Rules defines the rules for the specification.

type Spec

type Spec struct {
	Version      int     `json:"version" yaml:"version"`
	Name         string  `json:"name,omitempty" yaml:"name"`
	Description  string  `json:"description,omitempty" yaml:"description,omitempty"`
	Rules        Rules   `json:"rules" yaml:"rules"`
	Constitution string  `json:"constitution" yaml:"constitution"`
	Models       []Model `json:"models,omitempty" yaml:"models,omitempty"`
	Deploy       *Deploy `json:"domain,omitempty" yaml:"domain,omitempty"`
	Tasks        Tasks   `json:"tasks" yaml:"tasks"`
	Root         string  `json:"root,omitempty" yaml:"root,omitempty"`
}

Spec defines the structure for a specification document. This could be used in various contexts such as API specifications, software design documents, etc.

func Default

func Default() *Spec

Default return a default instance of the spec.

func Example

func Example() (*Spec, error)

Example returns a default instance of an example.

func New

func New() *Spec

New returns a new instance of Spec with default values.

func (*Spec) UnmarshalYAML

func (s *Spec) UnmarshalYAML(data []byte) error

UnmarshalYAML unmarshals YAML data into a Spec struct.

type Task

type Task struct {
	// ID is the ID of the task.
	ID string `json:"id" yaml:"id"`
	// Name is the name of the task.
	Name string `json:"name" yaml:"name"`
	// Description is the description of the task.
	Description string `json:"description" yaml:"description"`
	// Context is the context for the task.
	Context Context `json:"context" yaml:"context"`
}

Task defines a specifiction.

type Tasks

type Tasks map[string]Task

Tasks defines the tasks for the specification.

Jump to

Keyboard shortcuts

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