@cannbot-ai/install-helper 0.0.2-beta.0 → 0.0.2-beta.2
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 +55 -42
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -475,7 +475,10 @@ var zh_CN = {
|
|
|
475
475
|
status_title: "\u5DF2\u5B89\u88C5\u63D2\u4EF6",
|
|
476
476
|
status_none: "\u6682\u65E0\u5DF2\u5B89\u88C5\u7684\u63D2\u4EF6",
|
|
477
477
|
status_hint: "\u8FD0\u884C install-helper init \u5F00\u59CB\u5B89\u88C5",
|
|
478
|
-
status_install_time: "\u5B89\u88C5\u65F6\u95F4"
|
|
478
|
+
status_install_time: "\u5B89\u88C5\u65F6\u95F4",
|
|
479
|
+
install_installed_to: "\u5B89\u88C5\u5230",
|
|
480
|
+
install_skills_count: "Skills",
|
|
481
|
+
install_agents_count: "Agents"
|
|
479
482
|
};
|
|
480
483
|
var en_US = {
|
|
481
484
|
wizard_title: "CANNBot Skills Setup Wizard",
|
|
@@ -560,7 +563,10 @@ var en_US = {
|
|
|
560
563
|
status_title: "Installed Plugins",
|
|
561
564
|
status_none: "No installed plugins",
|
|
562
565
|
status_hint: "Run install-helper init to start",
|
|
563
|
-
status_install_time: "Installed at"
|
|
566
|
+
status_install_time: "Installed at",
|
|
567
|
+
install_installed_to: "Installed to",
|
|
568
|
+
install_skills_count: "Skills",
|
|
569
|
+
install_agents_count: "Agents"
|
|
564
570
|
};
|
|
565
571
|
var currentLang = "zh_CN";
|
|
566
572
|
function setLanguage(lang) {
|
|
@@ -713,7 +719,7 @@ var checkboxTheme = {
|
|
|
713
719
|
|
|
714
720
|
// src/ui/wizard.ts
|
|
715
721
|
var BACK = "__back__";
|
|
716
|
-
var
|
|
722
|
+
var CANCEL = "__cancel__";
|
|
717
723
|
async function selectToolWithDetection() {
|
|
718
724
|
const config = readConfig();
|
|
719
725
|
logger.blank();
|
|
@@ -723,7 +729,7 @@ async function selectToolWithDetection() {
|
|
|
723
729
|
spinner.stop();
|
|
724
730
|
const result = await stepTool(detectedTools, config.lastTool);
|
|
725
731
|
if (result === BACK) return "back";
|
|
726
|
-
if (result ===
|
|
732
|
+
if (result === CANCEL) return "cancel";
|
|
727
733
|
return result;
|
|
728
734
|
}
|
|
729
735
|
async function runWizard() {
|
|
@@ -744,7 +750,7 @@ async function runWizard() {
|
|
|
744
750
|
if (result === BACK) {
|
|
745
751
|
return { language: config.language || "zh_CN", tool: "opencode", level: "project", plugins: [], confirmed: false, back: true };
|
|
746
752
|
}
|
|
747
|
-
if (result ===
|
|
753
|
+
if (result === CANCEL) {
|
|
748
754
|
return { language: config.language || "zh_CN", tool: "opencode", level: "project", plugins: [], confirmed: false };
|
|
749
755
|
}
|
|
750
756
|
selectedTool = result;
|
|
@@ -757,7 +763,7 @@ async function runWizard() {
|
|
|
757
763
|
step = 0;
|
|
758
764
|
break;
|
|
759
765
|
}
|
|
760
|
-
if (result ===
|
|
766
|
+
if (result === CANCEL) {
|
|
761
767
|
return { language: config.language || "zh_CN", tool: selectedTool, level: "project", plugins: [], confirmed: false };
|
|
762
768
|
}
|
|
763
769
|
level = result;
|
|
@@ -770,7 +776,7 @@ async function runWizard() {
|
|
|
770
776
|
step = 1;
|
|
771
777
|
break;
|
|
772
778
|
}
|
|
773
|
-
if (result ===
|
|
779
|
+
if (result === CANCEL) {
|
|
774
780
|
return { language: config.language || "zh_CN", tool: selectedTool, level, plugins: [], confirmed: false };
|
|
775
781
|
}
|
|
776
782
|
plugins = result;
|
|
@@ -783,7 +789,7 @@ async function runWizard() {
|
|
|
783
789
|
step = 2;
|
|
784
790
|
break;
|
|
785
791
|
}
|
|
786
|
-
if (result ===
|
|
792
|
+
if (result === CANCEL || result === false) {
|
|
787
793
|
return { language: config.language || "zh_CN", tool: selectedTool, level, plugins: [], confirmed: false };
|
|
788
794
|
}
|
|
789
795
|
updateConfig({ lastTool: selectedTool, lastLevel: level });
|
|
@@ -793,7 +799,7 @@ async function runWizard() {
|
|
|
793
799
|
}
|
|
794
800
|
}
|
|
795
801
|
async function stepTool(detectedTools, lastTool) {
|
|
796
|
-
printBoxTitle("\u9009\u62E9 AI \u7F16\u7A0B\u5DE5\u5177");
|
|
802
|
+
printBoxTitle("[1/4] \u9009\u62E9 AI \u7F16\u7A0B\u5DE5\u5177");
|
|
797
803
|
if (detectedTools.length === 0) {
|
|
798
804
|
logger.error(t("error_tool_not_found"));
|
|
799
805
|
const choices2 = [
|
|
@@ -803,12 +809,12 @@ async function stepTool(detectedTools, lastTool) {
|
|
|
803
809
|
})),
|
|
804
810
|
new Separator("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"),
|
|
805
811
|
{ name: "<- " + t("wizard_back"), value: BACK },
|
|
806
|
-
{ name: "x " + t("wizard_cancel"), value:
|
|
812
|
+
{ name: "x " + t("wizard_cancel"), value: CANCEL }
|
|
807
813
|
];
|
|
808
814
|
showOperationHints();
|
|
809
815
|
const result2 = await select({ message: t("wizard_select_tool"), choices: choices2, default: lastTool, loop: false, theme: selectTheme });
|
|
810
816
|
if (result2 === BACK) return BACK;
|
|
811
|
-
if (result2 ===
|
|
817
|
+
if (result2 === CANCEL) return CANCEL;
|
|
812
818
|
return result2;
|
|
813
819
|
}
|
|
814
820
|
if (detectedTools.length === 1) {
|
|
@@ -823,12 +829,12 @@ async function stepTool(detectedTools, lastTool) {
|
|
|
823
829
|
{ name: `> ${t("wizard_select_tool")}`, value: "manual" },
|
|
824
830
|
new Separator("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"),
|
|
825
831
|
{ name: "<- " + t("wizard_back"), value: BACK },
|
|
826
|
-
{ name: "x " + t("wizard_cancel"), value:
|
|
832
|
+
{ name: "x " + t("wizard_cancel"), value: CANCEL }
|
|
827
833
|
];
|
|
828
834
|
showOperationHints();
|
|
829
835
|
const result2 = await select({ message: t("wizard_select_tool"), choices: choices2, loop: false, theme: selectTheme });
|
|
830
836
|
if (result2 === BACK) return BACK;
|
|
831
|
-
if (result2 ===
|
|
837
|
+
if (result2 === CANCEL) return CANCEL;
|
|
832
838
|
if (result2 === "manual") {
|
|
833
839
|
return stepToolManual(lastTool);
|
|
834
840
|
}
|
|
@@ -844,11 +850,11 @@ async function stepTool(detectedTools, lastTool) {
|
|
|
844
850
|
});
|
|
845
851
|
choices.push(new Separator("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
|
|
846
852
|
choices.push({ name: "<- " + t("wizard_back"), value: BACK });
|
|
847
|
-
choices.push({ name: "x " + t("wizard_cancel"), value:
|
|
853
|
+
choices.push({ name: "x " + t("wizard_cancel"), value: CANCEL });
|
|
848
854
|
showOperationHints();
|
|
849
855
|
const result = await select({ message: t("wizard_select_tool"), choices, default: lastTool, loop: false, theme: selectTheme });
|
|
850
856
|
if (result === BACK) return BACK;
|
|
851
|
-
if (result ===
|
|
857
|
+
if (result === CANCEL) return CANCEL;
|
|
852
858
|
return result;
|
|
853
859
|
}
|
|
854
860
|
async function stepToolManual(lastTool) {
|
|
@@ -859,22 +865,22 @@ async function stepToolManual(lastTool) {
|
|
|
859
865
|
})),
|
|
860
866
|
new Separator("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"),
|
|
861
867
|
{ name: "<- " + t("wizard_back"), value: BACK },
|
|
862
|
-
{ name: "x " + t("wizard_cancel"), value:
|
|
868
|
+
{ name: "x " + t("wizard_cancel"), value: CANCEL }
|
|
863
869
|
];
|
|
864
870
|
showOperationHints();
|
|
865
871
|
const result = await select({ message: t("wizard_select_tool"), choices, default: lastTool, loop: false, theme: selectTheme });
|
|
866
872
|
if (result === BACK) return BACK;
|
|
867
|
-
if (result ===
|
|
873
|
+
if (result === CANCEL) return CANCEL;
|
|
868
874
|
return result;
|
|
869
875
|
}
|
|
870
876
|
async function stepLevel(lastLevel) {
|
|
871
|
-
printBoxTitle("\u9009\u62E9\u5B89\u88C5\u4F4D\u7F6E");
|
|
877
|
+
printBoxTitle("[2/4] \u9009\u62E9\u5B89\u88C5\u4F4D\u7F6E");
|
|
872
878
|
const choices = [
|
|
873
879
|
{ name: "> project \u2014 \u5B89\u88C5\u5230\u5F53\u524D\u76EE\u5F55\uFF08\u63A8\u8350\uFF0C\u4EC5\u5F53\u524D\u9879\u76EE\u53EF\u7528\uFF09", value: "project" },
|
|
874
880
|
{ name: "> global \u2014 \u5B89\u88C5\u5230\u5168\u5C40\uFF08\u6240\u6709\u9879\u76EE\u5171\u4EAB\uFF09", value: "global" },
|
|
875
881
|
new Separator("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"),
|
|
876
882
|
{ name: "<- " + t("wizard_back"), value: BACK },
|
|
877
|
-
{ name: "x " + t("wizard_cancel"), value:
|
|
883
|
+
{ name: "x " + t("wizard_cancel"), value: CANCEL }
|
|
878
884
|
];
|
|
879
885
|
showOperationHints();
|
|
880
886
|
const result = await select({
|
|
@@ -885,11 +891,11 @@ async function stepLevel(lastLevel) {
|
|
|
885
891
|
theme: selectTheme
|
|
886
892
|
});
|
|
887
893
|
if (result === BACK) return BACK;
|
|
888
|
-
if (result ===
|
|
894
|
+
if (result === CANCEL) return CANCEL;
|
|
889
895
|
return result;
|
|
890
896
|
}
|
|
891
897
|
async function stepPlugins(tool, level) {
|
|
892
|
-
printBoxTitle("\u9009\u62E9\u8981\u5B89\u88C5\u7684\u63D2\u4EF6");
|
|
898
|
+
printBoxTitle("[3/4] \u9009\u62E9\u8981\u5B89\u88C5\u7684\u63D2\u4EF6");
|
|
893
899
|
const plugins = getAllPlugins();
|
|
894
900
|
const configRoot = getConfigRoot(tool, level);
|
|
895
901
|
const manifests = readAllManifests(configRoot);
|
|
@@ -898,14 +904,14 @@ async function stepPlugins(tool, level) {
|
|
|
898
904
|
const isInstalled = installedSet.has(p.id);
|
|
899
905
|
const suffix = isInstalled ? ` [${t("wizard_already_installed")}]` : "";
|
|
900
906
|
return {
|
|
901
|
-
name: `${p.displayName}${suffix}`,
|
|
907
|
+
name: `${p.displayName}${suffix} \u2014 ${p.description}`,
|
|
902
908
|
value: p.id,
|
|
903
909
|
checked: false
|
|
904
910
|
};
|
|
905
911
|
});
|
|
906
912
|
choices.push(new Separator("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
|
|
907
913
|
choices.push({ name: "<- " + t("wizard_back"), value: BACK, checked: false });
|
|
908
|
-
choices.push({ name: "x " + t("wizard_cancel"), value:
|
|
914
|
+
choices.push({ name: "x " + t("wizard_cancel"), value: CANCEL, checked: false });
|
|
909
915
|
showOperationHints(true);
|
|
910
916
|
const selected = await checkbox({
|
|
911
917
|
message: t("wizard_select_plugins"),
|
|
@@ -915,8 +921,8 @@ async function stepPlugins(tool, level) {
|
|
|
915
921
|
theme: checkboxTheme
|
|
916
922
|
});
|
|
917
923
|
if (selected.includes(BACK)) return BACK;
|
|
918
|
-
if (selected.includes(
|
|
919
|
-
const pluginIds = selected.filter((v) => v !== BACK && v !==
|
|
924
|
+
if (selected.includes(CANCEL)) return CANCEL;
|
|
925
|
+
const pluginIds = selected.filter((v) => v !== BACK && v !== CANCEL);
|
|
920
926
|
if (pluginIds.length === 0) {
|
|
921
927
|
const action = await select({
|
|
922
928
|
message: t("wizard_no_selection"),
|
|
@@ -929,19 +935,22 @@ async function stepPlugins(tool, level) {
|
|
|
929
935
|
theme: selectTheme
|
|
930
936
|
});
|
|
931
937
|
if (action === "back") return BACK;
|
|
932
|
-
return
|
|
938
|
+
return CANCEL;
|
|
933
939
|
}
|
|
934
940
|
return pluginIds;
|
|
935
941
|
}
|
|
936
942
|
async function stepConfirm(tool, level, plugins) {
|
|
937
|
-
printBoxTitle("\u786E\u8BA4\u5B89\u88C5");
|
|
943
|
+
printBoxTitle("[4/4] \u786E\u8BA4\u5B89\u88C5");
|
|
938
944
|
const allPlugins = getAllPlugins();
|
|
939
945
|
const selectedPlugins = plugins.map((id) => allPlugins.find((p) => p.id === id));
|
|
940
946
|
const displayPath = getConfigRoot(tool, level);
|
|
941
|
-
|
|
947
|
+
const toolName = getToolDisplayName(tool);
|
|
948
|
+
const levelText = level === "project" ? "project" : "global";
|
|
949
|
+
logger.info(`\u5373\u5C06\u5B89\u88C5 ${chalk2.bold(plugins.length)} \u4E2A\u63D2\u4EF6\u5230 ${chalk2.green(toolName)}\uFF08${chalk2.cyan(levelText)} \u7EA7\u522B\uFF09\uFF1A`);
|
|
950
|
+
logger.info(`\u5B89\u88C5\u8DEF\u5F84: ${chalk2.cyan(displayPath)}`);
|
|
942
951
|
for (const plugin of selectedPlugins) {
|
|
943
952
|
if (plugin) {
|
|
944
|
-
logger.step(` \u2022 ${chalk2.bold(plugin.displayName)}
|
|
953
|
+
logger.step(` \u2022 ${chalk2.bold(plugin.displayName)}`);
|
|
945
954
|
}
|
|
946
955
|
}
|
|
947
956
|
logger.blank();
|
|
@@ -949,12 +958,12 @@ async function stepConfirm(tool, level, plugins) {
|
|
|
949
958
|
{ name: "> " + t("wizard_confirm"), value: "confirm" },
|
|
950
959
|
new Separator("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"),
|
|
951
960
|
{ name: "<- " + t("wizard_back"), value: BACK },
|
|
952
|
-
{ name: "x " + t("wizard_cancel"), value:
|
|
961
|
+
{ name: "x " + t("wizard_cancel"), value: CANCEL }
|
|
953
962
|
];
|
|
954
963
|
showOperationHints();
|
|
955
964
|
const result = await select({ message: t("wizard_confirm"), choices, loop: false, theme: selectTheme });
|
|
956
965
|
if (result === BACK) return BACK;
|
|
957
|
-
if (result ===
|
|
966
|
+
if (result === CANCEL) return CANCEL;
|
|
958
967
|
return true;
|
|
959
968
|
}
|
|
960
969
|
|
|
@@ -2011,8 +2020,8 @@ function printEnhancedSummary(results, tool, configRoot) {
|
|
|
2011
2020
|
const lines = [
|
|
2012
2021
|
chalk4.bold(` ${t("install_done")}!`),
|
|
2013
2022
|
"",
|
|
2014
|
-
` ${chalk4.dim("
|
|
2015
|
-
` ${chalk4.dim("
|
|
2023
|
+
` ${chalk4.dim(t("install_installed_to") + ":")} ${configRoot}`,
|
|
2024
|
+
` ${chalk4.dim(t("install_skills_count") + ":")} ${totalSkills} \u4E2A ${chalk4.dim("|")} ${chalk4.dim(t("install_agents_count") + ":")} ${totalAgents} \u4E2A`,
|
|
2016
2025
|
"",
|
|
2017
2026
|
chalk4.bold(` ${t("install_enhanced_next_steps")}:`),
|
|
2018
2027
|
` ${chalk4.cyan("1.")} ${t("install_enhanced_launch")}: ${chalk4.green(toolName.toLowerCase())}`,
|
|
@@ -2037,6 +2046,7 @@ function printEnhancedSummary(results, tool, configRoot) {
|
|
|
2037
2046
|
import { existsSync as existsSync10, readFileSync as readFileSync5 } from "fs";
|
|
2038
2047
|
import { join as join10 } from "path";
|
|
2039
2048
|
var BACK2 = "__back__";
|
|
2049
|
+
var CANCEL2 = "__cancel__";
|
|
2040
2050
|
async function initCommand() {
|
|
2041
2051
|
const cwd = process.cwd();
|
|
2042
2052
|
if (existsSync10(join10(cwd, "package.json")) && (() => {
|
|
@@ -2126,10 +2136,10 @@ async function pluginInstallFlow() {
|
|
|
2126
2136
|
return "done";
|
|
2127
2137
|
}
|
|
2128
2138
|
const repoManager = createRepositoryManager();
|
|
2129
|
-
const spinner = createSpinner(
|
|
2139
|
+
const spinner = createSpinner("\u6B63\u5728\u52A0\u8F7D\u63D2\u4EF6\u6570\u636E...");
|
|
2130
2140
|
spinner.start();
|
|
2131
2141
|
const repoPath = await repoManager.ensureRepo();
|
|
2132
|
-
spinner.succeed(
|
|
2142
|
+
spinner.succeed("\u63D2\u4EF6\u6570\u636E\u52A0\u8F7D\u5B8C\u6210");
|
|
2133
2143
|
const allPlugins = getAllPlugins();
|
|
2134
2144
|
const selectedPlugins = answers.plugins.map(
|
|
2135
2145
|
(id) => allPlugins.find((p) => p.id === id)
|
|
@@ -2196,7 +2206,7 @@ async function skillInstallFlow() {
|
|
|
2196
2206
|
step = 0;
|
|
2197
2207
|
break;
|
|
2198
2208
|
}
|
|
2199
|
-
if (result ===
|
|
2209
|
+
if (result === CANCEL2) {
|
|
2200
2210
|
logger.info("\u5DF2\u53D6\u6D88\u5B89\u88C5");
|
|
2201
2211
|
return "done";
|
|
2202
2212
|
}
|
|
@@ -2219,20 +2229,23 @@ async function skillInstallFlow() {
|
|
|
2219
2229
|
return "done";
|
|
2220
2230
|
}
|
|
2221
2231
|
const repoManager = createRepositoryManager();
|
|
2222
|
-
const spinner = createSpinner(
|
|
2232
|
+
const spinner = createSpinner("\u6B63\u5728\u52A0\u8F7D\u63D2\u4EF6\u6570\u636E...");
|
|
2223
2233
|
spinner.start();
|
|
2224
2234
|
const repoPath = await repoManager.ensureRepo();
|
|
2225
|
-
spinner.succeed(
|
|
2235
|
+
spinner.succeed("\u63D2\u4EF6\u6570\u636E\u52A0\u8F7D\u5B8C\u6210");
|
|
2226
2236
|
logger.info(`${t("skill_install_progress")} ${chalk5.bold(selectedSkills.length)} \u4E2A Skills...`);
|
|
2227
2237
|
const results = await installSkills(selectedSkills, tool, level, repoPath);
|
|
2228
2238
|
let successCount = 0;
|
|
2229
2239
|
let failCount = 0;
|
|
2230
|
-
|
|
2240
|
+
const total = results.length;
|
|
2241
|
+
for (let i = 0; i < results.length; i++) {
|
|
2242
|
+
const result = results[i];
|
|
2243
|
+
const progress = `[${i + 1}/${total}]`;
|
|
2231
2244
|
if (result.success) {
|
|
2232
|
-
logger.success(`${result.skillId}`);
|
|
2245
|
+
logger.success(`${progress} ${result.skillId}`);
|
|
2233
2246
|
successCount++;
|
|
2234
2247
|
} else {
|
|
2235
|
-
logger.error(`${result.skillId}: ${result.error}`);
|
|
2248
|
+
logger.error(`${progress} ${result.skillId}: ${result.error}`);
|
|
2236
2249
|
failCount++;
|
|
2237
2250
|
}
|
|
2238
2251
|
}
|
|
@@ -2932,7 +2945,7 @@ function createCLI() {
|
|
|
2932
2945
|
setLanguage(config.language);
|
|
2933
2946
|
}
|
|
2934
2947
|
const program2 = new Command();
|
|
2935
|
-
program2.name("install-helper").description("Install Helper - Interactive installer for CANN operator development skills").version("0.0.2-beta.
|
|
2948
|
+
program2.name("install-helper").description("Install Helper - Interactive installer for CANN operator development skills").version("0.0.2-beta.2");
|
|
2936
2949
|
program2.command("init", { isDefault: false }).description("Run interactive installation wizard").action(async () => {
|
|
2937
2950
|
await initCommand();
|
|
2938
2951
|
});
|