castplan

package
v1.234.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package castplan defines declarative recordings independently of their language binding.

Index

Constants

View Source
const MarkerPrefix = "atmos:cast:v1:"

MarkerPrefix distinguishes recording metadata from legacy screenshot paths.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	Kind     string         `json:"kind"`
	Fields   map[string]any `json:"fields,omitempty"`
	Children []Action       `json:"children,omitempty"`
	Expect   []Matcher      `json:"expect,omitempty"`
	Reject   []Matcher      `json:"reject,omitempty"`
	ExitCode int            `json:"exit_code,omitempty"`
}

Action describes a command, registered step, presentation action, or nested group.

func (*Action) Check

func (a *Action) Check(text string, exitCode int) error

Check verifies output and the actual exit status for a command.

type Marker

type Marker struct {
	Kind        string `json:"kind"`
	ID          string `json:"id,omitempty"`
	Fingerprint string `json:"fingerprint,omitempty"`
	ExitCode    int    `json:"exit_code,omitempty"`
}

Marker identifies a declaration boundary without exposing command text or environment values.

func (Marker) Encode

func (m Marker) Encode() string

Encode formats a metadata marker; all members are primitive JSON values.

type Matcher

type Matcher struct {
	Text  string `json:"text"`
	Regex bool   `json:"regex,omitempty"`
}

Matcher is either a literal substring or a regular expression.

func (Matcher) Matches

func (m Matcher) Matches(text string) bool

Matches tests one assertion against normalized terminal text.

type Plan

type Plan struct {
	// Replacements normalize machine-specific output; source paths are not part of the portable fingerprint.
	Replacements  map[string]string `json:"-"`
	Configuration map[string]any    `json:"configuration"`
	Setup         []Action          `json:"setup,omitempty"`
	Actions       []Action          `json:"actions"`
	Cleanup       []Action          `json:"cleanup,omitempty"`
}

Plan is an ordered recording declaration. Configuration uses existing cast step fields.

func (*Plan) Fingerprint

func (p *Plan) Fingerprint() (string, error)

Fingerprint binds saved evidence to the complete declaration, including hidden actions.

Jump to

Keyboard shortcuts

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