github

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*github.Client

	// Specialized services - each responsible for a specific domain
	Repositories *RepositoryService
	PullRequests *PullRequestService
	Sessions     *SessionService
	Issues       *IssuesService
	Milestones   *MilestonesService
	Projects     *ProjectsService
	// contains filtered or unexported fields
}

Client wraps the GitHub API client with Jules integration It acts as a facade that delegates to specialized services following SOLID principles: - Single Responsibility: Each service handles one domain area - Open/Closed: New services can be added without modifying existing code - Liskov Substitution: Services can be mocked for testing - Interface Segregation: Each service exposes only relevant methods - Dependency Inversion: Services depend on abstractions (interfaces)

func NewClient

func NewClient(token string, julesClient *jules.Client) *Client

NewClient creates a new GitHub client with authentication and initializes all services This is the main entry point for GitHub operations

type GitRemoteParser

type GitRemoteParser struct{}

GitRemoteParser handles parsing of Git remote URLs and repository detection

func NewGitRemoteParser

func NewGitRemoteParser() *GitRemoteParser

NewGitRemoteParser creates a new git remote parser

func (*GitRemoteParser) GetRepoFromGitRemote

func (p *GitRemoteParser) GetRepoFromGitRemote() (*Repository, error)

GetRepoFromGitRemote detects the GitHub repository from the current directory's git remote

func (*GitRemoteParser) ParseGitHubURL

func (p *GitRemoteParser) ParseGitHubURL(remoteURL string) (*Repository, error)

ParseGitHubURL parses a GitHub URL and extracts owner and repository name Supports both HTTPS and SSH URL formats: - https://github.com/owner/repo.git - git@github.com:owner/repo.git

type Issue

type Issue struct {
	Number    int        `json:"number"`
	Title     string     `json:"title"`
	Body      string     `json:"body"`
	State     string     `json:"state"`
	URL       string     `json:"url"`
	HTMLURL   string     `json:"html_url"`
	Milestone string     `json:"milestone,omitempty"`
	CreatedAt time.Time  `json:"created_at"`
	UpdatedAt time.Time  `json:"updated_at"`
	ClosedAt  *time.Time `json:"closed_at,omitempty"`
	Assignees []string   `json:"assignees"`
	Labels    []string   `json:"labels"`
}

Issue represents a GitHub issue with relevant metadata.

type IssueCreateRequest

type IssueCreateRequest struct {
	Title     string   `json:"title"`
	Body      string   `json:"body,omitempty"`
	Assignees []string `json:"assignees,omitempty"`
	Labels    []string `json:"labels,omitempty"`
	Milestone int      `json:"milestone,omitempty"`
}

IssueCreateRequest represents parameters for creating a new issue

type IssueUpdateRequest

type IssueUpdateRequest struct {
	Title     *string   `json:"title,omitempty"`
	Body      *string   `json:"body,omitempty"`
	State     *string   `json:"state,omitempty"`
	Assignees *[]string `json:"assignees,omitempty"`
	Labels    *[]string `json:"labels,omitempty"`
	Milestone *int      `json:"milestone,omitempty"`
}

IssueUpdateRequest represents parameters for updating an issue

type IssuesService

type IssuesService struct {
	// contains filtered or unexported fields
}

IssuesService handles GitHub Issues operations

func NewIssuesService

func NewIssuesService(client *Client) *IssuesService

NewIssuesService creates a new issues service

func (*IssuesService) AddComment

func (s *IssuesService) AddComment(ctx context.Context, owner, repo string, number int, body string) error

AddComment adds a comment to an issue

func (*IssuesService) AddLabels

func (s *IssuesService) AddLabels(ctx context.Context, owner, repo string, number int, labels []string) error

AddLabels adds labels to an issue

func (*IssuesService) AssignIssue

func (s *IssuesService) AssignIssue(ctx context.Context, owner, repo string, number int, assignees []string) error

AssignIssue assigns users to an issue

func (*IssuesService) CloseIssue

func (s *IssuesService) CloseIssue(ctx context.Context, owner, repo string, number int) (*Issue, error)

CloseIssue closes an issue

func (*IssuesService) CreateIssue

func (s *IssuesService) CreateIssue(ctx context.Context, owner, repo string, req *IssueCreateRequest) (*Issue, error)

CreateIssue creates a new issue in a repository.

func (*IssuesService) GetIssue

func (s *IssuesService) GetIssue(ctx context.Context, owner, repo string, number int) (*Issue, error)

GetIssue retrieves a specific issue

func (*IssuesService) ListIssues

