cmd

package
v0.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 3, 2026 License: MIT Imports: 61 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MainScreen planInitScreen = iota
	AdvancedScreen
)
View Source
const RollingPlanName = "rolling"

RollingPlanName is the name of the auto-created rolling plan used when no plan is specified.

Variables

View Source
var ErrTUIQuit = errors.New("quit")

Functions

func CreateOrSwitchToMainRepoSessionAndRunCommand

func CreateOrSwitchToMainRepoSessionAndRunCommand(ctx context.Context, planName string, commandToRun []string) error

CreateOrSwitchToMainRepoSessionAndRunCommand creates or switches to a tmux session in the main repo and executes a command. This is similar to CreateOrSwitchToWorktreeSessionAndRunCommand but operates in the main repository.

func CreateOrSwitchToWorktreeSessionAndRunCommand

func CreateOrSwitchToWorktreeSessionAndRunCommand(ctx context.Context, plan *orchestration.Plan, worktreeName string, commandToRun []string) error

CreateOrSwitchToWorktreeSessionAndRunCommand creates or switches to a tmux session for the worktree and executes a command.

func ExportedCompleteJob

func ExportedCompleteJob(job *orchestration.Job, plan *orchestration.Plan, silent bool) error

ExportedCompleteJob exports completeJob for use by the status_tui package

func ExportedFindAllDependents

func ExportedFindAllDependents(job *orchestration.Job, plan *orchestration.Plan) []*orchestration.Job

ExportedFindAllDependents exports findAllDependents for use by the status_tui package

func ExportedFindRootJobs

func ExportedFindRootJobs(plan *orchestration.Plan) []*orchestration.Job

ExportedFindRootJobs exports findRootJobs for use by the status_tui package

func ExportedVerifyRunningJobStatus

func ExportedVerifyRunningJobStatus(plan *orchestration.Plan)

ExportedVerifyRunningJobStatus exports VerifyRunningJobStatus for use by the status_tui package

func FlowStatusProvider

func FlowStatusProvider(s state.State) (string, error)

FlowStatusProvider is the status provider for grove-flow. It generates the starship prompt status string based on the active plan.

func GetChatCommand

func GetChatCommand() *cobra.Command

func GetRegisterCodexSessionCmd

func GetRegisterCodexSessionCmd() *cobra.Command

func GetRegisterOpencodeSessionCmd

func GetRegisterOpencodeSessionCmd() *cobra.Command

func InitPlanStatusFlags

func InitPlanStatusFlags()

InitPlanStatusFlags initializes the flags for the status command

func NewActionCmd

func NewActionCmd() *cobra.Command

func NewAddCmd

func NewAddCmd() *cobra.Command

func NewCompleteCmd

func NewCompleteCmd() *cobra.Command

NewCompleteCmd creates the top-level `complete` command.

func NewConfigCmd

func NewConfigCmd() *cobra.Command

NewConfigCmd creates the top-level `config` command. This delegates to the existing NewPlanConfigCmd from plan_config.go

func NewCurrentCmd

func NewCurrentCmd() *cobra.Command

NewCurrentCmd creates the top-level `current` command.

func NewFinishCmd

func NewFinishCmd() *cobra.Command

NewFinishCmd creates the top-level `finish` command.

func NewGraphCmd

func NewGraphCmd() *cobra.Command

NewGraphCmd creates the top-level `graph` command.

func NewHoldCmd

func NewHoldCmd() *cobra.Command

NewHoldCmd creates the top-level `hold` command.

func NewListCmd

func NewListCmd() *cobra.Command

NewListCmd creates the top-level `list` command.

func NewModelsCmd

func NewModelsCmd() *cobra.Command

NewModelsCmd creates the flow models command.

func NewOpenCmd

func NewOpenCmd() *cobra.Command

NewOpenCmd creates the top-level `open` command.

func NewPlanCmd

func NewPlanCmd() *cobra.Command

NewPlanCmd returns the plan command with all subcommands configured.

func NewPlanConfigCmd

func NewPlanConfigCmd() *cobra.Command

NewPlanConfigCmd creates a new plan config command

func NewPlanContextCmd

func NewPlanContextCmd() *cobra.Command

