@cannbot-ai/install-helper 0.0.1 → 0.0.2-beta.1
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 +26 -25
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -713,7 +713,7 @@ var checkboxTheme = {
|
|
|
713
713
|
|
|
714
714
|
// src/ui/wizard.ts
|
|
715
715
|
var BACK = "__back__";
|
|
716
|
-
var
|
|
716
|
+
var CANCEL = "__cancel__";
|
|
717
717
|
async function selectToolWithDetection() {
|
|
718
718
|
const config = readConfig();
|
|
719
719
|
logger.blank();
|
|
@@ -723,7 +723,7 @@ async function selectToolWithDetection() {
|
|
|
723
723
|
spinner.stop();
|
|
724
724
|
const result = await stepTool(detectedTools, config.lastTool);
|
|
725
725
|
if (result === BACK) return "back";
|
|
726
|
-
if (result ===
|
|
726
|
+
if (result === CANCEL) return "cancel";
|
|
727
727
|
return result;
|
|
728
728
|
}
|
|
729
729
|
async function runWizard() {
|
|
@@ -744,7 +744,7 @@ async function runWizard() {
|
|
|
744
744
|
if (result === BACK) {
|
|
745
745
|
return { language: config.language || "zh_CN", tool: "opencode", level: "project", plugins: [], confirmed: false, back: true };
|
|
746
746
|
}
|
|
747
|
-
if (result ===
|
|
747
|
+
if (result === CANCEL) {
|
|
748
748
|
return { language: config.language || "zh_CN", tool: "opencode", level: "project", plugins: [], confirmed: false };
|
|
749
749
|
}
|
|
750
750
|
selectedTool = result;
|
|
@@ -757,7 +757,7 @@ async function runWizard() {
|
|
|
757
757
|
step = 0;
|
|
758
758
|
break;
|
|
759
759
|
}
|
|
760
|
-
if (result ===
|
|
760
|
+
if (result === CANCEL) {
|
|
761
761
|
return { language: config.language || "zh_CN", tool: selectedTool, level: "project", plugins: [], confirmed: false };
|
|
762
762
|
}
|
|
763
763
|
level = result;
|
|
@@ -770,7 +770,7 @@ async function runWizard() {
|
|
|
770
770
|
step = 1;
|
|
771
771
|
break;
|
|
772
772
|
}
|
|
773
|
-
if (result ===
|
|
773
|
+
if (result === CANCEL) {
|
|
774
774
|
return { language: config.language || "zh_CN", tool: selectedTool, level, plugins: [], confirmed: false };
|
|
775
775
|
}
|
|
776
776
|
plugins = result;
|
|
@@ -783,7 +783,7 @@ async function runWizard() {
|
|
|
783
783
|
step = 2;
|
|
784
784
|
break;
|
|
785
785
|
}
|
|
786
|
-
if (result ===
|
|
786
|
+
if (result === CANCEL || result === false) {
|
|
787
787
|
return { language: config.language || "zh_CN", tool: selectedTool, level, plugins: [], confirmed: false };
|
|
788
788
|
}
|
|
789
789
|
updateConfig({ lastTool: selectedTool, lastLevel: level });
|
|
@@ -803,12 +803,12 @@ async function stepTool(detectedTools, lastTool) {
|
|
|
803
803
|
})),
|
|
804
804
|
new Separator("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"),
|
|
805
805
|
{ name: "<- " + t("wizard_back"), value: BACK },
|
|
806
|
-
{ name: "x " + t("wizard_cancel"), value:
|
|
806
|
+
{ name: "x " + t("wizard_cancel"), value: CANCEL }
|
|
807
807
|
];
|
|
808
808
|
showOperationHints();
|
|
809
809
|
const result2 = await select({ message: t("wizard_select_tool"), choices: choices2, default: lastTool, loop: false, theme: selectTheme });
|
|
810
810
|
if (result2 === BACK) return BACK;
|
|
811
|
-
if (result2 ===
|
|
811
|
+
if (result2 === CANCEL) return CANCEL;
|
|
812
812
|
return result2;
|
|
813
813
|
}
|
|
814
814
|
if (detectedTools.length === 1) {
|
|
@@ -823,12 +823,12 @@ async function stepTool(detectedTools, lastTool) {
|
|
|
823
823
|
{ name: `> ${t("wizard_select_tool")}`, value: "manual" },
|
|
824
824
|
new Separator("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"),
|
|
825
825
|
{ name: "<- " + t("wizard_back"), value: BACK },
|
|
826
|
-
{ name: "x " + t("wizard_cancel"), value:
|
|
826
|
+
{ name: "x " + t("wizard_cancel"), value: CANCEL }
|
|
827
827
|
];
|
|
828
828
|
showOperationHints();
|
|
829
829
|
const result2 = await select({ message: t("wizard_select_tool"), choices: choices2, loop: false, theme: selectTheme });
|
|
830
830
|
if (result2 === BACK) return BACK;
|
|
831
|
-
if (result2 ===
|
|
831
|
+
if (result2 === CANCEL) return CANCEL;
|
|
832
832
|
if (result2 === "manual") {
|
|
833
833
|
return stepToolManual(lastTool);
|
|
834
834
|
}
|
|
@@ -844,11 +844,11 @@ async function stepTool(detectedTools, lastTool) {
|
|
|
844
844
|
});
|
|
845
845
|
choices.push(new Separator("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
|
|
846
846
|
choices.push({ name: "<- " + t("wizard_back"), value: BACK });
|
|
847
|
-
choices.push({ name: "x " + t("wizard_cancel"), value:
|
|
847
|
+
choices.push({ name: "x " + t("wizard_cancel"), value: CANCEL });
|
|
848
848
|
showOperationHints();
|
|
849
849
|
const result = await select({ message: t("wizard_select_tool"), choices, default: lastTool, loop: false, theme: selectTheme });
|
|
850
850
|
if (result === BACK) return BACK;
|
|
851
|
-
if (result ===
|
|
851
|
+
if (result === CANCEL) return CANCEL;
|
|
852
852
|
return result;
|
|
853
853
|
}
|
|
854
854
|
async function stepToolManual(lastTool) {
|
|
@@ -859,12 +859,12 @@ async function stepToolManual(lastTool) {
|
|
|
859
859
|
})),
|
|
860
860
|
new Separator("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"),
|
|
861
861
|
{ name: "<- " + t("wizard_back"), value: BACK },
|
|
862
|
-
{ name: "x " + t("wizard_cancel"), value:
|
|
862
|
+
{ name: "x " + t("wizard_cancel"), value: CANCEL }
|
|
863
863
|
];
|
|
864
864
|
showOperationHints();
|
|
865
865
|
const result = await select({ message: t("wizard_select_tool"), choices, default: lastTool, loop: false, theme: selectTheme });
|
|
866
866
|
if (result === BACK) return BACK;
|
|
867
|
-
if (result ===
|
|
867
|
+
if (result === CANCEL) return CANCEL;
|
|
868
868
|
return result;
|
|
869
869
|
}
|
|
870
870
|
async function stepLevel(lastLevel) {
|
|
@@ -874,7 +874,7 @@ async function stepLevel(lastLevel) {
|
|
|
874
874
|
{ name: "> global \u2014 \u5B89\u88C5\u5230\u5168\u5C40\uFF08\u6240\u6709\u9879\u76EE\u5171\u4EAB\uFF09", value: "global" },
|
|
875
875
|
new Separator("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"),
|
|
876
876
|
{ name: "<- " + t("wizard_back"), value: BACK },
|
|
877
|
-
{ name: "x " + t("wizard_cancel"), value:
|
|
877
|
+
{ name: "x " + t("wizard_cancel"), value: CANCEL }
|
|
878
878
|
];
|
|
879
879
|
showOperationHints();
|
|
880
880
|
const result = await select({
|
|
@@ -885,7 +885,7 @@ async function stepLevel(lastLevel) {
|
|
|
885
885
|
theme: selectTheme
|
|
886
886
|
});
|
|
887
887
|
if (result === BACK) return BACK;
|
|
888
|
-
if (result ===
|
|
888
|
+
if (result === CANCEL) return CANCEL;
|
|
889
889
|
return result;
|
|
890
890
|
}
|
|
891
891
|
async function stepPlugins(tool, level) {
|
|
@@ -898,14 +898,14 @@ async function stepPlugins(tool, level) {
|
|
|
898
898
|
const isInstalled = installedSet.has(p.id);
|
|
899
899
|
const suffix = isInstalled ? ` [${t("wizard_already_installed")}]` : "";
|
|
900
900
|
return {
|
|
901
|
-
name: `${p.displayName}${suffix}
|
|
901
|
+
name: `${p.displayName}${suffix} \u2014 ${p.description}`,
|
|
902
902
|
value: p.id,
|
|
903
903
|
checked: false
|
|
904
904
|
};
|
|
905
905
|
});
|
|
906
906
|
choices.push(new Separator("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"));
|
|
907
907
|
choices.push({ name: "<- " + t("wizard_back"), value: BACK, checked: false });
|
|
908
|
-
choices.push({ name: "x " + t("wizard_cancel"), value:
|
|
908
|
+
choices.push({ name: "x " + t("wizard_cancel"), value: CANCEL, checked: false });
|
|
909
909
|
showOperationHints(true);
|
|
910
910
|
const selected = await checkbox({
|
|
911
911
|
message: t("wizard_select_plugins"),
|
|
@@ -915,8 +915,8 @@ async function stepPlugins(tool, level) {
|
|
|
915
915
|
theme: checkboxTheme
|
|
916
916
|
});
|
|
917
917
|
if (selected.includes(BACK)) return BACK;
|
|
918
|
-
if (selected.includes(
|
|
919
|
-
const pluginIds = selected.filter((v) => v !== BACK && v !==
|
|
918
|
+
if (selected.includes(CANCEL)) return CANCEL;
|
|
919
|
+
const pluginIds = selected.filter((v) => v !== BACK && v !== CANCEL);
|
|
920
920
|
if (pluginIds.length === 0) {
|
|
921
921
|
const action = await select({
|
|
922
922
|
message: t("wizard_no_selection"),
|
|
@@ -929,7 +929,7 @@ async function stepPlugins(tool, level) {
|
|
|
929
929
|
theme: selectTheme
|
|
930
930
|
});
|
|
931
931
|
if (action === "back") return BACK;
|
|
932
|
-
return
|
|
932
|
+
return CANCEL;
|
|
933
933
|
}
|
|
934
934
|
return pluginIds;
|
|
935
935
|
}
|
|
@@ -949,12 +949,12 @@ async function stepConfirm(tool, level, plugins) {
|
|
|
949
949
|
{ name: "> " + t("wizard_confirm"), value: "confirm" },
|
|
950
950
|
new Separator("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"),
|
|
951
951
|
{ name: "<- " + t("wizard_back"), value: BACK },
|
|
952
|
-
{ name: "x " + t("wizard_cancel"), value:
|
|
952
|
+
{ name: "x " + t("wizard_cancel"), value: CANCEL }
|
|
953
953
|
];
|
|
954
954
|
showOperationHints();
|
|
955
955
|
const result = await select({ message: t("wizard_confirm"), choices, loop: false, theme: selectTheme });
|
|
956
956
|
if (result === BACK) return BACK;
|
|
957
|
-
if (result ===
|
|
957
|
+
if (result === CANCEL) return CANCEL;
|
|
958
958
|
return true;
|
|
959
959
|
}
|
|
960
960
|
|
|
@@ -2037,6 +2037,7 @@ function printEnhancedSummary(results, tool, configRoot) {
|
|
|
2037
2037
|
import { existsSync as existsSync10, readFileSync as readFileSync5 } from "fs";
|
|
2038
2038
|
import { join as join10 } from "path";
|
|
2039
2039
|
var BACK2 = "__back__";
|
|
2040
|
+
var CANCEL2 = "__cancel__";
|
|
2040
2041
|
async function initCommand() {
|
|
2041
2042
|
const cwd = process.cwd();
|
|
2042
2043
|
if (existsSync10(join10(cwd, "package.json")) && (() => {
|
|
@@ -2196,7 +2197,7 @@ async function skillInstallFlow() {
|
|
|
2196
2197
|
step = 0;
|
|
2197
2198
|
break;
|
|
2198
2199
|
}
|
|
2199
|
-
if (result ===
|
|
2200
|
+
if (result === CANCEL2) {
|
|
2200
2201
|
logger.info("\u5DF2\u53D6\u6D88\u5B89\u88C5");
|
|
2201
2202
|
return "done";
|
|
2202
2203
|
}
|
|
@@ -2932,7 +2933,7 @@ function createCLI() {
|
|
|
2932
2933
|
setLanguage(config.language);
|
|
2933
2934
|
}
|
|
2934
2935
|
const program2 = new Command();
|
|
2935
|
-
program2.name("install-helper").description("Install Helper - Interactive installer for CANN operator development skills").version("0.0.1");
|
|
2936
|
+
program2.name("install-helper").description("Install Helper - Interactive installer for CANN operator development skills").version("0.0.2-beta.1");
|
|
2936
2937
|
program2.command("init", { isDefault: false }).description("Run interactive installation wizard").action(async () => {
|
|
2937
2938
|
await initCommand();
|
|
2938
2939
|
});
|