@long_88/openclaw-aicc-channel-cli 0.1.1 → 0.1.3

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 (3) hide show
  1. package/README.md +1 -1
  2. package/cli.mjs +35 -10
  3. package/package.json +2 -2
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`, the matching `weixinFanoutTo` from `~/.openclaw/openclaw-weixin/accounts/<id>.json`, and the full account config JSON to help with AICC bridge testing. If multiple accounts are detected, the CLI exits with an error so you can resolve the ambiguity first.
12
+ If exactly one Weixin account is available, it prints a single `weixinFanoutBundle` value derived from `~/.openclaw/openclaw-weixin/accounts/<id>.json`, then waits for you to press Enter before the process exits. The bundle is a base64url-encoded JSON envelope with the shape `{"v":1,"accountId":"...","to":"..."}`. 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,33 @@ function readJsonFile(filePath) {
192
193
  return JSON.parse(readFileSync(filePath, "utf8"));
193
194
  }
194
195
 
195
- function logWeixinAccounts() {
196
+ function encodeWeixinFanoutBundle(accountId, to) {
197
+ return Buffer.from(
198
+ JSON.stringify({
199
+ v: 1,
200
+ accountId,
201
+ to
202
+ }),
203
+ "utf8"
204
+ ).toString("base64url");
205
+ }
206
+
207
+ async function waitForEnter() {
208
+ const rl = createInterface({
209
+ input: process.stdin,
210
+ output: process.stdout
211
+ });
212
+
213
+ try {
214
+ await rl.question("[aicc-channel] Press Enter to continue");
215
+ } finally {
216
+ rl.close();
217
+ }
218
+
219
+ process.stdout.write("\n");
220
+ }
221
+
222
+ async function logWeixinAccounts() {
196
223
  const weixinDir = join(homedir(), ".openclaw", "openclaw-weixin");
197
224
  const accountsPath = join(weixinDir, "accounts.json");
198
225
 
@@ -222,8 +249,6 @@ function logWeixinAccounts() {
222
249
  const accountId = accountIds[0];
223
250
  const accountPath = join(weixinDir, "accounts", `${accountId}.json`);
224
251
 
225
- log(`weixinFanoutAccountId=${accountId}`);
226
-
227
252
  if (!existsSync(accountPath)) {
228
253
  log(`account config file was not found: ${accountPath}`);
229
254
  return;
@@ -233,17 +258,17 @@ function logWeixinAccounts() {
233
258
  const accountConfig = readJsonFile(accountPath);
234
259
 
235
260
  if (accountConfig?.userId) {
236
- log(`weixinFanoutTo=${accountConfig.userId}`);
261
+ log(`weixinFanoutBundle=${encodeWeixinFanoutBundle(accountId, accountConfig.userId)}`);
237
262
  }
238
-
239
- log(`account config (${accountPath}):`);
240
- console.log(JSON.stringify(accountConfig, null, 2));
241
263
  } catch (error) {
242
264
  log(`failed to read account config ${accountPath}: ${error.message}`);
265
+ return;
243
266
  }
267
+
268
+ await waitForEnter();
244
269
  }
245
270
 
246
- function install(options) {
271
+ async function install(options) {
247
272
  const commands = buildCommands(options);
248
273
 
249
274
  if (options.dryRun) {
@@ -276,7 +301,7 @@ function install(options) {
276
301
  }
277
302
  }
278
303
 
279
- logWeixinAccounts();
304
+ await logWeixinAccounts();
280
305
  }
281
306
 
282
307
  const command = process.argv[2];
@@ -290,7 +315,7 @@ switch (command) {
290
315
  process.exit(0);
291
316
  break;
292
317
  case "install":
293
- install(parseArgs(process.argv.slice(3)));
318
+ await install(parseArgs(process.argv.slice(3)));
294
319
  break;
295
320
  default:
296
321
  fail(`unknown command: ${command}`);
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@long_88/openclaw-aicc-channel-cli",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "CLI installer for the OpenClaw AICC channel plugin.",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "bin": {
8
- "aicc-channel-installer": "./cli.mjs"
8
+ "aicc-channel-installer": "cli.mjs"
9
9
  },
10
10
  "files": [
11
11
  "cli.mjs",