3 Commits
Author SHA1 Message Date
yetone 599d784f59 library: magpie-image runs this computer's magpie, whatever path another computer or an old install saved (#1439, dawn1095)
magpie-image was kept in library.json with one computer's magpie by full
path (os.Executable at install). A WebDAV sync carried
C:\Users\...\Downloads\magpie-windows-amd64.exe to a Mac (and a Mac's app
to Windows), and a magpie moved out of Downloads left its old path behind:
the Library page said it couldn't start, and agents were given a program
that isn't there.

- heal (self_here.go): a server that is magpie's own -- `mcp ...` run by a
  program named magpie (magpie, magpie.exe, magpie-<os>-<arch>[.exe]) --
  whose program isn't an existing absolute path here is pointed at this
  magpie, as the library is read (load) and after every change (so a
  bundle Put from another computer is healed before it is written into
  the agents). Every agent writer, project MCP files, the WSL side and
  CheckServers read through load, so all of them get it. A magpie program
  that does exist here (another build) and any server run by another
  program are left as they are.
- Collect carries magpie's own server as plain "magpie": two computers
  with the same library carry the same bundle, so davsync's library hash
  matches and a sync doesn't write one's path over the other's.
- The path given is update.Program (exported cliProgram): the AppImage
  rather than its mount, Homebrew's opt link rather than the Cellar.
- TestWSLMagpieImage now says which magpie this (simulated Windows)
  computer runs.

Verified:
- New tests: TestOwnServerFromElsewhereRunsThisMagpie (Windows path read
  on macOS, a Mac path, an exe moved out of Downloads, a bare "magpie"),
  TestUsersOwnServerStaysAsItIs, TestCarriedOwnServerIsEachComputersMagpie.
  Broken by hand five ways (heal off; no heal in change; no marker in
  Collect; ownServer matching every server; existing magpie builds not
  kept) -- each went red with a FAIL naming the behaviour, green restored.
- gofmt -l clean; go vet -tags nogui ./...; GOOS=linux and GOOS=windows
  go vet (library, update, davsync); go build, GOOS=linux -tags nogui and
  GOOS=windows builds; go test -tags nogui ./... green in a sandbox HOME.
- Sandbox app (own HOME, ports 3561/3562) seeded with a library.json
  holding the reporter's Windows path for magpie-image plus a user's own
  missing Windows tool: on start library.json, Codex's config.toml and
  Claude Code's .claude.json got the running binary; /api/library/mcp/check
  answered magpie-image ok with 3 tools, the user's server unchanged and
  notfound.
Not verified: on the Windows box, or a real two-computer WebDAV sync.
2026-10-10 01:30:40 +08:00
yetone 90b1ac7956 update, gui: Add to PATH on Windows writes a magpie.cmd beside an app not named magpie.exe, so the site's magpie-windows-amd64.exe runs as magpie in a new terminal, and says so (#942, mintonight)
Add to PATH put the portable download's folder first in the user's PATH, but a terminal looks for magpie by that name only, so the command was never found. cliPlace now writes magpie.cmd beside a program not named magpie.exe: it runs %~dp0<the program's name> %*, which an update keeps, since it replaces the program where it is under its name. ReadCLI reads that magpie.cmd as this app (shimRuns), and the GUI says, in Add's tooltip, the row and the status, that magpie.cmd runs magpie-windows-amd64.exe. Going through cmd also makes PowerShell wait for the GUI-linked program and gives it the console. TestCLIShim and cli-path.test.cjs's new case fail without the change.
2026-10-06 02:18:07 +08:00
yetone d6daa40ce3 update, gui: Settings › About › Command line says what magpie runs in a new terminal and adds it (PAMI on Discord) — the app downloaded from the site, and every Windows one, left terminals without the magpie command, and nothing in the GUI said whether it was there. A Command line row now asks each shell installed (zsh, bash, fish and the login shell; PowerShell and cmd on Windows) for its PATH and says, with a dot each, whether its magpie runs this app, another copy (with that copy's version, read from its .app's Info.plist or Homebrew Cellar folder, never by running it), or none. Add to PATH links this app's program (Homebrew's opt link, the AppImage) into the folder on the default shell's PATH whose magpie runs first, else ~/.local/bin or the like when on PATH, replacing another copy there as install.sh's ln -sf does; on Windows it puts the app's folder first in HKCU\Environment Path and broadcasts WM_SETTINGCHANGE. A shell whose PATH lacks that folder gets its own button naming its profile (~/.zshrc, ~/.bash_profile on the Mac or ~/.bashrc, fish's config.fish), which links into ~/.local/bin and adds that folder with one marked line, once; no profile is written otherwise. A translocated or disk-image app is told to move first and gets no button. It says new terminals take the change (on Windows: new PowerShell/cmd windows, restart Windows Terminal). GET/POST /api/cli; en/zh/ja/de. TestCLIOnPath (temp HOME, stubbed shells: link, fish profile once, a shadowing copy replaced, no folder → zsh's profile kept and appended, an unknown shell refused, plist version, translocated refused) and TestPathFirst are new; cli-path.test.cjs (WebKit, en and zh: per-shell dots, Add posts {} and turns green, fish's button posts fish alone, Windows lists PowerShell and cmd, translocated gets no button, no scroll, no select, no left border, translations) fails without the change; cli-behind and update-auto pass. Not tried on a real Windows machine. go vet, go build (darwin, GOOS=linux nogui, GOOS=windows) and go test -tags nogui ./... under a temp HOME pass (TestOTelWholeWaterfallFallback and TestDevinSignedInOnlyInMagpie failed once each under load and pass alone). 2026-10-05 17:49:20 +08:00