Skip to content

Commit 1edf9b5

Browse files
committed
initial: openclaw-worktool plugin with one-line docker setup
1 parent 7fa34ce commit 1edf9b5

10 files changed

Lines changed: 457 additions & 49 deletions

.gitignore

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,29 @@ build/
77
coverage/
88
*.tsbuildinfo
99

10-
# local env
10+
# local env / secrets
1111
.env
1212
.env.*
1313
!.env.example
14-
.runtime_test/
14+
*.key
15+
*.pem
16+
17+
# openclaw runtime config (contains robotId, API keys, tokens)
18+
openclaw.json
19+
openclaw.json.bak
20+
runtime/
21+
.openclaw/
1522

1623
# logs
1724
npm-debug.log*
1825
yarn-debug.log*
1926
yarn-error.log*
2027
pnpm-debug.log*
28+
*.log
29+
30+
# test artifacts
31+
.runtime_test/
2132

22-
# macOS
33+
# OS
2334
.DS_Store
35+
Thumbs.db

DEPLOYMENT.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
# Deployment Guide
22

3-
本文档描述 `openclaw-plugin-worktool` 在 webhook 模式下的部署与联调。
3+
本文档描述 `openclaw-worktool` 在 webhook 模式下的部署与联调。
44

55
## 1. 插件安装
66

77
推荐一键安装:
88

99
```bash
10-
curl -fsSL https://raw.githubusercontent.com/answerlink/openclaw-plugin-worktool/main/scripts/install-docker.sh | bash
10+
curl -fsSL https://raw.githubusercontent.com/answerlink/openclaw-worktool/main/scripts/install-docker.sh | bash
1111
```
1212

1313
脚本会优先读取 `.env`,缺失项自动交互询问并回写 `.env`
1414

1515
CLI 一键安装(需要本机有 `openclaw` 命令):
1616

1717
```bash
18-
ROBOT_ID=wctestid curl -fsSL https://raw.githubusercontent.com/answerlink/openclaw-plugin-worktool/main/scripts/install.sh | bash
18+
ROBOT_ID=wctestid curl -fsSL https://raw.githubusercontent.com/answerlink/openclaw-worktool/main/scripts/install.sh | bash
1919
```
2020

2121
本地源码一键安装(clone 后,Docker 推荐):
2222

2323
```bash
24-
git clone https://github.com/answerlink/openclaw-plugin-worktool.git
25-
cd openclaw-plugin-worktool
24+
git clone https://github.com/answerlink/openclaw-worktool.git
25+
cd openclaw-worktool
2626
ROBOT_ID=wctestid bash scripts/install-local.sh
2727
```
2828

@@ -37,13 +37,13 @@ ROBOT_ID=wctestid bash scripts/install-local-native.sh
3737
如需安装指定版本:
3838

3939
```bash
40-
ROBOT_ID=wctestid VERSION=0.2.1 curl -fsSL https://raw.githubusercontent.com/answerlink/openclaw-plugin-worktool/main/scripts/install.sh | bash
40+
ROBOT_ID=wctestid VERSION=0.2.1 curl -fsSL https://raw.githubusercontent.com/answerlink/openclaw-worktool/main/scripts/install.sh | bash
4141
```
4242

4343
开发联调可用本地目录安装:
4444

4545
```bash
46-
openclaw plugins install /absolute/path/openclaw-plugin-worktool
46+
openclaw plugins install /absolute/path/openclaw-worktool
4747
```
4848

4949
## 2. OpenClaw 配置

README.md

Lines changed: 68 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,66 @@
1-
# openclaw-plugin-worktool
1+
# openclaw-worktool
22

33
OpenClaw 的 WorkTool 渠道插件,支持:
44

55
- 出站:将 OpenClaw 回复发送到微信(经 WorkTool bridge)。
66
- 入站:接收 WorkTool webhook 回调并路由到小龙虾 Agent。
77

8-
## 安装
8+
## 快速开始(推荐)
99

10-
方式 1:一键安装(Docker 用户推荐,无需 openclaw CLI)
10+
只需 Docker 和一个 WorkTool 机器人 ID,从零到跑通:
1111

