types

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package types defines the core data structures for visionspec.

Package types defines the core data structures for visionspec.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AIDLCConfig added in v0.6.0

type AIDLCConfig struct {
	Enabled   bool   `json:"enabled" yaml:"enabled"`
	OutputDir string `json:"output_dir,omitempty" yaml:"output_dir,omitempty"` // default: ".aidlc"
}

AIDLCConfig configures the AWS AI-DLC Workflows export target.

type Approval

type Approval struct {
	Approver   string    `json:"approver" yaml:"approver"`
	ApprovedAt time.Time `json:"approved_at" yaml:"approved_at"`
	Comment    string    `json:"comment,omitempty" yaml:"comment,omitempty"`
}

Approval represents an approval record for a spec.

type ContextConfig

type ContextConfig struct {
	// Repositories are git repositories to analyze.
	Repositories []RepositoryContextConfig `json:"repositories,omitempty" yaml:"repositories,omitempty"`

	// Graphize are standalone graphize graph paths.
	Graphize []GraphizeContextConfig `json:"graphize,omitempty" yaml:"graphize,omitempty"`

	// Files are local files to include as context.
	Files []FileContextConfig `json:"files,omitempty" yaml:"files,omitempty"`

	// MCPServers are MCP servers for external context.
	MCPServers map[string]MCPServerContextConfig `json:"mcp_servers,omitempty" yaml:"mcp_servers,omitempty"`

	// CacheTTL is how long to cache context data.
	CacheTTL time.Duration `json:"cache_ttl,omitempty" yaml:"cache_ttl,omitempty"`
}

ContextConfig configures context sources for grounding specs.

type ExecutionState added in v0.7.0

type ExecutionState struct {
	Target   string           `json:"target" yaml:"target"`
	SyncedAt time.Time        `json:"synced_at" yaml:"synced_at"`
	Tasks    []ExecutionTask  `json:"tasks" yaml:"tasks"`
	Summary  ExecutionSummary `json:"summary" yaml:"summary"`
}

ExecutionState tracks the state of tasks in an exported target.

type ExecutionSummary added in v0.7.0

type ExecutionSummary struct {
	TotalTasks int `json:"total_tasks" yaml:"total_tasks"`
	TodoCount  int `json:"todo_count" yaml:"todo_count"`
	InProgress int `json:"in_progress" yaml:"in_progress"`
	DoneCount  int `json:"done_count" yaml:"done_count"`
}

ExecutionSummary provides aggregate statistics.

type ExecutionTask added in v0.7.0

type ExecutionTask struct {
	ID     string `json:"id" yaml:"id"`
	Title  string `json:"title" yaml:"title"`
	Status string `json:"status" yaml:"status"` // todo, in_progress, done, blocked
}

ExecutionTask represents a task in the execution state.

type FileContextConfig

type FileContextConfig struct {
	Path    string `json:"path" yaml:"path"`
	Type    string `json:"type,omitempty" yaml:"type,omitempty"`
	MaxSize int64  `json:"max_size,omitempty" yaml:"max_size,omitempty"`
}

FileContextConfig configures a local file context source.

type GSDConfig

type GSDConfig struct {
	Enabled      bool   `json:"enabled" yaml:"enabled"`
	OutputDir    string `json:"output_dir,omitempty" yaml:"output_dir,omitempty"`
	ModelProfile string `json:"model_profile,omitempty" yaml:"model_profile,omitempty"` // "balanced", "quality", "budget"
}

GSDConfig configures the GSD export target.

type GasCityConfig

type GasCityConfig struct {
	Enabled bool   `json:"enabled" yaml:"enabled"`
	CityDir string `json:"city_dir,omitempty" yaml:"city_dir,omitempty"`
}

GasCityConfig configures the GasCity export target.

type GasTownConfig

type GasTownConfig struct {
	Enabled     bool   `json:"enabled" yaml:"enabled"`
	FormulaType string `json:"formula_type,omitempty" yaml:"formula_type,omitempty"` // "convoy", "workflow", "expansion"
	Rig         string `json:"rig,omitempty" yaml:"rig,omitempty"`
}

GasTownConfig configures the GasTown export target.

type GraphizeContextConfig

type GraphizeContextConfig struct {
	Path         string   `json:"path" yaml:"path"`
	Name         string   `json:"name,omitempty" yaml:"name,omitempty"`
	IncludeNodes []string `json:"include_nodes,omitempty" yaml:"include_nodes,omitempty"`
	IncludeEdges []string `json:"include_edges,omitempty" yaml:"include_edges,omitempty"`
}

GraphizeContextConfig configures a graphize context source.

type LLMConfig

