| user | 5a7d60d | 2025-07-27 21:22:04 +0400 | [diff] [blame] | 1 | package commands |
| 2 | |
| 3 | import ( |
| 4 | "fmt" |
| 5 | |
| 6 | "github.com/spf13/cobra" |
| 7 | ) |
| 8 | |
| 9 | var configCheckCmd = &cobra.Command{ |
| 10 | Use: "config-check", |
| 11 | Short: "Check configuration validity", |
| 12 | Long: `Check the current configuration for errors and display settings. |
| 13 | |
| 14 | Examples: |
| 15 | staff config-check`, |
| 16 | RunE: runConfigCheck, |
| 17 | } |
| 18 | |
| 19 | func runConfigCheck(cmd *cobra.Command, args []string) error { |
| 20 | fmt.Println("Configuration Check:") |
| 21 | fmt.Println("==================") |
| 22 | |
| 23 | // Check OpenAI configuration |
| 24 | if cfg.OpenAI.APIKey == "" { |
| 25 | fmt.Println("❌ OpenAI API key is missing") |
| 26 | } else { |
| 27 | fmt.Printf("✅ OpenAI API key configured (ends with: ...%s)\n", cfg.OpenAI.APIKey[len(cfg.OpenAI.APIKey)-4:]) |
| 28 | } |
| 29 | |
| 30 | if cfg.OpenAI.BaseURL == "" { |
| 31 | fmt.Println("ℹ️ OpenAI Base URL using default") |
| 32 | } else { |
| 33 | fmt.Printf("ℹ️ OpenAI Base URL: %s\n", cfg.OpenAI.BaseURL) |
| 34 | } |
| 35 | |
| 36 | // Check GitHub configuration |
| 37 | if cfg.GitHub.Token == "" { |
| 38 | fmt.Println("❌ GitHub token is missing") |
| 39 | } else { |
| 40 | fmt.Printf("✅ GitHub token configured (ends with: ...%s)\n", cfg.GitHub.Token[len(cfg.GitHub.Token)-4:]) |
| 41 | } |
| 42 | |
| 43 | if cfg.GitHub.Owner == "" { |
| 44 | fmt.Println("❌ GitHub owner is missing") |
| 45 | } else { |
| 46 | fmt.Printf("✅ GitHub owner: %s\n", cfg.GitHub.Owner) |
| 47 | } |
| 48 | |
| 49 | if cfg.GitHub.Repo == "" { |
| 50 | fmt.Println("❌ GitHub repo is missing") |
| 51 | } else { |
| 52 | fmt.Printf("✅ GitHub repo: %s\n", cfg.GitHub.Repo) |
| 53 | } |
| 54 | |
| 55 | // Check agents configuration |
| 56 | fmt.Printf("\nAgents: %d configured\n", len(cfg.Agents)) |
| 57 | for i, agent := range cfg.Agents { |
| 58 | temp := 0.7 |
| 59 | if agent.Temperature != nil { |
| 60 | temp = *agent.Temperature |
| 61 | } |
| 62 | fmt.Printf(" %d. %s (model: %s, temp: %.1f)\n", i+1, agent.Name, agent.Model, temp) |
| 63 | } |
| 64 | |
| 65 | // Check task manager |
| 66 | if taskManager == nil { |
| 67 | fmt.Println("❌ Task manager not initialized") |
| 68 | } else { |
| 69 | fmt.Println("✅ Task manager initialized") |
| 70 | } |
| 71 | |
| 72 | // Check agent manager |
| 73 | if agentManager == nil { |
| 74 | fmt.Println("❌ Agent manager not initialized") |
| 75 | } else { |
| 76 | fmt.Println("✅ Agent manager initialized") |
| 77 | } |
| 78 | |
| 79 | fmt.Println("\nConfiguration check complete!") |
| 80 | return nil |
| iomodo | 50598c6 | 2025-07-27 22:06:32 +0400 | [diff] [blame] | 81 | } |