1212
```bash
13-
curl -fsSL https://raw.githubusercontent.com/answerlink/openclaw-plugin-worktool/main/scripts/install-docker.sh | bash
13+
git clone https://github.com/answerlink/openclaw-worktool.git
14+
cd openclaw-worktool
15+
bash scripts/setup-docker.sh
16+
```
17+
18+
脚本会自动完成全部流程:
19+
20+
1. 交互式询问 WorkTool Robot ID(也可从 `.env` 读取)。
21+
2. 拉取 OpenClaw Docker 镜像(如本地没有)。
22+
3. 创建 Docker 容器(端口映射、volume 挂载全自动)。
23+
4. 启动 **OpenClaw onboard**(选模型、配网关 token——OpenClaw 官方交互界面)。
24+
5. 复制插件源码进容器、创建 SDK 兼容层、修补版本兼容性。
25+
6. 写入 `openclaw.json` 的 plugins + channels.worktool 配置。
26+
7. 重启容器、验证 webhook 健康检查。
27+
8. 所有值回写 `.env`,下次升级/重装零交互。
28+
29+
第二次运行(升级/改配置):
30+
31+
```bash
32+
bash scripts/setup-docker.sh
33+
# .env 中已有 ROBOT_ID 等值,直接跑完;onboard 会问你是否要重新配模型
34+
```
35+
36+
也可环境变量全传,跳过交互(适合 CI):
37+
38+
```bash
39+
ROBOT_ID=wctestid SKIP_ONBOARD=1 bash scripts/setup-docker.sh
40+
```
41+
42+
可覆盖参数:
43+
44+
| 变量 | 默认值 | 说明 |
45+
|---|---|---|
46+
| `ROBOT_ID` | (必填) | WorkTool 机器人 ID |
47+
| `OPENCLAW_IMAGE` | `alpine/openclaw:2026.3.28` | OpenClaw Docker 镜像 |
48+
| `CONTAINER_NAME` | `openclaw-gateway` | 容器名 |
49+
| `GATEWAY_PORT` | `18789` | OpenClaw 网关端口 |
50+
| `BRIDGE_BASE_URL` | `https://api.worktool.ymdyes.cn` | WorkTool Bridge 地址 |
51+
| `WEBHOOK_HOST` | `0.0.0.0` | Webhook 监听地址 |
52+
| `WEBHOOK_PORT` | `18799` | Webhook 端口 |
53+
| `WEBHOOK_PATH` | `/wechat/webhook` | Webhook 路径 |
54+
| `SKIP_ONBOARD` | (空) | 设为 `1` 跳过 onboard |
55+
| `ENV_FILE` | `./.env` | 配置文件路径 |
56+
| `PLUGIN_SOURCE_DIR` | 自动检测 | 插件源码目录 |
57+
58+
## 其他安装方式
59+
60+
### 方式 1:一键安装(Docker 用户,无需 openclaw CLI)
61+
62+
```bash
63+
curl -fsSL https://raw.githubusercontent.com/answerlink/openclaw-worktool/main/scripts/install-docker.sh | bash
1464
```
1565

1666
说明:
@@ -22,7 +72,7 @@ curl -fsSL https://raw.githubusercontent.com/answerlink/openclaw-plugin-worktool
2272
安装指定版本:
2373

2474
```bash
25-
VERSION=0.2.1 curl -fsSL https://raw.githubusercontent.com/answerlink/openclaw-plugin-worktool/main/scripts/install-docker.sh | bash
75+
VERSION=0.2.1 curl -fsSL https://raw.githubusercontent.com/answerlink/openclaw-worktool/main/scripts/install-docker.sh | bash
2676
```
2777

