@long_88/openclaw-aicc-channel-cli 0.1.1 → 0.1.2
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 +1 -1
- package/cli.mjs +23 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ npx -y @long_88/openclaw-aicc-channel-cli install
|
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
When the install completes, the CLI also inspects `~/.openclaw/openclaw-weixin/accounts.json`.
|
|
12
|
-
If exactly one Weixin account is available, it prints that `weixinFanoutAccountId
|
|
12
|
+
If exactly one Weixin account is available, it prints that `weixinFanoutAccountId` and the matching `weixinFanoutTo` from `~/.openclaw/openclaw-weixin/accounts/<id>.json`, then waits for you to press Enter before the process exits. If multiple accounts are detected, the CLI exits with an error so you can resolve the ambiguity first.
|
|
13
13
|
|
|
14
14
|
Configure a bridge account while installing:
|
|
15
15
|
|
package/cli.mjs
CHANGED
|
@@ -4,6 +4,7 @@ import { spawnSync } from "node:child_process";
|
|
|
4
4
|
import { existsSync, readFileSync } from "node:fs";
|
|
5
5
|
import { homedir } from "node:os";
|
|
6
6
|
import { join } from "node:path";
|
|
7
|
+
import { createInterface } from "node:readline/promises";
|
|
7
8
|
|
|
8
9
|
const CLI_SPEC = "@long_88/openclaw-aicc-channel-cli";
|
|
9
10
|
const PLUGIN_SPEC = "@long_88/openclaw-aicc-channel";
|
|
@@ -192,7 +193,22 @@ function readJsonFile(filePath) {
|
|
|
192
193
|
return JSON.parse(readFileSync(filePath, "utf8"));
|
|
193
194
|
}
|
|
194
195
|
|
|
195
|
-
function
|
|
196
|
+
async function waitForEnter() {
|
|
197
|
+
const rl = createInterface({
|
|
198
|
+
input: process.stdin,
|
|
199
|
+
output: process.stdout
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
try {
|
|
203
|
+
await rl.question("[aicc-channel] Press Enter to continue");
|
|
204
|
+
} finally {
|
|
205
|
+
rl.close();
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
process.stdout.write("\n");
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
async function logWeixinAccounts() {
|
|
196
212
|
const weixinDir = join(homedir(), ".openclaw", "openclaw-weixin");
|
|
197
213
|
const accountsPath = join(weixinDir, "accounts.json");
|
|
198
214
|
|
|
@@ -235,15 +251,15 @@ function logWeixinAccounts() {
|
|
|
235
251
|
if (accountConfig?.userId) {
|
|
236
252
|
log(`weixinFanoutTo=${accountConfig.userId}`);
|
|
237
253
|
}
|
|
238
|
-
|
|
239
|
-
log(`account config (${accountPath}):`);
|
|
240
|
-
console.log(JSON.stringify(accountConfig, null, 2));
|
|
241
254
|
} catch (error) {
|
|
242
255
|
log(`failed to read account config ${accountPath}: ${error.message}`);
|
|
256
|
+
return;
|
|
243
257
|
}
|
|
258
|
+
|
|
259
|
+
await waitForEnter();
|
|
244
260
|
}
|
|
245
261
|
|
|
246
|
-
function install(options) {
|
|
262
|
+
async function install(options) {
|
|
247
263
|
const commands = buildCommands(options);
|
|
248
264
|
|
|
249
265
|
if (options.dryRun) {
|
|
@@ -276,7 +292,7 @@ function install(options) {
|
|
|
276
292
|
}
|
|
277
293
|
}
|
|
278
294
|
|
|
279
|
-
logWeixinAccounts();
|
|
295
|
+
await logWeixinAccounts();
|
|
280
296
|
}
|
|
281
297
|
|
|
282
298
|
const command = process.argv[2];
|
|
@@ -290,7 +306,7 @@ switch (command) {
|
|
|
290
306
|
process.exit(0);
|
|
291
307
|
break;
|
|
292
308
|
case "install":
|
|
293
|
-
install(parseArgs(process.argv.slice(3)));
|
|
309
|
+
await install(parseArgs(process.argv.slice(3)));
|
|
294
310
|
break;
|
|
295
311
|
default:
|
|
296
312
|
fail(`unknown command: ${command}`);
|