mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-03 03:03:24 -04:00
feat: add shell helpers for OpenClaw development
Add interactive shell helper scripts to streamline local development: - openclaw-helpers.sh: Zsh functions for repo navigation, running nodes, wallet management, and log tailing - install.sh: Installer script that backs up existing config and sources helpers from .zshrc - README.md: Documentation for available commands - NEXT_STEPS.md: Community contribution checklist Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
committed by
Gustavo Madeira Santana
parent
a6187b568c
commit
33b717e885
130
scripts/shell-helpers/NEXT_STEPS.md
Normal file
130
scripts/shell-helpers/NEXT_STEPS.md
Normal file
@@ -0,0 +1,130 @@
|
||||
# Next Steps for OpenClaw Shell Helpers
|
||||
|
||||
## ✅ What We Built:
|
||||
|
||||
```
|
||||
scripts/shell-helpers/
|
||||
├── README.md # Comprehensive documentation
|
||||
├── openclaw-helpers.sh # Main helper commands
|
||||
├── install.sh # Easy installation script
|
||||
└── NEXT_STEPS.md # This file
|
||||
```
|
||||
|
||||
## 📦 Package Contents:
|
||||
|
||||
1. **20+ Helper Commands** - All the commands we created
|
||||
2. **Beautiful CLI** - Colorful, emoji-rich output
|
||||
3. **Auto-Configuration** - `openclaw-fix-token` and more
|
||||
4. **Self-Documenting** - `openclaw-help` command
|
||||
5. **Installation Script** - One-line install
|
||||
6. **Full Documentation** - README with examples
|
||||
|
||||
## 🚀 Next Steps:
|
||||
|
||||
### Option A: Create a Pull Request (Recommended)
|
||||
|
||||
```bash
|
||||
# 1. Create a new branch
|
||||
git checkout -b feat/shell-helpers
|
||||
|
||||
# 2. Add the files
|
||||
git add scripts/shell-helpers/
|
||||
|
||||
# 3. Commit
|
||||
git commit -m "feat: add shell helpers for easier Docker management
|
||||
|
||||
- User-friendly commands (openclaw-start, openclaw-stop, etc.)
|
||||
- Colorful CLI with helpful guidance
|
||||
- Auto-configuration for tokens and devices
|
||||
- Installation script for easy setup
|
||||
- Comprehensive documentation
|
||||
|
||||
Closes #[issue-number-if-exists]"
|
||||
|
||||
# 4. Push to your fork (or create one first)
|
||||
git push origin feat/shell-helpers
|
||||
|
||||
# 5. Open a PR on GitHub
|
||||
```
|
||||
|
||||
### Option B: Test First, PR Later
|
||||
|
||||
```bash
|
||||
# Test the helpers locally
|
||||
source scripts/shell-helpers/openclaw-helpers.sh
|
||||
openclaw-help
|
||||
openclaw-status
|
||||
|
||||
# Once happy, create the PR (Option A)
|
||||
```
|
||||
|
||||
### Option C: Share as Gist/Blog Post
|
||||
|
||||
If you want community feedback first before PRing to the official repo.
|
||||
|
||||
## 🎯 Recommendation
|
||||
|
||||
**Test it first** to make sure everything works, then create a PR.
|
||||
|
||||
## 📝 PR Description Template
|
||||
|
||||
When creating the PR, you can use this template:
|
||||
|
||||
---
|
||||
|
||||
**Title:** Add shell helpers for easier OpenClaw Docker management
|
||||
|
||||
**Description:**
|
||||
|
||||
This PR adds user-friendly shell helpers that make it easier to manage OpenClaw Docker containers without memorizing complex docker-compose commands.
|
||||
|
||||
### Features
|
||||
|
||||
- ✨ 20+ intuitive commands (`openclaw-start`, `openclaw-stop`, `openclaw-dashboard`, etc.)
|
||||
- 🎨 Beautiful, colorful CLI output with emojis and clear guidance
|
||||
- 🔧 Auto-configuration helpers (`openclaw-fix-token`)
|
||||
- 🌐 Web UI and device pairing helpers
|
||||
- 📖 Self-documenting (`openclaw-help`)
|
||||
- 🚀 Easy installation script
|
||||
|
||||
### Why This Matters
|
||||
|
||||
- **Lowers barrier to entry** - New users can get started quickly
|
||||
- **Better UX** - No need to remember docker-compose syntax
|
||||
- **Reduces support burden** - Built-in troubleshooting guidance
|
||||
- **Community contribution** - Makes OpenClaw more accessible
|
||||
|
||||
### Installation
|
||||
|
||||
```bash
|
||||
source scripts/shell-helpers/openclaw-helpers.sh
|
||||
openclaw-help
|
||||
```
|
||||
|
||||
Or use the installer:
|
||||
|
||||
```bash
|
||||
./scripts/shell-helpers/install.sh
|
||||
```
|
||||
|
||||
### Testing
|
||||
|
||||
Tested on:
|
||||
- macOS with zsh
|
||||
- [Add other platforms you test on]
|
||||
|
||||
---
|
||||
|
||||
## 🤔 Questions to Consider
|
||||
|
||||
Before submitting the PR, you might want to:
|
||||
|
||||
1. **Test on different platforms** (Linux, macOS, different shells)
|
||||
2. **Check if there's an existing issue** requesting this feature
|
||||
3. **Review CONTRIBUTING.md** in the repo for any specific guidelines
|
||||
4. **Consider adding tests** if the project has a testing framework
|
||||
5. **Update main README** to mention the helpers (optional)
|
||||
|
||||
## 📞 Need Help?
|
||||
|
||||
If you need assistance with any of these steps, feel free to ask! 🦞
|
||||
217
scripts/shell-helpers/README.md
Normal file
217
scripts/shell-helpers/README.md
Normal file
@@ -0,0 +1,217 @@
|
||||
# OpenClaw Shell Helpers
|
||||
|
||||
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.
|
||||
|
||||
## Features
|
||||
|
||||
✨ **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 configuration file (`~/.zshrc` or `~/.bashrc`):
|
||||
|
||||
```bash
|
||||
# Add this line to your ~/.zshrc or ~/.bashrc
|
||||
source /path/to/openclaw/scripts/shell-helpers/openclaw-helpers.sh
|
||||
```
|
||||
|
||||
Then reload your shell:
|
||||
|
||||
```bash
|
||||
source ~/.zshrc # or source ~/.bashrc
|
||||
```
|
||||
|
||||
### First Time Setup
|
||||
|
||||
```bash
|
||||
# 1. Start the gateway
|
||||
openclaw-start
|
||||
|
||||
# 2. Configure authentication token
|
||||
openclaw-fix-token
|
||||
|
||||
# 3. Open the web dashboard
|
||||
openclaw-dashboard
|
||||
|
||||
# 4. If you see "pairing required", approve devices
|
||||
openclaw-devices
|
||||
openclaw-approve <request-id>
|
||||
|
||||
# 5. Set up WhatsApp (optional)
|
||||
openclaw-shell
|
||||
> openclaw channels login --channel whatsapp
|
||||
```
|
||||
|
||||
## 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)
|
||||
|
||||
### 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
|
||||
|
||||
### 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
|
||||
|
||||
### Setup & Configuration
|
||||
|
||||
- `openclaw-fix-token` - Configure gateway authentication token (run once after setup)
|
||||
|
||||
### Maintenance
|
||||
|
||||
- `openclaw-rebuild` - Rebuild the Docker image
|
||||
- `openclaw-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
|
||||
|
||||
## Common Workflows
|
||||
|
||||
### Check Status and Logs
|
||||
|
||||
```bash
|
||||
openclaw-status
|
||||
openclaw-logs
|
||||
```
|
||||
|
||||
### Restart After Configuration Changes
|
||||
|
||||
```bash
|
||||
openclaw-restart
|
||||
openclaw-logs
|
||||
```
|
||||
|
||||
### Access the Dashboard
|
||||
|
||||
```bash
|
||||
openclaw-dashboard
|
||||
```
|
||||
|
||||
The dashboard will open automatically with the correct authentication token.
|
||||
|
||||
### Set Up WhatsApp Bot
|
||||
|
||||
```bash
|
||||
# 1. Shell into the container
|
||||
openclaw-shell
|
||||
|
||||
# 2. Inside the container, login to WhatsApp
|
||||
openclaw channels login --channel whatsapp --verbose
|
||||
|
||||
# 3. Scan the QR code with WhatsApp on your phone
|
||||
# 4. Verify connection
|
||||
openclaw status
|
||||
```
|
||||
|
||||
### Troubleshooting Device Pairing
|
||||
|
||||
```bash
|
||||
# 1. Check for pending pairing requests
|
||||
openclaw-devices
|
||||
|
||||
# 2. Copy the Request ID from the "Pending" table
|
||||
# 3. Approve the request
|
||||
openclaw-approve 6f9db1bd-a1cc-4d3f-b643-2c195262464e
|
||||
|
||||
# 4. Refresh your browser
|
||||
```
|
||||
|
||||
### Fix Token Mismatch Issues
|
||||
|
||||
If you see "gateway token mismatch" errors:
|
||||
|
||||
```bash
|
||||
openclaw-fix-token
|
||||
```
|
||||
|
||||
This will:
|
||||
1. Read the token from your `.env` file
|
||||
2. Configure it in the OpenClaw config
|
||||
3. Restart the gateway
|
||||
4. Verify the configuration
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Commands Not Found
|
||||
|
||||
Make sure you've sourced the helpers file:
|
||||
|
||||
```bash
|
||||
source /path/to/openclaw/scripts/shell-helpers/openclaw-helpers.sh
|
||||
```
|
||||
|
||||
Add it to your `~/.zshrc` or `~/.bashrc` for persistence.
|
||||
|
||||
### Token Mismatch Errors
|
||||
|
||||
Run `openclaw-fix-token` to automatically configure the authentication token.
|
||||
|
||||
### Permission Denied
|
||||
|
||||
Ensure Docker is running and you have permission to use it:
|
||||
|
||||
```bash
|
||||
docker ps
|
||||
```
|
||||
|
||||
### Container Not Starting
|
||||
|
||||
Check the logs:
|
||||
|
||||
```bash
|
||||
openclaw-logs
|
||||
```
|
||||
|
||||
Common issues:
|
||||
- Port 18789 or 18790 already in use
|
||||
- Missing environment variables in `.env`
|
||||
- Docker daemon not running
|
||||
|
||||
## Requirements
|
||||
|
||||
- Docker and Docker Compose installed
|
||||
- Bash or Zsh shell
|
||||
- OpenClaw project (from `docker-setup.sh`)
|
||||
|
||||
## Contributing
|
||||
|
||||
Found a bug or want to add a new helper? Contributions are welcome!
|
||||
|
||||
1. Test your changes locally
|
||||
2. Ensure helpers work in both bash and zsh
|
||||
3. Follow the existing naming convention (`openclaw-*`)
|
||||
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)
|
||||
52
scripts/shell-helpers/install.sh
Executable file
52
scripts/shell-helpers/install.sh
Executable file
@@ -0,0 +1,52 @@
|
||||
#!/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"
|
||||
255
scripts/shell-helpers/openclaw-helpers.sh
Executable file
255
scripts/shell-helpers/openclaw-helpers.sh
Executable file
@@ -0,0 +1,255 @@
|
||||
#!/usr/bin/env bash
|
||||
# OpenClaw Shell Helpers
|
||||
# User-friendly shell commands for managing OpenClaw Docker containers
|
||||
#
|
||||
# Installation:
|
||||
# Source this file from your shell rc file:
|
||||
# echo 'source /path/to/openclaw-helpers.sh' >> ~/.zshrc
|
||||
#
|
||||
# Usage:
|
||||
# openclaw-help # Show all available commands
|
||||
|
||||
# OpenClaw project directory (auto-detect or set manually)
|
||||
OPENCLAW_DIR="${OPENCLAW_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"
|
||||
|
||||
# Stop openclaw gateway
|
||||
alias openclaw-stop="docker compose -f ${OPENCLAW_DIR}/docker-compose.yml down"
|
||||
|
||||
# Restart openclaw gateway
|
||||
alias openclaw-restart="docker compose -f ${OPENCLAW_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"
|
||||
|
||||
# Check openclaw status
|
||||
alias openclaw-status="docker compose -f ${OPENCLAW_DIR}/docker-compose.yml ps"
|
||||
|
||||
# Open openclaw directory
|
||||
alias openclaw-cd="cd ${OPENCLAW_DIR}"
|
||||
|
||||
# Shell into openclaw container (with openclaw alias pre-configured)
|
||||
openclaw-shell() {
|
||||
docker compose -f "${OPENCLAW_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"
|
||||
|
||||
# Open config directory
|
||||
alias openclaw-config="cd ~/.openclaw"
|
||||
|
||||
# Open workspace directory
|
||||
alias openclaw-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"
|
||||
|
||||
# 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)"
|
||||
}
|
||||
|
||||
# Show gateway token
|
||||
openclaw-token() {
|
||||
grep OPENCLAW_GATEWAY_TOKEN "${OPENCLAW_DIR}/.env" | cut -d'=' -f2
|
||||
}
|
||||
|
||||
# Execute command in container
|
||||
openclaw-exec() {
|
||||
docker compose -f "${OPENCLAW_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"
|
||||
|
||||
# Fix token configuration (run this once after setup)
|
||||
openclaw-fix-token() {
|
||||
echo "🔧 Configuring gateway token..."
|
||||
local token=$(openclaw-token)
|
||||
if [[ -z "$token" ]]; then
|
||||
echo "❌ Error: Could not find gateway token"
|
||||
echo " Check: ${OPENCLAW_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 \
|
||||
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 \
|
||||
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
|
||||
echo "✅ Token saved correctly!"
|
||||
else
|
||||
echo "⚠️ Token mismatch detected"
|
||||
echo " Expected: ${token:0:20}..."
|
||||
echo " Got: ${saved_token:0:20}..."
|
||||
fi
|
||||
|
||||
echo "🔄 Restarting gateway..."
|
||||
docker compose -f "${OPENCLAW_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"
|
||||
}
|
||||
|
||||
# Open dashboard in browser
|
||||
openclaw-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:]]*')
|
||||
|
||||
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 " 2. Copy the Request ID from the Pending table"
|
||||
echo " 3. Run: openclaw-approve <request-id>"
|
||||
else
|
||||
echo "❌ Failed to get dashboard URL"
|
||||
echo " Try restarting: openclaw-restart"
|
||||
fi
|
||||
}
|
||||
|
||||
# List device pairings
|
||||
openclaw-devices() {
|
||||
echo "🔍 Checking device pairings..."
|
||||
docker compose -f "${OPENCLAW_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 " 2. Try manual config inside container:"
|
||||
echo " openclaw-shell"
|
||||
echo " openclaw config get gateway.remote.token"
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "💡 To approve a pairing request:"
|
||||
echo " openclaw-approve <request-id>"
|
||||
}
|
||||
|
||||
# Approve device pairing request
|
||||
openclaw-approve() {
|
||||
if [[ -z "$1" ]]; then
|
||||
echo "❌ Usage: openclaw-approve <request-id>"
|
||||
echo ""
|
||||
echo "💡 How to approve a device:"
|
||||
echo " 1. Run: openclaw-devices"
|
||||
echo " 2. Find the Request ID in the Pending table (long UUID)"
|
||||
echo " 3. Run: openclaw-approve <that-request-id>"
|
||||
echo ""
|
||||
echo "Example:"
|
||||
echo " openclaw-approve 6f9db1bd-a1cc-4d3f-b643-2c195262464e"
|
||||
return 1
|
||||
fi
|
||||
|
||||
echo "✅ Approving device: $1"
|
||||
docker compose -f "${OPENCLAW_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() {
|
||||
# Colors
|
||||
local CYAN='\033[0;36m'
|
||||
local BOLD='\033[1m'
|
||||
local GREEN='\033[0;32m'
|
||||
local YELLOW='\033[1;33m'
|
||||
local BLUE='\033[0;34m'
|
||||
local MAGENTA='\033[0;35m'
|
||||
local RED='\033[0;31m'
|
||||
local RESET='\033[0m'
|
||||
local DIM='\033[2m'
|
||||
|
||||
echo -e "\n${BOLD}${CYAN}🦞 OpenClaw Helper Commands${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 ""
|
||||
|
||||
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 ""
|
||||
|
||||
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 ""
|
||||
|
||||
echo -e "${BOLD}${MAGENTA}⚙️ Setup & Configuration${RESET}"
|
||||
echo -e " ${BOLD}openclaw-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 ""
|
||||
|
||||
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 ""
|
||||
|
||||
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 ""
|
||||
|
||||
echo -e "${BOLD}${GREEN}💬 WhatsApp Setup${RESET}"
|
||||
echo -e " ${GREEN}openclaw-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 "${BOLD}${CYAN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${RESET}"
|
||||
echo ""
|
||||
|
||||
echo -e "${YELLOW}💡 All commands guide you through next steps!${RESET}"
|
||||
echo -e "${BLUE}📚 Docs: ${RESET}${CYAN}https://docs.openclaw.ai${RESET}"
|
||||
echo ""
|
||||
}
|
||||
|
||||
# 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
|
||||
Reference in New Issue
Block a user