screenshots

package
v1.260904.0 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: MIT Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProviderAXe   = "axe"
	ProviderMacOS = "macos"
)
View Source
const (
	MatrixCellSuccess       = "success"
	MatrixCellFailed        = "failed"
	MatrixCellCanceled      = "canceled"
	MatrixCellCleanupFailed = "cleanup_failed"
)

Variables

View Source
var (
	// ErrMatrixPlanRead indicates that a matrix plan could not be read.
	ErrMatrixPlanRead = errors.New("read matrix plan")
	// ErrMatrixPlanParseJSON indicates that a matrix plan is not valid JSON/JSONC.
	ErrMatrixPlanParseJSON = errors.New("parse matrix plan JSON")
	// ErrMatrixInventoryTimeout indicates that the bounded simulator inventory
	// command reached its own deadline without caller cancellation.
	ErrMatrixInventoryTimeout = errors.New("simulator inventory timed out")
)
View Source
var (
	// ErrPlanRead indicates plan file read failure.
	ErrPlanRead = errors.New("read plan")
	// ErrPlanParseJSON indicates plan JSON decode failure.
	ErrPlanParseJSON = errors.New("parse plan JSON")
)

Functions

func BuildLocaleLaunchArguments added in v1.260904.0

func BuildLocaleLaunchArguments(locale string) ([]string, error)

BuildLocaleLaunchArguments returns arguments accepted by simctl launch.

func FrameDeviceValues

func FrameDeviceValues() []string

FrameDeviceValues returns allowed --device values in CLI display order.

func IsCanvasDevice

func IsCanvasDevice(device FrameDevice) bool

IsCanvasDevice returns true if the device uses canvas mode (no device bezel).

func LoadApprovals added in v1.260404.0

func LoadApprovals(path string) (map[string]bool, error)

LoadApprovals reads approved review keys from disk.

func ResolveFrameDeviceFromConfig

func ResolveFrameDeviceFromConfig(configPath, fallback string) string

ResolveFrameDeviceFromConfig resolves the config device to a supported CLI slug.

func ResolveReviewOutputDir

func ResolveReviewOutputDir(outputDir string) (string, error)

ResolveReviewOutputDir resolves output dir with defaults and ensures absolute path.

func SaveApprovals

func SaveApprovals(path string, approvals map[string]bool) error

SaveApprovals writes approved keys to disk in a stable JSON format.

func ValidateMatrixPlan added in v1.260904.0

func ValidateMatrixPlan(plan *MatrixPlan, base *Plan) error

ValidateMatrixPlan validates all matrix inputs that can be checked without executing commands. The base plan must already be loaded and validated.

func WatchAndRegenerate

func WatchAndRegenerate(ctx context.Context, configPath string, debounce time.Duration, onCycle func(results []WatchCycleResult, err error), opts *WatchOptions) error

WatchAndRegenerate watches a Koubou YAML config file (and the raw asset directories it references) for changes, then re-runs kou generate on each change. It blocks until ctx is cancelled.

Types

type AXeProvider

type AXeProvider struct{}

AXeProvider captures a screenshot via the AXe CLI.

func (*AXeProvider) Capture

func (p *AXeProvider) Capture(ctx context.Context, req CaptureRequest) (string, error)

Capture launches the requested app and captures a screenshot via AXe.

type CanvasOptions

type CanvasOptions struct {
	Title         string
	Subtitle      string
	BGColor       string // solid background hex color (e.g. "#ffffff"); defaults to dark gradient
	TitleColor    string // title text color; defaults to canvasDefaultTitleColor
	SubtitleColor string // subtitle text color; defaults to canvasDefaultSubtitleColor
}

CanvasOptions controls title/subtitle/color overlays for canvas-mode devices (e.g. --device mac). All fields are optional; zero values use defaults.

type CaptureRequest

type CaptureRequest struct {
	Provider  string // ProviderAXe or ProviderMacOS
	BundleID  string
	UDID      string // simulator UDID or "booted"
	Name      string // output file name (without extension)
	OutputDir string // directory to write PNG
}

