preflight

package
v3.34.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cleanup

func Cleanup(dir string, ref string, debug bool) error

Cleanup deletes the preflight branch from the remote. If the branch no longer exists on the remote, it is treated as success.

Types

type FileChange

type FileChange struct {
	Status string // e.g. "M", "A", "D", "R"
	Path   string
}

FileChange represents a single file changed in the snapshot.

func (FileChange) StatusSymbol

func (f FileChange) StatusSymbol() string

StatusSymbol returns a human-readable symbol for the file change status.

type Region

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

Region is a named section of a Screen that can be independently updated. All methods are safe for concurrent use.

func (*Region) AppendLine

func (r *Region) AppendLine(line string)

AppendLine adds a line to this region and redraws from this region downward.

func (*Region) SetLines

func (r *Region) SetLines(lines []string)

SetLines replaces the content of this region and redraws from this region downward. Regions above are untouched.

type Screen

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

Screen manages multiple named regions on a terminal, each independently rewritable. Regions are rendered top-to-bottom in insertion order.

Usage:

s := NewScreen(os.Stdout)
completed := s.AddRegion("completed")
jobs := s.AddRegion("jobs")
status := s.AddRegion("status")

jobs.SetLines([]string{"  ● lint  running", "  ● test  running"})
status.SetLines([]string{"  ⠋ Watching…"})

// Promote a completed job:
completed.AppendLine("  ✓ lint  passed")

// Update active jobs:
jobs.SetLines([]string{"  ● test  running"})

func NewScreen

func NewScreen(w *os.File) *Screen

NewScreen creates a Screen that writes to the given file (typically os.Stdout).

func (*Screen) AddRegion

func (s *Screen) AddRegion(id string) *Region

AddRegion appends a new named region to the bottom of the screen and returns it. Regions render in insertion order. Must be called before any updates.

func (*Screen) Flush

func (s *Screen) Flush()

Flush resets all tracking. After Flush, the screen will not overwrite any previously rendered lines.

type SnapshotOption

type SnapshotOption func(*snapshotConfig)

SnapshotOption configures Snapshot behavior.

func WithDebug

func WithDebug() SnapshotOption

WithDebug enables verbose git output on failure.

type SnapshotResult

type SnapshotResult struct {
	Commit string
	Ref    string
	Branch string
	Files  []FileChange
}

SnapshotResult holds the output of a successful snapshot operation.

func Snapshot

func Snapshot(dir string, preflightID uuid.UUID, opts ...SnapshotOption) (*SnapshotResult, error)

Snapshot pushes the current working tree state to a remote preflight ref. If there are uncommitted changes, it creates a temporary commit containing them without touching the real git index. If the worktree is clean, it pushes HEAD directly.

Jump to

Keyboard shortcuts

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