final_verification.go
1 package main 2 3 import ( 4 "context" 5 "fmt" 6 "os/exec" 7 "strings" 8 "time" 9 10 "github.com/TransformerOS/kamaji-go/internal/agents" 11 "github.com/TransformerOS/kamaji-go/internal/config" 12 "github.com/TransformerOS/kamaji-go/internal/providers" 13 "github.com/TransformerOS/kamaji-go/internal/tools" 14 ) 15 16 func main() { 17 fmt.Println("š FINAL VERIFICATION - All Components") 18 fmt.Println("=====================================") 19 20 // 1. Verify all tools 21 verifyTools() 22 23 // 2. Verify all CLI commands 24 verifyCLICommands() 25 26 // 3. Verify agents 27 verifyAgents() 28 29 // 4. Verify advanced features 30 verifyAdvancedFeatures() 31 32 fmt.Println("\nš VERIFICATION COMPLETE") 33 } 34 35 func verifyTools() { 36 fmt.Println("\nš TOOLS VERIFICATION") 37 38 allTools := tools.GetAll() 39 fmt.Printf("ā Total tools found: %d\n", len(allTools)) 40 41 // Critical tool categories 42 categories := map[string][]string{ 43 "File": {"file_read", "file_write", "file_append", "list_directory"}, 44 "Shell": {"shell_execute", "get_current_directory", "change_directory"}, 45 "Git": {"git_status", "git_add", "git_commit", "git_diff", "git_log"}, 46 "RAG": {"rag_load", "rag_query", "rag_list"}, 47 "Memory": {"memory_store", "memory_recall"}, 48 "Tasks": {"task_add", "task_list", "task_complete"}, 49 "Analysis": {"analyze_code", "analyze_project", "security_scan"}, 50 } 51 52 toolMap := make(map[string]bool) 53 for _, tool := range allTools { 54 toolMap[tool.Name()] = true 55 } 56 57 for category, expectedTools := range categories { 58 found := 0 59 for _, toolName := range expectedTools { 60 if toolMap[toolName] { 61 found++ 62 } 63 } 64 fmt.Printf("ā %s tools: %d/%d found\n", category, found, len(expectedTools)) 65 } 66 } 67 68 func verifyCLICommands() { 69 fmt.Println("\nš» CLI COMMANDS VERIFICATION") 70 71 expectedCommands := []string{ 72 "agent", "aide", "ask", "chat", "config", "do", "enhance", 73 "interactive", "mature", "provider", "queue", "rag", "tasks", 74 "tui", "update", "work", 75 } 76 77 // Test help command 78 cmd := exec.Command("./bin/kamaji", "--help") 79 output, err := cmd.Output() 80 if err != nil { 81 fmt.Printf("ā CLI help failed: %v\n", err) 82 return 83 } 84 85 helpText := string(output) 86 found := 0 87 for _, command := range expectedCommands { 88 if strings.Contains(helpText, command) { 89 found++ 90 } 91 } 92 93 fmt.Printf("ā CLI commands: %d/%d available\n", found, len(expectedCommands)) 94 95 // Test specific commands 96 testCommands := []struct{cmd, desc string}{ 97 {"config", "Configuration"}, 98 {"tasks", "Task management"}, 99 {"provider list", "Provider management"}, 100 } 101 102 for _, test := range testCommands { 103 cmd := exec.Command("./bin/kamaji", strings.Fields(test.cmd)...) 104 err := cmd.Run() 105 if err == nil { 106 fmt.Printf("ā %s: Working\n", test.desc) 107 } else { 108 fmt.Printf("ā ļø %s: %v\n", test.desc, err) 109 } 110 } 111 } 112 113 func verifyAgents() { 114 fmt.Println("\nš„ AGENT SYSTEM VERIFICATION") 115 116 // Test agent creation 117 llm := providers.NewMockProvider("http://test", "test-model") 118 allTools := tools.GetAll() 119 120 agent := agents.NewBasicAgentExecutor(llm, allTools, false) 121 if agent == nil { 122 fmt.Println("ā Agent creation failed") 123 return 124 } 125 126 fmt.Println("ā Agent creation: Working") 127 128 // Test agent status 129 status := agent.GetStatus() 130 if status.Status == "ready" { 131 fmt.Println("ā Agent status: Working") 132 } else { 133 fmt.Printf("ā ļø Agent status: %s\n", status.Status) 134 } 135 136 // Test agent tools access 137 agentTools := agent.GetTools() 138 fmt.Printf("ā Agent tools access: %d tools available\n", len(agentTools)) 139 140 // Test agent execution 141 ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) 142 defer cancel() 143 144 result, err := agent.Execute(ctx, "test task") 145 if err != nil { 146 fmt.Printf("ā ļø Agent execution: %v\n", err) 147 } else { 148 fmt.Println("ā Agent execution: Working") 149 if len(result) > 50 { 150 fmt.Printf(" Result preview: %s...\n", result[:50]) 151 } 152 } 153 } 154 155 func verifyAdvancedFeatures() { 156 fmt.Println("\nš ADVANCED FEATURES VERIFICATION") 157 158 // 1. Configuration system 159 cfg, err := config.Load() 160 if err != nil { 161 fmt.Printf("ā ļø Config system: %v\n", err) 162 } else { 163 fmt.Println("ā Configuration system: Working") 164 fmt.Printf(" Provider: %s, Model: %s\n", cfg.Provider, cfg.Model) 165 } 166 167 // 2. Provider system 168 _, err = providers.GetLLM(providers.LLMOptions{}) 169 if err != nil { 170 fmt.Printf("ā ļø Provider system: %v\n", err) 171 } else { 172 fmt.Println("ā Provider system: Working") 173 } 174 175 // 3. RAG functionality (simulated) 176 ragTools := []string{"rag_load", "rag_query", "rag_list"} 177 allTools := tools.GetAll() 178 toolMap := make(map[string]bool) 179 for _, tool := range allTools { 180 toolMap[tool.Name()] = true 181 } 182 183 ragFound := 0 184 for _, ragTool := range ragTools { 185 if toolMap[ragTool] { 186 ragFound++ 187 } 188 } 189 fmt.Printf("ā RAG system: %d/%d tools available\n", ragFound, len(ragTools)) 190 191 // 4. Memory functionality 192 memoryTools := []string{"memory_store", "memory_recall"} 193 memoryFound := 0 194 for _, memTool := range memoryTools { 195 if toolMap[memTool] { 196 memoryFound++ 197 } 198 } 199 fmt.Printf("ā Memory system: %d/%d tools available\n", memoryFound, len(memoryTools)) 200 201 // 5. Task management 202 taskTools := []string{"task_add", "task_list", "task_complete", "task_next"} 203 taskFound := 0 204 for _, taskTool := range taskTools { 205 if toolMap[taskTool] { 206 taskFound++ 207 } 208 } 209 fmt.Printf("ā Task management: %d/%d tools available\n", taskFound, len(taskTools)) 210 211 // 6. Analysis tools 212 analysisTools := []string{"analyze_code", "analyze_project", "analyze_dependencies", "security_scan"} 213 analysisFound := 0 214 for _, analysisTool := range analysisTools { 215 if toolMap[analysisTool] { 216 analysisFound++ 217 } 218 } 219 fmt.Printf("ā Analysis tools: %d/%d tools available\n", analysisFound, len(analysisTools)) 220 }