workops

package
v0.0.92 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MergeBack

func MergeBack(ctx context.Context, opts MergeBackOptions) error

MergeBack lands a linked worktree into main without removing the worktree. When DryRun is true, plans only (no HEAD or worktree mutations). When Sync=true under DryRun, still no mutations (post-land sync is no-op). When Sync=true and not DryRun, runs post-land FF sync (CLI --merge-back --sync parity).

func Push

func Push(ctx context.Context, opts PushOptions) error

Push publishes the current branch (and optional tags) from checkout/main. DryRun is a no-op for the network (no remote ref change).

func Sync added in v0.0.38

func Sync(checkout string, dryRun bool) error

Sync runs FF bi-directional sync for a checkout's main + linked worktrees. DryRun plans only (no merges). Library callers may prefer Quiet via internal options; this exported form prints a summary like wrk --sync.

func TagNext

func TagNext(ctx context.Context, opts TagNextOptions) (tag string, err error)

TagNext plans or applies the next release tag(s) at main tip and returns the primary tag string (first of TagNextAll.Tags — root-primary when present). DryRun returns the planned primary tag without creating refs. Kept as a BC helper for callers that need a single string.

func WhereMain

func WhereMain(checkout string) (mainAbs string, err error)

WhereMain resolves the main repository absolute path for a checkout. Linked worktree → main abs; main checkout → cleaned self path.

Types

type MergeBackOptions

type MergeBackOptions struct {
	WorktreeDir string
	Sync        bool
	DryRun      bool
	WrkHome     string
	// Confirm is called when the land plan needs user confirmation.
	// nil means auto-confirm (library / hermetic tests).
	// CLI injects worktree.PromptConfirmPlan.
	Confirm func(plan worktree.MergeBackPlan) (bool, error)
}

MergeBackOptions configures landing a linked worktree into main. Remove is always false for this API (worktree is kept).

type MergeBackResult added in v0.0.38

type MergeBackResult struct {
	SourcePath string
	TargetPath string
	Branch     string
	Relation   string
	// Action: "noop", "merged", "rebased-and-merged", "dry-run", "aborted", …
	Action  string
	Message string
}

MergeBackResult describes the outcome of a land (for CLI composition).

func MergeBackFull added in v0.0.38

func MergeBackFull(ctx context.Context, opts MergeBackOptions) (*MergeBackResult, error)

MergeBackFull is like MergeBack but returns the land outcome for composition (target path, relation, action/message). Aborted confirm returns Action "aborted" with a nil error.

type Project

type Project struct {
	Path      string
	OriginURL string // optional; may be empty when not stored
}

Project is one registered main repository entry from wrk home.

func ListProjects

func ListProjects(wrkHome string) ([]Project, error)

ListProjects reads registered main paths from {wrkHome}/projects.json. Empty wrkHome uses default wrk-home resolution (WRK_HOME or ~/.wrk).

type PushOptions

type PushOptions struct {
	Checkout string
	DryRun   bool
	// Force uses git push --force-with-lease for the branch only.
	// Tags are always pushed without force.
	Force bool
	Tags  []string
}

PushOptions configures pushing the current branch and optional tags.

type StatusReport

type StatusReport struct {
	MainPath     string
	CheckoutPath string
	Branch       string
	HeadShort    string
	IsWorktree   bool
	// Optional dirty counts when cheap to compute.
	Added   int
	Changed int
	Renamed int
	Deleted int
}

StatusReport is a structured checkout report for Status.

func Status

func Status(checkout string) (*StatusReport, error)

Status returns a structured report for the given checkout path.

type TagNextOptions

type TagNextOptions struct {
	Checkout string
	DryRun   bool
	// HeadRef is the commit or symbolic ref to plan/apply against.
	// Empty defaults to "HEAD" (main tip after resolve).
	HeadRef string
}

TagNextOptions configures planning/applying the next release tag(s).

type TagNextResult added in v0.0.38

type TagNextResult struct {
	// Tags are planned next tag names (DryRun) or created tag names (apply),
	// covering all scopes that planned a NextTag (root first when present).
	Tags []string
	// MainRepo is the resolved main repository absolute path.
	MainRepo string
}

TagNextResult is the multi-scope outcome of TagNextAll.

func TagNextAll added in v0.0.38

func TagNextAll(ctx context.Context, opts TagNextOptions) (TagNextResult, error)

TagNextAll plans or applies next release tags for all scopes at main tip (parity with wrkcli runTagNextAtResult core). DryRun creates no tag refs. HeadRef (optional on TagNextOptions) defaults to "HEAD".

Jump to

Keyboard shortcuts

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