@cannbot-ai/install-helper 0.0.1-beta.1 → 0.0.1-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 +52 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -929,7 +929,7 @@ async function stepConfirm(tool, level, plugins) {
|
|
|
929
929
|
printBoxTitle("\u786E\u8BA4\u5B89\u88C5");
|
|
930
930
|
const allPlugins = getAllPlugins();
|
|
931
931
|
const selectedPlugins = plugins.map((id) => allPlugins.find((p) => p.id === id));
|
|
932
|
-
const displayPath =
|
|
932
|
+
const displayPath = getConfigRoot(tool, level);
|
|
933
933
|
logger.info(`\u5373\u5C06\u5B89\u88C5 ${chalk2.bold(plugins.length)} \u4E2A\u573A\u666F\u5230 ${chalk2.cyan(displayPath)}\uFF1A`);
|
|
934
934
|
for (const plugin of selectedPlugins) {
|
|
935
935
|
if (plugin) {
|
|
@@ -968,8 +968,16 @@ var EXCLUDE_DIRS = /* @__PURE__ */ new Set([
|
|
|
968
968
|
".agents",
|
|
969
969
|
".opencode",
|
|
970
970
|
".claude",
|
|
971
|
+
".claude-plugin",
|
|
971
972
|
"dist",
|
|
972
|
-
"build"
|
|
973
|
+
"build",
|
|
974
|
+
"references",
|
|
975
|
+
"hooks",
|
|
976
|
+
"operators",
|
|
977
|
+
"workflows",
|
|
978
|
+
"tests",
|
|
979
|
+
"docs",
|
|
980
|
+
"scripts"
|
|
973
981
|
]);
|
|
974
982
|
var SKILL_SCAN_DIRS = [
|
|
975
983
|
"ops",
|
|
@@ -1044,6 +1052,17 @@ function getCurrentCommit(repoPath) {
|
|
|
1044
1052
|
if (existsSync5(refPath)) {
|
|
1045
1053
|
return readFileSync3(refPath, "utf-8").trim();
|
|
1046
1054
|
}
|
|
1055
|
+
const packedRefsPath = join5(repoPath, ".git", "packed-refs");
|
|
1056
|
+
if (existsSync5(packedRefsPath)) {
|
|
1057
|
+
const packedRefs = readFileSync3(packedRefsPath, "utf-8");
|
|
1058
|
+
const refName = headContent.slice(5);
|
|
1059
|
+
const lines = packedRefs.split("\n");
|
|
1060
|
+
for (const line of lines) {
|
|
1061
|
+
if (line.endsWith(refName)) {
|
|
1062
|
+
return line.split(" ")[0];
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1047
1066
|
}
|
|
1048
1067
|
return headContent;
|
|
1049
1068
|
} catch {
|
|
@@ -1080,6 +1099,20 @@ function getCachePath() {
|
|
|
1080
1099
|
return join5(homeDir, ".cannbot", "scan-cache.json");
|
|
1081
1100
|
}
|
|
1082
1101
|
function scanDirectory(dirPath, repoPath, sourcePrefix, skills, seen) {
|
|
1102
|
+
const selfSkillMd = join5(dirPath, "SKILL.md");
|
|
1103
|
+
if (existsSync5(selfSkillMd)) {
|
|
1104
|
+
const frontmatter = parseFrontmatter(selfSkillMd);
|
|
1105
|
+
if (frontmatter && !seen.has(frontmatter.name)) {
|
|
1106
|
+
seen.add(frontmatter.name);
|
|
1107
|
+
skills.push({
|
|
1108
|
+
id: frontmatter.name,
|
|
1109
|
+
description: frontmatter.description,
|
|
1110
|
+
source: sourcePrefix,
|
|
1111
|
+
filePath: selfSkillMd
|
|
1112
|
+
});
|
|
1113
|
+
}
|
|
1114
|
+
return;
|
|
1115
|
+
}
|
|
1083
1116
|
for (const entry of safeReaddir(dirPath)) {
|
|
1084
1117
|
const fullPath = join5(dirPath, entry);
|
|
1085
1118
|
if (EXCLUDE_DIRS.has(entry)) continue;
|
|
@@ -1215,7 +1248,7 @@ var STATIC_SKILL_CATEGORIES = [
|
|
|
1215
1248
|
{ id: "cuda2ascend-simt", description: "CUDA \u8FC1\u79FB\u5230 Ascend C SIMT", source: "ops-lab" },
|
|
1216
1249
|
{ id: "ops-direct-invoke-flash", description: "\u4ECE\u96F6\u6784\u5EFA Ascend C \u6838\u51FD\u6570", source: "plugins-official/ops-direct-invoke-flash/skills" },
|
|
1217
1250
|
{ id: "ops-registry-invoke-workflow", description: "\u6CE8\u518C\u8C03\u7528\u5DE5\u4F5C\u6D41", source: "plugins-official/ops-registry-invoke" },
|
|
1218
|
-
{ id: "ops-easyasc-dsl", description: "EasyASC DSL \u7B97\u5B50\u5F00\u53D1", source: "plugins-community/ops-easyasc-dsl" }
|
|
1251
|
+
{ id: "ops-easyasc-dsl", description: "EasyASC DSL \u7B97\u5B50\u5F00\u53D1", source: "plugins-community/ops-easyasc-dsl/skill" }
|
|
1219
1252
|
]
|
|
1220
1253
|
},
|
|
1221
1254
|
{
|
|
@@ -1820,10 +1853,10 @@ async function interactiveSkillSelect() {
|
|
|
1820
1853
|
const tools = ["opencode", "claude", "trae", "cursor", "copilot"];
|
|
1821
1854
|
const levels = ["project", "global"];
|
|
1822
1855
|
const installedSkills = [];
|
|
1823
|
-
for (const
|
|
1856
|
+
for (const tk of tools) {
|
|
1824
1857
|
for (const l of levels) {
|
|
1825
|
-
const path = l === "project" ? process.cwd() : getConfigRoot(
|
|
1826
|
-
installedSkills.push(...getInstalledSkills(
|
|
1858
|
+
const path = l === "project" ? process.cwd() : getConfigRoot(tk, l);
|
|
1859
|
+
installedSkills.push(...getInstalledSkills(tk, l, path));
|
|
1827
1860
|
}
|
|
1828
1861
|
}
|
|
1829
1862
|
const installedSet = new Set(installedSkills);
|
|
@@ -2402,6 +2435,15 @@ async function installCommand(names, options) {
|
|
|
2402
2435
|
return;
|
|
2403
2436
|
}
|
|
2404
2437
|
if (names.length === 0) {
|
|
2438
|
+
const scanSpinner2 = createSpinner("\u6B63\u5728\u52A0\u8F7D Skills \u5217\u8868...");
|
|
2439
|
+
scanSpinner2.start();
|
|
2440
|
+
try {
|
|
2441
|
+
const scanRepoManager = createRepositoryManager();
|
|
2442
|
+
await scanRepoManager.ensureRepoAndScan();
|
|
2443
|
+
scanSpinner2.succeed("Skills \u5217\u8868\u52A0\u8F7D\u5B8C\u6210");
|
|
2444
|
+
} catch {
|
|
2445
|
+
scanSpinner2.warn("Skills \u5217\u8868\u52A0\u8F7D\u5931\u8D25\uFF0C\u5C06\u4F7F\u7528\u5185\u7F6E\u6570\u636E");
|
|
2446
|
+
}
|
|
2405
2447
|
let tool2;
|
|
2406
2448
|
if (options.tool) {
|
|
2407
2449
|
tool2 = options.tool;
|
|
@@ -2432,7 +2474,8 @@ async function installCommand(names, options) {
|
|
|
2432
2474
|
const repoPath = await repoManager.ensureRepo();
|
|
2433
2475
|
spinner.succeed(t("install_repo_ready"));
|
|
2434
2476
|
logger.info(`${t("skill_install_progress")} ${chalk8.bold(names.length)} \u4E2A Skills...`);
|
|
2435
|
-
const
|
|
2477
|
+
const level2 = options.level || "project";
|
|
2478
|
+
const results = await installSkills(names, tool2, level2, repoPath);
|
|
2436
2479
|
let successCount = 0;
|
|
2437
2480
|
let failCount = 0;
|
|
2438
2481
|
for (const result of results) {
|
|
@@ -2444,7 +2487,7 @@ async function installCommand(names, options) {
|
|
|
2444
2487
|
failCount++;
|
|
2445
2488
|
}
|
|
2446
2489
|
}
|
|
2447
|
-
const configRoot = getConfigRoot(tool2,
|
|
2490
|
+
const configRoot = getConfigRoot(tool2, level2);
|
|
2448
2491
|
logger.blank();
|
|
2449
2492
|
logger.success(`${t("skill_install_done")}: ${chalk8.green(successCount + " \u6210\u529F")}, ${failCount > 0 ? chalk8.red(failCount + " \u5931\u8D25") : chalk8.dim(failCount + " \u5931\u8D25")}`);
|
|
2450
2493
|
logger.blank();
|
|
@@ -2865,7 +2908,7 @@ function createCLI() {
|
|
|
2865
2908
|
setLanguage(config.language);
|
|
2866
2909
|
}
|
|
2867
2910
|
const program2 = new Command();
|
|
2868
|
-
program2.name("install-helper").description("Install Helper - Interactive installer for CANN operator development skills").version("0.0.1-beta.
|
|
2911
|
+
program2.name("install-helper").description("Install Helper - Interactive installer for CANN operator development skills").version("0.0.1-beta.2");
|
|
2869
2912
|
program2.command("init", { isDefault: false }).description("Run interactive installation wizard").action(async () => {
|
|
2870
2913
|
await initCommand();
|
|
2871
2914
|
});
|