Skip to main content

Module update

Module update 

Source
Expand description

Install-aware startup update checks for mj.

Mjolnir reaches users through several channels — the curl release installer, the npm package, the Homebrew tap, and crates.io — and each channel publishes its “latest” somewhere else. This module decides how the running binary was installed, asks that channel whether a newer release exists, and (in check_prompt_and_apply) asks the user before changing anything. npm and Homebrew upgrades delegate to the package manager; curl installs self-replace; cargo and npx installs only print the command, because a live cargo install rebuild or a nested npx run is not something to start from inside mj.

Enums§

InstallMethod
How the running mj binary was installed. Decides both where the latest version is published and who is allowed to replace the binary: package managers own their trees, so upgrades there run the manager’s own command, while a curl install may only be replaced in place.
StartupUpdateOutcome
What the startup check decided. A successful upgrade never produces a value: the process re-execs into the new binary.

Functions§

check_prompt_and_apply
Checks the running install’s channel for a newer release, asks before changing anything, and on consent performs the upgrade: