@cannbot-ai/install-helper 0.0.2-beta.7 → 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 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("sh", ["-c", `command -v ${cmd}`], { timeout: 5e3 });
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("[1/4] \u9009\u62E9 AI \u7F16\u7A0B\u5DE5\u5177");
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("[2/4] \u9009\u62E9\u5B89\u88C5\u4F4D\u7F6E");
971
+ printBoxTitle(t("wizard_step_2_title"));
938
972
  const choices = [
939
- { name: "> project \u2014 \u5B89\u88C5\u5230\u5F53\u524D\u76EE\u5F55\uFF08\u63A8\u8350\uFF0C\u4EC5\u5F53\u524D\u9879\u76EE\u53EF\u7528\uFF09", value: "project" },
940
- { name: "> global \u2014 \u5B89\u88C5\u5230\u5168\u5C40\uFF08\u6240\u6709\u9879\u76EE\u5171\u4EAB\uFF09", value: "global" },
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("[3/4] \u9009\u62E9\u8981\u5B89\u88C5\u7684\u63D2\u4EF6");
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("[4/4] \u786E\u8BA4\u5B89\u88C5");
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);
@@ -1926,10 +1960,13 @@ async function installPlugin(opts) {
1926
1960
  if (existsSync9(agentsFile)) {
1927
1961
  const currentPlugin = detectCurrentPlugin(configRoot, opts.tool);
1928
1962
  if (currentPlugin && currentPlugin.pluginId !== opts.pluginId) {
1929
- const choice = await showOverwriteWarning(
1930
- currentPlugin.pluginName,
1931
- plugin.displayName
1932
- );
1963
+ let choice = "overwrite";
1964
+ if (!opts.yes) {
1965
+ choice = await showOverwriteWarning(
1966
+ currentPlugin.pluginName,
1967
+ plugin.displayName
1968
+ );
1969
+ }
1933
1970
  if (choice === "cancel") {
1934
1971
  logger.info(t("backup_cancel"));
1935
1972
  return {
@@ -1953,11 +1990,13 @@ async function installPlugin(opts) {
1953
1990
  }
1954
1991
  }
1955
1992
  try {
1956
- await execa3("bash", [scriptPath, ...args], {
1993
+ const execOptions = {
1957
1994
  cwd,
1958
1995
  timeout: 3e5,
1959
- stdio: "pipe"
1960
- });
1996
+ stdio: "pipe",
1997
+ input: opts.yes ? "y\n" : void 0
1998
+ };
1999
+ await execa3("bash", [scriptPath, ...args], execOptions);
1961
2000
  const manifest = readManifest(configRoot);
1962
2001
  let skillsCount = 0;
1963
2002
  let agentsCount = 0;
@@ -2109,7 +2148,7 @@ async function interactiveSkillSelect() {
2109
2148
  while (true) {
2110
2149
  switch (step) {
2111
2150
  case 0: {
2112
- printBoxTitle("[3/4] \u9009\u62E9 Skill \u7C7B\u522B");
2151
+ printBoxTitle(t("wizard_step_3_skill_title"));
2113
2152
  const categoryChoices = [
2114
2153
  ...categories.map((cat) => ({
2115
2154
  name: `> ${cat.name} (${cat.skills.length} skills)`,
@@ -2135,7 +2174,7 @@ async function interactiveSkillSelect() {
2135
2174
  case 1: {
2136
2175
  const category = categories.find((c) => c.id === selectedCategoryId);
2137
2176
  if (!category) return [];
2138
- printBoxTitle(`[4/4] \u9009\u62E9\u8981\u5B89\u88C5\u7684 Skills \u2014 ${category.name}`);
2177
+ printBoxTitle(t("wizard_step_4_skill_title").replace("{category}", category.name));
2139
2178
  const tools = ["opencode", "claude", "trae", "cursor", "copilot"];
2140
2179
  const levels = ["project", "global"];
2141
2180
  const installedSkills = [];
@@ -2325,14 +2364,14 @@ async function initCommand() {
2325
2364
  return;
2326
2365
  }
2327
2366
  printBanner(t("wizard_title"));
2328
- const spinner = createSpinner("\u6B63\u5728\u52A0\u8F7D Skills \u5217\u8868...");
2367
+ const spinner = createSpinner(t("loading_skills_list"));
2329
2368
  spinner.start();
2330
2369
  try {
2331
2370
  const repoManager = createRepositoryManager();
2332
2371
  await repoManager.ensureRepoAndScan();
2333
- spinner.succeed("Skills \u5217\u8868\u52A0\u8F7D\u5B8C\u6210");
2372
+ spinner.succeed(t("loading_skills_list_complete"));
2334
2373
  } catch {
2335
- spinner.warn("Skills \u5217\u8868\u52A0\u8F7D\u5931\u8D25\uFF0C\u5C06\u4F7F\u7528\u5185\u7F6E\u6570\u636E");
2374
+ spinner.warn(t("loading_skills_list_failed"));
2336
2375
  }
2337
2376
  let step = 0;
2338
2377
  let mode = "plugin";
@@ -2366,7 +2405,7 @@ async function initCommand() {
2366
2405
  }
2367
2406
  }
2368
2407
  async function selectMode() {
2369
- printBoxTitle("\u9009\u62E9\u5B89\u88C5\u7C7B\u578B");
2408
+ printBoxTitle(t("wizard_select_mode_title"));
2370
2409
  const CANCEL3 = "__cancel__";
2371
2410
  const choices = [
2372
2411
  {
@@ -2398,10 +2437,10 @@ async function pluginInstallFlow() {
2398
2437
  return "done";
2399
2438
  }
2400
2439
  const repoManager = createRepositoryManager();
2401
- const spinner = createSpinner("\u6B63\u5728\u52A0\u8F7D\u63D2\u4EF6\u6570\u636E...");
2440
+ const spinner = createSpinner(t("loading_plugin_data"));
2402
2441
  spinner.start();
2403
2442
  const repoPath = await repoManager.ensureRepo();
2404
- spinner.succeed("\u63D2\u4EF6\u6570\u636E\u52A0\u8F7D\u5B8C\u6210");
2443
+ spinner.succeed(t("loading_plugin_data_complete"));
2405
2444
  const allPlugins = getAllPlugins();
2406
2445
  const selectedPlugins = answers.plugins.map(
2407
2446
  (id) => allPlugins.find((p) => p.id === id)
@@ -2487,14 +2526,14 @@ async function skillInstallFlow() {
2487
2526
  return "done";
2488
2527
  }
2489
2528
  if (selectedSkills.length === 0) {
2490
- logger.info("\u672A\u9009\u62E9\u4EFB\u4F55 Skill");
2529
+ logger.info(t("install_no_skill_selected"));
2491
2530
  return "done";
2492
2531
  }
2493
2532
  const repoManager = createRepositoryManager();
2494
- const spinner = createSpinner("\u6B63\u5728\u52A0\u8F7D\u63D2\u4EF6\u6570\u636E...");
2533
+ const spinner = createSpinner(t("loading_plugin_data"));
2495
2534
  spinner.start();
2496
2535
  const repoPath = await repoManager.ensureRepo();
2497
- spinner.succeed("\u63D2\u4EF6\u6570\u636E\u52A0\u8F7D\u5B8C\u6210");
2536
+ spinner.succeed(t("loading_plugin_data_complete"));
2498
2537
  logger.info(`${t("skill_install_progress")} ${chalk6.bold(selectedSkills.length)} \u4E2A Skills...`);
2499
2538
  const results = await installSkills(selectedSkills, tool, level, repoPath);
2500
2539
  let successCount = 0;
@@ -2515,8 +2554,8 @@ async function skillInstallFlow() {
2515
2554
  logger.blank();
2516
2555
  logger.success(`${t("skill_install_done")}: ${chalk6.green(successCount + " \u6210\u529F")}, ${failCount > 0 ? chalk6.red(failCount + " \u5931\u8D25") : chalk6.dim(failCount + " \u5931\u8D25")}`);
2517
2556
  logger.blank();
2518
- logger.info(`\u5B89\u88C5\u5230: ${chalk6.cyan(configRoot + "/skills/")}`);
2519
- logger.info(`\u542F\u52A8 ${chalk6.green(tool)} \u5373\u53EF\u4F7F\u7528`);
2557
+ logger.info(`${t("install_to")}: ${chalk6.cyan(configRoot + "/skills/")}`);
2558
+ logger.info(`${t("start_to_use").replace("{tool}", chalk6.green(tool))}`);
2520
2559
  logger.blank();
2521
2560
  return "done";
2522
2561
  }
@@ -2734,7 +2773,7 @@ async function installCommand(names, options) {
2734
2773
  return;
2735
2774
  }
2736
2775
  if (names.length === 0) {
2737
- const scanSpinner2 = createSpinner("\u6B63\u5728\u52A0\u8F7D Skills \u5217\u8868...");
2776
+ const scanSpinner2 = createSpinner(t("loading_skills_list"));
2738
2777
  scanSpinner2.start();
2739
2778
  try {
2740
2779
  const scanRepoManager = createRepositoryManager();
@@ -2763,12 +2802,12 @@ async function installCommand(names, options) {
2763
2802
  break;
2764
2803
  }
2765
2804
  if (selectedSkills.length === 0) {
2766
- logger.info("\u672A\u9009\u62E9\u4EFB\u4F55 Skill");
2805
+ logger.info(t("install_no_skill_selected"));
2767
2806
  return;
2768
2807
  }
2769
2808
  names = selectedSkills;
2770
2809
  const repoManager = createRepositoryManager();
2771
- const spinner = createSpinner("\u6B63\u5728\u52A0\u8F7D\u63D2\u4EF6\u6570\u636E...");
2810
+ const spinner = createSpinner(t("loading_plugin_data"));
2772
2811
  spinner.start();
2773
2812
  const repoPath = await repoManager.ensureRepo();
2774
2813
  spinner.succeed("\u63D2\u4EF6\u6570\u636E\u52A0\u8F7D\u5B8C\u6210");
@@ -2793,15 +2832,15 @@ async function installCommand(names, options) {
2793
2832
  logger.blank();
2794
2833
  logger.success(`${t("skill_install_done")}: ${chalk9.green(successCount + " \u6210\u529F")}, ${failCount > 0 ? chalk9.red(failCount + " \u5931\u8D25") : chalk9.dim(failCount + " \u5931\u8D25")}`);
2795
2834
  logger.blank();
2796
- logger.info(`\u5B89\u88C5\u5230: ${chalk9.cyan(configRoot + "/skills/")}`);
2797
- logger.info(`\u542F\u52A8 ${chalk9.green(tool2)} \u5373\u53EF\u4F7F\u7528`);
2835
+ logger.info(`${t("install_to")}: ${chalk9.cyan(configRoot + "/skills/")}`);
2836
+ logger.info(`${t("start_to_use").replace("{tool}", chalk9.green(tool2))}`);
2798
2837
  logger.blank();
2799
2838
  return;
2800
2839
  }
2801
2840
  }
2802
2841
  }
2803
2842
  }
2804
- const scanSpinner = createSpinner("\u6B63\u5728\u52A0\u8F7D Skills \u5217\u8868...");
2843
+ const scanSpinner = createSpinner(t("loading_skills_list"));
2805
2844
  scanSpinner.start();
2806
2845
  try {
2807
2846
  const scanRepoManager = createRepositoryManager();
@@ -2868,16 +2907,18 @@ async function installCommand(names, options) {
2868
2907
  }
2869
2908
  if (pluginsToInstall.length > 0) {
2870
2909
  const repoManager = createRepositoryManager();
2871
- const spinner = createSpinner("\u6B63\u5728\u52A0\u8F7D\u63D2\u4EF6\u6570\u636E...");
2910
+ const spinner = createSpinner(t("loading_plugin_data"));
2872
2911
  spinner.start();
2873
2912
  const repoPath = await repoManager.ensureRepo();
2874
- spinner.succeed("\u63D2\u4EF6\u6570\u636E\u52A0\u8F7D\u5B8C\u6210");
2913
+ spinner.succeed(t("loading_plugin_data_complete"));
2875
2914
  const allPlugins = getAllPlugins();
2876
2915
  const results = await installPlugins(
2877
2916
  pluginsToInstall,
2878
2917
  tool,
2879
2918
  level,
2880
- repoPath
2919
+ repoPath,
2920
+ void 0,
2921
+ options.yes
2881
2922
  );
2882
2923
  const summary = results.map((result) => {
2883
2924
  const plugin = allPlugins.find((p) => p.id === result.pluginId);
@@ -2895,10 +2936,10 @@ async function installCommand(names, options) {
2895
2936
  }
2896
2937
  if (skills.length > 0) {
2897
2938
  const repoManager = createRepositoryManager();
2898
- const spinner = createSpinner("\u6B63\u5728\u52A0\u8F7D\u63D2\u4EF6\u6570\u636E...");
2939
+ const spinner = createSpinner(t("loading_plugin_data"));
2899
2940
  spinner.start();
2900
2941
  const repoPath = await repoManager.ensureRepo();
2901
- spinner.succeed("\u63D2\u4EF6\u6570\u636E\u52A0\u8F7D\u5B8C\u6210");
2942
+ spinner.succeed(t("loading_plugin_data_complete"));
2902
2943
  logger.info(`${t("skill_install_progress")} ${chalk9.bold(skills.length)} \u4E2A Skills...`);
2903
2944
  const results = await installSkills(skills, tool, level, repoPath);
2904
2945
  let successCount = 0;
@@ -2918,8 +2959,8 @@ async function installCommand(names, options) {
2918
2959
  logger.blank();
2919
2960
  logger.success(`${t("skill_install_done")}: ${chalk9.green(successCount + " \u6210\u529F")}, ${failCount > 0 ? chalk9.red(failCount + " \u5931\u8D25") : chalk9.dim(failCount + " \u5931\u8D25")}`);
2920
2961
  logger.blank();
2921
- logger.info(`\u5B89\u88C5\u5230: ${chalk9.cyan(getConfigRoot(tool, level) + "/skills/")}`);
2922
- logger.info(`\u542F\u52A8 ${chalk9.green(tool)} \u5373\u53EF\u4F7F\u7528`);
2962
+ logger.info(`${t("install_to")}: ${chalk9.cyan(getConfigRoot(tool, level) + "/skills/")}`);
2963
+ logger.info(`${t("start_to_use").replace("{tool}", chalk9.green(tool))}`);
2923
2964
  logger.blank();
2924
2965
  }
2925
2966
  }
@@ -3231,7 +3272,7 @@ function createCLI() {
3231
3272
  setLanguage(config.language);
3232
3273
  }
3233
3274
  const program2 = new Command();
3234
- program2.name("install-helper").description("CANNBot Install Helper - Interactive installer for CANN operator development skills").version("0.0.2-beta.7");
3275
+ program2.name("install-helper").description("CANNBot Install Helper - Interactive installer for CANN operator development skills").version("0.0.2-beta.9");
3235
3276
  program2.command("init", { isDefault: false }).description("Run interactive installation wizard").action(async () => {
3236
3277
  await initCommand();
3237
3278
  });