# 🐾 QwenClaw Installation & Setup Guide

**Complete guide to installing and using QwenClaw with Qwen Code CLI**

---

## ⚡ Quick Start (5 Minutes)

### Step 1: Install QwenClaw Globally

```bash
# Recommended: Install globally with npm
npm install -g qwenclaw

# Or use bun
bun install -g qwenclaw
```

### Step 2: Verify Installation

```bash
# Check version
qwenclaw --version

# Should show: qwenclaw v2.0.2
```

### Step 3: Run Setup

```bash
qwenclaw setup
```

### Step 4: Start Using

**In Terminal:**
```bash
qwenclaw start
qwenclaw status
```

**In Qwen Code CLI:**
```
/qwenclaw:status
/qwenclaw:start
/qwenclaw:send "Check my tasks"
```

---

## 📋 Prerequisites

- **Node.js** version 22 or higher
- **Qwen Code CLI** installed and configured
- **npm** or **bun** package manager

### Check Node Version

```bash
node --version  # Should be v22.x or higher
```

### Install Node.js (if needed)

- **Windows/macOS:** Download from https://nodejs.org/
- **Linux:** `curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - && sudo apt-get install -y nodejs`

---

## 🚀 Installation Methods

### Method 1: Global Install with npm (Recommended)

```bash
# Install globally - makes qwenclaw command available system-wide
npm install -g qwenclaw

# Verify installation
qwenclaw --version
qwenclaw help
```

**This is the recommended method because:**
- ✅ `qwenclaw` command available from anywhere in terminal
- ✅ Works with Qwen Code CLI slash commands
- ✅ No need to navigate to project directory
- ✅ Automatic PATH configuration

### Method 2: Global Install with bun

```bash
# Install globally with bun
bun install -g qwenclaw

# Verify
qwenclaw --version
```

### Method 3: From Source (Development)

```bash
# Clone repository
git clone https://github.rommark.dev/admin/QwenClaw-with-Auth.git
cd QwenClaw-with-Auth

# Install dependencies
npm install

# Link globally (makes it available system-wide)
npm link

# Verify
qwenclaw --version
```

### Method 4: Local Install (Not Recommended)

```bash
# Clone and install locally
git clone https://github.rommark.dev/admin/QwenClaw-with-Auth.git
cd QwenClaw-with-Auth
npm install

# Run with npm scripts (must be in project directory)
npm run start
npm run status
npm run help
```

**Note:** This method requires you to be in the project directory. For best experience, use Method 1 (global install).

---

## ⚙️ Configuration

### Run Setup Wizard

```bash
qwenclaw setup
```

This will:
1. Create `~/.qwen/qwenclaw/` directory
2. Generate default settings
3. Configure Qwen Code integration

### Manual Configuration

Create `~/.qwen/qwenclaw/settings.json`:

```json
{
  "model": "qwen-plus",
  "api": "",
  "timezone": "UTC",
  "heartbeat": {
    "enabled": false,
    "interval": 15
  },
  "telegram": {
    "token": "",
    "allowedUserIds": []
  },
  "security": {
    "level": "moderate"
  },
  "web": {
    "enabled": true,
    "host": "127.0.0.1",
    "port": 4632
  }
}
```

---

## 🎯 Usage

### Terminal Commands

| Command | Description |
|---------|-------------|
| `qwenclaw start` | Start daemon |
| `qwenclaw status` | Check status |
| `qwenclaw send "message"` | Send task |
| `qwenclaw skills` | List skills |
| `qwenclaw help` | Show help |

### Qwen Code Slash Commands

After installation, use these inside Qwen Code chat:

| Command | Description |
|---------|-------------|
| `/qwenclaw:start` | Start daemon |
| `/qwenclaw:status` | Check status |
| `/qwenclaw:send "task"` | Send task |
| `/qwenclaw:skills` | List skills |
| `/qwenclaw:help` | Show help |

### Examples

**Start Daemon:**
```bash
qwenclaw start
```

**Check Status:**
```
/qwenclaw:status
```

**Send Task:**
```bash
qwenclaw send "Summarize my GitHub notifications"
```

**List Skills:**
```
/qwenclaw:skills
```

---

## 🌐 Web Dashboard

Access the web dashboard at:

