openclaw-channels-csdn-setup 0.2.4 → 0.2.5
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/dist/cli.cjs +17 -2
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -56,10 +56,25 @@ var DEFAULT_API_URL = "https://msg.csdn.net/claw";
|
|
|
56
56
|
function isPlainObject2(v) {
|
|
57
57
|
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
58
58
|
}
|
|
59
|
+
function hasStalePluginState(cfg, channelId) {
|
|
60
|
+
const plugins = isPlainObject2(cfg.plugins) ? cfg.plugins : {};
|
|
61
|
+
return isPlainObject2(cfg.channels) && channelId in cfg.channels || isPlainObject2(plugins.entries) && channelId in plugins.entries || isPlainObject2(plugins.installs) && channelId in plugins.installs;
|
|
62
|
+
}
|
|
59
63
|
function stripChannelFromConfig(cfg, channelId) {
|
|
60
64
|
const channels = isPlainObject2(cfg.channels) ? { ...cfg.channels } : {};
|
|
61
65
|
delete channels[channelId];
|
|
62
|
-
|
|
66
|
+
const plugins = isPlainObject2(cfg.plugins) ? { ...cfg.plugins } : {};
|
|
67
|
+
if (isPlainObject2(plugins.entries)) {
|
|
68
|
+
const entries = { ...plugins.entries };
|
|
69
|
+
delete entries[channelId];
|
|
70
|
+
plugins.entries = entries;
|
|
71
|
+
}
|
|
72
|
+
if (isPlainObject2(plugins.installs)) {
|
|
73
|
+
const installs = { ...plugins.installs };
|
|
74
|
+
delete installs[channelId];
|
|
75
|
+
plugins.installs = installs;
|
|
76
|
+
}
|
|
77
|
+
return { ...cfg, channels, plugins };
|
|
63
78
|
}
|
|
64
79
|
function defaultConfigPath() {
|
|
65
80
|
return (0, import_node_path.join)((0, import_node_os.homedir)(), ".openclaw", "openclaw.json");
|
|
@@ -117,7 +132,7 @@ function run(argv) {
|
|
|
117
132
|
}
|
|
118
133
|
}
|
|
119
134
|
if (!parsed.values["skip-install"]) {
|
|
120
|
-
if (existing &&
|
|
135
|
+
if (existing && hasStalePluginState(existing, PLUGIN_PACKAGE)) {
|
|
121
136
|
try {
|
|
122
137
|
const stripped = stripChannelFromConfig(existing, PLUGIN_PACKAGE);
|
|
123
138
|
(0, import_node_fs.mkdirSync)((0, import_node_path.dirname)(configPath), { recursive: true });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openclaw-channels-csdn-setup",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
4
4
|
"description": "One-shot installer: openclaw plugins install csdn-im@latest + merge channels.csdn-im into openclaw.json. Requires OpenClaw peer range as published in csdn-im (see csdn-im package.json openclaw.compatibility).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|