scm

package
v0.6.43 Latest Latest
Warning

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

Go to latest
Published: May 30, 2026 License: AGPL-3.0, Apache-2.0, MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CICheckStatusQueued     = "queued"
	CICheckStatusInProgress = "in_progress"
	CICheckStatusCompleted  = "completed"
)

CICheckStatus values for CICheck.Status.

View Source
const (
	CICheckConclusionSuccess   = "success"
	CICheckConclusionFailure   = "failure"
	CICheckConclusionNeutral   = "neutral"
	CICheckConclusionCancelled = "cancelled"
	CICheckConclusionSkipped   = "skipped"
)

CICheckConclusion values for CICheck.Conclusion.

Variables

This section is empty.

Functions

func PRStateHash

func PRStateHash(details ...*PRDetails) (string, error)

PRStateHash produces a stable dedup hash over one or more PRDetails. Comments are keyed "id:body" (edits are detected), CI checks by "name:conclusion". Both are sorted before hashing so insertion order never causes false positives.

func RegisterGRPCServer added in v0.6.41

func RegisterGRPCServer(registrar grpc.ServiceRegistrar)

Types

type CICheck

type CICheck struct {
	Name       string
	Status     string // "queued", "in_progress", "completed"
	Conclusion string // "success", "failure", "neutral", "cancelled", "skipped", "timed_out", ""
	// CheckRunID is the provider-specific ID used to fetch logs (GitHub check run ID).
	CheckRunID int64
}

CICheck is a single CI check run or commit status.

type Client

type Client interface {
	GetPRDetails(ctx context.Context, prURL string) (*PRDetails, error)
	// GetCILogs fetches the log output for a single failed check run.
	// prURL is used to resolve owner/repo; checkRunID is from CICheck.CheckRunID.
	GetCILogs(ctx context.Context, prURL string, checkRunID int64) (string, error)
	// ReactToComment adds a reaction emoji to a PR comment.
	// reactableID is in the format "<type>:<numericID>" (from PRComment.ReactableID()).
	ReactToComment(ctx context.Context, prURL string, reactableID string, state CommentReactState) error
}

Client fetches live PR state directly from the SCM provider.

func NewClient

func NewClient(token string) Client

NewClient returns a provider-dispatching SCM client using token auth. The provider is inferred from the PR URL host.

type CommentReactState

type CommentReactState string

CommentReactState is the agent's work state conveyed as a GitHub reaction.

const (
	// CommentReactStateWorking maps to (eyes) — agent is looking at it.
	CommentReactStateWorking CommentReactState = "working"
	// CommentReactStateComplete maps to (+1) — agent finished.
	CommentReactStateComplete CommentReactState = "complete"
)

type GRPCClient added in v0.6.41

type GRPCClient interface {
	GetPRDetails(ctx context.Context, prURL string) (*PRDetails, error)
	Close() error
}

func NewGRPCClient added in v0.6.41

func NewGRPCClient(address string) (GRPCClient, error)

type PRComment

type PRComment struct {
	// ID is the numeric provider comment ID
	ID string
	// Type distinguishes top level issue comments from inline review comments, which have separate reaction endpoints in GitHub's API.
	// Used to route react API calls to the correct endpoint.
	Type      PRCommentType
	Author    string
	Body      string
	CreatedAt time.Time
}

PRComment is a single review or issue comment on the PR.

func (PRComment) ReactableID

func (c PRComment) ReactableID() string

ReactableID returns a composite key that encodes both the comment type and numeric ID e.g. "issue:123456" or "review:789012". This is the value the agent should pass to the reactToComment MCP tool.

type PRCommentType

type PRCommentType string

PRCommentType distinguishes top-level issue comments from inline review comments.

const (
	PRCommentTypeIssue  PRCommentType = "issue"
	PRCommentTypeReview PRCommentType = "review"
)

type PRDetails

type PRDetails struct {
	Title    string
	Body     string
	HeadRef  string  // source branch of the PR (e.g. "feat/my-branch")
	State    PRState // PRStateOpen, PRStateClosed, PRStateMerged
	Comments []PRComment
	CIChecks []CICheck
}

PRDetails is the live state of a pull request fetched directly from the SCM provider.

type PRState

type PRState string

PRState is the state of a pull request.

const (
	PRStateOpen   PRState = "open"
	PRStateClosed PRState = "closed"
	PRStateMerged PRState = "merged"
)

Jump to

Keyboard shortcuts

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