NewPlanContextCmd creates the plan context command.

func NewPlanCurrentCmd

func NewPlanCurrentCmd() *cobra.Command

NewPlanCurrentCmd creates the plan current command.

func NewPlanExtractCmd

func NewPlanExtractCmd() *cobra.Command

NewPlanExtractCmd creates the jobs extract command.

func NewPlanFinishCmd

func NewPlanFinishCmd() *cobra.Command

NewPlanFinishCmd creates the `plan finish` command.

func NewPlanHoldCmd

func NewPlanHoldCmd() *cobra.Command

NewPlanHoldCmd creates the `plan hold` command.

func NewPlanJobsCmd

func NewPlanJobsCmd() *cobra.Command

func NewPlanResumeCmd

func NewPlanResumeCmd() *cobra.Command

NewPlanResumeCmd creates the `plan resume` command.

func NewPlanSetCmd

func NewPlanSetCmd() *cobra.Command

NewPlanSetCmd creates the plan set command.

func NewPlanUnholdCmd

func NewPlanUnholdCmd() *cobra.Command

NewPlanUnholdCmd creates the `plan unhold` command.

func NewPlanUnsetCmd

func NewPlanUnsetCmd() *cobra.Command

NewPlanUnsetCmd creates the plan unset command.

func NewResumeCmd

func NewResumeCmd() *cobra.Command

NewResumeCmd creates the top-level `resume` command.

func NewReviewCmd

func NewReviewCmd() *cobra.Command

NewReviewCmd creates the top-level `review` command.

func NewRunCmd

func NewRunCmd() *cobra.Command

func NewSetCmd

func NewSetCmd() *cobra.Command

NewSetCmd creates the top-level `set` command.

func NewStarshipCmd

func NewStarshipCmd() *cobra.Command

func NewStatusCmd

func NewStatusCmd() *cobra.Command

func NewStepCmd

func NewStepCmd() *cobra.Command

NewStepCmd creates the top-level `step` command.

func NewTmuxCmd

func NewTmuxCmd() *cobra.Command

NewTmuxCmd returns the tmux command with all subcommands configured.

func NewTmuxStatusCmd

func NewTmuxStatusCmd() *cobra.Command

NewTmuxStatusCmd returns the command for opening plan status in a tmux window.

func NewUnholdCmd

func NewUnholdCmd() *cobra.Command

NewUnholdCmd creates the top-level `unhold` command.

func NewUnsetCmd

func NewUnsetCmd() *cobra.Command

NewUnsetCmd creates the top-level `unset` command.

func NewVersionCmd

func NewVersionCmd() *cobra.Command

func RunPlanAddStep

func RunPlanAddStep(cmd *PlanAddStepCmd) error

func RunPlanConfig

func RunPlanConfig(cmd *PlanConfigCmd) error

RunPlanConfig executes the plan config command

func RunPlanGraph

func RunPlanGraph(cmd *PlanGraphCmd) error

func RunPlanInit

func RunPlanInit(cmd *PlanInitCmd) error

RunPlanInit implements the plan init command.

func RunPlanInitTUI

func RunPlanInitTUI(dir string, cliCmd *PlanInitCmd) error

RunPlanInitTUI launches the interactive TUI for creating a new plan.

func RunPlanStatus

func RunPlanStatus(cmd *cobra.Command, args []string) error

RunPlanStatus implements the status command.

func VerifyRunningJobStatus

func VerifyRunningJobStatus(plan *orchestration.Plan)

VerifyRunningJobStatus checks the PID liveness for jobs marked as running. If a job's process is dead, its status is updated in-memory to "interrupted".

Types

type AgentConfig

type AgentConfig struct {
	Args                     []string                  `yaml:"args"`
	MountWorkspaceAtHostPath bool                      `yaml:"mount_workspace_at_host_path"`
	UseSuperprojectRoot      bool                      `yaml:"use_superproject_root"`
	InteractiveProvider      string                    `yaml:"interactive_provider,omitempty"` // "claude", "codex", or "opencode"
	Providers                map[string]ProviderConfig `yaml:"providers"`
}

AgentConfig defines the structure for the 'agent' section in grove.yml.

type AppConfig