type LLMConfig struct {
	// Provider is the LLM provider (anthropic, openai, gemini, etc.).
	Provider string `json:"provider,omitempty" yaml:"provider,omitempty"`

	// Model is the specific model to use (e.g., claude-sonnet-4-20250514, gpt-4o).
	Model string `json:"model,omitempty" yaml:"model,omitempty"`

	// Temperature controls randomness (0.0 = deterministic, higher = more random).
	Temperature *float64 `json:"temperature,omitempty" yaml:"temperature,omitempty"`

	// MaxTokens limits the response length.
	MaxTokens *int `json:"max_tokens,omitempty" yaml:"max_tokens,omitempty"`
}

LLMConfig configures the LLM provider for a project.

type MCPServerContextConfig

type MCPServerContextConfig struct {
	Command string            `json:"command" yaml:"command"`
	Args    []string          `json:"args,omitempty" yaml:"args,omitempty"`
	Env     map[string]string `json:"env,omitempty" yaml:"env,omitempty"`
	Config  map[string]any    `json:"config,omitempty" yaml:"config,omitempty"`
	Timeout time.Duration     `json:"timeout,omitempty" yaml:"timeout,omitempty"`
}

MCPServerContextConfig configures an MCP server context source.

type OpenSpecConfig

type OpenSpecConfig struct {
	Enabled bool `json:"enabled" yaml:"enabled"`
}

OpenSpecConfig configures the OpenSpec export target.

type Project

type Project struct {
	// Name is the project identifier (kebab-case).
	Name string `json:"name" yaml:"name"`

	// Path is the absolute path to the project directory.
	Path string `json:"path" yaml:"path"`

	// Constitution is the path to the constitution file (relative or absolute).
	Constitution string `json:"constitution,omitempty" yaml:"constitution,omitempty"`

	// LLM configures the LLM provider for evaluations and synthesis.
	LLM *LLMConfig `json:"llm,omitempty" yaml:"llm,omitempty"`

	// Specs contains the status of each spec in the project.
	Specs map[SpecType]*Spec `json:"specs,omitempty" yaml:"specs,omitempty"`

	// Approvals tracks approval status for each spec.
	Approvals map[SpecType]*Approval `json:"approvals,omitempty" yaml:"approvals,omitempty"`

	// Targets configures export targets.
	Targets TargetConfig `json:"targets,omitempty" yaml:"targets,omitempty"`

	// SpecRequirements configures which specs are required and their settings.
	// This appears as "spec_config:" in visionspec.yaml.
	SpecRequirements map[string]*SpecRequirement `json:"spec_config,omitempty" yaml:"spec_config,omitempty"`

	// Context configures context sources for grounding.
	Context *ContextConfig `json:"context,omitempty" yaml:"context,omitempty"`

	// Rubrics configures custom rubric loading.
	Rubrics *RubricsConfig `json:"rubrics,omitempty" yaml:"rubrics,omitempty"`

	// Execution tracks the state of exported execution targets.
	Execution *ExecutionState `json:"execution,omitempty" yaml:"execution,omitempty"`

	// CreatedAt is when the project was initialized.
	CreatedAt time.Time `json:"created_at" yaml:"created_at"`

	// UpdatedAt is when the project was last modified.
	UpdatedAt time.Time `json:"updated_at" yaml:"updated_at"`
}

Project represents a visionspec project.

func (*Project) GetSpecConfig

func (p *Project) GetSpecConfig() *SpecConfig

GetSpecConfig returns a SpecConfig wrapper for the project's spec requirements. This provides helper methods like IsRequired(), GetCategory(), etc.

type ReadinessGate

type ReadinessGate struct {
	Name    string `json:"name" yaml:"name"`
	Passed  bool   `json:"passed" yaml:"passed"`
	Message string `json:"message,omitempty" yaml:"message,omitempty"`
}

ReadinessGate represents a readiness check for a project.

type ReadinessStatus

type ReadinessStatus struct {
	Ready   bool            `json:"ready" yaml:"ready"`
	Gates   []ReadinessGate `json:"gates" yaml:"gates"`
	Summary string          `json:"summary" yaml:"summary"`
}

ReadinessStatus represents the overall readiness of a project.

type RepositoryContextConfig

type RepositoryContextConfig struct {
	Path     string   `json:"path,omitempty" yaml:"path,omitempty"`
	URL      string   `json:"url,omitempty" yaml:"url,omitempty"`
	Branch   string   `json:"branch,omitempty" yaml:"branch,omitempty"`
	Include  []string `json:"include,omitempty" yaml:"include,omitempty"`
	Exclude  []string `json:"exclude,omitempty" yaml:"exclude,omitempty"`
	Analyze  []string `json:"analyze,omitempty" yaml:"analyze,omitempty"`
	Graphize string   `json:"graphize,omitempty" yaml:"graphize,omitempty"`
	MaxDepth int      `json:"max_depth,omitempty" yaml:"max_depth,omitempty"`
}