2878
如果你的 `docker-compose.worktool.yml` 或配置目录不在当前目录,可传参:
@@ -31,34 +81,34 @@ VERSION=0.2.1 curl -fsSL https://raw.githubusercontent.com/answerlink/openclaw-p
3181
ROBOT_ID=wctestid \
3282
COMPOSE_FILE=/path/to/docker-compose.worktool.yml \
3383
OPENCLAW_CONFIG=/path/to/runtime/config/openclaw.json \
34-
PLUGIN_HOST_DIR=/path/to/openclaw-plugin-worktool \
35-
curl -fsSL https://raw.githubusercontent.com/answerlink/openclaw-plugin-worktool/main/scripts/install-docker.sh | bash
84+
PLUGIN_HOST_DIR=/path/to/openclaw-worktool \
85+
curl -fsSL https://raw.githubusercontent.com/answerlink/openclaw-worktool/main/scripts/install-docker.sh | bash
3686
```
3787

38-
方式 2:一键安装(CLI 模式,需要本机有 `openclaw` 命令)
88+
### 方式 2:一键安装(CLI 模式,需要本机有 `openclaw` 命令)
3989

4090
```bash
41-
ROBOT_ID=wctestid curl -fsSL https://raw.githubusercontent.com/answerlink/openclaw-plugin-worktool/main/scripts/install.sh | bash
91+
ROBOT_ID=wctestid curl -fsSL https://raw.githubusercontent.com/answerlink/openclaw-worktool/main/scripts/install.sh | bash
4292
```
4393

4494
安装指定版本:
4595

4696
```bash
47-
ROBOT_ID=wctestid VERSION=0.2.1 curl -fsSL https://raw.githubusercontent.com/answerlink/openclaw-plugin-worktool/main/scripts/install.sh | bash
97+
ROBOT_ID=wctestid VERSION=0.2.1 curl -fsSL https://raw.githubusercontent.com/answerlink/openclaw-worktool/main/scripts/install.sh | bash
4898
```
4999

50100
可选覆盖 WorkTool 地址(私有化部署):
51101

52102
```bash
53103
ROBOT_ID=wctestid BRIDGE_BASE_URL=https://your-private-worktool.example.com \
54-
curl -fsSL https://raw.githubusercontent.com/answerlink/openclaw-plugin-worktool/main/scripts/install.sh | bash
104+
curl -fsSL https://raw.githubusercontent.com/answerlink/openclaw-worktool/main/scripts/install.sh | bash
55105
```
56106

57-
方式 3:源码一键安装(clone 后本地自测)
107+
### 方式 3:源码一键安装(clone 后本地自测)
58108

59109
```bash
60-
git clone https://github.com/answerlink/openclaw-plugin-worktool.git
61-
cd openclaw-plugin-worktool
110+
git clone https://github.com/answerlink/openclaw-worktool.git
111+
cd openclaw-worktool
62112
ROBOT_ID=wctestid bash scripts/install-local.sh
63113
```
64114

@@ -90,16 +140,16 @@ ROBOT_ID=wctestid bash scripts/install-local-native.sh
90140
- 回调地址通常是:`https://your-public-domain.example.com/wechat/webhook`
91141
- 需要模型配置可用(OpenClaw provider 可调用),否则只能收消息不能出 AI 回复。
92142

93-
方式 4:源码目录安装(开发联调)
143+
### 方式 4:源码目录安装(开发联调)
94144

95145
```bash
96-
openclaw plugins install /absolute/path/openclaw-plugin-worktool
146+
openclaw plugins install /absolute/path/openclaw-worktool
97147
```
98148

99-
方式 5:发布包安装(给私有部署环境)
149+
### 方式 5:发布包安装(给私有部署环境)
100150

101151
```bash
102-
cd /absolute/path/openclaw-plugin-worktool
152+
cd /absolute/path/openclaw-worktool
103153
npm run release:local
104154
openclaw plugins install ./dist/package
105155
```

docs/ARCHITECTURE-LARK-REFERENCE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# WorkTool 插件架构说明(参考 openclaw-lark)
22

3-
本文档记录 `openclaw-plugin-worktool` 的目录边界,并对齐 `~/projects/openclaw-lark` 的分层思路,供后续持续演进。
3+
本文档记录 `openclaw-worktool` 的目录边界,并对齐 `~/projects/openclaw-lark` 的分层思路,供后续持续演进。
44