func (s *IssuesService) ListIssues(ctx context.Context, owner, repo string, state string, labels []string) ([]*Issue, error)

ListIssues lists issues for a repository

func (*IssuesService) RemoveLabel

func (s *IssuesService) RemoveLabel(ctx context.Context, owner, repo string, number int, label string) error

RemoveLabel removes a label from an issue

func (*IssuesService) UpdateIssue

func (s *IssuesService) UpdateIssue(ctx context.Context, owner, repo string, number int, req IssueUpdateRequest) (*Issue, error)

UpdateIssue updates an existing issue

type Milestone

type Milestone struct {
	Number       int        `json:"number"`
	Title        string     `json:"title"`
	Description  string     `json:"description"`
	State        string     `json:"state"`
	URL          string     `json:"url"`
	HTMLURL      string     `json:"html_url"`
	OpenIssues   int        `json:"open_issues"`
	ClosedIssues int        `json:"closed_issues"`
	CreatedAt    time.Time  `json:"created_at"`
	UpdatedAt    time.Time  `json:"updated_at"`
	DueOn        *time.Time `json:"due_on,omitempty"`
	ClosedAt     *time.Time `json:"closed_at,omitempty"`
}

Milestone represents a GitHub milestone.

type MilestoneCreateRequest

type MilestoneCreateRequest struct {
	Title       string     `json:"title"`
	Description string     `json:"description,omitempty"`
	DueOn       *time.Time `json:"due_on,omitempty"`
	State       string     `json:"state,omitempty"`
}

MilestoneCreateRequest represents parameters for creating a milestone

type MilestonesService

type MilestonesService struct {
	// contains filtered or unexported fields
}

MilestonesService handles GitHub Milestones operations

func NewMilestonesService

func NewMilestonesService(client *Client) *MilestonesService

NewMilestonesService creates a new milestones service

func (*MilestonesService) CloseMilestone

func (s *MilestonesService) CloseMilestone(ctx context.Context, owner, repo string, number int) (*Milestone, error)

CloseMilestone closes a milestone

func (*MilestonesService) CreateMilestone

func (s *MilestonesService) CreateMilestone(ctx context.Context, owner, repo string, req MilestoneCreateRequest) (*Milestone, error)

CreateMilestone creates a new milestone

func (*MilestonesService) DeleteMilestone

func (s *MilestonesService) DeleteMilestone(ctx context.Context, owner, repo string, number int) error

DeleteMilestone deletes a milestone

func (*MilestonesService) GetMilestone

func (s *MilestonesService) GetMilestone(ctx context.Context, owner, repo string, number int) (*Milestone, error)

GetMilestone retrieves a specific milestone

func (*MilestonesService) ListMilestones

func (s *MilestonesService) ListMilestones(ctx context.Context, owner, repo string, state string) ([]*Milestone, error)

ListMilestones lists milestones for a repository

func (*MilestonesService) UpdateMilestone

func (s *MilestonesService) UpdateMilestone(ctx context.Context, owner, repo string, number int, req MilestoneCreateRequest) (*Milestone, error)

UpdateMilestone updates an existing milestone

type Project

type Project struct {
	ID          int64      `json:"id"`
	Number      int        `json:"number"`
	Title       string     `json:"title"`
	Description string     `json:"description"`
	State       string     `json:"state"`
	URL         string     `json:"url"`
	HTMLURL     string     `json:"html_url"`
	Public      bool       `json:"public"`
	CreatedAt   time.Time  `json:"created_at"`
	UpdatedAt   time.Time  `json:"updated_at"`
	ClosedAt    *time.Time `json:"closed_at,omitempty"`
}

Project represents a GitHub Project (v2).

type ProjectField

type ProjectField struct {
	ID       int64    `json:"id"`
	Name     string   `json:"name"`
	DataType string   `json:"data_type"`
	Options  []string `json:"options,omitempty"`
}

ProjectField represents a field in a GitHub Projects v2 project.

type ProjectsService

type ProjectsService struct {
	// contains filtered or unexported fields
}

ProjectsService handles GitHub Projects (v2) operations Note: Projects v2 uses GraphQL API for most operations This service provides helper methods for common use cases

func NewProjectsService

func NewProjectsService(client *Client) *ProjectsService

NewProjectsService creates a new projects service

func (*ProjectsService) GetOrganizationProject

func (s *ProjectsService) GetOrganizationProject(ctx context.Context, org string, projectNumber int) (*Project, error)

GetOrganizationProject retrieves a specific organization project

