contract

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureDefault

func EnsureDefault(path, projectName string) (bool, error)

func Save

func Save(path string, contract *Contract) error

Types

type AgentTarget

type AgentTarget struct {
	Output       string   `yaml:"output"`
	MCPOutput    string   `yaml:"mcp_output,omitempty"`
	Header       string   `yaml:"header,omitempty"`
	Instructions []string `yaml:"instructions,omitempty"`
}

type Bootstrap

type Bootstrap struct {
	Steps   []BootstrapStep   `yaml:"steps"`
	Outputs []BootstrapOutput `yaml:"outputs,omitempty"`
}

type BootstrapOutput

type BootstrapOutput struct {
	Path      string `yaml:"path"`
	Kind      string `yaml:"kind,omitempty"`
	Gitignore bool   `yaml:"gitignore,omitempty"`
	Header    string `yaml:"header,omitempty"`
	Mode      string `yaml:"mode,omitempty"`
}

type BootstrapStep

type BootstrapStep struct {
	Name        string `yaml:"name,omitempty"`
	Run         string `yaml:"run"`
	Shell       string `yaml:"shell,omitempty"`
	Optional    bool   `yaml:"optional,omitempty"`
	Description string `yaml:"description,omitempty"`
}

func (*BootstrapStep) UnmarshalYAML

func (s *BootstrapStep) UnmarshalYAML(node *yaml.Node) error

type Contract

type Contract struct {
	Version   int                    `yaml:"version"`
	Project   Project                `yaml:"project"`
	Env       EnvSpec                `yaml:"env"`
	Runtimes  []Runtime              `yaml:"runtimes"`
	Services  []Service              `yaml:"services"`
	Bootstrap Bootstrap              `yaml:"bootstrap"`
	Doctor    Doctor                 `yaml:"doctor"`
	Agents    map[string]AgentTarget `yaml:"agents"`
	MCP       MCPConfig              `yaml:"mcp"`
	Policies  Policies               `yaml:"policies"`
	Run       RunConfig              `yaml:"run"`
}

func Default

func Default(projectName string) *Contract

func Load

func Load(path string) (*Contract, error)

func LoadProject

func LoadProject() (*Contract, string, error)

func (*Contract) AllEnvNames

func (c *Contract) AllEnvNames() []string

func (*Contract) EffectiveAgentTarget

func (c *Contract) EffectiveAgentTarget(name string) (AgentTarget, bool)

func (*Contract) Normalize

func (c *Contract) Normalize()

func (*Contract) Validate

func (c *Contract) Validate() *ValidationReport

type Doctor

type Doctor struct {
	Checks []DoctorCheck `yaml:"checks,omitempty"`
}

type DoctorCheck

type DoctorCheck struct {
	Name     string `yaml:"name"`
	Type     string `yaml:"type"`
	Target   string `yaml:"target,omitempty"`
	Required bool   `yaml:"required,omitempty"`
}

type EnvSpec

type EnvSpec struct {
	Required []EnvVar `yaml:"required"`
	Optional []EnvVar `yaml:"optional"`
	Public   []string `yaml:"public"`
}

type EnvVar

type EnvVar struct {
	Name        string `yaml:"name"`
	Source      string `yaml:"source,omitempty"`
	Description string `yaml:"description,omitempty"`
}

func (*EnvVar) UnmarshalYAML

func (e *EnvVar) UnmarshalYAML(node *yaml.Node) error

type MCPConfig

type MCPConfig struct {
	Servers []MCPServer `yaml:"servers"`
}

type MCPServer

type MCPServer struct {
	Name        string   `yaml:"name"`
	Command     string   `yaml:"command"`
	Args        []string `yaml:"args,omitempty"`
	Env         []string `yaml:"env,omitempty"`
	Description string   `yaml:"description,omitempty"`
}

type Policies

type Policies struct {
	RedactPaths   []string `yaml:"redact_paths,omitempty"`
	BlockPatterns []string `yaml:"block_patterns,omitempty"`
}

type Project

type Project struct {
	Slug    string `yaml:"slug"`
	Name    string `yaml:"name,omitempty"`
	Summary string `yaml:"summary,omitempty"`
}

type RunConfig

type RunConfig struct {
	Default string               `yaml:"default,omitempty"`
	Targets map[string]RunTarget `yaml:"targets,omitempty"`
}

type RunTarget

type RunTarget struct {
	Command     string `yaml:"command"`
	Description string `yaml:"description,omitempty"`
}

type Runtime

type Runtime struct {
	Name       string   `yaml:"name"`
	Binary     string   `yaml:"binary,omitempty"`
	VersionArg []string `yaml:"version_args,omitempty"`
	Required   bool     `yaml:"required,omitempty"`
}

func (*Runtime) UnmarshalYAML

func (r *Runtime) UnmarshalYAML(node *yaml.Node) error

type Service

type Service struct {
	Name        string `yaml:"name"`
	Host        string `yaml:"host,omitempty"`
	Port        int    `yaml:"port"`
	Required    bool   `yaml:"required,omitempty"`
	Start       string `yaml:"start,omitempty"`
	Description string `yaml:"description,omitempty"`
}

type ValidationReport

type ValidationReport struct {
	Errors   []string
	Warnings []string
}

func (*ValidationReport) AddError

func (r *ValidationReport) AddError(format string, args ...any)

func (*ValidationReport) AddWarning

func (r *ValidationReport) AddWarning(format string, args ...any)

func (*ValidationReport) OK

func (r *ValidationReport) OK() bool

Jump to

Keyboard shortcuts

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