* plugin: a mover installs the version its user pinned, not @latest
plugin.Add installs the spec it is given and appends @latest to a bare
package name, so installPlugin — the mover's installer, for
keepMovedCurrent, Move and HandOver — handing it a bare name quietly
replaced <pkg>@1.2.3 with <pkg>@latest in plugins.json. The pin was the
user's choice, and it was destroyed behind their back every time the
mover's min was raised.
installPlugin now hands Add the entry's own spec when the user has one.
A pin older than the move needs is left pinned and reported by the check
that was already there below it ("%s %s is installed; moving needs %s
or newer"), whose remedy is to unpin it; a pin that satisfies min still
returns early and is not reinstalled. A user with no entry for the
package keeps the bare name, which is a first install and there is no
pin to keep. A plugin the user turned off is still refused before any of
this, as it was.
TestInstallPluginKeepsTheUsersPin pins fake@0.1.5 with the move needing
0.2.0 and writes the version plugin.Version reads into the plugins folder
it is read from. It asks Add for fake@0.1.5 — against installPlugin as it
handed over the bare name it fails with "asked Add for [fake], want the
pinned fake@0.1.5" — and gets "needs 0.2.0 or newer" back rather than a
silent install of @latest. It also checks that a plugin the user turned
off is refused and not asked for at all. addPlugin is a var beside
pluginProviders and removePlugin so the test can read the spec handed
over without the Bun that Add runs.
Rebased on main as of 1b8cb53e. Note that main's installPlugin has since
learned to route an unpinned npm entry through plugin.Upgrade (for bun's
minimumReleaseAge, 4b56c867); this branch keeps the user's own spec for
an entry that exists, which is what a pin needs, and leaves the bare
name — the Upgrade route — to a first install.
Verified: go test ./internal/provider (2.9s, TestReleasePlugin and
TestMovedSignInAsBuiltIn skip: no bun on PATH); go vet on windows/amd64,
darwin/arm64 and linux/amd64 (-tags nogui) for both packages; gofmt -l
on an LF-normalized copy of the tree. No live plugin was installed and no
npm registry was reached.
* plugin: a plugin the user turned off stays off through every install path
add rebuilds an existing entry as Entry{Spec: spec} and keeps only its
options, so Off was lost: a plugin the user turned off came back on with
the next Add, Update, Update all or Upgrade, each of which goes through
add for an npm package. add now keeps Off too, as it keeps Options.
The fake bun the git plugin's test has the test binary stand in with
learned an npm spec (node_modules/<name> at the version the spec names,
with a file to load), so the tests really wrote plugins.json through add.
TestAddKeepsAnOffPluginOff, TestUpdateKeepsAnOffPluginOff and
TestUpgradeKeepsAnOffPluginOff each fail without the change — "after
Upgrade: [{Spec:... Off:false}], want the plugin still off" — and pass
with it. bunCommand is stubbed rather than $MAGPIE_BUN set, as the git
plugin's test does it: the env a test sets reaches the package's other
tests only through what they read, and $MAGPIE_BUN set here made
TestLoadConcurrentWithSavesAndEdits' Add run this binary too.
docs/subsystems/provider-plugins.md says which path does what: Update and
Update all install npm's newest and unpin a pin (ba0e2a8a), while
keepMovedCurrent installs the spec the user already chose.
Verified: go test ./internal/plugin (1.9s for the new tests; the full
package passes, with TestLoadConcurrentWithSavesAndEdits flaky on
Windows on main too — its rename of plugins.json loses to "Access is
denied" now and then, seen on a clean main checkout) and
./internal/provider (2.9s, TestReleasePlugin and TestMovedSignInAsBuiltIn
skip: no bun on PATH); go vet on windows/amd64, darwin/arm64 and
linux/amd64 (-tags nogui) for both packages; gofmt -l on an
LF-normalized copy of the tree.
* provider: a move leaves a pin, and an unpinned plugin still goes to npm's newest
installPlugin handed Add the entry's own spec, so an unpinned plugin
(pkg@latest) below a mover's min went to bun's @latest instead of
plugin.Upgrade. Under a bunfig minimumReleaseAge that silently installs an
older version and the move stays stuck: the sweanng424 fix (4b56c8672)
undone. Now:
- a pinned npm version below min is not reinstalled; the move says it is
pinned and which version it needs (the pin is the user's own choice);
- an unpinned npm entry goes through Upgrade, as on main;
- a git entry is reinstalled from its own spec, not swapped for npm's.
The docs paragraph now says the same.
Run: go test -tags nogui -run TestInstallPlugin ./internal/provider (green);
with the Upgrade branch disabled it goes red on the unpinned case, and with
the Pinned check removed it goes red on the pinned case.
---------
Co-authored-by: TryWorld <TryWorld2026@users.noreply.github.com>
Co-authored-by: yetone <yetoneful@gmail.com>
ARNO installed opencode-codearts-auth as github:yuweihao17/codearts. Its row
on Plugins always had an Update button, and still did right after updating
it to the newest commit. The page drew Update for every git plugin whatever
its commit, since npm has no version to compare for one, and nothing asked
the repository. ba0e2a8a fixed the same complaint for pinned npm plugins
only.
A git plugin is now compared by commit:
- internal/plugin/gitrev.go reads the commit Bun installed: the package's
.bun-tag (owner-repo-<sha7> for GitHub's, the full sha for a clone),
else bun.lock's "#<sha>". It asks where the spec's branch or tag (the
default branch without #ref) is now: GitHub's API (commits?per_page=1
[&sha=ref]) for github:o/r, o/r, https://github.com/o/r and
git+https/git+ssh/git:// URLs on github.com; git ls-remote for gitlab:,
bitbucket: and any other git URL (an annotated tag's commit, not the
tag's). A spec pinned to a commit is that commit, asked of nobody.
Answers are kept 10 minutes (GitHub allows 60 unauthenticated requests
an hour).
- updates.go: the hourly CheckUpdates and the Check for updates button
(CheckNow) report a git plugin as current or update, with its commit
and the repository's head, in place of the old "git" status. A waiting
git update is dropped once the installed commit is the head.
- GUI: /api/plugins/git gives the heads, asked after load and after an
install or update. The row shows the commit installed. Update, the
"New commits" chip, the Discover card's Update and Update all show only
when the repository is at another commit. Five new strings are in zh,
zh-TW, ja and de.
- Docs: the Updates list in site/public/docs (en, zh, ja) says how a git
plugin's update is told.
Tarball specs are unaffected, since magpie plugin add refuses them as not
a package name.
Run:
- go test -tags nogui ./internal/plugin ./internal/gui (temp HOME): ok.
- New TestGitPluginUpdateOnlyWhenItsRepositoryMoved, for
github:yuweihao17/codearts, its #main form, owner/repo, the
https://github.com URL, git+file and git+file#main, against a fake
GitHub API and bare repositories. After add, nothing waits. A new
commit at the same version is an update. After Upgrade, nothing waits
again.
- TestGitCommitAsBunWritesIt uses ARNO's literal bun.lock line and
.bun-tag. TestGitSource covers spec parsing and the pinned-sha form.
- Broke GitBehind by hand (any installed commit is behind): the new test
goes red in every form. Restored.
- GUI: plugin-git.test.cjs now checks no Update at the head, then New
commits with Update and Update all once the head moves, then none after
Update. It went red with the old condition put back. All 28 plugin-*
files plus click-scroll, i18n-keys, gui-ja and gui-de pass in Chromium
and WebKit.
- Real case, sandbox HOME, magpie web on a spare port: magpie plugin add
github:yuweihao17/codearts installed c594984. /api/plugins/git and
/api/plugins/check say current at c594984 against the real GitHub, and
nothing is waiting. In both engines the row shows "v0.1.0 c594984" with
no Update and no Update all.
- gofmt -l clean; go vet -tags nogui darwin, GOOS=linux and GOOS=windows
on internal/plugin and internal/gui.