jbang icon indicating copy to clipboard operation
jbang copied to clipboard

Support version pinning for aliases/scripts

Open quintesse opened this issue 8 months ago • 24 comments

The problem with running aliases and scripts from remote catalogs/sites is that the original author can update them and then we're stuck with several issues:

  • do we update automatically (possibly breaking an existing script) or not (possibly forgoing critical bug/security fixes)?
  • we can already somewhat tell JBang to update by using --fresh , but what if we don't want that and want to "pin" a specific version we already have?
  • how can we notify the user that a newer version is available (if automatic updating is not available/enabled)?
  • how can we support multiple versions and how do we make it possible to install a specific version?
  • how can a user list the versions that are available?

Also see discussion here https://github.com/quarkiverse/quarkus-mcp-servers/issues/30

Edit: my current recommendation would be something similar to https://github.com/jbangdev/jbang/issues/1979#issuecomment-2761151904

Which basically is:

  • special alias syntax alias:version@catalog
  • the version will be used to "patch" the script-ref, this would work for git repos and maven artifacts
  • nice to have: query repos for possible versions (tags/branches for git, artifact versions for maven)

The advantage is that the catalog format stays exactly the same so it's fully backward-compatible.

quintesse avatar Mar 27 '25 13:03 quintesse