Documentation
¶
Overview ¶
Package deploy is the confirm screen for writing one named image into one env — the "image bump" half of hoist's problem statement, reached with d on the matrix and a tag chosen in internal/app/tags.
It exists as its own screen rather than as a mode of internal/app/plan because the two confirm different things. The plan screen confirms a set: several repos, each tickable, derived from a source env. A deploy confirms one image the operator named outright, so there is nothing to tick and no source to describe — and the questions it should answer ("what is in this build", "what is running now") are not the plan screen's.
From M10 it leads with the work (#85 screen 03/10/11): the commits this deploy ships and which of them migrate the database, with the YAML diff one key away rather than the headline — the diff is the mechanism, and principle 4 already guarantees its shape (one image line per occurrence, verified before git add). When the history cannot be resolved the diff is the only evidence left and becomes the body again, with the reason stated. What it still shares with the plan screen is the rule that no write happens without the bytes available to look at: the diff is always one key away, never absent, and enter means the same thing from either view — whether the operator looked is their call.
Index ¶
- Constants
- type BackMsg
- type History
- type Model
- func (m Model) CapturesText() bool
- func (m Model) ImageRef() string
- func (m Model) Init() tea.Cmd
- func (m Model) KeyScreen() keys.Screen
- func (m Model) Reload(pl gitops.Plan, view service.RepoView) Model
- func (m Model) ResetStarting() Model
- func (m Model) SetSize(width, height int) Model
- func (m Model) SetStyles(s ui.Styles) Model
- func (m Model) Target() string
- func (m Model) Update(msg tea.Msg) (Model, tea.Cmd)
- func (m Model) View() string
- func (m Model) WithHistory(h History) Model
- func (m Model) WithNow(now func() time.Time) Model
- func (m Model) WithView(v service.RepoView) Model
- type RefreshMsg
- type StartMsg
Constants ¶
const ( ModePR = writepath.ModePR ModeDirect = writepath.ModeDirect )
Mode values — plan's own, so the root can treat both screens' StartMsgs the same way (M10: the two packages had spelled them differently while claiming to mirror each other).
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type History ¶
type History struct {
Delta *migrate.Delta
Note string
Declared image.Ref
DeclaredRefs []image.Ref
Since time.Time
}
History is what the picker already learned about the build being deployed, carried in so this screen leads with it without a second fetch (tags.SelectedMsg). Delta is nil when there is none, and Note then says why in a sentence. Declared is what the env declares today — the reference the delta is measured against — and Since when its manifest line last changed (zero when unknown). DeclaredRefs is every distinct reference the env declares for the image repo, Declared first: several when the env is split, and the summary then names each one, since "replacing v1" over an env that also runs v0 claims one declared build where there are two (#151).
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the deploy confirm screen.
func New ¶
New builds the screen for an already-constructed deploy plan. root is the repo checkout the diff is read from; envs decides whether the target is production, which forces PR mode.
func (Model) CapturesText ¶
CapturesText reports whether a keypress belongs to this screen's own text input — true only while the direct-mode confirmation is open.
func (Model) ImageRef ¶ added in v0.2.0
ImageRef is the caller-named reference this deploy would write — RefreshMsg's own root handler reads this back the same way as Target, above.
func (Model) KeyScreen ¶ added in v0.2.0
KeyScreen implements the root's keyed interface (internal/app/screen.go).
func (Model) Reload ¶ added in v0.2.0
Reload is RefreshMsg's own rebuild: the root calls this synchronously once it has rebuilt pl against a fresh *gitops.Repo (mirroring openDeploy's own direct planFn call — AGENTS.md §4.3's reasoning is about resolving a digest, and a deploy plan never resolves one, the reference is caller-supplied), replacing the plan and the diff/commit views it feeds without disturbing anything the operator has already set (mode, the yaml/commits toggle).
func (Model) ResetStarting ¶ added in v0.2.0
ResetStarting clears the one-shot Enter guard starting sets. See its own doc comment.
func (Model) SetSize ¶
SetSize implements the screen contract: the body viewport gets what the frame leaves after the fixed sections.
func (Model) Target ¶ added in v0.2.0
Target is the env this deploy would write into — RefreshMsg's own root handler reads this back to rebuild the same PlanRequest (Deploy: &ref, Target: this) against a fresh repo.
func (Model) WithHistory ¶
WithHistory supplies the commit history the picker loaded. With a delta the commits are the body and the YAML is behind d; without one the YAML is the body and the header says why there is no history.
func (Model) WithView ¶ added in v0.2.0
WithView records the service.RepoView the plan was actually built against (New's own caller, openDeploy, gets this from the same service.PlannedChange planFn returned) — carried into StartMsg.View so the root's StartPromotion call checks freshness against the view THIS plan was built from.
type RefreshMsg ¶ added in v0.2.0
type RefreshMsg struct{}
RefreshMsg is r/F5/ctrl+r: rebuild the diff at fresh origin. The screen has no way to fetch origin itself (AGENTS.md §4.3 — a screen never opens a git/cluster/registry connection), so this asks the root to run the matrix's own completion-triggered refresh (requestMatrixRefresh, the same fetch F5 already runs there) and rebuild this screen once matrix.RepoRefreshedMsg lands with the new *gitops.Repo — internal/app/app.go's own new case, mirroring plan.RefreshMsg exactly (the screen's own shared "r" path).
type StartMsg ¶
type StartMsg struct {
Plan gitops.Plan
Mode string
Confirmed bool
Target string
Image string
// View is the service.RepoView the deploy plan was actually built against (WithView,
// set by the root's openDeploy from the same service.PlannedChange.View planFn returned) —
// carried through so the root's StartPromotion call re-checks freshness against the view
// THIS plan was built from, not whatever the service's current view has since become
// (mirroring plan.StartMsg.View).
View service.RepoView
}
StartMsg is the operator confirming the deploy. Mode mirrors plan.StartMsg's: ModePR opens a pull request, ModeDirect commits straight to the base branch. Confirmed is true only when ModeDirect was reached through this screen's own huh.Confirm — engine.DirectCommitGateStep reads it as the record of that gesture (internal/engine/direct.go).