Add subtasks

Change-Id: Ica6afd9eef38bcf29135bf2c8a2e4bf0407ccfa1
diff --git a/server/tests/test_fake_llm.go b/server/tests/test_fake_llm.go
new file mode 100644
index 0000000..a322599
--- /dev/null
+++ b/server/tests/test_fake_llm.go
@@ -0,0 +1,60 @@
+package main
+
+import (
+	"context"
+	"fmt"
+	"log"
+
+	"github.com/iomodo/staff/llm"
+	_ "github.com/iomodo/staff/llm/providers" // Auto-register providers
+)
+
+func main() {
+	// Create fake LLM config
+	config := llm.Config{
+		Provider: llm.ProviderFake,
+		APIKey:   "fake-key",
+		BaseURL:  "fake://test",
+	}
+
+	// Create provider
+	provider, err := llm.CreateProvider(config)
+	if err != nil {
+		log.Fatalf("Failed to create provider: %v", err)
+	}
+	defer provider.Close()
+
+	// Test chat completion
+	req := llm.ChatCompletionRequest{
+		Model: "fake-gpt-4",
+		Messages: []llm.Message{
+			{
+				Role:    llm.RoleSystem,
+				Content: "You are a helpful AI assistant.",
+			},
+			{
+				Role:    llm.RoleUser,
+				Content: "Create a solution for implementing user authentication",
+			},
+		},
+		MaxTokens:   &[]int{4000}[0],
+		Temperature: &[]float64{0.3}[0],
+	}
+
+	fmt.Println("Testing Fake LLM Provider...")
+	fmt.Println("==========================")
+
+	resp, err := provider.ChatCompletion(context.Background(), req)
+	if err != nil {
+		log.Fatalf("Chat completion failed: %v", err)
+	}
+
+	fmt.Printf("Response ID: %s\n", resp.ID)
+	fmt.Printf("Model: %s\n", resp.Model)
+	fmt.Printf("Provider: %s\n", resp.Provider)
+	fmt.Printf("Usage: %+v\n", resp.Usage)
+	fmt.Println("\nGenerated Solution:")
+	fmt.Println("===================")
+	fmt.Println(resp.Choices[0].Message.Content)
+	fmt.Println("\nāœ… Fake LLM Provider is working correctly!")
+}
\ No newline at end of file
diff --git a/server/tests/test_subtasks.go b/server/tests/test_subtasks.go
new file mode 100644
index 0000000..d91c2fd
--- /dev/null
+++ b/server/tests/test_subtasks.go
@@ -0,0 +1,94 @@
+package main
+
+import (
+	"context"
+	"fmt"
+	"log"
+	"time"
+
+	"github.com/iomodo/staff/llm"
+	_ "github.com/iomodo/staff/llm/providers"
+	"github.com/iomodo/staff/subtasks"
+	"github.com/iomodo/staff/tm"
+)
+
+func main() {
+	fmt.Println("Testing Subtask Generation...")
+	fmt.Println("==============================")
+
+	// Create fake LLM provider
+	config := llm.Config{
+		Provider: llm.ProviderFake,
+		APIKey:   "fake-key",
+		BaseURL:  "fake://test",
+	}
+
+	provider, err := llm.CreateProvider(config)
+	if err != nil {
+		log.Fatalf("Failed to create provider: %v", err)
+	}
+	defer provider.Close()
+
+	// Create a mock task
+	task := &tm.Task{
+		ID:          "task-test-123",
+		Title:       "Build comprehensive user authentication system",
+		Description: "Implement a complete user authentication system with registration, login, password reset, multi-factor authentication, OAuth integration with Google and GitHub, session management, role-based access control, and admin dashboard for user management. System should support enterprise SSO integration and have comprehensive audit logging for security compliance.",
+		Priority:    tm.PriorityHigh,
+		Status:      tm.StatusToDo,
+		CreatedAt:   time.Now(),
+		UpdatedAt:   time.Now(),
+	}
+
+	// Create subtask service with available agent roles
+	agentRoles := []string{"ceo", "backend-engineer", "frontend-engineer", "qa", "devops"}
+	subtaskService := subtasks.NewSubtaskService(provider, nil, agentRoles)
+
+	fmt.Printf("šŸ“‹ Analyzing task: %s\n", task.Title)
+	fmt.Printf("šŸ” Description: %s\n\n", task.Description[:100]+"...")
+
+	// Analyze task for subtasks
+	fmt.Println("šŸ¤– Running LLM analysis...")
+	analysis, err := subtaskService.AnalyzeTaskForSubtasks(context.Background(), task)
+	if err != nil {
+		log.Fatalf("Failed to analyze task: %v", err)
+	}
+
+	fmt.Printf("āœ… Analysis completed!\n\n")
+	fmt.Printf("šŸ“Š **Analysis Summary:**\n%s\n\n", analysis.AnalysisSummary)
+	fmt.Printf("šŸŽÆ **Recommended Approach:**\n%s\n\n", analysis.RecommendedApproach)
+	fmt.Printf("ā±ļø **Estimated Total Hours:** %d\n\n", analysis.EstimatedTotalHours)
+
+	if analysis.RiskAssessment != "" {
+		fmt.Printf("āš ļø **Risk Assessment:**\n%s\n\n", analysis.RiskAssessment)
+	}
+
+	fmt.Printf("šŸ“ **Proposed Subtasks (%d):**\n", len(analysis.Subtasks))
+	fmt.Println("=================================")
+
+	for i, subtask := range analysis.Subtasks {
+		fmt.Printf("\n%d. **%s**\n", i+1, subtask.Title)
+		fmt.Printf("   - Assigned to: %s\n", subtask.AssignedTo)
+		fmt.Printf("   - Priority: %s\n", subtask.Priority)
+		fmt.Printf("   - Hours: %d\n", subtask.EstimatedHours)
+		if len(subtask.Dependencies) > 0 {
+			fmt.Printf("   - Dependencies: %v\n", subtask.Dependencies)
+		}
+		fmt.Printf("   - Description: %s\n", subtask.Description)
+	}
+
+	// Generate PR content
+	fmt.Println("\nšŸ”„ Generating PR content...")
+	prURL, err := subtaskService.GenerateSubtaskPR(context.Background(), analysis)
+	if err != nil {
+		log.Fatalf("Failed to generate PR: %v", err)
+	}
+
+	fmt.Printf("\nāœ… **Subtask PR Generated:** %s\n", prURL)
+	fmt.Println("\nšŸŽ‰ **Subtask generation test completed successfully!**")
+	fmt.Println("\nšŸ’” **Next Steps:**")
+	fmt.Println("   1. Review the generated subtasks")
+	fmt.Println("   2. Approve the PR to create actual subtasks")
+	fmt.Println("   3. Assign subtasks to appropriate agents")
+	fmt.Println("   4. Monitor subtask completion progress")
+}
\ No newline at end of file