Skip to content

chore: check for updates#48

Merged
notnmeyer merged 2 commits into
mainfrom
chore/check-for-updates
Apr 7, 2026
Merged

chore: check for updates#48
notnmeyer merged 2 commits into
mainfrom
chore/check-for-updates

Conversation

@notnmeyer

@notnmeyer notnmeyer commented Apr 7, 2026

Copy link
Copy Markdown
Member

adds an update check. we check once every 24 hours and cache the result in the config directory,

➜ cat ~/Library/Application\ Support/loops/update-check.json
{"latest_version":"0.0.2","checked_at":"2026-04-07T11:29:47.392033-07:00"}⏎

each time the cli is run:

  1. check update-check.json and trigger a refresh (in a goroutine) if its missing or its been more than 24 hours.
  2. if latest_version is > the currently installed version, it will add a message to the output (on stderr),
➜ dist/loops version
loops 0.0.1 (commit: none)

A new version of loops is available: v0.0.1 → v0.0.2
Run this to update:

  curl -fsSL --proto '=https' --tlsv1.2 https://cli.loops.so | bash -s -- latest /path/to/the/existing/bin

we skip the update check when the shell completion command is run or when its a dev build,

➜ task -- version
loops dev (commit: none)

this makes testing it in dev a littttttle bit of extra work, but the gist is that you must set a semver version. something like,

go build -ldflags "-X github.com/loops-so/cli/cmd.version=0.0.1" -o dist/loops .

additionally, --debug will show details about the check,

 ➜ dist/loops version --debug
loops 0.0.1 (commit: none)
[debug] update check: no cache (open /Users/nate/Library/Application Support/loops/update-check.json: no such file or directory)
[debug] update check: fetching latest release in background

➜ dist/loops version --debug
loops 0.0.1 (commit: none)
[debug] update check: cached latest=0.0.2 age=3s

A new version of loops is available: v0.0.1 → v0.0.2
Run this to update:

  curl -fsSL --proto '=https' --tlsv1.2 https://cli.loops.so | bash

lastly, we check the path of the binary customize the suggested command. i dont have a good way to demonstrate that with the homebrew installation at the moment, but take a look around here.

@notnmeyer notnmeyer self-assigned this Apr 7, 2026
@notnmeyer notnmeyer requested a review from nalanj April 7, 2026 19:12
@notnmeyer notnmeyer merged commit 1e9a2de into main Apr 7, 2026
2 checks passed
@notnmeyer notnmeyer deleted the chore/check-for-updates branch April 7, 2026 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants