refactor: modularize TUI, improve error handling, add CI caching and tests
All checks were successful
CI / build (push) Successful in 2m41s
All checks were successful
CI / build (push) Successful in 2m41s
Split monolithic app.go into focused modules (dashboard, chat, workflow, config, agents, terminal, commands, handlers). Add proper error handling for installer commands, proxy pipes, and MCP config parsing. Fix daemon channel buffer, cap orchestrator history, compile think regex once, and set HTTP timeouts on preview server. Improve CI with Go module caching, dependency download step, and test stage with race detection. 😘 Generated with Crush Assisted-by: GLM-5-Turbo via Crush <crush@charm.land>
This commit is contained in:
@@ -127,11 +127,11 @@ func GenerateCrushMCPConfig(cfg *config.MuyueConfig, homeDir string) error {
|
||||
existing := map[string]interface{}{}
|
||||
data, err := os.ReadFile(crusherPath)
|
||||
if err == nil {
|
||||
json.Unmarshal(data, &existing)
|
||||
if jsonErr := json.Unmarshal(data, &existing); jsonErr != nil {
|
||||
existing = map[string]interface{}{}
|
||||
}
|
||||
}
|
||||
|
||||
mcps := map[string]interface{}{}
|
||||
|
||||
core := []MCPServer{
|
||||
{Name: "filesystem", Command: "npx", Args: []string{"-y", "@modelcontextprotocol/server-filesystem", homeDir + "/projects"}},
|
||||
{Name: "fetch", Command: "npx", Args: []string{"-y", "@modelcontextprotocol/server-fetch"}},
|
||||
@@ -157,6 +157,8 @@ func GenerateCrushMCPConfig(cfg *config.MuyueConfig, homeDir string) error {
|
||||
}
|
||||
}
|
||||
|
||||
mcps := map[string]interface{}{}
|
||||
|
||||
for _, s := range core {
|
||||
entry := map[string]interface{}{
|
||||
"command": s.Command,
|
||||
@@ -189,7 +191,9 @@ func GenerateClaudeMCPConfig(cfg *config.MuyueConfig, homeDir string) error {
|
||||
existing := map[string]interface{}{}
|
||||
data, err := os.ReadFile(configPath)
|
||||
if err == nil {
|
||||
json.Unmarshal(data, &existing)
|
||||
if jsonErr := json.Unmarshal(data, &existing); jsonErr != nil {
|
||||
existing = map[string]interface{}{}
|
||||
}
|
||||
}
|
||||
|
||||
mcpservers := map[string]interface{}{}
|
||||
@@ -241,7 +245,10 @@ func GenerateClaudeMCPConfig(cfg *config.MuyueConfig, homeDir string) error {
|
||||
}
|
||||
|
||||
func ConfigureAll(cfg *config.MuyueConfig) error {
|
||||
home, _ := os.UserHomeDir()
|
||||
home, err := os.UserHomeDir()
|
||||
if err != nil {
|
||||
return fmt.Errorf("get home dir: %w", err)
|
||||
}
|
||||
|
||||
if err := GenerateCrushMCPConfig(cfg, home); err != nil {
|
||||
return fmt.Errorf("crush MCP config: %w", err)
|
||||
|
||||
Reference in New Issue
Block a user