Documentation
¶
Overview ¶
Package forge provides the IssueTracker interface and implementations for GitHub, Gitea, and GitLab.
The interface abstracts git forge operations so the dispatcher, agents, and MCP server work identically regardless of the underlying platform. See docs/forge-compatibility.md for the API surface comparison.
Index ¶
- type Branch
- type Comment
- type Commit
- type CreateIssueRequest
- type CreatePRRequest
- type Event
- type EventType
- type FileEntry
- type Issue
- type IssueTracker
- type ListOptions
- type ListPROptions
- type MergeMethod
- type PullRequest
- type PullRequestManager
- type RepoReader
- type SearchResult
- type State
- type UpdateIssueRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Branch ¶
type Branch struct {
Name string `json:"name"`
LastCommit string `json:"last_commit"`
UpdatedAt time.Time `json:"updated_at"`
}
Branch represents a git branch in the repository.
type Commit ¶
type Commit struct {
SHA string `json:"sha"`
Message string `json:"message"`
Author string `json:"author"`
Date time.Time `json:"date"`
}
Commit represents a single commit in the repository log.
type CreateIssueRequest ¶
CreateIssueRequest contains the fields needed to create a new issue.
type CreatePRRequest ¶
type CreatePRRequest struct {
Title string `json:"title"`
Body string `json:"body"`
Head string `json:"head"`
Base string `json:"base"`
}
CreatePRRequest contains the fields needed to create a pull request.
type Event ¶
type Event struct {
Type EventType
IssueNumber int
Issue *Issue
Comment *Comment
Label string
Assignee string
}
Event represents a change detected on the forge.
type FileEntry ¶
type FileEntry struct {
Name string `json:"name"`
Path string `json:"path"`
Type string `json:"type"` // "file", "dir", "symlink"
Size int `json:"size"`
}
FileEntry represents a single file or directory in the repository tree.
type Issue ¶
type Issue struct {
Number int
Title string
Body string
State State
Labels []string
Assignees []string
CreatedAt time.Time
UpdatedAt time.Time
ClosedAt *time.Time
}
Issue represents a forge issue in Samverk's domain.
type IssueTracker ¶
type IssueTracker interface {
// Issues
CreateIssue(ctx context.Context, req *CreateIssueRequest) (*Issue, error)
GetIssue(ctx context.Context, number int) (*Issue, error)
UpdateIssue(ctx context.Context, number int, req *UpdateIssueRequest) (*Issue, error)
ListIssues(ctx context.Context, opts *ListOptions) ([]*Issue, error)
// Comments
AddComment(ctx context.Context, number int, body string) (*Comment, error)
ListComments(ctx context.Context, number int) ([]*Comment, error)
// Labels
SetLabels(ctx context.Context, number int, labels []string) error
AddLabel(ctx context.Context, number int, label string) error
RemoveLabel(ctx context.Context, number int, label string) error
// Assignment
Assign(ctx context.Context, number int, assignee string) error
Unassign(ctx context.Context, number int, assignee string) error
// Event watching (polling-based initially; webhook support planned via issue #8)
Watch(ctx context.Context, handler func(Event)) error
}
IssueTracker is the platform-agnostic interface for git forge issue operations. Implementations exist for GitHub (internal/forge/github) and Gitea (planned).
type ListOptions ¶
ListOptions controls filtering and pagination for issue listing.
type ListPROptions ¶
type ListPROptions struct {
State State `json:"state,omitempty"`
Head string `json:"head,omitempty"`
Base string `json:"base,omitempty"`
Page int `json:"page,omitempty"`
PerPage int `json:"per_page,omitempty"`
}
ListPROptions controls filtering for pull request listing.
type MergeMethod ¶
type MergeMethod string
MergeMethod specifies how a pull request should be merged.
const ( MergeMethodMerge MergeMethod = "merge" MergeMethodSquash MergeMethod = "squash" MergeMethodRebase MergeMethod = "rebase" )
type PullRequest ¶
type PullRequest struct {
Number int `json:"number"`
Title string `json:"title"`
Body string `json:"body"`
State State `json:"state"`
Head string `json:"head"`
Base string `json:"base"`
Mergeable bool `json:"mergeable"`
Draft bool `json:"draft"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
PullRequest represents a pull request in Samverk's domain.
type PullRequestManager ¶
type PullRequestManager interface {
CreatePullRequest(ctx context.Context, req *CreatePRRequest) (*PullRequest, error)
GetPullRequest(ctx context.Context, number int) (*PullRequest, error)
ListPullRequests(ctx context.Context, opts *ListPROptions) ([]*PullRequest, error)
MergePullRequest(ctx context.Context, number int, method MergeMethod, commitMsg string) error
}
PullRequestManager provides pull request operations on a git forge.
type RepoReader ¶
type RepoReader interface {
ListFiles(ctx context.Context, path, ref string) ([]FileEntry, error)
ReadFile(ctx context.Context, path, ref string) ([]byte, error)
GetDiff(ctx context.Context, base, head string) (string, error)
ListBranches(ctx context.Context) ([]Branch, error)
GetCommitLog(ctx context.Context, branch string, limit int) ([]Commit, error)
SearchCode(ctx context.Context, query string) ([]SearchResult, error)
}
RepoReader provides read-only access to a git repository's contents.
type SearchResult ¶
type SearchResult struct {
Path string `json:"path"`
LineNumber int `json:"line_number"`
Line string `json:"line"`
}
SearchResult represents a single code search match.
type UpdateIssueRequest ¶
UpdateIssueRequest contains the fields to update on an existing issue. Nil pointer fields are left unchanged.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package gitea implements the forge.IssueTracker interface for Gitea using the official Gitea Go SDK.
|
Package gitea implements the forge.IssueTracker interface for Gitea using the official Gitea Go SDK. |
|
Package github implements the forge.IssueTracker interface for GitHub using the google/go-github SDK.
|
Package github implements the forge.IssueTracker interface for GitHub using the google/go-github SDK. |