core

package
v0.14.0 Latest Latest
Warning

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

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

Documentation

Overview

Package core provides canonical types for composable capabilities. Capabilities are reusable building blocks that can be converted to both Skills (for human-guided use) and ValidationArea Checks (for autonomous QA validation).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Capability

type Capability struct {
	// Metadata
	Name        string `json:"name"`        // Unique identifier (e.g., "golangci-lint")
	Description string `json:"description"` // Brief description

	// Content
	Instructions string `json:"instructions"` // Full instructions/prompt for the capability

	// Execution
	Command     string   `json:"command,omitempty"`      // CLI command to execute
	CommandArgs []string `json:"command_args,omitempty"` // Default command arguments

	// Triggers (for skill invocation)
	Triggers []string `json:"triggers,omitempty"` // Keywords that invoke this capability

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

	// Error Handling Guidance
	ErrorHandling *ErrorHandlingGuide `json:"error_handling,omitempty"` // How to handle errors

	// Common Fixes
	CommonFixes []CommonFix `json:"common_fixes,omitempty"` // Known issues and fixes

	// Language/Platform
	Language string `json:"language,omitempty"` // Target language (e.g., "go", "typescript")
	Platform string `json:"platform,omitempty"` // Target platform (e.g., "all", "darwin")

	// Validation
	Required        bool   `json:"required"`                    // If true, failure blocks release
	SuccessPattern  string `json:"success_pattern,omitempty"`   // Regex pattern indicating success
	FailurePattern  string `json:"failure_pattern,omitempty"`   // Regex pattern indicating failure
	ExitCodeSuccess []int  `json:"exit_code_success,omitempty"` // Exit codes indicating success (default: [0])
}

Capability represents a composable capability that can be used by both skills and subagents. It serves as the single source of truth for validation/QA capabilities like linting, testing, and building.

func NewCapability

func NewCapability(name, description string) *Capability

NewCapability creates a new Capability with the given name and description.

func (*Capability) AddCommonFix

func (c *Capability) AddCommonFix(fix CommonFix) *Capability

AddCommonFix adds a common fix to the capability.

func (*Capability) AsRequired

func (c *Capability) AsRequired() *Capability

AsRequired marks this capability as required (failure blocks release).

func (*Capability) ToCheck

func (c *Capability) ToCheck() validationcore.Check

ToCheck converts a Capability to a ValidationArea Check for autonomous QA validation. Checks are executed by validation agents and report GO/NO-GO status.

func (*Capability) ToSkill

func (c *Capability) ToSkill() *skillcore.Skill

ToSkill converts a Capability to a Skill for human-guided use. Skills are invoked via slash commands or triggers and provide interactive guidance to the user.

func (*Capability) WithCommand

func (c *Capability) WithCommand(cmd string, args ...string) *Capability

WithCommand sets the CLI command for the capability.

func (*Capability) WithDependencies

func (c *Capability) WithDependencies(deps ...string) *Capability

WithDependencies sets the required CLI tools.

func (*Capability) WithInstructions

func (c *Capability) WithInstructions(instructions string) *Capability

WithInstructions sets the full instructions.

func (*Capability) WithLanguage

func (c *Capability) WithLanguage(lang string) *Capability

WithLanguage sets the target language.

func (*Capability) WithTriggers

func (c *Capability) WithTriggers(triggers ...string) *Capability

WithTriggers sets the trigger keywords.

type CapabilitySet

type CapabilitySet struct {
	Name         string        `json:"name"`
	Description  string        `json:"description"`
	Language     string        `json:"language,omitempty"`
	Capabilities []*Capability `json:"capabilities"`
}

CapabilitySet represents a collection of related capabilities. This allows grouping capabilities by domain (e.g., all Go checks).

func NewCapabilitySet

func NewCapabilitySet(name, description string) *CapabilitySet

NewCapabilitySet creates a new CapabilitySet.

func (*CapabilitySet) Add

func (cs *CapabilitySet) Add(c *Capability) *CapabilitySet

Add adds a capability to the set.

func (*CapabilitySet) ToChecks

func (cs *CapabilitySet) ToChecks() []validationcore.Check

ToChecks converts all capabilities to ValidationArea Checks.

func (*CapabilitySet) ToSkills

func (cs *CapabilitySet) ToSkills() []*skillcore.Skill

ToSkills converts all capabilities to Skills.

func (*CapabilitySet) ToValidationArea

func (cs *CapabilitySet) ToValidationArea(signOffCriteria, instructions string) *validationcore.ValidationArea

ToValidationArea creates a ValidationArea from the capability set. This is useful for creating a QA validation area that composes multiple capabilities.

type CommonFix

type CommonFix struct {
	Issue       string `json:"issue"`       // Lint rule or error pattern (e.g., "G306", "errcheck")
	Description string `json:"description"` // What the issue is
	Before      string `json:"before"`      // Code before fix
	After       string `json:"after"`       // Code after fix
}

CommonFix represents a common issue and its fix.

type ErrorHandlingGuide

type ErrorHandlingGuide struct {
	// Priority order for handling errors
	Priorities []ErrorPriority `json:"priorities"`

	// Reference packages for error handling
	References []PackageReference `json:"references,omitempty"`
}

ErrorHandlingGuide provides instructions for handling errors.

type ErrorPriority

type ErrorPriority struct {
	Level       int    `json:"level"`       // Priority level (1 = highest)
	Name        string `json:"name"`        // Priority name (e.g., "Panic", "Return Error")
	Description string `json:"description"` // When to use this priority
	Example     string `json:"example"`     // Code example
}

ErrorPriority represents a priority level for error handling.

type PackageReference

type PackageReference struct {
	Package     string `json:"package"`     // Import path
	Description string `json:"description"` // What this package provides
	Usage       string `json:"usage"`       // Example usage
}

PackageReference is a reference to a package for error handling.

Jump to

Keyboard shortcuts

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