core

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package core provides canonical types for validation area definitions. Validation areas represent departments or areas of responsibility in the release process (e.g., QA, Documentation, Release Management, Security).

Index

Constants

View Source
const DefaultDirMode fs.FileMode = 0700

DefaultDirMode is the default permission for generated directories.

View Source
const DefaultFileMode fs.FileMode = 0600

DefaultFileMode is the default permission for generated files.

Variables

View Source
var (
	// AreaQA is the Quality Assurance validation area.
	AreaQA = "qa"

	// AreaDocumentation is the Documentation validation area.
	AreaDocumentation = "documentation"

	// AreaRelease is the Release Management validation area.
	AreaRelease = "release"

	// AreaSecurity is the Security/Compliance validation area.
	AreaSecurity = "security"
)

Predefined validation areas for software releases.

View Source
var DefaultRegistry = NewRegistry()

DefaultRegistry is the global adapter registry.

Functions

func AdapterNames

func AdapterNames() []string

AdapterNames returns adapter names from the default registry.

func Register

func Register(adapter Adapter)

Register adds an adapter to the default registry.

func WriteAreasToDir

func WriteAreasToDir(areas []*ValidationArea, dir string, adapterName string) error

WriteAreasToDir writes multiple validation areas to a directory using the specified adapter.

func WriteCanonicalFile

func WriteCanonicalFile(area *ValidationArea, path string) error

WriteCanonicalFile writes a canonical validation-area.json file.

Types

type Adapter

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

	// FileExtension returns the file extension for validation files.
	FileExtension() string

	// DefaultDir returns the default directory name for validation areas.
	DefaultDir() string

	// Parse converts tool-specific bytes to canonical ValidationArea.
	Parse(data []byte) (*ValidationArea, error)

	// Marshal converts canonical ValidationArea to tool-specific bytes.
	Marshal(area *ValidationArea) ([]byte, error)

	// ReadFile reads from path and returns canonical ValidationArea.
	ReadFile(path string) (*ValidationArea, error)

	// WriteFile writes canonical ValidationArea to path.
	WriteFile(area *ValidationArea, path string) error
}

Adapter converts between canonical ValidationArea and tool-specific formats.

func GetAdapter

func GetAdapter(name string) (Adapter, bool)

GetAdapter returns an adapter from the default registry.

type Check

type Check struct {
	Name        string `json:"name"`                   // Check identifier
	Description string `json:"description,omitempty"`  // What this check validates
	Command     string `json:"command,omitempty"`      // CLI command to execute
	Pattern     string `json:"pattern,omitempty"`      // Regex pattern to search for (failure if found)
	FilePattern string `json:"file_pattern,omitempty"` // Glob pattern for files to check
	Required    bool   `json:"required"`               // If true, failure blocks release (NO-GO)
}

Check represents an individual validation check within an area.

type CheckStatus

type CheckStatus string

CheckStatus represents the result of a check.

const (
	StatusGo   CheckStatus = "GO"
	StatusNoGo CheckStatus = "NO-GO"
	StatusWarn CheckStatus = "WARN"
	StatusSkip CheckStatus = "SKIP"
)

type MarshalError

type MarshalError struct {
	Format string
	Err    error
}

MarshalError represents an error marshaling to a format.

func (*MarshalError) Error

func (e *MarshalError) Error() string

func (*MarshalError) Unwrap

func (e *MarshalError) Unwrap() error

type ParseError

type ParseError struct {
	Format string
	Path   string
	Err    error
}

ParseError represents an error parsing a file format.

func (*ParseError) Error

func (e *ParseError) Error() string

func (*ParseError) Unwrap

func (e *ParseError) Unwrap() error

type ReadError

type ReadError struct {
	Path string
	Err  error
}

ReadError represents an error reading a file.

func (*ReadError) Error

func (e *ReadError) Error() string

func (*ReadError) Unwrap

func (e *ReadError) Unwrap() error

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

Registry manages adapter registration and lookup.

func NewRegistry

func NewRegistry() *Registry

NewRegistry creates a new adapter registry.

func (*Registry) AdapterNames

func (r *Registry) AdapterNames() []string

AdapterNames returns all registered adapter names sorted alphabetically.

func (*Registry) GetAdapter

func (r *Registry) GetAdapter(name string) (Adapter, bool)

GetAdapter returns an adapter by name.

func (*Registry) Register

func (r *Registry) Register(adapter Adapter)

Register adds an adapter to the registry.

type ValidationArea

type ValidationArea struct {
	// Metadata
	Name        string `json:"name"`        // Area identifier (e.g., "qa", "documentation")
	Description string `json:"description"` // Brief description of the area's responsibility

	// Sign-off criteria
	SignOffCriteria string `json:"sign_off_criteria"` // What must pass for GO status

	// Checks to perform
	Checks []Check `json:"checks"` // Individual validation checks

	// Dependencies
	Dependencies []string `json:"dependencies,omitempty"` // Required CLI tools

	// Instructions for AI agents
	Instructions string `json:"instructions"` // Full instructions/system prompt

	// Claude-specific (used when generating agent)
	Model  string   `json:"model,omitempty"`  // Model for agent (sonnet, opus, haiku)
	Tools  []string `json:"tools,omitempty"`  // Allowed tools for agent
	Skills []string `json:"skills,omitempty"` // Skills to load for agent
}

ValidationArea represents a canonical validation area definition. Each area can be converted to tool-specific formats:

  • Claude Code: Sub-agents (agents/*.md)
  • Gemini CLI: Commands or prompts
  • Codex: Prompts

func NewValidationArea

func NewValidationArea(name, description string) *ValidationArea

NewValidationArea creates a new ValidationArea with the given name and description.

func ReadCanonicalDir

func ReadCanonicalDir(dir string) ([]*ValidationArea, error)

ReadCanonicalDir reads all validation-area.json files from a directory.

func ReadCanonicalFile

func ReadCanonicalFile(path string) (*ValidationArea, error)

ReadCanonicalFile reads a canonical validation-area.json file.

func (*ValidationArea) AddCheck

func (v *ValidationArea) AddCheck(check Check)

AddCheck adds a check to the validation area.

func (*ValidationArea) AddDependency

func (v *ValidationArea) AddDependency(dep string)

AddDependency adds a CLI tool dependency.

func (*ValidationArea) AddSkill

func (v *ValidationArea) AddSkill(skill string)

AddSkill adds a skill (used in Claude agent generation).

func (*ValidationArea) AddTool

func (v *ValidationArea) AddTool(tool string)

AddTool adds a tool to the allowed tools list (used in Claude agent generation).

func (*ValidationArea) AddTools

func (v *ValidationArea) AddTools(tools ...string)

AddTools adds multiple tools to the allowed tools list.

func (*ValidationArea) SetModel

func (v *ValidationArea) SetModel(model string)

SetModel sets the model for the area (used in Claude agent generation).

type WriteError

type WriteError struct {
	Path string
	Err  error
}

WriteError represents an error writing a file.

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