Documentation
¶
Overview ¶
Package mode manages MAXAM operating modes
Package mode manages MAXAM operating modes ¶
Package mode manages MAXAM operating modes ¶
Package mode manages MAXAM operating modes
Index ¶
- Constants
- Variables
- func IsCommand(input string) bool
- type ApprovalNotification
- type AutoPlanConfig
- type AutoPlanHandler
- func (h *AutoPlanHandler) AskOwnerQuestion(ctx context.Context, question, agentName string) error
- func (h *AutoPlanHandler) CheckApproval(ctx context.Context) (bool, string, error)
- func (h *AutoPlanHandler) PlanIssueNumber() int
- func (h *AutoPlanHandler) ReportBlocker(ctx context.Context, blocker, agentName string) error
- func (h *AutoPlanHandler) SetOnApproved(fn func(issueNumber int, approvedBy string))
- func (h *AutoPlanHandler) SetOnTransition(fn func(from, to config.Mode))
- func (h *AutoPlanHandler) StartPlanWorkflow(ctx context.Context, issueNumber int, planSummary, agentName string) error
- func (h *AutoPlanHandler) StartPolling(ctx context.Context) <-chan ApprovalNotification
- func (h *AutoPlanHandler) State() AutoPlanState
- func (h *AutoPlanHandler) Stop()
- type AutoPlanState
- type CodeAnalysisResult
- type CodeAnalyzer
- type Command
- type FileIssue
- type IssueInfo
- type Manager
- func (m *Manager) AddIssue(issueNum int)
- func (m *Manager) Current() config.Mode
- func (m *Manager) EnterAutoMode(ctx *PlanContext) error
- func (m *Manager) EnterPlanMode() error
- func (m *Manager) GetPlanContext() *PlanContext
- func (m *Manager) IsAuto() bool
- func (m *Manager) IsInteractive() bool
- func (m *Manager) IsPlan() bool
- func (m *Manager) SetPlanApproved(approved bool)
- func (m *Manager) StatusString() string
- func (m *Manager) Stop()
- type ParseResult
- type PlanContext
- type PlanExecutor
- func (pe *PlanExecutor) AnalyzeProject(ctx context.Context) (*ProjectAnalysis, error)
- func (pe *PlanExecutor) CheckApprovalOnce(ctx context.Context, issueNumber int, since time.Time) (*approval.ApprovalResult, error)
- func (pe *PlanExecutor) CreatePlanIssue(ctx context.Context, analysis *ProjectAnalysis, proposal string) (*PlanIssue, error)
- func (pe *PlanExecutor) WaitForApproval(ctx context.Context, issueNumber int) (*approval.ApprovalResult, error)
- type PlanIssue
- type PlanModeConfig
- type ProjectAnalysis
- type TodoItem
- type TransitionManager
- func (t *TransitionManager) CanTransition(from, to config.Mode) bool
- func (t *TransitionManager) CurrentMode() config.Mode
- func (t *TransitionManager) Runner() *auto.Runner
- func (t *TransitionManager) SetOnError(fn func(err error))
- func (t *TransitionManager) SetOnTransition(fn func(from, to config.Mode))
- func (t *TransitionManager) Transition(req TransitionRequest) TransitionResult
- func (t *TransitionManager) TransitionToAutoAndRun(ctx context.Context, planCtx *PlanContext, issues []auto.IssueInfo) error
- func (t *TransitionManager) ValidTransitions() []config.Mode
- type TransitionRequest
- type TransitionResult
Constants ¶
const DefaultPollingInterval = 30 * time.Second
DefaultPollingInterval is the default interval for polling approval status
Variables ¶
var DefaultIgnoreDirs = []string{
".git", "node_modules", "vendor", ".venv", "__pycache__",
"dist", "build", "out", "target", ".next", ".nuxt",
}
DefaultIgnoreDirs are directories to skip during analysis
var DefaultIgnoreFiles = []string{
"*.min.js", "*.min.css", "*.map", "*.lock",
}
DefaultIgnoreFiles are file patterns to skip
Functions ¶
Types ¶
type ApprovalNotification ¶
ApprovalNotification represents a notification when a plan is approved
type AutoPlanConfig ¶
AutoPlanConfig holds configuration for AutoPlanHandler
func DefaultAutoPlanConfig ¶
func DefaultAutoPlanConfig() AutoPlanConfig
DefaultAutoPlanConfig returns the default configuration
type AutoPlanHandler ¶
type AutoPlanHandler struct {
// contains filtered or unexported fields
}
AutoPlanHandler manages the automatic plan mode workflow It watches for approval on plan issues and transitions to auto mode when approved
func NewAutoPlanHandler ¶
func NewAutoPlanHandler( modeManager *Manager, watcher *approval.Watcher, poster *approval.QuestionPoster, ) *AutoPlanHandler
NewAutoPlanHandler creates a new AutoPlanHandler
func (*AutoPlanHandler) AskOwnerQuestion ¶
func (h *AutoPlanHandler) AskOwnerQuestion(ctx context.Context, question, agentName string) error
AskOwnerQuestion posts a question to the owner on the current issue
func (*AutoPlanHandler) CheckApproval ¶
CheckApproval checks for approval on the current plan Returns true if approved, false otherwise
func (*AutoPlanHandler) PlanIssueNumber ¶
func (h *AutoPlanHandler) PlanIssueNumber() int
PlanIssueNumber returns the current plan issue number
func (*AutoPlanHandler) ReportBlocker ¶
func (h *AutoPlanHandler) ReportBlocker(ctx context.Context, blocker, agentName string) error
ReportBlocker posts a blocker notification to the owner
func (*AutoPlanHandler) SetOnApproved ¶
func (h *AutoPlanHandler) SetOnApproved(fn func(issueNumber int, approvedBy string))
SetOnApproved sets the callback for when a plan is approved
func (*AutoPlanHandler) SetOnTransition ¶
func (h *AutoPlanHandler) SetOnTransition(fn func(from, to config.Mode))
SetOnTransition sets the callback for mode transitions
func (*AutoPlanHandler) StartPlanWorkflow ¶
func (h *AutoPlanHandler) StartPlanWorkflow(ctx context.Context, issueNumber int, planSummary, agentName string) error
StartPlanWorkflow starts the automatic plan workflow 1. Posts the plan to the issue 2. Starts watching for approval 3. When approved, transitions to auto mode
func (*AutoPlanHandler) StartPolling ¶
func (h *AutoPlanHandler) StartPolling(ctx context.Context) <-chan ApprovalNotification
StartPolling starts the polling loop for approval Returns a channel that receives the approval result
func (*AutoPlanHandler) State ¶
func (h *AutoPlanHandler) State() AutoPlanState
State returns the current state
func (*AutoPlanHandler) Stop ¶
func (h *AutoPlanHandler) Stop()
Stop stops the plan workflow and returns to interactive mode
type AutoPlanState ¶
type AutoPlanState string
AutoPlanState represents the state of the auto plan workflow
const ( // StateIdle means no active plan workflow StateIdle AutoPlanState = "idle" // StatePlanCreated means a plan has been created and posted StatePlanCreated AutoPlanState = "plan_created" // StateWaitingApproval means waiting for owner approval StateWaitingApproval AutoPlanState = "waiting_approval" // StateApproved means the plan has been approved StateApproved AutoPlanState = "approved" // StateExecuting means the plan is being executed StateExecuting AutoPlanState = "executing" )
type CodeAnalysisResult ¶
type CodeAnalysisResult struct {
Todos []TodoItem
UnusedImports []FileIssue
LongFiles []FileIssue
Summary string
}
CodeAnalysisResult contains the results of code analysis
type CodeAnalyzer ¶
type CodeAnalyzer struct {
// contains filtered or unexported fields
}
CodeAnalyzer performs static analysis on project code
func NewCodeAnalyzer ¶
func NewCodeAnalyzer(workDir string) *CodeAnalyzer
NewCodeAnalyzer creates a new CodeAnalyzer
func (*CodeAnalyzer) Analyze ¶
func (ca *CodeAnalyzer) Analyze() (*CodeAnalysisResult, error)
Analyze performs code analysis on the project
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages the current operating mode
func NewManager ¶
NewManager creates a new mode manager with the given default mode
func (*Manager) EnterAutoMode ¶
func (m *Manager) EnterAutoMode(ctx *PlanContext) error
EnterAutoMode transitions to auto mode from plan mode Requires plan approval
func (*Manager) EnterPlanMode ¶
EnterPlanMode transitions to plan mode from interactive mode
func (*Manager) GetPlanContext ¶
func (m *Manager) GetPlanContext() *PlanContext
GetPlanContext returns the current plan context (nil if not in plan/auto mode)
func (*Manager) IsInteractive ¶
IsInteractive returns true if in interactive mode
func (*Manager) SetPlanApproved ¶
SetPlanApproved marks the current plan as approved
func (*Manager) StatusString ¶
StatusString returns a human-readable status string
type ParseResult ¶
type ParseResult struct {
IsCommand bool
Command Command
Args string // remaining text after command
}
ParseResult contains the result of parsing user input for commands
func Parse ¶
func Parse(input string) ParseResult
Parse parses user input and extracts any mode command
type PlanContext ¶
type PlanContext struct {
DiscussionURL string // URL of approved discussion
IssueNumbers []int // Issue numbers created from the plan
Approved bool // Whether the plan was approved
}
PlanContext stores the context from plan mode
type PlanExecutor ¶
type PlanExecutor struct {
// contains filtered or unexported fields
}
PlanExecutor handles plan mode execution
func NewPlanExecutor ¶
func NewPlanExecutor(ghClient *gh.Client, config *PlanModeConfig) *PlanExecutor
NewPlanExecutor creates a new PlanExecutor
func (*PlanExecutor) AnalyzeProject ¶
func (pe *PlanExecutor) AnalyzeProject(ctx context.Context) (*ProjectAnalysis, error)
AnalyzeProject performs a lightweight project analysis
func (*PlanExecutor) CheckApprovalOnce ¶
func (pe *PlanExecutor) CheckApprovalOnce(ctx context.Context, issueNumber int, since time.Time) (*approval.ApprovalResult, error)
CheckApprovalOnce checks for approval without blocking
func (*PlanExecutor) CreatePlanIssue ¶
func (pe *PlanExecutor) CreatePlanIssue(ctx context.Context, analysis *ProjectAnalysis, proposal string) (*PlanIssue, error)
CreatePlanIssue creates an issue with the plan proposal
func (*PlanExecutor) WaitForApproval ¶
func (pe *PlanExecutor) WaitForApproval(ctx context.Context, issueNumber int) (*approval.ApprovalResult, error)
WaitForApproval polls the issue for approval comments
type PlanModeConfig ¶
PlanModeConfig holds configuration for plan mode
func DefaultPlanModeConfig ¶
func DefaultPlanModeConfig() *PlanModeConfig
DefaultPlanModeConfig returns the default configuration
type ProjectAnalysis ¶
type ProjectAnalysis struct {
TotalIssues int
OpenIssues int
UnassignedIssues int
OldestOpenIssue *IssueInfo
LabelCounts map[string]int
Summary string
}
ProjectAnalysis contains simplified project analysis for plan mode
type TransitionManager ¶
type TransitionManager struct {
// contains filtered or unexported fields
}
TransitionManager manages mode transitions
func NewTransitionManager ¶
func NewTransitionManager(modeManager *Manager, runner *auto.Runner) *TransitionManager
NewTransitionManager creates a new transition manager
func (*TransitionManager) CanTransition ¶
func (t *TransitionManager) CanTransition(from, to config.Mode) bool
CanTransition checks if a transition is valid without performing it
func (*TransitionManager) CurrentMode ¶
func (t *TransitionManager) CurrentMode() config.Mode
CurrentMode returns the current mode
func (*TransitionManager) Runner ¶
func (t *TransitionManager) Runner() *auto.Runner
Runner returns the auto runner
func (*TransitionManager) SetOnError ¶
func (t *TransitionManager) SetOnError(fn func(err error))
SetOnError sets the callback for transition errors
func (*TransitionManager) SetOnTransition ¶
func (t *TransitionManager) SetOnTransition(fn func(from, to config.Mode))
SetOnTransition sets the callback for mode transitions
func (*TransitionManager) Transition ¶
func (t *TransitionManager) Transition(req TransitionRequest) TransitionResult
Transition performs a mode transition
func (*TransitionManager) TransitionToAutoAndRun ¶
func (t *TransitionManager) TransitionToAutoAndRun(ctx context.Context, planCtx *PlanContext, issues []auto.IssueInfo) error
TransitionToAutoAndRun transitions to auto mode and starts execution This is a convenience method that combines transition and execution
func (*TransitionManager) ValidTransitions ¶
func (t *TransitionManager) ValidTransitions() []config.Mode
ValidTransitions returns all valid transitions from the current mode
type TransitionRequest ¶
type TransitionRequest struct {
// From is the expected current mode (optional, for validation)
From config.Mode
// To is the target mode
To config.Mode
// PlanContext is required when transitioning to auto mode
PlanContext *PlanContext
// Issues is the list of issues to execute (for auto mode)
Issues []auto.IssueInfo
}
TransitionRequest represents a request to transition modes