[data-reveal]{opacity:1!important;transform:none!important}
DocumentationIntroduction

Introduction

How to install the AntelopeJS CLI, how its commands are structured, and the options, output, exit codes, plugins and settings every command shares.

Overview

The AntelopeJS CLI, ajs, is one command for every stage of a project. It creates projects, manages their modules, runs them in development, builds them for production, and stores global settings.

Installation

Install the CLI globally with your package manager:

npm install -g @antelopejs/core

The ajs command is then available in your terminal. To check the installation, print the version:

terminal
ajs --version

You can also run the CLI without installing it: npx @antelopejs/core <command> is the same as ajs <command>, for example npx @antelopejs/core project init my-app. Inside a project that lists @antelopejs/core as a dependency, npx runs that installed copy. The pages of this reference write ajs.

Command structure

Every invocation follows the same pattern:

terminal
ajs <command> <subcommand> [arguments] [options]

The CLI has these top-level commands:

CommandDescription
projectCreate, run, build and configure projects
moduleCreate and test modules
configShow or change CLI settings
updateUpdate the CLI and its global plugins
pluginsList official plugins, their version and where they resolve from

Each top-level command groups subcommands. For example, ajs project dev runs the project in development mode, and ajs project modules add adds modules to it.

Global options

Every command accepts these options, anywhere on the command line:

OptionDescription
-v, --versionPrint the version
--verbose [=channels]Print TRACE logs and full error details, optionally for some log channels only
-q, --quietPrint only results, warnings and errors, without progress, information or summaries
--no-colorDisable colors (also NO_COLOR=1)
-h, --helpShow help for a command

By default, --verbose turns on TRACE logs for every channel. To limit it to some channels, pass a comma-separated list after an equals sign, for example --verbose=cli.command,resolution. Only the --verbose=<channels> form takes a list. A bare --verbose never reads the next argument, so ajs --verbose project dev runs project dev with every channel. When something fails, a verbose run also prints stack traces and the full output of the commands that ajs ran. At startup, the loader.env channel lists the names, never the values, of the variables set from the project's .env, and of those the environment already held.

-q, --quiet, or ANTELOPEJS_QUIET=1, keeps a run to what a script needs. Results go to stdout, warnings and errors go to stderr, and the exit code reports the outcome. The run prints no progress lines, information messages, summaries, next steps or update notice.

ajs uses colors only on an interactive terminal. --no-color and a non-empty NO_COLOR always turn them off. Otherwise, FORCE_COLOR=1 turns them on and FORCE_COLOR=0 turns them off. Without FORCE_COLOR, CI=true and TERM=dumb turn them off too. The log lines of ajs project dev, build and start follow the same rules.

Getting help

Running ajs without arguments prints the top-level help on stdout and exits with code 0. A command group without a subcommand, such as ajs project, does the same. An unknown subcommand is a usage error, with exit code 2. The top-level help lists the commands, the official plugins and a few examples:

text
AntelopeJS CLI v1.10.3

Usage: ajs [options] [command]

Build modular Node.js applications from explicit interfaces.

Options:
  -v, --version             Print the version
  --verbose [=channels]     Print TRACE logs and full error details, optionally
                            for some log channels only (comma-separated)
                            (preset: "*", env: ANTELOPEJS_VERBOSE)
  -q, --quiet               Print only results, warnings and errors: no
                            progress, information or summaries (env:
                            ANTELOPEJS_QUIET)
  --no-color                Disable colors (also NO_COLOR=1)
  -h, --help                Show help for a command

Commands:
  project                   Create, run, build and configure projects
  module                    Create and test modules
  config                    Show or change CLI settings
  update [plugin]           Update the CLI and its global plugins
  plugins|plugin [options]  List official plugins
  help [command]            Show help for a command

Plugins:
  dms        DMS frontend commands (@antelopejs/dms-frontend)
  cloud      Deploy and operate AntelopeJS Cloud projects (@antelopejs/cloud)
  Resolved from the nearest node_modules/.bin, then from PATH.

Examples:
  # Create a project
  $ ajs project init my-app
  # Add a module from npm
  $ ajs project modules add @antelopejs/api
  # Run the project and reload it on changes
  $ ajs project dev --watch

Run ajs <command> --help for details. Docs: https://antelopejs.com/docs/cli/introduction

