git

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BranchNamingSuggestion

func BranchNamingSuggestion(branch string) string

BranchNamingSuggestion returns a suggestion message for when no task ID is found.

Types

type Client

type Client struct{}

Client wraps git command execution.

func NewClient

func NewClient() *Client

NewClient returns a new git client.

func (*Client) CurrentBranch

func (c *Client) CurrentBranch() (string, error)

CurrentBranch returns the current git branch name.

func (*Client) IsInsideWorkTree

func (c *Client) IsInsideWorkTree() bool

IsInsideWorkTree checks if the current directory is inside a git repository.

func (*Client) LatestCommitMessage

func (c *Client) LatestCommitMessage() (string, error)

LatestCommitMessage returns the subject line of the latest commit.

func (*Client) LatestCommitSHA

func (c *Client) LatestCommitSHA() (string, error)

LatestCommitSHA returns the SHA of the latest commit.

func (*Client) RemoteURL

func (c *Client) RemoteURL(remote string) (string, error)

RemoteURL returns the URL of the specified remote.

func (*Client) TopLevel

func (c *Client) TopLevel() (string, error)

TopLevel returns the root directory of the git repository.

type RepoContext

type RepoContext struct {
	Branch    string
	RemoteURL string
	TaskID    *TaskIDResult
	RepoOwner string
	RepoName  string
}

RepoContext holds detected git context information.

func DetectContext

func DetectContext() (*RepoContext, error)

DetectContext gathers full git context from the current repository.

type TaskIDResult

type TaskIDResult struct {
	// Raw is the full matched string (e.g., "CU-ae27de" or "PROJ-42")
	Raw string
	// ID is the task identifier suitable for API calls
	ID string
	// IsCustomID indicates whether this is a custom prefix ID vs a CU- ID
	IsCustomID bool
}

TaskIDResult holds a parsed task ID from a branch name.

func ExtractTaskID

func ExtractTaskID(branch string) *TaskIDResult

ExtractTaskID attempts to find a ClickUp task ID in a branch name. It tries CU-{hex} first, then PREFIX-{number} patterns.

func ParseTaskID added in v0.9.1

func ParseTaskID(input string) *TaskIDResult

ParseTaskID normalizes a task ID string passed as a CLI argument. It handles CU- prefixed IDs (stripping the prefix), custom prefix IDs (e.g., PROJ-42), and raw IDs (returned as-is).

Jump to

Keyboard shortcuts

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