cli icon indicating copy to clipboard operation
cli copied to clipboard

[BUG] No info on availability of new version of cli to user.

Open neoandmatrix opened this issue 11 months ago • 15 comments

Describe the bug.

Whenever a new version is released of the cli and if after that user runs a command then a info should be given that a new version of the cli is available. It is already implemented here but appears to be not working as can be seen from below screenshots.

Expected behavior

An info should be shown with new available version and current version once every day of running any commands.

Screenshots

Image

Image

As evident form above screenshots i am using an older version and info should be displayed that a new version is available but no info is shown.

How to Reproduce

  1. Install any older version of cli.
  2. Run any command.
  3. No info is displayed that a new version is available even tough it is.

🥦 Browser

None

👀 Have you checked for similar open issues?

  • [x] I checked and didn't find similar issue

🏢 Have you read the Contributing Guidelines?

Are you willing to work on this issue ?

Yes I am willing to submit a PR!

neoandmatrix avatar Feb 20 '25 07:02 neoandmatrix

Hey @AayushSaini101 any update on this issue? If verified and relevant would like to work on this.

In my opinion this can be due to the missing registry parameter in the plugin configuration as mentioned here in the warn-if-update-available docs https://github.com/oclif/plugin-warn-if-update-available?tab=readme-ov-file#configuration.

Would really appreciate your thoughts on this.

Thanks.

neoandmatrix avatar Mar 04 '25 14:03 neoandmatrix

@neoandmatrix I doubt its anything to do with the registry field as it states that if nothing is specified it defaults to the package name specified in the package.json

You can confirm this by setting the frequency to something like 10 seconds,

Image

Some npm scripts do trigger the warning but this warning never appears while you are running any command, and with a lower frequency it doesn't appear at all even with the scripts (one would expect that even with a lower frequency at least one warning should appear at beginning and then none would appear for the duration of the specified frequency)

pseudo-tensor avatar Mar 05 '25 13:03 pseudo-tensor

Thanks @pseudo-tensor for clarification. So i if am understanding your last point that is this

(one would expect that even with a lower frequency at least one warning should appear at beginning and then none would appear for the duration of the specified frequency)

then at least a waring should appear after 24 hours that is specified in the current configuration , right?

Moreover form what i can understand from reading the https://github.com/oclif/plugin-warn-if-update-available?tab=readme-ov-file#how-it-works especially

the downside is that it will only display after running a command that fetches the new version.

Once a command is ran that uses some script to fetch new version then only it will be displayed after every 24 hours on every command as mentioned in https://github.com/oclif/plugin-warn-if-update-available?tab=readme-ov-file#notification-frequency

Once a new version has been found, the default behavior is to notify the user on every command execution.

Please correct if i am getting something wrong regarding this. Then can confirm form maintainers that if this is the desired behavior or something can be changed.

Thanks.

neoandmatrix avatar Mar 05 '25 14:03 neoandmatrix

Hey @AayushSaini101 can you please have a look at this and confirm that this is the intended behaviour for the updates to show as mentioned in the previous comment above or some changes can be made to make it more informative like instead of depending on a command that will fetch a new version and then warning will be shown, we can do it to show on every command at some fixed interval like currently 24 hours as sometimes these changes can contain important patches or fixes also.

Thanks.

neoandmatrix avatar Mar 06 '25 04:03 neoandmatrix

Hey @Souvikns can you once have a look at this and confirm that this is the intented behaviour or not?

CC :- @AayushSaini101 @Shurtu-gal

neoandmatrix avatar May 25 '25 11:05 neoandmatrix

@neoandmatrix yeah looks like the plugin setting that we have might be the problem,

