git

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 5 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func BranchName

func BranchName(task *pm.Task) string

BranchName returns the branch name for a task: cloop/task-<id>-<slug>.

func CheckoutBranch

func CheckoutBranch(workDir, branch string) error

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

func CommitTaskArtifacts(workDir string, task *pm.Task) error

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

func CreateTaskBranch(workDir string, task *pm.Task) (string, error)

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

func CurrentBranch(workDir string) (string, error)

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

func MergeBranch(workDir, targetBranch, taskBranch string) error

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.

Jump to

Keyboard shortcuts

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