CaptureRequest holds parameters for a single screenshot capture.

type CaptureResult

type CaptureResult struct {
	Path     string `json:"path"`
	Provider string `json:"provider"`
	Width    int    `json:"width"`
	Height   int    `json:"height"`
	BundleID string `json:"bundle_id"`
	UDID     string `json:"udid"`
}

CaptureResult is the structured result of a successful capture.

func Capture

func Capture(ctx context.Context, req CaptureRequest) (*CaptureResult, error)

Capture runs the appropriate provider and validates the output file.

func CaptureWithProvider

func CaptureWithProvider(ctx context.Context, req CaptureRequest, p Provider) (*CaptureResult, error)

CaptureWithProvider runs the given provider (or selects by req.Provider if nil) and validates the output file. Used for testing with a mock provider.

type FrameDevice

type FrameDevice string

FrameDevice identifies a supported frame profile.

const (
	FrameDeviceIPhoneAir   FrameDevice = "iphone-air"
	FrameDeviceIPhone17Pro FrameDevice = "iphone-17-pro"
	FrameDeviceIPhone17PM  FrameDevice = "iphone-17-pro-max"
	FrameDeviceIPhone16e   FrameDevice = "iphone-16e"
	FrameDeviceIPhone17    FrameDevice = "iphone-17"
	FrameDeviceMac         FrameDevice = "mac"
)

func DefaultFrameDevice

func DefaultFrameDevice() FrameDevice

DefaultFrameDevice returns the default frame device.

func ParseFrameDevice

func ParseFrameDevice(raw string) (FrameDevice, error)

ParseFrameDevice normalizes and validates a frame device value.

type FrameDeviceOption

type FrameDeviceOption struct {
	ID      string `json:"id"`
	Default bool   `json:"default"`
}

FrameDeviceOption describes one supported frame device value.

func FrameDeviceOptions

func FrameDeviceOptions() []FrameDeviceOption

FrameDeviceOptions returns supported values with default marker.

type FrameRequest

type FrameRequest struct {
	InputPath  string         // required when ConfigPath is empty
	OutputPath string         // optional for custom config mode; required for input mode
	Device     string         // device slug; defaults to iphone-air when empty
	ConfigPath string         // optional Koubou YAML config path
	Canvas     *CanvasOptions // nil for bezel devices; non-nil for canvas devices (e.g. mac)

	// Kept for backwards compatibility; ignored in Koubou mode.
	FrameRoot   string
	ScreenBleed int
}

FrameRequest holds options for composing one screenshot.

type FrameResult

type FrameResult struct {
	Path         string `json:"path"`
	FramePath    string `json:"frame_path"`
	Device       string `json:"device"`
	DisplayType  string `json:"display_type,omitempty"`
	UploadWidth  int    `json:"upload_width,omitempty"`
	UploadHeight int    `json:"upload_height,omitempty"`
	Normalized   bool   `json:"normalized"`
	Width        int    `json:"width"`
	Height       int    `json:"height"`
}

FrameResult is the structured output for one composed frame image.

func Frame

func Frame(ctx context.Context, req FrameRequest) (*FrameResult, error)

Frame composes screenshots through Koubou's YAML pipeline.

type MatrixAppearance added in v1.260904.0

type MatrixAppearance interface {
	Snapshot(ctx context.Context, udid string) (state string, err error)
	Set(ctx context.Context, udid, appearance string) error
	Restore(ctx context.Context, udid, state string) error
}

MatrixAppearance controls simulator appearance state around a cell.

type MatrixCell added in v1.260904.0

type MatrixCell struct {
	ID              string
	Device          string
	UDID            string
	Locale          string
	Appearance      string
	Content         string
	LaunchArguments []string
	RawDir          string
	FramedDir       string
	RawPaths        []string
	FramedPaths     []string
}

MatrixCell is an expanded matrix invocation. UDID and launch arguments are intentionally internal and are never serialized in result or review artifacts.

