mateclaw-openclaw-plugin 0.1.0
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 +92 -0
- package/package.json +36 -0
- package/src/cli.mjs +2257 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 MateClaw
|
|
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,92 @@
|
|
|
1
|
+
# mateclaw-openclaw-plugin
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/mateclaw-openclaw-plugin)
|
|
4
|
+
[](https://www.npmjs.com/package/mateclaw-openclaw-plugin)
|
|
5
|
+
[](./LICENSE)
|
|
6
|
+
|
|
7
|
+
This package provides a folotoy-style one-command local setup for MateClaw demos:
|
|
8
|
+
|
|
9
|
+
- `doctor` checks OpenClaw, gateway, token, identity, LAN, and connector port
|
|
10
|
+
- `install` runs `doctor + auto-fix + optional gateway restart + connector start`
|
|
11
|
+
- connector outputs QR code and keeps app chat in the same gateway session
|
|
12
|
+
|
|
13
|
+
## Customer one-command flow
|
|
14
|
+
|
|
15
|
+
Published package usage:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npx -y mateclaw-openclaw-plugin install --chat-mode gateway-session --session-key agent:main:main
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Local repo usage:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
cd mateclaw-openclaw-plugin
|
|
25
|
+
npm install
|
|
26
|
+
node ./src/cli.mjs install --chat-mode gateway-session --session-key agent:main:main
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
After startup:
|
|
30
|
+
|
|
31
|
+
1. Scan the OpenClaw-side QR code shown by the installer in MateClaw app.
|
|
32
|
+
2. Start text chat directly in app.
|
|
33
|
+
3. Optional desktop same-session view:
|
|
34
|
+
`http://127.0.0.1:18789/chat?session=agent%3Amain%3Amain`
|
|
35
|
+
|
|
36
|
+
## What `install` auto-handles
|
|
37
|
+
|
|
38
|
+
- Checks OpenClaw CLI version and gateway health/status
|
|
39
|
+
- Checks and repairs `~/.openclaw/openclaw.json` (`gateway.mode`, `gateway.auth.mode`, token/password)
|
|
40
|
+
- Auto-backs up existing `openclaw.json` before writing
|
|
41
|
+
- Checks and auto-creates device identity (`~/.openclaw/identity/device.json`) when missing
|
|
42
|
+
- Checks and syncs device auth token (`~/.openclaw/identity/device-auth.json`) when missing
|
|
43
|
+
- Auto-selects current LAN IPv4
|
|
44
|
+
- Auto-switches connector port when preferred port is occupied
|
|
45
|
+
- Optionally restarts gateway (`openclaw gateway restart`)
|
|
46
|
+
- Starts connector and prints binding QR
|
|
47
|
+
|
|
48
|
+
## Commands
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
node ./src/cli.mjs doctor
|
|
52
|
+
node ./src/cli.mjs install
|
|
53
|
+
node ./src/cli.mjs connect
|
|
54
|
+
node ./src/cli.mjs login install # alias of install
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Useful options
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
node ./src/cli.mjs install \
|
|
61
|
+
--openclaw-url http://127.0.0.1:18789 \
|
|
62
|
+
--chat-mode gateway-session \
|
|
63
|
+
--session-key agent:main:main \
|
|
64
|
+
--port 18890
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
- `--openclaw-bin <cmd>`: override OpenClaw CLI command
|
|
68
|
+
- `--config-path <path>`: override openclaw config path
|
|
69
|
+
- `--skip-gateway-restart`: skip `openclaw gateway restart`
|
|
70
|
+
- `--skip-connector`: only run setup, do not start connector
|
|
71
|
+
- `--dry-run`: print planned fixes without writing files
|
|
72
|
+
- `--lan-host <ip>`: pin LAN IP manually
|
|
73
|
+
|
|
74
|
+
## Development scripts
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
npm run doctor
|
|
78
|
+
npm run install:local
|
|
79
|
+
npm run connect
|
|
80
|
+
npm run check:publish
|
|
81
|
+
npm run pack:dry-run
|
|
82
|
+
npm run publish:dry-run
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Publish
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
npm login
|
|
89
|
+
npm run check:publish
|
|
90
|
+
npm run publish:dry-run
|
|
91
|
+
npm run publish:public
|
|
92
|
+
```
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "mateclaw-openclaw-plugin",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"description": "Local OpenClaw connector for MateClaw customer demos",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"bin": {
|
|
9
|
+
"mateclaw-openclaw-plugin": "src/cli.mjs"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"src",
|
|
13
|
+
"README.md",
|
|
14
|
+
"LICENSE"
|
|
15
|
+
],
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public"
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"doctor": "node ./src/cli.mjs doctor",
|
|
21
|
+
"install:local": "node ./src/cli.mjs install",
|
|
22
|
+
"connect": "node ./src/cli.mjs connect",
|
|
23
|
+
"check:publish": "node ./scripts/prepublish-check.mjs",
|
|
24
|
+
"pack:dry-run": "npm pack --dry-run",
|
|
25
|
+
"publish:dry-run": "npm publish --dry-run --access public",
|
|
26
|
+
"publish:public": "npm publish --access public",
|
|
27
|
+
"prepublishOnly": "npm run check:publish"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"qrcode-terminal": "^0.12.0",
|
|
31
|
+
"ws": "^8.18.3"
|
|
32
|
+
},
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=18"
|
|
35
|
+
}
|
|
36
|
+
}
|