core

package
v0.13.0 Latest Latest
Warning

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

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

Documentation

Overview

Package core provides the canonical workflow adapter interface.

Package core provides error types for workflow operations.

Package core provides the canonical workflow definition types. Workflows define multi-phase spec creation processes that can be deployed across different AI coding assistants.

Index

Constants

View Source
const (
	LevelProduct = "product"
	LevelFeature = "feature"
)

WorkflowLevel constants.

View Source
const (
	ModeInteractive    = "interactive"
	ModeSynthesis      = "synthesis"
	ModeReconciliation = "reconciliation"
)

AuthoringMode constants.

View Source
const DefaultDirMode = 0755

DefaultDirMode is the default permission for workflow directories.

View Source
const DefaultFileMode = 0644

DefaultFileMode is the default permission for workflow files.

Variables

This section is empty.

Functions

func Generate

func Generate(cfg *GenerateConfig) error

Generate generates platform-specific workflow files.

func List

func List() []string

List returns all registered adapter names.

func Register

func Register(adapter Adapter)

Register adds an adapter to the registry.

Types

type Adapter

type Adapter interface {
	// Name returns the adapter identifier (e.g., "claude", "kiro")
	Name() string

	// EntryPointFile returns the entry point filename for this platform
	// (e.g., "CLAUDE.md" for Claude Code, "core-workflow.md" for Kiro steering)
	EntryPointFile() string

	// EntryPointDir returns the directory for the entry point
	// (e.g., "" for root, ".kiro/steering" for Kiro)
	EntryPointDir() string

	// RuleDetailsDir returns the directory for rule details
	// (e.g., ".spec-workflows" for Claude, ".kiro/spec-workflow-details" for Kiro)
	RuleDetailsDir() string

	// Generate creates platform-specific files from a Workflow
	Generate(workflow *Workflow, outputDir string) error

	// GenerateEntryPoint generates just the entry point file content
	GenerateEntryPoint(workflow *Workflow) ([]byte, error)
}

Adapter converts between canonical Workflow and platform-specific formats.

func Get

func Get(name string) (Adapter, error)

Get returns the adapter with the given name.

type AdapterNotFoundError

type AdapterNotFoundError struct {
	Name string
}

AdapterNotFoundError is returned when an adapter is not found.

func (*AdapterNotFoundError) Error

func (e *AdapterNotFoundError) Error() string

type GenerateConfig

type GenerateConfig struct {
	// Workflow is the source workflow to generate from
	Workflow *Workflow

	// SourceRepo is the spec-workflows repository
	SourceRepo *SourceRepo

	// OutputDir is the target project directory
	OutputDir string

	// Platform is the target platform (e.g., "claude", "kiro")
	Platform string

	// Extension is an optional extension to include
	Extension string

	// CopyRuleDetails copies rule-details to output (vs symlink/reference)
	CopyRuleDetails bool

	// CopyTemplates copies templates to output
	CopyTemplates bool

	// CopyRubrics copies rubrics to output
	CopyRubrics bool
}

GenerateConfig specifies how to generate workflow files.

type GenerateError

type GenerateError struct {
	Platform string
	Path     string
	Err      error
}

GenerateError is returned when generation fails.

func (*GenerateError) Error

func (e *GenerateError) Error() string

func (*GenerateError) Unwrap

func (e *GenerateError) Unwrap() error

type LoadError

type LoadError struct {
	Path string
	Err  error
}

LoadError is returned when loading a workflow repository fails.

func (*LoadError) Error

func (e *LoadError) Error() string

func (*LoadError) Unwrap

func (e *LoadError) Unwrap() error

type NotFoundError

type NotFoundError struct {
	WorkflowID string
}

NotFoundError is returned when a workflow is not found.

func (*NotFoundError) Error

func (e *NotFoundError) Error() string

type ParseError

type ParseError struct {
	Path string
	Err  error
}

ParseError is returned when parsing fails.

func (*ParseError) Error

func (e *ParseError) Error() string

func (*ParseError) Unwrap

func (e *ParseError) Unwrap() error

type Phase

type Phase struct {
	// Name is the phase identifier
	Name string `json:"name" yaml:"name"`

	// SpecType is the spec type created in this phase
	SpecType string `json:"specType" yaml:"specType"`

	// Mode is the authoring mode: "interactive", "synthesis", or "reconciliation"
	Mode string `json:"mode" yaml:"mode"`

	// Sources are the spec types used as input (for synthesis mode)
	Sources []string `json:"sources,omitempty" yaml:"sources,omitempty"`

	// Gate indicates if approval is required before proceeding
	Gate bool `json:"gate,omitempty" yaml:"gate,omitempty"`
}

Phase represents a workflow phase.

type SourceRepo

type SourceRepo struct {
	// Path is the local filesystem path to the repo
	Path string `json:"path" yaml:"path"`

	// Workflows maps workflow identifiers to Workflow definitions
	Workflows map[string]*Workflow `json:"workflows,omitempty" yaml:"workflows,omitempty"`
}

SourceRepo represents a spec-workflows repository.

func LoadSourceRepo

func LoadSourceRepo(path string) (*SourceRepo, error)

LoadSourceRepo loads a spec-workflows repository from the given path.

func (*SourceRepo) GetWorkflow

func (r *SourceRepo) GetWorkflow(id string) (*Workflow, error)

GetWorkflow returns the workflow with the given ID.

func (*SourceRepo) ListWorkflows

func (r *SourceRepo) ListWorkflows() []string

ListWorkflows returns all available workflow IDs.

type Workflow

type Workflow struct {
	// Name is the workflow identifier (e.g., "aws-working-backwards")
	Name string `json:"name" yaml:"name"`

	// Level is the workflow level: "product" or "feature"
	Level string `json:"level" yaml:"level"`

	// Description describes the workflow purpose
	Description string `json:"description,omitempty" yaml:"description,omitempty"`

	// Trigger is the phrase that activates this workflow
	Trigger string `json:"trigger,omitempty" yaml:"trigger,omitempty"`

	// EntryPoint is the path to the core-workflow.md file
	EntryPoint string `json:"entryPoint" yaml:"entryPoint"`

	// RuleDetails is the path to the rule-details directory
	RuleDetails string `json:"ruleDetails,omitempty" yaml:"ruleDetails,omitempty"`

	// Templates is the path to the templates directory
	Templates string `json:"templates,omitempty" yaml:"templates,omitempty"`

	// Rubrics is the path to the rubrics directory
	Rubrics string `json:"rubrics,omitempty" yaml:"rubrics,omitempty"`

	// Phases defines the workflow phases in order
	Phases []Phase `json:"phases,omitempty" yaml:"phases,omitempty"`

	// Extension is an optional extension to apply
	Extension string `json:"extension,omitempty" yaml:"extension,omitempty"`
}

Workflow represents a canonical workflow definition. Workflows guide AI assistants through multi-phase spec creation.

func NewWorkflow

func NewWorkflow(name, level string) *Workflow

NewWorkflow creates a new Workflow with the given name and level.

type WriteError

type WriteError struct {
	Path string
	Err  error
}

WriteError is returned when writing fails.

func (*WriteError) Error

func (e *WriteError) Error() string

func (*WriteError) Unwrap

func (e *WriteError) Unwrap() error

Jump to

Keyboard shortcuts

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