scenario

package
v0.135.8 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2026 License: BSD-2-Clause Imports: 12 Imported by: 0

Documentation

Overview

Package scenario provides types and file-system access for scenario markdown files.

Index

Constants

This section is empty.

Variables

KnownStatuses is the set of valid scenario status values.

Functions

func IsKnown

func IsKnown(s Status) bool

IsKnown returns true if s is one of the four defined scenario statuses.

Types

type Frontmatter

type Frontmatter struct {
	Status string `yaml:"status"`
}

Frontmatter represents the YAML frontmatter in a scenario file.

type Lister

type Lister interface {
	List(ctx context.Context) ([]*ScenarioFile, error)
	Summary(ctx context.Context) (*Summary, error)
	Find(ctx context.Context, id string) ([]*ScenarioFile, error)
}

Lister lists scenario files from a directory.

func NewLister

func NewLister(dir string) Lister

NewLister creates a Lister that scans the given directory.

type ScenarioFile

type ScenarioFile struct {
	Path        string
	Name        string // filename without .md extension, e.g. "001-workflow-direct"
	Number      int    // numeric prefix, -1 if none
	Frontmatter Frontmatter
	Title       string // text from the first "# " heading after frontmatter, empty if absent
	RawContent  []byte // full file bytes (used by show command to print entire file)
}

ScenarioFile represents a loaded scenario file.

func Load

func Load(ctx context.Context, path string) (*ScenarioFile, error)

Load reads one scenario file from disk. On frontmatter parse failure the file is still returned with an empty Frontmatter — callers treat an empty/unrecognized status as unknown. Returns an error only if the file cannot be read at all.

type Status

type Status string

Status represents the lifecycle state of a scenario.

const (
	// StatusIdea indicates a rough concept not yet ready for execution.
	StatusIdea Status = "idea"
	// StatusDraft indicates a scenario that is written but not yet exercised.
	StatusDraft Status = "draft"
	// StatusActive indicates a scenario that is currently in use for regression coverage.
	StatusActive Status = "active"
	// StatusOutdated indicates a scenario that no longer reflects the current behavior.
	StatusOutdated Status = "outdated"
)

type Summary

type Summary struct {
	Idea     int
	Draft    int
	Active   int
	Outdated int
	Unknown  int
	Total    int
}

Summary holds counts of scenarios grouped by status.

Jump to

Keyboard shortcuts

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