githubservice

package
v0.0.0-...-71c47e0 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2025 License: Apache-2.0 Imports: 20 Imported by: 1 module, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	JobTypeGitHubCommentSync       = "github_comment_sync"
	JobTypeGitHubProcessCommentLLM = "github_process_comment_llm"
	JobTypeGitHubCodeReview        = "github_code_review"
	DefaultLeaseDuration           = 30 * time.Second
)

Variables

View Source
var (
	ErrInvalidGitHubConfig = errors.New("invalid GitHub configuration")
	ErrGitHubAPIError      = errors.New("GitHub API error")
)

Functions

This section is empty.

Types

type GitHubCodeReviewProcessor

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

func NewGitHubCodeReviewProcessor

func NewGitHubCodeReviewProcessor(
	db libdb.DBManager,
	env execservice.TasksEnvService,
	githubClient githubclient.Client,
	chatManager *chat.Manager,
	tracker activitytracker.ActivityTracker,
) *GitHubCodeReviewProcessor

func (*GitHubCodeReviewProcessor) ProcessJob

func (p *GitHubCodeReviewProcessor) ProcessJob(ctx context.Context, job *store.Job) (err error)

type GitHubCommentProcessor

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

func (*GitHubCommentProcessor) ProcessJob

func (p *GitHubCommentProcessor) ProcessJob(ctx context.Context, job *store.Job) (err error)

type GithubMessage

type GithubMessage struct {
	CommentID string `json:"commentID"`
	UserName  string `json:"userName"`
	UserEmail string `json:"userEmail"`
	UserID    string `json:"userID"`
	PR        int    `json:"pr"`
	RepoID    string `json:"repoID"`
	Content   string `json:"content"`
}

type MessagePayload

type MessagePayload struct {
	// "repo_id":    repoID,
	// "pr_number":  prNumber,
	// "comment_id": commentID,
	// "user_name":  userName,
	// "content":    content,
	// "sent_at":    sendAt,
	RepoID    string `json:"repoID"`
	PRNumber  int    `json:"prNumber"`
	CommentID string `json:"commentID"`
	UserName  string `json:"userName"`
	chatservice.ChatMessage
}
 // TODO add type and fix missing role.
		{
    "role": "",
    "content": "this is a test message to ping the bot",
    "sentAt": "2025-07-27T08:47:01Z",
    "isUser": false,
    "isLatest": false
}

Store message with full context

type PullRequest

type PullRequest struct {
	ID          int64      `json:"id"`
	Number      int        `json:"number"`
	Title       string     `json:"title"`
	State       string     `json:"state"`
	URL         string     `json:"url"`
	CreatedAt   time.Time  `json:"createdAt"`
	UpdatedAt   time.Time  `json:"updatedAt"`
	AuthorLogin string     `json:"authorLogin"`
	ClosedAt    *time.Time `json:"closedAt,omitempty"`
	MergedAt    *time.Time `json:"mergedAt,omitempty"`
}

type PullRequestDetails

type PullRequestDetails struct {
	PullRequest   *github.PullRequest
	ChangedFiles  []*github.CommitFile
	IssueComments []*github.IssueComment
	Reviews       []*github.PullRequestReview
}

type Service

type Service interface {
	serverops.ServiceMeta
	ConnectRepo(ctx context.Context, userID, owner, repoName, accessToken string, botUserName string) (*store.GitHubRepo, error)
	ListPRs(ctx context.Context, repoID string) ([]*githubclient.PullRequest, error)
	ListRepos(ctx context.Context) ([]*store.GitHubRepo, error)
	DisconnectRepo(ctx context.Context, repoID string) error
	PR(ctx context.Context, repoID string, prNumber int) (*PullRequestDetails, error)
	ListComments(ctx context.Context, repoID string, prNumber int, since time.Time) ([]*github.IssueComment, error)
	PostComment(ctx context.Context, repoID string, prNumber int, comment string) error
}

func New

func New(db libdb.DBManager, githubClient githubclient.Client) Service

func WithActivityTracker

func WithActivityTracker(service Service, tracker activitytracker.ActivityTracker) Service

New decorator factory

type Worker

type Worker interface {
	ReceiveTick(ctx context.Context) error
	ProcessTick(ctx context.Context) error
	serverops.ServiceMeta
}

func NewWorker

func NewWorker(
	githubClient githubclient.Client,
	kvManager libkv.KVManager,
	tracker activitytracker.ActivityTracker,
	dbInstance libdb.DBManager,
	bootLastSyncTime time.Time,
) Worker

Jump to

Keyboard shortcuts

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