submit

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package submit provides a TUI component for displaying the progress of a stack submission.

Package submit provides a TUI component for displaying the progress of a stack submission.

Index

Constants

View Source
const (
	// StatusSubmitting indicates the branch is currently being submitted
	StatusSubmitting Status = "submitting"
	// StatusSyncing indicates the branch metadata is being synced
	StatusSyncing Status = "syncing"
	// StatusDone indicates the branch submission was successful
	StatusDone Status = "done"
	// StatusError indicates the branch submission failed
	StatusError Status = "error"
	// StatusPending indicates the branch is waiting to be submitted
	StatusPending Status = "pending"
	// SkipReasonNoChanges indicates the branch was skipped because it has no changes
	SkipReasonNoChanges = "no changes"
	// ActionUpdate indicates the branch will update an existing PR
	ActionUpdate = engine.SubmitActionUpdate
	// ActionCreate indicates the branch will create a new PR
	ActionCreate = engine.SubmitActionCreate
)

Variables

This section is empty.

Functions

func DisplayBranchName added in v0.22.0

func DisplayBranchName(branchName string) string

DisplayBranchName returns a compact branch name for submit output.

func FormatClosingSummary added in v0.22.0

func FormatClosingSummary(items []Item, skipped int, elapsed time.Duration) string

FormatClosingSummary renders the one-line run summary: counts by outcome plus elapsed time, e.g. "✓ 1 created, 2 updated, 4 unchanged (6.2s)".

func FormatCompactRow added in v0.22.0

func FormatCompactRow(item Item, width int, spinnerView string, styles Styles) string

FormatCompactRow renders a single submit progress row.

func FormatFailureSummary added in v0.22.0

func FormatFailureSummary(items []Item) string

FormatFailureSummary renders failed branches with their errors. The progress view is cleared when the TUI exits, so failures must be re-emitted as persistent output or they vanish from the terminal.

func FormatFinalList added in v0.22.0

func FormatFinalList(items []Item) string

FormatFinalList renders the persisted post-submit result: one row per branch with its final status, the row hyperlinked to its PR. Raw URL lines print only for newly created PRs — those are the ones the user needs to open; updated PRs rarely need their URL re-pasted.

func FormatSoloRow added in v0.22.0

func FormatSoloRow(item Item, spinnerView string, styles Styles) string

FormatSoloRow renders the progress row for a single-branch submit. The branch name is omitted — the plan line already named it — so the row is just the status icon and detail (e.g. " ✓ #1270 created").

func FormatSoloSummary added in v0.22.0

func FormatSoloSummary(items []Item) string

FormatSoloSummary renders the post-submit result for a single-branch submit: the PR ref and action on one line, the URL on the next, both indented. Unlike the stack summary there is no "Pull requests" header — one PR needs no list.

func PRRef added in v0.22.0

func PRRef(item Item) string

PRRef returns a display PR number, deriving it from URL when necessary.

func TruncateMiddle added in v0.22.0

func TruncateMiddle(s string, maxWidth int) string

TruncateMiddle shortens s to maxWidth display cells, preserving both ends.

Types

type Item

type Item struct {
	BranchName string
	Action     engine.SubmitAction
	PRNumber   *int
	Status     Status
	IsSkipped  bool
	SkipReason string
	URL        string
	Error      error
}

Item represents a branch being submitted

type Model

type Model struct {
	core.BaseModel // Embedded for ReadySignaler interface
	Items          []Item
	Warnings       []string // formatted warning lines, rendered after the rows and persisted on exit
	Solo           bool     // single-branch submit — drop the count header and per-row name

	Styles Styles
	// contains filtered or unexported fields
}

Model is the bubbletea model for submit progress. It embeds core.BaseModel for standard lifecycle handling.

func NewModel

func NewModel(items []Item) *Model

NewModel creates a new submit model

func (*Model) Init

func (m *Model) Init() tea.Cmd

Init initializes the model.

func (*Model) Update

func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles messages and updates the model.

func (*Model) View

func (m *Model) View() tea.View

View renders the model as a string.

type ProgressCompleteMsg

type ProgressCompleteMsg struct {
	Skipped int           // branches skipped in the plan, shown as "unchanged"
	Elapsed time.Duration // total run time; zero when unknown
}

ProgressCompleteMsg is sent when all submissions are finished.

type ProgressUpdateMsg

type ProgressUpdateMsg struct {
	BranchName string
	Status     Status
	URL        string
	Err        error
}

ProgressUpdateMsg is sent to update the status of a specific branch submission

type Status added in v0.22.0

type Status string

Status is the submission progress state of a branch. It mirrors the actions-layer submit.BranchStatus values; adapters convert at the boundary.

type Styles

type Styles struct {
	SpinnerStyle lipgloss.Style
	DoneStyle    lipgloss.Style
	ErrorStyle   lipgloss.Style
	BranchStyle  lipgloss.Style
	DimStyle     lipgloss.Style
}

Styles defines the visual styling for the submit component. It uses the shared style definitions from internal/tui/style for consistency.

func DefaultStyles

func DefaultStyles() Styles

DefaultStyles returns the default styles for the submit component, using shared styles from the style package for consistency.

type WarningMsg added in v0.22.0

type WarningMsg struct {
	BranchName string
	Warning    string
}

WarningMsg surfaces a non-fatal warning for a branch (e.g. labels could not be applied). Warnings render below the progress rows and persist on exit.

Jump to

Keyboard shortcuts

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