diff --git a/cmd/skillshare/upgrade.go b/cmd/skillshare/upgrade.go index c457a9213..f5d3b8d55 100644 --- a/cmd/skillshare/upgrade.go +++ b/cmd/skillshare/upgrade.go @@ -25,6 +25,10 @@ import ( versionpkg "skillshare/internal/version" ) +// replaceBinaryFlag is internal: the sudo child receives only this flag, so +// root replaces the binary and never touches the user's skill, caches, or logs. +const replaceBinaryFlag = "--replace-binary" + func cmdUpgrade(args []string) error { start := time.Now() @@ -32,6 +36,7 @@ func cmdUpgrade(args []string) error { force := false skillOnly := false cliOnly := false + replaceVersion := "" // Parse args for _, arg := range args { @@ -47,9 +52,21 @@ func cmdUpgrade(args []string) error { case "--help", "-h": printUpgradeHelp() return nil + default: + if v, ok := strings.CutPrefix(arg, replaceBinaryFlag+"="); ok { + replaceVersion = v + } } } + if replaceVersion != "" { + execPath, err := resolveExecPath() + if err != nil { + return err + } + return downloadBinary(execPath, replaceVersion) + } + // Show logo ui.Logo(version) @@ -127,14 +144,9 @@ func upgradeCLIBinary(dryRun, force bool) (string, error) { // Step 1: Show current version ui.StepStart("CLI", fmt.Sprintf("v%s", version)) - // Get current executable path - execPath, err := os.Executable() + execPath, err := resolveExecPath() if err != nil { - return "", fmt.Errorf("failed to get executable path: %w", err) - } - execPath, err = filepath.EvalSymlinks(execPath) - if err != nil { - return "", fmt.Errorf("failed to resolve symlink: %w", err) + return "", err } // Check if installed via Homebrew @@ -192,27 +204,18 @@ func upgradeCLIBinary(dryRun, force bool) (string, error) { } } - // Check if we need elevated permissions to write to the binary location + // Only the binary replacement runs as root; everything after it writes + // into the user's home and must stay owned by the user. if runtime.GOOS != "windows" && needsSudo(execPath) { ui.Info("Need elevated permissions to write to %s", filepath.Dir(execPath)) - return "", reexecWithSudo(execPath) + err = upgradeBinaryWithSudo(execPath, latestVersion) + } else { + err = downloadBinary(execPath, latestVersion) } - - // Get download URL for current platform - downloadURL, err := versionpkg.BuildDownloadURL(latestVersion) if err != nil { - return "", fmt.Errorf("failed to get download URL: %w", err) + return "", err } - - // Download hasUIDownload := latestVersion != "" - downloadLabel := fmt.Sprintf("Downloading v%s...", latestVersion) - downloadSpinner := ui.StartTreeSpinner(downloadLabel, !hasUIDownload) - if err := downloadAndReplace(downloadURL, execPath, downloadProgress(downloadLabel, downloadSpinner.Update)); err != nil { - downloadSpinner.Fail("Failed to download") - return "", fmt.Errorf("failed to upgrade: %w", err) - } - downloadSpinner.Success(fmt.Sprintf("Upgraded v%s → v%s", version, latestVersion)) // Clear version cache so next check fetches fresh data versionpkg.ClearCache() @@ -230,6 +233,34 @@ func upgradeCLIBinary(dryRun, force bool) (string, error) { return latestVersion, nil } +func resolveExecPath() (string, error) { + execPath, err := os.Executable() + if err != nil { + return "", fmt.Errorf("failed to get executable path: %w", err) + } + execPath, err = filepath.EvalSymlinks(execPath) + if err != nil { + return "", fmt.Errorf("failed to resolve symlink: %w", err) + } + return execPath, nil +} + +func downloadBinary(execPath, targetVersion string) error { + downloadURL, err := versionpkg.BuildDownloadURL(targetVersion) + if err != nil { + return fmt.Errorf("failed to get download URL: %w", err) + } + + downloadLabel := fmt.Sprintf("Downloading v%s...", targetVersion) + downloadSpinner := ui.StartTreeSpinner(downloadLabel, false) + if err := downloadAndReplace(downloadURL, execPath, downloadProgress(downloadLabel, downloadSpinner.Update)); err != nil { + downloadSpinner.Fail("Failed to download") + return fmt.Errorf("failed to upgrade: %w", err) + } + downloadSpinner.Success(fmt.Sprintf("Upgraded v%s → v%s", version, targetVersion)) + return nil +} + func upgradeSkillshareSkill(dryRun, force bool) error { // Step 1: Show skill info ui.StepStart("Skill", "skillshare") diff --git a/cmd/skillshare/upgrade_test.go b/cmd/skillshare/upgrade_test.go index 70686bae4..3b134104b 100644 --- a/cmd/skillshare/upgrade_test.go +++ b/cmd/skillshare/upgrade_test.go @@ -3,6 +3,7 @@ package main import ( + "errors" "os" "path/filepath" "strings" @@ -39,12 +40,12 @@ func TestNeedsSudo_NonExistentDir(t *testing.T) { } } -func TestReexecWithSudo_NoSudoInPath(t *testing.T) { +func TestUpgradeBinaryWithSudo_NoSudoInPath(t *testing.T) { origPath := os.Getenv("PATH") t.Setenv("PATH", "") defer os.Setenv("PATH", origPath) - err := reexecWithSudo("/usr/local/bin/skillshare") + err := upgradeBinaryWithSudo("/usr/local/bin/skillshare", "0.22.0") if err == nil { t.Fatal("expected error when sudo is not in PATH") } @@ -53,7 +54,7 @@ func TestReexecWithSudo_NoSudoInPath(t *testing.T) { } } -func TestReexecWithSudo_ExecArgs(t *testing.T) { +func TestUpgradeBinaryWithSudo_ExecArgs(t *testing.T) { // Capture what execFunc receives var gotPath string var gotArgs []string @@ -76,12 +77,12 @@ func TestReexecWithSudo_ExecArgs(t *testing.T) { os.WriteFile(fakeSudo, []byte("#!/bin/sh\n"), 0755) t.Setenv("PATH", dir) - // Override os.Args for the test + // The user's flags must not reach root: only the binary replacement runs there. origArgs := os.Args os.Args = []string{"skillshare", "upgrade", "--force"} defer func() { os.Args = origArgs }() - err := reexecWithSudo("/usr/local/bin/skillshare") + err := upgradeBinaryWithSudo("/usr/local/bin/skillshare", "0.22.0") if err != nil { t.Fatalf("unexpected error: %v", err) } @@ -89,7 +90,7 @@ func TestReexecWithSudo_ExecArgs(t *testing.T) { if gotPath != fakeSudo { t.Errorf("exec path = %q, want %q", gotPath, fakeSudo) } - wantArgs := []string{"sudo", "/usr/local/bin/skillshare", "upgrade", "--force"} + wantArgs := []string{"sudo", "/usr/local/bin/skillshare", "upgrade", "--replace-binary=0.22.0"} if len(gotArgs) != len(wantArgs) { t.Fatalf("args = %v, want %v", gotArgs, wantArgs) } @@ -100,7 +101,7 @@ func TestReexecWithSudo_ExecArgs(t *testing.T) { } } -func TestReexecWithSudo_NonInteractiveWithoutTTY(t *testing.T) { +func TestUpgradeBinaryWithSudo_NonInteractiveWithoutTTY(t *testing.T) { var gotArgs []string orig := execFunc execFunc = func(_ string, argv []string, _ []string) error { @@ -117,7 +118,7 @@ func TestReexecWithSudo_NonInteractiveWithoutTTY(t *testing.T) { os.WriteFile(filepath.Join(dir, "sudo"), []byte("#!/bin/sh\n"), 0755) t.Setenv("PATH", dir) - if err := reexecWithSudo("/usr/local/bin/skillshare"); err != nil { + if err := upgradeBinaryWithSudo("/usr/local/bin/skillshare", "0.22.0"); err != nil { t.Fatalf("unexpected error: %v", err) } if len(gotArgs) < 2 || gotArgs[1] != "-n" { @@ -125,7 +126,7 @@ func TestReexecWithSudo_NonInteractiveWithoutTTY(t *testing.T) { } } -func TestReexecWithSudo_PasswordNeededWithoutTTY(t *testing.T) { +func TestUpgradeBinaryWithSudo_PasswordNeededWithoutTTY(t *testing.T) { orig := execFunc execFunc = func(string, []string, []string) error { t.Error("must not exec sudo when it would need a password") @@ -141,8 +142,26 @@ func TestReexecWithSudo_PasswordNeededWithoutTTY(t *testing.T) { os.WriteFile(filepath.Join(dir, "sudo"), []byte("#!/bin/sh\nexit 1\n"), 0755) t.Setenv("PATH", dir) - err := reexecWithSudo("/usr/local/bin/skillshare") - if err == nil || !strings.Contains(err.Error(), "sudo skillshare upgrade") { - t.Errorf("err = %v, want the terminal command hint", err) + err := upgradeBinaryWithSudo("/usr/local/bin/skillshare", "0.22.0") + if err == nil || !strings.Contains(err.Error(), "run in a terminal: skillshare upgrade") { + t.Errorf("err = %v, want the terminal command hint without a sudo prefix", err) + } +} + +func TestUpgradeBinaryWithSudo_ChildFailureIsReturned(t *testing.T) { + orig := execFunc + execFunc = func(string, []string, []string) error { return errors.New("exit status 1") } + defer func() { execFunc = orig }() + + origTTY := stdinIsTTY + stdinIsTTY = func() bool { return true } + defer func() { stdinIsTTY = origTTY }() + + dir := t.TempDir() + os.WriteFile(filepath.Join(dir, "sudo"), []byte("#!/bin/sh\n"), 0755) + t.Setenv("PATH", dir) + + if err := upgradeBinaryWithSudo("/usr/local/bin/skillshare", "0.22.0"); err == nil { + t.Error("expected the sudo child's failure to stop the upgrade") } } diff --git a/cmd/skillshare/upgrade_unix.go b/cmd/skillshare/upgrade_unix.go index 2edb8662d..0004d41e8 100644 --- a/cmd/skillshare/upgrade_unix.go +++ b/cmd/skillshare/upgrade_unix.go @@ -19,13 +19,20 @@ func needsSudo(path string) bool { return unix.Access(filepath.Dir(path), unix.W_OK) != nil } -// execFunc is the syscall used to replace the process. Overridden in tests. -var execFunc = unix.Exec +// execFunc runs sudo and waits for it. Overridden in tests. +var execFunc = func(argv0 string, argv []string, envv []string) error { + cmd := exec.Command(argv0, argv[1:]...) + cmd.Env = envv + cmd.Stdin, cmd.Stdout, cmd.Stderr = os.Stdin, os.Stdout, os.Stderr + return cmd.Run() +} // stdinIsTTY reports whether a user can answer a sudo prompt. Overridden in tests. var stdinIsTTY = func() bool { return term.IsTerminal(int(os.Stdin.Fd())) } -func reexecWithSudo(execPath string) error { +// upgradeBinaryWithSudo replaces the binary in a sudo child that does nothing +// else, so the skill, UI assets, caches, and logs stay owned by the user. +func upgradeBinaryWithSudo(execPath, targetVersion string) error { sudoPath, err := exec.LookPath("sudo") if err != nil { return fmt.Errorf("sudo not found, please run: sudo %s", strings.Join(os.Args, " ")) @@ -35,11 +42,13 @@ func reexecWithSudo(execPath string) error { // sudo prompts on /dev/tty, not stdin: without -n a dashboard-spawned // upgrade waits for a password nobody can see until it times out. if exec.Command(sudoPath, "-n", "true").Run() != nil { - return fmt.Errorf("a password is needed to write to %s; run in a terminal: %s", filepath.Dir(execPath), versionpkg.SudoUpgradeHint) + return fmt.Errorf("a password is needed to write to %s; %s%s", filepath.Dir(execPath), versionpkg.SudoUpgradeHintPrefix, versionpkg.SudoUpgradeHint) } args = append(args, "-n") } - args = append(args, execPath) - args = append(args, os.Args[1:]...) - return execFunc(sudoPath, args, os.Environ()) + args = append(args, execPath, "upgrade", replaceBinaryFlag+"="+targetVersion) + if err := execFunc(sudoPath, args, os.Environ()); err != nil { + return fmt.Errorf("sudo upgrade failed: %w", err) + } + return nil } diff --git a/cmd/skillshare/upgrade_windows.go b/cmd/skillshare/upgrade_windows.go index 6be7cbb84..551650da1 100644 --- a/cmd/skillshare/upgrade_windows.go +++ b/cmd/skillshare/upgrade_windows.go @@ -8,6 +8,6 @@ func needsSudo(_ string) bool { return false } -func reexecWithSudo(_ string) error { +func upgradeBinaryWithSudo(_, _ string) error { return fmt.Errorf("sudo is not supported on Windows") } diff --git a/internal/server/handler_restart_upgrade.go b/internal/server/handler_restart_upgrade.go index 0fef3b0cd..8e4b6986a 100644 --- a/internal/server/handler_restart_upgrade.go +++ b/internal/server/handler_restart_upgrade.go @@ -36,9 +36,9 @@ func (s *Server) handleUpgrade(w http.ResponseWriter, r *http.Request) { } result, err := runUIUpgrade() if err != nil { - if strings.Contains(result.Output, versioncheck.SudoUpgradeHint) { + if strings.Contains(result.Output, versioncheck.SudoUpgradeHintPrefix+versioncheck.SudoUpgradeHint) { writeCodedError(w, http.StatusForbidden, "upgrade.needs_sudo", - "a password is needed to replace the binary; run in a terminal: "+versioncheck.SudoUpgradeHint, nil) + "a password is needed to replace the binary; "+versioncheck.SudoUpgradeHintPrefix+versioncheck.SudoUpgradeHint, nil) return } writeError(w, http.StatusInternalServerError, err.Error()) diff --git a/internal/server/handler_restart_upgrade_test.go b/internal/server/handler_restart_upgrade_test.go index 1c5d16185..1b4febff5 100644 --- a/internal/server/handler_restart_upgrade_test.go +++ b/internal/server/handler_restart_upgrade_test.go @@ -127,7 +127,7 @@ func TestHandleUpgradeReturnsRunnerError(t *testing.T) { func TestHandleUpgradeNeedsSudoIsCoded(t *testing.T) { old := runUIUpgrade runUIUpgrade = func() (uiUpgradeResult, error) { - return uiUpgradeResult{Output: "run in a terminal: sudo skillshare upgrade"}, errors.New("exit status 1") + return uiUpgradeResult{Output: "run in a terminal: skillshare upgrade"}, errors.New("exit status 1") } defer func() { runUIUpgrade = old }() diff --git a/internal/version/homebrew.go b/internal/version/homebrew.go index cca25ad27..033aa6445 100644 --- a/internal/version/homebrew.go +++ b/internal/version/homebrew.go @@ -70,4 +70,9 @@ func FetchBrewLatestVersion() (string, error) { // SudoUpgradeHint is the command shown when an upgrade needs a password but // has no terminal to ask on. The dashboard matches on it to explain the failure. -const SudoUpgradeHint = "sudo skillshare upgrade" +// It has no sudo prefix: the CLI elevates only the binary replacement, while a +// fully root upgrade leaves root-owned skill files that later break git pull. +const SudoUpgradeHint = "skillshare upgrade" + +// SudoUpgradeHintPrefix precedes SudoUpgradeHint in the CLI error. +const SudoUpgradeHintPrefix = "run in a terminal: " diff --git a/ui/src/i18n/locales/de.json b/ui/src/i18n/locales/de.json index 26aa87fc8..e815d7e9f 100644 --- a/ui/src/i18n/locales/de.json +++ b/ui/src/i18n/locales/de.json @@ -763,7 +763,7 @@ "update.missingRepos.rehydrateSuccess": "{count} getrackte(s) Repo(s) rehydriert", "update.missingRepos.rehydratePartial": "{count} Repo(s) konnten nicht rehydriert werden", "updateDialog.copyCommand": "Befehl kopieren", - "updateDialog.needsSudo": "Für das Update wird dein Passwort benötigt. Führe sudo skillshare upgrade in einem Terminal aus.", + "updateDialog.needsSudo": "Für das Update wird dein Passwort benötigt. Führe skillshare upgrade in einem Terminal aus.", "updateDialog.newVersion": "Neue Version verfügbar", "updateDialog.restartDev": "DEV-Modus-Neustart simuliert.", "updateDialog.restartManual": "Aktualisiert. Starte mit skillshare ui start neu, falls diese Seite keine Verbindung herstellt.", diff --git a/ui/src/i18n/locales/en.json b/ui/src/i18n/locales/en.json index b08087e36..cb721a8fc 100644 --- a/ui/src/i18n/locales/en.json +++ b/ui/src/i18n/locales/en.json @@ -769,7 +769,7 @@ "syncResult.upToDate.one": "{count} target already up to date", "syncResult.upToDate.other": "{count} targets already up to date", "updateDialog.copyCommand": "Copy command", - "updateDialog.needsSudo": "Updating needs your password. Run sudo skillshare upgrade in a terminal.", + "updateDialog.needsSudo": "Updating needs your password. Run skillshare upgrade in a terminal.", "updateDialog.newVersion": "New version available", "updateDialog.restartDev": "DEV mode restart simulated.", "updateDialog.restartManual": "Updated. Restart with skillshare ui start if this page does not reconnect.", diff --git a/ui/src/i18n/locales/es.json b/ui/src/i18n/locales/es.json index dd54286ef..cf48bda62 100644 --- a/ui/src/i18n/locales/es.json +++ b/ui/src/i18n/locales/es.json @@ -763,7 +763,7 @@ "update.missingRepos.rehydrateSuccess": "{count} repo(s) rastreado(s) rehidratado(s)", "update.missingRepos.rehydratePartial": "No se pudieron rehidratar {count} repo(s)", "updateDialog.copyCommand": "Copiar comando", - "updateDialog.needsSudo": "La actualización necesita tu contraseña. Ejecuta sudo skillshare upgrade en una terminal.", + "updateDialog.needsSudo": "La actualización necesita tu contraseña. Ejecuta skillshare upgrade en una terminal.", "updateDialog.newVersion": "Nueva versión disponible", "updateDialog.restartDev": "Reinicio en modo DEV simulado.", "updateDialog.restartManual": "Actualizado. Reinicia con skillshare ui start si esta página no se reconecta.", diff --git a/ui/src/i18n/locales/fa.json b/ui/src/i18n/locales/fa.json index c59686b5b..37e6228f8 100644 --- a/ui/src/i18n/locales/fa.json +++ b/ui/src/i18n/locales/fa.json @@ -763,7 +763,7 @@ "update.missingRepos.rehydrateSuccess": "{count} مخزن ردیابی‌شده مجدداً کلون شد", "update.missingRepos.rehydratePartial": "کلون مجدد {count} مخزن ناموفق بود", "updateDialog.copyCommand": "کپی دستور", - "updateDialog.needsSudo": "به‌روزرسانی به گذرواژهٔ شما نیاز دارد. در ترمینال sudo skillshare upgrade را اجرا کنید.", + "updateDialog.needsSudo": "به‌روزرسانی به گذرواژهٔ شما نیاز دارد. در ترمینال skillshare upgrade را اجرا کنید.", "updateDialog.newVersion": "نسخه جدید موجود است", "updateDialog.restartDev": "راه‌اندازی مجدد در حالت DEV شبیه‌سازی شد.", "updateDialog.restartManual": "به‌روزرسانی شد. اگر این صفحه دوباره وصل نشد، با skillshare ui start دوباره راه‌اندازی کنید.", diff --git a/ui/src/i18n/locales/fr.json b/ui/src/i18n/locales/fr.json index 5c9533f4d..d79ed9c3d 100644 --- a/ui/src/i18n/locales/fr.json +++ b/ui/src/i18n/locales/fr.json @@ -763,7 +763,7 @@ "update.missingRepos.rehydrateSuccess": "{count} dépôt(s) suivi(s) réhydraté(s)", "update.missingRepos.rehydratePartial": "Échec de la réhydratation de {count} dépôt(s)", "updateDialog.copyCommand": "Copier la commande", - "updateDialog.needsSudo": "La mise à jour nécessite votre mot de passe. Exécutez sudo skillshare upgrade dans un terminal.", + "updateDialog.needsSudo": "La mise à jour nécessite votre mot de passe. Exécutez skillshare upgrade dans un terminal.", "updateDialog.newVersion": "Nouvelle version disponible", "updateDialog.restartDev": "Redémarrage simulé en mode DEV.", "updateDialog.restartManual": "Mise à jour effectuée. Redémarrez avec skillshare ui start si cette page ne se reconnecte pas.", diff --git a/ui/src/i18n/locales/id.json b/ui/src/i18n/locales/id.json index ce5e03c14..e2e5a26a0 100644 --- a/ui/src/i18n/locales/id.json +++ b/ui/src/i18n/locales/id.json @@ -763,7 +763,7 @@ "update.missingRepos.rehydrateSuccess": "{count} repo terlacak berhasil di-rehydrate", "update.missingRepos.rehydratePartial": "{count} repo gagal di-rehydrate", "updateDialog.copyCommand": "Salin perintah", - "updateDialog.needsSudo": "Pembaruan memerlukan kata sandi Anda. Jalankan sudo skillshare upgrade di terminal.", + "updateDialog.needsSudo": "Pembaruan memerlukan kata sandi Anda. Jalankan skillshare upgrade di terminal.", "updateDialog.newVersion": "Versi baru tersedia", "updateDialog.restartDev": "Mulai ulang mode DEV disimulasikan.", "updateDialog.restartManual": "Diperbarui. Jalankan ulang dengan skillshare ui start jika halaman ini tidak tersambung kembali.", diff --git a/ui/src/i18n/locales/ja.json b/ui/src/i18n/locales/ja.json index be703ebe2..1b81c183b 100644 --- a/ui/src/i18n/locales/ja.json +++ b/ui/src/i18n/locales/ja.json @@ -763,7 +763,7 @@ "update.missingRepos.rehydrateSuccess": "{count} 件の tracked リポジトリを rehydrate しました", "update.missingRepos.rehydratePartial": "{count} 件のリポジトリの rehydrate に失敗しました", "updateDialog.copyCommand": "コマンドをコピー", - "updateDialog.needsSudo": "更新にはパスワードが必要です。ターミナルで sudo skillshare upgrade を実行してください。", + "updateDialog.needsSudo": "更新にはパスワードが必要です。ターミナルで skillshare upgrade を実行してください。", "updateDialog.newVersion": "新しいバージョンが利用可能です", "updateDialog.restartDev": "DEV モードの再起動をシミュレートしました。", "updateDialog.restartManual": "更新しました。このページが再接続しない場合は、skillshare ui start で再起動してください。", diff --git a/ui/src/i18n/locales/ko.json b/ui/src/i18n/locales/ko.json index 1498668cf..ead54ea4a 100644 --- a/ui/src/i18n/locales/ko.json +++ b/ui/src/i18n/locales/ko.json @@ -763,7 +763,7 @@ "update.missingRepos.rehydrateSuccess": "{count}개의 tracked 저장소를 rehydrate했습니다", "update.missingRepos.rehydratePartial": "{count}개의 저장소 rehydrate에 실패했습니다", "updateDialog.copyCommand": "명령 복사", - "updateDialog.needsSudo": "업데이트하려면 비밀번호가 필요합니다. 터미널에서 sudo skillshare upgrade 를 실행하세요.", + "updateDialog.needsSudo": "업데이트하려면 비밀번호가 필요합니다. 터미널에서 skillshare upgrade 를 실행하세요.", "updateDialog.newVersion": "새 버전 사용 가능", "updateDialog.restartDev": "DEV 모드 재시작을 시뮬레이션했습니다.", "updateDialog.restartManual": "업데이트되었습니다. 이 페이지가 다시 연결되지 않으면 skillshare ui start로 다시 시작하세요.", diff --git a/ui/src/i18n/locales/pt-BR.json b/ui/src/i18n/locales/pt-BR.json index 47fef5014..96838d9ef 100644 --- a/ui/src/i18n/locales/pt-BR.json +++ b/ui/src/i18n/locales/pt-BR.json @@ -763,7 +763,7 @@ "update.missingRepos.rehydrateSuccess": "{count} repositório(s) rastreado(s) reidratado(s)", "update.missingRepos.rehydratePartial": "Falha ao reidratar {count} repositório(s)", "updateDialog.copyCommand": "Copiar comando", - "updateDialog.needsSudo": "A atualização precisa da sua senha. Execute sudo skillshare upgrade em um terminal.", + "updateDialog.needsSudo": "A atualização precisa da sua senha. Execute skillshare upgrade em um terminal.", "updateDialog.newVersion": "Nova versão disponível", "updateDialog.restartDev": "Reinicialização em modo DEV simulada.", "updateDialog.restartManual": "Atualizado. Reinicie com skillshare ui start se esta página não reconectar.", diff --git a/ui/src/i18n/locales/zh-CN.json b/ui/src/i18n/locales/zh-CN.json index af9f1a5ce..a68476de9 100644 --- a/ui/src/i18n/locales/zh-CN.json +++ b/ui/src/i18n/locales/zh-CN.json @@ -763,7 +763,7 @@ "update.missingRepos.rehydrateSuccess": "已 rehydrate {count} 个 tracked repo", "update.missingRepos.rehydratePartial": "{count} 个 repo rehydrate 失败", "updateDialog.copyCommand": "复制命令", - "updateDialog.needsSudo": "更新需要输入密码,请在终端执行 sudo skillshare upgrade。", + "updateDialog.needsSudo": "更新需要输入密码,请在终端执行 skillshare upgrade。", "updateDialog.newVersion": "有新版本可用", "updateDialog.restartDev": "已模拟 DEV 模式重启。", "updateDialog.restartManual": "已更新。如果此页面没有重新连接,请执行 skillshare ui start 重启。", diff --git a/ui/src/i18n/locales/zh-TW.json b/ui/src/i18n/locales/zh-TW.json index d74c6f120..272f8fb6f 100644 --- a/ui/src/i18n/locales/zh-TW.json +++ b/ui/src/i18n/locales/zh-TW.json @@ -763,7 +763,7 @@ "update.missingRepos.rehydrateSuccess": "已 rehydrate {count} 個 tracked repo", "update.missingRepos.rehydratePartial": "{count} 個 repo rehydrate 失敗", "updateDialog.copyCommand": "複製指令", - "updateDialog.needsSudo": "更新需要輸入密碼,請在終端機執行 sudo skillshare upgrade。", + "updateDialog.needsSudo": "更新需要輸入密碼,請在終端機執行 skillshare upgrade。", "updateDialog.newVersion": "有新版本可用", "updateDialog.restartDev": "已模擬 DEV 模式重新啟動。", "updateDialog.restartManual": "已更新。如果此頁面沒有重新連線,請執行 skillshare ui start 重新啟動。", diff --git a/website/docs/reference/commands/upgrade.md b/website/docs/reference/commands/upgrade.md index 433606777..a5203818e 100644 --- a/website/docs/reference/commands/upgrade.md +++ b/website/docs/reference/commands/upgrade.md @@ -96,9 +96,9 @@ look like a hang. The Web UI assets below show the same. Downloading v0.21.4... 3.2 MB / 9.1 MB ``` -If the binary is in a protected directory (e.g., `/usr/local/bin`), skillshare automatically re-runs the upgrade with `sudo` — no manual prefix needed. +If the binary is in a protected directory (e.g., `/usr/local/bin`), skillshare asks `sudo` to replace only the binary — no manual prefix needed. The built-in skill, UI assets, and logs are still written as you, so don't run the whole upgrade with `sudo`: that leaves root-owned files in your skills source, and a later `git pull` fails with `Permission denied`. -When there is no terminal to ask for a password on (the dashboard's **Update now** button, CI), the upgrade stops right away and tells you to run `sudo skillshare upgrade` in a terminal instead of waiting for input. Cached `sudo` credentials and `NOPASSWD` setups still upgrade without a prompt. +When there is no terminal to ask for a password on (the dashboard's **Update now** button, CI), the upgrade stops right away and tells you to run `skillshare upgrade` in a terminal instead of waiting for input. Cached `sudo` credentials and `NOPASSWD` setups still upgrade without a prompt. ### Web UI Assets diff --git a/website/i18n/ja/docusaurus-plugin-content-docs/current/reference/commands/upgrade.md b/website/i18n/ja/docusaurus-plugin-content-docs/current/reference/commands/upgrade.md index e0943591c..60f94a92b 100644 --- a/website/i18n/ja/docusaurus-plugin-content-docs/current/reference/commands/upgrade.md +++ b/website/i18n/ja/docusaurus-plugin-content-docs/current/reference/commands/upgrade.md @@ -95,9 +95,9 @@ skillshare sync # すべての Target に配布 Downloading v0.21.4... 3.2 MB / 9.1 MB ``` -バイナリが保護されたディレクトリ(例: `/usr/local/bin`)にある場合、skillshare は `sudo` を使って自動的にアップグレードを再実行します — 手動でのプレフィックス指定は不要です。 +バイナリが保護されたディレクトリ(例: `/usr/local/bin`)にある場合、skillshare は `sudo` を使ってバイナリの置き換えだけを行います — 手動でのプレフィックス指定は不要です。組み込み skill、UI アセット、ログはあなたのユーザーとして書き込まれるため、アップグレード全体を `sudo` で実行しないでください。skill ソースに root 所有のファイルが残り、後の `git pull` が `Permission denied` で失敗します。 -パスワードを尋ねるための端末がない場合(Dashboard の **今すぐ更新** ボタン、CI など)、アップグレードは入力を待たずに即座に停止し、代わりにターミナルで `sudo skillshare upgrade` を実行するよう案内します。キャッシュされた `sudo` の認証情報や `NOPASSWD` 設定がある場合は、プロンプトなしでアップグレードが続行されます。 +パスワードを尋ねるための端末がない場合(Dashboard の **今すぐ更新** ボタン、CI など)、アップグレードは入力を待たずに即座に停止し、代わりにターミナルで `skillshare upgrade` を実行するよう案内します。キャッシュされた `sudo` の認証情報や `NOPASSWD` 設定がある場合は、プロンプトなしでアップグレードが続行されます。 ### Web UI アセット diff --git a/website/i18n/ko/docusaurus-plugin-content-docs/current/reference/commands/upgrade.md b/website/i18n/ko/docusaurus-plugin-content-docs/current/reference/commands/upgrade.md index cc0bd73dc..e821a0bd9 100644 --- a/website/i18n/ko/docusaurus-plugin-content-docs/current/reference/commands/upgrade.md +++ b/website/i18n/ko/docusaurus-plugin-content-docs/current/reference/commands/upgrade.md @@ -96,9 +96,9 @@ skillshare sync # 모든 target으로 배포 Downloading v0.21.4... 3.2 MB / 9.1 MB ``` -binary가 보호된 디렉터리(예: `/usr/local/bin`)에 있으면, skillshare는 별도의 접두사 없이 자동으로 `sudo`를 사용해 업그레이드를 재실행합니다. +binary가 보호된 디렉터리(예: `/usr/local/bin`)에 있으면, skillshare는 별도의 접두사 없이 `sudo`로 binary 교체만 수행합니다. 내장 skill, UI 에셋, 로그는 여전히 사용자 권한으로 기록되므로 업그레이드 전체를 `sudo`로 실행하지 마세요. skill 소스에 root 소유 파일이 남아 이후 `git pull`이 `Permission denied`로 실패합니다. -비밀번호를 입력할 터미널이 없는 경우(대시보드의 **지금 업데이트** 버튼, CI)에는 입력을 기다리지 않고 업그레이드가 즉시 중단되며, 터미널에서 `sudo skillshare upgrade`를 실행하라고 안내합니다. 캐시된 `sudo` 자격 증명이나 `NOPASSWD` 설정이 있으면 프롬프트 없이 업그레이드됩니다. +비밀번호를 입력할 터미널이 없는 경우(대시보드의 **지금 업데이트** 버튼, CI)에는 입력을 기다리지 않고 업그레이드가 즉시 중단되며, 터미널에서 `skillshare upgrade`를 실행하라고 안내합니다. 캐시된 `sudo` 자격 증명이나 `NOPASSWD` 설정이 있으면 프롬프트 없이 업그레이드됩니다. ### Web UI 에셋 diff --git a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/commands/upgrade.md b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/commands/upgrade.md index 7c8c68628..895e5ab4b 100644 --- a/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/commands/upgrade.md +++ b/website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/reference/commands/upgrade.md @@ -96,9 +96,9 @@ skillshare sync # 分发到所有 targets Downloading v0.21.4... 3.2 MB / 9.1 MB ``` -如果该二进制文件位于受保护的目录中(例如 `/usr/local/bin`),skillshare 会自动使用 `sudo` 重新执行升级——无需手动加前缀。 +如果该二进制文件位于受保护的目录中(例如 `/usr/local/bin`),skillshare 只会使用 `sudo` 替换二进制文件——无需手动加前缀。内置 skill、UI 资源和日志仍以你的身份写入,所以不要用 `sudo` 运行整个升级:这会在 skill 源目录留下 root 拥有的文件,之后 `git pull` 会出现 `Permission denied`。 -没有终端可以输入密码时(Dashboard 的 **立即更新** 按钮、CI),升级会立即停止,并提示你改在终端中运行 `sudo skillshare upgrade`,而不是一直等待输入。已缓存的 `sudo` 凭据和 `NOPASSWD` 配置仍会直接升级,不会出现提示。 +没有终端可以输入密码时(Dashboard 的 **立即更新** 按钮、CI),升级会立即停止,并提示你改在终端中运行 `skillshare upgrade`,而不是一直等待输入。已缓存的 `sudo` 凭据和 `NOPASSWD` 配置仍会直接升级,不会出现提示。 ### Web UI 资源 diff --git a/website/i18n/zh-Hant/docusaurus-plugin-content-docs/current/reference/commands/upgrade.md b/website/i18n/zh-Hant/docusaurus-plugin-content-docs/current/reference/commands/upgrade.md index a264e6f51..6137e2f3e 100644 --- a/website/i18n/zh-Hant/docusaurus-plugin-content-docs/current/reference/commands/upgrade.md +++ b/website/i18n/zh-Hant/docusaurus-plugin-content-docs/current/reference/commands/upgrade.md @@ -95,9 +95,9 @@ skillshare sync # 分發到所有 targets Downloading v0.21.4... 3.2 MB / 9.1 MB ``` -若執行檔位於受保護的目錄(例如 `/usr/local/bin`),skillshare 會自動以 `sudo` 重新執行升級 — 不需要手動加上前綴。 +若執行檔位於受保護的目錄(例如 `/usr/local/bin`),skillshare 只會用 `sudo` 替換執行檔 — 不需要手動加上前綴。內建 skill、UI 資源與紀錄仍以你的身分寫入,所以不要用 `sudo` 執行整個升級:這會在 skill 來源目錄留下 root 擁有的檔案,之後 `git pull` 會出現 `Permission denied`。 -沒有終端機可以輸入密碼時(Dashboard 的 **立即更新** 按鈕、CI),升級會立刻停止,並提示你改在終端機執行 `sudo skillshare upgrade`,不會一直等待輸入。已快取的 `sudo` 憑證與 `NOPASSWD` 設定仍會直接升級,不會出現提示。 +沒有終端機可以輸入密碼時(Dashboard 的 **立即更新** 按鈕、CI),升級會立刻停止,並提示你改在終端機執行 `skillshare upgrade`,不會一直等待輸入。已快取的 `sudo` 憑證與 `NOPASSWD` 設定仍會直接升級,不會出現提示。 ### Web UI 資源