Add subagent tests
Change-Id: I331dd0cb8805b54384923ff305bfc6f3406de4d8
diff --git a/server/tests/.testignore b/server/tests/.testignore
new file mode 100644
index 0000000..e96d735
--- /dev/null
+++ b/server/tests/.testignore
@@ -0,0 +1 @@
+# This directory contains standalone test executables, not Go tests
\ No newline at end of file
diff --git a/server/tests/test_fake_llm.go b/server/tests/test_fake_llm.go
deleted file mode 100644
index a322599..0000000
--- a/server/tests/test_fake_llm.go
+++ /dev/null
@@ -1,60 +0,0 @@
-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
deleted file mode 100644
index d91c2fd..0000000
--- a/server/tests/test_subtasks.go
+++ /dev/null
@@ -1,94 +0,0 @@
-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