Skip to Content
DocsCLI Reference

CLI Reference

Complete reference for the happy command line interface.

Basic Usage

happy [options] [-- claude-code-args]

Start Happy Coder with default settings:

happy

Common Commands

Start a Session

# Basic start happy # With project directory happy --dir ~/projects/my-app # With session name happy --session-name "backend-api" # With custom port happy --port 8766

View Sessions

# List active sessions happy list # Show session details happy info --session-id abc123

Health Check

# Check if everything works happy doctor # Test Claude Code integration happy test

Options

Connection Options

OptionDescriptionDefault
--port PORTLocal port for connections8765
--host HOSTLocal host to bindlocalhost
--server URLCustom relay server URLrelay.happy.engineering
--no-relayDirect connection (LAN only)false

Examples:

# Custom port happy --port 9000 # Custom relay server happy --server https://relay.mycompany.com # LAN-only mode happy --no-relay --host 0.0.0.0

Session Options

OptionDescriptionDefault
--session-name NAMEName for this sessionRandom
--session-id IDResume existing sessionNone
--dir PATHWorking directoryCurrent dir
--headlessNo terminal UIfalse

Examples:

# Named session happy --session-name "feature-branch" # Resume session happy --session-id abc123def456 # Headless for CI/CD happy --headless --session-name "ci-build"

Claude Code Options

OptionDescriptionDefault
--claude-path PATHPath to Claude Code binaryAuto-detect
--model MODELAI model to useopus-4.1
--max-tokens NUMMax tokens per response8000
--agent NAMEStart with specific agentNone
--mcp-config PATHMCP tools config file~/.claude/mcp.json

Examples:

# Specific Claude Code binary happy --claude-path /usr/local/bin/claude-code # Use different model happy --model sonnet-4 # Start with agent happy --agent bedtime # Custom MCP config happy --mcp-config ~/work-mcp-tools.json

Security Options

OptionDescriptionDefault
--encryption ALGOEncryption algorithmaes-256-gcm
--key-size BITSEncryption key size256
--no-qrShow text code instead of QRfalse
--require-authRequire authenticationfalse

Examples:

# Text code for manual entry happy --no-qr # Require authentication happy --require-auth

Display Options

OptionDescriptionDefault
--verboseVerbose outputfalse
--quietMinimal outputfalse
--no-colorDisable colored outputfalse
--jsonJSON output formatfalse

Examples:

# Debug mode happy --verbose # Quiet mode for scripts happy --quiet --json

Passing Arguments to Claude Code

Everything after -- goes to Claude Code:

# Pass model and token settings happy -- --model opus-4.1 --max-tokens 10000 # Pass a specific task happy -- "refactor the auth system" # Combine Happy and Claude options happy --port 9000 -- --model sonnet-4 --verbose

Environment Variables

Configure Happy via environment variables:

VariableDescriptionExample
HAPPY_SERVER_URLDefault relay serverhttps://relay.company.com
HAPPY_PORTDefault port8766
HAPPY_SESSION_NAMEDefault session namedev-session
HAPPY_CLAUDE_PATHClaude Code binary path/usr/local/bin/claude-code
HAPPY_TELEMETRYEnable/disable telemetryfalse
HAPPY_LOG_LEVELLog verbositydebug

Examples:

# Set default server export HAPPY_SERVER_URL="https://relay.mycompany.com" happy # Uses company relay # Disable telemetry export HAPPY_TELEMETRY=false # Debug logging export HAPPY_LOG_LEVEL=debug happy

Configuration Files

Happy reads config from (in priority order):

  1. Command line arguments
  2. Environment variables
  3. .happyrc in current directory
  4. ~/.config/happy/config.json

Project Config (.happyrc)

{ "server": "https://relay.company.com", "port": 8766, "session_name": "my-project", "claude_args": ["--model", "opus-4.1"], "mcp_config": "./project-mcp.json" }

Global Config (~/.config/happy/config.json)

{ "server": "https://relay.happy.engineering", "encryption": "aes-256-gcm", "telemetry": false, "theme": "dark", "notifications": true }

Subcommands

happy list

List all active sessions:

happy list [options] Options: --all Show all sessions (including inactive) --json Output as JSON --verbose Show detailed info

happy info

Show session details:

happy info [options] Options: --session-id Session to inspect (required) --json Output as JSON

happy kill

Terminate a session:

happy kill [options] Options: --session-id Session to kill (required) --all Kill all sessions --force Force kill without confirmation

happy doctor

Check system health:

happy doctor [options] Options: --verbose Show detailed diagnostics --fix Attempt to fix issues

Output:

✓ Node.js 18.0.0 ✓ Claude Code detected ✓ Network accessible ✓ Encryption working ✓ Relay server reachable

happy config

Manage configuration:

# Show current config happy config show # Set a value happy config set server https://relay.company.com # Get a value happy config get server # Reset to defaults happy config reset

happy logs

View session logs:

happy logs [options] Options: --session-id Session to view (default: current) --tail Follow log output --lines N Show last N lines --grep PATTERN Filter logs

Advanced Usage

Running in CI/CD

# GitHub Actions example - name: Run Claude Code Analysis run: | happy --headless \ --session-name "pr-${{ github.event.number }}" \ -- "review this PR and suggest improvements"

Multiple Concurrent Sessions

# Terminal 1: Frontend happy --port 8765 --session-name frontend # Terminal 2: Backend happy --port 8766 --session-name backend # Terminal 3: Database happy --port 8767 --session-name database

Scripting with Happy

#!/bin/bash # Start Happy in background happy --headless --session-name batch & HAPPY_PID=$! # Wait for connection sleep 5 # Send commands via API curl -X POST http://localhost:8765/api/message \ -d '{"text": "generate tests for user.js"}' # Cleanup kill $HAPPY_PID

Docker Usage

# Run in container docker run -it \ -v $(pwd):/workspace \ -p 8765:8765 \ happycoder/cli \ --dir /workspace # With docker-compose services: happy: image: happycoder/cli ports: - "8765:8765" volumes: - .:/workspace command: --dir /workspace --headless

Troubleshooting Commands

Debug Connection Issues

# Verbose connection logs happy --verbose --log-level debug # Test relay server curl https://relay.happy.engineering/health # Check local port lsof -i :8765

Reset Everything

# Kill all sessions happy kill --all # Clear config happy config reset # Remove all data rm -rf ~/.config/happy rm -rf ~/.happy

Performance Tuning

# Increase message buffer happy --buffer-size 10000 # Reduce encryption overhead (less secure) happy --encryption aes-128-gcm # Optimize for slow networks happy --compression gzip

Exit Codes

Happy uses standard exit codes:

CodeMeaning
0Success
1General error
2Invalid arguments
3Claude Code not found
4Port already in use
5Network error
6Authentication failed
7Session not found

Use in scripts:

if happy test; then echo "Happy Coder is working!" else echo "Something's wrong, exit code: $?" fi

Getting Help

# Show help happy --help # Show version happy --version # Show detailed command help happy [command] --help

For more help:

Last updated on