55
## 1. 参考飞书插件的分层边界
66

docs/RELEASE-AND-INSTALL.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
11
# WorkTool 插件发布与安装
22

3-
本文档用于把 `openclaw-plugin-worktool` 做成可分发安装包(参考 `openclaw-lark` 的发布方式)。
3+
本文档用于把 `openclaw-worktool` 做成可分发安装包(参考 `openclaw-lark` 的发布方式)。
44

55
## 0. 用户一键安装
66

77
latest:
88

99
```bash
10-
curl -fsSL https://raw.githubusercontent.com/answerlink/openclaw-plugin-worktool/main/scripts/install-docker.sh | bash
10+
curl -fsSL https://raw.githubusercontent.com/answerlink/openclaw-worktool/main/scripts/install-docker.sh | bash
1111
```
1212

1313
CLI 模式(需要本机有 `openclaw` 命令):
1414

1515
```bash
16-
ROBOT_ID=wctestid curl -fsSL https://raw.githubusercontent.com/answerlink/openclaw-plugin-worktool/main/scripts/install.sh | bash
16+
ROBOT_ID=wctestid curl -fsSL https://raw.githubusercontent.com/answerlink/openclaw-worktool/main/scripts/install.sh | bash
1717
```
1818

1919
指定版本:
2020

2121
```bash
22-
VERSION=0.2.1 curl -fsSL https://raw.githubusercontent.com/answerlink/openclaw-plugin-worktool/main/scripts/install-docker.sh | bash
22+
VERSION=0.2.1 curl -fsSL https://raw.githubusercontent.com/answerlink/openclaw-worktool/main/scripts/install-docker.sh | bash
2323
```
2424

2525
CLI 模式指定版本:
2626

2727
```bash
28-
ROBOT_ID=wctestid VERSION=0.2.1 curl -fsSL https://raw.githubusercontent.com/answerlink/openclaw-plugin-worktool/main/scripts/install.sh | bash
28+
ROBOT_ID=wctestid VERSION=0.2.1 curl -fsSL https://raw.githubusercontent.com/answerlink/openclaw-worktool/main/scripts/install.sh | bash
2929
```
3030

3131
clone 后本地一键安装(Docker 推荐):
3232

3333
```bash
34-
git clone https://github.com/answerlink/openclaw-plugin-worktool.git
35-
cd openclaw-plugin-worktool
34+
git clone https://github.com/answerlink/openclaw-worktool.git
35+
cd openclaw-worktool
3636
ROBOT_ID=wctestid bash scripts/install-local.sh
3737
```
3838

@@ -73,7 +73,7 @@ MODEL_API_PROTOCOL=openai-completions
7373
## 2. 构建发布目录
7474

7575
```bash
76-
cd /absolute/path/openclaw-plugin-worktool
76+
cd /absolute/path/openclaw-worktool
7777
npm run build
7878
```
7979

@@ -89,14 +89,14 @@ npm run build
8989
## 3. 生成 tgz 发布包
9090

9191
```bash
92-
cd /absolute/path/openclaw-plugin-worktool
92+
cd /absolute/path/openclaw-worktool
9393
npm run release:local
9494
```
9595

9696
产物:
9797

9898
- `dist/package/`(目录安装)
99-
- `dist/openclaw-plugin-worktool-<version>.tgz`(单文件分发)
99+
- `dist/openclaw-worktool-<version>.tgz`(单文件分发)
100100

101101
如需自动升级版本后发布:
102102

@@ -130,13 +130,13 @@ git push origin v0.2.1
130130
目录安装:
131131

132132
```bash
133-
openclaw plugins install /absolute/path/openclaw-plugin-worktool/dist/package
133+
openclaw plugins install /absolute/path/openclaw-worktool/dist/package
134134
```
135135

136136
tgz 安装:
137137

138138
```bash
139-
openclaw plugins install /absolute/path/openclaw-plugin-worktool/dist/openclaw-plugin-worktool-<version>.tgz
139+
openclaw plugins install /absolute/path/openclaw-worktool/dist/openclaw-worktool-<version>.tgz
140140
```
141141

