- Fix detectShell() to return full paths via LookPath (was returning bare names causing exec error on some systems) - Add shell path validation before pty.Start to prevent crashes - Simplify CLI: remove all subcommands, keep only desktop launch with --port - Restore missing Studio shared CSS (code blocks, input area, animations) - Replace Config vertical sidebar with horizontal nav-tabs matching main layout 💘 Generated with Crush Assisted-by: GLM-5.1 via Crush <crush@charm.land>
55 lines
1.1 KiB
Go
55 lines
1.1 KiB
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/muyue/muyue/internal/config"
|
|
"github.com/muyue/muyue/internal/desktop"
|
|
"github.com/muyue/muyue/internal/profiler"
|
|
)
|
|
|
|
func main() {
|
|
cfg := loadOrSetupConfig()
|
|
if err := desktop.Run(cfg, os.Args[1:]); err != nil {
|
|
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
|
|
os.Exit(1)
|
|
}
|
|
}
|
|
|
|
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
|
|
}
|