blob: ec8c8945d9bf4e12e1382933f719b0a7fe0c8265 [file] [log] [blame]
package commands
import (
"fmt"
"github.com/spf13/cobra"
)
var configCheckCmd = &cobra.Command{
Use: "config-check",
Short: "Check configuration validity",
Long: `Check the current configuration for errors and display settings.
Examples:
staff config-check`,
RunE: runConfigCheck,
}
func runConfigCheck(cmd *cobra.Command, args []string) error {
fmt.Println("Configuration Check:")
fmt.Println("==================")
// Check OpenAI configuration
if cfg.OpenAI.APIKey == "" {
fmt.Println("❌ OpenAI API key is missing")
} else {
fmt.Printf("✅ OpenAI API key configured (ends with: ...%s)\n", cfg.OpenAI.APIKey[len(cfg.OpenAI.APIKey)-4:])
}
if cfg.OpenAI.BaseURL == "" {
fmt.Println("ℹ️ OpenAI Base URL using default")
} else {
fmt.Printf("ℹ️ OpenAI Base URL: %s\n", cfg.OpenAI.BaseURL)
}
// Check GitHub configuration
if cfg.GitHub.Token == "" {
fmt.Println("❌ GitHub token is missing")
} else {
fmt.Printf("✅ GitHub token configured (ends with: ...%s)\n", cfg.GitHub.Token[len(cfg.GitHub.Token)-4:])
}
if cfg.GitHub.Owner == "" {
fmt.Println("❌ GitHub owner is missing")
} else {
fmt.Printf("✅ GitHub owner: %s\n", cfg.GitHub.Owner)
}
if cfg.GitHub.Repo == "" {
fmt.Println("❌ GitHub repo is missing")
} else {
fmt.Printf("✅ GitHub repo: %s\n", cfg.GitHub.Repo)
}
// Check agents configuration
fmt.Printf("\nAgents: %d configured\n", len(cfg.Agents))
for i, agent := range cfg.Agents {
temp := 0.7
if agent.Temperature != nil {
temp = *agent.Temperature
}
fmt.Printf(" %d. %s (model: %s, temp: %.1f)\n", i+1, agent.Name, agent.Model, temp)
}
// Check task manager
if taskManager == nil {
fmt.Println("❌ Task manager not initialized")
} else {
fmt.Println("✅ Task manager initialized")
}
// Check agent manager
if agentManager == nil {
fmt.Println("❌ Agent manager not initialized")
} else {
fmt.Println("✅ Agent manager initialized")
}
fmt.Println("\nConfiguration check complete!")
return nil
}