@colinlu50/openclaw-lark-stream 2026.3.21 → 2026.3.23
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/bin/openclaw-lark.js +42 -12
- package/package.json +2 -2
package/bin/openclaw-lark.js
CHANGED
|
@@ -1,37 +1,69 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import { execFileSync } from "node:child_process";
|
|
4
|
+
import { existsSync, rmSync } from "node:fs";
|
|
4
5
|
import { dirname, join } from "node:path";
|
|
5
6
|
|
|
6
7
|
const SELF_PACKAGE = "@colinlu50/openclaw-lark-stream";
|
|
8
|
+
const PLUGIN_DIR = join(
|
|
9
|
+
process.env.OPENCLAW_STATE_DIR || join(process.env.HOME || process.env.USERPROFILE || "", ".openclaw"),
|
|
10
|
+
"extensions",
|
|
11
|
+
"openclaw-lark",
|
|
12
|
+
);
|
|
7
13
|
|
|
8
14
|
const args = process.argv.slice(2);
|
|
9
15
|
const subcommand = args[0];
|
|
10
16
|
|
|
11
|
-
// ── install / update
|
|
12
|
-
//
|
|
17
|
+
// ── install / update ──
|
|
18
|
+
// 1) Let @larksuite/openclaw-lark-tools run the full interactive setup
|
|
19
|
+
// (version check, bot config, gateway restart, etc.)
|
|
20
|
+
// 2) Then swap the installed official code with our fork
|
|
13
21
|
if (subcommand === "install" || subcommand === "update") {
|
|
22
|
+
// Step 1: Run tools for interactive setup (installs official + configures bot)
|
|
23
|
+
// Don't exit on error — config is already saved, we still need to swap the code.
|
|
24
|
+
const toolsArgs = args.slice();
|
|
14
25
|
try {
|
|
26
|
+
runTools(toolsArgs);
|
|
27
|
+
} catch {
|
|
28
|
+
// Tools may fail on gateway restart etc. — that's OK, config is preserved.
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Step 2: Replace official plugin code with ours
|
|
32
|
+
try {
|
|
33
|
+
if (existsSync(PLUGIN_DIR)) {
|
|
34
|
+
console.log(`\nSwapping official plugin with ${SELF_PACKAGE}...`);
|
|
35
|
+
rmSync(PLUGIN_DIR, { recursive: true, force: true });
|
|
36
|
+
}
|
|
15
37
|
execFileSync("openclaw", ["plugins", "install", SELF_PACKAGE], {
|
|
16
38
|
stdio: "inherit",
|
|
17
39
|
});
|
|
40
|
+
console.log(`\n✅ ${SELF_PACKAGE} installed successfully.`);
|
|
41
|
+
console.log("Run: openclaw gateway restart");
|
|
18
42
|
} catch (error) {
|
|
43
|
+
console.error(`\n❌ Failed to install ${SELF_PACKAGE}. The bot config is preserved.`);
|
|
44
|
+
console.error("You can retry with: openclaw plugins install " + SELF_PACKAGE);
|
|
19
45
|
process.exit(error.status ?? 1);
|
|
20
46
|
}
|
|
21
47
|
process.exit(0);
|
|
22
48
|
}
|
|
23
49
|
|
|
24
|
-
// ── All other commands: delegate to @larksuite/openclaw-lark-tools
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
args.splice(vIdx, 2);
|
|
50
|
+
// ── All other commands: delegate to @larksuite/openclaw-lark-tools ──
|
|
51
|
+
try {
|
|
52
|
+
runTools(args);
|
|
53
|
+
} catch (error) {
|
|
54
|
+
process.exit(error.status ?? 1);
|
|
30
55
|
}
|
|
31
56
|
|
|
32
|
-
|
|
57
|
+
function runTools(fwdArgs) {
|
|
58
|
+
let version = "latest";
|
|
59
|
+
const vIdx = fwdArgs.indexOf("--tools-version");
|
|
60
|
+
if (vIdx !== -1) {
|
|
61
|
+
version = fwdArgs[vIdx + 1];
|
|
62
|
+
fwdArgs.splice(vIdx, 2);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const allArgs = ["--yes", `@larksuite/openclaw-lark-tools@${version}`, ...fwdArgs];
|
|
33
66
|
|
|
34
|
-
try {
|
|
35
67
|
if (process.platform === "win32") {
|
|
36
68
|
const npxCli = join(
|
|
37
69
|
dirname(process.execPath),
|
|
@@ -55,6 +87,4 @@ try {
|
|
|
55
87
|
} else {
|
|
56
88
|
execFileSync("npx", allArgs, { stdio: "inherit" });
|
|
57
89
|
}
|
|
58
|
-
} catch (error) {
|
|
59
|
-
process.exit(error.status ?? 1);
|
|
60
90
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@colinlu50/openclaw-lark-stream",
|
|
3
|
-
"version": "2026.3.
|
|
3
|
+
"version": "2026.3.23",
|
|
4
4
|
"description": "OpenClaw Lark/Feishu channel plugin",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"./index.ts"
|
|
48
48
|
],
|
|
49
49
|
"channel": {
|
|
50
|
-
"id": "openclaw-lark
|
|
50
|
+
"id": "openclaw-lark",
|
|
51
51
|
"label": "Feishu",
|
|
52
52
|
"selectionLabel": "Lark/Feishu (飞书)",
|
|
53
53
|
"docsPath": "/channels/feishu",
|