Skip to main content
Run commands from node_modules/.bin, global packages, or download packages temporarily for one-time execution.

Usage

ant exec <command> [args...]
ant x <command> [args...]

Parameters

command
string
required
Name of the command to execute. Can be a binary from:
  • Local node_modules/.bin
  • Global ~/.ant/pkg/global/node_modules
  • npm registry (downloaded temporarily)
args
string[]
Arguments to pass to the command.

Options

--ant
boolean
Run the command with ant runtime instead of Node.js.
--verbose
boolean
Enable verbose output.
-h, --help
boolean
Display help information.

Examples

List available commands

ant exec
Output:
Usage: ant x [--ant] <command> [args...]

Run a command from node_modules/.bin or download temporarily

Options:
  --ant    Run with ant instead of node

Available commands:
  tsc
  eslint
  prettier
  jest

Run local binary

ant x tsc --noEmit

Run with ant runtime

ant x --ant esbuild src/index.js --bundle

Run global binary

ant x -g pm2 start app.js

Download and run temporarily

If the command is not installed, Ant downloads it temporarily:
ant x cowsay "Hello, World!"
Output:
πŸ” Resolving cowsay
 _________________
< Hello, World! >
 -----------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

Run specific version

ant x [email protected] tsc --version

Pass complex arguments

ant x prettier --write "src/**/*.{js,ts,json}"

Execution Priority

Ant searches for binaries in this order:
  1. Local node_modules/.bin
  2. Global ~/.ant/pkg/global/node_modules
  3. Download from npm registry (temporary)

Temporary Downloads

When a command is not found locally or globally:
  • Package is downloaded to a temporary location
  • Command is executed immediately
  • Package may be cached for future use
ant x create-react-app my-app
# Downloads create-react-app temporarily

Runtime Selection

By default, binaries run with Node.js. Use --ant to run with Ant’s runtime:
# Runs with node
ant x esbuild src/index.js

# Runs with ant
ant x --ant esbuild src/index.js

Exit Codes

The exit code from the command is propagated:
ant x eslint .
# Exit code 1 if linting errors found

Command Not Found

ant x nonexistent-command
Output:
Error: 'nonexistent-command' not found

Build docs developers (and LLMs) love