type AppConfig struct {
	Core  *config.Config
	Flow  *FlowConfig
	Agent *AgentConfig
}

AppConfig wraps the core config with flow-specific extensions.

type BlockInfo

type BlockInfo struct {
	ID        string `json:"id"`
	Type      string `json:"type"`
	LineStart int    `json:"line_start"`
	Preview   string `json:"preview"`
}

BlockInfo represents information about an extractable block

type DependencyGraph

type DependencyGraph struct {
	Nodes map[string]*orchestration.Job
	Edges map[string][]string // job ID -> list of dependent job IDs
	Roots []string            // Jobs with no dependencies
}

type EcosystemRepoStatus

type EcosystemRepoStatus struct {
	Name        string
	MergeStatus string
	GitStatus   *git.StatusInfo
}

EcosystemRepoStatus holds detailed status for a single repo in an ecosystem plan.

type FlowConfig

type FlowConfig struct {
	ChatDirectory        string                  `yaml:"chat_directory"`
	OneshotModel         string                  `yaml:"oneshot_model"`
	TargetAgentContainer string                  `yaml:"target_agent_container"`
	PlansDirectory       string                  `yaml:"plans_directory"`
	MaxConsecutiveSteps  int                     `yaml:"max_consecutive_steps"`
	SummarizeOnComplete  bool                    `yaml:"summarize_on_complete"`
	SummaryModel         string                  `yaml:"summary_model"`
	SummaryPrompt        string                  `yaml:"summary_prompt"`
	SummaryMaxChars      int                     `yaml:"summary_max_chars"`
	RunInitByDefault     *bool                   `yaml:"run_init_by_default"` // Whether to run init actions by default (nil = true)
	Recipes              map[string]RecipeConfig `yaml:"recipes"`
}

FlowConfig defines the structure for the 'flow' section in grove.yml.

type GitStatusInfo

type GitStatusInfo struct {
	Clean        bool `json:"clean"`
	AheadCount   int  `json:"ahead_count"`
	BehindCount  int  `json:"behind_count"`
	HasUntracked bool `json:"has_untracked"`
	HasModified  bool `json:"has_modified"`
	HasStaged    bool `json:"has_staged"`
}

GitStatusInfo contains git repository status information

type GraphPageData

type GraphPageData struct {
	PlanName     string
	Stats        GraphStats
	MermaidGraph string
}

type GraphStats

type GraphStats struct {
	Total       int
	Completed   int
	Running     int
	Pending     int
	Failed      int
	Blocked     int
	NeedsReview int
}

type JobEnrichmentOptions

type JobEnrichmentOptions struct {
	NoteRef      string
	Repository   string
	Worktree     string
	IsNoteTarget bool
}

JobEnrichmentOptions holds context for enriching job frontmatter during plan init. This ensures consistent behavior across recipe-based and manual job creation.

type Model

type Model struct {
	ID       string
	Provider string
	Note     string
}

Model represents an LLM model option

type PlanAddStepCmd

type PlanAddStepCmd struct {
	Dir                 string   `arg:"" help:"Plan directory"`
	Template            string   `flag:"" help:"Name of the job template to use"`
	Type                string   `flag:"t" default:"interactive_agent" help:"Job type: oneshot, chat, interactive_agent, headless_agent, shell, or file"`
	Title               string   `flag:"" help:"Job title"`
	DependsOn           []string `flag:"d" help:"Dependencies (job filenames)"`
	PromptFile          string   `flag:"f" help:"File containing the prompt"`
	IncludeFiles        []string `flag:"" sep:"," help:"Comma-separated list of files to include as context"`
	Prompt              string   `flag:"p" help:"Inline prompt text"`
	Interactive         bool     `flag:"i" help:"Interactive mode"`
	Worktree            string   `flag:"" help:"Explicitly set the worktree name (overrides automatic inference)"`
	Model               string   `flag:"" help:"LLM model to use for this job"`
	Inline              []string `flag:"" sep:"," help:"File types to inline in prompt: dependencies, include, context, all, files, none (comma-separated)"`
	PrependDependencies bool     `flag:"" help:"[DEPRECATED] Use --inline=dependencies instead. Inline dependency content into prompt body."`
	Recipe              string   `flag:"" help:"Name of a recipe to add to the plan"`
	RecipeVars          []string `flag:"" help:"Variables for the recipe templates (e.g., key=value)"`
	SourceFile          string   `flag:"" help:"Origin file path for tracking job provenance (e.g., Claude plan file)"`
}

