Documentation
¶
Index ¶
- Constants
- func AttemptCIFixAndRecheck(ctx *Context, prNumber, branchName string, display func() string) bool
- func BuildEnhancedPrompt(ctx *Context) string
- func CheckHasChanges() (bool, error)
- func CleanupBranch(branchName, mainBranch string)
- func CleanupWorktree(ctx *Context)
- func CommitAndCreatePR(ctx *Context, branchName, mainBranch string, display func() string) error
- func CommitOnCurrentBranch(ctx *Context, display func() string) error
- func CreateIterationBranch(ctx *Context, iteration int, display func() string) (mainBranch, branchName string, err error)
- func DetectGitHubRepo() (owner, repo string, err error)
- func DetectProviderFromRemote(remoteURL string) string
- func ErrUnknownProvider(name string) error
- func ExecuteCallbacks(agentCtx *Context, mainErr error)
- func FormatDuration(d time.Duration) string
- func GenerateRandomHash() string
- func GetCurrentBranch() string
- func GetFailedRunID(ctx *Context, prNumber string) (string, error)
- func GetHeadSHA() (string, error)
- func GetIterationDisplay(iteration, maxRuns, extraIterations int) func() string
- func ListWorktrees() error
- func MergePRAndCleanup(ctx *Context, prNumber, branchName, mainBranch string, display func() string) error
- func ParseDuration(s string) (time.Duration, error)
- func Run(ctx *Context) error
- func RunCIFixIteration(ctx *Context, prNumber string, display func() string, attempt int) error
- func RunReviewerIteration(ctx *Context, display func() string) error
- func SetupRepoProvider(ctx *Context, providerName, repoID string, opts ProviderOptions) error
- func SetupWorktree(ctx *Context) error
- func ValidateRequirements(ctx *Context) error
- func WaitForPRChecks(ctx *Context, prNumber string, display func() string) bool
- type AIBackend
- type BackendResult
- type ClaudeCodeBackend
- type CodexBackend
- type Context
- type CoolProvider
- func (p *CoolProvider) ClosePullRequest(ctx *Context, prID string, deleteBranch bool) error
- func (p *CoolProvider) CreatePullRequest(ctx *Context, opts *PRCreateOptions) (*PullRequestInfo, error)
- func (p *CoolProvider) DetectFromGit() (*RepositoryInfo, error)
- func (p *CoolProvider) GetFailedWorkflowRun(ctx *Context, prID string) (string, error)
- func (p *CoolProvider) GetPRChecks(ctx *Context, prID string) ([]PRCheckResult, error)
- func (p *CoolProvider) GetPRReviewStatus(ctx *Context, prID string) (*PRReviewStatus, error)
- func (p *CoolProvider) GetPRStatus(ctx *Context, prID string) (*PRStatus, error)
- func (p *CoolProvider) MergePullRequest(ctx *Context, prID string, strategy MergeStrategy) error
- func (p *CoolProvider) Name() string
- func (p *CoolProvider) SupportsBranches() bool
- func (p *CoolProvider) SupportsCI() bool
- func (p *CoolProvider) UpdatePRBranch(ctx *Context, prID string) error
- func (p *CoolProvider) Validate(ctx *Context) error
- type GitHubProvider
- func (p *GitHubProvider) ClosePullRequest(ctx *Context, prID string, deleteBranch bool) error
- func (p *GitHubProvider) CreatePullRequest(ctx *Context, opts *PRCreateOptions) (*PullRequestInfo, error)
- func (p *GitHubProvider) DetectFromGit() (*RepositoryInfo, error)
- func (p *GitHubProvider) GetFailedWorkflowRun(ctx *Context, prID string) (string, error)
- func (p *GitHubProvider) GetPRChecks(ctx *Context, prID string) ([]PRCheckResult, error)
- func (p *GitHubProvider) GetPRReviewStatus(ctx *Context, prID string) (*PRReviewStatus, error)
- func (p *GitHubProvider) GetPRStatus(ctx *Context, prID string) (*PRStatus, error)
- func (p *GitHubProvider) MergePullRequest(ctx *Context, prID string, strategy MergeStrategy) error
- func (p *GitHubProvider) Name() string
- func (p *GitHubProvider) SupportsBranches() bool
- func (p *GitHubProvider) SupportsCI() bool
- func (p *GitHubProvider) UpdatePRBranch(ctx *Context, prID string) error
- func (p *GitHubProvider) Validate(ctx *Context) error
- type MergeStrategy
- type OpencodeBackend
- type PRCheckResult
- type PRCreateOptions
- type PRInfo
- type PRReviewStatus
- type PRStatus
- type ProviderOptions
- type PullRequestInfo
- type RepositoryInfo
- type RepositoryProvider
- type WorkflowRun
Constants ¶
View Source
const ( PromptCommitMessage = `` /* 579-byte string literal not displayed */ PromptWorkflowContext = `` /* 1018-byte string literal not displayed */ PromptNotesUpdateExisting = `` /* 141-byte string literal not displayed */ PromptNotesCreateNew = `Create a %s file with relevant context and instructions for the next iteration.` PromptNotesGuidelines = `` /* 445-byte string literal not displayed */ PromptReviewerContext = `` /* 324-byte string literal not displayed */ PromptCIFixContext = `` /* 825-byte string literal not displayed */ )
View Source
const ( CompletionSignal = "CONTINUOUS_PROJECT_COMPLETE" MaxConsecutiveErrors = 3 IterationDelaySeconds = 1 )
Variables ¶
This section is empty.
Functions ¶
func AttemptCIFixAndRecheck ¶
func BuildEnhancedPrompt ¶
func CheckHasChanges ¶
func CleanupBranch ¶
func CleanupBranch(branchName, mainBranch string)
func CleanupWorktree ¶
func CleanupWorktree(ctx *Context)
func CommitAndCreatePR ¶
func CommitOnCurrentBranch ¶
func CreateIterationBranch ¶
func DetectGitHubRepo ¶
func DetectProviderFromRemote ¶ added in v1.0.49
DetectProviderFromRemote 从 git remote URL 检测仓库提供商
func ErrUnknownProvider ¶ added in v1.0.49
ErrUnknownProvider 返回未知提供商错误
func ExecuteCallbacks ¶ added in v1.0.49
func FormatDuration ¶
func GenerateRandomHash ¶
func GenerateRandomHash() string
func GetCurrentBranch ¶
func GetCurrentBranch() string
func GetHeadSHA ¶ added in v1.0.50
func GetIterationDisplay ¶
func ListWorktrees ¶
func ListWorktrees() error
func MergePRAndCleanup ¶
func RunCIFixIteration ¶
func RunReviewerIteration ¶
func SetupRepoProvider ¶ added in v1.0.50
func SetupRepoProvider(ctx *Context, providerName, repoID string, opts ProviderOptions) error
func SetupWorktree ¶
func ValidateRequirements ¶
Types ¶
type AIBackend ¶ added in v1.0.49
type AIBackend interface {
Validate() error
RunIteration(ctx *Context, prompt string, display func() string) (*BackendResult, error)
RunCommit(ctx *Context, prompt string) error
Name() string
}
func NewBackend ¶ added in v1.0.49
type BackendResult ¶ added in v1.0.49
type ClaudeCodeBackend ¶ added in v1.0.49
type ClaudeCodeBackend struct{}
func (*ClaudeCodeBackend) Name ¶ added in v1.0.49
func (b *ClaudeCodeBackend) Name() string
func (*ClaudeCodeBackend) RunCommit ¶ added in v1.0.49
func (b *ClaudeCodeBackend) RunCommit(ctx *Context, prompt string) error
func (*ClaudeCodeBackend) RunIteration ¶ added in v1.0.49
func (b *ClaudeCodeBackend) RunIteration(ctx *Context, prompt string, display func() string) (*BackendResult, error)
func (*ClaudeCodeBackend) Validate ¶ added in v1.0.49
func (b *ClaudeCodeBackend) Validate() error
type CodexBackend ¶ added in v1.0.49
type CodexBackend struct{}
func (*CodexBackend) Name ¶ added in v1.0.49
func (b *CodexBackend) Name() string
func (*CodexBackend) RunCommit ¶ added in v1.0.49
func (b *CodexBackend) RunCommit(ctx *Context, prompt string) error
func (*CodexBackend) RunIteration ¶ added in v1.0.49
func (b *CodexBackend) RunIteration(ctx *Context, prompt string, display func() string) (*BackendResult, error)
func (*CodexBackend) Validate ¶ added in v1.0.49
func (b *CodexBackend) Validate() error
type Context ¶
type Context struct {
Prompt string
Model string
MaxRuns int
MaxCost float64
MaxDuration time.Duration
EnableCommits bool
EnableBranches bool
BranchPrefix string
MergeStrategy string
NotesFile string
DryRun bool
Debug bool
CompletionSignal string
CompletionThreshold int
ReviewPrompt string
CIRetryEnabled bool
CIRetryMax int
WorktreeName string
WorktreeBaseDir string
CleanupWorktree bool
Backend AIBackend
RunContext context.Context
RunCancel context.CancelFunc
// 仓库提供商抽象
RepoProvider RepositoryProvider
RepoInfo *RepositoryInfo
SuccessfulIterations int
ErrorCount int
ExtraIterations int
TotalCost float64
CompletionCount int
StartTime time.Time
OnComplete string
OnError string
OnFinish string
}
type CoolProvider ¶ added in v1.0.49
type CoolProvider struct {
Endpoint string
// contains filtered or unexported fields
}
func (*CoolProvider) ClosePullRequest ¶ added in v1.0.49
func (p *CoolProvider) ClosePullRequest(ctx *Context, prID string, deleteBranch bool) error
func (*CoolProvider) CreatePullRequest ¶ added in v1.0.49
func (p *CoolProvider) CreatePullRequest(ctx *Context, opts *PRCreateOptions) (*PullRequestInfo, error)
func (*CoolProvider) DetectFromGit ¶ added in v1.0.49
func (p *CoolProvider) DetectFromGit() (*RepositoryInfo, error)
func (*CoolProvider) GetFailedWorkflowRun ¶ added in v1.0.49
func (p *CoolProvider) GetFailedWorkflowRun(ctx *Context, prID string) (string, error)
func (*CoolProvider) GetPRChecks ¶ added in v1.0.49
func (p *CoolProvider) GetPRChecks(ctx *Context, prID string) ([]PRCheckResult, error)
func (*CoolProvider) GetPRReviewStatus ¶ added in v1.0.49
func (p *CoolProvider) GetPRReviewStatus(ctx *Context, prID string) (*PRReviewStatus, error)
func (*CoolProvider) GetPRStatus ¶ added in v1.0.49
func (p *CoolProvider) GetPRStatus(ctx *Context, prID string) (*PRStatus, error)
func (*CoolProvider) MergePullRequest ¶ added in v1.0.49
func (p *CoolProvider) MergePullRequest(ctx *Context, prID string, strategy MergeStrategy) error
func (*CoolProvider) Name ¶ added in v1.0.49
func (p *CoolProvider) Name() string
func (*CoolProvider) SupportsBranches ¶ added in v1.0.49
func (p *CoolProvider) SupportsBranches() bool
func (*CoolProvider) SupportsCI ¶ added in v1.0.49
func (p *CoolProvider) SupportsCI() bool
func (*CoolProvider) UpdatePRBranch ¶ added in v1.0.49
func (p *CoolProvider) UpdatePRBranch(ctx *Context, prID string) error
func (*CoolProvider) Validate ¶ added in v1.0.49
func (p *CoolProvider) Validate(ctx *Context) error
type GitHubProvider ¶ added in v1.0.49
type GitHubProvider struct{}
func (*GitHubProvider) ClosePullRequest ¶ added in v1.0.49
func (p *GitHubProvider) ClosePullRequest(ctx *Context, prID string, deleteBranch bool) error
func (*GitHubProvider) CreatePullRequest ¶ added in v1.0.49
func (p *GitHubProvider) CreatePullRequest(ctx *Context, opts *PRCreateOptions) (*PullRequestInfo, error)
func (*GitHubProvider) DetectFromGit ¶ added in v1.0.49
func (p *GitHubProvider) DetectFromGit() (*RepositoryInfo, error)
func (*GitHubProvider) GetFailedWorkflowRun ¶ added in v1.0.49
func (p *GitHubProvider) GetFailedWorkflowRun(ctx *Context, prID string) (string, error)
func (*GitHubProvider) GetPRChecks ¶ added in v1.0.49
func (p *GitHubProvider) GetPRChecks(ctx *Context, prID string) ([]PRCheckResult, error)
func (*GitHubProvider) GetPRReviewStatus ¶ added in v1.0.49
func (p *GitHubProvider) GetPRReviewStatus(ctx *Context, prID string) (*PRReviewStatus, error)
func (*GitHubProvider) GetPRStatus ¶ added in v1.0.49
func (p *GitHubProvider) GetPRStatus(ctx *Context, prID string) (*PRStatus, error)
func (*GitHubProvider) MergePullRequest ¶ added in v1.0.49
func (p *GitHubProvider) MergePullRequest(ctx *Context, prID string, strategy MergeStrategy) error
func (*GitHubProvider) Name ¶ added in v1.0.49
func (p *GitHubProvider) Name() string
func (*GitHubProvider) SupportsBranches ¶ added in v1.0.49
func (p *GitHubProvider) SupportsBranches() bool
func (*GitHubProvider) SupportsCI ¶ added in v1.0.49
func (p *GitHubProvider) SupportsCI() bool
func (*GitHubProvider) UpdatePRBranch ¶ added in v1.0.49
func (p *GitHubProvider) UpdatePRBranch(ctx *Context, prID string) error
func (*GitHubProvider) Validate ¶ added in v1.0.49
func (p *GitHubProvider) Validate(ctx *Context) error
type MergeStrategy ¶ added in v1.0.49
type MergeStrategy string
MergeStrategy 合并策略
const ( MergeStrategySquash MergeStrategy = "squash" MergeStrategyMerge MergeStrategy = "merge" MergeStrategyRebase MergeStrategy = "rebase" )
type OpencodeBackend ¶ added in v1.0.49
type OpencodeBackend struct{}
func (*OpencodeBackend) Name ¶ added in v1.0.49
func (b *OpencodeBackend) Name() string
func (*OpencodeBackend) RunCommit ¶ added in v1.0.49
func (b *OpencodeBackend) RunCommit(ctx *Context, prompt string) error
func (*OpencodeBackend) RunIteration ¶ added in v1.0.49
func (b *OpencodeBackend) RunIteration(ctx *Context, prompt string, display func() string) (*BackendResult, error)
func (*OpencodeBackend) Validate ¶ added in v1.0.49
func (b *OpencodeBackend) Validate() error
type PRCheckResult ¶
type PRCreateOptions ¶ added in v1.0.49
PRCreateOptions PR 创建选项
type PRReviewStatus ¶ added in v1.0.49
type PRReviewStatus struct {
ReviewDecision string // APPROVED, CHANGES_REQUESTED, REVIEW_REQUIRED, ""
ReviewRequests []string // 待审查者列表
}
PRReviewStatus PR 审查状态
type PRStatus ¶ added in v1.0.49
type PRStatus struct {
State string // open, merged, closed
CIStatus string // pending, success, failure
CIRunID string
ChecksURL string
}
PRStatus PR 状态
type ProviderOptions ¶ added in v1.0.49
ProviderOptions 提供商初始化选项
type PullRequestInfo ¶ added in v1.0.49
PullRequestInfo PR 信息
type RepositoryInfo ¶ added in v1.0.49
type RepositoryInfo struct {
Provider string // github, cool, etc.
Owner string // 所有者/组织
Repo string // 仓库名(完整路径,如 "owner/repo")
}
RepositoryInfo 仓库信息
type RepositoryProvider ¶ added in v1.0.49
type RepositoryProvider interface {
// Name 返回提供商名称 (github, cool, etc.)
Name() string
// Validate 验证配置和环境
Validate(ctx *Context) error
// DetectFromGit 从 git remote 自动检测仓库信息
DetectFromGit() (*RepositoryInfo, error)
// CreatePullRequest 创建 PR/MR
CreatePullRequest(ctx *Context, opts *PRCreateOptions) (*PullRequestInfo, error)
// MergePullRequest 合并 PR
MergePullRequest(ctx *Context, prID string, strategy MergeStrategy) error
// GetPRStatus 获取 PR 的 CI 状态
GetPRStatus(ctx *Context, prID string) (*PRStatus, error)
// GetPRChecks 获取 PR 检查项详细信息
GetPRChecks(ctx *Context, prID string) ([]PRCheckResult, error)
// GetPRReviewStatus 获取 PR 审查状态
GetPRReviewStatus(ctx *Context, prID string) (*PRReviewStatus, error)
// UpdatePRBranch 更新 PR 分支与目标分支同步
UpdatePRBranch(ctx *Context, prID string) error
// ClosePullRequest 关闭 PR
ClosePullRequest(ctx *Context, prID string, deleteBranch bool) error
// GetFailedWorkflowRun 获取 PR 的失败 workflow run ID
GetFailedWorkflowRun(ctx *Context, prID string) (string, error)
// SupportsBranches 是否支持分支工作流
SupportsBranches() bool
// SupportsCI 是否支持 CI 集成
SupportsCI() bool
}
RepositoryProvider 定义仓库操作的抽象接口
func NewRepositoryProvider ¶ added in v1.0.49
func NewRepositoryProvider(providerName string, opts ProviderOptions) (RepositoryProvider, error)
NewRepositoryProvider 创建仓库提供商实例
type WorkflowRun ¶
type WorkflowRun struct {
DatabaseId int `json:"databaseId"`
}
Click to show internal directories.
Click to hide internal directories.