@openbrt/weclawbotctl 0.1.7 → 0.1.8
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/README.md +10 -0
- package/bin/weclawbotctl.mjs +22 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -110,6 +110,16 @@ certificate lacks `localhost` or `127.0.0.1` SANs, fix the gateway certificate
|
|
|
110
110
|
or use a certificate trusted by Node. The package does not rewrite other
|
|
111
111
|
users' OpenClaw gateway certificates automatically.
|
|
112
112
|
|
|
113
|
+
If OpenClaw is installed outside `PATH`, pass it explicitly:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
weclawbotctl openclaw doctor --bin /path/to/openclaw
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
When `weclawbotctl` is installed globally, it also checks the same npm global
|
|
120
|
+
`bin` directory for `openclaw`, which helps non-interactive SSH and systemd
|
|
121
|
+
environments where shell startup files are not loaded.
|
|
122
|
+
|
|
113
123
|
To install the OpenClaw plugin from a local checkout during development:
|
|
114
124
|
|
|
115
125
|
```bash
|
package/bin/weclawbotctl.mjs
CHANGED
|
@@ -269,12 +269,12 @@ async function commandOpenClaw(values) {
|
|
|
269
269
|
|
|
270
270
|
async function commandOpenClawInstall(values) {
|
|
271
271
|
const options = parseOptions(values, {
|
|
272
|
-
bin: process.env.OPENCLAW_BIN || "
|
|
272
|
+
bin: process.env.OPENCLAW_BIN || "",
|
|
273
273
|
spec: DEFAULT_OPENCLAW_PLUGIN_SPEC,
|
|
274
274
|
force: true,
|
|
275
275
|
doctor: true,
|
|
276
276
|
});
|
|
277
|
-
const openclaw =
|
|
277
|
+
const openclaw = await resolveOpenClawBin(options.bin);
|
|
278
278
|
const spec = String(options.spec || DEFAULT_OPENCLAW_PLUGIN_SPEC);
|
|
279
279
|
const version = await runCaptured(openclaw, ["--version"], { timeoutMs: 10_000 });
|
|
280
280
|
const versionCheck = openClawVersionCheck(version.stdout);
|
|
@@ -292,12 +292,12 @@ async function commandOpenClawInstall(values) {
|
|
|
292
292
|
|
|
293
293
|
async function commandOpenClawDoctor(values) {
|
|
294
294
|
const options = parseOptions(values, {
|
|
295
|
-
bin: process.env.OPENCLAW_BIN || "
|
|
295
|
+
bin: process.env.OPENCLAW_BIN || "",
|
|
296
296
|
json: false,
|
|
297
297
|
gateway: true,
|
|
298
298
|
timeout: 20,
|
|
299
299
|
});
|
|
300
|
-
const openclaw =
|
|
300
|
+
const openclaw = await resolveOpenClawBin(options.bin);
|
|
301
301
|
const timeoutMs = Math.max(1, Number(options.timeout) || 20) * 1000;
|
|
302
302
|
const checks = [];
|
|
303
303
|
|
|
@@ -583,6 +583,22 @@ async function fileExists(file) {
|
|
|
583
583
|
}
|
|
584
584
|
}
|
|
585
585
|
|
|
586
|
+
async function resolveOpenClawBin(value) {
|
|
587
|
+
if (value) return String(value);
|
|
588
|
+
const scriptDir = path.dirname(process.argv[1] || "");
|
|
589
|
+
const candidates = [
|
|
590
|
+
scriptDir ? path.join(scriptDir, "openclaw") : "",
|
|
591
|
+
path.join(os.homedir(), ".npm-global", "bin", "openclaw"),
|
|
592
|
+
path.join(os.homedir(), ".local", "bin", "openclaw"),
|
|
593
|
+
"/usr/local/bin/openclaw",
|
|
594
|
+
"/opt/homebrew/bin/openclaw",
|
|
595
|
+
].filter(Boolean);
|
|
596
|
+
for (const candidate of candidates) {
|
|
597
|
+
if (await fileExists(candidate)) return candidate;
|
|
598
|
+
}
|
|
599
|
+
return "openclaw";
|
|
600
|
+
}
|
|
601
|
+
|
|
586
602
|
function compactText(value) {
|
|
587
603
|
return String(value || "").replace(/\s+/gu, " ").trim().slice(0, 500);
|
|
588
604
|
}
|
|
@@ -605,6 +621,6 @@ function usage() {
|
|
|
605
621
|
weclawbotctl thinking [--ttl seconds] [--id correlation-id]
|
|
606
622
|
weclawbotctl idle [--id correlation-id]
|
|
607
623
|
weclawbotctl screen <document.json> [--force]
|
|
608
|
-
weclawbotctl openclaw install [--spec @openbrt/weclawbotctl] [--force=false]
|
|
609
|
-
weclawbotctl openclaw doctor [--gateway=false] [--json]`);
|
|
624
|
+
weclawbotctl openclaw install [--spec @openbrt/weclawbotctl] [--bin /path/to/openclaw] [--force=false]
|
|
625
|
+
weclawbotctl openclaw doctor [--gateway=false] [--bin /path/to/openclaw] [--json]`);
|
|
610
626
|
}
|