@colinlu50/openclaw-lark-stream 2026.3.21 → 2026.3.22
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 +61 -36
- package/package.json +2 -2
package/bin/openclaw-lark.js
CHANGED
|
@@ -1,60 +1,85 @@
|
|
|
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
|
+
const toolsArgs = args.slice(); // forward all flags (--app, --use-existing, --version, etc.)
|
|
24
|
+
runTools(toolsArgs);
|
|
25
|
+
|
|
26
|
+
// Step 2: Replace official plugin code with ours
|
|
14
27
|
try {
|
|
28
|
+
if (existsSync(PLUGIN_DIR)) {
|
|
29
|
+
console.log(`\nSwapping official plugin with ${SELF_PACKAGE}...`);
|
|
30
|
+
rmSync(PLUGIN_DIR, { recursive: true, force: true });
|
|
31
|
+
}
|
|
15
32
|
execFileSync("openclaw", ["plugins", "install", SELF_PACKAGE], {
|
|
16
33
|
stdio: "inherit",
|
|
17
34
|
});
|
|
35
|
+
console.log(`\n✅ ${SELF_PACKAGE} installed successfully.`);
|
|
36
|
+
console.log("Restart the gateway to load the new plugin.");
|
|
18
37
|
} catch (error) {
|
|
38
|
+
console.error(`\n❌ Failed to install ${SELF_PACKAGE}. The bot config is preserved.`);
|
|
39
|
+
console.error("You can retry with: openclaw plugins install " + SELF_PACKAGE);
|
|
19
40
|
process.exit(error.status ?? 1);
|
|
20
41
|
}
|
|
21
42
|
process.exit(0);
|
|
22
43
|
}
|
|
23
44
|
|
|
24
|
-
// ── All other commands: delegate to @larksuite/openclaw-lark-tools
|
|
25
|
-
|
|
26
|
-
const vIdx = args.indexOf("--tools-version");
|
|
27
|
-
if (vIdx !== -1) {
|
|
28
|
-
version = args[vIdx + 1];
|
|
29
|
-
args.splice(vIdx, 2);
|
|
30
|
-
}
|
|
45
|
+
// ── All other commands: delegate to @larksuite/openclaw-lark-tools ──
|
|
46
|
+
runTools(args);
|
|
31
47
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
if (
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
48
|
+
function runTools(fwdArgs) {
|
|
49
|
+
let version = "latest";
|
|
50
|
+
const vIdx = fwdArgs.indexOf("--tools-version");
|
|
51
|
+
if (vIdx !== -1) {
|
|
52
|
+
version = fwdArgs[vIdx + 1];
|
|
53
|
+
fwdArgs.splice(vIdx, 2);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const allArgs = ["--yes", `@larksuite/openclaw-lark-tools@${version}`, ...fwdArgs];
|
|
57
|
+
|
|
58
|
+
try {
|
|
59
|
+
if (process.platform === "win32") {
|
|
60
|
+
const npxCli = join(
|
|
61
|
+
dirname(process.execPath),
|
|
62
|
+
"node_modules",
|
|
63
|
+
"npm",
|
|
64
|
+
"bin",
|
|
65
|
+
"npx-cli.js",
|
|
66
|
+
);
|
|
67
|
+
execFileSync(process.execPath, [npxCli, ...allArgs], {
|
|
68
|
+
stdio: "inherit",
|
|
69
|
+
env: {
|
|
70
|
+
...process.env,
|
|
71
|
+
NODE_OPTIONS: [
|
|
72
|
+
process.env.NODE_OPTIONS,
|
|
73
|
+
"--disable-warning=DEP0190",
|
|
74
|
+
]
|
|
75
|
+
.filter(Boolean)
|
|
76
|
+
.join(" "),
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
} else {
|
|
80
|
+
execFileSync("npx", allArgs, { stdio: "inherit" });
|
|
81
|
+
}
|
|
82
|
+
} catch (error) {
|
|
83
|
+
process.exit(error.status ?? 1);
|
|
57
84
|
}
|
|
58
|
-
} catch (error) {
|
|
59
|
-
process.exit(error.status ?? 1);
|
|
60
85
|
}
|
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.22",
|
|
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",
|