Major changes: - Refactor CLI entry point to Cobra commands (root, setup, scan, doctor, install, update, lsp, mcp, skills, config, version) - Add LSP registry with health checks, auto-install, and editor config generation - Add MCP registry with editor detection, status tracking, and per-editor configuration - Add workflow engine with planner and step execution for automated task chains - Add conversation search, export (Markdown/JSON), and detailed token counting - Add streaming shell chat handler with tool call/result events - Add skill validation, dry-run testing, and export endpoints - Enrich dashboard with Tools/Activity/Status tabs and tool cards grid - Add PRD documentation - Complete i18n for both EN and FR 💘 Generated with Crush Assisted-by: GLM-5.1 via Crush <crush@charm.land>
66 lines
1.6 KiB
Go
66 lines
1.6 KiB
Go
package commands
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/muyue/muyue/internal/config"
|
|
"github.com/muyue/muyue/internal/desktop"
|
|
"github.com/muyue/muyue/internal/profiler"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var rootCmd = &cobra.Command{
|
|
Use: "muyue",
|
|
Short: "Muyue is your AI-powered development companion",
|
|
Long: `Muyue - A modern development environment with AI assistance, tool management, and seamless desktop integration.`,
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
cfg := loadOrSetupConfig()
|
|
return desktop.Run(cfg, os.Args[1:])
|
|
},
|
|
}
|
|
|
|
func Execute() error {
|
|
return rootCmd.Execute()
|
|
}
|
|
|
|
func loadOrSetupConfig() *config.MuyueConfig {
|
|
if !config.Exists() {
|
|
fmt.Println("First time setup detected!")
|
|
cfg, err := profiler.RunFirstTimeSetup()
|
|
if err != nil {
|
|
fmt.Fprintf(os.Stderr, "Setup error: %v\n", err)
|
|
os.Exit(1)
|
|
}
|
|
|
|
for i := range cfg.AI.Providers {
|
|
if cfg.AI.Providers[i].Active && cfg.AI.Providers[i].APIKey == "" {
|
|
key, err := profiler.AskAPIKey(cfg.AI.Providers[i].Name)
|
|
if err == nil && key != "" {
|
|
cfg.AI.Providers[i].APIKey = key
|
|
}
|
|
}
|
|
}
|
|
|
|
if err := config.Save(cfg); err != nil {
|
|
fmt.Fprintf(os.Stderr, "Save error: %v\n", err)
|
|
os.Exit(1)
|
|
}
|
|
|
|
fmt.Println("\nSetup complete! Starting muyue...")
|
|
return cfg
|
|
}
|
|
|
|
cfg, err := config.Load()
|
|
if err != nil {
|
|
fmt.Fprintf(os.Stderr, "Config load error: %v\n", err)
|
|
os.Exit(1)
|
|
}
|
|
|
|
return cfg
|
|
}
|
|
|
|
func init() {
|
|
rootCmd.PersistentFlags().Int("port", 8080, "HTTP port for the desktop server")
|
|
rootCmd.PersistentFlags().Bool("no-open", false, "Don't open browser on startup")
|
|
} |