Complete implementation of muyue v0.1.0, a single-binary Go tool that transforms the development environment with AI-powered orchestration. Core features: - TUI with 5 tabs (Dashboard/Chat/Workflow/Agents/Config) using Charm stack - AI chat via MiniMax M2.7 with async message handling - Structured Plan→Execute workflow engine (gather→plan→review→execute) - System scanner detecting 14 tools + 8 runtimes across Linux/macOS/Windows - Auto-installer for Crush, Claude Code, BMAD, Starship, runtimes - Background update daemon with hourly checks - LSP auto-config for 16 language servers - MCP auto-config for 12 servers (deployed to Crush + Claude Code) - Skills system with 5 built-ins + AI-powered generation - Crush/Claude Code proxy for unified control - HTML preview server for visual outputs - First-time setup wizard with interactive profiling - Cross-platform: Linux (primary), macOS, Windows, WSL CI/CD: - GitHub Actions CI: build + test + lint on Linux/macOS/Windows - Release workflow: cross-compile 6 binaries with checksums on tag push 💘 Generated with Crush Assisted-by: GLM-5.1 via Crush <crush@charm.land>
108 lines
2.0 KiB
Go
108 lines
2.0 KiB
Go
package platform
|
|
|
|
import (
|
|
"runtime"
|
|
"strings"
|
|
)
|
|
|
|
type OS string
|
|
|
|
const (
|
|
Linux OS = "linux"
|
|
MacOS OS = "darwin"
|
|
Windows OS = "windows"
|
|
Unknown OS = "unknown"
|
|
)
|
|
|
|
type Arch string
|
|
|
|
const (
|
|
AMD64 Arch = "amd64"
|
|
ARM64 Arch = "arm64"
|
|
ARM Arch = "arm"
|
|
X86 Arch = "386"
|
|
)
|
|
|
|
type SystemInfo struct {
|
|
OS OS
|
|
Arch Arch
|
|
IsWSL bool
|
|
Shell string
|
|
Terminal string
|
|
PackageManager string
|
|
}
|
|
|
|
func Detect() SystemInfo {
|
|
info := SystemInfo{
|
|
OS: OS(runtime.GOOS),
|
|
Arch: Arch(runtime.GOARCH),
|
|
}
|
|
|
|
info.IsWSL = detectWSL()
|
|
info.Shell = detectShell()
|
|
info.Terminal = detectTerminal()
|
|
info.PackageManager = detectPackageManager(info.OS)
|
|
|
|
return info
|
|
}
|
|
|
|
func detectWSL() bool {
|
|
return fileContains("/proc/version", "microsoft") ||
|
|
fileContains("/proc/version", "WSL")
|
|
}
|
|
|
|
func detectShell() string {
|
|
shells := []string{"zsh", "bash", "fish", "pwsh", "powershell"}
|
|
for _, s := range shells {
|
|
if _, err := execLookPath(s); err == nil {
|
|
return s
|
|
}
|
|
}
|
|
return "sh"
|
|
}
|
|
|
|
func detectTerminal() string {
|
|
terms := []string{
|
|
"hyper", "alacritty", "kitty", "wezterm", "ghostty",
|
|
"windows-terminal", "gnome-terminal", "konsole",
|
|
"xterm", "tilix", "terminator",
|
|
}
|
|
for _, t := range terms {
|
|
if _, err := execLookPath(t); err == nil {
|
|
return t
|
|
}
|
|
}
|
|
return "unknown"
|
|
}
|
|
|
|
func detectPackageManager(os OS) string {
|
|
managers := map[string][]string{
|
|
"linux": {"apt", "dnf", "pacman", "zypper", "nix", "apk", "snap", "flatpak"},
|
|
"darwin": {"brew", "nix"},
|
|
"windows": {"winget", "choco", "scoop"},
|
|
}
|
|
|
|
if list, ok := managers[string(os)]; ok {
|
|
for _, mgr := range list {
|
|
if _, err := execLookPath(mgr); err == nil {
|
|
return mgr
|
|
}
|
|
}
|
|
}
|
|
return "unknown"
|
|
}
|
|
|
|
func (s SystemInfo) String() string {
|
|
parts := []string{
|
|
"OS: " + string(s.OS),
|
|
"Arch: " + string(s.Arch),
|
|
}
|
|
if s.IsWSL {
|
|
parts = append(parts, "WSL: yes")
|
|
}
|
|
parts = append(parts, "Shell: "+s.Shell)
|
|
parts = append(parts, "Terminal: "+s.Terminal)
|
|
parts = append(parts, "PackageManager: "+s.PackageManager)
|
|
return strings.Join(parts, ", ")
|
|
}
|