openclaw-channels-csdn-setup 0.2.4 → 0.2.6

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.
Files changed (2) hide show
  1. package/dist/cli.cjs +9 -37
  2. package/package.json +1 -1
package/dist/cli.cjs CHANGED
@@ -53,14 +53,6 @@ function mergeCsdnIntoOpenClawConfig(existing, csdn) {
53
53
  // src/cli.ts
54
54
  var PLUGIN_PACKAGE = "csdn-im";
55
55
  var DEFAULT_API_URL = "https://msg.csdn.net/claw";
56
- function isPlainObject2(v) {
57
- return typeof v === "object" && v !== null && !Array.isArray(v);
58
- }
59
- function stripChannelFromConfig(cfg, channelId) {
60
- const channels = isPlainObject2(cfg.channels) ? { ...cfg.channels } : {};
61
- delete channels[channelId];
62
- return { ...cfg, channels };
63
- }
64
56
  function defaultConfigPath() {
65
57
  return (0, import_node_path.join)((0, import_node_os.homedir)(), ".openclaw", "openclaw.json");
66
58
  }
@@ -106,28 +98,7 @@ function run(argv) {
106
98
  }
107
99
  const apiUrl = parsed.values["api-url"]?.trim() || process.env.CSDN_API_URL?.trim() || DEFAULT_API_URL;
108
100
  const configPath = parsed.values.config?.trim() || defaultConfigPath();
109
- let existing;
110
- if ((0, import_node_fs.existsSync)(configPath)) {
111
- try {
112
- const raw = (0, import_node_fs.readFileSync)(configPath, "utf8");
113
- existing = JSON.parse(raw);
114
- } catch (e) {
115
- console.error(`Error: could not read ${configPath}: ${e}`);
116
- return 1;
117
- }
118
- }
119
101
  if (!parsed.values["skip-install"]) {
120
- if (existing && isPlainObject2(existing.channels) && PLUGIN_PACKAGE in existing.channels) {
121
- try {
122
- const stripped = stripChannelFromConfig(existing, PLUGIN_PACKAGE);
123
- (0, import_node_fs.mkdirSync)((0, import_node_path.dirname)(configPath), { recursive: true });
124
- (0, import_node_fs.writeFileSync)(configPath, `${JSON.stringify(stripped, null, 2)}
125
- `, "utf8");
126
- } catch (e) {
127
- console.error(`Error: could not pre-strip channel config: ${e}`);
128
- return 1;
129
- }
130
- }
131
102
  const openclaw = (0, import_node_child_process.spawnSync)(
132
103
  "openclaw",
133
104
  ["plugins", "install", PLUGIN_PACKAGE],
@@ -147,14 +118,15 @@ function run(argv) {
147
118
  console.error(`Error: openclaw plugins install exited with code ${openclaw.status}`);
148
119
  return openclaw.status ?? 1;
149
120
  }
150
- if ((0, import_node_fs.existsSync)(configPath)) {
151
- try {
152
- const raw = (0, import_node_fs.readFileSync)(configPath, "utf8");
153
- existing = JSON.parse(raw);
154
- } catch (e) {
155
- console.error(`Error: could not read ${configPath} after install: ${e}`);
156
- return 1;
157
- }
121
+ }
122
+ let existing;
123
+ if ((0, import_node_fs.existsSync)(configPath)) {
124
+ try {
125
+ const raw = (0, import_node_fs.readFileSync)(configPath, "utf8");
126
+ existing = JSON.parse(raw);
127
+ } catch (e) {
128
+ console.error(`Error: could not read ${configPath}: ${e}`);
129
+ return 1;
158
130
  }
159
131
  }
160
132
  const merged = mergeCsdnIntoOpenClawConfig(existing, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openclaw-channels-csdn-setup",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
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",