142142
## 5. 最小验收

docs/WORKTOOL-ARCHITECTURE-TEXT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Nginx
1717
v
1818
宿主机 OpenClaw 进程
1919
|
20-
+-- openclaw-plugin-worktool
20+
+-- openclaw-worktool
2121
|
2222
+-- index.ts/js
2323
| - 注册 channel(worktool)

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "openclaw-plugin-worktool",
2+
"name": "openclaw-worktool",
33
"version": "0.2.0",
44
"description": "OpenClaw WorkTool channel plugin for WeChat webhook/RPA bridge integration.",
55
"type": "module",
@@ -36,7 +36,7 @@
3636
"order": 96
3737
},
3838
"install": {
39-
"npmSpec": "openclaw-plugin-worktool",
39+
"npmSpec": "openclaw-worktool",
4040
"localPath": "extensions/worktool",
4141
"defaultChoice": "local"
4242
}

scripts/install-docker.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
33

4-
REPO="${REPO:-answerlink/openclaw-plugin-worktool}"
4+
REPO="${REPO:-answerlink/openclaw-worktool}"
55
VERSION="${VERSION:-latest}" # e.g. 0.2.1 or latest
66

77
# Core WorkTool channel settings
@@ -23,7 +23,7 @@ ENV_FILE="${ENV_FILE:-./.env}"
2323
COMPOSE_FILE="${COMPOSE_FILE:-./docker-compose.worktool.yml}"
2424
SERVICE_NAME="${SERVICE_NAME:-openclaw-worktool}"
2525
OPENCLAW_CONFIG="${OPENCLAW_CONFIG:-./runtime/config/openclaw.json}"
26-
PLUGIN_HOST_DIR="${PLUGIN_HOST_DIR:-./openclaw-plugin-worktool}"
26+
PLUGIN_HOST_DIR="${PLUGIN_HOST_DIR:-./openclaw-worktool}"
2727
CONTAINER_PLUGIN_PATH="${CONTAINER_PLUGIN_PATH:-/app/extensions/worktool}"
2828
AUTO_RESTART="${AUTO_RESTART:-1}"
2929

@@ -218,7 +218,7 @@ upsert_env WEBHOOK_PORT "$WEBHOOK_PORT"
218218
upsert_env WEBHOOK_PATH "$WEBHOOK_PATH"
219219

220220
VER="$(resolve_version)"
221-
URL="https://github.com/${REPO}/releases/download/v${VER}/openclaw-plugin-worktool-${VER}.tgz"
221+
URL="https://github.com/${REPO}/releases/download/v${VER}/openclaw-worktool-${VER}.tgz"
222222

223223
echo "Downloading plugin package ${VER} from ${REPO}..."
224224
curl -fsSL "$URL" -o "$ARCHIVE_PATH"

scripts/install.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ if ! command -v openclaw >/dev/null 2>&1; then
77
exit 1
88
fi
99

10-
REPO="${REPO:-answerlink/openclaw-plugin-worktool}"
10+
REPO="${REPO:-answerlink/openclaw-worktool}"
1111
VERSION="${VERSION:-latest}" # e.g. 0.2.1 or latest
1212
ROBOT_ID="${ROBOT_ID:-}"
1313
BRIDGE_BASE_URL="${BRIDGE_BASE_URL:-https://api.worktool.ymdyes.cn}"
@@ -49,7 +49,7 @@ if [ -z "$ROBOT_ID" ]; then
4949
fi
5050

5151
VER="$(resolve_version)"
52-
URL="https://github.com/${REPO}/releases/download/v${VER}/openclaw-plugin-worktool-${VER}.tgz"
52+
URL="https://github.com/${REPO}/releases/download/v${VER}/openclaw-worktool-${VER}.tgz"
5353

5454
echo "Downloading plugin package ${VER} from ${REPO}..."
5555
curl -fsSL "$URL" -o "$ARCHIVE_PATH"

0 commit comments

Comments
 (0)