@cannbot-ai/install-helper 0.0.2-beta.6 → 1.0.0
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 +78 -38
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import { select as select3, Separator as Separator3 } from "@inquirer/prompts";
|
|
|
8
8
|
import chalk5 from "chalk";
|
|
9
9
|
|
|
10
10
|
// src/ui/wizard.ts
|
|
11
|
-
import { select,
|
|
11
|
+
import { select, Separator } from "@inquirer/prompts";
|
|
12
12
|
import chalk2 from "chalk";
|
|
13
13
|
|
|
14
14
|
// src/core/registry.ts
|
|
@@ -478,10 +478,27 @@ var zh_CN = {
|
|
|
478
478
|
status_install_time: "\u5B89\u88C5\u65F6\u95F4",
|
|
479
479
|
install_installed_to: "\u5B89\u88C5\u5230",
|
|
480
480
|
install_skills_count: "Skills",
|
|
481
|
-
install_agents_count: "Agents"
|
|
481
|
+
install_agents_count: "Agents",
|
|
482
|
+
lang_supported: "\u652F\u6301\u7684\u8BED\u8A00: zh_CN, en_US",
|
|
483
|
+
lang_usage: "\u7528\u6CD5: install-helper lang set <language>",
|
|
484
|
+
lang_specify: "\u8BF7\u6307\u5B9A\u8BED\u8A00: install-helper lang set zh_CN",
|
|
485
|
+
lang_unknown_action: "\u672A\u77E5\u64CD\u4F5C",
|
|
486
|
+
lang_supported_actions: "\u652F\u6301\u7684\u64CD\u4F5C: show, set",
|
|
487
|
+
info_aliases: "\u522B\u540D",
|
|
488
|
+
uninstall_not_found: "\u672A\u627E\u5230",
|
|
489
|
+
uninstall_no_record: "\u672A\u627E\u5230\u5B89\u88C5\u8BB0\u5F55\uFF0C\u53EF\u80FD\u672A\u5B89\u88C5\u6216\u5B89\u88C5\u8BB0\u5F55\u5DF2\u635F\u574F",
|
|
490
|
+
uninstall_no_record_hint: "\u5982\u9700\u5F3A\u5236\u6E05\u7406\uFF0C\u8BF7\u624B\u52A8\u5220\u9664 .opencode/ \u6216 .claude/ \u76EE\u5F55\u4E2D\u7684\u76F8\u5173\u6587\u4EF6",
|
|
491
|
+
uninstall_in_progress: "\u6B63\u5728\u5378\u8F7D",
|
|
492
|
+
uninstall_removed: "\u5DF2\u5378\u8F7D",
|
|
493
|
+
uninstall_files_gone: "\u7684\u6587\u4EF6\u5DF2\u4E0D\u5B58\u5728\uFF0C\u5DF2\u6E05\u7406\u5B89\u88C5\u8BB0\u5F55",
|
|
494
|
+
uninstall_skills_in_progress: "\u6B63\u5728\u5378\u8F7D",
|
|
495
|
+
init_pkg_dir_warn: "\u5F53\u524D\u76EE\u5F55\u770B\u8D77\u6765\u662F install-helper \u5305\u76EE\u5F55",
|
|
496
|
+
init_pkg_dir_hint: "\u8BF7\u5728\u4F60\u7684\u9879\u76EE\u76EE\u5F55\u4E2D\u8FD0\u884C\u6B64\u547D\u4EE4\uFF0C\u800C\u4E0D\u662F\u5728 install-helper \u5B89\u88C5\u76EE\u5F55\u4E2D",
|
|
497
|
+
init_pkg_dir_example: "\u793A\u4F8B\uFF1Acd ~/my-project && install-helper",
|
|
498
|
+
init_cancelled: "\u5DF2\u53D6\u6D88\u5B89\u88C5"
|
|
482
499
|
};
|
|
483
500
|
var en_US = {
|
|
484
|
-
wizard_title: "CANNBot
|
|
501
|
+
wizard_title: "CANNBot Install Helper",
|
|
485
502
|
wizard_detect: "Detecting installed AI coding tools...",
|
|
486
503
|
wizard_select_tool: "Select AI coding tool",
|
|
487
504
|
wizard_select_level: "Select install level",
|
|
@@ -566,7 +583,24 @@ var en_US = {
|
|
|
566
583
|
status_install_time: "Installed at",
|
|
567
584
|
install_installed_to: "Installed to",
|
|
568
585
|
install_skills_count: "Skills",
|
|
569
|
-
install_agents_count: "Agents"
|
|
586
|
+
install_agents_count: "Agents",
|
|
587
|
+
lang_supported: "Supported languages: zh_CN, en_US",
|
|
588
|
+
lang_usage: "Usage: install-helper lang set <language>",
|
|
589
|
+
lang_specify: "Please specify language: install-helper lang set zh_CN",
|
|
590
|
+
lang_unknown_action: "Unknown action",
|
|
591
|
+
lang_supported_actions: "Supported actions: show, set",
|
|
592
|
+
info_aliases: "Aliases",
|
|
593
|
+
uninstall_not_found: "Not found",
|
|
594
|
+
uninstall_no_record: "No install record found, may not be installed or record is corrupted",
|
|
595
|
+
uninstall_no_record_hint: "For manual cleanup, delete related files in .opencode/ or .claude/ directory",
|
|
596
|
+
uninstall_in_progress: "Uninstalling",
|
|
597
|
+
uninstall_removed: "Uninstalled",
|
|
598
|
+
uninstall_files_gone: " files no longer exist, install record cleaned",
|
|
599
|
+
uninstall_skills_in_progress: "Uninstalling",
|
|
600
|
+
init_pkg_dir_warn: "Current directory appears to be the install-helper package directory",
|
|
601
|
+
init_pkg_dir_hint: "Please run this command in your project directory, not in the install-helper package directory",
|
|
602
|
+
init_pkg_dir_example: "Example: cd ~/my-project && install-helper",
|
|
603
|
+
init_cancelled: "Installation cancelled"
|
|
570
604
|
};
|
|
571
605
|
var currentLang = "zh_CN";
|
|
572
606
|
function setLanguage(lang) {
|
|
@@ -970,7 +1004,7 @@ import { execa as execa2 } from "execa";
|
|
|
970
1004
|
|
|
971
1005
|
// src/core/scanner.ts
|
|
972
1006
|
import { existsSync as existsSync5, readdirSync, readFileSync as readFileSync3, statSync, writeFileSync as writeFileSync2, mkdirSync as mkdirSync2 } from "fs";
|
|
973
|
-
import { join as join5
|
|
1007
|
+
import { join as join5 } from "path";
|
|
974
1008
|
import { parse as parseYaml } from "yaml";
|
|
975
1009
|
var EXCLUDE_DIRS = /* @__PURE__ */ new Set([
|
|
976
1010
|
"node_modules",
|
|
@@ -2047,9 +2081,9 @@ async function initCommand() {
|
|
|
2047
2081
|
return false;
|
|
2048
2082
|
}
|
|
2049
2083
|
})()) {
|
|
2050
|
-
logger.warn("
|
|
2051
|
-
logger.info("
|
|
2052
|
-
logger.info("
|
|
2084
|
+
logger.warn(t("init_pkg_dir_warn"));
|
|
2085
|
+
logger.info(t("init_pkg_dir_hint"));
|
|
2086
|
+
logger.info(t("init_pkg_dir_example"));
|
|
2053
2087
|
return;
|
|
2054
2088
|
}
|
|
2055
2089
|
printBanner(t("wizard_title"));
|
|
@@ -2122,7 +2156,7 @@ async function pluginInstallFlow() {
|
|
|
2122
2156
|
const answers = await runWizard();
|
|
2123
2157
|
if (!answers.confirmed) {
|
|
2124
2158
|
if (answers.back) return "back";
|
|
2125
|
-
logger.info("
|
|
2159
|
+
logger.info(t("init_cancelled"));
|
|
2126
2160
|
return "done";
|
|
2127
2161
|
}
|
|
2128
2162
|
const repoManager = createRepositoryManager();
|
|
@@ -2183,7 +2217,7 @@ async function skillInstallFlow() {
|
|
|
2183
2217
|
const result = await selectToolWithDetection();
|
|
2184
2218
|
if (result === "back") return "back";
|
|
2185
2219
|
if (result === "cancel") {
|
|
2186
|
-
logger.info("
|
|
2220
|
+
logger.info(t("init_cancelled"));
|
|
2187
2221
|
return "done";
|
|
2188
2222
|
}
|
|
2189
2223
|
tool = result;
|
|
@@ -2197,7 +2231,7 @@ async function skillInstallFlow() {
|
|
|
2197
2231
|
break;
|
|
2198
2232
|
}
|
|
2199
2233
|
if (result === CANCEL2) {
|
|
2200
|
-
logger.info("
|
|
2234
|
+
logger.info(t("init_cancelled"));
|
|
2201
2235
|
return "done";
|
|
2202
2236
|
}
|
|
2203
2237
|
level = result;
|
|
@@ -2211,7 +2245,7 @@ async function skillInstallFlow() {
|
|
|
2211
2245
|
break;
|
|
2212
2246
|
}
|
|
2213
2247
|
if (selectedSkills === "cancel") {
|
|
2214
|
-
logger.info("
|
|
2248
|
+
logger.info(t("init_cancelled"));
|
|
2215
2249
|
return "done";
|
|
2216
2250
|
}
|
|
2217
2251
|
if (selectedSkills.length === 0) {
|
|
@@ -2496,21 +2530,24 @@ async function installCommand(names, options) {
|
|
|
2496
2530
|
}
|
|
2497
2531
|
names = selectedSkills;
|
|
2498
2532
|
const repoManager = createRepositoryManager();
|
|
2499
|
-
const spinner = createSpinner(
|
|
2533
|
+
const spinner = createSpinner("\u6B63\u5728\u52A0\u8F7D\u63D2\u4EF6\u6570\u636E...");
|
|
2500
2534
|
spinner.start();
|
|
2501
2535
|
const repoPath = await repoManager.ensureRepo();
|
|
2502
|
-
spinner.succeed(
|
|
2536
|
+
spinner.succeed("\u63D2\u4EF6\u6570\u636E\u52A0\u8F7D\u5B8C\u6210");
|
|
2503
2537
|
logger.info(`${t("skill_install_progress")} ${chalk8.bold(names.length)} \u4E2A Skills...`);
|
|
2504
2538
|
const level2 = options.level || "project";
|
|
2505
2539
|
const results = await installSkills(names, tool2, level2, repoPath);
|
|
2506
2540
|
let successCount = 0;
|
|
2507
2541
|
let failCount = 0;
|
|
2508
|
-
|
|
2542
|
+
const total = results.length;
|
|
2543
|
+
for (let i = 0; i < results.length; i++) {
|
|
2544
|
+
const result = results[i];
|
|
2545
|
+
const progress = `[${i + 1}/${total}]`;
|
|
2509
2546
|
if (result.success) {
|
|
2510
|
-
logger.success(`${result.skillId}`);
|
|
2547
|
+
logger.success(`${progress} ${result.skillId}`);
|
|
2511
2548
|
successCount++;
|
|
2512
2549
|
} else {
|
|
2513
|
-
logger.error(`${result.skillId}: ${result.error}`);
|
|
2550
|
+
logger.error(`${progress} ${result.skillId}: ${result.error}`);
|
|
2514
2551
|
failCount++;
|
|
2515
2552
|
}
|
|
2516
2553
|
}
|
|
@@ -2593,10 +2630,10 @@ async function installCommand(names, options) {
|
|
|
2593
2630
|
}
|
|
2594
2631
|
if (pluginsToInstall.length > 0) {
|
|
2595
2632
|
const repoManager = createRepositoryManager();
|
|
2596
|
-
const spinner = createSpinner(
|
|
2633
|
+
const spinner = createSpinner("\u6B63\u5728\u52A0\u8F7D\u63D2\u4EF6\u6570\u636E...");
|
|
2597
2634
|
spinner.start();
|
|
2598
2635
|
const repoPath = await repoManager.ensureRepo();
|
|
2599
|
-
spinner.succeed(
|
|
2636
|
+
spinner.succeed("\u63D2\u4EF6\u6570\u636E\u52A0\u8F7D\u5B8C\u6210");
|
|
2600
2637
|
const allPlugins = getAllPlugins();
|
|
2601
2638
|
const results = await installPlugins(
|
|
2602
2639
|
pluginsToInstall,
|
|
@@ -2620,20 +2657,23 @@ async function installCommand(names, options) {
|
|
|
2620
2657
|
}
|
|
2621
2658
|
if (skills.length > 0) {
|
|
2622
2659
|
const repoManager = createRepositoryManager();
|
|
2623
|
-
const spinner = createSpinner(
|
|
2660
|
+
const spinner = createSpinner("\u6B63\u5728\u52A0\u8F7D\u63D2\u4EF6\u6570\u636E...");
|
|
2624
2661
|
spinner.start();
|
|
2625
2662
|
const repoPath = await repoManager.ensureRepo();
|
|
2626
|
-
spinner.succeed(
|
|
2663
|
+
spinner.succeed("\u63D2\u4EF6\u6570\u636E\u52A0\u8F7D\u5B8C\u6210");
|
|
2627
2664
|
logger.info(`${t("skill_install_progress")} ${chalk8.bold(skills.length)} \u4E2A Skills...`);
|
|
2628
2665
|
const results = await installSkills(skills, tool, level, repoPath);
|
|
2629
2666
|
let successCount = 0;
|
|
2630
2667
|
let failCount = 0;
|
|
2631
|
-
|
|
2668
|
+
const total = results.length;
|
|
2669
|
+
for (let i = 0; i < results.length; i++) {
|
|
2670
|
+
const result = results[i];
|
|
2671
|
+
const progress = `[${i + 1}/${total}]`;
|
|
2632
2672
|
if (result.success) {
|
|
2633
|
-
logger.success(`${result.skillId}`);
|
|
2673
|
+
logger.success(`${progress} ${result.skillId}`);
|
|
2634
2674
|
successCount++;
|
|
2635
2675
|
} else {
|
|
2636
|
-
logger.error(`${result.skillId}: ${result.error}`);
|
|
2676
|
+
logger.error(`${progress} ${result.skillId}: ${result.error}`);
|
|
2637
2677
|
failCount++;
|
|
2638
2678
|
}
|
|
2639
2679
|
}
|
|
@@ -2691,18 +2731,18 @@ async function uninstallCommand(names, options) {
|
|
|
2691
2731
|
skills.push(skill.id);
|
|
2692
2732
|
continue;
|
|
2693
2733
|
}
|
|
2694
|
-
logger.error(
|
|
2734
|
+
logger.error(`${t("uninstall_not_found")}: ${name}`);
|
|
2695
2735
|
}
|
|
2696
2736
|
for (const pluginId of plugins) {
|
|
2697
2737
|
const plugin = findPlugin(pluginId);
|
|
2698
2738
|
if (!plugin) continue;
|
|
2699
2739
|
const record = readRecord(plugin.id);
|
|
2700
2740
|
if (!record) {
|
|
2701
|
-
logger.warn(`${plugin.displayName}
|
|
2702
|
-
logger.info(
|
|
2741
|
+
logger.warn(`${plugin.displayName} ${t("uninstall_no_record")}`);
|
|
2742
|
+
logger.info(`${t("uninstall_no_record_hint")}`);
|
|
2703
2743
|
continue;
|
|
2704
2744
|
}
|
|
2705
|
-
logger.info(
|
|
2745
|
+
logger.info(`${t("uninstall_in_progress")} ${plugin.displayName}...`);
|
|
2706
2746
|
let removedFiles = 0;
|
|
2707
2747
|
let removedDirs = 0;
|
|
2708
2748
|
for (const filePath of record.files) {
|
|
@@ -2735,13 +2775,13 @@ async function uninstallCommand(names, options) {
|
|
|
2735
2775
|
removeInstalledPlugin(plugin.id);
|
|
2736
2776
|
const totalRemoved = removedFiles + removedDirs;
|
|
2737
2777
|
if (totalRemoved > 0) {
|
|
2738
|
-
logger.success(
|
|
2778
|
+
logger.success(`${t("uninstall_removed")} ${plugin.displayName}\uFF08\u79FB\u9664 ${removedFiles} \u4E2A\u6587\u4EF6\uFF0C${removedDirs} \u4E2A\u76EE\u5F55\uFF09`);
|
|
2739
2779
|
} else {
|
|
2740
|
-
logger.warn(`${plugin.displayName}
|
|
2780
|
+
logger.warn(`${plugin.displayName}${t("uninstall_files_gone")}`);
|
|
2741
2781
|
}
|
|
2742
2782
|
}
|
|
2743
2783
|
if (skills.length > 0) {
|
|
2744
|
-
logger.info(
|
|
2784
|
+
logger.info(`${t("uninstall_skills_in_progress")} ${skills.length} \u4E2A Skills...`);
|
|
2745
2785
|
const results = await uninstallSkills(skills, tool, level);
|
|
2746
2786
|
let successCount = 0;
|
|
2747
2787
|
let failCount = 0;
|
|
@@ -2867,7 +2907,7 @@ async function infoCommand(pluginName) {
|
|
|
2867
2907
|
console.log(` ${chalk11.dim(t("info_status") + ":")} ${statusText}`);
|
|
2868
2908
|
console.log(` ${chalk11.dim(t("info_skills") + ":")} ${plugin.skills}`);
|
|
2869
2909
|
console.log(` ${chalk11.dim(t("info_agents") + ":")} ${plugin.agents}`);
|
|
2870
|
-
console.log(` ${chalk11.dim("
|
|
2910
|
+
console.log(` ${chalk11.dim(t("info_aliases") + ":")} ${plugin.aliases.join(", ")}`);
|
|
2871
2911
|
console.log();
|
|
2872
2912
|
try {
|
|
2873
2913
|
const repoManager = createRepositoryManager();
|
|
@@ -2903,14 +2943,14 @@ async function langCommand(action, value) {
|
|
|
2903
2943
|
console.log();
|
|
2904
2944
|
console.log(` ${chalk12.dim(t("lang_current") + ":")} ${config.language}`);
|
|
2905
2945
|
console.log();
|
|
2906
|
-
console.log(chalk12.dim(
|
|
2907
|
-
console.log(chalk12.dim(
|
|
2946
|
+
console.log(chalk12.dim(` ${t("lang_supported")}`));
|
|
2947
|
+
console.log(chalk12.dim(` ${t("lang_usage")}`));
|
|
2908
2948
|
console.log();
|
|
2909
2949
|
return;
|
|
2910
2950
|
}
|
|
2911
2951
|
if (action === "set") {
|
|
2912
2952
|
if (!value) {
|
|
2913
|
-
console.log(chalk12.red(
|
|
2953
|
+
console.log(chalk12.red(` ${t("lang_specify")}`));
|
|
2914
2954
|
return;
|
|
2915
2955
|
}
|
|
2916
2956
|
if (value !== "zh_CN" && value !== "en_US") {
|
|
@@ -2924,8 +2964,8 @@ async function langCommand(action, value) {
|
|
|
2924
2964
|
console.log();
|
|
2925
2965
|
return;
|
|
2926
2966
|
}
|
|
2927
|
-
console.log(chalk12.red(`
|
|
2928
|
-
console.log(chalk12.dim(
|
|
2967
|
+
console.log(chalk12.red(` ${t("lang_unknown_action")}: ${action}`));
|
|
2968
|
+
console.log(chalk12.dim(` ${t("lang_supported_actions")}`));
|
|
2929
2969
|
}
|
|
2930
2970
|
|
|
2931
2971
|
// src/cli.ts
|
|
@@ -2935,7 +2975,7 @@ function createCLI() {
|
|
|
2935
2975
|
setLanguage(config.language);
|
|
2936
2976
|
}
|
|
2937
2977
|
const program2 = new Command();
|
|
2938
|
-
program2.name("install-helper").description("Install Helper - Interactive installer for CANN operator development skills").version("0.0
|
|
2978
|
+
program2.name("install-helper").description("CANNBot Install Helper - Interactive installer for CANN operator development skills").version("1.0.0");
|
|
2939
2979
|
program2.command("init", { isDefault: false }).description("Run interactive installation wizard").action(async () => {
|
|
2940
2980
|
await initCommand();
|
|
2941
2981
|
});
|