lf update
Check whether a newer version of the LenserFight CLI is available and print the correct upgrade command for your package manager.
Usage
sh
lf updateOptions
| Flag | Type | Default | Description |
|---|---|---|---|
--check | boolean | false | Only check and report; do not print install commands |
--json | boolean | false | Output result as JSON |
Examples
sh
# Interactive — shows update banner and install command
lf update
# CI-friendly — exits 0 always, result in JSON
lf update --json
# Only verify you are up to date
lf update --checkHow it works
- Reads the installed version from the bundled
package.json. - Queries the npm registry (
registry.npmjs.org/@lenserfight/cli/latest) with a 5-second timeout. - Compares versions using semver. If the registry version is newer, it prints the appropriate update command.
- Caches the registry response in
~/.lenserfight/update-check.jsonfor 24 hours to avoid repeated network calls.
Update commands by package manager
The CLI detects your package manager automatically:
sh
# npm global install
npm install -g @lenserfight/cli@latest
# pnpm global install
pnpm add -g @lenserfight/cli@latest
# yarn global install
yarn global add @lenserfight/cli@latestRelease channels
| Channel | npm tag | Who should use it |
|---|---|---|
stable | latest | Production use; recommended for most users |
beta | beta | Pre-release feature testing |
rc | rc | Release candidates before stable |
nightly | nightly | Bleeding-edge; may contain regressions |
lf update always recommends the latest stable release. To install a pre-release channel:
sh
npm install -g @lenserfight/cli@beta
npm install -g @lenserfight/cli@rc
npm install -g @lenserfight/cli@nightlyBackground update hint
After every command, the CLI checks the cache and prints a one-line hint to stderr if a newer version is available:
╭─────────────────────────────────────────────────────╮
│ Update available: v0.10.0-alpha.2 → v0.11.0 │
│ Run `lf update` for upgrade instructions. │
╰─────────────────────────────────────────────────────╯The hint:
- Only appears when the cache already contains a newer version — it does not make a network call on every command.
- Writes to
stderr, neverstdout, so scripts and--jsonoutput are unaffected. - Is suppressed in
--localmode and whenLF_NO_UPDATE_CHECK=1.
Suppress update checks
sh
# Per-invocation
lf --local <command>
# Process-wide
LF_NO_UPDATE_CHECK=1 lf <command>Invalidate the cache
Delete the cache file to force an immediate check on the next command:
sh
rm ~/.lenserfight/update-check.jsonAfter updating
Run lf doctor to verify your environment is healthy:
sh
lf doctorJSON output schema
json
{
"current": "0.2.0",
"latest": "0.3.0",
"hasUpdate": true
}When the registry is unreachable:
json
{
"current": "0.2.0",
"latest": null,
"hasUpdate": false
}Security
- The CLI never executes shell commands on your behalf. It only prints the update command for you to run.
- Registry requests use HTTPS and a strict 5-second abort timeout.
- The cache file contains only version strings and a timestamp — no credentials, no personal data.
Related
lf doctor— validate environment health after upgradinglf whats-new— print recent changelog entrieslf status— show current auth and environment state
lf update
Check for CLI updates and print upgrade instructions.
| Flag | Type | Required | Description |
|---|---|---|---|
--check | boolean | no | Only check and print the result; do not print install commands |
--json | boolean | no | Output result as JSON |