func ExpandMatrix added in v1.260904.0

func ExpandMatrix(plan *MatrixPlan, base *Plan) ([]MatrixCell, error)

ExpandMatrix returns cells in declaration order: device, locale, appearance, then content variant. Paths are logical paths until RunMatrix resolves them.

type MatrixCellError added in v1.260904.0

type MatrixCellError struct {
	Stage   string `json:"stage"`
	Code    string `json:"code"`
	Message string `json:"message"`
}

MatrixCellError is a sanitized, stable failure contract. It intentionally has no raw subprocess output, simulator identifier, or launch arguments.

type MatrixCellResult added in v1.260904.0

type MatrixCellResult struct {
	ID           string                   `json:"id"`
	Device       string                   `json:"device"`
	Locale       string                   `json:"locale"`
	Appearance   string                   `json:"appearance"`
	Content      string                   `json:"contentVariant"`
	Status       string                   `json:"status"`
	Attempts     int                      `json:"attempts"`
	DurationMS   int64                    `json:"durationMs"`
	RawPaths     []string                 `json:"rawPaths,omitempty"`
	FramedPaths  []string                 `json:"framedPaths,omitempty"`
	Screenshots  []MatrixScreenshotResult `json:"screenshots,omitempty"`
	Steps        []RunStepResult          `json:"steps,omitempty"`
	FailureStage string                   `json:"failureStage,omitempty"`
	FailureCode  string                   `json:"failureCode,omitempty"`
	Error        *MatrixCellError         `json:"error,omitempty"`
	// contains filtered or unexported fields
}

MatrixCellResult is the privacy-safe result for one cell.

type MatrixContentVariant added in v1.260904.0

type MatrixContentVariant struct {
	ID              string   `json:"id"`
	LaunchArguments []string `json:"launch_arguments,omitempty"`
}

MatrixContentVariant supplies literal launch arguments for one content fixture.

type MatrixDependencies added in v1.260904.0

type MatrixDependencies struct {
	RunPlan func(context.Context, *Plan) (*RunResult, error)
	// RunPlanRooted is the matrix-only provider contract. The destination root
	// is retained for the whole attempt and must be used for every output write.
	// It is additive so existing test/integration callbacks keep compiling while
	// normal matrix execution avoids handing a replaceable pathname to adapters.
	// RunPlan and RunPlanRooted are mutually exclusive; supplying both is a
	// validation error rather than an implicit precedence choice.
	RunPlanRooted func(context.Context, *Plan, rootfs.Root) (*RunResult, error)
	Frame         func(context.Context, FrameRequest) (*FrameResult, error)
	// FrameRooted is the rooted counterpart of Frame. Implementations must use
	// the supplied root for the final output publication. Frame and FrameRooted
	// are mutually exclusive for the same reason as the plan callbacks.
	FrameRooted func(context.Context, FrameRequest, rootfs.Root) (*FrameResult, error)
	Appearance  MatrixAppearance
	CheckDevice func(context.Context, MatrixDevice) error
}

MatrixDependencies makes external execution replaceable by tests without changing the normal command behavior.

type MatrixDevice added in v1.260904.0

type MatrixDevice struct {
	ID   string `json:"id"`
	UDID string `json:"udid"`
}

MatrixDevice identifies an already-existing, booted simulator.

type MatrixExecution added in v1.260904.0

type MatrixExecution struct {
	MaxConcurrency int    `json:"max_concurrency,omitempty"`
	MaxAttempts    int    `json:"max_attempts,omitempty"`
	RetryBackoffMS int    `json:"retry_backoff_ms,omitempty"`
	RetryBackoff   string `json:"retry_backoff,omitempty"`
	// contains filtered or unexported fields
}

MatrixExecution controls matrix scheduling and retry behavior.

func (*MatrixExecution) UnmarshalJSON added in v1.260904.0

