Jevik_AI on X uninstalled magpie and rebooted, and Codex's config.toml still had openai_base_url = "http://127.0.0.1:3425/backend-api/codex"; Rk1ngggg asked whether an update cleans it. magpie's own uninstall (Settings › About › Uninstall magpie, `magpie uninstall`) already disconnects every agent and takes Codex's leftovers (#3866), but on Windows magpie wasn't in Settings › Apps › Installed apps, so it was removed the way Windows offers for a program it doesn't list: by deleting the exe and folders, which runs no code. shortcut.Ensure now writes HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\magpie (DisplayName, DisplayIcon, Publisher, InstallLocation, UninstallString, URLInfoAbout, NoModify, NoRepair) at every installed start, beside App Paths, and Remove (uninstall's System step) takes it out the same way: only while it names this exe, or an exe that is gone. Its Uninstall runs `magpie.exe uninstall --window` (shortcut.UninstallArgs). magpie.exe has no console, where the terminal's `magpie uninstall` would refuse for want of one to ask on, so those exact args open the app's window (or forward to the running app, OnSecondInstanceLaunch) on Settings › About with Uninstall magpie's question asked (uninstallView, ?uninstall=1). It asks once: a redraw of Settings doesn't ask again, and Cancel removes nothing. magpie web opened at that link asks nothing. Deleting the app by hand still runs no code (macOS drag-to-Trash included); agent-wiring.md says so. Run on mote at the pushed head (rebased ontobe9dbce02): - gofmt -l clean; go vet ./..., GOOS=linux go vet -tags nogui ./..., GOOS=windows go vet ./...: ok. go build, GOOS=linux go build -tags nogui, GOOS=windows go build: ok. - go test -tags nogui ./internal/gui ./internal/cli ./internal/shortcut ./internal/uninstall: ok (TestCoreScriptBudget included). - uninstall-settings.test.cjs and i18n-keys.test.cjs: 40 of 40 (chromium and webkit; the new Installed-apps cases in en and zh at 1100 and 420). At d3f40bedd, the same change onc7ebb6f8d, under suite.lock: - go test -tags nogui -timeout 45m ./...: ok, every package. - The whole GUI suite (--test-concurrency=4): 22518 of 22800; the 282 reds are in 53 files the change doesn't reach (model-chip-steady 40, usage-agents-hide 22, zero-priced-free 20, provider-fetch-again 14, ...), the full-suite reds of #5475; the numbers are on that issue. Their run atc7ebb6f8dalone is queued behind other sessions' suites. - The first full run found the core scripts 147 bytes over TestCoreScriptBudget; the page's part was cut to one line (the budget is not raised). On xiaomi-gpu (win-run): go test ./internal/shortcut, incl. TestInstalledAppsEntry on the real HKCU registry under a test key: ok. Broken by hand, each red: - registerAppPath not calling registerUninstall: TestInstalledAppsEntry (UninstallString = "") on Windows. - main.go not taking UninstallArgs to the window: TestInstalledAppsUninstallOpensTheWindow (unknown "--window"). - app.js not asking on ?uninstall=1: 4 of 4 Installed-apps GUI cases. - app.js asking without its once guard (params.delete): the same 4 ("asked again"). Not tried: a real Settings › Apps › Uninstall click on Windows with an installed magpie (the test box's install belongs to other sessions); the second-instance forward (OnSecondInstanceLaunch) has no test of its own.
70 lines
2.0 KiB
Go
70 lines
2.0 KiB
Go
//go:build !nogui
|
||
|
||
package cli
|
||
|
||
import (
|
||
"log"
|
||
|
||
"github.com/yetone/magpie/internal/applog"
|
||
"github.com/yetone/magpie/internal/gui"
|
||
"github.com/yetone/magpie/internal/proc"
|
||
)
|
||
|
||
const hasGUI = true
|
||
|
||
// runGUI starts the desktop app, writing its log to a file (startLog).
|
||
func runGUI(showMain bool, link string) error {
|
||
startLog("app")
|
||
return openApp(showMain, link)
|
||
}
|
||
|
||
// openApp starts the desktop app; a var so a test can stand in for it.
|
||
// The app may have been opened from the Finder, with none of the PATH a
|
||
// terminal has.
|
||
var openApp = func(showMain bool, link string) error {
|
||
proc.UserPath()
|
||
gui.Started = ownSignals // once Wails handles them: it quits through OnShutdown
|
||
return gui.Run(version, showMain, link)
|
||
}
|
||
|
||
// runWindow starts the app with its window open on view ("" for the first
|
||
// tab).
|
||
func runWindow(view string) error {
|
||
gui.OpenView = view
|
||
return runGUI(true, "")
|
||
}
|
||
|
||
// runUninstallWindow starts the app with its window on Settings ›
|
||
// Uninstall magpie, asking, or brings the running one's there: what
|
||
// Windows' Installed apps runs for magpie's Uninstall.
|
||
func runUninstallWindow() error {
|
||
gui.OpenUninstall = true
|
||
return runGUI(true, "")
|
||
}
|
||
|
||
// runPanel starts the app with its quick panel open, or toggles the panel
|
||
// of the one already running.
|
||
func runPanel() error {
|
||
startLog("panel")
|
||
return openPanel()
|
||
}
|
||
|
||
// openPanel starts the app with its panel open; a var so a test can stand
|
||
// in for it.
|
||
var openPanel = func() error {
|
||
proc.UserPath()
|
||
gui.OpenPanel = true
|
||
gui.Started = ownSignals // once Wails handles them: it quits through OnShutdown
|
||
return gui.Run(version, false, "")
|
||
}
|
||
|
||
// startLog has the app write its log to a file as well as stderr
|
||
// (applog): opened from the Finder, the Dock or the Start menu it has no
|
||
// terminal, and what it logged went nowhere (rayem1w on X). A var so a
|
||
// test can tell runGUI starts it without starting the app.
|
||
var startLog = func(how string) {
|
||
if _, err := applog.Start(version, how); err != nil {
|
||
log.Println("log:", err)
|
||
}
|
||
}
|