Every command and subcommand accepts --help, and ajs help project is the same as ajs project --help. For a plugin, ajs help <plugin> [command] prints the plugin's own help, like ajs <plugin> [command] --help. For example, ajs help dms prints the help of the DMS plugin. A command's help page says what the command does, then lists its arguments, its options, the global options and a few examples:

terminal
# Help for project commands
ajs project --help

# Help for a specific subcommand
ajs project dev --help

An option that defaults to the current directory, such as --project, shows (default: current directory) instead of a path. An option that an environment variable can also set names it, for example (env: ANTELOPEJS_PROJECT).

Tip

To see the options and examples of a command in the terminal, add --help to it.

Output

Commands that read data write their result, and only their result, on stdout. These commands are project modules list, project logging show, config show, config get and plugins. Context lines, hints, warnings and errors go to stderr, so you can pipe or redirect the result.

On a terminal, ajs wraps messages, errors with their details and fixes, lists, and key/value lines to the terminal width. It breaks lines between words and indents each continued line under the text it continues. When the output is piped or redirected, ajs writes each line whole.

  • On a terminal, lists are aligned tables under a header, and settings are aligned key/value lines. A table fits the terminal width. Its first column stays whole, and an ellipsis cuts the widest other columns. On a terminal too narrow even for that, each row becomes a block of aligned header and value lines.
  • When stdout is piped, a table becomes one tab-separated line per row, without a header, for cut, awk or grep.
  • With -j, --json, stdout holds exactly one JSON document, and the update notice never shows.
terminal
# Names of the configured modules
ajs project modules list | cut -f1

# Version of the dms plugin, if installed
ajs plugins --json | jq -r '.[] | select(.name == "dms") | .version'

Progress and summaries

Commands that do work report their progress on stderr, one line per task. These commands are project build, dev and start, and project modules add, install, update and remove. A task that took one second or more shows its duration.

  • On an interactive terminal, running tasks are a live list with one animated line each. Log lines and module output printed in the meantime appear above the list.
  • In CI (CI=true), when stderr is piped, and with --verbose, nothing is animated. Each task prints a single line when it finishes.
  • With --quiet, a task prints nothing unless it ends with a warning or an error.

Log lines, from --verbose in particular, are feedback too. During a CLI command such as project build or project modules install, they all go to stderr. Once project dev, run or start launches the application, its log lines are its output. They go to stdout, and errors go to stderr.

These commands end with one summary. It says what the command did, what it wrote and how long it took, then lists the commands that usually come next.

text
✔ Installed dependencies for module-a 2.3s
✔ Installed dependencies for module-b 2.4s
✔ Loaded 2 modules 2.4s
Built 2 modules → ./.antelope/build/build.json · 2.4s

Next steps
  ajs project start  start the project from this build

When several modules fail to load, the summary lists each failure once, followed by a single error that carries the fixes.

Errors

When a command fails, ajs prints one error on stderr. The error says what failed, why, and the details, then how to fix it. Known low-level failures get a plain explanation: a missing path, an unknown npm package, an unreachable registry, or a git repository that cannot be cloned. When a command that ajs runs fails, the error shows the last lines of its output.

text
✖ Package '@acme/missing' not found on the npm registry
  The registry answered 404: the name is wrong or the package is private.
  Run with --verbose to see the command output.
  → Check the name: npm view @acme/missing

When --verbose would show more, such as a stack trace or command output beyond the lines already printed, the error says so. Run the command again with --verbose to see stack traces and the full output of the failed command.

Exit codes

Every command reports its outcome through its exit code, for scripts and CI jobs:

CodeMeaning
0The command succeeded
1The command failed
2Usage error (unknown command or option, missing argument, invalid value). Nothing was attempted
3ajs project start --refresh-config found a module set that differs from the build (see project start)
130The command was cancelled with Ctrl+C

Cancelling ajs project init prints Cancelled and leaves no antelope.config.ts behind, so you can run it again. Stopping ajs project dev or ajs project start with Ctrl+C also exits with 130, once the project has stopped.

Plugins

Official plugins are separate packages that add command groups to the CLI. The core resolves ajs <plugin> to the plugin executable and forwards the remaining arguments to it.

PluginPackageDescription
dms@antelopejs/dms-frontendDMS frontend commands
cloud@antelopejs/cloudDeploy and operate AntelopeJS Cloud projects

Resolution order

