Documentation
¶
Overview ¶
Package git provides helpers for integrating cloop task execution with git workflows. Each PM task can be executed on its own branch, committed when done, and merged back to the original branch on success.
Index ¶
- func BranchName(task *pm.Task) string
- func CheckoutBranch(workDir, branch string) error
- func CommitTaskArtifacts(workDir string, task *pm.Task) error
- func CreateTaskBranch(workDir string, task *pm.Task) (string, error)
- func CurrentBranch(workDir string) (string, error)
- func MergeBranch(workDir, targetBranch, taskBranch string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BranchName ¶
BranchName returns the branch name for a task: cloop/task-<id>-<slug>.
func CheckoutBranch ¶
CheckoutBranch checks out the named branch (or commit SHA for detached HEAD) without performing any merge. Use this to return to the original branch after a failed task in git mode.
func CommitTaskArtifacts ¶
CommitTaskArtifacts stages all modified/untracked files and creates a commit referencing the task ID and title. The commit message follows the format:
cloop(task-<id>): <title>
If there is nothing to commit (clean tree), the function returns nil without creating an empty commit.
func CreateTaskBranch ¶
CreateTaskBranch creates (and checks out) a new branch named cloop/task-<id>-<slug> from HEAD. If the branch already exists it is checked out as-is (idempotent). Returns the new branch name.
func CurrentBranch ¶
CurrentBranch returns the name of the currently checked-out git branch. Returns an error if the working directory is not inside a git repository.
func MergeBranch ¶
MergeBranch merges taskBranch into targetBranch (typically the branch that was active before CreateTaskBranch was called). After a successful merge the working directory is left on targetBranch.
Uses --no-ff so each task always produces a visible merge commit in the log.
Types ¶
This section is empty.