plan

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	Type   string `json:"type"`
	Target string `json:"target"`
	Detail string `json:"detail"`
}

Action describes a change to be applied.

type AliasChange

type AliasChange struct {
	OldAnchor string `json:"oldAnchor"`
	NewAnchor string `json:"newAnchor"`
	StableID  string `json:"stableID"`
	Reason    string `json:"reason"`
}

AliasChange describes an auto-aliasing action.

type Applier

type Applier struct {
	// contains filtered or unexported fields
}

Applier applies state plans.

func NewApplier

func NewApplier(cfg *config.Config) (*Applier, error)

NewApplier creates an applier.

func (*Applier) Apply

func (a *Applier) Apply(plan *Plan, opts ApplyOptions) (*ApplyResult, error)

Apply executes a plan.

type ApplyOptions

type ApplyOptions struct {
	AckCold bool
	DryRun  bool
}

ApplyOptions configures plan application.

type ApplyResult

type ApplyResult struct {
	Applied          bool     `json:"applied"`
	ManifestUpdated  bool     `json:"manifestUpdated"`
	SchemaUpdated    bool     `json:"schemaUpdated"`
	AckFileGenerated bool     `json:"ackFileGenerated,omitempty"`
	Actions          []string `json:"actions"`
	Errors           []string `json:"errors,omitempty"`
}

ApplyResult contains the result of applying a plan.

type Artifacts

type Artifacts struct {
	Manifest string `json:"manifest"`
	Schema   string `json:"schema"`
	Bindings string `json:"bindings,omitempty"`
}

Artifacts contains state artifact paths.

type ColdDeployAck

type ColdDeployAck struct {
	AckVersion       string               `json:"ackVersion"`
	SchemaHashBefore string               `json:"schemaHashBefore"`
	SchemaHashAfter  string               `json:"schemaHashAfter"`
	Reason           string               `json:"reason"`
	Details          *ColdDeployAckDetail `json:"details,omitempty"`
	AcknowledgedBy   string               `json:"acknowledgedBy"`
	Timestamp        string               `json:"timestamp"`
}

ColdDeployAck records a cold deploy acknowledgement.

func (*ColdDeployAck) Validate

func (ack *ColdDeployAck) Validate() error

Validate ensures the ack matches the required schema.

type ColdDeployAckDetail

type ColdDeployAckDetail struct {
	RemovedStableIDs    []string                  `json:"removedStableIDs,omitempty"`
	ChangedFingerprints []FingerprintChangeDetail `json:"changedFingerprints,omitempty"`
	Notes               string                    `json:"notes,omitempty"`
}

ColdDeployAckDetail provides additional context for a cold deploy.

type Diagnostic

type Diagnostic struct {
	Code     string      `json:"code"`
	Severity string      `json:"severity"`
	Message  string      `json:"message"`
	Location *Location   `json:"location,omitempty"`
	Context  interface{} `json:"context,omitempty"`
	Fixes    []Fix       `json:"fixes,omitempty"`
}

Diagnostic is a warning or error.

type FingerprintChangeDetail

type FingerprintChangeDetail struct {
	StableID string `json:"stableID"`
	From     string `json:"from"`
	To       string `json:"to"`
}

FingerprintChangeDetail describes a fingerprint change for an entity.

type Fix

type Fix struct {
	Description string `json:"description"`
	Auto        bool   `json:"auto"`
	Command     string `json:"command,omitempty"`
}

Fix describes a possible fix.

type IdentityChanges

type IdentityChanges struct {
	AddedPrimitives    []PrimitiveChange `json:"addedPrimitives,omitempty"`
	RemovedPrimitives  []PrimitiveChange `json:"removedPrimitives,omitempty"`
	AliasedPrimitives  []AliasChange     `json:"aliasedPrimitives,omitempty"`
	AddedSessionKeys   []string          `json:"addedSessionKeys,omitempty"`
	RemovedSessionKeys []string          `json:"removedSessionKeys,omitempty"`
}

IdentityChanges describes anchor/ID changes.

type Location

type Location struct {
	File     string `json:"file"`
	Line     int    `json:"line"`
	Column   int    `json:"column"`
	Function string `json:"function,omitempty"`
}

Location identifies a source position.

type Plan

type Plan struct {
	GeneratedAt     time.Time       `json:"generatedAt"`
	ToolVersion     string          `json:"toolVersion"`
	SchemaImpact    SchemaImpact    `json:"schemaImpact"`
	IdentityChanges IdentityChanges `json:"identityChanges"`
	Warnings        []Diagnostic    `json:"warnings,omitempty"`
	Errors          []Diagnostic    `json:"errors,omitempty"`
	Actions         []Action        `json:"actions"`
	RequiresAck     bool            `json:"requiresAck"`
	Artifacts       Artifacts       `json:"artifacts"`
}

Plan represents the result of analyzing state changes.

func (*Plan) MarshalJSON

func (p *Plan) MarshalJSON() ([]byte, error)

MarshalJSON produces deterministic JSON output.

type Planner

type Planner struct {
	// contains filtered or unexported fields
}

Planner computes state plans.

func NewPlanner

func NewPlanner(cfg *config.Config) (*Planner, error)

NewPlanner creates a planner.

func (*Planner) ComputePlan

func (p *Planner) ComputePlan() (*Plan, error)

ComputePlan analyzes the current source and produces a plan.

type PrimitiveChange

type PrimitiveChange struct {
	AnchorKey string `json:"anchorKey"`
	StableID  string `json:"stableID"`
	Kind      string `json:"kind"`
	Persisted bool   `json:"persisted"`
}

PrimitiveChange describes an added or removed primitive.

type SchemaImpact

type SchemaImpact struct {
	Classification string   `json:"classification"`
	Reason         string   `json:"reason,omitempty"`
	AffectedIDs    []string `json:"affectedIDs,omitempty"`
	AffectedKeys   []string `json:"affectedKeys,omitempty"`
}

SchemaImpact describes the deploy classification.

Jump to

Keyboard shortcuts

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