openclaw-service 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +239 -0
- package/README.md.bak +247 -0
- package/README.openclaw-cli.md +239 -0
- package/README.openclaw-daemon.md +239 -0
- package/README.openclaw-gateway.md +239 -0
- package/README.openclaw-health.md +239 -0
- package/README.openclaw-helper.md +239 -0
- package/README.openclaw-install.md +239 -0
- package/README.openclaw-manage.md +239 -0
- package/README.openclaw-monitor.md +239 -0
- package/README.openclaw-run.md +239 -0
- package/README.openclaw-service.md +239 -0
- package/README.openclaw-setup.md +239 -0
- package/README.openclaw-start.md +239 -0
- package/README.openclaw-tools.md +239 -0
- package/README.openclaw-utils.md +239 -0
- package/README.openclaw-watch.md +239 -0
- package/README.zh-CN.md +213 -0
- package/dist/chunk-FUWKRMIF.js +470 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +567 -0
- package/dist/server-PP5Y3LAF.js +7 -0
- package/package.json +51 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 OpenClaw
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/Sobranier/openclaw-doctor/main/assets/welcome.png" alt="OpenClaw service" width="400" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">OpenClaw service</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
Keep your OpenClaw service alive. Automatically.
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="./README.zh-CN.md">中文文档</a>
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
## Get Started
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install -g openclaw-service
|
|
19
|
+
openclaw-service watch -d
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
That's it. Doctor monitors your OpenClaw gateway in the background, restarts it when it goes down, and tells you what happened. Zero configuration needed -- it reads everything from your existing OpenClaw setup.
|
|
23
|
+
|
|
24
|
+
## Core Commands
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
openclaw-service watch # Start monitoring (foreground)
|
|
28
|
+
openclaw-service watch -d # Start monitoring (background)
|
|
29
|
+
openclaw-service unwatch # Stop monitoring
|
|
30
|
+
|
|
31
|
+
openclaw-service status # Quick health check
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
These four commands cover 90% of daily use.
|
|
35
|
+
|
|
36
|
+
## Gateway Management
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
openclaw-service gateway start # Start the OpenClaw gateway
|
|
40
|
+
openclaw-service gateway stop # Stop the gateway
|
|
41
|
+
openclaw-service gateway restart # Restart the gateway
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Diagnostics & Logs
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
openclaw-service doctor # Full diagnostics (binary, gateway, channels)
|
|
48
|
+
openclaw-service logs # View gateway logs
|
|
49
|
+
openclaw-service logs --error # View error logs only
|
|
50
|
+
openclaw-service logs --doctor # View Doctor's own event logs
|
|
51
|
+
openclaw-service dashboard # Web management UI (http://localhost:9090)
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Install
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
# npm (recommended)
|
|
58
|
+
npm install -g openclaw-service
|
|
59
|
+
|
|
60
|
+
# or run without installing
|
|
61
|
+
npx openclaw-service status
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Requires Node >= 22 (same as OpenClaw).
|
|
65
|
+
|
|
66
|
+
## How It Works
|
|
67
|
+
|
|
68
|
+
Doctor auto-detects your OpenClaw installation:
|
|
69
|
+
|
|
70
|
+
- Reads `~/.openclaw/openclaw.json` for gateway port, channels, agents
|
|
71
|
+
- Finds the launchd service from `~/Library/LaunchAgents/`
|
|
72
|
+
- Checks health via `openclaw health --json` (real gateway RPC, not HTTP)
|
|
73
|
+
- Restarts via `launchctl kickstart` when needed
|
|
74
|
+
|
|
75
|
+
**You don't configure OpenClaw details.** Doctor figures them out.
|
|
76
|
+
|
|
77
|
+
## All Commands
|
|
78
|
+
|
|
79
|
+
| Command | Description |
|
|
80
|
+
|---------|-------------|
|
|
81
|
+
| **Monitoring** | |
|
|
82
|
+
| `watch` | Start health monitoring (foreground) |
|
|
83
|
+
| `watch -d` | Start health monitoring (background) |
|
|
84
|
+
| `watch -d --dashboard` | Background monitoring + web dashboard |
|
|
85
|
+
| `unwatch` | Stop monitoring |
|
|
86
|
+
| **Gateway** | |
|
|
87
|
+
| `gateway start` | Start the OpenClaw gateway |
|
|
88
|
+
| `gateway stop` | Stop the gateway |
|
|
89
|
+
| `gateway restart` | Restart the gateway |
|
|
90
|
+
| **Info** | |
|
|
91
|
+
| `status` | Show gateway and channel health |
|
|
92
|
+
| `status --json` | Machine-readable JSON output |
|
|
93
|
+
| `doctor` | Run full diagnostics |
|
|
94
|
+
| `dashboard` | Start web management UI |
|
|
95
|
+
| `logs` | Show gateway logs |
|
|
96
|
+
| `logs --error` | Show error logs only |
|
|
97
|
+
| `logs --doctor` | Show Doctor event logs |
|
|
98
|
+
|
|
99
|
+
## Configuration
|
|
100
|
+
|
|
101
|
+
Config is stored at `~/.openclaw-doctor/config.json`. Created automatically on first run. Only Doctor's own preferences -- no OpenClaw settings needed.
|
|
102
|
+
|
|
103
|
+
```json
|
|
104
|
+
{
|
|
105
|
+
"checkInterval": 30,
|
|
106
|
+
"failThreshold": 3,
|
|
107
|
+
"dashboardPort": 9090,
|
|
108
|
+
"maxRestartsPerHour": 5,
|
|
109
|
+
"openclawProfile": "default",
|
|
110
|
+
"notify": {
|
|
111
|
+
"webhook": {
|
|
112
|
+
"enabled": false,
|
|
113
|
+
"url": "",
|
|
114
|
+
"bodyTemplate": "{\"msgtype\":\"text\",\"text\":{\"content\":\"{{message}}\"}}"
|
|
115
|
+
},
|
|
116
|
+
"system": {
|
|
117
|
+
"enabled": true
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
| Field | Description | Default |
|
|
124
|
+
|-------|-------------|---------|
|
|
125
|
+
| `checkInterval` | Seconds between health checks | `30` |
|
|
126
|
+
| `failThreshold` | Consecutive failures before restart | `3` |
|
|
127
|
+
| `dashboardPort` | Web dashboard port | `9090` |
|
|
128
|
+
| `maxRestartsPerHour` | Restart throttle | `5` |
|
|
129
|
+
| `openclawProfile` | OpenClaw profile to monitor (`default`, `dev`, ...) | `default` |
|
|
130
|
+
| `notify.webhook.url` | Webhook for notifications | -- |
|
|
131
|
+
| `notify.system.enabled` | macOS native notifications | `true` |
|
|
132
|
+
|
|
133
|
+
## Notifications
|
|
134
|
+
|
|
135
|
+
Doctor notifies you across the full lifecycle:
|
|
136
|
+
|
|
137
|
+
| Event | Example |
|
|
138
|
+
|-------|---------|
|
|
139
|
+
| Monitoring started | "Doctor is watching your OpenClaw service" |
|
|
140
|
+
| Health degraded | "Service unhealthy (attempt 2/3)" |
|
|
141
|
+
| Restarting | "Restarting gateway..." |
|
|
142
|
+
| Restart succeeded | "Gateway back online" |
|
|
143
|
+
| Restart failed | "Restart failed: [error]" |
|
|
144
|
+
| Throttled | "Too many restarts, manual intervention needed" |
|
|
145
|
+
| Recovered | "Service recovered on its own" |
|
|
146
|
+
| Monitoring stopped | "Doctor stopped" |
|
|
147
|
+
|
|
148
|
+
Channels: **Webhook** (DingTalk, Feishu, Slack, etc.) + **macOS system notifications**.
|
|
149
|
+
|
|
150
|
+
## Skills Integration
|
|
151
|
+
|
|
152
|
+
Doctor runs as a standalone daemon, callable by OpenClaw or other tools:
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
openclaw-service status --json # Machine-readable output
|
|
156
|
+
openclaw-service watch -d # Idempotent -- safe to call repeatedly
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
If the caller crashes, Doctor keeps running.
|
|
160
|
+
|
|
161
|
+
## Architecture
|
|
162
|
+
|
|
163
|
+
```
|
|
164
|
+
+-----------------+
|
|
165
|
+
| Notification |
|
|
166
|
+
| (Webhook/OS) |
|
|
167
|
+
+--------^--------+
|
|
168
|
+
|
|
|
169
|
+
+-------------+ CLI +--------+--------+ RPC +-----------+
|
|
170
|
+
| OpenClaw | --------> | | ---------> | OpenClaw |
|
|
171
|
+
| / Scripts | | openclaw-doctor | | Gateway |
|
|
172
|
+
| / Skills | <-------- | (daemon) | <--------- | :18789 |
|
|
173
|
+
+-------------+ stdout +--------+--------+ health +-----------+
|
|
174
|
+
|
|
|
175
|
+
+--------v--------+
|
|
176
|
+
| ~/.openclaw/logs |
|
|
177
|
+
| (read & analyze) |
|
|
178
|
+
+-----------------+
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Development
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
git clone https://github.com/openclaw/openclaw-doctor.git
|
|
185
|
+
cd openclaw-doctor
|
|
186
|
+
npm install
|
|
187
|
+
|
|
188
|
+
npm run dev -- status # Quick test
|
|
189
|
+
npm run dev -- watch # Foreground monitoring
|
|
190
|
+
npm run dev -- watch -d # Background daemon
|
|
191
|
+
npm run dev -- unwatch # Stop daemon
|
|
192
|
+
|
|
193
|
+
npm run build # Build for distribution
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## Roadmap
|
|
197
|
+
|
|
198
|
+
- [x] Health check via `openclaw health --json` + auto-restart with throttling
|
|
199
|
+
- [x] Auto-detect OpenClaw config (gateway port, channels, agents, launchd)
|
|
200
|
+
- [x] Background daemon mode (`watch -d` / `unwatch`)
|
|
201
|
+
- [x] Gateway management (`gateway start/stop/restart`)
|
|
202
|
+
- [x] Read and display OpenClaw gateway logs
|
|
203
|
+
- [x] Web status dashboard
|
|
204
|
+
- [x] `--json` output for status
|
|
205
|
+
- [ ] Notification system (Webhook + macOS)
|
|
206
|
+
- [ ] `logs --tail` (real-time follow)
|
|
207
|
+
- [ ] `config` command (get/set)
|
|
208
|
+
- [ ] Multiple service monitoring
|
|
209
|
+
- [ ] Linux systemd support
|
|
210
|
+
|
|
211
|
+
## License
|
|
212
|
+
|
|
213
|
+
[MIT](./LICENSE)
|
|
214
|
+
|
|
215
|
+
## Publishing
|
|
216
|
+
|
|
217
|
+
This repo publishes two npm packages from the same codebase:
|
|
218
|
+
|
|
219
|
+
- **`openclaw-service`** — the main package (`package.json`)
|
|
220
|
+
- **`openclaw-service`** — alias package (`package.openclaw-service.json`)
|
|
221
|
+
|
|
222
|
+
Both packages share the same version number and dist output.
|
|
223
|
+
|
|
224
|
+
### Release a new version
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
# 1. Bump version (patch / minor / major)
|
|
228
|
+
npm version patch
|
|
229
|
+
|
|
230
|
+
# 2. Build + publish both packages
|
|
231
|
+
npm run release
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
`npm run release` calls `scripts/publish.sh`, which:
|
|
235
|
+
1. Builds once (`npm run build`)
|
|
236
|
+
2. Publishes `openclaw-service` with the default `package.json`
|
|
237
|
+
3. Temporarily swaps in `package.openclaw-service.json`, publishes `openclaw-service`, then restores
|
|
238
|
+
|
|
239
|
+
To update the `openclaw-service` package metadata (description, keywords, bin name, etc.), edit `package.openclaw-service.json`. Keep `version` in sync — it's automatically picked up from whichever `package.json` is active during publish.
|
package/README.md.bak
ADDED
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/Sobranier/openclaw-doctor/main/assets/welcome.png" alt="OpenClaw Doctor" width="400" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">OpenClaw Doctor</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
Keep your OpenClaw service alive. Automatically.
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="./README.zh-CN.md">中文文档</a>
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
<p align="center">
|
|
16
|
+
<a href="https://www.npmjs.com/package/openclaw-doctor"><img src="https://img.shields.io/npm/v/openclaw-doctor?label=openclaw-doctor&color=red" alt="npm openclaw-doctor" /></a>
|
|
17
|
+
|
|
18
|
+
<a href="https://www.npmjs.com/package/openclaw-cli"><img src="https://img.shields.io/npm/v/openclaw-cli?label=openclaw-cli&color=blue" alt="npm openclaw-cli" /></a>
|
|
19
|
+
|
|
20
|
+
<a href="https://www.npmjs.com/package/openclaw-manage"><img src="https://img.shields.io/npm/v/openclaw-manage?label=openclaw-manage&color=green" alt="npm openclaw-manage" /></a>
|
|
21
|
+
</p>
|
|
22
|
+
|
|
23
|
+
## Get Started
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install -g openclaw-doctor
|
|
27
|
+
openclaw-doctor watch -d
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
That's it. Doctor monitors your OpenClaw gateway in the background, restarts it when it goes down, and tells you what happened. Zero configuration needed -- it reads everything from your existing OpenClaw setup.
|
|
31
|
+
|
|
32
|
+
## Core Commands
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
openclaw-doctor watch # Start monitoring (foreground)
|
|
36
|
+
openclaw-doctor watch -d # Start monitoring (background)
|
|
37
|
+
openclaw-doctor unwatch # Stop monitoring
|
|
38
|
+
|
|
39
|
+
openclaw-doctor status # Quick health check
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
These four commands cover 90% of daily use.
|
|
43
|
+
|
|
44
|
+
## Gateway Management
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
openclaw-doctor gateway start # Start the OpenClaw gateway
|
|
48
|
+
openclaw-doctor gateway stop # Stop the gateway
|
|
49
|
+
openclaw-doctor gateway restart # Restart the gateway
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Diagnostics & Logs
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
openclaw-doctor doctor # Full diagnostics (binary, gateway, channels)
|
|
56
|
+
openclaw-doctor logs # View gateway logs
|
|
57
|
+
openclaw-doctor logs --error # View error logs only
|
|
58
|
+
openclaw-doctor logs --doctor # View Doctor's own event logs
|
|
59
|
+
openclaw-doctor dashboard # Web management UI (http://localhost:9090)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Install
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
# npm (recommended)
|
|
66
|
+
npm install -g openclaw-doctor
|
|
67
|
+
|
|
68
|
+
# or run without installing
|
|
69
|
+
npx openclaw-doctor status
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Requires Node >= 22 (same as OpenClaw).
|
|
73
|
+
|
|
74
|
+
## How It Works
|
|
75
|
+
|
|
76
|
+
Doctor auto-detects your OpenClaw installation:
|
|
77
|
+
|
|
78
|
+
- Reads `~/.openclaw/openclaw.json` for gateway port, channels, agents
|
|
79
|
+
- Finds the launchd service from `~/Library/LaunchAgents/`
|
|
80
|
+
- Checks health via `openclaw health --json` (real gateway RPC, not HTTP)
|
|
81
|
+
- Restarts via `launchctl kickstart` when needed
|
|
82
|
+
|
|
83
|
+
**You don't configure OpenClaw details.** Doctor figures them out.
|
|
84
|
+
|
|
85
|
+
## All Commands
|
|
86
|
+
|
|
87
|
+
| Command | Description |
|
|
88
|
+
|---------|-------------|
|
|
89
|
+
| **Monitoring** | |
|
|
90
|
+
| `watch` | Start health monitoring (foreground) |
|
|
91
|
+
| `watch -d` | Start health monitoring (background) |
|
|
92
|
+
| `watch -d --dashboard` | Background monitoring + web dashboard |
|
|
93
|
+
| `unwatch` | Stop monitoring |
|
|
94
|
+
| **Gateway** | |
|
|
95
|
+
| `gateway start` | Start the OpenClaw gateway |
|
|
96
|
+
| `gateway stop` | Stop the gateway |
|
|
97
|
+
| `gateway restart` | Restart the gateway |
|
|
98
|
+
| **Info** | |
|
|
99
|
+
| `status` | Show gateway and channel health |
|
|
100
|
+
| `status --json` | Machine-readable JSON output |
|
|
101
|
+
| `doctor` | Run full diagnostics |
|
|
102
|
+
| `dashboard` | Start web management UI |
|
|
103
|
+
| `logs` | Show gateway logs |
|
|
104
|
+
| `logs --error` | Show error logs only |
|
|
105
|
+
| `logs --doctor` | Show Doctor event logs |
|
|
106
|
+
|
|
107
|
+
## Configuration
|
|
108
|
+
|
|
109
|
+
Config is stored at `~/.openclaw-doctor/config.json`. Created automatically on first run. Only Doctor's own preferences -- no OpenClaw settings needed.
|
|
110
|
+
|
|
111
|
+
```json
|
|
112
|
+
{
|
|
113
|
+
"checkInterval": 30,
|
|
114
|
+
"failThreshold": 3,
|
|
115
|
+
"dashboardPort": 9090,
|
|
116
|
+
"maxRestartsPerHour": 5,
|
|
117
|
+
"openclawProfile": "default",
|
|
118
|
+
"notify": {
|
|
119
|
+
"webhook": {
|
|
120
|
+
"enabled": false,
|
|
121
|
+
"url": "",
|
|
122
|
+
"bodyTemplate": "{\"msgtype\":\"text\",\"text\":{\"content\":\"{{message}}\"}}"
|
|
123
|
+
},
|
|
124
|
+
"system": {
|
|
125
|
+
"enabled": true
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
| Field | Description | Default |
|
|
132
|
+
|-------|-------------|---------|
|
|
133
|
+
| `checkInterval` | Seconds between health checks | `30` |
|
|
134
|
+
| `failThreshold` | Consecutive failures before restart | `3` |
|
|
135
|
+
| `dashboardPort` | Web dashboard port | `9090` |
|
|
136
|
+
| `maxRestartsPerHour` | Restart throttle | `5` |
|
|
137
|
+
| `openclawProfile` | OpenClaw profile to monitor (`default`, `dev`, ...) | `default` |
|
|
138
|
+
| `notify.webhook.url` | Webhook for notifications | -- |
|
|
139
|
+
| `notify.system.enabled` | macOS native notifications | `true` |
|
|
140
|
+
|
|
141
|
+
## Notifications
|
|
142
|
+
|
|
143
|
+
Doctor notifies you across the full lifecycle:
|
|
144
|
+
|
|
145
|
+
| Event | Example |
|
|
146
|
+
|-------|---------|
|
|
147
|
+
| Monitoring started | "Doctor is watching your OpenClaw service" |
|
|
148
|
+
| Health degraded | "Service unhealthy (attempt 2/3)" |
|
|
149
|
+
| Restarting | "Restarting gateway..." |
|
|
150
|
+
| Restart succeeded | "Gateway back online" |
|
|
151
|
+
| Restart failed | "Restart failed: [error]" |
|
|
152
|
+
| Throttled | "Too many restarts, manual intervention needed" |
|
|
153
|
+
| Recovered | "Service recovered on its own" |
|
|
154
|
+
| Monitoring stopped | "Doctor stopped" |
|
|
155
|
+
|
|
156
|
+
Channels: **Webhook** (DingTalk, Feishu, Slack, etc.) + **macOS system notifications**.
|
|
157
|
+
|
|
158
|
+
## Skills Integration
|
|
159
|
+
|
|
160
|
+
Doctor runs as a standalone daemon, callable by OpenClaw or other tools:
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
openclaw-doctor status --json # Machine-readable output
|
|
164
|
+
openclaw-doctor watch -d # Idempotent -- safe to call repeatedly
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
If the caller crashes, Doctor keeps running.
|
|
168
|
+
|
|
169
|
+
## Architecture
|
|
170
|
+
|
|
171
|
+
```
|
|
172
|
+
+-----------------+
|
|
173
|
+
| Notification |
|
|
174
|
+
| (Webhook/OS) |
|
|
175
|
+
+--------^--------+
|
|
176
|
+
|
|
|
177
|
+
+-------------+ CLI +--------+--------+ RPC +-----------+
|
|
178
|
+
| OpenClaw | --------> | | ---------> | OpenClaw |
|
|
179
|
+
| / Scripts | | openclaw-doctor | | Gateway |
|
|
180
|
+
| / Skills | <-------- | (daemon) | <--------- | :18789 |
|
|
181
|
+
+-------------+ stdout +--------+--------+ health +-----------+
|
|
182
|
+
|
|
|
183
|
+
+--------v--------+
|
|
184
|
+
| ~/.openclaw/logs |
|
|
185
|
+
| (read & analyze) |
|
|
186
|
+
+-----------------+
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Development
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
git clone https://github.com/openclaw/openclaw-doctor.git
|
|
193
|
+
cd openclaw-doctor
|
|
194
|
+
npm install
|
|
195
|
+
|
|
196
|
+
npm run dev -- status # Quick test
|
|
197
|
+
npm run dev -- watch # Foreground monitoring
|
|
198
|
+
npm run dev -- watch -d # Background daemon
|
|
199
|
+
npm run dev -- unwatch # Stop daemon
|
|
200
|
+
|
|
201
|
+
npm run build # Build for distribution
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
## Roadmap
|
|
205
|
+
|
|
206
|
+
- [x] Health check via `openclaw health --json` + auto-restart with throttling
|
|
207
|
+
- [x] Auto-detect OpenClaw config (gateway port, channels, agents, launchd)
|
|
208
|
+
- [x] Background daemon mode (`watch -d` / `unwatch`)
|
|
209
|
+
- [x] Gateway management (`gateway start/stop/restart`)
|
|
210
|
+
- [x] Read and display OpenClaw gateway logs
|
|
211
|
+
- [x] Web status dashboard
|
|
212
|
+
- [x] `--json` output for status
|
|
213
|
+
- [ ] Notification system (Webhook + macOS)
|
|
214
|
+
- [ ] `logs --tail` (real-time follow)
|
|
215
|
+
- [ ] `config` command (get/set)
|
|
216
|
+
- [ ] Multiple service monitoring
|
|
217
|
+
- [ ] Linux systemd support
|
|
218
|
+
|
|
219
|
+
## License
|
|
220
|
+
|
|
221
|
+
[MIT](./LICENSE)
|
|
222
|
+
|
|
223
|
+
## Publishing
|
|
224
|
+
|
|
225
|
+
This repo publishes two npm packages from the same codebase:
|
|
226
|
+
|
|
227
|
+
- **`openclaw-doctor`** — the main package (`package.json`)
|
|
228
|
+
- **`openclaw-cli`** — alias package (`package.openclaw-cli.json`)
|
|
229
|
+
|
|
230
|
+
Both packages share the same version number and dist output.
|
|
231
|
+
|
|
232
|
+
### Release a new version
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
# 1. Bump version (patch / minor / major)
|
|
236
|
+
npm version patch
|
|
237
|
+
|
|
238
|
+
# 2. Build + publish both packages
|
|
239
|
+
npm run release
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
`npm run release` calls `scripts/publish.sh`, which:
|
|
243
|
+
1. Builds once (`npm run build`)
|
|
244
|
+
2. Publishes `openclaw-doctor` with the default `package.json`
|
|
245
|
+
3. Temporarily swaps in `package.openclaw-cli.json`, publishes `openclaw-cli`, then restores
|
|
246
|
+
|
|
247
|
+
To update the `openclaw-cli` package metadata (description, keywords, bin name, etc.), edit `package.openclaw-cli.json`. Keep `version` in sync — it's automatically picked up from whichever `package.json` is active during publish.
|