Documentation
¶
Overview ¶
Package forge abstracts code-hosting (forge) operations such as opening pull requests. It is deliberately separate from internal/tracker: a pull request is a code-repository concept, not an issue-tracker one. Some backends (GitHub, GitLab) are both a tracker and a forge and implement both interfaces; pure issue trackers (Jira, Linear, Shortcut, …) implement only tracker.Provider.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsForgeKind ¶
IsForgeKind reports whether a tracker kind also acts as a code forge that can open pull requests. It gates which `human <kind>` command trees expose the `pr` subcommand, so pure issue trackers don't advertise an operation they can't perform.
func KindForHost ¶
KindForHost maps a git remote host to a forge kind, or "" if the host is not a recognised forge. It mirrors the host→kind mapping in tracker/urlparse.go so a repository's origin remote can be matched to a configured forge.
func ParseRemoteURL ¶
ParseRemoteURL extracts the host and "owner/repo" path from a git remote URL, accepting the common forms:
https://github.com/owner/repo.git ssh://git@github.com/owner/repo.git git@github.com:owner/repo.git (scp-style, no scheme)
A trailing ".git" and surrounding slashes are stripped. It returns ok=false for input it cannot parse into a non-empty host and repo path.
Types ¶
type Creator ¶
type Creator interface {
CreatePullRequest(ctx context.Context, pr *PullRequest) (*PullRequest, error)
}
Creator opens a pull request on a code-forge host.
type Forge ¶
type Forge interface {
Creator
}
Forge aggregates code-forge operations. Today that is only pull-request creation; future operations (list, merge, status) extend this interface.
type PullRequest ¶
type PullRequest struct {
Repo string // "owner/repo" (GitHub) or "group/project" (GitLab)
Base string // target branch the PR merges into (e.g. "main")
Head string // source branch holding the changes
Title string
Body string
Number int // populated on return
URL string // populated on return
}
PullRequest carries both the request to open a pull request and the created result. Repo/Base/Head/Title/Body are inputs; Number/URL are populated on return (Title is echoed back from the forge).