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
ao-forge init my-app --framework nuxtjs
ao-forge init my-app --framework react
ao-forge init my-app --framework vue
ao-forge init my-app --framework svelte

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

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

Development Commands

# Start development server
ao-forge dev

# Start with specific port
ao-forge dev --port 3001

# Open browser automatically
ao-forge dev --open
✨ 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 process start                         # Start with default name
ao-forge process start -n "my-process"         # Start with custom name
ao-forge process start -w "./wallet.json"     # Use specific wallet

# List processes
ao-forge process list                          # List all processes

# Stop processes
ao-forge process stop                          # Stop running processes

Configuration Management

# Get config value
ao-forge config get packageManager

# Set config value
ao-forge config set packageManager pnpm

# List all configuration
ao-forge config list

# Validate configuration
ao-forge config validate

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. The CLI will prompt for an API key if none is found when running generation commands.
# Generate a Lua contract
ao-forge ai generate -p "Create a simple counter contract" -t contract -o ./ao/counter.lua

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

# Generate without saving to file
ao-forge ai generate -p "Create a token contract"

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

Command Options

CommandOptionDescription
init--frameworkFramework to use (nextjs, nuxtjs, react, vue, svelte)
--pathPath to create project
--package-managerPackage manager (npm, yarn, pnpm)
dev--port <port>Development server port
--openOpen browser automatically
process start-n, --name <name>Name for the AO process
-w, --wallet <path>Path to wallet file
process listList all processes
process stopStop running processes
config get<key>Get a configuration value
config set<key> <value>Set a configuration value
config listList all configuration values
ai 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