mirror of
https://github.com/openclaw/openclaw.git
synced 2026-02-19 18:39:20 -05:00
Renamed everything to clawdock
This commit is contained in:
committed by
Gustavo Madeira Santana
parent
4da2e24d5c
commit
3715b9671c
@@ -1,140 +1,111 @@
|
||||
# OpenClaw Shell Helpers <!-- omit in toc -->
|
||||
# ClawDock <!-- omit in toc -->
|
||||
|
||||
User-friendly shell commands for managing OpenClaw Docker containers. These helpers make it easy to start, stop, configure, and interact with OpenClaw without memorizing complex docker-compose commands.
|
||||
Stop typing `docker-compose` commands. Just type `clawdock-start`.
|
||||
|
||||
- [Features](#features)
|
||||
- [Quick Start](#quick-start)
|
||||
- [Installation](#installation)
|
||||
- [First Time Setup](#first-time-setup)
|
||||
Inspired by Simon Willison's [Running OpenClaw in Docker](https://til.simonwillison.net/llms/openclaw-docker).
|
||||
|
||||
- [Quickstart](#quickstart)
|
||||
- [Available Commands](#available-commands)
|
||||
- [Basic Operations](#basic-operations)
|
||||
- [Container Access](#container-access)
|
||||
- [Web UI \& Devices](#web-ui--devices)
|
||||
- [Setup \& Configuration](#setup--configuration)
|
||||
- [Maintenance](#maintenance)
|
||||
- [Utilities](#utilities)
|
||||
- [Common Workflows](#common-workflows)
|
||||
- [Check Status and Logs](#check-status-and-logs)
|
||||
- [Restart After Configuration Changes](#restart-after-configuration-changes)
|
||||
- [Access the Dashboard](#access-the-dashboard)
|
||||
- [Set Up WhatsApp Bot](#set-up-whatsapp-bot)
|
||||
- [Troubleshooting Device Pairing](#troubleshooting-device-pairing)
|
||||
- [Fix Token Mismatch Issues](#fix-token-mismatch-issues)
|
||||
- [Troubleshooting](#troubleshooting)
|
||||
- [Commands Not Found](#commands-not-found)
|
||||
- [Token Mismatch Errors](#token-mismatch-errors)
|
||||
- [Permission Denied](#permission-denied)
|
||||
- [Container Not Starting](#container-not-starting)
|
||||
- [Requirements](#requirements)
|
||||
- [Contributing](#contributing)
|
||||
- [License](#license)
|
||||
- [Support](#support)
|
||||
|
||||
## Features
|
||||
## Quickstart
|
||||
|
||||
✨ **Simple Commands** - Intuitive names like `openclaw-start`, `openclaw-stop`, `openclaw-dashboard`
|
||||
🎨 **Beautiful Output** - Colorful, emoji-rich terminal output with clear guidance
|
||||
🔧 **Auto-Configuration** - Helpers guide you through setup and troubleshooting
|
||||
🚀 **Fast Onboarding** - Get started with OpenClaw in minutes
|
||||
📖 **Self-Documenting** - Run `openclaw-help` anytime to see available commands
|
||||
|
||||
## Quick Start
|
||||
|
||||
### Installation
|
||||
|
||||
**Add to your shell config (`~/.zshrc` or `~/.bashrc`):**
|
||||
**Try it out:**
|
||||
|
||||
```bash
|
||||
source /path/to/openclaw/scripts/shell-helpers/openclaw-helpers.sh
|
||||
source <(curl -sL https://raw.githubusercontent.com/openclaw/openclaw/main/scripts/shell-helpers/clawdock-helpers.sh)
|
||||
```
|
||||
|
||||
**Reload your shell:**
|
||||
**Make it permanent:**
|
||||
|
||||
```bash
|
||||
source ~/.zshrc
|
||||
echo 'source <(curl -sL https://raw.githubusercontent.com/openclaw/openclaw/main/scripts/shell-helpers/clawdock-helpers.sh)' >> ~/.zshrc
|
||||
```
|
||||
|
||||
### First Time Setup
|
||||
|
||||
**Start the gateway:**
|
||||
**See what you get:**
|
||||
|
||||
```bash
|
||||
openclaw-start
|
||||
clawdock-help
|
||||
```
|
||||
|
||||
**Configure authentication token:**
|
||||
**First time setup:**
|
||||
|
||||
```bash
|
||||
openclaw-fix-token
|
||||
```
|
||||
|
||||
**Open the web dashboard:**
|
||||
|
||||
```bash
|
||||
openclaw-dashboard
|
||||
```
|
||||
|
||||
**If you see "pairing required", approve devices:**
|
||||
|
||||
```bash
|
||||
openclaw-devices
|
||||
clawdock-start
|
||||
```
|
||||
|
||||
```bash
|
||||
openclaw-approve <request-id>
|
||||
clawdock-fix-token
|
||||
```
|
||||
|
||||
**Set up WhatsApp (optional):**
|
||||
|
||||
```bash
|
||||
openclaw-shell
|
||||
clawdock-dashboard
|
||||
```
|
||||
|
||||
Then inside the container:
|
||||
If you see "pairing required":
|
||||
|
||||
```bash
|
||||
openclaw channels login --channel whatsapp
|
||||
clawdock-devices
|
||||
```
|
||||
|
||||
```bash
|
||||
clawdock-approve <request-id>
|
||||
```
|
||||
|
||||
## Available Commands
|
||||
|
||||
### Basic Operations
|
||||
|
||||
- `openclaw-start` - Start the OpenClaw gateway
|
||||
- `openclaw-stop` - Stop the gateway
|
||||
- `openclaw-restart` - Restart the gateway
|
||||
- `openclaw-status` - Check container status
|
||||
- `openclaw-logs` - View live logs (follows output)
|
||||
| Command | Description |
|
||||
|---------|-------------|
|
||||
| `clawdock-start` | Start the gateway |
|
||||
| `clawdock-stop` | Stop the gateway |
|
||||
| `clawdock-restart` | Restart the gateway |
|
||||
| `clawdock-status` | Check container status |
|
||||
| `clawdock-logs` | View live logs (follows output) |
|
||||
|
||||
### Container Access
|
||||
|
||||
- `openclaw-shell` - Interactive shell inside the gateway container
|
||||
- `openclaw-cli <command>` - Run OpenClaw CLI commands
|
||||
- `openclaw-exec <command>` - Execute arbitrary commands in the container
|
||||
| Command | Description |
|
||||
|---------|-------------|
|
||||
| `clawdock-shell` | Interactive shell inside the gateway container |
|
||||
| `clawdock-cli <command>` | Run OpenClaw CLI commands |
|
||||
| `clawdock-exec <command>` | Execute arbitrary commands in the container |
|
||||
|
||||
### Web UI & Devices
|
||||
|
||||
- `openclaw-dashboard` - Open web UI in browser with authentication
|
||||
- `openclaw-devices` - List device pairing requests
|
||||
- `openclaw-approve <id>` - Approve a device pairing request
|
||||
| Command | Description |
|
||||
|---------|-------------|
|
||||
| `clawdock-dashboard` | Open web UI in browser with authentication |
|
||||
| `clawdock-devices` | List device pairing requests |
|
||||
| `clawdock-approve <id>` | Approve a device pairing request |
|
||||
|
||||
### Setup & Configuration
|
||||
|
||||
- `openclaw-fix-token` - Configure gateway authentication token (run once after setup)
|
||||
| Command | Description |
|
||||
|---------|-------------|
|
||||
| `clawdock-fix-token` | Configure gateway authentication token (run once) |
|
||||
|
||||
### Maintenance
|
||||
|
||||
- `openclaw-rebuild` - Rebuild the Docker image
|
||||
- `openclaw-clean` - ⚠️ Remove all containers and volumes (destructive!)
|
||||
| Command | Description |
|
||||
|---------|-------------|
|
||||
| `clawdock-rebuild` | Rebuild the Docker image |
|
||||
| `clawdock-clean` | Remove all containers and volumes (destructive!) |
|
||||
|
||||
### Utilities
|
||||
|
||||
- `openclaw-health` - Run gateway health check
|
||||
- `openclaw-token` - Display the gateway authentication token
|
||||
- `openclaw-cd` - Jump to the OpenClaw project directory
|
||||
- `openclaw-config` - Open the OpenClaw config directory
|
||||
- `openclaw-workspace` - Open the workspace directory
|
||||
- `openclaw-help` - Show all available commands with examples
|
||||
| Command | Description |
|
||||
|---------|-------------|
|
||||
| `clawdock-health` | Run gateway health check |
|
||||
| `clawdock-token` | Display the gateway authentication token |
|
||||
| `clawdock-cd` | Jump to the OpenClaw project directory |
|
||||
| `clawdock-config` | Open the OpenClaw config directory |
|
||||
| `clawdock-workspace` | Open the workspace directory |
|
||||
| `clawdock-help` | Show all available commands with examples |
|
||||
|
||||
## Common Workflows
|
||||
|
||||
@@ -143,13 +114,13 @@ openclaw channels login --channel whatsapp
|
||||
**Check container status:**
|
||||
|
||||
```bash
|
||||
openclaw-status
|
||||
clawdock-status
|
||||
```
|
||||
|
||||
**View live logs:**
|
||||
|
||||
```bash
|
||||
openclaw-logs
|
||||
clawdock-logs
|
||||
```
|
||||
|
||||
### Restart After Configuration Changes
|
||||
@@ -157,29 +128,21 @@ openclaw-logs
|
||||
**Restart the gateway:**
|
||||
|
||||
```bash
|
||||
openclaw-restart
|
||||
clawdock-restart
|
||||
```
|
||||
|
||||
**Watch the logs:**
|
||||
|
||||
```bash
|
||||
openclaw-logs
|
||||
clawdock-logs
|
||||
```
|
||||
|
||||
### Access the Dashboard
|
||||
|
||||
```bash
|
||||
openclaw-dashboard
|
||||
```
|
||||
|
||||
The dashboard will open automatically with the correct authentication token.
|
||||
|
||||
### Set Up WhatsApp Bot
|
||||
|
||||
**Shell into the container:**
|
||||
|
||||
```bash
|
||||
openclaw-shell
|
||||
clawdock-shell
|
||||
```
|
||||
|
||||
**Inside the container, login to WhatsApp:**
|
||||
@@ -201,13 +164,13 @@ openclaw status
|
||||
**Check for pending pairing requests:**
|
||||
|
||||
```bash
|
||||
openclaw-devices
|
||||
clawdock-devices
|
||||
```
|
||||
|
||||
**Copy the Request ID from the "Pending" table, then approve:**
|
||||
|
||||
```bash
|
||||
openclaw-approve 6f9db1bd-a1cc-4d3f-b643-2c195262464e
|
||||
clawdock-approve 6f9db1bd-a1cc-4d3f-b643-2c195262464e
|
||||
```
|
||||
|
||||
Then refresh your browser.
|
||||
@@ -217,11 +180,10 @@ Then refresh your browser.
|
||||
If you see "gateway token mismatch" errors:
|
||||
|
||||
```bash
|
||||
openclaw-fix-token
|
||||
clawdock-fix-token
|
||||
```
|
||||
|
||||
This will:
|
||||
|
||||
1. Read the token from your `.env` file
|
||||
2. Configure it in the OpenClaw config
|
||||
3. Restart the gateway
|
||||
@@ -234,14 +196,18 @@ This will:
|
||||
**Source the helpers file:**
|
||||
|
||||
```bash
|
||||
source /path/to/openclaw/scripts/shell-helpers/openclaw-helpers.sh
|
||||
source <(curl -sL https://raw.githubusercontent.com/openclaw/openclaw/main/scripts/shell-helpers/clawdock-helpers.sh)
|
||||
```
|
||||
|
||||
Add this line to your `~/.zshrc` or `~/.bashrc` for persistence.
|
||||
|
||||
### Token Mismatch Errors
|
||||
|
||||
Run `openclaw-fix-token` to automatically configure the authentication token.
|
||||
**Run the token fixer:**
|
||||
|
||||
```bash
|
||||
clawdock-fix-token
|
||||
```
|
||||
|
||||
### Permission Denied
|
||||
|
||||
@@ -256,11 +222,10 @@ docker ps
|
||||
**Check the logs:**
|
||||
|
||||
```bash
|
||||
openclaw-logs
|
||||
clawdock-logs
|
||||
```
|
||||
|
||||
Common issues:
|
||||
|
||||
- Port 18789 or 18790 already in use
|
||||
- Missing environment variables in `.env`
|
||||
- Docker daemon not running
|
||||
@@ -273,20 +238,10 @@ Common issues:
|
||||
|
||||
## Contributing
|
||||
|
||||
Found a bug or want to add a new helper? Contributions are welcome!
|
||||
Found a bug or want to add a new helper? Contributions welcome!
|
||||
|
||||
1. Test your changes locally
|
||||
2. Ensure helpers work in both bash and zsh
|
||||
3. Follow the existing naming convention (`openclaw-*`)
|
||||
3. Follow the naming convention (`clawdock-*`)
|
||||
4. Add documentation for new commands
|
||||
5. Submit a pull request
|
||||
|
||||
## License
|
||||
|
||||
Same as the OpenClaw project.
|
||||
|
||||
## Support
|
||||
|
||||
- 📚 [OpenClaw Documentation](https://docs.openclaw.ai)
|
||||
- 💬 [Community Discussions](https://github.com/openclaw/openclaw/discussions)
|
||||
- 🐛 [Report Issues](https://github.com/openclaw/openclaw/issues)
|
||||
|
||||
@@ -1,90 +1,90 @@
|
||||
#!/usr/bin/env bash
|
||||
# OpenClaw Shell Helpers
|
||||
# User-friendly shell commands for managing OpenClaw Docker containers
|
||||
# ClawDock - Docker helpers for OpenClaw
|
||||
# Inspired by Simon Willison's "Running OpenClaw in Docker"
|
||||
# https://til.simonwillison.net/llms/openclaw-docker
|
||||
#
|
||||
# Installation:
|
||||
# Source this file from your shell rc file:
|
||||
# echo 'source /path/to/openclaw-helpers.sh' >> ~/.zshrc
|
||||
# source <(curl -sL https://raw.githubusercontent.com/openclaw/openclaw/main/scripts/shell-helpers/clawdock-helpers.sh)
|
||||
#
|
||||
# Usage:
|
||||
# openclaw-help # Show all available commands
|
||||
# clawdock-help # Show all available commands
|
||||
|
||||
# OpenClaw project directory (auto-detect or set manually)
|
||||
OPENCLAW_DIR="${OPENCLAW_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)}"
|
||||
CLAWDOCK_DIR="${CLAWDOCK_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)}"
|
||||
|
||||
# Start openclaw gateway
|
||||
alias openclaw-start="docker compose -f ${OPENCLAW_DIR}/docker-compose.yml up -d openclaw-gateway"
|
||||
alias clawdock-start="docker compose -f ${CLAWDOCK_DIR}/docker-compose.yml up -d openclaw-gateway"
|
||||
|
||||
# Stop openclaw gateway
|
||||
alias openclaw-stop="docker compose -f ${OPENCLAW_DIR}/docker-compose.yml down"
|
||||
alias clawdock-stop="docker compose -f ${CLAWDOCK_DIR}/docker-compose.yml down"
|
||||
|
||||
# Restart openclaw gateway
|
||||
alias openclaw-restart="docker compose -f ${OPENCLAW_DIR}/docker-compose.yml restart openclaw-gateway"
|
||||
alias clawdock-restart="docker compose -f ${CLAWDOCK_DIR}/docker-compose.yml restart openclaw-gateway"
|
||||
|
||||
# View openclaw logs
|
||||
alias openclaw-logs="docker compose -f ${OPENCLAW_DIR}/docker-compose.yml logs -f openclaw-gateway"
|
||||
alias clawdock-logs="docker compose -f ${CLAWDOCK_DIR}/docker-compose.yml logs -f openclaw-gateway"
|
||||
|
||||
# Check openclaw status
|
||||
alias openclaw-status="docker compose -f ${OPENCLAW_DIR}/docker-compose.yml ps"
|
||||
alias clawdock-status="docker compose -f ${CLAWDOCK_DIR}/docker-compose.yml ps"
|
||||
|
||||
# Open openclaw directory
|
||||
alias openclaw-cd="cd ${OPENCLAW_DIR}"
|
||||
alias clawdock-cd="cd ${CLAWDOCK_DIR}"
|
||||
|
||||
# Shell into openclaw container (with openclaw alias pre-configured)
|
||||
openclaw-shell() {
|
||||
docker compose -f "${OPENCLAW_DIR}/docker-compose.yml" exec openclaw-gateway \
|
||||
clawdock-shell() {
|
||||
docker compose -f "${CLAWDOCK_DIR}/docker-compose.yml" exec openclaw-gateway \
|
||||
bash -c 'echo "alias openclaw=\"./openclaw.mjs\"" > /tmp/.bashrc_openclaw && bash --rcfile /tmp/.bashrc_openclaw'
|
||||
}
|
||||
|
||||
# Rebuild openclaw Docker image
|
||||
alias openclaw-rebuild="docker compose -f ${OPENCLAW_DIR}/docker-compose.yml build openclaw-gateway"
|
||||
alias clawdock-rebuild="docker compose -f ${CLAWDOCK_DIR}/docker-compose.yml build openclaw-gateway"
|
||||
|
||||
# Open config directory
|
||||
alias openclaw-config="cd ~/.openclaw"
|
||||
alias clawdock-config="cd ~/.openclaw"
|
||||
|
||||
# Open workspace directory
|
||||
alias openclaw-workspace="cd ~/.openclaw/workspace"
|
||||
alias clawdock-workspace="cd ~/.openclaw/workspace"
|
||||
|
||||
# Clean up containers and volumes (nuclear option)
|
||||
alias openclaw-clean="docker compose -f ${OPENCLAW_DIR}/docker-compose.yml down -v --remove-orphans"
|
||||
alias clawdock-clean="docker compose -f ${CLAWDOCK_DIR}/docker-compose.yml down -v --remove-orphans"
|
||||
|
||||
# Health check
|
||||
openclaw-health() {
|
||||
docker compose -f "${OPENCLAW_DIR}/docker-compose.yml" exec openclaw-gateway \
|
||||
node dist/index.js health --token "$(grep OPENCLAW_GATEWAY_TOKEN ${OPENCLAW_DIR}/.env | cut -d'=' -f2)"
|
||||
clawdock-health() {
|
||||
docker compose -f "${CLAWDOCK_DIR}/docker-compose.yml" exec openclaw-gateway \
|
||||
node dist/index.js health --token "$(grep OPENCLAW_GATEWAY_TOKEN ${CLAWDOCK_DIR}/.env | cut -d'=' -f2)"
|
||||
}
|
||||
|
||||
# Show gateway token
|
||||
openclaw-token() {
|
||||
grep OPENCLAW_GATEWAY_TOKEN "${OPENCLAW_DIR}/.env" | cut -d'=' -f2
|
||||
clawdock-token() {
|
||||
grep OPENCLAW_GATEWAY_TOKEN "${CLAWDOCK_DIR}/.env" | cut -d'=' -f2
|
||||
}
|
||||
|
||||
# Execute command in container
|
||||
openclaw-exec() {
|
||||
docker compose -f "${OPENCLAW_DIR}/docker-compose.yml" exec openclaw-gateway "$@"
|
||||
clawdock-exec() {
|
||||
docker compose -f "${CLAWDOCK_DIR}/docker-compose.yml" exec openclaw-gateway "$@"
|
||||
}
|
||||
|
||||
# Run interactive CLI commands (dedicated CLI container)
|
||||
alias openclaw-cli="docker compose -f ${OPENCLAW_DIR}/docker-compose.yml run --rm openclaw-cli"
|
||||
alias clawdock-cli="docker compose -f ${CLAWDOCK_DIR}/docker-compose.yml run --rm openclaw-cli"
|
||||
|
||||
# Fix token configuration (run this once after setup)
|
||||
openclaw-fix-token() {
|
||||
clawdock-fix-token() {
|
||||
echo "🔧 Configuring gateway token..."
|
||||
local token=$(openclaw-token)
|
||||
local token=$(clawdock-token)
|
||||
if [[ -z "$token" ]]; then
|
||||
echo "❌ Error: Could not find gateway token"
|
||||
echo " Check: ${OPENCLAW_DIR}/.env"
|
||||
echo " Check: ${CLAWDOCK_DIR}/.env"
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo "📝 Setting token: ${token:0:20}..."
|
||||
|
||||
# Set both tokens directly (simpler approach)
|
||||
docker compose -f "${OPENCLAW_DIR}/docker-compose.yml" exec openclaw-gateway \
|
||||
docker compose -f "${CLAWDOCK_DIR}/docker-compose.yml" exec openclaw-gateway \
|
||||
bash -c "./openclaw.mjs config set gateway.remote.token '$token' && ./openclaw.mjs config set gateway.auth.token '$token'" 2>&1 | grep -v "^WARN\|^time="
|
||||
|
||||
echo "🔍 Verifying token was saved..."
|
||||
local saved_token=$(docker compose -f "${OPENCLAW_DIR}/docker-compose.yml" exec openclaw-gateway \
|
||||
local saved_token=$(docker compose -f "${CLAWDOCK_DIR}/docker-compose.yml" exec openclaw-gateway \
|
||||
bash -c "./openclaw.mjs config get gateway.remote.token 2>/dev/null" 2>&1 | grep -v "^WARN\|^time=" | tr -d '\r\n' | head -c 64)
|
||||
|
||||
if [[ "$saved_token" == "$token" ]]; then
|
||||
@@ -96,81 +96,81 @@ openclaw-fix-token() {
|
||||
fi
|
||||
|
||||
echo "🔄 Restarting gateway..."
|
||||
docker compose -f "${OPENCLAW_DIR}/docker-compose.yml" restart openclaw-gateway 2>&1 | grep -v "^WARN\|^time="
|
||||
docker compose -f "${CLAWDOCK_DIR}/docker-compose.yml" restart openclaw-gateway 2>&1 | grep -v "^WARN\|^time="
|
||||
|
||||
echo "⏳ Waiting for gateway to start..."
|
||||
sleep 5
|
||||
|
||||
echo "✅ Configuration complete!"
|
||||
echo " Try: openclaw-devices"
|
||||
echo " Try: clawdock-devices"
|
||||
}
|
||||
|
||||
# Open dashboard in browser
|
||||
openclaw-dashboard() {
|
||||
clawdock-dashboard() {
|
||||
echo "🦞 Getting dashboard URL..."
|
||||
local url=$(docker compose -f "${OPENCLAW_DIR}/docker-compose.yml" run --rm openclaw-cli dashboard --no-open 2>&1 | grep -v "^WARN\|^time=" | grep -o 'http[s]\?://[^[:space:]]*')
|
||||
local url=$(docker compose -f "${CLAWDOCK_DIR}/docker-compose.yml" run --rm openclaw-cli dashboard --no-open 2>&1 | grep -v "^WARN\|^time=" | grep -o 'http[s]\?://[^[:space:]]*')
|
||||
|
||||
if [[ -n "$url" ]]; then
|
||||
echo "✅ Opening: $url"
|
||||
open "$url" 2>/dev/null || xdg-open "$url" 2>/dev/null || echo " Please open manually: $url"
|
||||
echo ""
|
||||
echo "💡 If you see 'pairing required' error:"
|
||||
echo " 1. Run: openclaw-devices"
|
||||
echo " 1. Run: clawdock-devices"
|
||||
echo " 2. Copy the Request ID from the Pending table"
|
||||
echo " 3. Run: openclaw-approve <request-id>"
|
||||
echo " 3. Run: clawdock-approve <request-id>"
|
||||
else
|
||||
echo "❌ Failed to get dashboard URL"
|
||||
echo " Try restarting: openclaw-restart"
|
||||
echo " Try restarting: clawdock-restart"
|
||||
fi
|
||||
}
|
||||
|
||||
# List device pairings
|
||||
openclaw-devices() {
|
||||
clawdock-devices() {
|
||||
echo "🔍 Checking device pairings..."
|
||||
docker compose -f "${OPENCLAW_DIR}/docker-compose.yml" exec openclaw-gateway \
|
||||
docker compose -f "${CLAWDOCK_DIR}/docker-compose.yml" exec openclaw-gateway \
|
||||
node dist/index.js devices list 2>&1 | grep -v "^WARN\|^time="
|
||||
|
||||
local exit_code=$?
|
||||
if [ $exit_code -ne 0 ]; then
|
||||
echo ""
|
||||
echo "💡 If you see token errors above:"
|
||||
echo " 1. Verify token is set: openclaw-token"
|
||||
echo " 1. Verify token is set: clawdock-token"
|
||||
echo " 2. Try manual config inside container:"
|
||||
echo " openclaw-shell"
|
||||
echo " clawdock-shell"
|
||||
echo " openclaw config get gateway.remote.token"
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "💡 To approve a pairing request:"
|
||||
echo " openclaw-approve <request-id>"
|
||||
echo " clawdock-approve <request-id>"
|
||||
}
|
||||
|
||||
# Approve device pairing request
|
||||
openclaw-approve() {
|
||||
clawdock-approve() {
|
||||
if [[ -z "$1" ]]; then
|
||||
echo "❌ Usage: openclaw-approve <request-id>"
|
||||
echo "❌ Usage: clawdock-approve <request-id>"
|
||||
echo ""
|
||||
echo "💡 How to approve a device:"
|
||||
echo " 1. Run: openclaw-devices"
|
||||
echo " 1. Run: clawdock-devices"
|
||||
echo " 2. Find the Request ID in the Pending table (long UUID)"
|
||||
echo " 3. Run: openclaw-approve <that-request-id>"
|
||||
echo " 3. Run: clawdock-approve <that-request-id>"
|
||||
echo ""
|
||||
echo "Example:"
|
||||
echo " openclaw-approve 6f9db1bd-a1cc-4d3f-b643-2c195262464e"
|
||||
echo " clawdock-approve 6f9db1bd-a1cc-4d3f-b643-2c195262464e"
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo "✅ Approving device: $1"
|
||||
docker compose -f "${OPENCLAW_DIR}/docker-compose.yml" exec openclaw-gateway \
|
||||
docker compose -f "${CLAWDOCK_DIR}/docker-compose.yml" exec openclaw-gateway \
|
||||
node dist/index.js devices approve "$1" 2>&1 | grep -v "^WARN\|^time="
|
||||
|
||||
echo ""
|
||||
echo "✅ Device approved! Refresh your browser."
|
||||
}
|
||||
|
||||
# Show all available openclaw helper commands
|
||||
openclaw-help() {
|
||||
# Show all available clawdock helper commands
|
||||
clawdock-help() {
|
||||
# Colors
|
||||
local CYAN='\033[0;36m'
|
||||
local BOLD='\033[1m'
|
||||
@@ -182,65 +182,65 @@ openclaw-help() {
|
||||
local RESET='\033[0m'
|
||||
local DIM='\033[2m'
|
||||
|
||||
echo -e "\n${BOLD}${CYAN}🦞 OpenClaw Helper Commands${RESET}\n"
|
||||
echo -e "\n${BOLD}${CYAN}🦞 ClawDock - Docker Helpers for OpenClaw${RESET}\n"
|
||||
|
||||
echo -e "${BOLD}${MAGENTA}⚡ Basic Operations${RESET}"
|
||||
echo -e " ${BOLD}openclaw-start${RESET} ${DIM}Start the gateway${RESET}"
|
||||
echo -e " ${BOLD}openclaw-stop${RESET} ${DIM}Stop the gateway${RESET}"
|
||||
echo -e " ${BOLD}openclaw-restart${RESET} ${DIM}Restart the gateway${RESET}"
|
||||
echo -e " ${BOLD}openclaw-status${RESET} ${DIM}Check container status${RESET}"
|
||||
echo -e " ${BOLD}openclaw-logs${RESET} ${DIM}View live logs (follows)${RESET}"
|
||||
echo -e " ${BOLD}clawdock-start${RESET} ${DIM}Start the gateway${RESET}"
|
||||
echo -e " ${BOLD}clawdock-stop${RESET} ${DIM}Stop the gateway${RESET}"
|
||||
echo -e " ${BOLD}clawdock-restart${RESET} ${DIM}Restart the gateway${RESET}"
|
||||
echo -e " ${BOLD}clawdock-status${RESET} ${DIM}Check container status${RESET}"
|
||||
echo -e " ${BOLD}clawdock-logs${RESET} ${DIM}View live logs (follows)${RESET}"
|
||||
echo ""
|
||||
|
||||
echo -e "${BOLD}${MAGENTA}🐚 Container Access${RESET}"
|
||||
echo -e " ${BOLD}openclaw-shell${RESET} ${DIM}Shell into container (openclaw alias ready)${RESET}"
|
||||
echo -e " ${BOLD}openclaw-cli${RESET} ${DIM}Run CLI commands (e.g., openclaw-cli status)${RESET}"
|
||||
echo -e " ${BOLD}openclaw-exec${RESET} ${CYAN}<cmd>${RESET} ${DIM}Execute command in gateway container${RESET}"
|
||||
echo -e " ${BOLD}clawdock-shell${RESET} ${DIM}Shell into container (openclaw alias ready)${RESET}"
|
||||
echo -e " ${BOLD}clawdock-cli${RESET} ${DIM}Run CLI commands (e.g., clawdock-cli status)${RESET}"
|
||||
echo -e " ${BOLD}clawdock-exec${RESET} ${CYAN}<cmd>${RESET} ${DIM}Execute command in gateway container${RESET}"
|
||||
echo ""
|
||||
|
||||
echo -e "${BOLD}${MAGENTA}🌐 Web UI & Devices${RESET}"
|
||||
echo -e " ${BOLD}openclaw-dashboard${RESET} ${DIM}Open web UI in browser ${YELLOW}(auto-guides you)${RESET}"
|
||||
echo -e " ${BOLD}openclaw-devices${RESET} ${DIM}List device pairings ${YELLOW}(auto-guides you)${RESET}"
|
||||
echo -e " ${BOLD}openclaw-approve${RESET} ${CYAN}<id>${RESET} ${DIM}Approve device pairing ${YELLOW}(with examples)${RESET}"
|
||||
echo -e " ${BOLD}clawdock-dashboard${RESET} ${DIM}Open web UI in browser ${YELLOW}(auto-guides you)${RESET}"
|
||||
echo -e " ${BOLD}clawdock-devices${RESET} ${DIM}List device pairings ${YELLOW}(auto-guides you)${RESET}"
|
||||
echo -e " ${BOLD}clawdock-approve${RESET} ${CYAN}<id>${RESET} ${DIM}Approve device pairing ${YELLOW}(with examples)${RESET}"
|
||||
echo ""
|
||||
|
||||
echo -e "${BOLD}${MAGENTA}⚙️ Setup & Configuration${RESET}"
|
||||
echo -e " ${BOLD}openclaw-fix-token${RESET} ${DIM}Configure gateway token ${YELLOW}(run once)${RESET}"
|
||||
echo -e " ${BOLD}clawdock-fix-token${RESET} ${DIM}Configure gateway token ${YELLOW}(run once)${RESET}"
|
||||
echo ""
|
||||
|
||||
echo -e "${BOLD}${MAGENTA}🔧 Maintenance${RESET}"
|
||||
echo -e " ${BOLD}openclaw-rebuild${RESET} ${DIM}Rebuild Docker image${RESET}"
|
||||
echo -e " ${BOLD}openclaw-clean${RESET} ${RED}⚠️ Remove containers & volumes (nuclear)${RESET}"
|
||||
echo -e " ${BOLD}clawdock-rebuild${RESET} ${DIM}Rebuild Docker image${RESET}"
|
||||
echo -e " ${BOLD}clawdock-clean${RESET} ${RED}⚠️ Remove containers & volumes (nuclear)${RESET}"
|
||||
echo ""
|
||||
|
||||
echo -e "${BOLD}${MAGENTA}🛠️ Utilities${RESET}"
|
||||
echo -e " ${BOLD}openclaw-health${RESET} ${DIM}Run health check${RESET}"
|
||||
echo -e " ${BOLD}openclaw-token${RESET} ${DIM}Show gateway auth token${RESET}"
|
||||
echo -e " ${BOLD}openclaw-cd${RESET} ${DIM}Jump to openclaw project directory${RESET}"
|
||||
echo -e " ${BOLD}openclaw-config${RESET} ${DIM}Open config directory (~/.openclaw)${RESET}"
|
||||
echo -e " ${BOLD}openclaw-workspace${RESET} ${DIM}Open workspace directory${RESET}"
|
||||
echo -e " ${BOLD}clawdock-health${RESET} ${DIM}Run health check${RESET}"
|
||||
echo -e " ${BOLD}clawdock-token${RESET} ${DIM}Show gateway auth token${RESET}"
|
||||
echo -e " ${BOLD}clawdock-cd${RESET} ${DIM}Jump to openclaw project directory${RESET}"
|
||||
echo -e " ${BOLD}clawdock-config${RESET} ${DIM}Open config directory (~/.openclaw)${RESET}"
|
||||
echo -e " ${BOLD}clawdock-workspace${RESET} ${DIM}Open workspace directory${RESET}"
|
||||
echo ""
|
||||
|
||||
echo -e "${BOLD}${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${RESET}"
|
||||
echo -e "${BOLD}${GREEN}🚀 First Time Setup${RESET}"
|
||||
echo -e "${CYAN} 1.${RESET} ${GREEN}openclaw-start${RESET} ${DIM}# Start the gateway${RESET}"
|
||||
echo -e "${CYAN} 2.${RESET} ${GREEN}openclaw-fix-token${RESET} ${DIM}# Configure token${RESET}"
|
||||
echo -e "${CYAN} 3.${RESET} ${GREEN}openclaw-dashboard${RESET} ${DIM}# Open web UI${RESET}"
|
||||
echo -e "${CYAN} 4.${RESET} ${GREEN}openclaw-devices${RESET} ${DIM}# If pairing needed${RESET}"
|
||||
echo -e "${CYAN} 5.${RESET} ${GREEN}openclaw-approve${RESET} ${CYAN}<id>${RESET} ${DIM}# Approve pairing${RESET}"
|
||||
echo -e "${CYAN} 1.${RESET} ${GREEN}clawdock-start${RESET} ${DIM}# Start the gateway${RESET}"
|
||||
echo -e "${CYAN} 2.${RESET} ${GREEN}clawdock-fix-token${RESET} ${DIM}# Configure token${RESET}"
|
||||
echo -e "${CYAN} 3.${RESET} ${GREEN}clawdock-dashboard${RESET} ${DIM}# Open web UI${RESET}"
|
||||
echo -e "${CYAN} 4.${RESET} ${GREEN}clawdock-devices${RESET} ${DIM}# If pairing needed${RESET}"
|
||||
echo -e "${CYAN} 5.${RESET} ${GREEN}clawdock-approve${RESET} ${CYAN}<id>${RESET} ${DIM}# Approve pairing${RESET}"
|
||||
echo ""
|
||||
|
||||
echo -e "${BOLD}${GREEN}💬 WhatsApp Setup${RESET}"
|
||||
echo -e " ${GREEN}openclaw-shell${RESET}"
|
||||
echo -e " ${GREEN}clawdock-shell${RESET}"
|
||||
echo -e " ${BLUE}>${RESET} ${GREEN}openclaw channels login --channel whatsapp${RESET}"
|
||||
echo -e " ${BLUE}>${RESET} ${GREEN}openclaw status${RESET}"
|
||||
echo ""
|
||||
|
||||
echo -e "${BOLD}${GREEN}📝 Quick Examples${RESET}"
|
||||
echo -e " ${GREEN}openclaw-start${RESET} && ${GREEN}openclaw-logs${RESET}"
|
||||
echo -e " ${GREEN}openclaw-dashboard${RESET}"
|
||||
echo -e " ${GREEN}openclaw-devices${RESET}"
|
||||
echo -e " ${GREEN}openclaw-cli${RESET} ${CYAN}channels login${RESET}"
|
||||
echo -e " ${GREEN}clawdock-start${RESET} && ${GREEN}clawdock-logs${RESET}"
|
||||
echo -e " ${GREEN}clawdock-dashboard${RESET}"
|
||||
echo -e " ${GREEN}clawdock-devices${RESET}"
|
||||
echo -e " ${GREEN}clawdock-cli${RESET} ${CYAN}channels login${RESET}"
|
||||
echo -e "${BOLD}${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${RESET}"
|
||||
echo ""
|
||||
|
||||
@@ -250,6 +250,6 @@ openclaw-help() {
|
||||
}
|
||||
|
||||
# Export functions so they're available in subshells
|
||||
export -f openclaw-shell openclaw-health openclaw-token openclaw-exec
|
||||
export -f openclaw-fix-token openclaw-dashboard openclaw-devices
|
||||
export -f openclaw-approve openclaw-help
|
||||
export -f clawdock-shell clawdock-health clawdock-token clawdock-exec
|
||||
export -f clawdock-fix-token clawdock-dashboard clawdock-devices
|
||||
export -f clawdock-approve clawdock-help
|
||||
@@ -1,52 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# OpenClaw Shell Helpers Installer
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
HELPERS_FILE="$SCRIPT_DIR/openclaw-helpers.sh"
|
||||
|
||||
# Detect shell
|
||||
if [[ -n "${ZSH_VERSION:-}" ]]; then
|
||||
SHELL_RC="$HOME/.zshrc"
|
||||
SHELL_NAME="zsh"
|
||||
elif [[ -n "${BASH_VERSION:-}" ]]; then
|
||||
SHELL_RC="$HOME/.bashrc"
|
||||
SHELL_NAME="bash"
|
||||
else
|
||||
echo "⚠️ Could not detect shell type. Please source manually:"
|
||||
echo " source $HELPERS_FILE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "🦞 OpenClaw Shell Helpers Installer"
|
||||
echo ""
|
||||
echo "Detected shell: $SHELL_NAME"
|
||||
echo "Config file: $SHELL_RC"
|
||||
echo ""
|
||||
|
||||
# Check if already installed
|
||||
if grep -q "openclaw-helpers.sh" "$SHELL_RC" 2>/dev/null; then
|
||||
echo "✅ Helpers already installed in $SHELL_RC"
|
||||
echo ""
|
||||
echo "To reload:"
|
||||
echo " source $SHELL_RC"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Add to shell config
|
||||
echo "📝 Adding helpers to $SHELL_RC..."
|
||||
cat >> "$SHELL_RC" << EOF
|
||||
|
||||
# OpenClaw Shell Helpers
|
||||
source "$HELPERS_FILE"
|
||||
EOF
|
||||
|
||||
echo "✅ Installation complete!"
|
||||
echo ""
|
||||
echo "To use the helpers now, run:"
|
||||
echo " source $SHELL_RC"
|
||||
echo ""
|
||||
echo "Or open a new terminal window."
|
||||
echo ""
|
||||
echo "To see available commands:"
|
||||
echo " openclaw-help"
|
||||
Reference in New Issue
Block a user