func (*ProjectsService) GetUserProject

func (s *ProjectsService) GetUserProject(ctx context.Context, username string, projectNumber int) (*Project, error)

GetUserProject retrieves a specific user project

func (*ProjectsService) ListOrganizationProjects

func (s *ProjectsService) ListOrganizationProjects(ctx context.Context, org string) ([]*Project, error)

ListOrganizationProjects lists Projects v2 for an organization

func (*ProjectsService) ListProjectFields

func (s *ProjectsService) ListProjectFields(ctx context.Context, org string, projectNumber int) ([]*ProjectField, error)

ListProjectFields lists fields for a project

func (*ProjectsService) ListUserProjects

func (s *ProjectsService) ListUserProjects(ctx context.Context, username string) ([]*Project, error)

ListUserProjects lists Projects v2 for a user

type PullRequestService

type PullRequestService struct {
	// contains filtered or unexported fields
}

PullRequestService handles pull request operations

func NewPullRequestService

func NewPullRequestService(client *Client, julesClient *jules.Client) *PullRequestService

NewPullRequestService creates a new pull request service

func (*PullRequestService) GetPullRequestDiff

func (s *PullRequestService) GetPullRequestDiff(ctx context.Context, sessionID string) (string, error)

GetPullRequestDiff retrieves the diff for a PR created by a Jules session

func (*PullRequestService) GetSessionPullRequest

func (s *PullRequestService) GetSessionPullRequest(ctx context.Context, sessionID string) (*github.PullRequest, error)

GetSessionPullRequest retrieves the PR created by a Jules session

func (*PullRequestService) MergePullRequest

func (s *PullRequestService) MergePullRequest(ctx context.Context, prURL string, mergeMethod string) error

MergePullRequest merges a PR created by Jules

type Repository

type Repository struct {
	Owner         string `json:"owner"`
	Name          string `json:"name"`
	FullName      string `json:"full_name"`
	Description   string `json:"description,omitempty"`
	Stars         int    `json:"stars"`
	Forks         int    `json:"forks"`
	OpenIssues    int    `json:"open_issues"`
	DefaultBranch string `json:"default_branch"`
	Private       bool   `json:"private"`
	URL           string `json:"url"`
	UpdatedAt     string `json:"updated_at,omitempty"`
}

Repository represents a GitHub repository with metadata

type RepositoryService

type RepositoryService struct {
	// contains filtered or unexported fields
}

RepositoryService handles repository-related operations

func NewRepositoryService

func NewRepositoryService(client *Client, julesClient *jules.Client) *RepositoryService

NewRepositoryService creates a new repository service

func (*RepositoryService) DiscoverCurrentRepo

func (s *RepositoryService) DiscoverCurrentRepo(ctx context.Context) (*Repository, error)

DiscoverCurrentRepo detects the GitHub repository from the current git remote

func (*RepositoryService) ListAccessibleRepos

func (s *RepositoryService) ListAccessibleRepos(ctx context.Context) ([]*Repository, error)

ListAccessibleRepos lists repositories the user can access

func (*RepositoryService) ListConnectedRepos

func (s *RepositoryService) ListConnectedRepos(ctx context.Context) ([]*Repository, error)

ListConnectedRepos fetches repositories connected to Jules

func (*RepositoryService) SearchRepositories

func (s *RepositoryService) SearchRepositories(ctx context.Context, query string, opts *github.SearchOptions) ([]*Repository, error)

SearchRepositories searches for GitHub repositories using the GitHub Search API

func (*RepositoryService) SyncRepoWithJules

func (s *RepositoryService) SyncRepoWithJules(ctx context.Context, owner, repo string) error

SyncRepoWithJules ensures a repository is connected to Jules

type SessionService

type SessionService struct {
	// contains filtered or unexported fields
}

SessionService handles Jules session operations with GitHub integration

func NewSessionService

func NewSessionService(client *Client, julesClient *jules.Client, repoService *RepositoryService) *SessionService

NewSessionService creates a new session service

func (*SessionService) CreateSessionFromCurrentRepo

func (s *SessionService) CreateSessionFromCurrentRepo(ctx context.Context, prompt string, branch string) (*jules.Session, error)

CreateSessionFromCurrentRepo creates a Jules session using git context

func (*SessionService) CreateSessionFromRepo

func (s *SessionService) CreateSessionFromRepo(ctx context.Context, prompt, owner, repo, branch string) (*jules.Session, error)

CreateSessionFromRepo creates a Jules session for a specific GitHub repository

Jump to

Keyboard shortcuts

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