specs

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 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 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 are the request options for the model.
	RequestOptions map[string]any `json:"requestOptions,omitempty" yaml:"requestOptions,omitempty"`
	// ID is the unique identifier for the model.
	ID string `json:"id" yaml:"id"`
	// Name is the name of the model.
	Name string `json:"name" yaml:"name"`
	// URL is the URL of the model.
	URL string `json:"url" yaml:"url"`
	// Provider is the provider of the model.
	Provider Provider `json:"provider" yaml:"provider"`
	// Roles are the roles of the model.
	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 Sites added in v0.3.0

type Sites struct {
	// Name is the name of the site.
	Name string `json:"name" yaml:"name"`
	// 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"`
}

Sites defines the deployment configuration for the specification.

type Spec

type Spec struct {
	// Version is the version of the spec.
	Version int `json:"version" yaml:"version"`
	// Name is the name of the spec.
	Name string `json:"name,omitempty" yaml:"name"`
	// Root is the root directory of the spec.
	Root string `json:"root,omitempty" yaml:"root,omitempty"`
	// Description is the description of the spec.
	Description string `json:"description,omitempty" yaml:"description,omitempty"`
	// Rules define the rules for the spec.
	Rules Rules `json:"rules" yaml:"rules"`
	// Constitution is the constitution of the spec.
	Constitution string `json:"constitution" yaml:"constitution"`
	// Models define the models for the spec.
	Models []Model `json:"models,omitempty" yaml:"models,omitempty"`
	// Sites defines the deployment configuration for the specification.
	Sites *Sites `json:"sites,omitempty" yaml:"sites,omitempty"`
	// Tasks define the tasks for the spec.
	Tasks Tasks `json:"tasks" yaml:"tasks"`
}

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