@paul-unifra/yaar-cli
v0.2.1
Published
TypeScript CLI for deploying YAAR agents on 0G. The deploy command mirrors the current web deploy flow:
Readme
YAAR CLI
TypeScript CLI for deploying YAAR agents on 0G. The deploy command mirrors the current web deploy flow:
- Upload or reuse the agent image.
- Upload metadata through the YAAR web deploy API.
- Pay the current iNFT mint fee.
- Ask the YAAR web deploy API to mint the iNFT.
- Create the agent token from the user's signer, with optional pre-purchase value.
The executable is yaar.
Runtime Dependencies
To run the CLI itself:
- Bun
>=1.1.38for workspace install/build scripts. - Node.js
>=20. - Workspace dependencies installed with
bun install. - A reachable 0G EVM RPC, defaulting to
https://evmrpc-testnet.0g.aifor testnet. - A reachable YAAR deploy API. The default is
https://yaar.fun; for local development useYAAR_API_URL=http://localhost:3000or setapi.base_urlin the deploy config. - A funded signer wallet with enough 0G for the mint fee, gas, and optional pre-purchase.
Signer options:
- Private key mode: set
YAAR_PRIVATE_KEY=0x...or pass--private-key 0x.... - Open Wallet Standard mode: install the
owsCLI from https://openwallet.sh/ and pass--ows-wallet <name-or-id>.
OWS install:
npm install -g @open-wallet-standard/coreIf ows is not on PATH, set YAAR_OWS_BIN=/path/to/ows.
For local actual deployments through the web app:
- Start the existing web app with
bun run dev:weborcd apps/web && bun run dev. - Keep
apps/web/.envpopulated. The CLI does not require additional server-side settings beyond the environment already used by web-based deployments. - Set the CLI API URL to the local web app, for example
YAAR_API_URL=http://localhost:3000. - The indexer does not need to run locally for deployment. It only affects when the deployed agent appears in indexed discovery/trade surfaces.
For tests only:
bun run test:e2erequires Foundry'sanvilbinary. Normal CLI deploys do not need anvil.- Set
YAAR_FORK_RPC_URLto override the anvil fork source RPC.
Build
cd apps/cli
bun install
bun run build
./dist/index.mjs --helpFrom the repository root:
bun run --filter @yaar/cli buildTests
cd apps/cli
bun run typecheck
bun run test
bun run test:e2etest:e2e starts an anvil fork of 0G testnet, runs a local deploy API stub, and verifies the full
CLI path:
pay mint fee -> mint iNFT -> create tokenCreate A Config
yaar config init -o agent.yamlMinimal config:
network:
name: testnet
rpc_url: "https://evmrpc-testnet.0g.ai"
chain_id: 16602
api:
base_url: "http://localhost:3000"
agent:
name: "My AI Agent"
ticker: "MYAI"
description: "An AI agent that helps users complete useful tasks."
profile_picture: "https://example.com/avatar.png"
twitter: "myagent"
website: "https://myagent.example"
github: ""
discord: ""
docs: ""
category: "AI Agent"
owner:
type: self
identifier: ""
tokenomics:
pre_purchase:
enabled: false
amount: "0"Owner modes:
self: iNFT is minted directly to the deployer wallet.evm: if the address differs from the deployer, iNFT is minted to the claim contract and the designated wallet can claim later.githuborx: CLI asks the web API to resolve the immutable identity, then mints to the claim contract.
Deploy With A Private Key
export YAAR_API_URL=http://localhost:3000
export YAAR_PRIVATE_KEY=0x...
yaar deploy -c agent.yamlUseful overrides:
yaar deploy \
--name "Research Agent" \
--ticker RSCH \
--description "An autonomous research assistant for market and protocol analysis." \
--twitter research_agent \
--category "Research" \
--image ./avatar.png \
--private-key 0x...Deploy With OWS
List local OWS wallets:
yaar wallet listCreate an OWS-compatible wallet if none exists:
yaar wallet create --name yaar-deployer
yaar wallet address --wallet yaar-deployerSend enough 0G to the printed EVM address for the mint fee, optional pre-purchase, and gas. Then:
YAAR_API_URL=http://localhost:3000 yaar deploy -c agent.yaml --ows-wallet yaar-deployerThe CLI builds unsigned legacy 0G transactions with viem, calls:
ows sign tx --wallet <wallet> --chain 16602 --tx <unsigned-tx> --jsonand submits the signed raw transaction through the configured RPC.
Resume
Deployments create .yaar-deploy-<id>.json while running. If the process is interrupted:
yaar deploy --resume <id> --ows-wallet yaar-deployerFor private-key signing, provide YAAR_PRIVATE_KEY again. Private keys are never persisted in state
files.
Dry Run
YAAR_API_URL=http://localhost:3000 yaar deploy -c agent.yaml --ows-wallet yaar-deployer --dry-run --jsonThis validates config, resolves the owner, reads balance and mint fee, and sends no transactions.
Agent Skill
The agent-facing skill lives at:
apps/cli/skills/yaar-deploy/SKILL.mdInstall or expose that skill to an agent. The skill instructs the agent to:
- Check for an existing OWS wallet.
- Create an OWS-compatible wallet if needed.
- Ask the user/team to fund the printed 0G address.
- Generate or update
agent.yaml. - Run
yaar deploywith--ows-wallet.
