Documentation
¶
Index ¶
- Constants
- func ExtractBranchFromSummary(summary string, issueID string) string
- func ExtractTitleFromSummary(summary string) string
- func FormatPRBody(summary string, issueID string) string
- type GitClient
- func (g *GitClient) ApplyPatch(ctx context.Context, patchPath string) error
- func (g *GitClient) CommitChanges(ctx context.Context, message string) (string, error)
- func (g *GitClient) CreateBranch(ctx context.Context, branchName string) error
- func (g *GitClient) EnsureCleanWorkspace() error
- func (g *GitClient) Push(branchName string) error
- type PRPublisher
- type PRPublisherConfig
- type PRRef
Constants ¶
const ( // TokenEnv is the environment variable for GitHub token. TokenEnv = "GITHUB_TOKEN" // HolonTokenEnv is the environment variable for Holon-specific GitHub token. // This has higher priority than GITHUB_TOKEN. HolonTokenEnv = "HOLON_GITHUB_TOKEN" // BranchFlag is the flag name for branch configuration. BranchFlag = "branch" // TitleFlag is the flag name for PR title configuration. TitleFlag = "title" // IssueFlag is the flag name for issue ID reference. IssueFlag = "issue_id" // AuthorNameFlag is the flag name for git author name configuration. AuthorNameFlag = "git_author_name" // AuthorEmailFlag is the flag name for git author email configuration. AuthorEmailFlag = "git_author_email" )
Variables ¶
This section is empty.
Functions ¶
func ExtractBranchFromSummary ¶
ExtractBranchFromSummary extracts a branch name from summary.md content. Looks for patterns like "Branch: holon/fix-123" or returns a default.
func ExtractTitleFromSummary ¶
ExtractTitleFromSummary extracts a PR title from summary.md content. Uses the first non-empty line (excluding markdown headers) as the title.
func FormatPRBody ¶
FormatPRBody formats the PR body from summary content. Adds issue reference if provided.
Types ¶
type GitClient ¶
type GitClient struct {
// WorkspaceDir is the path to the Git workspace
WorkspaceDir string
// Token is the GitHub authentication token
Token string
// AuthorName is the git author name for commits
AuthorName string
// AuthorEmail is the git author email for commits
AuthorEmail string
}
GitClient handles Git operations for PR creation.
func NewGitClient ¶
NewGitClient creates a new Git client.
func (*GitClient) ApplyPatch ¶
ApplyPatch applies a patch file to the workspace and stages all changes.
func (*GitClient) CommitChanges ¶
CommitChanges commits all changes with the given message.
func (*GitClient) CreateBranch ¶
CreateBranch creates a new branch or checks out existing one.
NOTE: This function performs destructive git operations (reset --hard, clean -fd) to ensure the worktree is clean before branch creation. This is safe for publish workflows where the workspace should be in a clean state, but could discard uncommitted changes if called in other contexts.
func (*GitClient) EnsureCleanWorkspace ¶
EnsureCleanWorkspace ensures the workspace is a Git repository.
type PRPublisher ¶
type PRPublisher struct{}
PRPublisher publishes Holon outputs as GitHub PRs.
func NewPRPublisher ¶
func NewPRPublisher() *PRPublisher
NewPRPublisher creates a new PR publisher instance.
func (*PRPublisher) Publish ¶
func (p *PRPublisher) Publish(req publisher.PublishRequest) (publisher.PublishResult, error)
Publish sends Holon outputs to GitHub as a PR.
func (*PRPublisher) Validate ¶
func (p *PRPublisher) Validate(req publisher.PublishRequest) error
Validate checks if the request is valid for this publisher.
type PRPublisherConfig ¶
type PRPublisherConfig struct {
// BranchName is the name of the branch to create/use for the PR
BranchName string
// Title is the PR title (if empty, derived from summary.md)
Title string
// CommitMessage is the commit message (if empty, derived from summary.md)
CommitMessage string
// IssueID is the optional issue number to reference in the PR
IssueID string
// AuthorName is the git author name for commits (if empty, uses "holonbot[bot]")
AuthorName string
// AuthorEmail is the git author email for commits (if empty, uses holonbot noreply address)
AuthorEmail string
// DryRun if true, validates without making changes
DryRun bool
}
PRPublisherConfig contains configuration for PR publishing.
type PRRef ¶
PRRef represents a parsed GitHub repository reference. Supports formats: "owner/repo", "owner/repo:base_branch"
func ParsePRRef ¶
ParsePRRef parses a PR reference string into a PRRef struct.
func (PRRef) GitCloneURLWithToken ¶
GitCloneURLWithToken returns the HTTPS clone URL with an embedded token.