Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refine the default behaviour for "wasmer run" #3247

Closed
Michael-F-Bryan opened this issue Oct 24, 2022 · 2 comments
Closed

Refine the default behaviour for "wasmer run" #3247

Michael-F-Bryan opened this issue Oct 24, 2022 · 2 comments
Labels
bug Something isn't working 📦 lib-cli About wasmer-cli priority-medium Medium priority issue

Comments

@Michael-F-Bryan
Copy link
Contributor

Currently, when the user runs wasmer run ls, the behaviour is as follows...

  • If the command has already been installed (i.e. wasmer install user/some-package where the package contains a ls command),
    • Execute it
  • Otherwise,
    • Ask the WAPM backend which packages include a ls command (query)
    • Automatically install the package that was most recently published
    • Execute it

This mostly works, but there’s no guarantee which package you are installing if someone else publishes a package with the same command name (not good for ergonomics or security).

One idea @syrusakbary raised is that we could use the [dependencies] section in wapm.toml (soon to be renamed wasmer.toml) to figure out which commands are available.

For example:

#  wapm.toml
[package]
name = "..."

[[command]]
name = "ls"
package = "markj/coreutils"

[dependencies]
"mark/coreutils" = ".."
"sharrattj/coreutils:ls" = "1.2.3"

To help users, the wapm install mark/coreutils command could automatically update the "closest" wapm.toml file, and running wasmer run ls without an ls command in your wapm.toml would give you a suggestion like this:

$ wasmer run ls
ERROR: The "ls" command isn't currently installed. 

You might want to install one of the following packages:
- sharrattj/coreutils
- mark2/coreutils

If we behave similar to git and npm by recursively searching parent files for a wapm.toml, this effectively gives us a "global install" command for free - if no wapm.toml is found, add it to $HOME/.wapm.toml (or $WASMER_HOME/wapm.toml or $HOME/.config/wasmer/wapm.toml or wherever).

@Michael-F-Bryan
Copy link
Contributor Author

It sounds like this broke webassembly.sh - wasmerio/webassembly.sh#116.

@Michael-F-Bryan
Copy link
Contributor Author

I'm closing this because it's no longer relevant.

There is no longer the concept of "installing" commands. Instead, since merging the wapm and wasmer CLIs and re-implementing wasmer run (#3924), wasmer run will now accept

  • a URL or file path pointing to a *.webc file
  • the name (and version) of a package that we'll fetch from the current registry, or
  • the path to a directory containing a wasmer.toml file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working 📦 lib-cli About wasmer-cli priority-medium Medium priority issue
Projects
None yet
Development

No branches or pull requests

1 participant