|
|
3 ماه پیش | |
|---|---|---|
| .gitignore | 3 ماه پیش | |
| README.md | 3 ماه پیش | |
| package.json | 3 ماه پیش | |
| server.js | 3 ماه پیش |
wedo 原型协同中心通知服务——多人通过 git 共建原型库(各自 MCP wedo 推送/拉取),hub 只负责一件事:广播"谁改了什么"。不存原型内容(内容归 git),零依赖(node ≥ 18 单文件)。
用户A改完原型 → MCP publish(push到git仓库) → POST /events 上报hub
│
用户B的MCP定时轮询 GET /events?repo=&since= ────────┘ → 🔔"A更新了 财务管理/包额"
(hub不可达时MCP自动降级为裸 git fetch 比对提交,功能不缺失)
| 方法 | 路径 | 说明 |
|---|---|---|
| POST | /events |
上报改动事件 {repo, user, message, commit, files[]}(repo/message 必填) |
| GET | /events?repo=<项目>&since=<时间戳> |
增量轮询某项目事件(since=上次游标,首次传 0) |
| GET | /repos |
项目维度视图:每项目的活跃用户/事件数/最近改动 |
| GET | /health |
健康检查 |
x-wedo-token: <WEDO_TOKEN>(服务端未设置 WEDO_TOKEN 时不校验);repo 字段隔离(如 hanglung、其他系统原型库各自命名),一份 hub 服务多项目;events.json(最近 200 条,重启不丢)。node server.js # 默认 8790 端口,无鉴权(仅内网可信环境)
WEDO_PORT=8790 WEDO_TOKEN=你的口令 node server.js
Windows: set WEDO_TOKEN=xxx && node server.js
npm i -g pm2
WEDO_PORT=8790 WEDO_TOKEN=你的口令 pm2 start server.js --name wedo-hub
pm2 save && pm2 startup
# /etc/systemd/system/wedo-hub.service
[Unit]
Description=wedo prototype hub
After=network.target
[Service]
WorkingDirectory=/opt/wedo-hub
Environment=WEDO_PORT=8790
Environment=WEDO_TOKEN=你的口令
ExecStart=/usr/bin/node server.js
Restart=always
[Install]
WantedBy=multi-user.target
systemctl enable --now wedo-hub
curl -H "x-wedo-token: 你的口令" http://<host>:8790/health
ZCode 的 wedo MCP 配置 env:
{
"WEDO_HUB_URL": "http://<host>:8790",
"WEDO_HUB_TOKEN": "你的口令",
"WEDO_REPO": "hanglung"
}
不配置 hub 时 MCP 自动使用纯 git 模式(publish 正常,更新感知降级为提交级比对)。
server.js 服务本体(零依赖单文件)
events.json 运行时事件持久化(git忽略)