lifecycle

package
v1.10.0 Latest Latest
Warning

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

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

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package lifecycle keeps the CLI's own operational state: the resolution record, the init transaction journal and the operation log. All of it is derived and operational - never an authority - and lives under .gtt/cli/.

Index

Constants

View Source
const (
	StateConfiguring = "CONFIGURING"
	StateStaging     = "STAGING"
	StateInstalling  = "INSTALLING"
	StateValidating  = "VALIDATING"
	StateInitialized = "INITIALIZED"
)

Init transaction states (operational only).

View Source
const Dir = ".gtt/cli"

Dir is the CLI state directory inside a project.

View Source
const JournalFile = ".gtt-init-transaction.json"

JournalFile records an init transaction in progress. It lives at the project root because .gtt/ may not exist yet.

Variables

This section is empty.

Functions

func Timestamp

func Timestamp() string

Timestamp is the UTC time in RFC 3339.

Types

type Event

type Event struct {
	At     string `json:"at"`
	Event  string `json:"event"`
	Detail string `json:"detail,omitempty"`
}

Event is one entry of the CLI history (updates, clean exports, snapshots).

type Journal

type Journal struct {
	Schema     int               `json:"schema"`
	State      string            `json:"state"`
	StartedAt  string            `json:"started_at"`
	Bootstrap  Resolution        `json:"bootstrap"`
	Selections Selections        `json:"selections"`
	CorePaths  []string          `json:"core_paths"`
	CoreLedger map[string]string `json:"core_ledger,omitempty"`
	Completed  []string          `json:"completed"`
}

Journal is the recorded state of an init transaction.

func (Journal) Done

func (j Journal) Done(step string) bool

Done reports whether a step was completed.

type Resolution

type Resolution struct {
	ID            string `json:"id"`
	Version       string `json:"version"`
	SchemaVersion int    `json:"schema_version"`
	Channel       string `json:"channel"`
	Source        string `json:"source"`
	Origin        string `json:"origin"`
	Checksum      string `json:"checksum"`
	Integrity     string `json:"integrity"`
	Signature     string `json:"signature"`
	ResolvedAt    string `json:"resolved_at"`
}

Resolution is the record of the Bootstrap a project was installed from.

type Selections

type Selections struct {
	Detected      []string `json:"detected"`
	Participating []string `json:"participating"`
	Primary       string   `json:"primary"`
	Language      string   `json:"language"`
	Profile       string   `json:"profile"`
	Sources       []Source `json:"sources"`
	Questionnaire bool     `json:"questionnaire"`
	// The development method answered at setup (Method Governance). Empty
	// means unanswered: the method stays OPEN, nothing is recorded.
	DevStyle string `json:"dev_style,omitempty"` // pack ids, comma separated, or "help"
	DevStart string `json:"dev_start,omitempty"` // a pack id, "direct" or "help"
	// Delivery Planning answered at setup (D1-D3). Empty means unanswered: OPEN.
	DeliveryWho     string `json:"delivery_who,omitempty"`
	DeliveryLanes   string `json:"delivery_lanes,omitempty"`
	DeliveryHorizon string `json:"delivery_horizon,omitempty"`
	DeliveryTeam    string `json:"delivery_team,omitempty"`
}

Selections are the human's choices collected by init.

type Source

type Source struct {
	Path string `json:"path"`
	Type string `json:"type"`
}

Source is one selected initial source.

type State

type State struct {
	Schema     int               `json:"schema"`
	Notice     string            `json:"notice"`
	CLI        map[string]string `json:"cli"`
	Bootstrap  *Resolution       `json:"bootstrap,omitempty"`
	CoreLedger map[string]string `json:"core_ledger,omitempty"`
	// Rewritten are the package files the Bootstrap's own operations were
	// seen to rewrite during an install or an update. They differ from the
	// release without having been customized by anyone.
	Rewritten []string `json:"bootstrap_rewritten,omitempty"`
	History   []Event  `json:"history,omitempty"`
	// Language is the interaction language the project recorded through the
	// Bootstrap, kept here so that every command speaks it without asking.
	Language string `json:"language,omitempty"`
}

State is .gtt/cli/state.json.

type Store

type Store struct{ Root string }

Store reads and writes CLI state for one project.

func (Store) ClearJournal

func (s Store) ClearJournal() error

ClearJournal removes the journal once the transaction ends.

func (Store) Load

func (s Store) Load() (State, error)

Load returns the state; a project without one yields an empty state.

func (Store) LoadJournal

func (s Store) LoadJournal() (*Journal, error)

LoadJournal returns the journal of an interrupted transaction, if any.

func (Store) Log

func (s Store) Log(fields map[string]any)

Log appends one line to the operation log. Values must never be secrets; callers pass operation names and results only.

func (Store) Record

func (s Store) Record(event, detail string) error

Record appends a history event and saves.

func (Store) Save

func (s Store) Save(st State) error

Save writes the state.

func (Store) SaveJournal

func (s Store) SaveJournal(j *Journal) error

SaveJournal persists the journal.

Jump to

Keyboard shortcuts

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