func (e *MatrixExecution) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes execution settings while recording which bounded limits were stated explicitly. encoding/json cannot otherwise distinguish "max_concurrency": 0 from an omitted field, so a mistaken zero would silently run with the default instead of being reported. Unknown-field strictness is preserved here because a custom unmarshaler bypasses the outer decoder's DisallowUnknownFields.

type MatrixFrame added in v1.260904.0

type MatrixFrame struct {
	Enabled              bool              `json:"enabled"`
	DeviceByMatrixDevice map[string]string `json:"device_by_matrix_device,omitempty"`
}

MatrixFrame configures optional local framing for matrix artifacts.

type MatrixOptions added in v1.260904.0

type MatrixOptions struct {
	MaxConcurrency    int
	MaxConcurrencySet bool
	MaxAttempts       int
	MaxAttemptsSet    bool
	RetryBackoff      time.Duration
	RetryBackoffSet   bool
}

MatrixOptions contains command-line overrides. Zero values use plan defaults.

type MatrixOutput added in v1.260904.0

type MatrixOutput struct {
	RawDir    string      `json:"raw_dir,omitempty"`
	FramedDir string      `json:"framed_dir,omitempty"`
	ReviewDir string      `json:"review_dir,omitempty"`
	Frame     MatrixFrame `json:"frame,omitempty"`
}

MatrixOutput configures the three local artifact directories.

type MatrixPlan added in v1.260904.0

type MatrixPlan struct {
	Version         int                    `json:"version"`
	BasePlan        string                 `json:"base_plan"`
	Devices         []MatrixDevice         `json:"devices"`
	Locales         []string               `json:"locales"`
	Appearances     []string               `json:"appearances"`
	ContentVariants []MatrixContentVariant `json:"content_variants"`
	Execution       MatrixExecution        `json:"execution,omitempty"`
	Output          MatrixOutput           `json:"output,omitempty"`
	// contains filtered or unexported fields
}

MatrixPlan describes the Cartesian product to execute over a base screenshot plan.

func LoadMatrixPlan added in v1.260904.0

func LoadMatrixPlan(path string) (*MatrixPlan, error)

LoadMatrixPlan reads a JSON or JSONC matrix plan without resolving its base plan.

type MatrixResult added in v1.260904.0

type MatrixResult struct {
	PlanPath      string              `json:"planPath"`
	BundleID      string              `json:"bundleId,omitempty"`
	RawDir        string              `json:"rawDir"`
	FramedDir     string              `json:"framedDir"`
	ReviewDir     string              `json:"reviewDir"`
	Status        string              `json:"status"`
	TotalCells    int                 `json:"totalCells"`
	Succeeded     int                 `json:"succeeded"`
	Failed        int                 `json:"failed"`
	Canceled      int                 `json:"canceled"`
	Retried       int                 `json:"retried"`
	CleanupFailed int                 `json:"cleanupFailed,omitempty"`
	Cells         []MatrixCellResult  `json:"cells"`
	Review        *MatrixReviewResult `json:"review,omitempty"`

	// Total is retained internally for callers that build reports directly;
	// the public output uses totalCells.
	Total int `json:"-"`
}

MatrixResult is printed after a matrix run and is also the source for review artifacts.

func RunMatrix added in v1.260904.0

func RunMatrix(ctx context.Context, matrixPath string, matrixPlan *MatrixPlan, options MatrixOptions) (*MatrixResult, error)

RunMatrix loads the base plan, validates the complete matrix, executes local cells, and writes a report even when execution is partially unsuccessful.

func RunMatrixWithDependencies added in v1.260904.0

func RunMatrixWithDependencies(ctx context.Context, matrixPath string, matrixPlan *MatrixPlan, options MatrixOptions, dependencies MatrixDependencies) (*MatrixResult, error)

RunMatrixWithDependencies is the testable implementation of RunMatrix.

type MatrixReviewManifest added in v1.260904.0

type MatrixReviewManifest = asc.MatrixReviewManifest

MatrixReviewManifest and MatrixReviewResult are aliases for the governed output contracts. The screenshots package keeps execution details private while the asc package owns public JSON field naming and renderers.

