feat: redesign TUI + Ctrl+C quit confirm + version logic + sudo handling
All checks were successful
CI / build (push) Successful in 24s

- Replace 'q' quit with Ctrl+C confirmation dialog (Yes/No overlay)
  Second Ctrl+C within 2s force quits
- Redesign TUI with Charm bubbles components: spinner, progress bar,
  help bar, key bindings, better color palette, rounded borders
- Add Shift+Tab to cycle tabs backward
- Fix version: bump to 0.2.0, release workflow checks existing tags
  before publishing (no more overwriting releases)
- Handle sudo: CLI auto-relaunches with sudo/pkexec for tools that
  need elevated privileges, TUI shows clear error message

💘 Generated with Crush

Assisted-by: GLM-5.1 via Crush <crush@charm.land>
This commit is contained in:
Augustin
2026-04-19 23:22:04 +02:00
parent e58e00da13
commit e3cd618cb1
6 changed files with 624 additions and 191 deletions

View File

@@ -22,19 +22,43 @@ jobs:
export PATH=/usr/local/go/bin:$PATH
go version
- name: Get version
- name: Compute version
id: info
run: |
VERSION=$(grep 'Version =' internal/version/version.go | cut -d'"' -f2)
BASE_VERSION=$(grep 'Version =' internal/version/version.go | cut -d'"' -f2)
COMMIT_COUNT=$(git rev-list --count HEAD)
SHORT_SHA=$(git rev-parse --short HEAD)
echo "version=v${VERSION}" >> $GITHUB_OUTPUT
FULL_VERSION="${BASE_VERSION}-dev.${COMMIT_COUNT}+${SHORT_SHA}"
echo "base_version=v${BASE_VERSION}" >> $GITHUB_OUTPUT
echo "full_version=v${FULL_VERSION}" >> $GITHUB_OUTPUT
echo "sha=${SHORT_SHA}" >> $GITHUB_OUTPUT
echo "commit_count=${COMMIT_COUNT}" >> $GITHUB_OUTPUT
- name: Check if tag exists
id: check
env:
GITEA_TOKEN: ${{ secrets.GITEATOKEN }}
run: |
if [ -z "$GITEA_TOKEN" ]; then
echo "skip=false" >> $GITHUB_OUTPUT
exit 0
fi
TAG="${{ steps.info.outputs.base_version }}"
API="${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases/tags/${TAG}"
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" -H "Authorization: token ${GITEA_TOKEN}" "${API}")
if [ "$HTTP_CODE" = "200" ]; then
echo "Tag ${TAG} already exists, skipping release."
echo "skip=true" >> $GITHUB_OUTPUT
else
echo "skip=false" >> $GITHUB_OUTPUT
fi
- name: Build all platforms
if: steps.check.outputs.skip != 'true'
run: |
export PATH=/usr/local/go/bin:$PATH
mkdir -p dist
VERSION=${{ steps.info.outputs.version }}
VERSION=${{ steps.info.outputs.full_version }}
SHA=${{ steps.info.outputs.sha }}
LDFLAGS="-s -w -X github.com/muyue/muyue/internal/version.Version=${VERSION}-${SHA}"
@@ -59,6 +83,7 @@ jobs:
ls -lh dist/
- name: Create checksums and archives
if: steps.check.outputs.skip != 'true'
run: |
cd dist
sha256sum * > checksums.txt
@@ -72,27 +97,8 @@ jobs:
rm -f muyue-linux-amd64 muyue-linux-arm64 muyue-darwin-amd64 muyue-darwin-arm64 muyue-windows-amd64.exe muyue-windows-arm64.exe
ls -lh
- name: Delete old release
env:
GITEA_TOKEN: ${{ secrets.GITEATOKEN }}
run: |
if [ -z "$GITEA_TOKEN" ]; then
echo "Warning: GITEA_TOKEN not set, skipping delete"
exit 0
fi
API="${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases"
RELEASES=$(curl -s -H "Authorization: token ${GITEA_TOKEN}" "${API}" 2>/dev/null || echo "")
if [ -n "$RELEASES" ]; then
echo "$RELEASES" | grep -o '"id":[0-9]*' | while read line; do
ID=$(echo "$line" | grep -o '[0-9]*')
curl -s -X DELETE -H "Authorization: token ${GITEA_TOKEN}" "${API}/${ID}" > /dev/null 2>&1 || true
echo "Deleted release ${ID}"
done || true
fi
curl -s -X DELETE -H "Authorization: token ${GITEA_TOKEN}" \
"${{ github.server_url }}/api/v1/repos/${{ github.repository }}/tags/latest" > /dev/null 2>&1 || true
- name: Create release
if: steps.check.outputs.skip != 'true'
env:
GITEA_TOKEN: ${{ secrets.GITEATOKEN }}
run: |
@@ -101,32 +107,36 @@ jobs:
echo "Go to Settings > Actions > Secrets and add GITEA_TOKEN"
exit 1
fi
VERSION=${{ steps.info.outputs.version }}
VERSION=${{ steps.info.outputs.full_version }}
BASE_TAG=${{ steps.info.outputs.base_version }}
SHA=${{ steps.info.outputs.sha }}
COMMIT_COUNT=${{ steps.info.outputs.commit_count }}
API="${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases"
BODY="## muyue ${VERSION} (${SHA})
BODY="## muyue ${VERSION}
| Platform | File |
|----------|------|
| Linux x86_64 | muyue-linux-amd64.tar.gz |
| Linux ARM64 | muyue-linux-arm64.tar.gz |
| macOS Intel | muyue-darwin-amd64.tar.gz |
| macOS Apple Silicon | muyue-darwin-arm64.tar.gz |
| Windows x86_64 | muyue-windows-amd64.zip |
| Windows ARM64 | muyue-windows-arm64.zip |
Build \#${COMMIT_COUNT} from \`${SHA}\`
### Install (Linux amd64)
\`\`\`bash
curl -sL ${{ github.server_url }}/${{ github.repository }}/releases/download/latest/muyue-linux-amd64.tar.gz | tar xz
chmod +x muyue-linux-amd64
sudo mv muyue-linux-amd64 /usr/local/bin/muyue
\`\`\`"
| Platform | File |
|----------|------|
| Linux x86_64 | muyue-linux-amd64.tar.gz |
| Linux ARM64 | muyue-linux-arm64.tar.gz |
| macOS Intel | muyue-darwin-amd64.tar.gz |
| macOS Apple Silicon | muyue-darwin-arm64.tar.gz |
| Windows x86_64 | muyue-windows-amd64.zip |
| Windows ARM64 | muyue-windows-arm64.zip |
### Install (Linux amd64)
\`\`\`bash
curl -sL ${{ github.server_url }}/${{ github.repository }}/releases/download/${BASE_TAG}/muyue-linux-amd64.tar.gz | tar xz
chmod +x muyue-linux-amd64
sudo mv muyue-linux-amd64 /usr/local/bin/muyue
\`\`\`"
RESPONSE=$(curl -s -X POST "${API}" \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \
-d "{\"tag_name\":\"latest\",\"target_commitish\":\"main\",\"name\":\"muyue ${VERSION} (${SHA})\",\"body\":$(echo "$BODY" | jq -Rs .),\"draft\":false,\"prerelease\":false}")
-d "{\"tag_name\":\"${BASE_TAG}\",\"target_commitish\":\"main\",\"name\":\"muyue ${VERSION}\",\"body\":$(echo "$BODY" | jq -Rs .),\"draft\":false,\"prerelease\":false}")
RELEASE_ID=$(echo "$RESPONSE" | grep -o '"id":[0-9]*' | head -1 | grep -o '[0-9]*')

View File

@@ -3,6 +3,8 @@ package main
import (
"fmt"
"os"
"os/exec"
"strings"
tea "github.com/charmbracelet/bubbletea"
"github.com/muyue/muyue/internal/config"
@@ -71,7 +73,7 @@ Usage:
Commands:
version Show version
scan Scan your system for tools and runtimes
install [tools] Install missing tools (crush, claude, bmad, starship, go, node, python, git)
install [tools] Install missing tools (needs sudo for some tools)
update Check and apply updates for all tools
setup Run first-time setup wizard
config Show current configuration
@@ -82,8 +84,8 @@ Commands:
TUI Controls:
1-5 Switch tabs (Dashboard/Chat/Workflow/Agents/Config)
Tab Cycle to next tab
q / Ctrl+C Quit
Tab / Shift+Tab Cycle tabs
Ctrl+C Show quit confirmation (press twice quickly to force quit)
Chat Commands:
/plan <goal> Start a structured Plan→Execute workflow
@@ -94,6 +96,10 @@ Workflow Controls:
[g] Generate plan (after answering questions)
[n] Execute next step
[x] Cancel/reset workflow
Note:
Some tools (docker, gh, etc.) require elevated privileges.
Run 'sudo muyue install' or use 'pkexec muyue install' if needed.
`, version.FullVersion())
}
@@ -174,6 +180,38 @@ func runInstall(tools []string) {
tools = missing
}
if needsSudo(tools) && os.Geteuid() != 0 {
fmt.Println("Some tools require elevated privileges.")
if path, err := exec.LookPath("sudo"); err == nil {
fmt.Printf("Re-running with sudo...\n")
cmd := exec.Command(path, append([]string{os.Args[0], "install"}, tools...)...)
cmd.Stdin = os.Stdin
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
if err := cmd.Run(); err != nil {
fmt.Fprintf(os.Stderr, "sudo install failed: %v\n", err)
os.Exit(1)
}
config.Save(cfg)
return
}
if path, err := exec.LookPath("pkexec"); err == nil {
fmt.Printf("Re-running with pkexec...\n")
cmd := exec.Command(path, append([]string{os.Args[0], "install"}, tools...)...)
cmd.Stdin = os.Stdin
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
if err := cmd.Run(); err != nil {
fmt.Fprintf(os.Stderr, "pkexec install failed: %v\n", err)
os.Exit(1)
}
config.Save(cfg)
return
}
fmt.Println("Neither sudo nor pkexec found. Some installs may fail.")
fmt.Println("Try running: sudo muyue install")
}
results := inst.InstallAll(tools)
for _, r := range results {
status := "[OK]"
@@ -186,6 +224,18 @@ func runInstall(tools []string) {
config.Save(cfg)
}
func needsSudo(tools []string) bool {
sudoTools := map[string]bool{
"docker": true, "git": true, "gh": true, "node": true, "python": true,
}
for _, t := range tools {
if sudoTools[t] {
return true
}
}
return false
}
func runUpdate() {
fmt.Println("Checking for updates...")
result := scanner.ScanSystem()
@@ -432,7 +482,7 @@ func runSkills(args []string) {
Description: description,
Content: resp,
Author: "muyue-generated",
Version: "1.0.0",
Version: "0.1.0",
Target: target,
Tags: []string{"generated"},
}
@@ -468,3 +518,22 @@ func runSkills(args []string) {
fmt.Println("Available: list, show, generate, deploy, init, delete")
}
}
func checkConfigProviders(cfg *config.MuyueConfig) {
for i := range cfg.AI.Providers {
if cfg.AI.Providers[i].Active {
return
}
}
if len(cfg.AI.Providers) > 0 {
cfg.AI.Providers[0].Active = true
}
}
func joinWithQuotes(items []string) string {
quoted := make([]string, len(items))
for i, item := range items {
quoted[i] = fmt.Sprintf("%q", item)
}
return strings.Join(quoted, ", ")
}

1
go.mod
View File

@@ -15,6 +15,7 @@ require (
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/catppuccin/go v0.3.0 // indirect
github.com/charmbracelet/colorprofile v0.4.1 // indirect
github.com/charmbracelet/harmonica v0.2.0 // indirect
github.com/charmbracelet/x/ansi v0.11.6 // indirect
github.com/charmbracelet/x/cellbuf v0.0.15 // indirect
github.com/charmbracelet/x/exp/strings v0.0.0-20240722160745-212f7b056ed0 // indirect

2
go.sum
View File

@@ -14,6 +14,8 @@ github.com/charmbracelet/bubbletea v1.3.10 h1:otUDHWMMzQSB0Pkc87rm691KZ3SWa4KUlv
github.com/charmbracelet/bubbletea v1.3.10/go.mod h1:ORQfo0fk8U+po9VaNvnV95UPWA1BitP1E0N6xJPlHr4=
github.com/charmbracelet/colorprofile v0.4.1 h1:a1lO03qTrSIRaK8c3JRxJDZOvhvIeSco3ej+ngLk1kk=
github.com/charmbracelet/colorprofile v0.4.1/go.mod h1:U1d9Dljmdf9DLegaJ0nGZNJvoXAhayhmidOdcBwAvKk=
github.com/charmbracelet/harmonica v0.2.0 h1:8NxJWRWg/bzKqqEaaeFNipOu77YR5t8aSwG4pgaUBiQ=
github.com/charmbracelet/harmonica v0.2.0/go.mod h1:KSri/1RMQOZLbw7AHqgcBycp8pgJnQMYYT8QZRqZ1Ao=
github.com/charmbracelet/huh v1.0.0 h1:wOnedH8G4qzJbmhftTqrpppyqHakl/zbbNdXIWJyIxw=
github.com/charmbracelet/huh v1.0.0/go.mod h1:5YVc+SlZ1IhQALxRPpkGwwEKftN/+OlJlnJYlDRFqN4=
github.com/charmbracelet/lipgloss v1.1.0 h1:vYXsiLHVkK7fp74RkV7b2kq9+zDLoEU4MZoFqR/noCY=

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,7 @@ package version
const (
Name = "muyue"
Version = "0.1.0"
Version = "0.2.0"
Author = "La Légion de Muyue"
License = "MIT"
)