@cannbot-ai/install-helper 1.2.0-beta.2 → 1.2.0-beta.3
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 +42 -20
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -2081,6 +2081,8 @@ var init_constants = __esm({
|
|
|
2081
2081
|
// src/ui/wizard.ts
|
|
2082
2082
|
var wizard_exports = {};
|
|
2083
2083
|
__export(wizard_exports, {
|
|
2084
|
+
decodePluginChoice: () => decodePluginChoice,
|
|
2085
|
+
encodePluginChoice: () => encodePluginChoice,
|
|
2084
2086
|
runWizard: () => runWizard,
|
|
2085
2087
|
selectToolWithDetection: () => selectToolWithDetection,
|
|
2086
2088
|
stepLevel: () => stepLevel
|
|
@@ -2099,6 +2101,14 @@ async function selectToolWithDetection() {
|
|
|
2099
2101
|
if (result === CANCEL) return "cancel";
|
|
2100
2102
|
return result;
|
|
2101
2103
|
}
|
|
2104
|
+
function encodePluginChoice(id, source) {
|
|
2105
|
+
return source === "cannbot" ? `cannbot::${id}` : `skills::${id}`;
|
|
2106
|
+
}
|
|
2107
|
+
function decodePluginChoice(value) {
|
|
2108
|
+
if (value.startsWith("cannbot::")) return { id: value.slice("cannbot::".length), source: "cannbot" };
|
|
2109
|
+
if (value.startsWith("skills::")) return { id: value.slice("skills::".length), source: "skills" };
|
|
2110
|
+
return { id: value, source: "skills" };
|
|
2111
|
+
}
|
|
2102
2112
|
async function runWizard() {
|
|
2103
2113
|
const config = readConfig();
|
|
2104
2114
|
logger.blank();
|
|
@@ -2273,7 +2283,7 @@ async function stepPlugins(tool, level) {
|
|
|
2273
2283
|
const badge = p.source === "cannbot" ? chalk3.magenta(" [cannbot]") : "";
|
|
2274
2284
|
return {
|
|
2275
2285
|
name: `> ${chalk3.cyan(p.displayName)}${badge}${suffix}`,
|
|
2276
|
-
value: p.id,
|
|
2286
|
+
value: encodePluginChoice(p.id, p.source),
|
|
2277
2287
|
description: p.description
|
|
2278
2288
|
};
|
|
2279
2289
|
});
|
|
@@ -2295,7 +2305,10 @@ async function stepPlugins(tool, level) {
|
|
|
2295
2305
|
async function stepConfirm(tool, level, plugins) {
|
|
2296
2306
|
printBoxTitle(t("wizard_step_4_title"));
|
|
2297
2307
|
const allPlugins = getAllPlugins();
|
|
2298
|
-
const selectedPlugins = plugins.map((
|
|
2308
|
+
const selectedPlugins = plugins.map((value) => {
|
|
2309
|
+
const { id, source } = decodePluginChoice(value);
|
|
2310
|
+
return allPlugins.find((p) => p.id === id && (p.source ?? "skills") === source);
|
|
2311
|
+
});
|
|
2299
2312
|
const displayPath = getConfigRoot(tool, level);
|
|
2300
2313
|
const toolName = getToolDisplayName(tool);
|
|
2301
2314
|
const levelText = level === "project" ? "project" : "global";
|
|
@@ -4676,7 +4689,7 @@ async function delegateInstall(options) {
|
|
|
4676
4689
|
return result;
|
|
4677
4690
|
}
|
|
4678
4691
|
async function installPluginRouted(options) {
|
|
4679
|
-
const isCannbot = options.source === "cannbot" || options.plugin?.source === "cannbot";
|
|
4692
|
+
const isCannbot = options.source === "cannbot" || options.source !== "skills" && options.plugin?.source === "cannbot";
|
|
4680
4693
|
if (isCannbot) {
|
|
4681
4694
|
return delegateInstall({
|
|
4682
4695
|
pluginId: options.pluginId,
|
|
@@ -5428,14 +5441,20 @@ async function pluginInstallFlow() {
|
|
|
5428
5441
|
return "done";
|
|
5429
5442
|
}
|
|
5430
5443
|
const allPlugins = getAllPlugins();
|
|
5431
|
-
const
|
|
5432
|
-
|
|
5433
|
-
|
|
5444
|
+
const selected = answers.plugins.map((value) => {
|
|
5445
|
+
const { id, source } = decodePluginChoice(value);
|
|
5446
|
+
return {
|
|
5447
|
+
id,
|
|
5448
|
+
source,
|
|
5449
|
+
plugin: allPlugins.find((p) => p.id === id && (p.source ?? "skills") === source)
|
|
5450
|
+
};
|
|
5451
|
+
});
|
|
5434
5452
|
const total = answers.plugins.length;
|
|
5435
5453
|
const results = [];
|
|
5436
|
-
for (let i = 0; i <
|
|
5437
|
-
const pluginId =
|
|
5438
|
-
const
|
|
5454
|
+
for (let i = 0; i < selected.length; i++) {
|
|
5455
|
+
const pluginId = selected[i].id;
|
|
5456
|
+
const source = selected[i].source;
|
|
5457
|
+
const plugin = selected[i].plugin;
|
|
5439
5458
|
const displayName = plugin?.displayName || pluginId;
|
|
5440
5459
|
const progress = `[${i + 1}/${total}]`;
|
|
5441
5460
|
const pluginSpinner = createSpinner(`${progress} ${t("install_progress")} ${displayName}...`);
|
|
@@ -5445,7 +5464,8 @@ async function pluginInstallFlow() {
|
|
|
5445
5464
|
tool: answers.tool,
|
|
5446
5465
|
level: answers.level,
|
|
5447
5466
|
repoPath,
|
|
5448
|
-
plugin
|
|
5467
|
+
plugin,
|
|
5468
|
+
source
|
|
5449
5469
|
});
|
|
5450
5470
|
if (result.success) {
|
|
5451
5471
|
pluginSpinner.succeed(
|
|
@@ -5464,7 +5484,7 @@ async function pluginInstallFlow() {
|
|
|
5464
5484
|
}
|
|
5465
5485
|
const summary = results.map((result, index) => ({
|
|
5466
5486
|
pluginId: result.pluginId,
|
|
5467
|
-
displayName:
|
|
5487
|
+
displayName: selected[index]?.plugin?.displayName || result.pluginId,
|
|
5468
5488
|
success: result.success,
|
|
5469
5489
|
skillsCount: result.skillsCount,
|
|
5470
5490
|
agentsCount: result.agentsCount
|
|
@@ -6224,7 +6244,7 @@ async function installPlugins(pluginIds, tool, level, repoPath, installPath, yes
|
|
|
6224
6244
|
const progress = `[${i + 1}/${total}]`;
|
|
6225
6245
|
const spinner = createSpinner(`${progress} ${t("install_progress")} ${pluginId}...`);
|
|
6226
6246
|
spinner.start();
|
|
6227
|
-
const plugin = findPlugin(pluginId);
|
|
6247
|
+
const plugin = findPlugin(pluginId, { source });
|
|
6228
6248
|
const result = await installPluginRouted({
|
|
6229
6249
|
pluginId,
|
|
6230
6250
|
tool,
|
|
@@ -6804,12 +6824,13 @@ async function updateCommand(pluginNames, options) {
|
|
|
6804
6824
|
}
|
|
6805
6825
|
for (const name of pluginNames) {
|
|
6806
6826
|
const cannbotMatches = cannbotInstalled.filter((e) => e.id === name);
|
|
6807
|
-
const
|
|
6808
|
-
|
|
6827
|
+
const legacyPlugin = findPlugin(name, { source: "skills" });
|
|
6828
|
+
const anyPlugin = findPlugin(name);
|
|
6829
|
+
if (cannbotMatches.length === 0 && !legacyPlugin && !anyPlugin) {
|
|
6809
6830
|
logger.error(`${t("error_plugin_not_found")}: ${name}`);
|
|
6810
6831
|
continue;
|
|
6811
6832
|
}
|
|
6812
|
-
const legacyMatches = cannbotMatches.length === 0 &&
|
|
6833
|
+
const legacyMatches = cannbotMatches.length === 0 && legacyPlugin ? installed.filter((p) => p.id === legacyPlugin.id) : [];
|
|
6813
6834
|
const matches = [
|
|
6814
6835
|
...cannbotMatches.map((e) => ({ pluginId: e.id, tool: e.tool, level: "project", source: "cannbot" })),
|
|
6815
6836
|
...legacyMatches.map((p) => ({ pluginId: p.id, tool: p.tool, level: p.level, source: "skills" }))
|
|
@@ -6821,7 +6842,8 @@ async function updateCommand(pluginNames, options) {
|
|
|
6821
6842
|
targets.push(match);
|
|
6822
6843
|
}
|
|
6823
6844
|
} else {
|
|
6824
|
-
|
|
6845
|
+
const displayName = cannbotMatches.length ? cannbotMatches[0].id : legacyPlugin?.displayName || anyPlugin?.displayName || name;
|
|
6846
|
+
logger.warn(`${displayName} ${t("error_not_installed")}, ${t("update_skipped")}`);
|
|
6825
6847
|
}
|
|
6826
6848
|
}
|
|
6827
6849
|
}
|
|
@@ -6841,12 +6863,11 @@ async function updateCommand(pluginNames, options) {
|
|
|
6841
6863
|
);
|
|
6842
6864
|
}
|
|
6843
6865
|
}
|
|
6844
|
-
const allPlugins = getAllPlugins();
|
|
6845
6866
|
const results = [];
|
|
6846
6867
|
const total = targets.length;
|
|
6847
6868
|
for (let i = 0; i < targets.length; i++) {
|
|
6848
6869
|
const target = targets[i];
|
|
6849
|
-
const plugin =
|
|
6870
|
+
const plugin = findPlugin(target.pluginId, { source: target.source });
|
|
6850
6871
|
const displayName = plugin?.displayName || target.pluginId;
|
|
6851
6872
|
const progress = `[${i + 1}/${total}]`;
|
|
6852
6873
|
const pluginSpinner = createSpinner(`${progress} ${t("update_updating")} ${displayName}...`);
|
|
@@ -6874,8 +6895,9 @@ async function updateCommand(pluginNames, options) {
|
|
|
6874
6895
|
}
|
|
6875
6896
|
results.push(result);
|
|
6876
6897
|
}
|
|
6877
|
-
const summary = results.map((result) => {
|
|
6878
|
-
const
|
|
6898
|
+
const summary = results.map((result, index) => {
|
|
6899
|
+
const source = targets[index]?.source;
|
|
6900
|
+
const plugin = source ? findPlugin(result.pluginId, { source }) : void 0;
|
|
6879
6901
|
return {
|
|
6880
6902
|
pluginId: result.pluginId,
|
|
6881
6903
|
displayName: plugin?.displayName || result.pluginId,
|