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 ¶
const ( StateConfiguring = "CONFIGURING" StateStaging = "STAGING" StateInstalling = "INSTALLING" StateValidating = "VALIDATING" StateInitialized = "INITIALIZED" )
Init transaction states (operational only).
const Dir = ".gtt/cli"
Dir is the CLI state directory inside a project.
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 ¶
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.
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"
}
Selections are the human's choices collected by init.
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"`
}
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 ¶
ClearJournal removes the journal once the transaction ends.
func (Store) LoadJournal ¶
LoadJournal returns the journal of an interrupted transaction, if any.
func (Store) Log ¶
Log appends one line to the operation log. Values must never be secrets; callers pass operation names and results only.
func (Store) SaveJournal ¶
SaveJournal persists the journal.