To my best knowledge
On startup, call a function to check the latest version from GitHub or a URL where version info is served.
Example: https://api.github.com/repos/ozkanpakdil/swaggerific/releases/latest
If there’s a new version, ask the user to update (Y/n).
If user hit Y, download the zip and overwrite the current install.
Be careful about the path the CLI needs correct access to write there.
Restart the CLI with the same parameters so it continues what the user requested.
I saw this flow in 2009 in a windows application. If you have MSI to deliver this may change but steps will be similar. Here there are many different examples.