func LoadMatrixReviewManifest added in v1.260904.0

func LoadMatrixReviewManifest(path string) (*MatrixReviewManifest, error)

LoadMatrixReviewManifest parses a generated matrix review manifest.

type MatrixReviewRequest added in v1.260904.0

type MatrixReviewRequest struct {
	Result      *MatrixResult
	OutputDir   string
	LockContext context.Context
}

MatrixReviewRequest describes the local report to write after a matrix run.

type MatrixReviewResult added in v1.260904.0

type MatrixReviewResult = asc.MatrixReviewResult

MatrixReviewManifest and MatrixReviewResult are aliases for the governed output contracts. The screenshots package keeps execution details private while the asc package owns public JSON field naming and renderers.

func GenerateMatrixReview added in v1.260904.0

func GenerateMatrixReview(ctx context.Context, request MatrixReviewRequest) (*MatrixReviewResult, error)

GenerateMatrixReview writes an offline HTML report and its JSON manifest. It includes every planned cell, including failed and canceled cells.

type MatrixScreenshotResult added in v1.260904.0

type MatrixScreenshotResult struct {
	Name       string `json:"name"`
	Status     string `json:"status"`
	RawPath    string `json:"rawPath,omitempty"`
	FramedPath string `json:"framedPath,omitempty"`
	Width      int    `json:"width,omitempty"`
	Height     int    `json:"height,omitempty"`
}

MatrixScreenshotResult describes one screenshot step in a cell review.

type MatrixValidationError added in v1.260904.0

type MatrixValidationError struct {
	Err error
}

MatrixValidationError marks failures that are deterministic input errors and must be reported with CLI usage semantics before any run side effect.

func (*MatrixValidationError) Error added in v1.260904.0

func (e *MatrixValidationError) Error() string

func (*MatrixValidationError) Unwrap added in v1.260904.0

func (e *MatrixValidationError) Unwrap() error

type Plan

type Plan struct {
	Version  int          `json:"version"`
	App      PlanApp      `json:"app"`
	Defaults PlanDefaults `json:"defaults,omitempty"`
	Steps    []PlanStep   `json:"steps"`
}

Plan defines a deterministic screenshot automation sequence.

func LoadPlan

func LoadPlan(path string) (*Plan, error)

LoadPlan reads and validates a plan file.

func LoadPlanUnvalidated

func LoadPlanUnvalidated(path string) (*Plan, error)

LoadPlanUnvalidated reads and parses a plan file without validation.

type PlanApp

type PlanApp struct {
	BundleID        string   `json:"bundle_id"`
	UDID            string   `json:"udid,omitempty"`
	OutputDir       string   `json:"output_dir,omitempty"`
	LaunchArguments []string `json:"launch_arguments,omitempty"`
	// contains filtered or unexported fields
}

PlanApp contains app/simulator defaults for a run.

type PlanDefaults

type PlanDefaults struct {
	PostActionDelayMS int `json:"post_action_delay_ms,omitempty"`
}

PlanDefaults defines default timing behavior.

type PlanStep

type PlanStep struct {
	Action         StepAction `json:"action"`
	Name           *string    `json:"name,omitempty"`
	Label          *string    `json:"label,omitempty"`
	ID             *string    `json:"id,omitempty"`
	Contains       *string    `json:"contains,omitempty"`
	Text           *string    `json:"text,omitempty"`
	Keycodes       []int      `json:"keycodes,omitempty"`
	X              *float64   `json:"x,omitempty"`
	Y              *float64   `json:"y,omitempty"`
	DurationMS     *int       `json:"duration_ms,omitempty"`
	TimeoutMS      *int       `json:"timeout_ms,omitempty"`
	PollIntervalMS *int       `json:"poll_interval_ms,omitempty"`
}

PlanStep is one executable action in the plan.

type PlanValidationCode

type PlanValidationCode string

PlanValidationCode classifies validation failures.

