Skip to content

@opys/cli ​

npm

The opys command. It builds a config into one shareable file, and installs and launches either the config or a built file.

sh
npm install -g @opys/cli

Needs Node.js 20 or newer. A config is an ordinary JavaScript file, so install what it imports in your project:

sh
npm install -D @opys/dev @opys/minecraft

Example ​

sh
opys launch                 # build the config, install, start the game
opys install                # the same, without starting the game
opys build                  # write the bundle the config's `output` names

A built bundle runs without the config. The player's values come from --var:

sh
opys launch game.opys --var root=/path/to/install --var username=Player \
  --var uuid=00000000-0000-0000-0000-000000000001 --var token=0

Commands ​

CommandBuildsInstallsStarts the game
opys buildyesnono
opys installyesyesno
opys launchyesyesyes
opys install <bundle>noyesno
opys launch <bundle>noyesyes
  • With no bundle named, a command reads opys.config.mjs in the current directory.
  • opys install installs the files and stops. A mod loader's own first-run work, such as Forge patching the game, happens when the game first starts.
  • A bundle is a path or an http(s) URL. A URL is read in pieces, as a launcher reads it: only what the installation lacks is downloaded.
  • With a bundle named, no config is loaded, so its run does not happen. Pass what it would have set with --var.

Options ​

OptionCommandsWhat it does
-i, --inputall, with a configThe config file. Default opys.config.mjs.
-o, --outputbuildThe bundle to write. Default: the config's output.
--mode <value>all, with a configPassed to a config function. Default: the command.
--var <key=value>install, launchSets a variable. Repeat it for several.
--feature <a,b>install, launchSwitches features on, comma separated.
--log-level <l>allsilent, error, warn, info or debug.
-vallThe same as --log-level debug.

opys build with no -o and no output in the config prints the manifest as JSON. That is for reading and comparing. It cannot be installed from, because the carried files are not in it.

Exit codes ​

CodeMeaning
0Success.
1A mistake in the command or config, or a failure to build.
2A download failed.
3A file did not match its hash.
4An archive could not be unpacked.
5The game started, then exited with an error of its own.

Every command ​

Each command, in each way it is used.

sh
# build
opys build                               # writes the config's `output`
opys build -o dist/game.opys             # writes here instead
opys build -i packs/server.config.mjs    # another config
opys build --mode release                # the config function gets { mode: 'release' }
opys build > manifest.json               # no output named: the manifest, as JSON

# install, without starting the game
opys install
opys install --feature java_console
opys install game.opys --var root=/srv/game
opys install https://example.com/game.opys --var root=/srv/game

# launch
opys launch
opys launch --mode dev                   # `mode` defaults to 'launch'
opys launch --var username=Tester        # overrides one variable
opys launch --feature java_console,custom_java
opys launch game.opys --var root=/srv/game --var username=Player \
  --var uuid=00000000-0000-0000-0000-000000000001 --var token=0

# how much it says
opys launch -v
opys build --log-level silent

Documentation ​

Part of opys.