Skip to main content
Complete reference for all package manager commands in Ant.

Global Flags

These flags work with most commands:
  • --verbose - Enable detailed logging of operations
  • -h, --help - Display help for the command

init

Create a new package.json file interactively.
ant init
Interactive prompts:
  • Package name (defaults to directory name)
  • Version (defaults to 1.0.0)
  • Entry point (defaults to index.js)
Example output:
ant init

package name (my-project): my-app
version (1.0.0): 1.0.0
entry point (index.js): index.js

+ Created package.json
Generated package.json:
{
  "name": "my-app",
  "version": "1.0.0",
  "type": "module",
  "main": "index.js",
  "scripts": {
    "start": "ant index.js"
  },
  "dependencies": {},
  "devDependencies": {}
}

install

Alias: i Install dependencies from lockfile, or add packages if specified.
ant install                    # Install from lockfile
ant install express lodash     # Add packages
ant install -D typescript      # Add as devDependency
ant install -g typescript      # Install globally
packages
string[]
Package specifications (name[@version]). If omitted, installs from lockfile.
-g, --global
flag
Install packages globally to ~/.ant/pkg/global
-D, --save-dev
flag
Add packages to devDependencies instead of dependencies
Behavior:
  • Without arguments: Reads package.json and ant.lockb, installs exact versions from lockfile
  • With packages: Adds packages to package.json, resolves dependencies, and installs
  • No lockfile: Resolves fresh dependency tree and creates ant.lockb
Example output:
ant install express
ant install v0.1.0 (a1b2c3d)
🔍 Resolving [1/1]

installed [email protected] with binaries:
 - express

15 packages installed [2.3s] done

add

Alias: a Add one or more packages to dependencies.
ant add <package[@version]>... [options]
packages
string[]
required
One or more package specifications:
  • lodash - Latest version
  • [email protected] - Specific version
  • lodash@^4.0.0 - Semver range
  • @types/node - Scoped package
-g, --global
flag
Install packages globally to ~/.ant/pkg/global
-D, --save-dev
flag
Add packages to devDependencies
Examples:
ant add lodash express         # Add to dependencies
ant add -D typescript @types/node  # Add to devDependencies
ant add lodash@^4.0.0          # Add with version range
ant add -g typescript          # Install globally
Output:
ant add lodash

+ [email protected]

1 package installed [823ms]

remove

Alias: rm Remove packages from dependencies.
ant remove <package>... [-g]
packages
string[]
required
One or more package names to remove
-g, --global
flag
Remove packages from global installation
Examples:
ant remove lodash              # Remove from local dependencies
ant remove lodash express      # Remove multiple packages
ant remove -g typescript       # Remove global package
Output:
ant remove lodash
ant remove v0.1.0 (a1b2c3d)

12 packages installed [1.1s]
- Removed: lodash

update

Alias: up Re-resolve dependencies and update lockfile.
ant update                     # Update all packages
ant update [packages...]       # Update specific packages
packages
string[]
Specific packages to update. If omitted, updates all packages.
Behavior:
  • Without arguments: Re-resolves all dependencies based on version ranges in package.json, updates lockfile
  • With packages: Updates specified packages to latest versions matching constraints
Examples:
ant update                     # Update all packages
ant update express lodash      # Update specific packages
ant update [email protected]       # Update to specific version
Output:
ant update
ant update v0.1.0 (a1b2c3d)

+ [email protected] (v4.19.0 available)
+ [email protected]

2 packages installed [1.5s]

run

Run a script from package.json.
ant run <script> [args...]
ant run                        # List available scripts
script
string
Script name from package.json scripts section. If omitted, lists all scripts.
args
string[]
Arguments to pass to the script. Use -- to separate script args from ant flags.
Examples:
ant run dev                    # Run dev script
ant run test -- --coverage     # Pass args to script
ant run build                  # Run build script
Output:
ant run dev
$ vite dev

  VITE v5.0.0  ready in 234 ms

  ➜  Local:   http://localhost:5173/
List scripts:
ant run
Usage: ant run <script> [args...]

Run a script from package.json

Available scripts:
  dev             vite dev
  build           vite build
  test            vitest run
  lint            eslint .

exec

