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

Module Commands

Reference for AntelopeJS module commands — scaffold new modules and run test suites.

Overview

The ajs module command group provides tools for module development. You use these commands to scaffold new modules from templates and to run module tests.

ajs module init

Create a module from one of the templates of the interface repository. The interface repository (the git CLI setting, see ajs config) lists the available templates and interfaces; the command creates the module from the chosen template, adds the chosen interfaces as dependencies and installs them.

ajs module init <path> [options]
ArgumentDescription
pathDirectory of the new module
OptionDescription
-g, --git <url>Interface repository URL, overriding the git CLI setting
-t, --template <name>Template to create the module from
--interfaces <names>Interfaces to add as dependencies (comma-separated)
--pm <npm|yarn|pnpm>Package manager of the module
--git-init / --no-git-initInitialize a git repository in the module, or not
-y, --yesAccept the default answer of every question no flag answers

The command asks for the template, the interfaces to add, the package manager and whether to initialize a git repository, then creates the module. Every question is answered before anything is written: cancelling with Ctrl+C leaves the target directory untouched and exits with code 130. An unknown --template or --interfaces name exits with code 2 and lists the available ones. --git always takes the repository URL; whether to initialize a git repository is --git-init / --no-git-init, the same flag as ajs project init.

Each question can be answered with its flag, so the command runs in scripts and CI. When standard input is not a terminal, or CI is set, the command never prompts. The target directory and the interface repository are checked first, so a non-empty directory or an unreachable repository is reported as such; then a question that no flag answers makes the command exit with code 2 before anything is written, and the error lists the flags to pass. Interfaces are optional and default to none. --yes answers the remaining questions with their defaults: the first template, npm and a git repository.

Examples:

# Create a module in the modules directory
ajs module init ./modules/my-module

# Use the templates of another interface repository
ajs module init ./modules/my-module --git https://github.com/your-org/interfaces.git

# Fully non-interactive, for scripts and CI
ajs module init ./modules/my-module --template "Blank Typescript" --interfaces api,logging --pm pnpm --no-git-init

# Accept every default
ajs module init ./modules/my-module --yes

The command ends with a summary such as Created module from template Blank Typescript → ./modules/my-module. After initialization, add the module to your project with ajs project modules add.

ajs module init ./modules/auth
ajs project modules add ./modules/auth --mode local
Keep your modules in a modules/ directory within the project for a clean file structure. Use --mode local when adding them to the project configuration.

ajs module test

Run the tests of a module. When no path is provided, the command runs the tests of the module in the current directory. The module declares its test configuration in the antelopeJs.test entry of its package.json (see Testing); without it, the command fails and explains how to add one:

✖ Module my-module has no test configuration
  The antelopeJs.test field of its package.json does not name a test configuration file.
  → Create antelope.test.ts, exporting defineConfig({ name, modules, test: { folder: "test" } }) from @antelopejs/interface-core/config
  → Point package.json to it: "antelopeJs": { "test": "antelope.test.ts" }
  → Docs: https://antelopejs.com/docs/module-development/testing
ajs module test [path] [options]
ArgumentDescription
pathDirectory of the module (default: current directory)
OptionDescription
-f, --file <path>Test file to run instead of the whole suite (repeatable)

Examples:

# Run all tests for a module
ajs module test ./modules/my-module

# Run tests in the current directory
ajs module test

# Run a specific test file
ajs module test ./modules/my-module -f tests/auth.test.ts

# Run multiple specific test files
ajs module test ./modules/my-module -f tests/auth.test.ts -f tests/session.test.ts
The -f flag can be specified multiple times to run a subset of test files. When omitted, the command runs every test file of the test folder the configuration declares. The command exits with code 1 when a test fails.