# Basic process generation
ao-forge ai generate process counter --description "A simple counter with increment and decrement functions"
# Advanced process generation
ao-forge ai generate process token --description "ERC-20 style token with transfer, approve, and balance functions" --model gpt-4 --include-docs --generate-types
# Custom output directory
ao-forge ai generate process dao --description "DAO contract with voting and proposal functionality" --output ./contracts/
# Generate smart contract
ao-forge ai generate contract voting --description "Voting system with quadratic voting and delegation"
# Generate with custom model
ao-forge ai generate contract nft --description "NFT contract with minting and trading" --model claude-3
# Generate tests for process
ao-forge ai generate test counter --description "Tests for counter process functionality"
# Generate tests for contract
ao-forge ai generate test voting --description "Tests for voting contract functionality"
# List available models
ao-forge ai models
# Use specific model
ao-forge ai generate process counter --model gpt-4
ao-forge ai generate process counter --model gpt-3.5-turbo
ao-forge ai generate process counter --model claude-3
# Custom prompt
ao-forge ai generate process my-process --prompt "Create a voting system with quadratic voting and delegation"
# Prompt from file
ao-forge ai generate process my-process --prompt-file ./prompts/voting.txt
# voting.txt
Create a voting system with the following features:
- Quadratic voting mechanism
- Delegation support
- Proposal management
- Vote tallying
- Result reporting
-- Generated process with proper structure
Handlers.add("function_name", function(msg)
-- Input validation
if not msg.Input then
return { error = "Missing input" }
end
-- Process logic
local result = processInput(msg.Input)
-- Return result
return { success = true, result = result }
end)
-- Generated contract with proper structure
-- Contract: Token
-- Description: ERC-20 style token with transfer, approve, and balance functions
-- State management
local function getBalance(address)
return tonumber(AO.load("balance:" .. address) or "0")
end
local function setBalance(address, amount)
AO.store("balance:" .. address, tostring(amount))
end
-- Transfer function
Handlers.add("transfer", function(msg)
local from = msg.From
local to = msg.To
local amount = tonumber(msg.Amount)
-- Validation
if not to or not amount or amount <= 0 then
return { error = "Invalid transfer parameters" }
end
local balance = getBalance(from)
if balance < amount then
return { error = "Insufficient balance" }
end
-- Execute transfer
setBalance(from, balance - amount)
setBalance(to, getBalance(to) + amount)
return { success = true, from = from, to = to, amount = amount }
end)