RepositoryContextConfig configures a git repository context source.

type RubricsConfig

type RubricsConfig struct {
	// Directory is a path to a directory containing .rubric.yaml files.
	// Rubrics are named: {spec-type}.rubric.yaml (e.g., prd.rubric.yaml).
	Directory string `json:"directory,omitempty" yaml:"directory,omitempty"`

	// Overrides maps spec types to specific rubric file paths.
	// This allows using different rubric files for specific specs.
	Overrides map[SpecType]string `json:"overrides,omitempty" yaml:"overrides,omitempty"`

	// StrictMode requires all categories to pass (no partial scores).
	StrictMode bool `json:"strict_mode,omitempty" yaml:"strict_mode,omitempty"`

	// MaxCritical is the maximum number of critical findings allowed (default: 0).
	MaxCritical int `json:"max_critical,omitempty" yaml:"max_critical,omitempty"`

	// MaxHigh is the maximum number of high findings allowed (default: 0).
	MaxHigh int `json:"max_high,omitempty" yaml:"max_high,omitempty"`

	// MaxMedium is the maximum number of medium findings allowed (-1 = unlimited).
	MaxMedium int `json:"max_medium,omitempty" yaml:"max_medium,omitempty"`
}

RubricsConfig configures custom rubric loading for a project.

type Spec

type Spec struct {
	Type      SpecType   `json:"type" yaml:"type"`
	Path      string     `json:"path" yaml:"path"`
	Status    SpecStatus `json:"status" yaml:"status"`
	UpdatedAt time.Time  `json:"updated_at" yaml:"updated_at"`
	Checksum  string     `json:"checksum,omitempty" yaml:"checksum,omitempty"`
}

Spec represents a specification document.

type SpecCategory

type SpecCategory string

SpecCategory groups spec types by their category.

const (
	CategorySource    SpecCategory = "source"
	CategoryGTM       SpecCategory = "gtm"
	CategoryTechnical SpecCategory = "technical"
	CategoryOutput    SpecCategory = "output"
)

type SpecConfig

type SpecConfig struct {
	// Specs maps spec type names to their requirements.
	Specs map[string]*SpecRequirement `json:"specs,omitempty" yaml:"specs,omitempty"`
}

SpecConfig holds per-spec configuration for a project.

func DefaultSpecConfig

func DefaultSpecConfig() *SpecConfig

DefaultSpecConfig returns the default spec configuration.

func NewSpecConfig

func NewSpecConfig() *SpecConfig

NewSpecConfig creates a new SpecConfig with default values.

func (*SpecConfig) AllSpecs

func (sc *SpecConfig) AllSpecs() []string

AllSpecs returns all configured spec types (built-in + custom).

func (*SpecConfig) CustomSpecs

func (sc *SpecConfig) CustomSpecs() []string

CustomSpecs returns all custom (non-built-in) spec types.

func (*SpecConfig) GetCategory

func (sc *SpecConfig) GetCategory(specType string) SpecCategory

GetCategory returns the category for a spec type.

func (*SpecConfig) GetRequirement

func (sc *SpecConfig) GetRequirement(specType string) *SpecRequirement

GetRequirement returns the requirement for a spec type. Returns nil if not configured.

func (*SpecConfig) GetRubric

func (sc *SpecConfig) GetRubric(specType string) string

GetRubric returns the rubric name for a spec type. Returns the spec type name if no custom rubric is configured.

func (*SpecConfig) GetTemplate

func (sc *SpecConfig) GetTemplate(specType string) string

GetTemplate returns the template name for a spec type. Returns the spec type name if no custom template is configured.

func (*SpecConfig) IsRequired

func (sc *SpecConfig) IsRequired(specType string) bool

IsRequired returns whether a spec type is required. It checks the config first, then falls back to built-in defaults.

func (*SpecConfig) Merge

func (sc *SpecConfig) Merge(other *SpecConfig)

Merge merges another SpecConfig into this one. Values from other override values in this config.

func (*SpecConfig) RequiredSpecs

func (sc *SpecConfig) RequiredSpecs() []string

RequiredSpecs returns all required spec types.

func (*SpecConfig) SetRequirement

func (sc *SpecConfig) SetRequirement(specType string, req *SpecRequirement)

SetRequirement sets the requirement for a spec type.

func (*SpecConfig) SpecsByCategory

func (sc *SpecConfig) SpecsByCategory(category SpecCategory) []string

SpecsByCategory returns all spec types in the given category.

type SpecKitConfig

