model

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2026 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package model holds the shared, budget-agnostic intermediate types that flow through the gather → fit → render pipeline.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action string

Action is the reduced primary-action bucket for a resource change.

const (
	ActionAdd     Action = "add"
	ActionChange  Action = "change"
	ActionDestroy Action = "destroy"
	ActionReplace Action = "replace"
)

type AttrDiff

type AttrDiff struct {
	Name     string
	Variants []Variant
	Selected int // chosen variant index; fit mutates this
}

AttrDiff is one changed attribute with its ordered variants (index 0 = preferred).

func (AttrDiff) AtLast

func (a AttrDiff) AtLast() bool

AtLast reports whether the selected variant is already the least-detail one.

func (AttrDiff) Sel

func (a AttrDiff) Sel() Variant

Sel returns the currently-selected variant.

type Change

type Change struct {
	Address string
	Type    string
	Action  Action
	Attrs   []AttrDiff // populated for update/replace; empty for terse create/delete
}

Change is one resource change within a stack.

type Class

type Class struct {
	Name string
	Icon string // "" when no glyph
}

Class is the classification result for a stack.

func (Class) Label

func (c Class) Label() string

Label renders the class as "icon name" or just "name".

type Counts

type Counts struct {
	Add, Change, Destroy, Replace int
}

Counts holds per-stack action tallies (no-ops excluded).

func (Counts) AnyChange

func (c Counts) AnyChange() bool

AnyChange reports whether the stack has at least one non-no-op change.

func (Counts) Total

func (c Counts) Total() int

Total returns the sum of all action counts.

type Level

type Level string

Level identifies a render variant, ordered most → least detail.

const (
	LevelInline     Level = "inline"     // scalar / sensitive / known-after-apply
	LevelStructural Level = "structural" // changed paths only
	LevelLineDiff   Level = "linediff"   // unified line diff
	LevelSummary    Level = "summary"    // magnitude only
	LevelHidden     Level = "hidden"     // omitted
)

type RenderMode

type RenderMode int

RenderMode is the terminal-cascade level chosen by fit.

const (
	ModeFull        RenderMode = iota // table + per-stack details
	ModeSummaryOnly                   // table + notice, no details
	ModeMinimal                       // one-line aggregate + notice
)

type Report

type Report struct {
	Title       string
	Marker      string
	Classified  bool // whether to show the Class column
	Stacks      []Stack
	Mode        RenderMode
	Notice      string // cascade notice (set by fit when degrading)
	DetailsOpen bool   // render <details open> when true
}

Report is the complete intermediate model.

type Stack

type Stack struct {
	Name    string
	Counts  Counts
	Class   *Class // nil when classification is disabled
	Changes []Change
}

Stack is one stack's parsed, classified plan.

type Variant

type Variant struct {
	Level   Level
	Content string // markdown fragment (lines inside the “`diff block)
	Bytes   int    // len(Content); used by fit for largest-first selection
}

Variant is one possible rendering of a single attribute diff.

Jump to

Keyboard shortcuts

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