Alias: x Run a command from node_modules/.bin or download temporarily.
ant x [--ant] <command> [args...]
ant x                          # List available binaries
--ant
flag
Run the binary with ant instead of node
command
string
Binary name to execute. If omitted, lists all available binaries.
args
string[]
Arguments to pass to the command
Examples:
ant x tsc --version            # Run TypeScript compiler
ant x --ant prettier --write . # Run with ant runtime
ant x create-react-app my-app  # Download and run temporarily
Lookup order:
  1. Local node_modules/.bin/
  2. Global ~/.ant/pkg/global/node_modules/.bin/
  3. Temporary download from npm registry
Output:
ant x typescript
🔍 Resolving typescript

Version 5.3.3

why

Alias: explain Show which packages depend on a given package.
ant why <package>
package
string
required
Package name to query
Example:
ant why react-dom
Output:
[email protected] dev
  └ package.json (devDependencies)
  └ @testing-library/[email protected] "^18.0.0"
  └ react-dom peer "^18.0.0"
Explanation:
  • Shows the installed version and type (dev/peer/optional)
  • Lists all packages that depend on it
  • Shows dependency constraints

info

Show package information from the npm registry.
ant info <package[@version]>
package
string
required
Package specification (name or name@version)
Examples:
ant info lodash                # Info for latest version
ant info [email protected]        # Info for specific version
ant info @types/node           # Info for scoped package
Output:
ant info lodash
[email protected] | MIT | deps: 0 | versions: 112
Lodash modular utilities.
https://lodash.com/
keywords: modules, stdlib, util

dependencies (0):

dist
 .tarball: https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz
 .shasum: 679591c564c3bffaae8454cf0b3df370c3d6911c
 .integrity: sha512-v2kDEe57lec...
 .unpackedSize: 1.41 MB

dist-tags:
  latest: 4.17.21

maintainers:
- John-David Dalton <[email protected]>

Published: 2021-02-20T15:49:35.000Z

ls

Alias: list List installed packages.
ant ls [-g]
-g, --global
flag
List global packages instead of local ones
Examples:
ant ls                         # List local packages
ant ls -g                      # List global packages
Output:
/home/user/my-project/node_modules (42)
├── [email protected]
├── [email protected]
└── [email protected]

trust

Run lifecycle scripts for packages.
ant trust [packages...] [--all]
ant trust                      # List packages needing trust
packages
string[]
Package names to trust. If omitted, lists packages with pending scripts.
-a, --all
flag
Trust and run all pending lifecycle scripts
Examples:
ant trust                      # Show packages needing trust
ant trust puppeteer            # Trust specific package
ant trust --all                # Trust all packages
Lifecycle scripts:
  • preinstall - Runs before package is installed
  • install / postinstall - Runs after package is installed
  • preuninstall / uninstall / postuninstall - Runs before/after removal
Output:
ant install puppeteer

1 package needs to run lifecycle scripts:
  • puppeteer (node install.js)

Run: ant trust <pkg> or ant trust --all
ant trust puppeteer
Added 1 package to trustedDependencies in package.json
Running lifecycle scripts for 1 package...

1 package trusted [823ms]

cache

Manage the package cache.
ant cache <command>

cache info

Show cache statistics.
ant cache info
Output:
Cache location: ~/.ant/pkg
Packages:      156
Size:          1.23 GB
DB size:       4.12 MB

cache prune

Remove packages older than N days.
ant cache prune [days]
days
number
Maximum age in days (default: 30)
Examples:
ant cache prune                # Prune packages older than 30 days
ant cache prune 7              # Prune packages older than 7 days
Output:
Pruned 23 packages older than 30 days

cache sync

Flush cache database to disk.
ant cache sync
Output:
Cache synced

create

Scaffold a new project from a template.
ant create <template> [dest] [...flags]
ant create <github-org/repo> [dest] [...flags]
template
string
required
Template name (npm package) or GitHub repository (org/repo)
dest
string
Destination directory. Defaults to template/repo name.
Template types:
  1. NPM templates: Runs ant x create-<template> with given arguments
  2. GitHub repositories: Clones repository contents as template
Examples:
ant create vite my-app         # npm: create-vite
ant create react-app my-app    # npm: create-react-app
ant create user/template       # GitHub: user/template
NPM template:
ant create vite my-app --template react
# Runs: ant x create-vite my-app --template react
GitHub template:
ant create vercel/next.js my-app
# Clones: https://github.com/vercel/next.js.git
Environment variables:
  • GITHUB_TOKEN - Supply a token for private repos or higher rate limits
Output:
+ Creating project from vercel/next.js...

Done! Created my-app

  cd my-app
  ant install

Build docs developers (and LLMs) love