Documentation
¶
Index ¶
- Constants
- func AuthorInitials(name string) string
- func ExpandPath(path string) (string, error)
- func GenerateIssueWorktreeName(issue *models.IssueInfo, template, generatedTitle string) string
- func GeneratePRWorktreeName(pr *models.PRInfo, template, generatedTitle string) string
- func GitURLToWebURL(gitURL string) string
- func RandomBranchName() string
- func SanitizeBranchName(name string, maxLength int) string
- func SanitizePRURL(raw string) (string, error)
- func WrapANSIContent(content string, width int) string
- type CommitMeta
Constants ¶
const DefaultDirPerms = 0o750
DefaultDirPerms defines directory permissions for created paths.
const DefaultFilePerms = 0o600
DefaultFilePerms defines file permissions for created files.
Variables ¶
This section is empty.
Functions ¶
func AuthorInitials ¶ added in v1.43.0
AuthorInitials returns initials for an author name.
func ExpandPath ¶
ExpandPath expands ~ and environment variables in a path.
func GenerateIssueWorktreeName ¶
GenerateIssueWorktreeName generates a worktree name from an issue using a template. Supports placeholders: {number}, {title}, {generated}
func GeneratePRWorktreeName ¶
GeneratePRWorktreeName generates a worktree name from a PR using a template. Supports placeholders: {number}, {title}, {generated}, {pr_author}
func GitURLToWebURL ¶ added in v1.43.0
GitURLToWebURL converts a git remote URL to a web URL. Handles both SSH (git@github.com:user/repo.git) and HTTPS (https://github.com/user/repo.git) formats.
func RandomBranchName ¶ added in v1.26.0
func RandomBranchName() string
RandomBranchName returns a Docker-style adjective-noun name for temporary branches.
func SanitizeBranchName ¶
SanitizeBranchName sanitizes a branch/title for use as a worktree directory name. - Converts to lowercase - Keeps only alphanumeric characters, replaces everything else with hyphens - Collapses consecutive hyphens - Trims leading/trailing hyphens - Optionally limits length (0 = no limit)
func SanitizePRURL ¶ added in v1.43.0
SanitizePRURL validates and normalises a pull request URL.
func WrapANSIContent ¶ added in v1.43.0
WrapANSIContent wraps terminal-styled content to the target width while preserving ANSI escape sequences.
Types ¶
type CommitMeta ¶ added in v1.43.0
type CommitMeta struct {
SHA string
Author string
Email string
Date string
Subject string
Body []string
}
CommitMeta is parsed commit metadata from a log entry.
func ParseCommitMeta ¶ added in v1.43.0
func ParseCommitMeta(raw string) CommitMeta
ParseCommitMeta parses a raw commit metadata string into its fields.