Skip to content

self-update

The self-update command checks GitHub releases for a newer version of kasl and, if one exists, downloads it and replaces the running binary in place - keeping the previous one alongside it as kasl.bak.

Scoop, Homebrew and winget keep a record of the version they installed. Replacing their file behind their back would leave that record saying the old version is still there, so in an installation one of them owns self-update names the command that updates it and changes nothing:

ℹ️ kasl was installed with Scoop, which keeps its own record of what is installed - replacing the file behind its back would leave that record wrong.
Update it with: scoop update kasl

The manager is read from where the running kasl lives - Scoop’s apps\kasl, Homebrew’s Cellar/kasl, winget’s WinGet\Packages and WinGet\Links - so an installation of the installers, npm or cargo is updated as before.

Builds before 1.10 compared version numbers as text, so they rank a 1.10 release below a 1.9 one and report “No update required” - exactly at the release they need. Reinstall once with the installer (irm https://raw.githubusercontent.com/lacodda/kasl/main/tools/install.ps1 | iex on Windows, curl -fsSL https://raw.githubusercontent.com/lacodda/kasl/main/tools/install.sh | sh elsewhere), npm i -g kasl-cli or cargo install kasl-cli; from then on self-update compares numbers. The installer replaces the kasl already on your PATH, wherever it lives, and restarts the watcher; older installers put a second copy in their default directory instead, and running a current one cleans that up.

The release archive carries the plugins that come with kasl - GitLab’s - beside the binary, and self-update puts them beside it too, at the version that release was built with.

The update is carried out by the kasl that is running, so an install updated by kasl 1.19 or earlier received the new binary without them: the old updater took only itself from the archive. kasl plugin list says so, and the next kasl self-update completes the box - with no newer release to install, it takes this version’s plugins from this version’s archive and leaves the binary as it is:

ℹ️ No update required. You are using the latest version!
✅ Installed the plugins that ship with this version: kasl-plugin-gitlab
Terminal window
kasl self-update

The command takes no arguments.

  1. Version check: reads the latest release tag from the releases/latest redirect - not the api.github.com endpoint, which is rate-limited to 60 anonymous requests per hour per IP and starves any machine behind a shared NAT.
  2. Platform detection: picks the release asset matching the current OS/architecture.
  3. Download and extraction: retrieves the archive and unpacks the programs from it - kasl and the plugins that ship with it. Nothing else in the archive is written next to the executable.
  4. Replacement: the current executable is renamed to kasl.bak and the new one takes its place.
  5. Alias refresh: the short ka alias is updated too, where it is installed.

If the watcher is running, it is stopped before the swap and restarted afterward.

The release builds three targets, and self-update takes the archive of the one it runs on:

  • x86_64-pc-windows-msvc - Windows 64-bit
  • aarch64-apple-darwin - macOS Apple Silicon
  • x86_64-unknown-linux-gnu - Linux 64-bit

A kasl on any other target - an Intel Mac, Linux on arm64 - finds no archive of its own on the release page; it got there by cargo install kasl-cli, and that is what updates it.

There is exactly one backup, kasl.bak, sitting next to the binary. Each update overwrites it, so it always holds the version you were running immediately before the most recent update - never anything older. Restoring it is a manual copy over the current binary; nothing reverts automatically.

Where the short alias is installed, self-update replaces it along with the main binary, so ka never answers to an older version than kasl. An update never adds the alias to an installation that does not have it - skipping it at install time (KASL_NO_ALIAS=1) stays skipped.

On macOS and Linux the installer makes ka a symlink to kasl, so it follows every update for free.

The download and binary swap print nothing; only the result line does:

ℹ️ No update required. You are using the latest version!

or, when a newer release was installed:

✅ The kasl application has been successfully updated to version X.Y.Z!

X.Y.Z is the version that was just installed - the message always names the actual new version, not a fixed number.

If the watcher was running, two extra lines bracket the result:

ℹ️ Stopping watcher for update...
ℹ️ Restarting watcher after update...

Other commands print a similar notice when they notice a newer release is available:

A new version of kasl is available: vX.Y.Z
Upgrade now by running: kasl self-update

In an installation a package manager owns, the second line names its command instead - scoop update kasl, brew upgrade kasl.

  • autostart - autostart settings are preserved during updates
  • setup - configuration is maintained during updates
  • watch - monitoring continues after a successful update