{"modulePath":"github.com/AlaudaDevops/toolbox/pr-cli","version":"v0.0.0-20261019083812-38d5e0ad0d24","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package handler\n\n## Constants\n\n```go\nconst (\n\t// PostMergeCherryPickCommand is the built-in command for post-merge cherry-pick operations\n\tPostMergeCherryPickCommand = \"__post-merge-cherry-pick\"\n)\n```\nBuilt-in command constants\n\n## Functions\n\n```go\nfunc IsBuiltInCommand(command string) bool\n```\nIsBuiltInCommand returns true if the command is a built-in command (starts with \\_\\_)\n\n## Types\n\n```go\ntype CommandHandler func(args []string) error\n```\nCommandHandler defines the interface for command handlers\n\n```go\ntype CommentedError struct {\n\tErr error\n}\n```\nCommentedError represents an error where a comment has already been posted to the PR\n\n```go\nfunc (e *CommentedError) Error() string\n```\n\n```go\nfunc (e *CommentedError) Unwrap() error\n```\n\n```go\ntype PRHandler struct {\n\t*logrus.Logger\n\t// contains filtered or unexported fields\n}\n```\nPRHandler encapsulates Git client and configuration for PR operations\n\n```go\nfunc NewPRHandler(logger *logrus.Logger, cfg *config.Config) (*PRHandler, error)\n```\nNewPRHandler creates a new PR handler with Git client and configuration\n\n```go\nfunc NewPRHandlerWithClient(logger *logrus.Logger, cfg *config.Config, client git.GitClient, prSender string) (*PRHandler, error)\n```\nNewPRHandlerWithClient creates a new PR handler with a provided client (for testing)\n\n```go\nfunc (h *PRHandler) CheckPRStatus(expectedState string) error\n```\nCheckPRStatus verifies if the PR is in the expected state\n\n```go\nfunc (h *PRHandler) ExecuteCommand(command string, args []string) error\n```\nExecuteCommand executes a command with the given arguments This is the unified command execution method used by regular, sub-command, and built-in command flows\n\n```go\nfunc (h *PRHandler) ExposedDetermineMergeMethod(args []string) string\n```\nExposedDetermineMergeMethod exposes determineMergeMethod for testing\n\n```go\nfunc (h *PRHandler) ExposedSelectAutoMergeMethod() string\n```\nExposedSelectAutoMergeMethod exposes selectAutoMergeMethod for testing\n\n```go\nfunc (h *PRHandler) ExposedValidateRebaseMerge() error\n```\nExposedValidateRebaseMerge exposes validateRebaseMerge for testing\n\n```go\nfunc (h *PRHandler) GetCommentsWithCache() ([]git.Comment, error)\n```\nGetCommentsWithCache retrieves all comments from the pull request with caching\n\n```go\nfunc (h *PRHandler) GetLGTMVotes(requiredPerms []string, debugMode bool, ignoreUserRemove ...string) (int, map[string]string, error)\n```\nGetLGTMVotes retrieves and validates LGTM votes with optimized comments caching\n\n```go\nfunc (h *PRHandler) HandleAssign(users []string) error\n```\nHandleAssign assigns users as reviewers to the PR\n\n```go\nfunc (h *PRHandler) HandleBatch(args []string) error\n```\nHandleBatch executes multiple commands in batch mode\n\n```go\nfunc (h *PRHandler) HandleCheck(args []string) error\n```\nHandleCheck displays current LGTM status or executes sub-commands\n\n```go\nfunc (h *PRHandler) HandleCheckbox(args []string) error\n```\nHandleCheckbox updates unchecked checkboxes in the PR description.\n\n```go\nfunc (h *PRHandler) HandleCheckboxIssue(args []string) error\n```\nHandleCheckboxIssue updates unchecked checkboxes in the specified or default GitHub issue.\n\n```go\nfunc (h *PRHandler) HandleCherrypick(args []string) error\n```\nHandleCherrypick handles the cherrypick command to create a cherrypick PR to a different branch\n\n```go\nfunc (h *PRHandler) HandleClose(args []string) error\n```\nHandleClose closes the PR without merging\n\n```go\nfunc (h *PRHandler) HandleHelp(_ []string) error\n```\nHandleHelp displays available commands in GitHub Markdown table format\n\n```go\nfunc (h *PRHandler) HandleLGTM(_ []string) error\n```\nHandleLGTM processes LGTM votes and approves PR if threshold is met\n\n```go\nfunc (h *PRHandler) HandleLabel(labels []string) error\n```\nHandleLabel adds labels to the PR\n\n```go\nfunc (h *PRHandler) HandleMerge(args []string) error\n```\nHandleMerge merges the PR if conditions are met\n\n```go\nfunc (h *PRHandler) HandlePostMergeCherryPick() error\n```\nHandlePostMergeCherryPick processes any cherry-pick commands found in PR comments after merge This is a public method that can be called independently for post-merge operations\n\n```go\nfunc (h *PRHandler) HandleRebase(_ []string) error\n```\nHandleRebase rebases the PR branch\n\n```go\nfunc (h *PRHandler) HandleRemoveLGTM(_ []string) error\n```\nHandleRemoveLGTM processes the removal of LGTM by dismissing approval if threshold was met\n\n```go\nfunc (h *PRHandler) HandleRetest(args []string) error\n```\nHandleRetest reruns failed test jobs by commenting /test {pipeline-name}\n\n```go\nfunc (h *PRHandler) HandleUnassign(users []string) error\n```\nHandleUnassign removes users from PR reviewers\n\n```go\nfunc (h *PRHandler) HandleUnlabel(labels []string) error\n```\nHandleUnlabel removes labels from the PR\n\n```go\nfunc (h *PRHandler) PostComment(message string) error\n```\nPostComment posts a comment to the pull request\n\n```go\ntype RemovalResult struct {\n\tCurrentUserHasVote bool\n\tBeforeVotes        int\n\tAfterVotes         int\n\tUserPermission     string\n}\n```\nRemovalResult holds the result of LGTM removal processing\n\n```go\ntype SubCommand struct {\n\tCommand string\n\tArgs    []string\n}\n```\nSubCommand represents a parsed sub-command with its arguments\n\n","path":"github.com/AlaudaDevops/toolbox/pr-cli/pkg/handler","name":"handler","synopsis":"","isRedistributable":true}
