@cannbot-ai/install-helper 0.0.2-beta.8 → 0.0.2-beta.9
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/index.js +69 -35
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -232,7 +232,7 @@ async function getCommandVersion(cmd, args = ["--version"]) {
|
|
|
232
232
|
}
|
|
233
233
|
async function getCommandPath(cmd) {
|
|
234
234
|
try {
|
|
235
|
-
const result = await execa("
|
|
235
|
+
const result = await execa("which", [cmd], { timeout: 5e3 });
|
|
236
236
|
return result.stdout.trim();
|
|
237
237
|
} catch {
|
|
238
238
|
return void 0;
|
|
@@ -508,7 +508,24 @@ var zh_CN = {
|
|
|
508
508
|
backup_only_uninstall: "\u4EC5\u5378\u8F7D\uFF08\u4E0D\u6062\u590D\uFF09",
|
|
509
509
|
backup_select_action: "\u8BF7\u9009\u62E9\u64CD\u4F5C",
|
|
510
510
|
backup_restore_success: "\u5DF2\u6062\u590D\u914D\u7F6E",
|
|
511
|
-
backup_created: "\u5DF2\u521B\u5EFA\u5907\u4EFD"
|
|
511
|
+
backup_created: "\u5DF2\u521B\u5EFA\u5907\u4EFD",
|
|
512
|
+
loading_skills_list: "\u6B63\u5728\u52A0\u8F7D Skills \u5217\u8868...",
|
|
513
|
+
loading_skills_list_complete: "Skills \u5217\u8868\u52A0\u8F7D\u5B8C\u6210",
|
|
514
|
+
loading_plugin_data: "\u6B63\u5728\u52A0\u8F7D\u63D2\u4EF6\u6570\u636E...",
|
|
515
|
+
loading_plugin_data_complete: "\u63D2\u4EF6\u6570\u636E\u52A0\u8F7D\u5B8C\u6210",
|
|
516
|
+
loading_skills_list_failed: "Skills \u5217\u8868\u52A0\u8F7D\u5931\u8D25\uFF0C\u5C06\u4F7F\u7528\u5185\u7F6E\u6570\u636E",
|
|
517
|
+
install_no_skill_selected: "\u672A\u9009\u62E9\u4EFB\u4F55 Skill",
|
|
518
|
+
install_to: "\u5B89\u88C5\u5230",
|
|
519
|
+
start_to_use: "\u542F\u52A8 {tool} \u5373\u53EF\u4F7F\u7528",
|
|
520
|
+
wizard_step_1_title: "[1/4] \u9009\u62E9 AI \u7F16\u7A0B\u5DE5\u5177",
|
|
521
|
+
wizard_step_2_title: "[2/4] \u9009\u62E9\u5B89\u88C5\u4F4D\u7F6E",
|
|
522
|
+
wizard_step_3_title: "[3/4] \u9009\u62E9\u8981\u5B89\u88C5\u7684\u63D2\u4EF6",
|
|
523
|
+
wizard_step_4_title: "[4/4] \u786E\u8BA4\u5B89\u88C5",
|
|
524
|
+
wizard_step_3_skill_title: "[3/4] \u9009\u62E9 Skill \u7C7B\u522B",
|
|
525
|
+
wizard_step_4_skill_title: "[4/4] \u9009\u62E9\u8981\u5B89\u88C5\u7684 Skills \u2014 {category}",
|
|
526
|
+
install_level_project: "\u5B89\u88C5\u5230\u5F53\u524D\u76EE\u5F55\uFF08\u63A8\u8350\uFF0C\u4EC5\u5F53\u524D\u9879\u76EE\u53EF\u7528\uFF09",
|
|
527
|
+
install_level_global: "\u5B89\u88C5\u5230\u5168\u5C40\uFF08\u6240\u6709\u9879\u76EE\u5171\u4EAB\uFF09",
|
|
528
|
+
wizard_select_mode_title: "\u9009\u62E9\u5B89\u88C5\u7C7B\u578B"
|
|
512
529
|
};
|
|
513
530
|
var en_US = {
|
|
514
531
|
wizard_title: "CANNBot Install Helper",
|
|
@@ -626,7 +643,24 @@ var en_US = {
|
|
|
626
643
|
backup_only_uninstall: "Uninstall only (no restore)",
|
|
627
644
|
backup_select_action: "Please select an action",
|
|
628
645
|
backup_restore_success: "Configuration restored",
|
|
629
|
-
backup_created: "Backup created"
|
|
646
|
+
backup_created: "Backup created",
|
|
647
|
+
loading_skills_list: "Loading Skills list...",
|
|
648
|
+
loading_skills_list_complete: "Skills list loaded",
|
|
649
|
+
loading_plugin_data: "Loading plugin data...",
|
|
650
|
+
loading_plugin_data_complete: "Plugin data loaded",
|
|
651
|
+
loading_skills_list_failed: "Failed to load Skills list, using built-in data",
|
|
652
|
+
install_no_skill_selected: "No Skill selected",
|
|
653
|
+
install_to: "Install to",
|
|
654
|
+
start_to_use: "Start {tool} to use",
|
|
655
|
+
wizard_step_1_title: "[1/4] Select AI coding tool",
|
|
656
|
+
wizard_step_2_title: "[2/4] Select installation location",
|
|
657
|
+
wizard_step_3_title: "[3/4] Select plugins to install",
|
|
658
|
+
wizard_step_4_title: "[4/4] Confirm installation",
|
|
659
|
+
wizard_step_3_skill_title: "[3/4] Select Skill category",
|
|
660
|
+
wizard_step_4_skill_title: "[4/4] Select Skills to install \u2014 {category}",
|
|
661
|
+
install_level_project: "Install to current directory (recommended, current project only)",
|
|
662
|
+
install_level_global: "Install globally (all projects)",
|
|
663
|
+
wizard_select_mode_title: "Select installation type"
|
|
630
664
|
};
|
|
631
665
|
var currentLang = "zh_CN";
|
|
632
666
|
function setLanguage(lang) {
|
|
@@ -859,7 +893,7 @@ async function runWizard() {
|
|
|
859
893
|
}
|
|
860
894
|
}
|
|
861
895
|
async function stepTool(detectedTools, lastTool) {
|
|
862
|
-
printBoxTitle("
|
|
896
|
+
printBoxTitle(t("wizard_step_1_title"));
|
|
863
897
|
if (detectedTools.length === 0) {
|
|
864
898
|
logger.error(t("error_tool_not_found"));
|
|
865
899
|
const choices2 = [
|
|
@@ -934,10 +968,10 @@ async function stepToolManual(lastTool) {
|
|
|
934
968
|
return result;
|
|
935
969
|
}
|
|
936
970
|
async function stepLevel(lastLevel) {
|
|
937
|
-
printBoxTitle("
|
|
971
|
+
printBoxTitle(t("wizard_step_2_title"));
|
|
938
972
|
const choices = [
|
|
939
|
-
{ name:
|
|
940
|
-
{ name:
|
|
973
|
+
{ name: `> project \u2014 ${t("install_level_project")}`, value: "project" },
|
|
974
|
+
{ name: `> global \u2014 ${t("install_level_global")}`, value: "global" },
|
|
941
975
|
new Separator("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"),
|
|
942
976
|
{ name: "<- " + t("wizard_back"), value: BACK },
|
|
943
977
|
{ name: "x " + t("wizard_cancel"), value: CANCEL }
|
|
@@ -955,7 +989,7 @@ async function stepLevel(lastLevel) {
|
|
|
955
989
|
return result;
|
|
956
990
|
}
|
|
957
991
|
async function stepPlugins(tool, level) {
|
|
958
|
-
printBoxTitle("
|
|
992
|
+
printBoxTitle(t("wizard_step_3_title"));
|
|
959
993
|
const plugins = getAllPlugins();
|
|
960
994
|
const configRoot = getConfigRoot(tool, level);
|
|
961
995
|
const manifests = readAllManifests(configRoot);
|
|
@@ -996,7 +1030,7 @@ async function stepPlugins(tool, level) {
|
|
|
996
1030
|
return pluginIds;
|
|
997
1031
|
}
|
|
998
1032
|
async function stepConfirm(tool, level, plugins) {
|
|
999
|
-
printBoxTitle("
|
|
1033
|
+
printBoxTitle(t("wizard_step_4_title"));
|
|
1000
1034
|
const allPlugins = getAllPlugins();
|
|
1001
1035
|
const selectedPlugins = plugins.map((id) => allPlugins.find((p) => p.id === id));
|
|
1002
1036
|
const displayPath = getConfigRoot(tool, level);
|
|
@@ -2114,7 +2148,7 @@ async function interactiveSkillSelect() {
|
|
|
2114
2148
|
while (true) {
|
|
2115
2149
|
switch (step) {
|
|
2116
2150
|
case 0: {
|
|
2117
|
-
printBoxTitle("
|
|
2151
|
+
printBoxTitle(t("wizard_step_3_skill_title"));
|
|
2118
2152
|
const categoryChoices = [
|
|
2119
2153
|
...categories.map((cat) => ({
|
|
2120
2154
|
name: `> ${cat.name} (${cat.skills.length} skills)`,
|
|
@@ -2140,7 +2174,7 @@ async function interactiveSkillSelect() {
|
|
|
2140
2174
|
case 1: {
|
|
2141
2175
|
const category = categories.find((c) => c.id === selectedCategoryId);
|
|
2142
2176
|
if (!category) return [];
|
|
2143
|
-
printBoxTitle(
|
|
2177
|
+
printBoxTitle(t("wizard_step_4_skill_title").replace("{category}", category.name));
|
|
2144
2178
|
const tools = ["opencode", "claude", "trae", "cursor", "copilot"];
|
|
2145
2179
|
const levels = ["project", "global"];
|
|
2146
2180
|
const installedSkills = [];
|
|
@@ -2330,14 +2364,14 @@ async function initCommand() {
|
|
|
2330
2364
|
return;
|
|
2331
2365
|
}
|
|
2332
2366
|
printBanner(t("wizard_title"));
|
|
2333
|
-
const spinner = createSpinner("
|
|
2367
|
+
const spinner = createSpinner(t("loading_skills_list"));
|
|
2334
2368
|
spinner.start();
|
|
2335
2369
|
try {
|
|
2336
2370
|
const repoManager = createRepositoryManager();
|
|
2337
2371
|
await repoManager.ensureRepoAndScan();
|
|
2338
|
-
spinner.succeed("
|
|
2372
|
+
spinner.succeed(t("loading_skills_list_complete"));
|
|
2339
2373
|
} catch {
|
|
2340
|
-
spinner.warn("
|
|
2374
|
+
spinner.warn(t("loading_skills_list_failed"));
|
|
2341
2375
|
}
|
|
2342
2376
|
let step = 0;
|
|
2343
2377
|
let mode = "plugin";
|
|
@@ -2371,7 +2405,7 @@ async function initCommand() {
|
|
|
2371
2405
|
}
|
|
2372
2406
|
}
|
|
2373
2407
|
async function selectMode() {
|
|
2374
|
-
printBoxTitle("
|
|
2408
|
+
printBoxTitle(t("wizard_select_mode_title"));
|
|
2375
2409
|
const CANCEL3 = "__cancel__";
|
|
2376
2410
|
const choices = [
|
|
2377
2411
|
{
|
|
@@ -2403,10 +2437,10 @@ async function pluginInstallFlow() {
|
|
|
2403
2437
|
return "done";
|
|
2404
2438
|
}
|
|
2405
2439
|
const repoManager = createRepositoryManager();
|
|
2406
|
-
const spinner = createSpinner("
|
|
2440
|
+
const spinner = createSpinner(t("loading_plugin_data"));
|
|
2407
2441
|
spinner.start();
|
|
2408
2442
|
const repoPath = await repoManager.ensureRepo();
|
|
2409
|
-
spinner.succeed("
|
|
2443
|
+
spinner.succeed(t("loading_plugin_data_complete"));
|
|
2410
2444
|
const allPlugins = getAllPlugins();
|
|
2411
2445
|
const selectedPlugins = answers.plugins.map(
|
|
2412
2446
|
(id) => allPlugins.find((p) => p.id === id)
|
|
@@ -2492,14 +2526,14 @@ async function skillInstallFlow() {
|
|
|
2492
2526
|
return "done";
|
|
2493
2527
|
}
|
|
2494
2528
|
if (selectedSkills.length === 0) {
|
|
2495
|
-
logger.info("
|
|
2529
|
+
logger.info(t("install_no_skill_selected"));
|
|
2496
2530
|
return "done";
|
|
2497
2531
|
}
|
|
2498
2532
|
const repoManager = createRepositoryManager();
|
|
2499
|
-
const spinner = createSpinner("
|
|
2533
|
+
const spinner = createSpinner(t("loading_plugin_data"));
|
|
2500
2534
|
spinner.start();
|
|
2501
2535
|
const repoPath = await repoManager.ensureRepo();
|
|
2502
|
-
spinner.succeed("
|
|
2536
|
+
spinner.succeed(t("loading_plugin_data_complete"));
|
|
2503
2537
|
logger.info(`${t("skill_install_progress")} ${chalk6.bold(selectedSkills.length)} \u4E2A Skills...`);
|
|
2504
2538
|
const results = await installSkills(selectedSkills, tool, level, repoPath);
|
|
2505
2539
|
let successCount = 0;
|
|
@@ -2520,8 +2554,8 @@ async function skillInstallFlow() {
|
|
|
2520
2554
|
logger.blank();
|
|
2521
2555
|
logger.success(`${t("skill_install_done")}: ${chalk6.green(successCount + " \u6210\u529F")}, ${failCount > 0 ? chalk6.red(failCount + " \u5931\u8D25") : chalk6.dim(failCount + " \u5931\u8D25")}`);
|
|
2522
2556
|
logger.blank();
|
|
2523
|
-
logger.info(
|
|
2524
|
-
logger.info(
|
|
2557
|
+
logger.info(`${t("install_to")}: ${chalk6.cyan(configRoot + "/skills/")}`);
|
|
2558
|
+
logger.info(`${t("start_to_use").replace("{tool}", chalk6.green(tool))}`);
|
|
2525
2559
|
logger.blank();
|
|
2526
2560
|
return "done";
|
|
2527
2561
|
}
|
|
@@ -2739,7 +2773,7 @@ async function installCommand(names, options) {
|
|
|
2739
2773
|
return;
|
|
2740
2774
|
}
|
|
2741
2775
|
if (names.length === 0) {
|
|
2742
|
-
const scanSpinner2 = createSpinner("
|
|
2776
|
+
const scanSpinner2 = createSpinner(t("loading_skills_list"));
|
|
2743
2777
|
scanSpinner2.start();
|
|
2744
2778
|
try {
|
|
2745
2779
|
const scanRepoManager = createRepositoryManager();
|
|
@@ -2768,12 +2802,12 @@ async function installCommand(names, options) {
|
|
|
2768
2802
|
break;
|
|
2769
2803
|
}
|
|
2770
2804
|
if (selectedSkills.length === 0) {
|
|
2771
|
-
logger.info("
|
|
2805
|
+
logger.info(t("install_no_skill_selected"));
|
|
2772
2806
|
return;
|
|
2773
2807
|
}
|
|
2774
2808
|
names = selectedSkills;
|
|
2775
2809
|
const repoManager = createRepositoryManager();
|
|
2776
|
-
const spinner = createSpinner("
|
|
2810
|
+
const spinner = createSpinner(t("loading_plugin_data"));
|
|
2777
2811
|
spinner.start();
|
|
2778
2812
|
const repoPath = await repoManager.ensureRepo();
|
|
2779
2813
|
spinner.succeed("\u63D2\u4EF6\u6570\u636E\u52A0\u8F7D\u5B8C\u6210");
|
|
@@ -2798,15 +2832,15 @@ async function installCommand(names, options) {
|
|
|
2798
2832
|
logger.blank();
|
|
2799
2833
|
logger.success(`${t("skill_install_done")}: ${chalk9.green(successCount + " \u6210\u529F")}, ${failCount > 0 ? chalk9.red(failCount + " \u5931\u8D25") : chalk9.dim(failCount + " \u5931\u8D25")}`);
|
|
2800
2834
|
logger.blank();
|
|
2801
|
-
logger.info(
|
|
2802
|
-
logger.info(
|
|
2835
|
+
logger.info(`${t("install_to")}: ${chalk9.cyan(configRoot + "/skills/")}`);
|
|
2836
|
+
logger.info(`${t("start_to_use").replace("{tool}", chalk9.green(tool2))}`);
|
|
2803
2837
|
logger.blank();
|
|
2804
2838
|
return;
|
|
2805
2839
|
}
|
|
2806
2840
|
}
|
|
2807
2841
|
}
|
|
2808
2842
|
}
|
|
2809
|
-
const scanSpinner = createSpinner("
|
|
2843
|
+
const scanSpinner = createSpinner(t("loading_skills_list"));
|
|
2810
2844
|
scanSpinner.start();
|
|
2811
2845
|
try {
|
|
2812
2846
|
const scanRepoManager = createRepositoryManager();
|
|
@@ -2873,10 +2907,10 @@ async function installCommand(names, options) {
|
|
|
2873
2907
|
}
|
|
2874
2908
|
if (pluginsToInstall.length > 0) {
|
|
2875
2909
|
const repoManager = createRepositoryManager();
|
|
2876
|
-
const spinner = createSpinner("
|
|
2910
|
+
const spinner = createSpinner(t("loading_plugin_data"));
|
|
2877
2911
|
spinner.start();
|
|
2878
2912
|
const repoPath = await repoManager.ensureRepo();
|
|
2879
|
-
spinner.succeed("
|
|
2913
|
+
spinner.succeed(t("loading_plugin_data_complete"));
|
|
2880
2914
|
const allPlugins = getAllPlugins();
|
|
2881
2915
|
const results = await installPlugins(
|
|
2882
2916
|
pluginsToInstall,
|
|
@@ -2902,10 +2936,10 @@ async function installCommand(names, options) {
|
|
|
2902
2936
|
}
|
|
2903
2937
|
if (skills.length > 0) {
|
|
2904
2938
|
const repoManager = createRepositoryManager();
|
|
2905
|
-
const spinner = createSpinner("
|
|
2939
|
+
const spinner = createSpinner(t("loading_plugin_data"));
|
|
2906
2940
|
spinner.start();
|
|
2907
2941
|
const repoPath = await repoManager.ensureRepo();
|
|
2908
|
-
spinner.succeed("
|
|
2942
|
+
spinner.succeed(t("loading_plugin_data_complete"));
|
|
2909
2943
|
logger.info(`${t("skill_install_progress")} ${chalk9.bold(skills.length)} \u4E2A Skills...`);
|
|
2910
2944
|
const results = await installSkills(skills, tool, level, repoPath);
|
|
2911
2945
|
let successCount = 0;
|
|
@@ -2925,8 +2959,8 @@ async function installCommand(names, options) {
|
|
|
2925
2959
|
logger.blank();
|
|
2926
2960
|
logger.success(`${t("skill_install_done")}: ${chalk9.green(successCount + " \u6210\u529F")}, ${failCount > 0 ? chalk9.red(failCount + " \u5931\u8D25") : chalk9.dim(failCount + " \u5931\u8D25")}`);
|
|
2927
2961
|
logger.blank();
|
|
2928
|
-
logger.info(
|
|
2929
|
-
logger.info(
|
|
2962
|
+
logger.info(`${t("install_to")}: ${chalk9.cyan(getConfigRoot(tool, level) + "/skills/")}`);
|
|
2963
|
+
logger.info(`${t("start_to_use").replace("{tool}", chalk9.green(tool))}`);
|
|
2930
2964
|
logger.blank();
|
|
2931
2965
|
}
|
|
2932
2966
|
}
|
|
@@ -3238,7 +3272,7 @@ function createCLI() {
|
|
|
3238
3272
|
setLanguage(config.language);
|
|
3239
3273
|
}
|
|
3240
3274
|
const program2 = new Command();
|
|
3241
|
-
program2.name("install-helper").description("CANNBot Install Helper - Interactive installer for CANN operator development skills").version("0.0.2-beta.
|
|
3275
|
+
program2.name("install-helper").description("CANNBot Install Helper - Interactive installer for CANN operator development skills").version("0.0.2-beta.9");
|
|
3242
3276
|
program2.command("init", { isDefault: false }).description("Run interactive installation wizard").action(async () => {
|
|
3243
3277
|
await initCommand();
|
|
3244
3278
|
});
|