Documentation
¶
Index ¶
- Variables
- func BuildConsoleURL(region, repo, prID string) string
- type CodeCommitClientFactory
- type CreatePullRequestOptions
- type CreatedPullRequest
- type DiffGeneratorFactory
- type GetReviewOptions
- type ListPullRequest
- type ListPullRequestsOptions
- type PostCommentOptions
- type PostedComment
- type ReviewPayload
- type SystemError
Constants ¶
This section is empty.
Variables ¶
var ( // ErrMissingPRRef is returned when a use case requires either a PR URL // or a (repo + prId) pair and neither is provided. ErrMissingPRRef = errors.New("provide a PR URL or repo and prId") // ErrMissingRegion is returned when no AWS region can be resolved from // the use-case input, the config file, or the standard AWS env variables. ErrMissingRegion = errors.New("region is required: use region option, set region in config file, or set AWS_REGION/AWS_DEFAULT_REGION env") )
Sentinel validation errors. CLI callers translate these to flag-aware wording via errors.Is; the MCP server lets them surface as-is so MCP clients see surface-neutral messages.
Functions ¶
func BuildConsoleURL ¶
BuildConsoleURL returns the CodeCommit web-console URL for a pull request.
Types ¶
type CodeCommitClientFactory ¶
type CodeCommitClientFactory func(ctx context.Context, region, profile string) (codecommit.Client, error)
CodeCommitClientFactory creates a CodeCommit client for resolved AWS settings.
type CreatePullRequestOptions ¶
type CreatePullRequestOptions struct {
Repo string
Title string
SourceBranch string
DestinationBranch string
Description string
Region string
Profile string
Config string
}
CreatePullRequestOptions contains inputs shared by the CLI and MCP create paths. SourceBranch is required: the CLI's "default to local Git current branch when empty" behavior is resolved on the CLI side before calling this use case, so MCP callers must pass an explicit source branch.
type CreatedPullRequest ¶
type CreatedPullRequest struct {
PRId string `json:"prId"`
Title string `json:"title"`
Repository string `json:"repository"`
SourceBranch string `json:"sourceBranch"`
DestinationBranch string `json:"destinationBranch"`
URL string `json:"url"`
}
CreatedPullRequest is the structured result of creating a pull request, returned to both the CLI (for JSON formatting) and the MCP tool. Field names match the existing `ccpr create --format json` schema.
func CreatePullRequest ¶
func CreatePullRequest( ctx context.Context, opts CreatePullRequestOptions, newClient CodeCommitClientFactory, ) (CreatedPullRequest, error)
CreatePullRequest creates a new CodeCommit pull request and returns the resulting metadata. AWS-side failures are wrapped in *SystemError so callers can distinguish them from user input errors.
type DiffGeneratorFactory ¶
DiffGeneratorFactory creates a diff generator for the resolved repo path.
type GetReviewOptions ¶
type GetReviewOptions struct {
URL string
Repo string
PRId string
Region string
Profile string
Config string
}
GetReviewOptions contains inputs shared by the CLI and MCP review paths.
type ListPullRequest ¶
type ListPullRequest struct {
PRId string `json:"prId"`
Title string `json:"title"`
AuthorARN string `json:"authorArn"`
SourceBranch string `json:"sourceBranch"`
DestinationBranch string `json:"destinationBranch"`
Status string `json:"status"`
CreationDate string `json:"creationDate"`
}
ListPullRequest is the stable machine-readable PR summary schema.
func ListPullRequests ¶
func ListPullRequests(ctx context.Context, opts ListPullRequestsOptions, newClient CodeCommitClientFactory) ([]ListPullRequest, error)
ListPullRequests returns pull request summaries for a repository.
type ListPullRequestsOptions ¶
type ListPullRequestsOptions struct {
Repo string
Status string
Config string
Profile string
Region string
}
ListPullRequestsOptions contains inputs shared by the CLI and MCP list paths.
type PostCommentOptions ¶
type PostCommentOptions struct {
URL string
Repo string
PRId string
Body string
Region string
Profile string
Config string
}
PostCommentOptions contains inputs shared by the CLI and MCP comment paths.
type PostedComment ¶
type PostedComment struct {
CommentID string `json:"commentId"`
PullRequestID string `json:"pullRequestId"`
AuthorARN string `json:"authorArn"`
CreationDate string `json:"creationDate"`
}
PostedComment is the structured result of posting a comment, returned to both the CLI (for JSON formatting) and the MCP tool. Field names match the existing `ccpr comment --format json` schema.
func PostComment ¶
func PostComment( ctx context.Context, opts PostCommentOptions, newClient CodeCommitClientFactory, ) (PostedComment, error)
PostComment posts a comment to a CodeCommit pull request and returns the resulting metadata. AWS-side failures are wrapped in *SystemError so callers can distinguish them from user input errors.
type ReviewPayload ¶
type ReviewPayload = output.ReviewOutput
ReviewPayload is the structured review payload returned to both the CLI (for JSON formatting) and the MCP tool. It aliases output.ReviewOutput so the JSON shape remains consistent across surfaces.
func GetReview ¶
func GetReview( ctx context.Context, opts GetReviewOptions, newClient CodeCommitClientFactory, newDiff DiffGeneratorFactory, ) (ReviewPayload, error)
GetReview fetches PR metadata, comments, and the local-Git-generated diff for a single pull request and returns it as a ReviewPayload.
type SystemError ¶
type SystemError struct {
// contains filtered or unexported fields
}
SystemError marks an error as system-level (AWS, Git) so CLI callers can route it to a non-user exit code. Detect via errors.As.
func (*SystemError) Error ¶
func (e *SystemError) Error() string
func (*SystemError) Unwrap ¶
func (e *SystemError) Unwrap() error