English
updateNotifierPlugin
Built directly into clerc with zero third-party dependencies. Checks the npm registry concurrently in the background while the command runs, caches results on disk ($XDG_CACHE_HOME/clerc-update-notifier), and renders a ctx.log.box.warn banner after execution finishes without slowing down fast commands.
Usage
ts
import { clerc, updateNotifierPlugin } from "clerc";
const cli = clerc({
name: "acme-cli",
version: "2.0.0",
}).use(
updateNotifierPlugin({
// All options are optional - defaults to ctx.meta.name & ctx.meta.version
checkIntervalMs: 1000 * 60 * 60 * 24, // 24h
postRunGraceMs: 250,
}),
);warn ╭─ Update available: 2.0.0 → 2.1.0 ───╮
│ Run npm i -g acme-cli to update │
╰─────────────────────────────────────╯Smart Defaults
- Automatically skipped in CI (
CIenv set), whenNO_UPDATE_NOTIFIERis set, or when!ctx.terminal.isTTY. - Runs with
{ enforce: "pre" }: starts thefetchas early as possible and prints the banner after all other middlewares finish. - Unref'd
postRunGraceMstimer (default250ms) guarantees slow networks never hang a completed CLI command.

