Usage

The CLI can be accessed using ao-forge. Read more about installing AOS

Creating a New Project

# Interactive mode (recommended)
ao-forge init my-app

# Specify framework
ao-forge init my-app --framework nextjs

# Use in existing directory
ao-forge init --path ./existing-directory

# Specify package manager
ao-forge init my-app --package-manager pnpm

# Using the create alias
ao-forge create my-app

Development Commands

# Start development server only
ao-forge dev

# Start both development server and AO processes
ao-forge dev:ao

# Start development server with monitoring
ao-forge dev:ao -m

# Start with process evaluation
ao-forge dev:ao -e "your-eval-input"
✨ Well done! A browser window should be loaded for http://localhost:3000

AO Process Management

AO processes run on the Arweave network and can be managed using the following commands:

# Start AO processes
ao-forge ao:start                              # Start with default name
ao-forge ao:start -n "my-process"              # Start with custom name
ao-forge ao:start -w "./wallet.json"           # Use specific wallet
ao-forge ao:start --tag-name "type" --tag-value "counter"  # Add tags
ao-forge ao:start --module <txid>              # Use specific module
ao-forge ao:start --cron "1-minute"            # Setup with cron job
ao-forge ao:start --sqlite                     # Use SQLite module
ao-forge ao:start --monitor                    # Start with monitoring

# Monitor processes
ao-forge ao:monitor                            # Monitor default process
ao-forge ao:monitor my-process                 # Monitor specific process

# Watch process output
ao-forge ao:watch my-process                   # Watch specific process

# List processes
ao-forge ao:list                               # List all processes for your wallet

# Setup cron jobs
ao-forge ao:cron my-process "1-minute"         # Setup minute cron
ao-forge ao:cron my-process "30-second"        # Setup second cron

Configuration Management

# Get config value
cao config --get packageManager

# Set config value
cao config --set packageManager pnpm

# Delete config value
cao config --delete customKey

AI-Powered CLI

AI Code Generation

Before using the AI code generation feature, you need to configure an API key. You have several options:

  1. Set environment variable:
export OPENAI_API_KEY='your-api-key-here'
export ANTHROPIC_API_KEY='your-anthropic-api-key-here'
  1. Configure API key through CLI:
cao config:api
  1. The CLI will prompt for an API key if none is found when running generation commands.
# Generate a Lua contract
cao ao:generate -p "Create a simple counter contract" -t contract -o ./ao/counter.lua

# Generate a test module
cao ao:generate -p "Create tests for counter contract" -t test -o ./ao/tests/counter.test.lua

# Generate without saving to file
cao ao:generate -p "Create a token contract"

# Specify AI provider and model
cao ao:generate -p "Create a counter contract" --provider openai --model gpt-4
cao ao:generate -p "Create a counter contract" --provider anthropic --model claude-3-opus-20240229

Command Options

CommandOptionDescription
ao:start-n, --name <name>Name for the AO process
-w, --wallet <path>Path to wallet file
-d, --data <path>Data file path
--tag-name <name>Process tag name
--tag-value <value>Process tag value
--module <txid>Module ID to use
--cron <frequency>Setup cron job (e.g., "1-minute")
--monitorMonitor the process
--sqliteUse sqlite3 AOS Module
--gateway-url <url>Set Arweave gateway URL
--cu-url <url>Set Computer Unit URL
--mu-url <url>Set Messenger Unit URL
ao:monitor[name]Process name to monitor
ao:watch<name>Process name to watch
ao:listList processes for your wallet
ao:cron<name>Process name
<frequency>Cron frequency (e.g., "1-minute")
init-f, --frameworkFramework to use (nextjs or nuxtjs)
-p, --pathPath to create project
--package-managerPackage manager (npm, yarn, pnpm)
dev:ao-n, --name <name>Name for the AO process
--monitorMonitor process after starting
ao:generate-p, --prompt <text>Description of code to generate
-t, --type <type>Type of code (contract/module/test)
-o, --output <path>Output file path
--provider <provider>AI provider (openai/anthropic)
--model <model>Specific AI model to use