Quick Start
CLI Quick Start
Master the Autohand Code command-line interface in minutes. Learn essential commands and productivity workflows for AI-assisted coding.
Pro Tip: The CLI is perfect for automation, scripting, and headless workflows. Use autohand --help to explore all available commands.
Your First Commands
Start with these essential commands to get familiar with the Autohand Code CLI:
Check Installation
bash
# Install Autohand Code
curl -fsSL https://autohand.ai/install.sh | bash
# Or install with npm
npm install -g autohand-cli
# Check the installed version
autohand --version
# Check runtime, config, tools, and account
autohand doctor
# Show help
autohand --helpAuthentication
bash
# Sign in to your account
autohand login
# Check account and installation status
autohand doctor
# Sign out
autohand logoutQuick Code Generation
bash
# Start an interactive session in your project
cd my-project
autohand
# Run a single instruction and exit
autohand -p "Create a function that validates email addresses in src/utils/email.ts"
# Choose a model for one run
autohand -p "Write a Python function that sorts a list of objects by date" --model your-modelEssential Workflows
Master these common workflows to boost your productivity:
1. Rapid Prototyping
bash
# Create a project folder and describe what you want
mkdir my-project && cd my-project
autohand -p "Create an Express.js server with CORS and middleware in server.js, a package.json, and a React dashboard component in components/Dashboard.jsx"
# Create an AGENTS.md file with project instructions
autohand init
# Install dependencies
npm install
# Start development
npm run dev2. Code Refactoring
bash
# Refactor legacy code
autohand -p "Refactor old-code.js to modern ES modules and async/await"
# Add error handling
autohand -p "Add error handling to app.js"
# Add logging
autohand -p "Add structured logging to service.js"
# Plan a larger change before editing
autohand --plan -p "Plan how to speed up the queries in database.js"3. Test Generation
bash
# Generate unit tests
autohand -p "Write unit tests for user-service.js and run them"
# Generate integration tests
autohand -p "Add integration tests for the routes in api.js"
# Generate test data
autohand -p "Create a fixture file with 100 sample users that match the user schema"4. Documentation Generation
bash
# Generate API documentation
autohand -p "Document the public API in docs/api.md"
# Add code documentation
autohand -p "Add doc comments to the exported functions in src/"
# Generate a README
autohand -p "Write a README.md for this project"
# Generate a changelog
git log v1.0.0..v1.1.0 --oneline | autohand -p "Write a changelog for these commits"Productivity Tips
Use Aliases for Common Commands
bash
# Add to your .bashrc or .zshrc
alias ahp='autohand -p'
alias ahr='autohand --restricted -p'
# Usage
ahp "Create a React Button component in Button.jsx"
ahr "Explain what utils.js does"Pipe Mode for Workflows
bash
# Pipe a file into a prompt
cat requirements.txt | autohand -p "Create an installation script for these requirements"
# Review recent changes
git diff | autohand -p "Review this diff for bugs"
# Work on the files changed most recently
git diff --name-only | head -5 | autohand -p "Modernize the syntax in these files"Batch Operations
bash
# Process a directory
autohand -p "Refactor the files in src/legacy to modern syntax"
# Generate tests for a directory
autohand -p "Add unit tests for every module in src/ that has none"
# Run a longer task in an autonomous loop with limits
autohand --auto-mode "Document every module in the project" --max-iterations 20 --max-cost 5Configuration Files
bash
# Open the settings menu
autohand config
# Use a different model for one run
autohand --model your-model -p "Summarize this project"
# Use a specific config file
autohand --config .autohand/config.json
# Show current permission settings
autohand --permissionsCommand Reference
Core Commands
| Command | Description | Example |
|---|---|---|
-p, --prompt |
Run one instruction and exit | autohand -p "Create an API server" |
--plan |
Start in read-only plan mode | autohand --plan |
--auto-mode |
Run an autonomous loop with limits | autohand --auto-mode "Add unit tests" |
review |
Run Autohand Review | autohand review changes --base main |
init |
Create an AGENTS.md file | autohand init |
resume |
Resume a saved session | autohand resume |
Utility Commands
| Command | Description | Example |
|---|---|---|
doctor |
Check the installation and account | autohand doctor |
config |
Manage configuration | autohand config |
sessions |
List saved sessions | autohand sessions |
mcp |
Manage MCP servers | autohand mcp |
update |
Update the CLI | autohand update |
Advanced Features
Reusable Skills
bash
# Analyze the project and install recommended skills
autohand --learn
# Browse and install a community skill
autohand --skill-install
# Use a skill in a single instruction
autohand -p "Use the frontend-ui skill to create a Button component"Integration with Git
bash
# Write a commit message for staged changes
git diff --staged | autohand -p "Write a conventional commit message for these changes"
# Write a pull request description
git log main..HEAD --oneline | autohand -p "Write a pull request description for these commits"
# Review the changes on this branch
autohand review changes --base main
# Commit with a generated message after lint and tests pass
autohand -c -p "Fix the lint errors in src/"Headless Mode
On a machine where you signed in with autohand login, command mode needs no extra setup. CI runners and containers have no stored sign-in, so they use an API key with --bare. See Authenticate in CI and containers.
# Run one instruction in command mode
autohand -p "Create a test suite for src/" --yes
# CI runner or container: authenticate with an API key and --bare
export AUTOHAND_PROVIDER=autohandai
export AUTOHAND_API_KEY=your_key
export AUTOHAND_AI_API_KEY="$AUTOHAND_API_KEY"
autohand --bare -p "Refactor the code in src/"
# Write JSON Lines events to a log
autohand -p "Generate API docs in docs/api.md" --output-format stream-json > run.jsonlCommon Issues
Command Not Found
# Check if autohand is in PATH
which autohand
# Add to PATH (temporary)
export PATH="$HOME/.local/bin:$PATH"
# Add to PATH permanently (zsh)
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
source ~/.zshrcAuthentication Errors
# Check account and installation status
autohand doctor
# Re-authenticate
autohand logout
autohand login
# Use an API key on a machine without a sign-in (requires --bare)
export AUTOHAND_PROVIDER=autohandai
export AUTOHAND_API_KEY=your_api_key
export AUTOHAND_AI_API_KEY="$AUTOHAND_API_KEY"
autohand --bare -p "Say hello"Slow Performance
# Check the installation
autohand doctor
# Use a faster model for one run
autohand --model your-fast-model -p "Summarize this file"
# Update the CLI and model catalog
autohand updateNext Steps
Now that you're comfortable with the CLI, explore these advanced topics: