Documentation
¶
Index ¶
- Constants
- func EnsureControlPlane(ctx context.Context, proj *project.Project) error
- func HandleCommentResolutionTask(ctx context.Context, proj *project.Project, task *db.ScheduledTask) error
- func HandleGitHubCommentTask(ctx context.Context, proj *project.Project, task *db.ScheduledTask) error
- func HandleGitHubResolveThreadTask(ctx context.Context, proj *project.Project, task *db.ScheduledTask) error
- func HandleImportPRTask(ctx context.Context, proj *project.Project, task *db.ScheduledTask) error
- func HandleTaskError(ctx context.Context, proj *project.Project, task *db.ScheduledTask, ...)
- func ProcessAllDueTasks(ctx context.Context, proj *project.Project)
- func ProcessAllDueTasksWithControlPlane(ctx context.Context, proj *project.Project, cp *ControlPlane)
- func RunControlPlaneLoop(ctx context.Context, proj *project.Project, procManager *procmon.Manager) error
- func RunControlPlaneLoopWithControlPlane(ctx context.Context, proj *project.Project, procManager *procmon.Manager, ...) error
- func ScheduleDestroyWorktree(ctx context.Context, proj *project.Project, workID string) error
- func SpawnControlPlane(ctx context.Context, proj *project.Project) error
- func TriggerPRFeedbackCheck(ctx context.Context, proj *project.Project, workID string) error
- type ControlPlane
- func (cp *ControlPlane) GetTaskHandlers() map[string]TaskHandler
- func (cp *ControlPlane) HandleCreateWorktreeTask(ctx context.Context, proj *project.Project, task *db.ScheduledTask) error
- func (cp *ControlPlane) HandleDestroyWorktreeTask(ctx context.Context, proj *project.Project, task *db.ScheduledTask) error
- func (cp *ControlPlane) HandleGitPushTask(ctx context.Context, proj *project.Project, task *db.ScheduledTask) error
- func (cp *ControlPlane) HandlePRFeedbackTask(ctx context.Context, proj *project.Project, task *db.ScheduledTask) error
- func (cp *ControlPlane) HandleSpawnOrchestratorTask(ctx context.Context, proj *project.Project, task *db.ScheduledTask) error
- type DefaultOrchestratorSpawner
- type DefaultWorkDestroyer
- type OrchestratorSpawner
- type SessionInitResult
- type TaskHandler
- type WorkDestroyer
Constants ¶
const TabName = "control"
TabName is the name of the control plane tab in zellij
Variables ¶
This section is empty.
Functions ¶
func EnsureControlPlane ¶
EnsureControlPlane ensures the control plane is running, spawning it if needed
func HandleCommentResolutionTask ¶
func HandleCommentResolutionTask(ctx context.Context, proj *project.Project, task *db.ScheduledTask) error
HandleCommentResolutionTask handles a scheduled comment resolution check. Returns nil on success, error on failure (caller handles retry/completion).
func HandleGitHubCommentTask ¶
func HandleGitHubCommentTask(ctx context.Context, proj *project.Project, task *db.ScheduledTask) error
HandleGitHubCommentTask handles a scheduled GitHub comment posting task. Returns nil on success, error on failure (caller handles retry/completion).
func HandleGitHubResolveThreadTask ¶
func HandleGitHubResolveThreadTask(ctx context.Context, proj *project.Project, task *db.ScheduledTask) error
HandleGitHubResolveThreadTask handles a scheduled GitHub thread resolution task. Returns nil on success, error on failure (caller handles retry/completion).
func HandleImportPRTask ¶
HandleImportPRTask handles a scheduled PR import task. This sets up a worktree from an existing GitHub PR.
func HandleTaskError ¶
func HandleTaskError(ctx context.Context, proj *project.Project, task *db.ScheduledTask, errMsg string)
HandleTaskError handles an error for a task, rescheduling with backoff if appropriate.
func ProcessAllDueTasks ¶
ProcessAllDueTasks checks for and executes any scheduled tasks that are due across all works. This uses the default ControlPlane with production dependencies.
func ProcessAllDueTasksWithControlPlane ¶
func ProcessAllDueTasksWithControlPlane(ctx context.Context, proj *project.Project, cp *ControlPlane)
ProcessAllDueTasksWithControlPlane checks for and executes any scheduled tasks with provided dependencies.
func RunControlPlaneLoop ¶
func RunControlPlaneLoop(ctx context.Context, proj *project.Project, procManager *procmon.Manager) error
RunControlPlaneLoop runs the main control plane event loop with default dependencies.
func RunControlPlaneLoopWithControlPlane ¶
func RunControlPlaneLoopWithControlPlane(ctx context.Context, proj *project.Project, procManager *procmon.Manager, cp *ControlPlane) error
RunControlPlaneLoopWithControlPlane runs the main control plane event loop with provided dependencies. This allows testing with mock dependencies.
func ScheduleDestroyWorktree ¶
ScheduleDestroyWorktree schedules a worktree destruction task for the control plane. This is the preferred way to destroy a worktree as it runs asynchronously with retry support.
func SpawnControlPlane ¶
SpawnControlPlane spawns the control plane in a zellij tab
Types ¶
type ControlPlane ¶
type ControlPlane struct {
Git git.Operations
Worktree worktree.Operations
Zellij zellij.SessionManager
Mise func(dir string) mise.Operations
FeedbackProcessor feedback.Processor
OrchestratorSpawner OrchestratorSpawner
WorkDestroyer WorkDestroyer
}
ControlPlane manages the execution of scheduled tasks with injectable dependencies. It allows for testing without actual CLI tools, services, or file system operations.
func NewControlPlane ¶
func NewControlPlane() *ControlPlane
NewControlPlane creates a new ControlPlane with default production dependencies.
func NewControlPlaneWithDeps ¶
func NewControlPlaneWithDeps( gitOps git.Operations, wtOps worktree.Operations, zellijMgr zellij.SessionManager, miseOps func(dir string) mise.Operations, feedbackProc feedback.Processor, orchestratorSpawner OrchestratorSpawner, workDestroyer WorkDestroyer, ) *ControlPlane
NewControlPlaneWithDeps creates a new ControlPlane with provided dependencies for testing.
func (*ControlPlane) GetTaskHandlers ¶
func (cp *ControlPlane) GetTaskHandlers() map[string]TaskHandler
GetTaskHandlers returns the task handler map for the control plane.
func (*ControlPlane) HandleCreateWorktreeTask ¶
func (cp *ControlPlane) HandleCreateWorktreeTask(ctx context.Context, proj *project.Project, task *db.ScheduledTask) error
HandleCreateWorktreeTask handles a scheduled worktree creation task
func (*ControlPlane) HandleDestroyWorktreeTask ¶
func (cp *ControlPlane) HandleDestroyWorktreeTask(ctx context.Context, proj *project.Project, task *db.ScheduledTask) error
HandleDestroyWorktreeTask handles a scheduled worktree destruction task
func (*ControlPlane) HandleGitPushTask ¶
func (cp *ControlPlane) HandleGitPushTask(ctx context.Context, proj *project.Project, task *db.ScheduledTask) error
HandleGitPushTask handles a scheduled git push task with retry support. Returns nil on success, error on failure (caller handles retry/completion).
func (*ControlPlane) HandlePRFeedbackTask ¶
func (cp *ControlPlane) HandlePRFeedbackTask(ctx context.Context, proj *project.Project, task *db.ScheduledTask) error
HandlePRFeedbackTask handles a scheduled PR feedback check. Returns nil on success, error on failure (caller handles retry/completion).
func (*ControlPlane) HandleSpawnOrchestratorTask ¶
func (cp *ControlPlane) HandleSpawnOrchestratorTask(ctx context.Context, proj *project.Project, task *db.ScheduledTask) error
HandleSpawnOrchestratorTask handles a scheduled orchestrator spawn task
type DefaultOrchestratorSpawner ¶
type DefaultOrchestratorSpawner struct{}
DefaultOrchestratorSpawner implements OrchestratorSpawner using the claude package.
func (*DefaultOrchestratorSpawner) SpawnWorkOrchestrator ¶
func (d *DefaultOrchestratorSpawner) SpawnWorkOrchestrator(ctx context.Context, workID, projectName, workDir, friendlyName string, w io.Writer) error
SpawnWorkOrchestrator implements OrchestratorSpawner.
type DefaultWorkDestroyer ¶
type DefaultWorkDestroyer struct{}
DefaultWorkDestroyer implements WorkDestroyer using the work package.
type OrchestratorSpawner ¶
type OrchestratorSpawner interface {
SpawnWorkOrchestrator(ctx context.Context, workID, projectName, workDir, friendlyName string, w io.Writer) error
}
OrchestratorSpawner defines the interface for spawning work orchestrators. This abstraction enables testing without actual zellij operations.
type SessionInitResult ¶
type SessionInitResult struct {
// SessionCreated is true if a new zellij session was created
SessionCreated bool
// SessionName is the name of the zellij session (e.g., "co-myproject")
SessionName string
}
SessionInitResult contains information about session initialization
func InitializeSession ¶
InitializeSession ensures a zellij session exists with the control plane running. When a new session is created, it uses a layout to start the control plane automatically. Returns information about whether a new session was created.
type TaskHandler ¶
TaskHandler is the signature for all scheduled task handlers.