const (
	PlanErrUnsupportedVersion PlanValidationCode = "unsupported_version"
	PlanErrMissingBundleID    PlanValidationCode = "missing_bundle_id"
	PlanErrMissingSteps       PlanValidationCode = "missing_steps"
	PlanErrNegativeDelay      PlanValidationCode = "negative_post_action_delay"
	PlanErrMissingAction      PlanValidationCode = "missing_action"
	PlanErrTapMissingTarget   PlanValidationCode = "tap_missing_target"
	PlanErrTypeMissingText    PlanValidationCode = "type_missing_text"
	PlanErrKeycodesMissing    PlanValidationCode = "keycodes_missing"
	PlanErrKeycodeInvalid     PlanValidationCode = "keycode_invalid"
	PlanErrWaitMissingMS      PlanValidationCode = "wait_missing_duration_ms"
	PlanErrWaitForMissingBy   PlanValidationCode = "wait_for_missing_matcher"
	PlanErrWaitForNegTimeout  PlanValidationCode = "wait_for_negative_timeout"
	PlanErrWaitForNegPoll     PlanValidationCode = "wait_for_negative_poll"
	PlanErrScreenshotNoName   PlanValidationCode = "screenshot_missing_name"
	PlanErrUnsupportedAction  PlanValidationCode = "unsupported_action"
)

type PlanValidationError

type PlanValidationError struct {
	Code    PlanValidationCode
	Step    int
	Message string
}

PlanValidationError describes a structured plan validation failure.

func (*PlanValidationError) Error

func (e *PlanValidationError) Error() string

type Provider

type Provider interface {
	Capture(ctx context.Context, req CaptureRequest) (pngPath string, err error)
}

Provider captures a single screenshot and returns the path to the PNG.

type ReviewApproveRequest

type ReviewApproveRequest struct {
	OutputDir    string
	ManifestPath string
	ApprovalPath string
	AllReady     bool
	Keys         []string
	ScreenshotID string
	Locale       string
	Device       string
}

ReviewApproveRequest configures updates to approved.json.

type ReviewApproveResult

type ReviewApproveResult struct {
	ManifestPath  string   `json:"manifest_path"`
	ApprovalPath  string   `json:"approval_path"`
	Matched       int      `json:"matched"`
	Added         int      `json:"added"`
	TotalApproved int      `json:"total_approved"`
	Keys          []string `json:"keys,omitempty"`
}

ReviewApproveResult summarizes approval updates.

func ApproveReview

func ApproveReview(ctx context.Context, req ReviewApproveRequest) (*ReviewApproveResult, error)

ApproveReview writes/updates approval keys for review entries.

type ReviewEntry

type ReviewEntry struct {
	Key               string   `json:"key"`
	ScreenshotID      string   `json:"screenshot_id"`
	Locale            string   `json:"locale,omitempty"`
	Device            string   `json:"device,omitempty"`
	FramedPath        string   `json:"framed_path"`
	FramedRelative    string   `json:"framed_relative_path"`
	RawPath           string   `json:"raw_path,omitempty"`
	RawRelative       string   `json:"raw_relative_path,omitempty"`
	Width             int      `json:"width"`
	Height            int      `json:"height"`
	DisplayTypes      []string `json:"display_types,omitempty"`
	ValidAppStoreSize bool     `json:"valid_app_store_size"`
	Status            string   `json:"status"`
	Approved          bool     `json:"approved"`
	ApprovalState     string   `json:"approval_state"`
}

ReviewEntry represents one framed screenshot row in review artifacts.

type ReviewManifest

type ReviewManifest struct {
	GeneratedAt  string        `json:"generated_at"`
	RawDir       string        `json:"raw_dir,omitempty"`
	FramedDir    string        `json:"framed_dir"`
	OutputDir    string        `json:"output_dir"`
	ApprovalPath string        `json:"approval_path"`
	Summary      ReviewSummary `json:"summary"`
	Entries      []ReviewEntry `json:"entries"`
}

ReviewManifest is the JSON artifact for agent/human checks.

func LoadReviewManifest

