@cannbot-ai/install-helper 1.1.6-beta.0 → 1.1.6-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 +175 -54
- package/dist/index.js.map +1 -1
- package/dist/locales/en_US.json +6 -1
- package/dist/locales/zh_CN.json +6 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -864,7 +864,12 @@ var init_zh_CN = __esm({
|
|
|
864
864
|
uninstall_plugin_batch_skip_restore: "\u6279\u91CF\u5378\u8F7D\u6A21\u5F0F\uFF1A\u8DF3\u8FC7\u5907\u4EFD\u6062\u590D",
|
|
865
865
|
uninstall_confirm_prompt: "\u5373\u5C06\u5378\u8F7D {count} \u9879\uFF0C\u786E\u8BA4\uFF1F",
|
|
866
866
|
uninstall_select_items: "\u7BA1\u7406\u5DF2\u5B89\u88C5\u7684 Skills\uFF08\u7A7A\u683C\u5207\u6362\uFF0C\u56DE\u8F66\u786E\u8BA4\uFF09",
|
|
867
|
-
uninstall_select_plugins: "\u7BA1\u7406\u5DF2\u5B89\u88C5\u7684 Plugins\uFF08\u7A7A\u683C\u5207\u6362\uFF0C\u56DE\u8F66\u786E\u8BA4\uFF09"
|
|
867
|
+
uninstall_select_plugins: "\u7BA1\u7406\u5DF2\u5B89\u88C5\u7684 Plugins\uFF08\u7A7A\u683C\u5207\u6362\uFF0C\u56DE\u8F66\u786E\u8BA4\uFF09",
|
|
868
|
+
uninstall_select_category: "\u9009\u62E9\u8981\u7BA1\u7406\u7684 Skill \u7C7B\u522B",
|
|
869
|
+
uninstall_uncheck_all_category: "\u5168\u4E0D\u9009\u5F53\u524D\u7C7B\u522B\uFF08\u6807\u8BB0\u5168\u90E8\u5378\u8F7D\uFF09",
|
|
870
|
+
uninstall_continue_or_confirm: "\u5DF2\u6807\u8BB0 {count} \u4E2A\u5F85\u5378\u8F7D\uFF0C\u8BF7\u9009\u62E9\u64CD\u4F5C",
|
|
871
|
+
uninstall_marked_count: "\u5DF2\u6807\u8BB0 {count} \u4E2A\u5F85\u5378\u8F7D",
|
|
872
|
+
uninstall_uncategorized: "\u672A\u5206\u7C7B"
|
|
868
873
|
};
|
|
869
874
|
}
|
|
870
875
|
});
|
|
@@ -1081,7 +1086,12 @@ var init_en_US = __esm({
|
|
|
1081
1086
|
uninstall_plugin_batch_skip_restore: "Batch mode: skipping backup restore",
|
|
1082
1087
|
uninstall_confirm_prompt: "About to uninstall {count} items, confirm?",
|
|
1083
1088
|
uninstall_select_items: "Manage installed Skills (space to toggle, enter to confirm)",
|
|
1084
|
-
uninstall_select_plugins: "Manage installed Plugins (space to toggle, enter to confirm)"
|
|
1089
|
+
uninstall_select_plugins: "Manage installed Plugins (space to toggle, enter to confirm)",
|
|
1090
|
+
uninstall_select_category: "Select Skill category to manage",
|
|
1091
|
+
uninstall_uncheck_all_category: "Uncheck all in this category (mark for uninstall)",
|
|
1092
|
+
uninstall_continue_or_confirm: "{count} marked for uninstall, choose an action",
|
|
1093
|
+
uninstall_marked_count: "{count} marked for uninstall",
|
|
1094
|
+
uninstall_uncategorized: "Uncategorized"
|
|
1085
1095
|
};
|
|
1086
1096
|
}
|
|
1087
1097
|
});
|
|
@@ -3816,60 +3826,172 @@ async function interactiveSkillUnselect(tool, level) {
|
|
|
3816
3826
|
logger.warn(t("uninstall_no_installed_skills"));
|
|
3817
3827
|
return "back";
|
|
3818
3828
|
}
|
|
3819
|
-
const
|
|
3829
|
+
const allCategories = getAllCategories();
|
|
3820
3830
|
const installedSet = new Set(installedSkills);
|
|
3821
|
-
const
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3831
|
-
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
return {
|
|
3835
|
-
name: `${chalk5.cyan(skillId)}${catName ? chalk5.dim(` [${catName}]`) : ""}`,
|
|
3836
|
-
value: skillId,
|
|
3837
|
-
checked: true,
|
|
3838
|
-
description: desc
|
|
3839
|
-
};
|
|
3840
|
-
})
|
|
3841
|
-
];
|
|
3842
|
-
printBoxTitle(t("uninstall_interactive_title"));
|
|
3843
|
-
logger.info(chalk5.dim(` ${t("uninstall_checkbox_hint")}`));
|
|
3844
|
-
logger.blank();
|
|
3845
|
-
showOperationHints(true);
|
|
3846
|
-
const selected = await checkbox({
|
|
3847
|
-
message: t("uninstall_select_items"),
|
|
3848
|
-
choices: skillChoices,
|
|
3849
|
-
loop: false,
|
|
3850
|
-
instructions: false,
|
|
3851
|
-
theme: checkboxTheme,
|
|
3852
|
-
pageSize: 20
|
|
3853
|
-
});
|
|
3854
|
-
let toKeep;
|
|
3855
|
-
if (selected.includes(UNSELECT_ALL)) {
|
|
3856
|
-
toKeep = [];
|
|
3857
|
-
} else {
|
|
3858
|
-
toKeep = selected.filter((id) => id !== UNSELECT_ALL);
|
|
3859
|
-
}
|
|
3860
|
-
const toUninstall = installedSkills.filter((id) => !toKeep.includes(id));
|
|
3861
|
-
if (toUninstall.length === 0) {
|
|
3862
|
-
logger.info(t("uninstall_nothing_to_uninstall"));
|
|
3863
|
-
return "back";
|
|
3831
|
+
const categoriesWithInstalled = allCategories.map((cat) => ({
|
|
3832
|
+
...cat,
|
|
3833
|
+
skills: cat.skills.filter((s) => installedSet.has(s.id))
|
|
3834
|
+
})).filter((cat) => cat.skills.length > 0);
|
|
3835
|
+
const uncategorized = installedSkills.filter(
|
|
3836
|
+
(id) => !allCategories.some((cat) => cat.skills.some((s) => s.id === id))
|
|
3837
|
+
);
|
|
3838
|
+
if (uncategorized.length > 0) {
|
|
3839
|
+
categoriesWithInstalled.push({
|
|
3840
|
+
id: "__uncategorized__",
|
|
3841
|
+
name: t("uninstall_uncategorized"),
|
|
3842
|
+
skills: uncategorized.map((id) => ({ id, description: "", source: "", filePath: "" }))
|
|
3843
|
+
});
|
|
3864
3844
|
}
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3845
|
+
let keptSet = new Set(installedSkills);
|
|
3846
|
+
let step = 0;
|
|
3847
|
+
let selectedCategoryId = "";
|
|
3848
|
+
while (true) {
|
|
3849
|
+
switch (step) {
|
|
3850
|
+
case 0: {
|
|
3851
|
+
const toUninstallCount = installedSkills.length - keptSet.size;
|
|
3852
|
+
const titleSuffix = toUninstallCount > 0 ? `${t("wizard_step_3_skill_title")}\uFF08${t("uninstall_marked_count").replace("{count}", String(toUninstallCount))}\uFF09` : t("wizard_step_3_skill_title");
|
|
3853
|
+
printBoxTitle(titleSuffix);
|
|
3854
|
+
const categoryChoices = [
|
|
3855
|
+
{
|
|
3856
|
+
name: `>> ${t("uninstall_uncheck_all")}`,
|
|
3857
|
+
value: UNSELECT_ALL
|
|
3858
|
+
},
|
|
3859
|
+
new Separator2("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"),
|
|
3860
|
+
...categoriesWithInstalled.map((cat) => {
|
|
3861
|
+
const catKeptCount = cat.skills.filter((s) => keptSet.has(s.id)).length;
|
|
3862
|
+
const catUninstallCount = cat.skills.length - catKeptCount;
|
|
3863
|
+
const suffix = catUninstallCount > 0 ? chalk5.yellow(` (${catUninstallCount} to uninstall)`) : "";
|
|
3864
|
+
return {
|
|
3865
|
+
name: `> ${cat.name} (${cat.skills.length} skills)${suffix}`,
|
|
3866
|
+
value: cat.id
|
|
3867
|
+
};
|
|
3868
|
+
}),
|
|
3869
|
+
new Separator2("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"),
|
|
3870
|
+
...toUninstallCount > 0 ? [{ name: `>> ${t("uninstall_confirm_count").replace("{count}", String(toUninstallCount))}`, value: "uninstall" }] : [],
|
|
3871
|
+
{ name: "<- " + t("wizard_back"), value: BACK },
|
|
3872
|
+
{ name: "x " + t("wizard_cancel"), value: CANCEL }
|
|
3873
|
+
];
|
|
3874
|
+
showOperationHints();
|
|
3875
|
+
selectedCategoryId = await select3({
|
|
3876
|
+
message: t("uninstall_select_category"),
|
|
3877
|
+
choices: categoryChoices,
|
|
3878
|
+
loop: false,
|
|
3879
|
+
theme: selectTheme,
|
|
3880
|
+
pageSize: 15
|
|
3881
|
+
});
|
|
3882
|
+
if (selectedCategoryId === BACK) return "back";
|
|
3883
|
+
if (selectedCategoryId === CANCEL) return "cancel";
|
|
3884
|
+
if (selectedCategoryId === UNSELECT_ALL) {
|
|
3885
|
+
keptSet = /* @__PURE__ */ new Set();
|
|
3886
|
+
step = 0;
|
|
3887
|
+
break;
|
|
3888
|
+
}
|
|
3889
|
+
if (selectedCategoryId === "uninstall") {
|
|
3890
|
+
const toUninstall = installedSkills.filter((id) => !keptSet.has(id));
|
|
3891
|
+
if (toUninstall.length === 0) {
|
|
3892
|
+
logger.info(t("uninstall_nothing_to_uninstall"));
|
|
3893
|
+
return "back";
|
|
3894
|
+
}
|
|
3895
|
+
const confirmed = await confirm({
|
|
3896
|
+
message: t("uninstall_confirm_prompt").replace("{count}", chalk5.bold(String(toUninstall.length))),
|
|
3897
|
+
default: false
|
|
3898
|
+
});
|
|
3899
|
+
if (!confirmed) return "cancel";
|
|
3900
|
+
return { toUninstall, toKeep: [...keptSet] };
|
|
3901
|
+
}
|
|
3902
|
+
step = 1;
|
|
3903
|
+
break;
|
|
3904
|
+
}
|
|
3905
|
+
case 1: {
|
|
3906
|
+
const category = categoriesWithInstalled.find((c) => c.id === selectedCategoryId);
|
|
3907
|
+
if (!category) return "back";
|
|
3908
|
+
printBoxTitle(t("wizard_step_4_skill_title").replace("{category}", category.name));
|
|
3909
|
+
const categorySkillIds = new Set(category.skills.map((s) => s.id));
|
|
3910
|
+
const keptInCategory = new Set([...keptSet].filter((id) => categorySkillIds.has(id)));
|
|
3911
|
+
const skillChoices = [
|
|
3912
|
+
{
|
|
3913
|
+
name: `>> ${t("uninstall_uncheck_all_category")}`,
|
|
3914
|
+
value: SELECT_ALL_CATEGORY,
|
|
3915
|
+
checked: keptInCategory.size === 0,
|
|
3916
|
+
description: t("uninstall_uncheck_all_category")
|
|
3917
|
+
},
|
|
3918
|
+
new Separator2("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"),
|
|
3919
|
+
...category.skills.map((skill) => {
|
|
3920
|
+
const isKept = keptInCategory.has(skill.id);
|
|
3921
|
+
return {
|
|
3922
|
+
name: `${chalk5.cyan(skill.id)}`,
|
|
3923
|
+
value: skill.id,
|
|
3924
|
+
checked: isKept,
|
|
3925
|
+
description: skill.description || ""
|
|
3926
|
+
};
|
|
3927
|
+
})
|
|
3928
|
+
];
|
|
3929
|
+
logger.info(chalk5.dim(` ${t("uninstall_checkbox_hint")}`));
|
|
3930
|
+
logger.blank();
|
|
3931
|
+
showOperationHints(true);
|
|
3932
|
+
const selectedSkills = await checkbox({
|
|
3933
|
+
message: t("uninstall_select_items"),
|
|
3934
|
+
choices: skillChoices,
|
|
3935
|
+
loop: false,
|
|
3936
|
+
instructions: false,
|
|
3937
|
+
theme: checkboxTheme,
|
|
3938
|
+
pageSize: 15
|
|
3939
|
+
});
|
|
3940
|
+
let keptInCat;
|
|
3941
|
+
if (selectedSkills.includes(SELECT_ALL_CATEGORY)) {
|
|
3942
|
+
keptInCat = [];
|
|
3943
|
+
} else {
|
|
3944
|
+
keptInCat = selectedSkills.filter((id) => id !== SELECT_ALL_CATEGORY);
|
|
3945
|
+
}
|
|
3946
|
+
for (const id of categorySkillIds) {
|
|
3947
|
+
if (keptInCat.includes(id)) {
|
|
3948
|
+
keptSet.add(id);
|
|
3949
|
+
} else {
|
|
3950
|
+
keptSet.delete(id);
|
|
3951
|
+
}
|
|
3952
|
+
}
|
|
3953
|
+
const toUninstallCount = installedSkills.length - keptSet.size;
|
|
3954
|
+
const action = await select3({
|
|
3955
|
+
message: toUninstallCount > 0 ? t("uninstall_continue_or_confirm").replace("{count}", String(toUninstallCount)) : t("wizard_no_selection"),
|
|
3956
|
+
choices: toUninstallCount > 0 ? [
|
|
3957
|
+
{ name: ">> " + t("uninstall_confirm_count").replace("{count}", String(toUninstallCount)), value: "uninstall" },
|
|
3958
|
+
{ name: "> " + t("skill_continue_select"), value: CONTINUE_SELECT },
|
|
3959
|
+
new Separator2("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"),
|
|
3960
|
+
{ name: "x " + t("wizard_cancel"), value: "cancel" }
|
|
3961
|
+
] : [
|
|
3962
|
+
new Separator2("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"),
|
|
3963
|
+
{ name: "> " + t("skill_continue_select"), value: CONTINUE_SELECT },
|
|
3964
|
+
{ name: "<- " + t("wizard_back_to_reselect"), value: "back" },
|
|
3965
|
+
{ name: "x " + t("wizard_cancel"), value: "cancel" }
|
|
3966
|
+
],
|
|
3967
|
+
loop: false,
|
|
3968
|
+
theme: selectTheme
|
|
3969
|
+
});
|
|
3970
|
+
if (action === "uninstall") {
|
|
3971
|
+
const toUninstall = installedSkills.filter((id) => !keptSet.has(id));
|
|
3972
|
+
if (toUninstall.length === 0) {
|
|
3973
|
+
logger.info(t("uninstall_nothing_to_uninstall"));
|
|
3974
|
+
return "back";
|
|
3975
|
+
}
|
|
3976
|
+
const confirmed = await confirm({
|
|
3977
|
+
message: t("uninstall_confirm_prompt").replace("{count}", chalk5.bold(String(toUninstall.length))),
|
|
3978
|
+
default: false
|
|
3979
|
+
});
|
|
3980
|
+
if (!confirmed) return "cancel";
|
|
3981
|
+
return { toUninstall, toKeep: [...keptSet] };
|
|
3982
|
+
}
|
|
3983
|
+
if (action === CONTINUE_SELECT) {
|
|
3984
|
+
step = 0;
|
|
3985
|
+
break;
|
|
3986
|
+
}
|
|
3987
|
+
if (action === "back") {
|
|
3988
|
+
step = 0;
|
|
3989
|
+
break;
|
|
3990
|
+
}
|
|
3991
|
+
return "cancel";
|
|
3992
|
+
}
|
|
3993
|
+
}
|
|
3871
3994
|
}
|
|
3872
|
-
return { toUninstall, toKeep };
|
|
3873
3995
|
}
|
|
3874
3996
|
function listAllSkills() {
|
|
3875
3997
|
const categories = getAllCategories();
|
|
@@ -4909,7 +5031,6 @@ async function uninstallRecent(tool, level, yes) {
|
|
|
4909
5031
|
async function uninstallInteractive(defaultTool, defaultLevel) {
|
|
4910
5032
|
let tool = defaultTool;
|
|
4911
5033
|
let level = defaultLevel;
|
|
4912
|
-
printBoxTitle(t("uninstall_interactive_title"));
|
|
4913
5034
|
const typeChoices = [
|
|
4914
5035
|
{ name: `> ${t("uninstall_type_skill")}`, value: "skill" },
|
|
4915
5036
|
{ name: `> ${t("uninstall_type_plugin")}`, value: "plugin" },
|