lf update
Check whether a newer version of the LenserFight CLI is available and print the correct upgrade command for your package manager.
Usage
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
# 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:
# 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@latest"Cannot update in place" — permission errors
lf update checks that the install directory is writable before running your package manager. When it is not, the update stops with the blocked directory named, rather than letting npm fail with a wall of EACCES output:
ERROR Cannot update in place — the install directory is not writable by your account.
install dir /opt/homebrew/lib/node_modules/@lenserfight
owned by uid 501
you are uid 504This happens when the CLI was installed by a different account than the one running it — common on a shared machine, or under a Homebrew-managed prefix owned by whoever installed Homebrew. Re-running the install, with or without sudo, does not fix the underlying ownership.
Three ways out, in rough order of preference:
# 1. Run the update from the account that owns the install.
# 2. Take ownership of just this package, then re-run `lf update`.
sudo chown -R "$(id -un)" /opt/homebrew/lib/node_modules/@lenserfight
# 3. Move to a per-user global prefix, so updates never need elevation.
npm config set prefix ~/.npm-global
npm install -g @lenserfight/cli@latest
# then put ~/.npm-global/bin ahead of the old prefix on your PATHsudo npm install -g also works, but under a Homebrew-managed prefix it leaves root-owned files behind that can break later brew commands.
Release 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:
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
# 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:
rm ~/.lenserfight/update-check.jsonAfter updating
Run lf doctor to verify your environment is healthy:
lf doctorJSON output schema
{
"current": "0.2.0",
"latest": "0.3.0",
"hasUpdate": true
}When the registry is unreachable:
{
"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 |