@cannbot-ai/install-helper 0.0.2-beta.23 → 0.0.2-beta.25
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 +128 -121
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5,11 +5,11 @@ import { Command } from "commander";
|
|
|
5
5
|
|
|
6
6
|
// src/commands/init.ts
|
|
7
7
|
import { select as select4, Separator as Separator3 } from "@inquirer/prompts";
|
|
8
|
-
import
|
|
8
|
+
import chalk7 from "chalk";
|
|
9
9
|
|
|
10
10
|
// src/ui/wizard.ts
|
|
11
11
|
import { select, checkbox, Separator } from "@inquirer/prompts";
|
|
12
|
-
import
|
|
12
|
+
import chalk3 from "chalk";
|
|
13
13
|
|
|
14
14
|
// src/core/registry.ts
|
|
15
15
|
import { readdirSync, readFileSync } from "fs";
|
|
@@ -548,6 +548,7 @@ function removeInstalledPlugin(pluginId) {
|
|
|
548
548
|
}
|
|
549
549
|
|
|
550
550
|
// src/ui/theme.ts
|
|
551
|
+
import chalk2 from "chalk";
|
|
551
552
|
var selectTheme = {
|
|
552
553
|
helpMode: "never"
|
|
553
554
|
};
|
|
@@ -557,7 +558,10 @@ var checkboxTheme = {
|
|
|
557
558
|
unchecked: "\u2610",
|
|
558
559
|
cursor: "\u276F"
|
|
559
560
|
},
|
|
560
|
-
helpMode: "never"
|
|
561
|
+
helpMode: "never",
|
|
562
|
+
style: {
|
|
563
|
+
description: (text) => chalk2.cyan(" \u{1F4A1} " + text)
|
|
564
|
+
}
|
|
561
565
|
};
|
|
562
566
|
|
|
563
567
|
// src/ui/wizard.ts
|
|
@@ -747,9 +751,10 @@ async function stepPlugins(tool, level) {
|
|
|
747
751
|
const isInstalled = installedSet.has(p.id);
|
|
748
752
|
const suffix = isInstalled ? ` [${t("wizard_already_installed")}]` : "";
|
|
749
753
|
return {
|
|
750
|
-
name: `${p.displayName}${suffix}
|
|
754
|
+
name: `${chalk3.cyan(p.displayName)}${suffix}`,
|
|
751
755
|
value: p.id,
|
|
752
|
-
checked: false
|
|
756
|
+
checked: false,
|
|
757
|
+
description: p.description
|
|
753
758
|
};
|
|
754
759
|
});
|
|
755
760
|
showOperationHints(true);
|
|
@@ -785,11 +790,11 @@ async function stepConfirm(tool, level, plugins) {
|
|
|
785
790
|
const displayPath = getConfigRoot(tool, level);
|
|
786
791
|
const toolName = getToolDisplayName(tool);
|
|
787
792
|
const levelText = level === "project" ? "project" : "global";
|
|
788
|
-
logger.info(t("wizard_confirm_install_format").replace("{count}",
|
|
789
|
-
logger.info(`${t("wizard_install_path")}: ${
|
|
793
|
+
logger.info(t("wizard_confirm_install_format").replace("{count}", chalk3.bold(String(plugins.length))).replace("{tool}", chalk3.green(toolName)).replace("{level}", chalk3.cyan(levelText)));
|
|
794
|
+
logger.info(`${t("wizard_install_path")}: ${chalk3.cyan(displayPath)}`);
|
|
790
795
|
for (const plugin of selectedPlugins) {
|
|
791
796
|
if (plugin) {
|
|
792
|
-
logger.step(` \u2022 ${
|
|
797
|
+
logger.step(` \u2022 ${chalk3.bold(plugin.displayName)}`);
|
|
793
798
|
}
|
|
794
799
|
}
|
|
795
800
|
logger.blank();
|
|
@@ -1668,13 +1673,13 @@ function readAllRecords() {
|
|
|
1668
1673
|
|
|
1669
1674
|
// src/ui/backup-prompts.ts
|
|
1670
1675
|
import { select as select2 } from "@inquirer/prompts";
|
|
1671
|
-
import
|
|
1676
|
+
import chalk4 from "chalk";
|
|
1672
1677
|
async function showOverwriteWarning(currentPluginName, newPluginName) {
|
|
1673
1678
|
console.log();
|
|
1674
|
-
console.log(
|
|
1679
|
+
console.log(chalk4.yellow(` \u26A0\uFE0F ${t("backup_detected")}`));
|
|
1675
1680
|
console.log();
|
|
1676
|
-
console.log(` ${t("backup_current")}: ${
|
|
1677
|
-
console.log(` ${t("backup_installing")}: ${
|
|
1681
|
+
console.log(` ${t("backup_current")}: ${chalk4.cyan(currentPluginName)}`);
|
|
1682
|
+
console.log(` ${t("backup_installing")}: ${chalk4.cyan(newPluginName)}`);
|
|
1678
1683
|
console.log();
|
|
1679
1684
|
console.log(` ${t("backup_overwrite_warning")}`);
|
|
1680
1685
|
console.log(` ${t("backup_auto_create")}`);
|
|
@@ -1690,7 +1695,7 @@ async function showOverwriteWarning(currentPluginName, newPluginName) {
|
|
|
1690
1695
|
}
|
|
1691
1696
|
async function showRestorePrompt(backups) {
|
|
1692
1697
|
console.log();
|
|
1693
|
-
console.log(
|
|
1698
|
+
console.log(chalk4.cyan(` ${t("backup_restore_prompt")}`));
|
|
1694
1699
|
console.log();
|
|
1695
1700
|
const choices = backups.map((b) => ({
|
|
1696
1701
|
name: `${t("backup_restore")} ${b.pluginName} (${b.backupTime})`,
|
|
@@ -1832,7 +1837,7 @@ async function installPlugin(opts) {
|
|
|
1832
1837
|
import { existsSync as existsSync10, mkdirSync as mkdirSync5, symlinkSync, unlinkSync as unlinkSync3, readdirSync as readdirSync4, rmdirSync, realpathSync, lstatSync as lstatSync2 } from "fs";
|
|
1833
1838
|
import { join as join12 } from "path";
|
|
1834
1839
|
import { select as select3, checkbox as checkbox2, Separator as Separator2 } from "@inquirer/prompts";
|
|
1835
|
-
import
|
|
1840
|
+
import chalk5 from "chalk";
|
|
1836
1841
|
import Table from "cli-table3";
|
|
1837
1842
|
async function installSkills(skillIds, tool, level, repoPath) {
|
|
1838
1843
|
const configRoot = getConfigRoot(tool, level);
|
|
@@ -1971,7 +1976,8 @@ async function interactiveSkillSelect(tool, level) {
|
|
|
1971
1976
|
{
|
|
1972
1977
|
name: `>> ${t("skill_select_all_category")}`,
|
|
1973
1978
|
value: SELECT_ALL_CATEGORY,
|
|
1974
|
-
checked: accumulatedInCategory.size === category.skills.length
|
|
1979
|
+
checked: accumulatedInCategory.size === category.skills.length,
|
|
1980
|
+
description: t("skill_select_all_category")
|
|
1975
1981
|
},
|
|
1976
1982
|
new Separator2("\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500"),
|
|
1977
1983
|
...category.skills.map((skill) => {
|
|
@@ -1979,9 +1985,10 @@ async function interactiveSkillSelect(tool, level) {
|
|
|
1979
1985
|
const isAccumulated = accumulatedInCategory.has(skill.id);
|
|
1980
1986
|
const suffix = isInstalled ? ` [${t("skill_already_installed")}]` : isAccumulated ? " [+]" : "";
|
|
1981
1987
|
return {
|
|
1982
|
-
name: `${skill.id}${suffix}
|
|
1988
|
+
name: `${chalk5.cyan(skill.id)}${suffix}`,
|
|
1983
1989
|
value: skill.id,
|
|
1984
|
-
checked: isAccumulated
|
|
1990
|
+
checked: isAccumulated,
|
|
1991
|
+
description: skill.description
|
|
1985
1992
|
};
|
|
1986
1993
|
})
|
|
1987
1994
|
];
|
|
@@ -2055,11 +2062,11 @@ async function interactiveSkillSelect(tool, level) {
|
|
|
2055
2062
|
function listAllSkills() {
|
|
2056
2063
|
const categories = getAllCategories();
|
|
2057
2064
|
console.log();
|
|
2058
|
-
console.log(
|
|
2059
|
-
console.log(
|
|
2065
|
+
console.log(chalk5.bold(` ${t("skill_list_title")}`));
|
|
2066
|
+
console.log(chalk5.dim(" " + "\u2500".repeat(60)));
|
|
2060
2067
|
for (const category of categories) {
|
|
2061
2068
|
console.log();
|
|
2062
|
-
console.log(
|
|
2069
|
+
console.log(chalk5.bold(` ${category.name}`) + chalk5.dim(` (${category.skills.length} skills)`));
|
|
2063
2070
|
const table = new Table({
|
|
2064
2071
|
style: { head: [], border: [] },
|
|
2065
2072
|
colWidths: [35, 45],
|
|
@@ -2067,14 +2074,14 @@ function listAllSkills() {
|
|
|
2067
2074
|
});
|
|
2068
2075
|
for (const skill of category.skills) {
|
|
2069
2076
|
table.push([
|
|
2070
|
-
|
|
2077
|
+
chalk5.cyan(skill.id),
|
|
2071
2078
|
skill.description
|
|
2072
2079
|
]);
|
|
2073
2080
|
}
|
|
2074
2081
|
console.log(table.toString());
|
|
2075
2082
|
}
|
|
2076
2083
|
console.log();
|
|
2077
|
-
console.log(
|
|
2084
|
+
console.log(chalk5.dim(` ${t("skill_total_count").replace("{count}", String(getAllSkills().length))}`));
|
|
2078
2085
|
console.log();
|
|
2079
2086
|
}
|
|
2080
2087
|
function isSymlink2(path) {
|
|
@@ -2086,22 +2093,22 @@ function isSymlink2(path) {
|
|
|
2086
2093
|
}
|
|
2087
2094
|
|
|
2088
2095
|
// src/ui/display.ts
|
|
2089
|
-
import
|
|
2096
|
+
import chalk6 from "chalk";
|
|
2090
2097
|
import Table2 from "cli-table3";
|
|
2091
2098
|
function printPluginList(plugins, installed) {
|
|
2092
2099
|
const table = new Table2({
|
|
2093
2100
|
head: [
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2101
|
+
chalk6.cyan(t("list_id")),
|
|
2102
|
+
chalk6.cyan(t("list_name")),
|
|
2103
|
+
chalk6.cyan(t("list_status")),
|
|
2104
|
+
chalk6.cyan(t("list_skills")),
|
|
2105
|
+
chalk6.cyan(t("list_agents"))
|
|
2099
2106
|
],
|
|
2100
2107
|
style: { head: [], border: [] }
|
|
2101
2108
|
});
|
|
2102
2109
|
plugins.forEach((plugin, index) => {
|
|
2103
2110
|
const isInstalled = installed.has(plugin.id);
|
|
2104
|
-
const status = isInstalled ?
|
|
2111
|
+
const status = isInstalled ? chalk6.green(`\u2713 ${t("status_installed")}`) : chalk6.dim(`\u2014`);
|
|
2105
2112
|
table.push([
|
|
2106
2113
|
String(index + 1),
|
|
2107
2114
|
plugin.displayName,
|
|
@@ -2112,7 +2119,7 @@ function printPluginList(plugins, installed) {
|
|
|
2112
2119
|
});
|
|
2113
2120
|
console.log();
|
|
2114
2121
|
const countSuffix = t("count_suffix");
|
|
2115
|
-
console.log(
|
|
2122
|
+
console.log(chalk6.bold(` ${t("list_title")} (${plugins.length}${countSuffix ? " " + countSuffix : ""})`));
|
|
2116
2123
|
console.log(table.toString());
|
|
2117
2124
|
console.log();
|
|
2118
2125
|
}
|
|
@@ -2121,7 +2128,7 @@ function printInstallSummary(results) {
|
|
|
2121
2128
|
const totalCount = results.length;
|
|
2122
2129
|
console.log();
|
|
2123
2130
|
console.log(
|
|
2124
|
-
|
|
2131
|
+
chalk6.bold(
|
|
2125
2132
|
` ${t("install_done")}! ${successCount}/${totalCount} ${t("install_success")}`
|
|
2126
2133
|
)
|
|
2127
2134
|
);
|
|
@@ -2129,10 +2136,10 @@ function printInstallSummary(results) {
|
|
|
2129
2136
|
for (const result of results) {
|
|
2130
2137
|
if (result.success) {
|
|
2131
2138
|
console.log(
|
|
2132
|
-
|
|
2139
|
+
chalk6.green(" \u2713") + ` ${result.displayName} (${result.skillsCount} skills, ${result.agentsCount} agents)`
|
|
2133
2140
|
);
|
|
2134
2141
|
} else {
|
|
2135
|
-
console.log(
|
|
2142
|
+
console.log(chalk6.red(" \u2717") + ` ${result.displayName}`);
|
|
2136
2143
|
}
|
|
2137
2144
|
}
|
|
2138
2145
|
console.log();
|
|
@@ -2147,23 +2154,23 @@ function printEnhancedSummary(results, tool, configRoot) {
|
|
|
2147
2154
|
const toolName = getToolDisplayName(tool);
|
|
2148
2155
|
const countSuffix = t("count_suffix");
|
|
2149
2156
|
const lines = [
|
|
2150
|
-
|
|
2157
|
+
chalk6.bold(` ${t("install_done")}!`),
|
|
2151
2158
|
"",
|
|
2152
|
-
` ${
|
|
2153
|
-
` ${
|
|
2159
|
+
` ${chalk6.dim(t("install_installed_to") + ":")} ${configRoot}`,
|
|
2160
|
+
` ${chalk6.dim(t("install_skills_count") + ":")} ${totalSkills}${countSuffix ? " " + countSuffix : ""} ${chalk6.dim("|")} ${chalk6.dim(t("install_agents_count") + ":")} ${totalAgents}${countSuffix ? " " + countSuffix : ""}`,
|
|
2154
2161
|
"",
|
|
2155
|
-
|
|
2156
|
-
` ${
|
|
2157
|
-
` ${
|
|
2158
|
-
` ${
|
|
2159
|
-
` ${
|
|
2162
|
+
chalk6.bold(` ${t("install_enhanced_next_steps")}:`),
|
|
2163
|
+
` ${chalk6.cyan("1.")} ${t("install_enhanced_launch")}: ${chalk6.green(toolName.toLowerCase())}`,
|
|
2164
|
+
` ${chalk6.cyan("2.")} ${t("install_enhanced_try")}: ${chalk6.green(t("try_prompt"))}`,
|
|
2165
|
+
` ${chalk6.cyan("3.")} ${t("install_enhanced_more")}: ${chalk6.green("install-helper list")}`,
|
|
2166
|
+
` ${chalk6.cyan("4.")} ${t("install_enhanced_check")}: ${chalk6.green("install-helper doctor")}`,
|
|
2160
2167
|
""
|
|
2161
2168
|
];
|
|
2162
2169
|
if (successResults.length === 1) {
|
|
2163
2170
|
const plugin = findPlugin(successResults[0].pluginId);
|
|
2164
2171
|
const docsPath = plugin ? `${plugin.dir}/quickstart.md` : `${successResults[0].pluginId}/quickstart.md`;
|
|
2165
2172
|
lines.push(
|
|
2166
|
-
` ${
|
|
2173
|
+
` ${chalk6.dim(t("install_enhanced_docs"))}: ${chalk6.dim(docsPath)}`
|
|
2167
2174
|
);
|
|
2168
2175
|
}
|
|
2169
2176
|
console.log();
|
|
@@ -2364,7 +2371,7 @@ async function skillInstallFlow() {
|
|
|
2364
2371
|
spinner.start();
|
|
2365
2372
|
const repoPath = await repoManager.ensureRepo();
|
|
2366
2373
|
spinner.succeed(t("loading_plugin_data_complete"));
|
|
2367
|
-
logger.info(`${t("skill_install_progress")} ${t("skill_count_format").replace("{count}",
|
|
2374
|
+
logger.info(`${t("skill_install_progress")} ${t("skill_count_format").replace("{count}", chalk7.bold(String(selectedSkills.length)))}...`);
|
|
2368
2375
|
const results = await installSkills(selectedSkills, tool, level, repoPath);
|
|
2369
2376
|
let successCount = 0;
|
|
2370
2377
|
let failCount = 0;
|
|
@@ -2382,10 +2389,10 @@ async function skillInstallFlow() {
|
|
|
2382
2389
|
}
|
|
2383
2390
|
const configRoot = getConfigRoot(tool, level);
|
|
2384
2391
|
logger.blank();
|
|
2385
|
-
logger.success(`${t("skill_install_done")}: ${
|
|
2392
|
+
logger.success(`${t("skill_install_done")}: ${chalk7.green(t("result_success_format").replace("{count}", String(successCount)))}, ${failCount > 0 ? chalk7.red(t("result_failed_format").replace("{count}", String(failCount))) : chalk7.dim(t("result_failed_format").replace("{count}", String(failCount)))}`);
|
|
2386
2393
|
logger.blank();
|
|
2387
|
-
logger.info(`${t("install_to")}: ${
|
|
2388
|
-
logger.info(`${t("start_to_use").replace("{tool}",
|
|
2394
|
+
logger.info(`${t("install_to")}: ${chalk7.cyan(configRoot + "/skills/")}`);
|
|
2395
|
+
logger.info(`${t("start_to_use").replace("{tool}", chalk7.green(tool))}`);
|
|
2389
2396
|
logger.blank();
|
|
2390
2397
|
return "done";
|
|
2391
2398
|
}
|
|
@@ -2407,32 +2414,32 @@ async function listCommand() {
|
|
|
2407
2414
|
}
|
|
2408
2415
|
|
|
2409
2416
|
// src/commands/doctor.ts
|
|
2410
|
-
import
|
|
2417
|
+
import chalk8 from "chalk";
|
|
2411
2418
|
import { existsSync as existsSync12, readdirSync as readdirSync5, lstatSync as lstatSync3, unlinkSync as unlinkSync4, mkdirSync as mkdirSync6 } from "fs";
|
|
2412
2419
|
import { join as join14 } from "path";
|
|
2413
2420
|
async function doctorCommand(options = {}) {
|
|
2414
2421
|
console.log();
|
|
2415
|
-
console.log(
|
|
2416
|
-
console.log(
|
|
2422
|
+
console.log(chalk8.bold(` ${t("doctor_title")}`));
|
|
2423
|
+
console.log(chalk8.dim(" " + "\u2500".repeat(46)));
|
|
2417
2424
|
let errors = 0;
|
|
2418
2425
|
let warnings = 0;
|
|
2419
2426
|
let fixes = 0;
|
|
2420
2427
|
console.log();
|
|
2421
|
-
console.log(
|
|
2428
|
+
console.log(chalk8.bold(` ${t("doctor_tools")}`));
|
|
2422
2429
|
const detectedTools = await detectTools();
|
|
2423
2430
|
const allTools = getAllTools();
|
|
2424
2431
|
for (const tool of allTools) {
|
|
2425
2432
|
const detected = detectedTools.find((d) => d.name === tool);
|
|
2426
2433
|
if (detected) {
|
|
2427
2434
|
console.log(
|
|
2428
|
-
|
|
2435
|
+
chalk8.green(" \u2713") + ` ${getToolDisplayName(tool)}${detected.version ? ` v${detected.version}` : ""}`
|
|
2429
2436
|
);
|
|
2430
2437
|
} else {
|
|
2431
|
-
console.log(
|
|
2438
|
+
console.log(chalk8.dim(" \u2014") + ` ${getToolDisplayName(tool)} \u2014 ${t("doctor_not_installed")}`);
|
|
2432
2439
|
}
|
|
2433
2440
|
}
|
|
2434
2441
|
console.log();
|
|
2435
|
-
console.log(
|
|
2442
|
+
console.log(chalk8.bold(` ${t("doctor_plugins")}`));
|
|
2436
2443
|
const plugins = getAllPlugins();
|
|
2437
2444
|
const installed = scanInstalled();
|
|
2438
2445
|
const installedMap = new Map(installed.map((p) => [p.id, p]));
|
|
@@ -2440,14 +2447,14 @@ async function doctorCommand(options = {}) {
|
|
|
2440
2447
|
const inst = installedMap.get(plugin.id);
|
|
2441
2448
|
if (inst) {
|
|
2442
2449
|
console.log(
|
|
2443
|
-
|
|
2450
|
+
chalk8.green(" \u2713") + ` ${plugin.id.padEnd(30)} ${inst.skillsCount} skills, ${inst.agentsCount} agents`
|
|
2444
2451
|
);
|
|
2445
2452
|
} else {
|
|
2446
|
-
console.log(
|
|
2453
|
+
console.log(chalk8.dim(" \u2014") + ` ${plugin.id.padEnd(30)} \u2014 ${t("doctor_not_installed")}`);
|
|
2447
2454
|
}
|
|
2448
2455
|
}
|
|
2449
2456
|
console.log();
|
|
2450
|
-
console.log(
|
|
2457
|
+
console.log(chalk8.bold(` ${t("doctor_links")}`));
|
|
2451
2458
|
const primaryTool = detectedTools[0]?.name || "opencode";
|
|
2452
2459
|
const configRoot = getConfigRoot(primaryTool, "project");
|
|
2453
2460
|
const skillsDir = getSkillsDir(configRoot);
|
|
@@ -2456,57 +2463,57 @@ async function doctorCommand(options = {}) {
|
|
|
2456
2463
|
const brokenLinks = checkBrokenLinks(skillsDir);
|
|
2457
2464
|
if (brokenLinks === 0) {
|
|
2458
2465
|
const count = readdirSync5(skillsDir).length;
|
|
2459
|
-
console.log(
|
|
2466
|
+
console.log(chalk8.green(" \u2713") + ` ${skillsDir} \u2014 ${t("doctor_links_valid").replace("{count}", String(count))}`);
|
|
2460
2467
|
} else {
|
|
2461
|
-
console.log(
|
|
2468
|
+
console.log(chalk8.yellow(" \u26A0") + ` ${skillsDir} \u2014 ${t("doctor_broken_links").replace("{count}", String(brokenLinks))}`);
|
|
2462
2469
|
warnings++;
|
|
2463
2470
|
if (options.fix) {
|
|
2464
2471
|
const fixed = fixBrokenLinks(skillsDir);
|
|
2465
2472
|
fixes += fixed;
|
|
2466
|
-
console.log(
|
|
2473
|
+
console.log(chalk8.green(" \u2713") + ` ${t("doctor_fix_cleaning")}: ${t("doctor_fixed").replace("{count}", String(fixed))}`);
|
|
2467
2474
|
}
|
|
2468
2475
|
}
|
|
2469
2476
|
} else {
|
|
2470
|
-
console.log(
|
|
2477
|
+
console.log(chalk8.dim(" \u2014") + ` ${skillsDir} \u2014 ${t("doctor_not_exist")}`);
|
|
2471
2478
|
if (options.fix) {
|
|
2472
2479
|
mkdirSync6(skillsDir, { recursive: true });
|
|
2473
2480
|
fixes++;
|
|
2474
|
-
console.log(
|
|
2481
|
+
console.log(chalk8.green(" \u2713") + ` ${t("doctor_fix_rebuilding")}: ${t("doctor_created").replace("{path}", skillsDir)}`);
|
|
2475
2482
|
}
|
|
2476
2483
|
}
|
|
2477
2484
|
if (existsSync12(agentsDir)) {
|
|
2478
2485
|
const brokenLinks = checkBrokenLinks(agentsDir);
|
|
2479
2486
|
if (brokenLinks === 0) {
|
|
2480
2487
|
const count = readdirSync5(agentsDir).length;
|
|
2481
|
-
console.log(
|
|
2488
|
+
console.log(chalk8.green(" \u2713") + ` ${agentsDir} \u2014 ${t("doctor_links_valid").replace("{count}", String(count))}`);
|
|
2482
2489
|
} else {
|
|
2483
|
-
console.log(
|
|
2490
|
+
console.log(chalk8.yellow(" \u26A0") + ` ${agentsDir} \u2014 ${t("doctor_broken_links").replace("{count}", String(brokenLinks))}`);
|
|
2484
2491
|
warnings++;
|
|
2485
2492
|
if (options.fix) {
|
|
2486
2493
|
const fixed = fixBrokenLinks(agentsDir);
|
|
2487
2494
|
fixes += fixed;
|
|
2488
|
-
console.log(
|
|
2495
|
+
console.log(chalk8.green(" \u2713") + ` ${t("doctor_fix_cleaning")}: ${t("doctor_fixed").replace("{count}", String(fixed))}`);
|
|
2489
2496
|
}
|
|
2490
2497
|
}
|
|
2491
2498
|
} else {
|
|
2492
|
-
console.log(
|
|
2499
|
+
console.log(chalk8.dim(" \u2014") + ` ${agentsDir} \u2014 ${t("doctor_not_exist")}`);
|
|
2493
2500
|
if (options.fix) {
|
|
2494
2501
|
mkdirSync6(agentsDir, { recursive: true });
|
|
2495
2502
|
fixes++;
|
|
2496
|
-
console.log(
|
|
2503
|
+
console.log(chalk8.green(" \u2713") + ` ${t("doctor_fix_rebuilding")}: ${t("doctor_created").replace("{path}", agentsDir)}`);
|
|
2497
2504
|
}
|
|
2498
2505
|
}
|
|
2499
2506
|
console.log();
|
|
2500
|
-
console.log(
|
|
2507
|
+
console.log(chalk8.bold(` ${t("doctor_config")}`));
|
|
2501
2508
|
const configFile = getConfigFileName(primaryTool);
|
|
2502
2509
|
const configPath = join14(process.cwd(), configFile);
|
|
2503
2510
|
if (existsSync12(configPath)) {
|
|
2504
|
-
console.log(
|
|
2511
|
+
console.log(chalk8.green(" \u2713") + ` ${configFile} ${t("doctor_config_exists")}`);
|
|
2505
2512
|
} else {
|
|
2506
|
-
console.log(
|
|
2513
|
+
console.log(chalk8.dim(" \u2014") + ` ${configFile} ${t("doctor_config_not_exist")}`);
|
|
2507
2514
|
}
|
|
2508
2515
|
console.log();
|
|
2509
|
-
console.log(
|
|
2516
|
+
console.log(chalk8.dim(" " + "\u2500".repeat(46)));
|
|
2510
2517
|
if (options.fix && fixes > 0) {
|
|
2511
2518
|
console.log(
|
|
2512
2519
|
` ${t("doctor_result")}: ${t("doctor_result_with_fix").replace("{warnings}", String(warnings)).replace("{errors}", String(errors)).replace("{fixes}", String(fixes))}`
|
|
@@ -2562,36 +2569,36 @@ function fixBrokenLinks(dir) {
|
|
|
2562
2569
|
}
|
|
2563
2570
|
|
|
2564
2571
|
// src/commands/status.ts
|
|
2565
|
-
import
|
|
2572
|
+
import chalk9 from "chalk";
|
|
2566
2573
|
async function statusCommand() {
|
|
2567
2574
|
const plugins = getAllPlugins();
|
|
2568
2575
|
const installed = scanInstalled();
|
|
2569
2576
|
const installedMap = new Map(installed.map((p) => [p.id, p]));
|
|
2570
2577
|
console.log();
|
|
2571
|
-
console.log(
|
|
2578
|
+
console.log(chalk9.bold(` ${t("status_title")}`));
|
|
2572
2579
|
console.log();
|
|
2573
2580
|
if (installed.length === 0) {
|
|
2574
|
-
console.log(
|
|
2575
|
-
console.log(
|
|
2581
|
+
console.log(chalk9.dim(` ${t("status_none")}`));
|
|
2582
|
+
console.log(chalk9.dim(` ${t("status_hint")}`));
|
|
2576
2583
|
console.log();
|
|
2577
2584
|
return;
|
|
2578
2585
|
}
|
|
2579
2586
|
for (const inst of installed) {
|
|
2580
2587
|
console.log(
|
|
2581
|
-
|
|
2588
|
+
chalk9.green(" \u2713") + ` ${inst.displayName}` + chalk9.dim(` (${inst.tool}, ${inst.level})`)
|
|
2582
2589
|
);
|
|
2583
2590
|
console.log(
|
|
2584
|
-
|
|
2591
|
+
chalk9.dim(` ${inst.skillsCount} skills, ${inst.agentsCount} agents`)
|
|
2585
2592
|
);
|
|
2586
|
-
console.log(
|
|
2587
|
-
console.log(
|
|
2593
|
+
console.log(chalk9.dim(` ${inst.configRoot}`));
|
|
2594
|
+
console.log(chalk9.dim(` ${t("status_install_time")}: ${inst.installTime}`));
|
|
2588
2595
|
console.log();
|
|
2589
2596
|
}
|
|
2590
2597
|
}
|
|
2591
2598
|
|
|
2592
2599
|
// src/commands/install.ts
|
|
2593
2600
|
import { confirm } from "@inquirer/prompts";
|
|
2594
|
-
import
|
|
2601
|
+
import chalk10 from "chalk";
|
|
2595
2602
|
async function installCommand(names, options) {
|
|
2596
2603
|
if (options.list) {
|
|
2597
2604
|
try {
|
|
@@ -2632,7 +2639,7 @@ async function installCommand(names, options) {
|
|
|
2632
2639
|
spinner.start();
|
|
2633
2640
|
const repoPath = await repoManager.ensureRepo();
|
|
2634
2641
|
spinner.succeed(t("loading_plugin_data_complete"));
|
|
2635
|
-
logger.info(`${t("skill_all_install_progress").replace("{count}",
|
|
2642
|
+
logger.info(`${t("skill_all_install_progress").replace("{count}", chalk10.bold(String(skillIds.length)))}`);
|
|
2636
2643
|
const results = await installSkills(skillIds, tool2, level2, repoPath);
|
|
2637
2644
|
let successCount = 0;
|
|
2638
2645
|
let failCount = 0;
|
|
@@ -2650,10 +2657,10 @@ async function installCommand(names, options) {
|
|
|
2650
2657
|
}
|
|
2651
2658
|
const configRoot = getConfigRoot(tool2, level2);
|
|
2652
2659
|
logger.blank();
|
|
2653
|
-
logger.success(`${t("skill_install_done")}: ${
|
|
2660
|
+
logger.success(`${t("skill_install_done")}: ${chalk10.green(t("result_success_format").replace("{count}", String(successCount)))}, ${failCount > 0 ? chalk10.red(t("result_failed_format").replace("{count}", String(failCount))) : chalk10.dim(t("result_failed_format").replace("{count}", String(failCount)))}`);
|
|
2654
2661
|
logger.blank();
|
|
2655
|
-
logger.info(`${t("install_to")}: ${
|
|
2656
|
-
logger.info(`${t("start_to_use").replace("{tool}",
|
|
2662
|
+
logger.info(`${t("install_to")}: ${chalk10.cyan(configRoot + "/skills/")}`);
|
|
2663
|
+
logger.info(`${t("start_to_use").replace("{tool}", chalk10.green(tool2))}`);
|
|
2657
2664
|
logger.blank();
|
|
2658
2665
|
return;
|
|
2659
2666
|
}
|
|
@@ -2698,7 +2705,7 @@ async function installCommand(names, options) {
|
|
|
2698
2705
|
spinner.start();
|
|
2699
2706
|
const repoPath = await repoManager.ensureRepo();
|
|
2700
2707
|
spinner.succeed(t("loading_plugin_data_complete"));
|
|
2701
|
-
logger.info(`${t("skill_install_progress")} ${t("skill_count_format").replace("{count}",
|
|
2708
|
+
logger.info(`${t("skill_install_progress")} ${t("skill_count_format").replace("{count}", chalk10.bold(String(names.length)))}...`);
|
|
2702
2709
|
const results = await installSkills(names, tool2, level2, repoPath);
|
|
2703
2710
|
let successCount = 0;
|
|
2704
2711
|
let failCount = 0;
|
|
@@ -2716,10 +2723,10 @@ async function installCommand(names, options) {
|
|
|
2716
2723
|
}
|
|
2717
2724
|
const configRoot = getConfigRoot(tool2, level2);
|
|
2718
2725
|
logger.blank();
|
|
2719
|
-
logger.success(`${t("skill_install_done")}: ${
|
|
2726
|
+
logger.success(`${t("skill_install_done")}: ${chalk10.green(t("result_success_format").replace("{count}", String(successCount)))}, ${failCount > 0 ? chalk10.red(t("result_failed_format").replace("{count}", String(failCount))) : chalk10.dim(t("result_failed_format").replace("{count}", String(failCount)))}`);
|
|
2720
2727
|
logger.blank();
|
|
2721
|
-
logger.info(`${t("install_to")}: ${
|
|
2722
|
-
logger.info(`${t("start_to_use").replace("{tool}",
|
|
2728
|
+
logger.info(`${t("install_to")}: ${chalk10.cyan(configRoot + "/skills/")}`);
|
|
2729
|
+
logger.info(`${t("start_to_use").replace("{tool}", chalk10.green(tool2))}`);
|
|
2723
2730
|
logger.blank();
|
|
2724
2731
|
return;
|
|
2725
2732
|
}
|
|
@@ -2754,7 +2761,7 @@ async function installCommand(names, options) {
|
|
|
2754
2761
|
for (const p of allPlugins) {
|
|
2755
2762
|
logger.step(` ${p.id} (${p.aliases.join(", ")})`);
|
|
2756
2763
|
}
|
|
2757
|
-
logger.info(`${t("available_skills")}: ${
|
|
2764
|
+
logger.info(`${t("available_skills")}: ${chalk10.cyan("install-helper install --list")}`);
|
|
2758
2765
|
return;
|
|
2759
2766
|
}
|
|
2760
2767
|
let tool;
|
|
@@ -2826,7 +2833,7 @@ async function installCommand(names, options) {
|
|
|
2826
2833
|
spinner.start();
|
|
2827
2834
|
const repoPath = await repoManager.ensureRepo();
|
|
2828
2835
|
spinner.succeed(t("loading_plugin_data_complete"));
|
|
2829
|
-
logger.info(`${t("skill_install_progress")} ${t("skill_count_format").replace("{count}",
|
|
2836
|
+
logger.info(`${t("skill_install_progress")} ${t("skill_count_format").replace("{count}", chalk10.bold(String(skills.length)))}...`);
|
|
2830
2837
|
const results = await installSkills(skills, tool, level, repoPath);
|
|
2831
2838
|
let successCount = 0;
|
|
2832
2839
|
let failCount = 0;
|
|
@@ -2843,10 +2850,10 @@ async function installCommand(names, options) {
|
|
|
2843
2850
|
}
|
|
2844
2851
|
}
|
|
2845
2852
|
logger.blank();
|
|
2846
|
-
logger.success(`${t("skill_install_done")}: ${
|
|
2853
|
+
logger.success(`${t("skill_install_done")}: ${chalk10.green(t("result_success_format").replace("{count}", String(successCount)))}, ${failCount > 0 ? chalk10.red(t("result_failed_format").replace("{count}", String(failCount))) : chalk10.dim(t("result_failed_format").replace("{count}", String(failCount)))}`);
|
|
2847
2854
|
logger.blank();
|
|
2848
|
-
logger.info(`${t("install_to")}: ${
|
|
2849
|
-
logger.info(`${t("start_to_use").replace("{tool}",
|
|
2855
|
+
logger.info(`${t("install_to")}: ${chalk10.cyan(getConfigRoot(tool, level) + "/skills/")}`);
|
|
2856
|
+
logger.info(`${t("start_to_use").replace("{tool}", chalk10.green(tool))}`);
|
|
2850
2857
|
logger.blank();
|
|
2851
2858
|
}
|
|
2852
2859
|
}
|
|
@@ -2881,7 +2888,7 @@ async function installPlugins(pluginIds, tool, level, repoPath, installPath, yes
|
|
|
2881
2888
|
|
|
2882
2889
|
// src/commands/uninstall.ts
|
|
2883
2890
|
import { existsSync as existsSync13, unlinkSync as unlinkSync5, rmdirSync as rmdirSync2, readdirSync as readdirSync6, lstatSync as lstatSync4 } from "fs";
|
|
2884
|
-
import
|
|
2891
|
+
import chalk11 from "chalk";
|
|
2885
2892
|
async function uninstallCommand(names, options) {
|
|
2886
2893
|
const tool = options.tool ? validateTool(options.tool) : "opencode";
|
|
2887
2894
|
const level = options.level ? validateLevel(options.level) : "project";
|
|
@@ -2981,7 +2988,7 @@ async function uninstallCommand(names, options) {
|
|
|
2981
2988
|
}
|
|
2982
2989
|
}
|
|
2983
2990
|
logger.blank();
|
|
2984
|
-
logger.success(`${t("skill_uninstall_done")}: ${
|
|
2991
|
+
logger.success(`${t("skill_uninstall_done")}: ${chalk11.green(t("result_success_format").replace("{count}", String(successCount)))}, ${failCount > 0 ? chalk11.red(t("result_failed_format").replace("{count}", String(failCount))) : chalk11.dim(t("result_failed_format").replace("{count}", String(failCount)))}`);
|
|
2985
2992
|
logger.blank();
|
|
2986
2993
|
}
|
|
2987
2994
|
}
|
|
@@ -2994,7 +3001,7 @@ function isSymlink3(path) {
|
|
|
2994
3001
|
}
|
|
2995
3002
|
|
|
2996
3003
|
// src/commands/update.ts
|
|
2997
|
-
import
|
|
3004
|
+
import chalk12 from "chalk";
|
|
2998
3005
|
async function updateCommand(pluginNames, options) {
|
|
2999
3006
|
let tool;
|
|
3000
3007
|
if (options.tool) {
|
|
@@ -3012,7 +3019,7 @@ async function updateCommand(pluginNames, options) {
|
|
|
3012
3019
|
pluginsToUpdate = manifests.map((m) => m.team);
|
|
3013
3020
|
if (pluginsToUpdate.length === 0) {
|
|
3014
3021
|
logger.info(t("update_no_plugins"));
|
|
3015
|
-
logger.info(t("update_install_hint").replace("{cmd}",
|
|
3022
|
+
logger.info(t("update_install_hint").replace("{cmd}", chalk12.cyan("install-helper install <plugin>")));
|
|
3016
3023
|
return;
|
|
3017
3024
|
}
|
|
3018
3025
|
} else {
|
|
@@ -3074,42 +3081,42 @@ async function updateCommand(pluginNames, options) {
|
|
|
3074
3081
|
}
|
|
3075
3082
|
|
|
3076
3083
|
// src/commands/info.ts
|
|
3077
|
-
import
|
|
3084
|
+
import chalk13 from "chalk";
|
|
3078
3085
|
import { existsSync as existsSync14, readdirSync as readdirSync7 } from "fs";
|
|
3079
3086
|
import { join as join15 } from "path";
|
|
3080
3087
|
async function infoCommand(pluginName) {
|
|
3081
3088
|
const plugin = findPlugin(pluginName);
|
|
3082
3089
|
if (!plugin) {
|
|
3083
|
-
console.log(
|
|
3090
|
+
console.log(chalk13.red(` ${t("info_not_found")}: ${pluginName}`));
|
|
3084
3091
|
return;
|
|
3085
3092
|
}
|
|
3086
3093
|
const installed = scanInstalled();
|
|
3087
3094
|
const isInstalled = installed.some((p) => p.id === plugin.id);
|
|
3088
|
-
const statusText = isInstalled ?
|
|
3095
|
+
const statusText = isInstalled ? chalk13.green(`\u2713 ${t("status_installed")}`) : chalk13.dim(`\u2014 ${t("status_not_installed")}`);
|
|
3089
3096
|
console.log();
|
|
3090
|
-
console.log(
|
|
3091
|
-
console.log(
|
|
3097
|
+
console.log(chalk13.bold(` ${plugin.displayName}`));
|
|
3098
|
+
console.log(chalk13.dim(" " + "\u2500".repeat(40)));
|
|
3092
3099
|
console.log();
|
|
3093
|
-
console.log(` ${
|
|
3094
|
-
console.log(` ${
|
|
3095
|
-
console.log(` ${
|
|
3096
|
-
console.log(` ${
|
|
3097
|
-
console.log(` ${
|
|
3098
|
-
console.log(` ${
|
|
3100
|
+
console.log(` ${chalk13.dim(t("info_description") + ":")} ${plugin.description}`);
|
|
3101
|
+
console.log(` ${chalk13.dim("ID:")} ${plugin.id}`);
|
|
3102
|
+
console.log(` ${chalk13.dim(t("info_status") + ":")} ${statusText}`);
|
|
3103
|
+
console.log(` ${chalk13.dim(t("info_skills") + ":")} ${plugin.skills}`);
|
|
3104
|
+
console.log(` ${chalk13.dim(t("info_agents") + ":")} ${plugin.agents}`);
|
|
3105
|
+
console.log(` ${chalk13.dim(t("info_aliases") + ":")} ${plugin.aliases.join(", ")}`);
|
|
3099
3106
|
console.log();
|
|
3100
3107
|
try {
|
|
3101
3108
|
const repoManager = createRepositoryManager();
|
|
3102
3109
|
const repoPath = await repoManager.ensureRepo();
|
|
3103
3110
|
const quickstartPath = join15(repoPath, plugin.dir, "quickstart.md");
|
|
3104
3111
|
if (existsSync14(quickstartPath)) {
|
|
3105
|
-
console.log(` ${
|
|
3112
|
+
console.log(` ${chalk13.dim(t("info_quickstart") + ":")} ${quickstartPath}`);
|
|
3106
3113
|
}
|
|
3107
3114
|
const agentsDir = join15(repoPath, plugin.dir, "agents");
|
|
3108
3115
|
if (existsSync14(agentsDir)) {
|
|
3109
3116
|
const agentFiles = readdirSync7(agentsDir).filter((f) => f.endsWith(".md"));
|
|
3110
3117
|
if (agentFiles.length > 0) {
|
|
3111
3118
|
console.log();
|
|
3112
|
-
console.log(` ${
|
|
3119
|
+
console.log(` ${chalk13.bold("Agents:")}`);
|
|
3113
3120
|
for (const agent of agentFiles) {
|
|
3114
3121
|
console.log(` \u2022 ${agent.replace(".md", "")}`);
|
|
3115
3122
|
}
|
|
@@ -3121,39 +3128,39 @@ async function infoCommand(pluginName) {
|
|
|
3121
3128
|
}
|
|
3122
3129
|
|
|
3123
3130
|
// src/commands/lang.ts
|
|
3124
|
-
import
|
|
3131
|
+
import chalk14 from "chalk";
|
|
3125
3132
|
async function langCommand(action, value) {
|
|
3126
3133
|
const config = readConfig();
|
|
3127
3134
|
if (!action || action === "show") {
|
|
3128
3135
|
console.log();
|
|
3129
|
-
console.log(
|
|
3130
|
-
console.log(
|
|
3136
|
+
console.log(chalk14.bold(` ${t("lang_title")}`));
|
|
3137
|
+
console.log(chalk14.dim(" " + "\u2500".repeat(40)));
|
|
3131
3138
|
console.log();
|
|
3132
|
-
console.log(` ${
|
|
3139
|
+
console.log(` ${chalk14.dim(t("lang_current") + ":")} ${config.language}`);
|
|
3133
3140
|
console.log();
|
|
3134
|
-
console.log(
|
|
3135
|
-
console.log(
|
|
3141
|
+
console.log(chalk14.dim(` ${t("lang_supported")}`));
|
|
3142
|
+
console.log(chalk14.dim(` ${t("lang_usage")}`));
|
|
3136
3143
|
console.log();
|
|
3137
3144
|
return;
|
|
3138
3145
|
}
|
|
3139
3146
|
if (action === "set") {
|
|
3140
3147
|
if (!value) {
|
|
3141
|
-
console.log(
|
|
3148
|
+
console.log(chalk14.red(` ${t("lang_specify")}`));
|
|
3142
3149
|
return;
|
|
3143
3150
|
}
|
|
3144
3151
|
if (value !== "zh_CN" && value !== "en_US") {
|
|
3145
|
-
console.log(
|
|
3152
|
+
console.log(chalk14.red(` ${t("lang_invalid")}`));
|
|
3146
3153
|
return;
|
|
3147
3154
|
}
|
|
3148
3155
|
updateConfig({ language: value });
|
|
3149
3156
|
setLanguage(value);
|
|
3150
3157
|
console.log();
|
|
3151
|
-
console.log(
|
|
3158
|
+
console.log(chalk14.green(` \u2713 ${t("lang_set")} ${value}`));
|
|
3152
3159
|
console.log();
|
|
3153
3160
|
return;
|
|
3154
3161
|
}
|
|
3155
|
-
console.log(
|
|
3156
|
-
console.log(
|
|
3162
|
+
console.log(chalk14.red(` ${t("lang_unknown_action")}: ${action}`));
|
|
3163
|
+
console.log(chalk14.dim(` ${t("lang_supported_actions")}`));
|
|
3157
3164
|
}
|
|
3158
3165
|
|
|
3159
3166
|
// src/cli.ts
|
|
@@ -3163,7 +3170,7 @@ function createCLI() {
|
|
|
3163
3170
|
setLanguage(config.language);
|
|
3164
3171
|
}
|
|
3165
3172
|
const program2 = new Command();
|
|
3166
|
-
program2.name("install-helper").description("CANNBot Install Helper - Interactive installer for CANN operator development skills").version("0.0.2-beta.
|
|
3173
|
+
program2.name("install-helper").description("CANNBot Install Helper - Interactive installer for CANN operator development skills").version("0.0.2-beta.25");
|
|
3167
3174
|
program2.command("init", { isDefault: false }).description("Run interactive installation wizard").action(async () => {
|
|
3168
3175
|
await initCommand();
|
|
3169
3176
|
});
|