npm 12 runs a package's install script only when told to
(--allow-scripts=<pkg>), and bun (--trust) and pnpm 10 (--allow-build)
do the same. A package whose postinstall puts its binary in place then
installs a stub: @opencode/cli 2.2.5 from npm 12.2.2 or bun 1.4.2 without
the flag prints "@opencode/cli's postinstall script was not run" and
exits 1 (mote, sandbox HOME). OpenCode's own v2 updater passes the same
flags.
cliSpec.scripts marks the agents whose npm package has an install
script: `npm view <pkg> scripts` on 2026-11-05 named one for claude,
cline, crush, deveco, mothx, omo, opencode and snow, and none for the
rest. Their install command, their npm/bun/pnpm update and the mend
hint now carry the manager's flag. npm 10 and 11 run scripts anyway and
take --allow-scripts as an unknown config.
Run (mote): gofmt -l, go vet ./internal/agent, go test ./internal/agent
-run 'Install|UpdateCLI|HowInstalled|Mend|Npm|Bun|Pnpm|Shim|Scripts|CLI|
OpenCode|Air' ok, and GOOS=linux/windows go vet ok. Real: on mote, npm
10.9.4, 11.21.2 and 12.2.2 with --allow-scripts=@opencode/cli each gave
a working opencode v2.2.5; npm 12 without it and bun without --trust the
stub; bun with --trust a working one.
Broken by hand: withScripts never adding the flag turns
TestInstallLetsScriptsRun, TestUpdateLetsScriptsRun and
TestUpdateCLIChecksItRuns red.
Not tried: pnpm and yarn for real (mote has neither), the other seven
agents' packages on npm 12.