Getting Started
Install CLI.do and execute your first commands
Get started with CLI.do in minutes and start executing code from your terminal.
Installation Options
Option 1: Use Without Installing (Recommended)
Execute immediately without installing:
npx cli.do $.Business.create({ name: 'Acme' })Option 2: Install Globally
Install once, use the do shortcut everywhere:
npm install -g cli.do
# or
pnpm add -g cli.doNow use the do command:
do $.Business.create({ name: 'Acme' })Option 3: Project-Local Installation
Install in your project:
npm install cli.do
# or
pnpm add cli.doUse with npx:
npx do $.Business.create({ name: 'Acme' })Authentication
1. Get Your API Key
Sign up at platform.do and get your API key from the dashboard.
2. Login
# Interactive OAuth login (recommended)
do auth login
# Or set API key
export DO_TOKEN=sk_live_xxxxx
# Or use admin token
export DO_ADMIN_TOKEN=admin_xxxxx3. Verify
do auth statusYour First Commands
Create Entities
# Create a business
do $.Business.create({
name: 'Acme Corp',
industry: 'Technology',
employees: 50
})
# Create a person
do $.Person.create({
name: 'John Doe',
email: '[email protected]',
jobTitle: 'CEO'
})Query Data
# List all businesses
do db.list($.Business)
# Get specific business
do db.get($.Business, 'acme-corp')
# Filter results
do db.list($.Business, { where: { industry: 'Technology' } })Execute AI Operations
# Generate text
do ai.generate('Write a product description for a CRM platform')
# Generate with specific model
do ai.generate({
prompt: 'Explain quantum computing',
model: 'claude-sonnet-4.5'
})
# Create embeddings
do ai.embeddings.create('semantic search query')Integrate APIs
# Stripe
do api.stripe.customers.create({
email: '[email protected]',
name: 'Jane Doe'
})
# SendGrid
do api.sendgrid.sendEmail({
to: '[email protected]',
subject: 'Welcome!',
template: 'welcome-email',
data: { name: 'Jane' }
})
# Slack
do api.slack.postMessage({
channel: '#general',
text: 'Hello from CLI.do!'
})Data Traversals
O*NET Occupations
# Generate lean canvas for all tasks in an occupation
do db.Occupations
.get('15-1252.00')
.tasks
.forEach(task => task.generateLeanCanvas())NAICS Industries
# Analyze high-growth industries
do db.Industries
.filter({ growth: '>10%' })
.map(industry => industry.analyze())Process Chains
# Process all pending orders over $1000
do db.Orders
.filter({ status: 'pending', total: '>1000' })
.forEach(order => {
order.$.Manager.approve()
order.Email.send({ template: 'approval-notification' })
order.Slack.notify({ channel: '#finance' })
})Environment Variables
Set these in your environment or .env file:
# .env
DO_TOKEN=sk_live_xxxxx # API key (recommended)
DO_ADMIN_TOKEN=admin_xxxxx # Admin token (highest priority)
DO_BASE_URL=https://rpc.do # RPC endpointConfiguration Commands
# Set configuration
do config set DO_BASE_URL https://rpc.do
# Get configuration
do config get DO_BASE_URL
# List all configuration
do config listOutput Formats
Default (Plain Text)
$ do db.get($.Business, 'acme-corp')
{ id: 'acme-corp', name: 'Acme Corp', industry: 'Technology' }JSON
$ do db.list($.Business) --json
[{"id":"acme-corp","name":"Acme Corp"}]Pretty JSON
$ do db.list($.Business) --json --pretty
[
{
"id": "acme-corp",
"name": "Acme Corp"
}
]Scripting
Use CLI.do in shell scripts:
#!/bin/bash
# Fetch users and process them
USERS=$(do db.list($.User) --json)
# Parse with jq
echo "$USERS" | jq '.[] | .email'
# Execute for each user
for user in $(echo "$USERS" | jq -r '.[] | @base64'); do
_jq() {
echo ${user} | base64 --decode | jq -r ${1}
}
EMAIL=$(_jq '.email')
do api.sendgrid.sendEmail({ to: "$EMAIL", template: "welcome" })
doneCI/CD Integration
Use in GitHub Actions:
name: Deploy
on: push
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install CLI
run: npm install -g cli.do
- name: Deploy
env:
DO_TOKEN: ${{ secrets.DO_TOKEN }}
run: |
do wf.run('deployToProduction', { version: "${{ github.sha }}" })Troubleshooting
Command Not Found
# Check installation
which do
# Reinstall globally
npm install -g cli.do --force
# Or use npx
npx cli.do [code]Authentication Errors
Error: Authentication requiredSolution: Set your API key or login
export DO_TOKEN=sk_live_xxxxx
# or
do auth loginAPI Connection Issues
# Check API health
do health
# Verify configuration
do config list
# Test with curl
curl https://rpc.do/healthInvalid Syntax
# Make sure to use proper JavaScript/TypeScript syntax
do db.list($.Business) # Correct
# Quotes matter
do $.Business.create({ name: "Acme" }) # Use single quotes in bashNext Steps
- Examples - Real-world usage patterns
- Authentication - Detailed auth setup
- Patterns - Semantic pattern reference
- SDK Reference - Complete SDK documentation