func LoadReviewManifest(path string) (*ReviewManifest, error)

LoadReviewManifest parses a generated review manifest from disk.

type ReviewOpenRequest

type ReviewOpenRequest struct {
	OutputDir string
	HTMLPath  string
	DryRun    bool
}

ReviewOpenRequest configures opening a generated review HTML file.

type ReviewOpenResult

type ReviewOpenResult struct {
	HTMLPath string `json:"html_path"`
	Opened   bool   `json:"opened"`
}

ReviewOpenResult describes the resolved review HTML path and open state.

func OpenReview

func OpenReview(ctx context.Context, req ReviewOpenRequest) (*ReviewOpenResult, error)

OpenReview opens the generated review HTML in the default browser.

type ReviewRequest

type ReviewRequest struct {
	RawDir       string // optional; missing raw files are reported
	FramedDir    string // required
	OutputDir    string // optional, defaults to ./screenshots/review
	ApprovalPath string // optional, defaults to <output-dir>/approved.json
}

ReviewRequest configures generation of screenshot review artifacts.

type ReviewResult

type ReviewResult struct {
	ManifestPath string `json:"manifest_path"`
	HTMLPath     string `json:"html_path"`
	ApprovalPath string `json:"approval_path"`
	FramedDir    string `json:"framed_dir"`
	Total        int    `json:"total"`
	Ready        int    `json:"ready"`
	MissingRaw   int    `json:"missing_raw"`
	InvalidSize  int    `json:"invalid_size"`
	Approved     int    `json:"approved"`
	Pending      int    `json:"pending"`
}

ReviewResult is printed by CLI after artifacts are written.

func GenerateReview

func GenerateReview(ctx context.Context, req ReviewRequest) (*ReviewResult, error)

GenerateReview creates manifest and HTML side-by-side report artifacts.

type ReviewSummary

type ReviewSummary struct {
	Total           int `json:"total"`
	Ready           int `json:"ready"`
	MissingRaw      int `json:"missing_raw"`
	InvalidSize     int `json:"invalid_size"`
	Approved        int `json:"approved"`
	PendingApproval int `json:"pending_approval"`
}

ReviewSummary aggregates status/approval totals across all entries.

type RunResult

type RunResult struct {
	BundleID  string          `json:"bundle_id"`
	UDID      string          `json:"udid"`
	OutputDir string          `json:"output_dir"`
	Steps     []RunStepResult `json:"steps"`
}

RunResult is the structured output for a plan run.

func RunPlan

func RunPlan(ctx context.Context, plan *Plan) (*RunResult, error)

RunPlan executes a validated plan.

type RunStepResult

type RunStepResult struct {
	Index      int    `json:"index"`
	Action     string `json:"action"`
	Status     string `json:"status"`
	DurationMS int64  `json:"duration_ms"`
	Error      string `json:"error,omitempty"`
}

RunStepResult reports one executed step.

type StepAction

type StepAction string

StepAction is one supported automation step.

const (
	ActionLaunch      StepAction = "launch"
	ActionTap         StepAction = "tap"
	ActionType        StepAction = "type"
	ActionKeySequence StepAction = "key_sequence"
	ActionWait        StepAction = "wait"
	ActionWaitFor     StepAction = "wait_for"
	ActionScreenshot  StepAction = "screenshot"
)

type WatchCycleResult

type WatchCycleResult struct {
	Name    string `json:"name"`
	Path    string `json:"path"`
	Success bool   `json:"success"`
	Error   string `json:"error,omitempty"`
}

WatchCycleResult describes one screenshot generated per watch cycle.

type WatchOptions

type WatchOptions struct {
	// ReviewOutputDir, when non-empty, triggers automatic review HTML/manifest
	// regeneration after each successful kou generate cycle.
	ReviewOutputDir string
	// ReviewRawDir is the raw screenshots directory for review generation.
	ReviewRawDir string
}

WatchOptions configures optional review regeneration after each watch cycle.

Jump to

Keyboard shortcuts

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