Documentation
¶
Index ¶
- Constants
- type GitClient
- func (g *GitClient) ApplyPatch(ctx context.Context, patchPath string) (bool, error)
- func (g *GitClient) CommitChanges(message string) (string, error)
- func (g *GitClient) CreateBranch(branchName string) error
- func (g *GitClient) EnsureRepository() error
- func (g *GitClient) Push(branchName, remoteName string) error
- type GitPublisherConfig
- type Publisher
Constants ¶
const ( // DefaultCommitMessage is the default commit message. DefaultCommitMessage = "Apply changes from Holon" // DefaultRemote is the default remote name. DefaultRemote = "origin" // WorkspaceEnv is the environment variable for workspace directory. WorkspaceEnv = "HOLON_WORKSPACE" // GitTokenEnv is the environment variable for git authentication token. GitTokenEnv = "GIT_TOKEN" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GitClient ¶
type GitClient struct {
// WorkspaceDir is the path to the Git workspace
WorkspaceDir string
// Token is the optional authentication token for push operations
Token string
}
GitClient handles Git operations.
func NewGitClient ¶
NewGitClient creates a new Git client.
func (*GitClient) ApplyPatch ¶
ApplyPatch applies a patch file to the workspace using git apply --3way. Returns true if patch was applied, false if patch file was empty/missing.
func (*GitClient) CommitChanges ¶
CommitChanges commits all changes with the given message. Returns the commit hash if successful.
func (*GitClient) CreateBranch ¶
CreateBranch creates a new branch or checks out an existing one.
func (*GitClient) EnsureRepository ¶
EnsureRepository ensures the workspace is a Git repository.
type GitPublisherConfig ¶
type GitPublisherConfig struct {
// Branch is the branch name to create or checkout (optional)
Branch string
// Commit if true, commits changes after applying patch
Commit bool
// CommitMessage is the commit message (if empty, uses default)
CommitMessage string
// Push if true, pushes commits to remote
Push bool
// Remote is the remote name to push to (default: origin)
Remote string
// WorkspaceDir is the path to the git workspace
WorkspaceDir string
}
GitPublisherConfig contains configuration for git publishing.
type Publisher ¶
type Publisher struct{}
Publisher publishes Holon outputs to git.
func NewPublisher ¶
func NewPublisher() *Publisher
NewPublisher creates a new git publisher instance.
func (*Publisher) Publish ¶
func (p *Publisher) Publish(req publisher.PublishRequest) (publisher.PublishResult, error)
Publish sends Holon outputs to git.
Note: If branch creation succeeds but a subsequent step (patch application, commit, or push) fails, the repository will be left on the newly created/checked out branch. This behavior is intentional to preserve state for debugging.