func (*PlanAddStepCmd) Run

func (c *PlanAddStepCmd) Run() error

type PlanConfigCmd

type PlanConfigCmd struct {
	Dir  string
	Set  []string
	Get  string
	JSON bool
}

PlanConfigCmd represents the plan config command

type PlanGraphCmd

type PlanGraphCmd struct {
	Directory string `arg:"" help:"Plan directory"`
	Format    string `flag:"f" default:"mermaid" help:"Output format: mermaid, dot, ascii"`
	Serve     bool   `flag:"s" help:"Serve interactive HTML visualization"`
	Port      int    `flag:"p" default:"8080" help:"Port for web server"`
	Output    string `flag:"o" help:"Output file (stdout if not specified)"`
}

func (*PlanGraphCmd) Run

func (c *PlanGraphCmd) Run() error

type PlanInitCmd

type PlanInitCmd struct {
	Dir            string
	Force          bool
	Model          string
	Worktree       string
	Container      string
	ExtractAllFrom string
	OpenSession    bool
	Recipe         string
	RecipeVars     []string
	RecipeCmd      string
	Repos          []string // List of repos to include in ecosystem worktree
	NoteRef        string
	FromNote       string
	NoteTargetFile string
	RunInit        bool // Run init actions from workspace_init.yml
}

PlanInitCmd holds the parameters for the init command.

type PlanListItem

type PlanListItem struct {
	Plan                  *orchestration.Plan
	Name                  string
	JobCount              int
	Status                string
	StatusParts           map[string]int        // For detailed status breakdown
	LastUpdated           time.Time             // When the plan was last modified
	Worktree              string                // Worktree associated with the plan
	GitStatus             *git.StatusInfo       // Git status information for the worktree
	ReviewStatus          string                // Review status like "In Progress"
	MergeStatus           string                // Merge status: "Ready", "Needs Rebase", "Merged"
	Notes                 string                // User notes/description
	EcosystemRepoStatuses []EcosystemRepoStatus // Detailed status for each repo in an ecosystem plan
}

PlanListItem represents a plan in the TUI list

type PlanStatistics

type PlanStatistics struct {
	Completed int
	Running   int
	Pending   int
	Failed    int
	Todo      int
	Hold      int
	Abandoned int
	Total     int
}

PlanStatistics holds the statistics for a plan.

func GetPlanStatistics

func GetPlanStatistics(plan *orchestration.Plan) PlanStatistics

GetPlanStatistics calculates statistics for a plan. This is extracted from the plan status command to be reused by the starship provider.

type PlanSummary

type PlanSummary struct {
	ID            string               `json:"id"`
	Title         string               `json:"title"`
	Path          string               `json:"path"`
	Status        string               `json:"status"`
	JobCount      int                  `json:"job_count"`
	Jobs          []*orchestration.Job `json:"jobs,omitempty"`
	CreatedAt     time.Time            `json:"created_at"`
	UpdatedAt     time.Time            `json:"updated_at"`
	Repository    string               `json:"repository,omitempty"`
	WorkspaceName string               `json:"workspace_name,omitempty"`
	WorkspacePath string               `json:"workspace_path,omitempty"`
}

PlanSummary represents a plan in the JSON output

type ProviderConfig

type ProviderConfig struct {
	Args []string `yaml:"args"`
}

ProviderConfig holds settings for a specific agent provider.

type RecipeConfig

type RecipeConfig struct {
	Vars map[string]string `yaml:"vars"`
}

RecipeConfig defines configuration for a specific recipe.

type WorktreeStatus

type WorktreeStatus struct {
	Name         string         `json:"name"`
	Branch       string         `json:"branch,omitempty"`
	GitStatus    *GitStatusInfo `json:"git_status,omitempty"`
	MergeStatus  string         `json:"merge_status"`
	ReviewStatus string         `json:"review_status"`
}

WorktreeStatus represents git and worktree information for JSON output

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL