cli

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute() error

Types

type Expectation

type Expectation struct {
	Decision  string             `yaml:"decision"`
	Rule      string             `yaml:"rule,omitempty"`
	Message   string             `yaml:"message,omitempty"`
	Mutations []ExpectedMutation `yaml:"mutations,omitempty"`
}

Expectation is the expected evaluation result.

type ExpectedMutation

type ExpectedMutation struct {
	Path     string `yaml:"path"`
	Replaced string `yaml:"replaced"`
}

ExpectedMutation is an expected mutation from a redact action.

type FixtureCall

type FixtureCall struct {
	Operation string          `yaml:"operation"`
	Params    map[string]any  `yaml:"params"`
	Context   *FixtureContext `yaml:"context,omitempty"`
}

FixtureCall is the call to evaluate.

type FixtureContext

type FixtureContext struct {
	AgentID   string            `yaml:"agent_id,omitempty"`
	UserID    string            `yaml:"user_id,omitempty"`
	Scope     string            `yaml:"scope,omitempty"`
	Direction string            `yaml:"direction,omitempty"`
	Labels    map[string]string `yaml:"labels,omitempty"`
	Timestamp string            `yaml:"timestamp,omitempty"` // RFC3339 format
}

FixtureContext is optional context overrides.

type FixtureFile

type FixtureFile struct {
	Path  string     // source file path (set during loading, not in YAML)
	Scope string     `yaml:"scope"`
	Tests []TestCase `yaml:"tests"`
}

FixtureFile is a parsed test fixture file.

func LoadFixtures

func LoadFixtures(path string) ([]FixtureFile, error)

LoadFixtures reads and parses fixture files from a path. Path can be a single .yaml/.yml file or a directory (loads all yaml files).

type TestCase

type TestCase struct {
	Name   string      `yaml:"name"`
	Call   FixtureCall `yaml:"call"`
	Expect Expectation `yaml:"expect"`
}

TestCase is a single test: a call and the expected result.

Jump to

Keyboard shortcuts

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