npm.io
1.0.2 • Published yesterdayCLI

@powernukkitx/cli

Licence
MIT
Version
1.0.2
Deps
3
Size
77 kB
Vulns
0
Weekly
0
Stars
1

pnx-cli

PowerNukkitX CLI - command line tool to manage a Minecraft Bedrock server powered by PowerNukkitX.

Create, start, update and diagnose your server, manage plugins from the marketplace, all with a clean interface and an interactive menu.

Contents

Installation

npm install -g @powernukkitx/cli

The pnx command becomes available.

Requirements

Quick start

# Contextual interactive menu
pnx

# Create a server then start it
pnx init --dir ./pnx-server
pnx start --memory 4G

# Help
pnx --help
pnx <command> --help

Commands

init - create a server

Downloads the latest powernukkitx.jar and the start scripts.

pnx init --dir ./pnx-server
Option Description
--dir <path> Target directory (prompted otherwise)
--dev Development build
start - start the server

Checks Java, builds optimized JVM arguments (generational ZGC, UTF-8) and launches the server.

pnx start --memory 4G --restart
Option Description
--dir <path> Server directory
--memory <size> Allocated memory, e.g. 2G, 4G (default 2G)
--restart Auto restart on crash
--dry-run Print the command without running it
stop - stop the server

Stops the server started through its stored PID.

pnx stop
update - update the core

Backs up the old jar as .old then downloads the latest version.

pnx update --force
Option Description
--force Force re-download (ignore cache)
--dev Development build
plugin - manage plugins

Official marketplace plus local tracking of installed versions.

pnx plugin list                    # catalog
pnx plugin search essentials       # search
pnx plugin info <slug>             # details
pnx plugin install <slug|url.jar>  # install (marketplace or .jar URL)
pnx plugin installed               # local plugins
pnx plugin update [slug]           # update
pnx plugin remove [name]           # remove

Without an argument, install, update and remove offer an interactive selection.

Diagnostics and utilities
pnx doctor          # Java, RAM, disk, port 19132, plugins/worlds
pnx info            # status, path, plugins, worlds, RAM
pnx backup          # timestamped server backup
pnx config          # print pnx.yml / server.properties (colored)
pnx use ./server    # set the default server
pnx logs            # latest logs (with live follow)
pnx console         # RCON console attached to the server

doctor and info accept --json for machine output.

Interactive mode

Launched without a subcommand, pnx opens a contextual menu that:

  • detects state (server present, running, PID);
  • only offers relevant actions (create if missing, start if stopped, stop if running...);
  • routes to the existing commands.
pnx

Global options

Option Description
--json Machine JSON output (disables decorative rendering)
--no-color Disable colors

CLI state is stored in ~/.pnx-cli/ (config, PID, installed plugins, version cache). Environment variables: PNX_API_URL (marketplace API base), PNX_HOME (state directory).

Architecture

The code follows a layered architecture - thin commands, isolated business logic:

dist/
  cli.js          entry point (citty) + global options
  commands/       parse arguments -> call service -> render
    plugin/       plugin subcommands
  services/       pure business logic (release, server, process, plugins, backup)
  infra/          http, JSON store (~/.pnx-cli), constants/endpoints
  ui/             single output system (clack + chalk), prompts

Rules: commands do no direct network/file access (everything goes through services/infra); services render nothing (they return data).

Stack: citty (routing), @clack/prompts (prompts), chalk (colors).

Development

The shipped code lives in dist/ (plain ES modules, no build step).

npm install       # dependencies
npm start         # run dist/cli.js
npm run check     # syntax check every file
npm run smoke     # run pnx --help

License

MIT

Keywords