Documentation
Moon CLI

Moon CLI

Moon CLI is a global multi-platform command-line router. It manages platforms, each with its own runner. Moontraze is one registered platform on Moon CLI.

You can use Moontraze in two ways:

  1. Moon CLI — moon moontraze deploy
  2. npx (npm) — npx moontraze deploy (no install needed)

Both work the same. Choose whichever you prefer.


Two Ways to Use Moontraze CLI

Option A: Moon CLI

Moon CLI is a global router that manages multiple platforms.

Install once, use forever.

npm install -g moon-cli

Or via curl:

Windows (PowerShell):

irm https://api.moontraze.com/cli/install.ps1 | iex

Windows (CMD):

curl -o "%TEMP%\moon-install.ps1" https://api.moontraze.com/cli/install.ps1
powershell -ExecutionPolicy Bypass -File "%TEMP%\moon-install.ps1"

Linux / macOS:

curl -fsSL https://api.moontraze.com/cli/install.sh | bash

Termux (Android):

pkg install nodejs
curl -fsSL https://api.moontraze.com/cli/install.sh | bash

Option B: npx (No Install)

If you don't want to install Moon CLI, use npx:

npx moontraze login
npx moontraze deploy --prod
npx moontraze update

Same commands, no global install.

Option C: npm install

Install Moontraze CLI locally:

npm install -g moontraze

Then use:

moontraze login
moontraze deploy --prod

Install Moon CLI

Windows (PowerShell)

irm https://api.moontraze.com/cli/install.ps1 | iex

Windows (CMD)

curl -o "%TEMP%\moon-install.ps1" https://api.moontraze.com/cli/install.ps1
powershell -ExecutionPolicy Bypass -File "%TEMP%\moon-install.ps1"

Linux / macOS

curl -fsSL https://api.moontraze.com/cli/install.sh | bash

Termux (Android)

pkg install nodejs
curl -fsSL https://api.moontraze.com/cli/install.sh | bash

After Install

Refresh PATH if moon is not found:

Windows CMD:

set PATH=%LOCALAPPDATA%\Moon\bin;%PATH%

Windows PowerShell:

$env:Path = "$env:LOCALAPPDATA\Moon\bin;$env:Path"

Linux / macOS / Termux:

export PATH="$HOME/.local/share/Moon/bin:$PATH"

Verify:

moon -v

Install location:

  • Windows → %LOCALAPPDATA%\Moon
  • Linux / macOS / Termux → ~/.local/share/Moon

Global Moon Commands

# Version / help
moon -v
moon help
 
# Update / uninstall router
moon update
moon uninstall --yes
 
# Platform management
moon platform list
moon platform remove myweb
moon platform use myweb

Install Moontraze Platform

# One-time install
moon moontraze install

Moontraze Commands

# Login
moon moontraze login
moon moontraze login --token <jwt>
 
# Link project
moon moontraze link my-site
 
# List sites
moon moontraze list
 
# Deploy
moon moontraze deploy
moon moontraze deploy --prod
 
# Update CLI
moon moontraze update
 
# Uninstall
moon moontraze uninstall --yes

Without Moon CLI (npx)

If you don't want to install Moon CLI:

npx moontraze login
npx moontraze deploy --prod
npx moontraze update

Same functionality, no global install.


Typical Workflow

With Moon CLI

moon -v
moon update
 
moon moontraze install
moon moontraze login
moon moontraze link my-site
moon moontraze deploy --prod
 
moon moontraze update
moon update
 
moon moontraze uninstall --yes
moon uninstall --yes

With npx

npx moontraze login
npx moontraze link my-site
npx moontraze deploy --prod

How Platforms Work

Moon CLI is a router. It does not implement login or deploy itself. Each platform provides its own runner.

  • Moontraze is a registered platform
  • Anyone can publish a free platform with a manifest URL
  • Or register for a one-line professional install

Free / open platform:

  • Host a manifest + tarball
  • Users run moon yourname install --from <url>

Registered platform:

  • Listed in Moon CLI
  • Users run moon yourname install (no URL)

Publish a Free Platform

Step A — Build your CLI runner

// bin/myweb.js
#!/usr/bin/env node
const platform = process.env.MOON_PLATFORM || 'myweb';
const api = process.env.MOON_API || 'https://api.myweb.com';
const cmd = (process.argv[2] || '').toLowerCase();
 
if (cmd === 'login') { /* your login */ }
else if (cmd === 'deploy') { /* your deploy */ }
else if (cmd === 'list') { /* your list */ }
else console.log('Commands: login | deploy | list');

Step B — Host manifest + tarball

// GET https://api.myweb.com/cli/manifest.json
{
  "version": "1.0.0",
  "tarball": "https://api.myweb.com/cli/myweb-1.0.0.tgz"
}

Tarball layout (npm pack style):

package/bin/myweb.js
package/lib/...
package/package.json

Step C — Tell users

moon myweb install --from https://api.myweb.com/cli/manifest.json
 
moon myweb login
moon myweb deploy
moon platform list

Local Add (This Machine Only)

For development. Other users cannot install this entry.

# Relative path
moon platform add myweb --runner ./myweb-cli.js --api https://api.myweb.com --label "My Web"
 
# Windows absolute
moon platform add myweb --runner C:\Users\Demo\apps\myweb\bin\cli.js --api https://api.myweb.com
 
# Linux / macOS / Termux
moon platform add myweb --runner /home/demo/.local/share/MyWeb/cli/bin/cli.js --api https://api.myweb.com
 
# npm package on this machine
moon platform add myweb --runner npm:myweb-cli --api https://api.myweb.com
 
moon platform list
moon platform use myweb
moon platform remove myweb

Notes

  • moon only routes to a runner; it does not implement login or deploy
  • moon platform add = local only
  • Worldwide users need install --from or a registered platform
  • Free platforms: you host manifest + tarball; document --from command
  • Registered platforms: users run moon <name> install only
  • moon update updates the router
  • moon moontraze update updates the Moontraze CLI
  • Each user must run install once per machine
  • Project link lives in .moontraze/project.json (folder-local)