app

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 9 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 app holds the orchestration both front-ends call.

It exists because the CLI and the TUI must not be two implementations. The first attempt put these helpers in internal/cli and had the TUI import them, which produced an import cycle the moment the CLI needed to launch the TUI -- a useful accident, because it forced the shared layer to be named rather than left implicit in whichever package happened to define it first.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnyFailed

func AnyFailed(outcomes []Outcome) bool

AnyFailed reports whether any outcome failed.

func ApplyWorkspace

func ApplyWorkspace(pack *config.PackConfig, workspace string)

ApplyWorkspace resolves a relative pack_root against the workspace setting.

Every shipped config names an absolute /work/<pack>, which is where the Docker image sees the mounted checkouts. A relative root is for running the binary on a laptop against sibling checkouts without editing four configs.

func CheckAll

func CheckAll(ctx context.Context, packs []*config.PackConfig) []checker.Result

CheckAll resolves upstream status for every pack, in order.

Sequential on purpose. Polling four registries concurrently would save a second or two and cost the deterministic output order that makes a CI log diffable between runs.

func LoadPacks

func LoadPacks(configDir, only string) ([]*config.PackConfig, error)

LoadPacks loads one pack, or every pack in registry order.

Shared so the two front-ends cannot disagree about what "every pack" means.

func LoadPacksIn

func LoadPacksIn(configDir, only, workspace string) ([]*config.PackConfig, error)

LoadPacksIn is LoadPacks with a relative pack_root resolved against workspace, so the checker reads the vendored version from the right tree.

func PackSettings

func PackSettings(stack settings.Stack, pack *config.PackConfig) (settings.Resolved, error)

PackSettings resolves one pack's settings over the run-wide stack.

The pack layer is the config's `settings` block. It is parsed here rather than at load time because the schema has already checked its shape, and only the settings package knows which keys are pack-scoped.

func RunRecipe

func RunRecipe(_ context.Context, pack *config.PackConfig, version string, opts recipes.Options) (pipeline.Result, error)

RunRecipe builds a pack's pipelines and runs them in order.

Aborts on the first failure and returns that result, rather than running the rest: the emoji recipe's trailing pipeline commits whatever the three asset pipelines left on disk, so continuing past a failed fetch would commit a half-refreshed pack.

Types

type Checker

type Checker interface {
	CheckPack(ctx context.Context, pack *config.PackConfig) checker.Result
}

Checker is the version check a sync runs first.

type Outcome

type Outcome struct {
	Pack    string
	Status  Status
	Current string
	Latest  string
	DryRun  bool
	Result  pipeline.Result
	Err     error
}

Outcome is one pack's result.

func Sync

func Sync(ctx context.Context, packs []*config.PackConfig, opts SyncOptions) []Outcome

Sync refreshes every pack that is behind upstream (or every pack, with force), and returns one outcome per pack in input order.

Two things fail loudly here that the Python let pass:

  • An upstream whose latest version cannot be resolved is a failure, not a skip. The Python printed a yellow line and exited 0, so a dead registry or a renamed package looked exactly like an up-to-date pack, every Monday, indefinitely.
  • A pack that declares no sinks is a failure unless this is a dry run: it would fetch, transform, and then write nothing, and report success.

Neither stops the other packs. One dead registry must not hold back the rest of the run; it makes the run exit non-zero once the rest are done.

func (Outcome) Failed

func (o Outcome) Failed() bool

Failed reports whether the outcome should make the run exit non-zero.

type RunFunc

type RunFunc func(ctx context.Context, pack *config.PackConfig, version string, opts recipes.Options) (pipeline.Result, error)

RunFunc builds and runs one pack's recipe.

type Status

type Status string

Status is how one pack's sync ended.

const (
	StatusUpToDate   Status = "up-to-date"
	StatusSynced     Status = "synced"
	StatusFailed     Status = "failed"
	StatusUnresolved Status = "unresolved"
)

The outcomes a sync can have.

type SyncOptions

type SyncOptions struct {
	// Stack is the run-wide settings; each pack's own layer is merged in.
	Stack settings.Stack

	// ConfigDir is handed to the recipes (the bundled manifest lives there).
	ConfigDir string

	// Concurrency bounds how many packs run at once. Below 1 means 1.
	Concurrency int

	Checker Checker
	Run     RunFunc

	// Starting and Done are called around each pack, from that pack's
	// goroutine, for progress output. Either may be nil. Calls are
	// serialised, so a reporter need not lock.
	Starting func(pack *config.PackConfig, result checker.Result, dryRun bool)
	Done     func(Outcome)
}

SyncOptions configures Sync.

Jump to

Keyboard shortcuts

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