git

package
v0.1.0-beta Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BranchName

func BranchName(teamID, teamName string, taskID int64) string

BranchName returns the agentary-style branch name for a task: agentary/<team_id>/<team>/T<NNNN>. teamID is the internal team UUID; teamName is the display name; taskID is the task number.

func CreateWorktree

func CreateWorktree(ctx context.Context, worktreePath, sourceURL, branchName string) (baseSHA string, err error)

CreateWorktree creates a worktree for the task: clones sourceURL into worktreePath and checks out branch branchName (creating it from main or HEAD). Returns baseSHA (commit at branch creation). If the directory already exists, returns the current HEAD there without re-cloning.

func DeleteWorktree

func DeleteWorktree(ctx context.Context, worktreePath string) error

DeleteWorktree removes the worktree directory and optionally deletes the branch in the main repo. If worktreePath is empty or the path doesn't exist, no-op (returns nil).

func Diff

func Diff(ctx context.Context, worktreePath, baseSHA, headRef string) (string, error)

Diff returns git diff baseSHA..headRef in worktreePath (for review UI). headRef is typically "HEAD" or branch name.

func MergeInWorktree

func MergeInWorktree(ctx context.Context, worktreePath, branchName string) error

MergeInWorktree runs git checkout main (or master) and git merge branchName in the worktree. Used by the merge workflow stage to merge the task branch into main.

func RebaseOntoMain

func RebaseOntoMain(ctx context.Context, worktreePath, branchName string) error

RebaseOntoMain checks out branchName, fetches origin, and rebases onto origin/main (or origin/master). No-op if worktreePath or branchName is empty.

func RunTestCmd

func RunTestCmd(ctx context.Context, worktreePath, testCmd string) error

RunTestCmd runs testCmd (e.g. from repo.test_cmd) in worktreePath. Uses sh -c for shell semantics.

func WorktreePath

func WorktreePath(home, teamName, repoName string, taskID int64) string

WorktreePath returns the path for a task worktree under home: <home>/protected/teams/<team>/worktrees/<repo>-T<id>.

Types

This section is empty.

Jump to

Keyboard shortcuts

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