---
name: openclaw-manage
description: Gestion d'OpenClaw Gateway sur PC Windows
disable-model-invocation: true
argument-hint: "[status|start|stop|restart|logs|config|test]"
allowed-tools: Bash
---

# Gestion OpenClaw Gateway

Contrôle du Gateway OpenClaw sur PC Windows pour le contrôle de la tablette Android via Telegram.

## Commandes disponibles

### Vérifier le statut du gateway
```bash
openclaw status
```

### Démarrer le gateway
```bash
openclaw start
```

### Arrêter le gateway
```bash
openclaw stop
```

### Redémarrer le gateway
```bash
openclaw restart
```

### Voir les logs (50 dernières lignes)
```bash
openclaw logs --tail 50
```

### Voir les logs en temps réel
```bash
openclaw logs --follow
```

### Éditer la configuration
```bash
notepad $env:USERPROFILE\.openclaw\openclaw.json
```

### Vérifier la version
```bash
openclaw --version
```

### Mettre à jour OpenClaw
```bash
npm update -g openclaw
```

## Tests

### Tester le bot Telegram
```bash
$token = Get-Content $env:USERPROFILE\.openclaw\secrets\telegram.token
Invoke-RestMethod -Uri "https://api.telegram.org/bot$token/getMe" -Method Get
```

### Tester SSH vers tablette
```bash
ssh tablette "echo 'Connection OK'"
```

### Test complet de l'infrastructure
```bash
# Exécuter le script de test
.\scripts\openclaw\full-test.ps1
```

## Gestion des secrets

### Lister les secrets
```bash
Get-ChildItem $env:USERPROFILE\.openclaw\secrets
```

### Vérifier la clé OpenAI
```bash
Get-Content $env:USERPROFILE\.openclaw\secrets\openai.key
```

### Vérifier le token Telegram
```bash
Get-Content $env:USERPROFILE\.openclaw\secrets\telegram.token
```

## Démarrage automatique

### Créer une tâche planifiée
```powershell
$action = New-ScheduledTaskAction -Execute "openclaw" -Argument "start"
$trigger = New-ScheduledTaskTrigger -AtStartup
$principal = New-ScheduledTaskPrincipal -UserId "$env:USERNAME" -LogonType Interactive
Register-ScheduledTask -TaskName "OpenClaw Gateway" -Action $action -Trigger $trigger -Principal $principal
```

### Désactiver le démarrage automatique
```powershell
Unregister-ScheduledTask -TaskName "OpenClaw Gateway" -Confirm:$false
```

## Dépannage

### Gateway ne démarre pas
```bash
# Mode verbose pour voir les erreurs
openclaw gateway --verbose
```

### Vérifier le port 18789
```bash
netstat -an | findstr "18789"
```

### Nettoyer les logs anciens
```powershell
Remove-Item $env:USERPROFILE\.openclaw\logs\*.log.* -Force
```

### Réinstaller OpenClaw
```bash
npm uninstall -g openclaw
npm install -g openclaw@latest
```

## Skill tablet-control

### Copier le skill vers OpenClaw
```powershell
Copy-Item .\scripts\openclaw\tablet-control.js $env:USERPROFILE\.openclaw\skills\tablet-control.js
```

### Vérifier que le skill est chargé
```bash
openclaw skills list
```

## Usage

Exemples d'utilisation :
- `/openclaw-manage status` - Vérifier l'état du Gateway
- `/openclaw-manage logs` - Voir les derniers logs
- `/openclaw-manage restart` - Redémarrer le Gateway
- `/openclaw-manage test` - Exécuter les tests complets

## Liens utiles

- Documentation : `config-android/docs/openclaw-setup.md`
- Scripts PowerShell : `config-android/scripts/openclaw/`
- Skill tablet-control : `config-android/scripts/openclaw/tablet-control.js`
