@a2hmarket/a2hmarket 0.6.3 → 0.6.4
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/package.json +1 -1
- package/scripts/install.mjs +40 -73
package/package.json
CHANGED
package/scripts/install.mjs
CHANGED
|
@@ -468,32 +468,11 @@ async function main() {
|
|
|
468
468
|
log(`\n${BOLD}A2H Market — OpenClaw Plugin${RESET}\n`);
|
|
469
469
|
log(` 安装: npx -y ${NPM_SPEC} install`);
|
|
470
470
|
log(` 快速: npx -y ${NPM_SPEC} install --agent ag_xxx:key`);
|
|
471
|
-
log(` 非交互: npx -y ${NPM_SPEC} install --agent ag_xxx:key --notify feishu:ou_xxx`);
|
|
472
471
|
log(` 更新: npx -y ${NPM_SPEC} update`);
|
|
473
472
|
log(` 卸载: npx -y ${NPM_SPEC} uninstall\n`);
|
|
474
|
-
log(` 选项:`);
|
|
475
|
-
log(` --agent <id:key> 跳过浏览器授权,直接使用凭证`);
|
|
476
|
-
log(` --notify <channel:id> 指定通知渠道(如 feishu:ou_xxx, discord:123456)`);
|
|
477
|
-
log(` --yes 跳过所有确认提示\n`);
|
|
478
473
|
process.exit(0);
|
|
479
474
|
}
|
|
480
475
|
|
|
481
|
-
// Parse global flags
|
|
482
|
-
const autoYes = args.includes("--yes") || args.includes("-y");
|
|
483
|
-
|
|
484
|
-
const notifyFlag = args.find((a) => a.startsWith("--notify"));
|
|
485
|
-
const notifyValue = notifyFlag
|
|
486
|
-
? args[args.indexOf(notifyFlag) + 1] ?? notifyFlag.split("=")[1]
|
|
487
|
-
: null;
|
|
488
|
-
let presetNotify = null;
|
|
489
|
-
if (notifyValue && notifyValue.includes(":")) {
|
|
490
|
-
const colonIdx = notifyValue.indexOf(":");
|
|
491
|
-
presetNotify = {
|
|
492
|
-
channel: notifyValue.slice(0, colonIdx),
|
|
493
|
-
target: notifyValue.slice(colonIdx + 1),
|
|
494
|
-
};
|
|
495
|
-
}
|
|
496
|
-
|
|
497
476
|
log(`\n${BOLD}🏪 A2H Market — OpenClaw Plugin Installer${RESET}\n`);
|
|
498
477
|
|
|
499
478
|
// ── Step 1: Check OpenClaw ─────────────────────────────────────
|
|
@@ -528,14 +507,9 @@ async function main() {
|
|
|
528
507
|
const existingId = existing.agent_id ?? existing.agentId ?? "";
|
|
529
508
|
if (existingId) {
|
|
530
509
|
log(` 已有凭证: ${CYAN}${existingId}${RESET}`);
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
reuse = await prompt.ask("使用现有凭证? (Y/n)", "Y");
|
|
535
|
-
prompt.close();
|
|
536
|
-
} else {
|
|
537
|
-
log(` ${DIM}--yes: 自动使用现有凭证${RESET}`);
|
|
538
|
-
}
|
|
510
|
+
const prompt = createPrompt();
|
|
511
|
+
const reuse = await prompt.ask("使用现有凭证? (Y/n)", "Y");
|
|
512
|
+
prompt.close();
|
|
539
513
|
if (reuse.toLowerCase() !== "n") {
|
|
540
514
|
agentId = existingId;
|
|
541
515
|
agentKey = existing.agent_key ?? existing.agentKey ?? "";
|
|
@@ -689,59 +663,52 @@ async function main() {
|
|
|
689
663
|
mqtt_url: mqttUrl,
|
|
690
664
|
};
|
|
691
665
|
|
|
692
|
-
//
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
const channels = detectChannels();
|
|
700
|
-
if (channels.length > 0) {
|
|
701
|
-
log(` 检测到 ${channels.length} 个可用渠道:`);
|
|
702
|
-
channels.forEach((ch, i) => {
|
|
703
|
-
log(` ${CYAN}${i + 1}${RESET}. ${ch.name}`);
|
|
704
|
-
});
|
|
666
|
+
// Detect available channels and let user choose
|
|
667
|
+
const channels = detectChannels();
|
|
668
|
+
if (channels.length > 0) {
|
|
669
|
+
log(` 检测到 ${channels.length} 个可用渠道:`);
|
|
670
|
+
channels.forEach((ch, i) => {
|
|
671
|
+
log(` ${CYAN}${i + 1}${RESET}. ${ch.name}`);
|
|
672
|
+
});
|
|
705
673
|
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
if (chosen.name === "feishu") {
|
|
719
|
-
target = detectFeishuTarget() || "";
|
|
720
|
-
if (target) {
|
|
721
|
-
log(` 检测到飞书用户: ${CYAN}${target}${RESET}`);
|
|
722
|
-
} else {
|
|
723
|
-
target = await prompt2.ask("输入飞书 open_id (ou_xxx) 或 chat_id (oc_xxx)", "");
|
|
724
|
-
}
|
|
725
|
-
} else if (chosen.name === "discord") {
|
|
726
|
-
target = await prompt2.ask("输入 Discord 频道 ID", "");
|
|
727
|
-
} else {
|
|
728
|
-
target = await prompt2.ask(`输入 ${chosen.name} 目标 ID`, "");
|
|
729
|
-
}
|
|
674
|
+
const prompt2 = createPrompt();
|
|
675
|
+
const choice = await prompt2.ask(
|
|
676
|
+
`选择通知渠道 (1-${channels.length},回车跳过)`,
|
|
677
|
+
"",
|
|
678
|
+
);
|
|
679
|
+
|
|
680
|
+
if (choice) {
|
|
681
|
+
const idx = parseInt(choice, 10) - 1;
|
|
682
|
+
if (idx >= 0 && idx < channels.length) {
|
|
683
|
+
const chosen = channels[idx];
|
|
684
|
+
let target = "";
|
|
730
685
|
|
|
686
|
+
if (chosen.name === "feishu") {
|
|
687
|
+
target = detectFeishuTarget() || "";
|
|
731
688
|
if (target) {
|
|
732
|
-
|
|
733
|
-
log(` ${CHECK} 通知渠道已配置: ${chosen.name} → ${target}`);
|
|
689
|
+
log(` 检测到飞书用户: ${CYAN}${target}${RESET}`);
|
|
734
690
|
} else {
|
|
735
|
-
|
|
691
|
+
target = await prompt2.ask("输入飞书 open_id (ou_xxx) 或 chat_id (oc_xxx)", "");
|
|
736
692
|
}
|
|
693
|
+
} else if (chosen.name === "discord") {
|
|
694
|
+
target = await prompt2.ask("输入 Discord 频道 ID", "");
|
|
695
|
+
} else {
|
|
696
|
+
target = await prompt2.ask(`输入 ${chosen.name} 目标 ID`, "");
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
if (target) {
|
|
700
|
+
credsData.notify = { channel: chosen.name, target };
|
|
701
|
+
log(` ${CHECK} 通知渠道已配置: ${chosen.name} → ${target}`);
|
|
702
|
+
} else {
|
|
703
|
+
log(` ${WARN} 未输入目标 ID,跳过通知配置`);
|
|
737
704
|
}
|
|
738
|
-
} else {
|
|
739
|
-
log(` ${DIM}跳过通知配置${RESET}`);
|
|
740
705
|
}
|
|
741
|
-
prompt2.close();
|
|
742
706
|
} else {
|
|
743
|
-
log(` ${DIM}
|
|
707
|
+
log(` ${DIM}跳过通知配置${RESET}`);
|
|
744
708
|
}
|
|
709
|
+
prompt2.close();
|
|
710
|
+
} else {
|
|
711
|
+
log(` ${DIM}未检测到可用渠道,跳过通知配置${RESET}`);
|
|
745
712
|
}
|
|
746
713
|
|
|
747
714
|
// Save credentials file (fallback for dev mode)
|