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:
@@ -210,10 +210,18 @@ func (i *Installer) installNode() InstallResult {
|
||||
}
|
||||
case platform.MacOS:
|
||||
cmd := exec.Command("brew", "install", "node")
|
||||
cmd.Run()
|
||||
if output, err := cmd.CombinedOutput(); err != nil {
|
||||
return InstallResult{Tool: "node", Success: false,
|
||||
Message: fmt.Sprintf("install failed: %s: %s", err, string(output))}
|
||||
}
|
||||
case platform.Windows:
|
||||
cmd := exec.Command("winget", "install", "OpenJS.NodeJS.LTS")
|
||||
cmd.Run()
|
||||
if output, err := cmd.CombinedOutput(); err != nil {
|
||||
return InstallResult{Tool: "node", Success: false,
|
||||
Message: fmt.Sprintf("install failed: %s: %s", err, string(output))}
|
||||
}
|
||||
default:
|
||||
return InstallResult{Tool: "node", Success: false, Message: "unsupported OS"}
|
||||
}
|
||||
|
||||
return InstallResult{Tool: "node", Success: true, Message: "installed"}
|
||||
@@ -226,11 +234,22 @@ func (i *Installer) installPython() InstallResult {
|
||||
|
||||
switch i.system.PackageManager {
|
||||
case "apt":
|
||||
exec.Command("apt", "install", "-y", "python3", "python3-pip").Run()
|
||||
if output, err := exec.Command("apt", "install", "-y", "python3", "python3-pip").CombinedOutput(); err != nil {
|
||||
return InstallResult{Tool: "python", Success: false,
|
||||
Message: fmt.Sprintf("install failed: %s: %s", err, string(output))}
|
||||
}
|
||||
case "brew":
|
||||
exec.Command("brew", "install", "python3").Run()
|
||||
if output, err := exec.Command("brew", "install", "python3").CombinedOutput(); err != nil {
|
||||
return InstallResult{Tool: "python", Success: false,
|
||||
Message: fmt.Sprintf("install failed: %s: %s", err, string(output))}
|
||||
}
|
||||
case "winget":
|
||||
exec.Command("winget", "install", "Python.Python.3.12").Run()
|
||||
if output, err := exec.Command("winget", "install", "Python.Python.3.12").CombinedOutput(); err != nil {
|
||||
return InstallResult{Tool: "python", Success: false,
|
||||
Message: fmt.Sprintf("install failed: %s: %s", err, string(output))}
|
||||
}
|
||||
default:
|
||||
return InstallResult{Tool: "python", Success: false, Message: fmt.Sprintf("install via '%s' not supported", i.system.PackageManager)}
|
||||
}
|
||||
|
||||
return InstallResult{Tool: "python", Success: true, Message: "installed"}
|
||||
@@ -243,11 +262,22 @@ func (i *Installer) installGit() InstallResult {
|
||||
|
||||
switch i.system.PackageManager {
|
||||
case "apt":
|
||||
exec.Command("apt", "install", "-y", "git").Run()
|
||||
if output, err := exec.Command("apt", "install", "-y", "git").CombinedOutput(); err != nil {
|
||||
return InstallResult{Tool: "git", Success: false,
|
||||
Message: fmt.Sprintf("install failed: %s: %s", err, string(output))}
|
||||
}
|
||||
case "brew":
|
||||
exec.Command("brew", "install", "git").Run()
|
||||
if output, err := exec.Command("brew", "install", "git").CombinedOutput(); err != nil {
|
||||
return InstallResult{Tool: "git", Success: false,
|
||||
Message: fmt.Sprintf("install failed: %s: %s", err, string(output))}
|
||||
}
|
||||
case "winget":
|
||||
exec.Command("winget", "install", "Git.Git").Run()
|
||||
if output, err := exec.Command("winget", "install", "Git.Git").CombinedOutput(); err != nil {
|
||||
return InstallResult{Tool: "git", Success: false,
|
||||
Message: fmt.Sprintf("install failed: %s: %s", err, string(output))}
|
||||
}
|
||||
default:
|
||||
return InstallResult{Tool: "git", Success: false, Message: fmt.Sprintf("install via '%s' not supported", i.system.PackageManager)}
|
||||
}
|
||||
|
||||
if i.config.Profile.Name != "" {
|
||||
|
||||
Reference in New Issue
Block a user