```
http://127.0.0.1:4632
```

Features:
- Real-time daemon status
- Skill management
- Job scheduling
- Logs viewer

---

## 📚 Available Skills (81 Total)

### By Category

| Category | Count | Examples |
|----------|-------|----------|
| Content | 8 | Research writer, changelog |
| Development | 25 | Code mentor, plugin dev |
| Design | 3 | UI/UX Pro Max, shadcn/ui |
| Automation | 5 | GUI automation |
| Multi-Agent | 2 | Agents Council |
| Economic | 1 | ClawWork (220 tasks) |
| Tools | 10 | QwenBot, file ops |
| Business | 8 | Internal comms |
| Creative | 5 | Theme factory |
| Productivity | 7 | Meeting insights |
| Media | 3 | Image, video |
| Writing | 3 | Resume, brand |
| Social | 2 | Twitter, Slack |
| Community | 1 | AChurch |
| Document | 1 | Document skills |

### List All Skills

```bash
qwenclaw skills
```

Or in Qwen Code:
```
/qwenclaw:skills
```

---

## 🔧 Troubleshooting

### Issue: "command not found: qwenclaw" or "qwenclaw is not recognized"

**Cause:** QwenClaw not installed globally or not in PATH

**Solution:**

```bash
# Install globally
npm install -g qwenclaw

# If still not found, add npm global bin to PATH

# Windows:
# Add to System Environment Variables PATH:
# %APPDATA%\npm

# macOS/Linux:
export PATH="$HOME/.npm-global/bin:$PATH"
# Add above line to ~/.bashrc or ~/.zshrc

# Verify installation
qwenclaw --version
```

**Alternative (Windows PowerShell):**
```powershell
# Run as Administrator
npm install -g qwenclaw

# Add to PATH
[Environment]::SetEnvironmentVariable("Path", $env:Path + ";$env:APPDATA\npm", [EnvironmentVariableTarget]::Machine)
```

### Issue: Permission denied when installing globally

**Solution:**

```bash
# macOS/Linux - use sudo
sudo npm install -g qwenclaw

# Or configure npm to use user directory
npm config set prefix '~/.npm-global'
export PATH=~/.npm-global/bin:$PATH
```

### Issue: "/qwenclaw:status unknown command"

**Solution:**
```bash
# Verify commands directory exists
ls -la ~/.qwen/commands/qwenclaw/

# Should contain: start.md, status.md, send.md, skills.md, help.md

# If missing, re-run setup
qwenclaw setup

# Restart Qwen Code
exit
qwen
```

### Issue: "Daemon not running"

**Solution:**
```bash
# Start daemon
qwenclaw start

# Or use slash command
/qwenclaw:start
```

### Issue: "Skills not available"

**Solution:**
```bash
# Check skills directory
ls -la ~/.qwen/qwenclaw/skills/

# Re-run setup
qwenclaw setup
```

---

## 📖 Additional Resources

- **GitHub:** https://github.rommark.dev/admin/QwenClaw-with-Auth
- **Issues:** https://github.rommark.dev/admin/QwenClaw-with-Auth/issues
- **OpenClaw:** https://github.com/openclaw/openclaw
- **Qwen Code:** https://github.com/QwenLM/Qwen-Code

---

## 🆘 Getting Help

### View Help

```bash
qwenclaw help
```

Or in Qwen Code:
```
/qwenclaw:help
```

### Report Issues

1. Check existing issues: https://github.rommark.dev/admin/QwenClaw-with-Auth/issues
2. Create new issue with:
   - QwenClaw version: `qwenclaw --version`
   - Node version: `node --version`
   - OS and version
   - Error message
   - Steps to reproduce

---

## ✅ Verification Checklist

After installation, verify:

- [ ] `qwenclaw --version` shows version 2.0.1 or higher
- [ ] `qwenclaw status` shows daemon status
- [ ] `/qwenclaw:status` works in Qwen Code
- [ ] Web dashboard accessible at http://127.0.0.1:4632
- [ ] Skills directory exists: `~/.qwen/qwenclaw/skills/`
- [ ] Commands directory exists: `~/.qwen/commands/qwenclaw/`

---

**You're all set! Start using QwenClaw with `/qwenclaw:status` in Qwen Code!** 🐾🎉
