forge

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 License: MIT Imports: 3 Imported by: 0

README

Pull Requests

Lets human open pull requests on code-hosting platforms, keeping that work separate from issue tracking. It recognises which of your configured backends can actually host code and only offers pull-request actions where they make sense.

  • Opens a pull request from one branch to another
  • Sets the title and description of a PR
  • Returns the new pull request number and URL
  • Knows which backends can host pull requests
  • Matches your git remote to the right forge
  • Parses HTTPS, SSH, and scp-style remote URLs

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

func IsForgeKind(kind string) bool

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

func KindForHost(host string) string

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

func ParseRemoteURL(raw string) (host, repo string, ok bool)

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).

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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