The CLI looks for the plugin executable in this order, the way npx resolves a project-local binary:

  1. node_modules/.bin/<binary> in the current working directory, then in each parent directory up to the filesystem root (local). On Windows, the CLI also tries the .cmd, .exe and .bat variants.
  2. The directories of PATH, where a global installation lives (global).
  3. If neither has the executable, ajs <plugin> offers to install the plugin globally. The prompt defaults to No. Without an interactive terminal, the command fails and prints the install command instead.

A project that lists the plugin in its dependencies always runs its own version, from the project root or from any subdirectory, and never gets the global install prompt. The compatibility check reads the package.json of the executable that the CLI resolved. A project-local plugin is checked against its own version, not the global one.

A command that is neither a core command nor an official plugin runs a third-party ajs-<name> executable when one resolves the same way. The CLI first prints Running third-party plugin ajs-<name> (<path>) on stderr, so a typo never runs an unexpected program without notice.

terminal
# List official plugins, where they resolve from and their version
ajs plugins

# Run a plugin command (project-local binary first, then PATH,
# then an offer to install the plugin globally when missing)
ajs dms <command>

# Update the CLI and every globally installed official plugin
ajs update

# Update a single plugin
ajs update dms

Plugins are released separately from @antelopejs/core and declare the core versions they support in peerDependencies. When the installed plugin does not support the running CLI, the command stops with an error that names both versions.

Plugins print their output with the @antelopejs/core/cli module, so their messages, errors and exit codes match those of the core commands.

--no-color, --verbose and --quiet given before the plugin name reach the plugin through its environment as NO_COLOR=1, ANTELOPEJS_VERBOSE and ANTELOPEJS_QUIET=1. ANTELOPEJS_VERBOSE holds the channel list, or * for every channel. For example, ajs --no-color dms dev runs ajs-dms dev without colors. The CLI forwards everything after the plugin name, options included, to the plugin unchanged.

ajs plugins prints one row per official plugin with its package, version, source (local or global), status and location:

text
PLUGIN  PACKAGE                   VERSION  SOURCE  STATUS                         LOCATION
dms     @antelopejs/dms-frontend  0.9.0    local   needs @antelopejs/core ^2.0.0  ./node_modules/.bin/ajs-dms
→ Update @antelopejs/dms-frontend in this project's package.json

The status is one of these values:

  • compatible.
  • needs @antelopejs/core <range>, when the plugin does not support the running CLI. Running the plugin would fail.
  • unknown, when the CLI cannot read the plugin's package.json.
  • not installed. A hint on stderr then gives the command that installs the plugin.

ajs plugins --json prints the same information as a JSON array.

The project package manager owns the plugins that resolve from a project node_modules. ajs update leaves them alone and updates only the CLI and the globally installed plugins.

ajs update uses the package manager that installed the CLI globally (npm, pnpm, or Yarn Classic). It updates one package at a time and stops at the first failure. It requires a global installation. When the CLI comes from a project dependency or a source checkout, ajs update refuses to modify a global installation. ajs update <plugin> checks the name first. A name that is not an official plugin fails with a usage error (exit code 2), whatever the installation.

Environment variables

VariableEffect
ANTELOPEJS_PROJECTDefault of --project
ANTELOPEJS_LAUNCH_ENVDefault of --env
ANTELOPEJS_VERBOSEDefault of --verbose, as a comma-separated channel list
ANTELOPEJS_GITDefault of --git (interface repository URL) for project modules install and module init
ANTELOPEJS_QUIETAny value other than 0 or false turns on --quiet
NO_COLORAny non-empty value disables colors, like --no-color
FORCE_COLOR1 turns colors on outside a terminal, 0 turns them off
CIDisables colors, animations, questions and the update notice
AJS_NO_UPDATE_CHECKAny value other than 0 or false disables the update notice

Update notice

When a newer version of @antelopejs/core is published, ajs prints one line on stderr after the command output:

text
ℹ Update available 1.10.3 → 1.12.0  → ajs update

The CLI asks the npm registry at most once a day, in the background, and gives up after one second. It caches the answer in ~/.antelopejs/update-check.json. The CLI skips the check in these cases:

  • stderr is not a terminal.
  • CI or AJS_NO_UPDATE_CHECK holds a value other than 0 or false.
  • The run is ajs alone, ajs help, or uses --help, --version, --json or --quiet.

Configuration storage

The CLI stores its global settings in a JSON file:

PlatformPath
Linux, macOS~/.antelopejs/config.json
Windows%USERPROFILE%\.antelopejs\config.json

The file holds settings such as the default interface repository URL. Change it with the ajs config commands, not by hand. See the Configuration page.