caseresource

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RenderFrontmatter

func RenderFrontmatter(fm Frontmatter) string

RenderFrontmatter renders a Frontmatter as a YAML frontmatter block.

Types

type CaseResource

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

CaseResource implements the Resource, Validator, and Transitioner interfaces.

func New

func New(fs dal.FileSystem, exec dal.Executor, strat *strategy.Strategy) *CaseResource

New creates a new CaseResource.

func (*CaseResource) Create

func (cr *CaseResource) Create(ctx *agentcli.AppContext, slug string, opts map[string]string) (*resource.Record, error)

Create creates a new case directory and case.md file.

func (*CaseResource) Get

func (cr *CaseResource) Get(ctx *agentcli.AppContext, id string) (*resource.Record, error)

Get retrieves a case record by its ID.

func (*CaseResource) List

func (cr *CaseResource) List(ctx *agentcli.AppContext, filter resource.Filter) ([]resource.Record, error)

List walks the cases directory and returns matching records.

func (*CaseResource) Schema

func (cr *CaseResource) Schema() resource.ResourceSchema

Schema returns the resource schema for cases.

func (*CaseResource) Transition

func (cr *CaseResource) Transition(ctx *agentcli.AppContext, id string, action string) (*resource.Record, error)

Transition applies a state machine action to a case and returns the updated record.

func (*CaseResource) Validate

func (cr *CaseResource) Validate(ctx *agentcli.AppContext, id string) (*agentcli.DoctorReport, error)

Validate checks that a case has all required frontmatter fields.

type Frontmatter

type Frontmatter struct {
	Type      string `yaml:"type"`
	Status    string `yaml:"status"`
	ClaimedBy string `yaml:"claimed_by"`
	Created   string `yaml:"created"`
}

Frontmatter represents YAML frontmatter in case.md files.

func ParseFrontmatter

func ParseFrontmatter(content string) (Frontmatter, string, error)

ParseFrontmatter extracts YAML frontmatter from case.md content. Returns the parsed frontmatter and the remaining body content.

type StateMachine

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

StateMachine enforces valid state transitions loaded from strategy config.

func NewStateMachine

func NewStateMachine(config strategy.TransitionsConfig) *StateMachine

NewStateMachine creates a StateMachine from a TransitionsConfig.

func (*StateMachine) AllStatuses

func (sm *StateMachine) AllStatuses() []string

AllStatuses returns all known statuses from the categories config.

func (*StateMachine) Apply

func (sm *StateMachine) Apply(currentStatus, action string) (string, error)

Apply applies an action to the current status and returns the new status.

func (*StateMachine) CategoryForStatus

func (sm *StateMachine) CategoryForStatus(status string) string

CategoryForStatus returns the category name for a given status.

func (*StateMachine) ExpandStatusFilter

func (sm *StateMachine) ExpandStatusFilter(filter string) (map[string]bool, error)

ExpandStatusFilter expands a status filter (status name or category) into a set of statuses.

func (*StateMachine) Initial

func (sm *StateMachine) Initial() string

Initial returns the initial status for new cases.

Jump to

Keyboard shortcuts

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