syncengine

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2026 License: MPL-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Package syncengine is tk's sole push boundary: selection policy (auto-commit-only filter, unreachable/disabled/config-error reporting, participants grouped by git-root) and the per-root flow (preflight, lock order, snapshot, fetch/integrate, mid-rebase resume, sync-time integrity via integrity.RunBatches, push-if-ahead). Cobra-free; the composition root supplies ambient or all-registered inputs.

Index

Constants

This section is empty.

Variables

View Source
var ErrNeedsAttention = errors.New("tk sync: one or more roots need attention (see the lines above)")

ErrNeedsAttention is the process-level failure class when roots need human follow-up.

Functions

func FrontmatterHasMarkers

func FrontmatterHasMarkers(abs string) bool

FrontmatterHasMarkers reports whether path's YAML fence (or whole file if no fence) still carries git conflict markers. Shared by resume and CLI merge tests.

func FrontmatterHasStatusConflict

func FrontmatterHasStatusConflict(abs string) bool

FrontmatterHasStatusConflict reports whether path's frontmatter still lists status_conflict. Shared by resume and CLI merge tests.

func HasConflictMarker

func HasConflictMarker(data []byte) bool

HasConflictMarker reports whether data contains a line starting with a git conflict marker. Shared by resume and CLI merge tests.

Types

type AmbientScope

type AmbientScope struct {
	Name string
	Dir  string
}

AmbientScope is one successfully resolved ambient scope.

type Deps

type Deps struct {
	Ctx      context.Context
	Cue      *cue.Context
	StateDir string
	Reg      *registry.Registry
	DB       *index.DB
	Rec      *reconcile.Reconciler
}

Deps are machine-local services the sync engine needs.

type Input

type Input struct {
	// AllRegistered: every registered scope (from --all or ambient ErrNoScope).
	AllRegistered bool
	// Ambient is set when AllRegistered is false.
	Ambient *AmbientScope
}

Input is either one ambient scope (already resolved at the composition root) or all-registered mode. The package does not read env, cwd, or Cobra.

type Participant

type Participant struct {
	Name string
	Dir  string
}

Participant is one auto-commit scope under a git-root.

type Reporter

type Reporter interface {
	Out(line string)
	Err(line string)
}

Reporter receives progress and diagnostic lines (stdout-class Out, stderr-class Err).

type Result

type Result struct {
	// NeedsAttention is true when any root or selection line requires human follow-up.
	NeedsAttention bool
}

Result is the exit-mapping outcome of a sync run. Progress lines stream on Reporter.

func Run

func Run(deps Deps, rep Reporter, in Input) (Result, error)

Run selects targets and syncs each git-root. Per-root failures isolate under multi-root. Selection-time lines (unreachable, disabled, config, empty-set) and per-root progress stream on rep; Result only carries NeedsAttention for process exit mapping.

type Selection

type Selection struct {
	Targets     []Target
	Disabled    []string
	ConfigErrs  []string
	Unreachable []string
	Candidates  int
}

Selection is the structured outcome of sole-push-boundary target selection.

func Select

func Select(deps Deps, in Input) (Selection, error)

Select applies sole-push-boundary selection policy and returns structured results.

type Target

type Target struct {
	Root         string
	Participants []Participant
}

Target is one git-root with its auto-commit participants.

Jump to

Keyboard shortcuts

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