type SpecKitConfig struct {
	Enabled         bool   `json:"enabled" yaml:"enabled"`
	OutputDir       string `json:"output_dir,omitempty" yaml:"output_dir,omitempty"`
	BranchNumbering string `json:"branch_numbering,omitempty" yaml:"branch_numbering,omitempty"` // "sequential" or "timestamp"
}

SpecKitConfig configures the SpecKit export target.

type SpecRequirement

type SpecRequirement struct {
	// Required indicates whether this spec is mandatory for the project.
	Required bool `json:"required" yaml:"required"`

	// Category specifies the spec category (source, gtm, technical).
	// Only needed for custom spec types; built-in types have implicit categories.
	Category SpecCategory `json:"category,omitempty" yaml:"category,omitempty"`

	// Template specifies which template to use (defaults to spec type name).
	Template string `json:"template,omitempty" yaml:"template,omitempty"`

	// Rubric specifies which rubric to use (defaults to spec type name).
	Rubric string `json:"rubric,omitempty" yaml:"rubric,omitempty"`
}

SpecRequirement defines requirements for a spec type.

type SpecStatus

type SpecStatus string

SpecStatus represents the status of a specification.

const (
	StatusMissing   SpecStatus = "missing"   // File does not exist
	StatusDraft     SpecStatus = "draft"     // File exists, not evaluated
	StatusEvaluated SpecStatus = "evaluated" // Evaluation complete
	StatusApproved  SpecStatus = "approved"  // Approved by reviewer
	StatusRejected  SpecStatus = "rejected"  // Rejected, needs revision
	StatusOutdated  SpecStatus = "outdated"  // Source changed since eval
)

type SpecType

type SpecType string

SpecType represents the type of specification document.

const (
	// Source specs (human-authored)
	SpecTypeMRD SpecType = "mrd" // Market Requirements Document
	SpecTypePRD SpecType = "prd" // Product Requirements Document
	SpecTypeUXD SpecType = "uxd" // User Experience Design

	// GTM specs (LLM-generated)
	SpecTypePress       SpecType = "press"        // Press Release
	SpecTypeFAQ         SpecType = "faq"          // FAQ
	SpecTypeNarrative1P SpecType = "narrative-1p" // 1-Pager Executive Narrative
	SpecTypeNarrative6P SpecType = "narrative-6p" // 6-Pager AWS-Style Narrative

	// Technical specs (LLM-generated)
	SpecTypeTRD SpecType = "trd" // Technical Requirements Document
	SpecTypeTPD SpecType = "tpd" // Test Plan Document
	SpecTypeIRD SpecType = "ird" // Infrastructure Requirements Document

	// Output specs
	SpecTypeSpec         SpecType = "spec"          // Reconciled execution spec
	SpecTypeCurrentTruth SpecType = "current-truth" // Post-ship state
)

func AllSpecTypes

func AllSpecTypes() []SpecType

AllSpecTypes returns all spec types in workflow order.

func GTMSpecTypes

func GTMSpecTypes() []SpecType

GTMSpecTypes returns GTM spec types.

func SourceSpecTypes

func SourceSpecTypes() []SpecType

SourceSpecTypes returns source spec types.

func TechnicalSpecTypes

func TechnicalSpecTypes() []SpecType

TechnicalSpecTypes returns technical spec types.

func (SpecType) Category

func (s SpecType) Category() SpecCategory

Category returns the category for a spec type.

func (SpecType) Dir

func (s SpecType) Dir() string

Dir returns the directory where this spec type should be stored.

func (SpecType) EvalFilename

func (s SpecType) EvalFilename() string

EvalFilename returns the canonical eval filename for this spec type.

func (SpecType) Filename

func (s SpecType) Filename() string

Filename returns the canonical filename for this spec type.

func (SpecType) IsRequired

func (s SpecType) IsRequired() bool

IsRequired returns whether this spec type is required for reconciliation.

func (SpecType) IsValid

func (s SpecType) IsValid() bool

IsValid returns whether this is a known spec type.

type TargetConfig

type TargetConfig struct {
	Default string `json:"default,omitempty" yaml:"default,omitempty"`

	SpecKit  *SpecKitConfig  `json:"speckit,omitempty" yaml:"speckit,omitempty"`
	GSD      *GSDConfig      `json:"gsd,omitempty" yaml:"gsd,omitempty"`
	GasTown  *GasTownConfig  `json:"gastown,omitempty" yaml:"gastown,omitempty"`
	GasCity  *GasCityConfig  `json:"gascity,omitempty" yaml:"gascity,omitempty"`
	AIDLC    *AIDLCConfig    `json:"aidlc,omitempty" yaml:"aidlc,omitempty"`
	OpenSpec *OpenSpecConfig `json:"openspec,omitempty" yaml:"openspec,omitempty"`
}

TargetConfig configures export targets for a project.

Jump to

Keyboard shortcuts

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