Help us shape the future of Go! Take the 2026 Go Developer Survey

schema

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommitEvent

type CommitEvent struct {
	SHA     string       `json:"sha"`
	Message string       `json:"message"`
	Author  string       `json:"author"`
	Files   []FileStatus `json:"files"`
}

CommitEvent contains git commit data

type CommitTrigger

type CommitTrigger struct {
	Paths          []string `yaml:"paths,omitempty" json:"paths,omitempty"`
	PathsIgnore    []string `yaml:"paths-ignore,omitempty" json:"paths-ignore,omitempty"`
	Branches       []string `yaml:"branches,omitempty" json:"branches,omitempty"`
	BranchesIgnore []string `yaml:"branches-ignore,omitempty" json:"branches-ignore,omitempty"`
}

CommitTrigger matches git commit events

type ConcurrencyConfig

type ConcurrencyConfig struct {
	Group       string `yaml:"group" json:"group"`
	MaxParallel int    `yaml:"max-parallel,omitempty" json:"max-parallel,omitempty"` // Default: 1
}

ConcurrencyConfig controls parallel execution

type Event

type Event struct {
	Hook      *HookEvent   `json:"hook,omitempty"`
	Tool      *ToolEvent   `json:"tool,omitempty"`
	File      *FileEvent   `json:"file,omitempty"`
	Commit    *CommitEvent `json:"commit,omitempty"`
	Push      *PushEvent   `json:"push,omitempty"`
	Cwd       string       `json:"cwd"`
	Timestamp string       `json:"timestamp"`
}

Event represents the runtime event context passed to workflows

func LoadEvent

func LoadEvent(jsonStr string) (*Event, error)

LoadEvent loads an event from a JSON string

type FileEvent

type FileEvent struct {
	Path    string `json:"path"`
	Action  string `json:"action"` // create, edit
	Content string `json:"content,omitempty"`
}

FileEvent contains file change data

type FileStatus

type FileStatus struct {
	Path   string `json:"path"`
	Status string `json:"status"` // added, modified, deleted
}

FileStatus represents a file's status in a commit

type FileTrigger

type FileTrigger struct {
	Types       []string `yaml:"types,omitempty" json:"types,omitempty"`               // create, edit
	Paths       []string `yaml:"paths,omitempty" json:"paths,omitempty"`               // Include patterns
	PathsIgnore []string `yaml:"paths-ignore,omitempty" json:"paths-ignore,omitempty"` // Exclude patterns
}

FileTrigger matches file create/edit events

type HookEvent

type HookEvent struct {
	Type string     `json:"type"` // preToolUse, postToolUse
	Tool *ToolEvent `json:"tool"`
	Cwd  string     `json:"cwd"`
}

HookEvent contains hook-specific event data

type HooksTrigger

type HooksTrigger struct {
	Types []string `yaml:"types,omitempty" json:"types,omitempty"` // preToolUse, postToolUse
	Tools []string `yaml:"tools,omitempty" json:"tools,omitempty"` // Filter by tool name
}

HooksTrigger matches agent hook events

type OnConfig

type OnConfig struct {
	Hooks  *HooksTrigger  `yaml:"hooks,omitempty" json:"hooks,omitempty"`
	Tool   *ToolTrigger   `yaml:"tool,omitempty" json:"tool,omitempty"`
	Tools  []ToolTrigger  `yaml:"tools,omitempty" json:"tools,omitempty"`
	File   *FileTrigger   `yaml:"file,omitempty" json:"file,omitempty"`
	Commit *CommitTrigger `yaml:"commit,omitempty" json:"commit,omitempty"`
	Push   *PushTrigger   `yaml:"push,omitempty" json:"push,omitempty"`
}

OnConfig defines all trigger types

func (*OnConfig) UnmarshalYAML

func (o *OnConfig) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements custom YAML unmarshaling for OnConfig This handles the case where triggers are specified without properties (e.g., "commit:" with no sub-fields) In YAML, this parses as nil, but we want it to be an empty struct to indicate "match all"

type PushEvent

type PushEvent struct {
	Ref     string        `json:"ref"`
	Before  string        `json:"before"`
	After   string        `json:"after"`
	Commits []CommitEvent `json:"commits"`
}

PushEvent contains git push data

type PushTrigger

