Documentation
¶
Index ¶
- func BranchName(teamID, teamName string, taskID int64) string
- func CreateWorktree(ctx context.Context, worktreePath, sourceURL, branchName string) (baseSHA string, err error)
- func DeleteWorktree(ctx context.Context, worktreePath string) error
- func Diff(ctx context.Context, worktreePath, baseSHA, headRef string) (string, error)
- func MergeInWorktree(ctx context.Context, worktreePath, branchName string) error
- func RebaseOntoMain(ctx context.Context, worktreePath, branchName string) error
- func RunTestCmd(ctx context.Context, worktreePath, testCmd string) error
- func WorktreePath(home, teamName, repoName string, taskID int64) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BranchName ¶
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 ¶
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 ¶
Diff returns git diff baseSHA..headRef in worktreePath (for review UI). headRef is typically "HEAD" or branch name.
func MergeInWorktree ¶
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 ¶
RebaseOntoMain checks out branchName, fetches origin, and rebases onto origin/main (or origin/master). No-op if worktreePath or branchName is empty.
func RunTestCmd ¶
RunTestCmd runs testCmd (e.g. from repo.test_cmd) in worktreePath. Uses sh -c for shell semantics.
func WorktreePath ¶
WorktreePath returns the path for a task worktree under home: <home>/protected/teams/<team>/worktrees/<repo>-T<id>.
Types ¶
This section is empty.