Documentation
¶
Index ¶
- Variables
- type BatchIssueUpdate
- type BatchUpdateResult
- type Client
- func (c *Client) AddBlockedBy(ctx context.Context, issueNumber string, blockingNumber string) error
- func (c *Client) AddToProject(ctx context.Context, issueNumber string, projectID string) error
- func (c *Client) BatchEditIssues(ctx context.Context, updates []BatchIssueUpdate) (BatchUpdateResult, error)
- func (c *Client) CloseIssue(ctx context.Context, number string, reason string) error
- func (c *Client) CreateComment(ctx context.Context, issueNumber string, body string) error
- func (c *Client) CreateIssue(ctx context.Context, issue issue.Issue) (string, error)
- func (c *Client) CreateLabel(ctx context.Context, name, color string) error
- func (c *Client) CreateMilestone(ctx context.Context, title string) error
- func (c *Client) EditIssue(ctx context.Context, number string, change IssueChange) error
- func (c *Client) EnrichWithRelationships(ctx context.Context, iss *issue.Issue) error
- func (c *Client) EnrichWithRelationshipsBatch(ctx context.Context, issues []issue.Issue) error
- func (c *Client) GetIssue(ctx context.Context, number string) (issue.Issue, error)
- func (c *Client) GetIssueNodeID(ctx context.Context, number string) (string, error)
- func (c *Client) GetIssueRelationships(ctx context.Context, number string) (IssueRelationships, string, error)
- func (c *Client) GetIssueRelationshipsBatch(ctx context.Context, numbers []string) (map[string]IssueRelationships, error)
- func (c *Client) GetIssuesBatch(ctx context.Context, numbers []string) (map[string]issue.Issue, error)
- func (c *Client) HasProjectScope(ctx context.Context) (bool, error)
- func (c *Client) ListIssueTypes(ctx context.Context) ([]IssueType, error)
- func (c *Client) ListIssues(ctx context.Context, state string, labels []string) ([]issue.Issue, error)
- func (c *Client) ListIssuesWithRelationships(ctx context.Context, opts ListIssuesOptions) (ListIssuesResult, error)
- func (c *Client) ListLabels(ctx context.Context) ([]Label, error)
- func (c *Client) ListMilestones(ctx context.Context) ([]Milestone, error)
- func (c *Client) ListProjects(ctx context.Context) ([]Project, error)
- func (c *Client) RemoveBlockedBy(ctx context.Context, issueNumber string, blockingNumber string) error
- func (c *Client) RemoveFromProject(ctx context.Context, issueNumber string, projectID string) error
- func (c *Client) ReopenIssue(ctx context.Context, number string) error
- func (c *Client) SetIssueType(ctx context.Context, issueNumber string, issueTypeID string) error
- func (c *Client) SetParent(ctx context.Context, issueNumber string, parentNumber string) error
- func (c *Client) SetProgress(fn func(ProgressEvent))
- func (c *Client) SyncProjects(ctx context.Context, issueNumber string, localProjects []string, ...) error
- func (c *Client) SyncRelationships(ctx context.Context, issueNumber string, local issue.Issue) error
- type ExecRunner
- type IssueChange
- type IssueRelationships
- type IssueType
- type Label
- type ListIssuesOptions
- type ListIssuesResult
- type Milestone
- type ProgressEvent
- type ProgressStage
- type Project
- type Runner
Constants ¶
This section is empty.
Variables ¶
var ErrMissingProjectScope = errors.New("missing 'project' scope - run 'gh auth refresh -s project' to enable")
ErrMissingProjectScope is returned when the token lacks project scope
Functions ¶
This section is empty.
Types ¶
type BatchIssueUpdate ¶ added in v0.2.0
type BatchIssueUpdate struct {
Number string // Issue number
Title *string // New title (nil = no change)
Body *string // New body (nil = no change)
Milestone *string // New milestone title (nil = no change, empty string = remove)
Labels []string // Final set of labels (nil = no change)
Assignees []string // Final set of assignees (nil = no change)
ClearMilestone bool // If true, remove milestone
ClearLabels bool // If true and Labels is nil, remove all labels
ClearAssignees bool // If true and Assignees is nil, remove all assignees
}
BatchIssueUpdate represents updates to apply to a single issue.
type BatchUpdateResult ¶ added in v0.2.0
type BatchUpdateResult struct {
Updated []string // Issue numbers that were updated
Errors map[string]string // Issue number -> error message
}
BatchUpdateResult contains the result of a batch update operation.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) AddBlockedBy ¶
AddBlockedBy adds a blocking relationship (issueNumber is blocked by blockingNumber).
func (*Client) AddToProject ¶
AddToProject adds an issue to a project. Returns nil if successful, or an error (including scope errors).
func (*Client) BatchEditIssues ¶ added in v0.2.0
func (c *Client) BatchEditIssues(ctx context.Context, updates []BatchIssueUpdate) (BatchUpdateResult, error)
BatchEditIssues updates multiple issues in a single GraphQL call. This is much faster than calling EditIssue for each issue individually. Note: This only handles title, body, milestone, labels, and assignees. State changes, relationships, issue types, and projects must be handled separately.
func (*Client) CloseIssue ¶
func (*Client) CreateComment ¶
CreateComment posts a comment on an issue.
func (*Client) CreateIssue ¶
func (*Client) CreateLabel ¶
CreateLabel creates a new label with the given name and color. Color should be a 6-character hex string without the # prefix.
func (*Client) CreateMilestone ¶
CreateMilestone creates a new milestone with the given title.
func (*Client) EnrichWithRelationships ¶
EnrichWithRelationships fetches parent and blocking relationships for an issue via GraphQL and updates the issue in place.
func (*Client) EnrichWithRelationshipsBatch ¶
EnrichWithRelationshipsBatch fetches parent and blocking relationships for multiple issues in a single API call and updates each issue in place.
func (*Client) GetIssueNodeID ¶
GetIssueNodeID fetches the GraphQL node ID for an issue.
func (*Client) GetIssueRelationships ¶
func (c *Client) GetIssueRelationships(ctx context.Context, number string) (IssueRelationships, string, error)
GetIssueRelationships fetches parent and blocking relationships for an issue via GraphQL.
func (*Client) GetIssueRelationshipsBatch ¶
func (c *Client) GetIssueRelationshipsBatch(ctx context.Context, numbers []string) (map[string]IssueRelationships, error)
GetIssueRelationshipsBatch fetches parent and blocking relationships for multiple issues in a single GraphQL call. Returns a map of issue number -> relationships.
func (*Client) GetIssuesBatch ¶
func (c *Client) GetIssuesBatch(ctx context.Context, numbers []string) (map[string]issue.Issue, error)
GetIssuesBatch fetches multiple issues in a single GraphQL call. Returns a map of issue number -> issue. Issues that don't exist are not included.
func (*Client) HasProjectScope ¶
HasProjectScope checks if the current GitHub token has the 'project' scope.
func (*Client) ListIssueTypes ¶
ListIssueTypes fetches all issue types from the repository's organization. Issue types are an organization-level feature, so this queries the org that owns the repo. Returns an empty list (not an error) if issue types are not available.
func (*Client) ListIssues ¶
func (*Client) ListIssuesWithRelationships ¶
func (c *Client) ListIssuesWithRelationships(ctx context.Context, opts ListIssuesOptions) (ListIssuesResult, error)
ListIssuesWithRelationships fetches issues with their relationships and label colors using GraphQL with pagination. This is much faster than separate calls.
func (*Client) ListLabels ¶
ListLabels fetches all labels from the repository with their colors. Uses the GitHub API with pagination to fetch all labels (gh label list is limited to 1000).
func (*Client) ListMilestones ¶
ListMilestones fetches all milestones from the repository.
func (*Client) ListProjects ¶
ListProjects fetches all projects accessible from the repository. This includes both organization projects and user projects. Returns an empty list (not an error) if projects are not available or scope is missing.
func (*Client) RemoveBlockedBy ¶
func (c *Client) RemoveBlockedBy(ctx context.Context, issueNumber string, blockingNumber string) error
RemoveBlockedBy removes a blocking relationship (issueNumber is no longer blocked by blockingNumber).
func (*Client) RemoveFromProject ¶
RemoveFromProject removes an issue from a project. Returns nil if successful, or an error (including scope errors).
func (*Client) SetIssueType ¶
SetIssueType sets or clears the issue type for an issue. If issueTypeID is empty, the issue type is cleared.
func (*Client) SetParent ¶
SetParent sets or removes the parent of an issue. If parentNumber is empty, the parent relationship is removed.
func (*Client) SetProgress ¶
func (c *Client) SetProgress(fn func(ProgressEvent))
func (*Client) SyncProjects ¶
func (c *Client) SyncProjects(ctx context.Context, issueNumber string, localProjects []string, knownProjects map[string]string) error
SyncProjects syncs the project memberships for an issue. It compares the desired state (from local issue) with the current remote state and adds/removes project memberships as needed. Returns nil on success. Scope errors are logged but don't cause failure.
func (*Client) SyncRelationships ¶
func (c *Client) SyncRelationships(ctx context.Context, issueNumber string, local issue.Issue) error
SyncRelationships syncs the parent and blocking relationships for an issue. It compares the desired state (from local issue) with the current remote state and makes the necessary mutations.
type ExecRunner ¶
type ExecRunner struct{}
type IssueChange ¶
type IssueChange struct {
Title *string
Body *string
Milestone *string
IssueType *string
AddProjects []string
RemoveProjects []string
AddLabels []string
RemoveLabels []string
AddAssignees []string
RemoveAssignees []string
State *string
StateReason *string
StateTransition *string
StateWasOpen bool
StateWasClosed bool
StateIsOpen bool
StateIsClosed bool
}
IssueChange captures the edits we need to apply to an issue.
type IssueRelationships ¶
type IssueRelationships struct {
Parent *issue.IssueRef
BlockedBy []issue.IssueRef
Blocks []issue.IssueRef
IssueType string
Projects []string
}
IssueRelationships holds the parent, blocking, issue type, and project data for an issue.
type IssueType ¶
type IssueType struct {
ID string `json:"id"`
Name string `json:"name"`
Description string `json:"description"`
}
IssueType represents a GitHub issue type (org-level).
type ListIssuesOptions ¶
type ListIssuesOptions struct {
State string // "open", "closed", or "all"
Labels []string // Filter by labels
Since time.Time // Only fetch issues updated after this time (zero means no filter)
}
ListIssuesOptions configures the ListIssuesWithRelationships query.
type ListIssuesResult ¶
ListIssuesResult contains the result of ListIssuesWithRelationships
type Milestone ¶
type Milestone struct {
Title string `json:"title"`
Description string `json:"description"`
DueOn *string `json:"due_on"` // ISO 8601 format
State string `json:"state"` // open or closed
}
Milestone represents a GitHub milestone.
type ProgressEvent ¶
type ProgressEvent struct {
Stage ProgressStage
Page int
Issues int
PageIssues int
Total int
}
type ProgressStage ¶
type ProgressStage string
const ( ProgressListIssuesPageStart ProgressStage = "list_issues_page_start" ProgressListIssuesPageDone ProgressStage = "list_issues_page_done" )