type PushTrigger struct {
	Paths          []string `yaml:"paths,omitempty" json:"paths,omitempty"`
	PathsIgnore    []string `yaml:"paths-ignore,omitempty" json:"paths-ignore,omitempty"`
	Branches       []string `yaml:"branches,omitempty" json:"branches,omitempty"`
	BranchesIgnore []string `yaml:"branches-ignore,omitempty" json:"branches-ignore,omitempty"`
	Tags           []string `yaml:"tags,omitempty" json:"tags,omitempty"`
	TagsIgnore     []string `yaml:"tags-ignore,omitempty" json:"tags-ignore,omitempty"`
}

PushTrigger matches git push events

type Step

type Step struct {
	Name             string            `yaml:"name,omitempty" json:"name,omitempty"`
	If               string            `yaml:"if,omitempty" json:"if,omitempty"`
	Run              string            `yaml:"run,omitempty" json:"run,omitempty"`
	Shell            string            `yaml:"shell,omitempty" json:"shell,omitempty"` // pwsh, bash, sh, cmd
	Uses             string            `yaml:"uses,omitempty" json:"uses,omitempty"`   // Reusable action
	With             map[string]string `yaml:"with,omitempty" json:"with,omitempty"`   // Action inputs
	Env              map[string]string `yaml:"env,omitempty" json:"env,omitempty"`
	WorkingDirectory string            `yaml:"working-directory,omitempty" json:"working-directory,omitempty"`
	Timeout          int               `yaml:"timeout,omitempty" json:"timeout,omitempty"` // Seconds
	ContinueOnError  bool              `yaml:"continue-on-error,omitempty" json:"continue-on-error,omitempty"`
}

Step represents a single step in a workflow

type ToolEvent

type ToolEvent struct {
	Name     string                 `json:"name"`
	Args     map[string]interface{} `json:"args"`
	HookType string                 `json:"hook_type,omitempty"`
}

ToolEvent contains tool invocation data

type ToolTrigger

type ToolTrigger struct {
	Name string            `yaml:"name" json:"name"`
	Args map[string]string `yaml:"args,omitempty" json:"args,omitempty"` // Glob patterns on arg values
	If   string            `yaml:"if,omitempty" json:"if,omitempty"`     // Expression condition
}

ToolTrigger matches specific tools with argument filtering

type ValidationError

type ValidationError struct {
	File    string
	Message string
	Details []string
}

ValidationError represents a validation error

type ValidationResult

type ValidationResult struct {
	Valid  bool
	Errors []ValidationError
}

ValidationResult contains the results of validating workflows

func ValidateWorkflow

func ValidateWorkflow(filePath string) *ValidationResult

ValidateWorkflow validates a single workflow file against the schema

func ValidateWorkflowsInDir

func ValidateWorkflowsInDir(dir string) *ValidationResult

ValidateWorkflowsInDir validates all workflow files in a directory

type Workflow

type Workflow struct {
	Name        string             `yaml:"name" json:"name"`
	Description string             `yaml:"description,omitempty" json:"description,omitempty"`
	Blocking    *bool              `yaml:"blocking,omitempty" json:"blocking,omitempty"` // Default: true
	Concurrency *ConcurrencyConfig `yaml:"concurrency,omitempty" json:"concurrency,omitempty"`
	On          OnConfig           `yaml:"on" json:"on"`
	Env         map[string]string  `yaml:"env,omitempty" json:"env,omitempty"`
	Steps       []Step             `yaml:"steps" json:"steps"`
}

Workflow represents a complete agent workflow definition

func LoadWorkflow

func LoadWorkflow(filePath string) (*Workflow, error)

LoadWorkflow loads a workflow from a YAML file

func (*Workflow) IsBlocking

func (w *Workflow) IsBlocking() bool

IsBlocking returns whether the workflow should block on failure (default: true)

type WorkflowResult

type WorkflowResult struct {
	PermissionDecision       string `json:"permissionDecision"` // allow, deny
	PermissionDecisionReason string `json:"permissionDecisionReason,omitempty"`
	LogFile                  string `json:"logFile,omitempty"` // Path to detailed log file
}

WorkflowResult represents the outcome of running a workflow

func NewAllowResult

func NewAllowResult() *WorkflowResult

NewAllowResult creates an allow result

func NewDenyResult

func NewDenyResult(reason string) *WorkflowResult

NewDenyResult creates a deny result with a reason

Jump to

Keyboard shortcuts

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