clarinet icon indicating copy to clipboard operation
clarinet copied to clipboard

Notify users when new minor versions of clarinet are available

Open lgalabru opened this issue 3 years ago • 8 comments

lgalabru avatar Jan 18 '22 15:01 lgalabru

Good idea. The GitHub API could be useful for implementing that - https://docs.github.com/en/rest/reference/releases#get-the-latest-release

obycode avatar Jan 19 '22 13:01 obycode

Hello @lgalabru and @obycode! Reviving this topic...

It seems that GitHub API needs a token to call the latest release endpoint. How that would be handled by clarinet? I mean, an authentication token will be need and the token information will be publicly available.

Probably there is something more secure to base this feature on (call to a private service, call to package managers, etc). Any idea on that? What you think?

Cheers!

csgui avatar Dec 26 '22 12:12 csgui

hey @csgui! handling an API token in Clarinet could be a bit tedious. How about relying on Brew's API? https://formulae.brew.sh/api/formula/clarinet.json should do the work?

lgalabru avatar Dec 26 '22 15:12 lgalabru

Yep @lgalabru ! Homebrew seems a reliable source of data for the need here.

We can extract the latest released version from the map below:

"versions": {
    "stable": "1.3.0",
    "head": "HEAD",
    "bottle": true
}

If this task is aligned with clarinet priorities, I can be responsible to implement that. :-)

csgui avatar Dec 26 '22 15:12 csgui

nice, that'd be helpful if we want to avoid version fragmentation + helping developers running the latest version. There could be a relationship / dependency with this feature https://github.com/hirosystems/clarinet/issues/439, where we want to write some settings on disk (ideally respecting platform conventions so .settings/clarinet.json for linux, Library/Application Data/clarinet for macos, not sure for windows). We could start with a schema as simple as:

{
   "update_check_enabled": true,
   "last_update_check": 1672070945
}

Hitting the brew API for every single command would be pretty annoying for developers and brew, and this preference file would be very useful for future features.

lgalabru avatar Dec 26 '22 16:12 lgalabru

Probably also related with #205 where a TOML config file was discussed. What you think?

csgui avatar Dec 26 '22 16:12 csgui

yes we could definitely go with a toml, no strong opinion on my end!

lgalabru avatar Dec 26 '22 16:12 lgalabru

I noticed today that gh had a nice friendly way of doing this. I ran a command and after the output, it said:

A new release of gh is available: 2.29.0 → 2.30.0
To upgrade, run: brew upgrade gh
https://github.com/cli/cli/releases/tag/v2.30.0

Their implementation is in Go, but the process they used could be informative.

obycode avatar Jun 01 '23 20:06 obycode