Refactor everything
Change-Id: Ic3a37c38cfecba943c91f6ae545ce1c5b551c0d5
diff --git a/server/cmd/commands/generate_subtasks.go b/server/cmd/commands/generate_subtasks.go
deleted file mode 100644
index c907b82..0000000
--- a/server/cmd/commands/generate_subtasks.go
+++ /dev/null
@@ -1,95 +0,0 @@
-package commands
-
-import (
- "fmt"
- "log"
-
- "github.com/spf13/cobra"
-)
-
-var generateSubtasksCmd = &cobra.Command{
- Use: "generate-subtasks [task-id]",
- Short: "Generate subtasks for a given task using LLM analysis",
- Long: `Analyze a task and generate proposed subtasks using LLM analysis.
-This creates a PR with the proposed subtasks that can be reviewed and merged.
-
-Example:
- staff generate-subtasks task-123456-abcdef`,
- Args: cobra.ExactArgs(1),
- RunE: runGenerateSubtasks,
-}
-
-func init() {
- rootCmd.AddCommand(generateSubtasksCmd)
-}
-
-func runGenerateSubtasks(cmd *cobra.Command, args []string) error {
- taskID := args[0]
-
- // Get the task
- task, err := taskManager.GetTask(taskID)
- if err != nil {
- return fmt.Errorf("failed to get task: %w", err)
- }
-
- fmt.Printf("Generating subtasks for task: %s\n", task.Title)
- fmt.Printf("Description: %s\n", task.Description)
- fmt.Printf("Priority: %s\n\n", task.Priority)
-
- // Check if subtasks already generated
- if task.SubtasksGenerated {
- fmt.Printf("⚠️ Subtasks already generated for this task\n")
- if task.SubtasksPRURL != "" {
- fmt.Printf("PR URL: %s\n", task.SubtasksPRURL)
- }
- return nil
- }
-
- // Force subtask generation by temporarily marking as high priority
- originalPriority := task.Priority
- task.Priority = "high"
-
- // Get the manager's subtask service and generate
- if agentManager == nil {
- return fmt.Errorf("agent manager not initialized")
- }
-
- // This is a bit of a hack to access private method, but for testing...
- log.Printf("Starting subtask analysis for task %s...", taskID)
-
- // We'll call this through the normal task processing flow
- // by creating a dummy agent to trigger the subtask generation
- agentStatus := agentManager.GetAgentStatus()
- if len(agentStatus) == 0 {
- return fmt.Errorf("no agents available")
- }
-
- // Get first available agent
- var agentName string
- for name := range agentStatus {
- agentName = name
- break
- }
-
- fmt.Printf("🤖 Using agent '%s' for subtask analysis...\n\n", agentName)
-
- // Create a simple approach: assign task to agent and let it process
- task.Assignee = agentName
- task.Priority = originalPriority // Restore original priority
-
- if err := taskManager.UpdateTask(task); err != nil {
- return fmt.Errorf("failed to update task assignment: %w", err)
- }
-
- fmt.Printf("✅ Task assigned to agent '%s' for subtask generation\n", agentName)
- fmt.Printf("💡 Start the server to see subtask generation in action:\n")
- fmt.Printf(" staff server --config config-fake.yaml\n\n")
- fmt.Printf("📋 The agent will:\n")
- fmt.Printf(" 1. Analyze the task requirements\n")
- fmt.Printf(" 2. Generate proposed subtasks with LLM\n")
- fmt.Printf(" 3. Create a PR with subtask proposals\n")
- fmt.Printf(" 4. Wait for PR review and approval\n")
- fmt.Printf(" 5. Create actual subtasks when PR is merged\n")
-
- return nil
-}
\ No newline at end of file
diff --git a/server/cmd/commands/root.go b/server/cmd/commands/root.go
index ade7c53..e75e134 100644
--- a/server/cmd/commands/root.go
+++ b/server/cmd/commands/root.go
@@ -75,8 +75,8 @@
Level: slog.LevelInfo,
}))
- gitInterface := git.DefaultGit("../")
- taskManager = git_tm.NewGitTaskManagerWithLogger(gitInterface, "../", logger)
+ gitInterface := git.New(cfg, logger)
+ taskManager = git_tm.NewGitTaskManager(gitInterface, cfg, logger)
// Initialize agent manager
agentManager, err = agent.NewManager(cfg, taskManager, logger)