"plugins": [
      "@oclif/plugin-warn-if-update-available",
      "@oclif/plugin-autocomplete"
    ],
    "warn-if-update-available": {
      "frequency": 24,
      "message": "\n<%= chalk.yellow('╭────────────────────────────────────────────────────────────────╮') %>\n<%= chalk.yellow('│                                                                │') %>\n<%= chalk.yellow('│') %>               Update available! <%= chalk.red(config.version) %> → <%= chalk.greenBright(latest) %>.                 <%= chalk.yellow('│') %>\n<%= chalk.yellow('│') %> <%= chalk.magentaBright('Changelog:') %> https://github.com/asyncapi/cli/releases/tag/v<%= latest %> <%= chalk.yellow('│') %>\n<%= chalk.yellow('│') %>      Run \"<%= chalk.magentaBright('npm install -g @asyncapi/cli@latest') %>\" to update.      <%= chalk.yellow('│') %>\n<%= chalk.yellow('│') %>                                                                <%= chalk.yellow('│') %>\n<%= chalk.yellow('╰────────────────────────────────────────────────────────────────╯') %>",
      "frequencyUnit": "hours"
    }
  },

Maybe tweaking the settings might give us a solution here. @neoandmatrix you wanna open a PR for this.

Souvikns avatar May 31 '25 05:05 Souvikns

Sure @Souvikns , will try and see what changes can fix this.

neoandmatrix avatar May 31 '25 05:05 neoandmatrix

Hey @Souvikns made some changes to plugin config

Image

Added timeoutInDays parameter as mentioned here to change the checking frequency to every one day as cli is frequently updated.

Now i tried to test this for which i also changed the notification duration to 10 seconds which if i am correctly understanding from their docs should notify user on every command execution if that is executed in interval of 10 seconds.

While trying to test this i can see this working if i run tests as seen below

Image

but if i try it to test from local build using bin/run bundle command i am not getting the update warning.

Also one caution that they have mentioned in their docs is

the downside is that it will only display after running a command that fetches the new version.

means we will get a notification only if some command is ran that fetches a new version . To understand this i looked up how they are using this plugin which results in this warning

Image

when any oclif commands are used and found its usage here as and then looked at the https://github.com/oclif/oclif/blob/main/src/commands/manifest.ts to see if the oclif manifest is doing anything related that makes it to fetch new version but as much i understood i found nothing like so.

I believe that plugin doesn't work when using development environment as in their docs for this they mention

It then saves a version file to the cache directory that will enable the warning.

but during local testing this is not present i believe hence no warnings. Only the confusing part is why the warnings appear during tests which are ran locally.

WDYT if i am missing something let me know can test further.

neoandmatrix avatar Jun 01 '25 07:06 neoandmatrix

I believe test somewhere might be setting up prod env. Is there no info on new version for packaged releases as well?

Shurtu-gal avatar Jun 03 '25 09:06 Shurtu-gal

I believe test somewhere might be setting up prod env. Is there no info on new version for packaged releases as well?

Currently as far as i have used during these last 4 months never got any warnings or notification to update when installed via the npm.

neoandmatrix avatar Jun 03 '25 09:06 neoandmatrix

I believe test somewhere might be setting up prod env. Is there no info on new version for packaged releases as well?

Currently as far as i have used during these last 4 months never got any warnings or notification to update when installed via the npm.

@neoandmatrix could you check any other approach to resolve this thanks.

AayushSaini101 avatar Jun 03 '25 10:06 AayushSaini101

@neoandmatrix could you check any other approach to resolve this thanks.

Yes will try to debug more. Thanks

neoandmatrix avatar Jun 03 '25 10:06 neoandmatrix

This issue has been automatically marked as stale because it has not had recent activity :sleeping:

It will be closed in 120 days if no further activity occurs. To unstale this issue, add a comment with a detailed explanation.

There can be many reasons why some specific issue has no activity. The most probable cause is lack of time, not lack of interest. AsyncAPI Initiative is a Linux Foundation project not owned by a single for-profit company. It is a community-driven initiative ruled under open governance model.

Let us figure out together how to push this issue forward. Connect with us through one of many communication channels we established here.

Thank you for your patience :heart:

github-actions[bot] avatar Oct 03 '25 00:10 github-actions[bot]

Still relevant

neoandmatrix avatar Oct 14 '25 15:10 neoandmatrix

keep-open

Shurtu-gal avatar Oct 15 '25 12:10 Shurtu-gal