@cannbot-ai/install-helper 1.1.2 → 1.1.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/README.md CHANGED
@@ -15,7 +15,7 @@ curl -fsSL https://raw.gitcode.com/cann/cannbot-skills/raw/master/install.sh | b
15
15
  ### Windows
16
16
 
17
17
  ```powershell
18
- irm https://cdn.jsdelivr.net/npm/@cannbot-ai/install-helper@latest/dist/install.ps1 | iex
18
+ iwr -useb https://raw.gitcode.com/cann/cannbot-skills/raw/master/install.ps1 | iex
19
19
  ```
20
20
 
21
21
  ### npm(全平台,需要 Node.js 18+)
package/dist/index.js CHANGED
@@ -595,8 +595,8 @@ var embedded_plugins_default = [
595
595
  "direct",
596
596
  "kernel"
597
597
  ],
598
- skills: 16,
599
- agents: 3,
598
+ skills: 19,
599
+ agents: 4,
600
600
  description: "Ascend C \u76F4\u8C03\u5168\u6D41\u7A0B\uFF1A\u73AF\u5883\u2192\u8BBE\u8BA1\u2192\u5F00\u53D1\u2192\u5BA1\u67E5\u2192\u6027\u80FD\u9A8C\u6536",
601
601
  version: "1.2.2",
602
602
  configFile: "AGENTS.md",
@@ -655,7 +655,7 @@ var embedded_plugins_default = [
655
655
  "flash",
656
656
  "kernel-flash"
657
657
  ],
658
- skills: 1,
658
+ skills: 7,
659
659
  agents: 1,
660
660
  description: "\u4ECE\u6570\u5B66\u516C\u5F0F\u6216\u4EE3\u7801\u7247\u6BB5\u5FEB\u901F\u6784\u5EFA\u5E76\u9A8C\u8BC1 Ascend NPU \u6838\u51FD\u6570",
661
661
  version: "1.2.2",
@@ -699,8 +699,8 @@ var embedded_plugins_default = [
699
699
  "ascendc-registry",
700
700
  "registry"
701
701
  ],
702
- skills: 12,
703
- agents: 4,
702
+ skills: 26,
703
+ agents: 3,
704
704
  description: "\u751F\u4EA7\u7EA7 ACLNN \u6CE8\u518C\u7B97\u5B50\u5168\u6D41\u7A0B\uFF1A\u4EE3\u7801\u2192UT/ST\u2192\u4E0A\u5E93",
705
705
  version: "1.2.2",
706
706
  configFile: "AGENTS.md",
@@ -772,7 +772,7 @@ var embedded_plugins_default = [
772
772
  aliases: [
773
773
  "catlass"
774
774
  ],
775
- skills: 10,
775
+ skills: 14,
776
776
  agents: 3,
777
777
  description: "Catlass \u6A21\u677F\u62FC\u88C5 GEMM/Matmul/Epilogue \u7B97\u5B50\u5F00\u53D1",
778
778
  version: "1.2.2",
@@ -822,7 +822,7 @@ var embedded_plugins_default = [
822
822
  "infer",
823
823
  "inference"
824
824
  ],
825
- skills: 11,
825
+ skills: 12,
826
826
  agents: 3,
827
827
  description: "NPU \u6A21\u578B\u63A8\u7406\u7AEF\u5230\u7AEF\u4F18\u5316\uFF08\u5E76\u884C/KVCache/\u878D\u5408/\u91CF\u5316/\u56FE\u6A21\u5F0F/\u591A\u6D41/SuperKernel\uFF09",
828
828
  version: "1.2.2",
@@ -958,7 +958,7 @@ var embedded_plugins_default = [
958
958
  "triton"
959
959
  ],
960
960
  skills: 6,
961
- agents: 1,
961
+ agents: 0,
962
962
  description: "Triton-Ascend \u7B97\u5B50 6 \u9636\u6BB5\u81EA\u52A8\u751F\u6210\u4E0E\u4F18\u5316\uFF08\u63CF\u8FF0\u2192\u4EE3\u7801\u2192\u9A8C\u8BC1\u2192\u4F18\u5316\uFF09",
963
963
  version: "1.2.2",
964
964
  configFile: "AGENTS.md",
@@ -1022,7 +1022,7 @@ var embedded_plugins_default = [
1022
1022
  "review"
1023
1023
  ],
1024
1024
  skills: 5,
1025
- agents: 1,
1025
+ agents: 2,
1026
1026
  description: "Ascend C \u7B97\u5B50\u4EE3\u7801 4 \u9636\u6BB5\u5168\u91CF\u68C0\u89C6\uFF08\u4E3B Agent \u7F16\u6392 + \u5B50 Agent \u5E76\u884C\u68C0\u89C6\uFF09",
1027
1027
  version: "1.2.2",
1028
1028
  configFile: "AGENTS.md",
@@ -1473,13 +1473,9 @@ function verifyPluginFilesExist(configRoot, manifest, tool, level) {
1473
1473
  });
1474
1474
  if (!hasAnyAgent) return false;
1475
1475
  }
1476
- let agentsMdPath;
1477
- if (tool === "opencode" && level === "project") {
1478
- agentsMdPath = join5(configRoot, "..", "AGENTS.md");
1479
- } else {
1480
- agentsMdPath = join5(configRoot, "AGENTS.md");
1481
- }
1482
- if (!existsSync5(agentsMdPath)) return false;
1476
+ const agentsFileName = getAgentsFileName(tool);
1477
+ const configFilePath = level === "project" ? join5(configRoot, "..", agentsFileName) : join5(configRoot, agentsFileName);
1478
+ if (!existsSync5(configFilePath)) return false;
1483
1479
  return true;
1484
1480
  }
1485
1481
 
@@ -2708,12 +2704,24 @@ async function showRestorePrompt(backups) {
2708
2704
  }
2709
2705
 
2710
2706
  // src/core/plugin-installer.ts
2711
- import { existsSync as existsSync12, mkdirSync as mkdirSync5, symlinkSync, unlinkSync as unlinkSync4, realpathSync, copyFileSync as copyFileSync2, cpSync, writeFileSync as writeFileSync2, rmSync } from "fs";
2707
+ import { existsSync as existsSync12, mkdirSync as mkdirSync5, symlinkSync, unlinkSync as unlinkSync4, realpathSync, readlinkSync, copyFileSync as copyFileSync2, cpSync, writeFileSync as writeFileSync2, rmSync } from "fs";
2712
2708
  import { join as join11, basename } from "path";
2713
2709
  import { execa as execa3 } from "execa";
2714
2710
  function installLink(source, target) {
2715
2711
  try {
2716
2712
  const resolved = realpathSync(source);
2713
+ if (isSymlink(target)) {
2714
+ try {
2715
+ const currentTarget = readlinkSync(target);
2716
+ const normCurrent = currentTarget.replace(/\\/g, "/").toLowerCase();
2717
+ const normSource = resolved.replace(/\\/g, "/").toLowerCase();
2718
+ if (normCurrent === normSource) {
2719
+ return "skipped";
2720
+ }
2721
+ } catch {
2722
+ return "skipped";
2723
+ }
2724
+ }
2717
2725
  if (existsSync12(target) || isSymlink(target)) {
2718
2726
  unlinkSync4(target);
2719
2727
  }
@@ -2869,7 +2877,7 @@ function writeCannbotManifest(configRoot, pluginId, version, level, tool, skills
2869
2877
  brand_dir: configRoot,
2870
2878
  install_time: (/* @__PURE__ */ new Date()).toISOString()
2871
2879
  };
2872
- const manifestPath = join11(configRoot, "cannbot-manifest.json");
2880
+ const manifestPath = join11(configRoot, `${pluginId}-manifest.json`);
2873
2881
  writeFileSync2(manifestPath, JSON.stringify(manifest, null, 2), "utf-8");
2874
2882
  return manifest;
2875
2883
  }
@@ -3003,6 +3011,8 @@ async function installPlugin(opts) {
3003
3011
  warnings: []
3004
3012
  };
3005
3013
  }
3014
+ }
3015
+ if (currentPlugin) {
3006
3016
  backupInfo = createBackup(
3007
3017
  configRoot,
3008
3018
  opts.tool,
@@ -3163,8 +3173,8 @@ async function installPlugin(opts) {
3163
3173
  }
3164
3174
 
3165
3175
  // src/core/skill-installer.ts
3166
- import { existsSync as existsSync14, mkdirSync as mkdirSync6, symlinkSync as symlinkSync2, unlinkSync as unlinkSync5, readdirSync as readdirSync4, rmdirSync, realpathSync as realpathSync2 } from "fs";
3167
- import { join as join13, dirname as dirname6 } from "path";
3176
+ import { existsSync as existsSync14, mkdirSync as mkdirSync6, symlinkSync as symlinkSync2, unlinkSync as unlinkSync5, readdirSync as readdirSync4, rmSync as rmSync2, realpathSync as realpathSync2, readlinkSync as readlinkSync2 } from "fs";
3177
+ import { join as join13, dirname as dirname6, isAbsolute } from "path";
3168
3178
  import { select as select3, checkbox, Separator as Separator2 } from "@inquirer/prompts";
3169
3179
  import chalk5 from "chalk";
3170
3180
  import Table from "cli-table3";
@@ -3191,6 +3201,22 @@ async function installSkills(skillIds, tool, level, repoPath) {
3191
3201
  }
3192
3202
  try {
3193
3203
  const resolvedSource = realpathSync2(sourcePath);
3204
+ if (isSymlink(targetPath)) {
3205
+ try {
3206
+ const currentTarget = readlinkSync2(targetPath);
3207
+ const normCurrent = currentTarget.replace(/\\/g, "/").toLowerCase();
3208
+ const normSource = resolvedSource.replace(/\\/g, "/").toLowerCase();
3209
+ if (normCurrent === normSource) {
3210
+ results.push({ skillId, success: true });
3211
+ installedIds.push(skillId);
3212
+ continue;
3213
+ }
3214
+ } catch {
3215
+ results.push({ skillId, success: true });
3216
+ installedIds.push(skillId);
3217
+ continue;
3218
+ }
3219
+ }
3194
3220
  if (existsSync14(targetPath) || isSymlink(targetPath)) {
3195
3221
  unlinkSync5(targetPath);
3196
3222
  }
@@ -3239,7 +3265,7 @@ async function uninstallSkills(skillIds, tool, level) {
3239
3265
  try {
3240
3266
  const entries = readdirSync4(skillsDir);
3241
3267
  if (entries.length === 0) {
3242
- rmdirSync(skillsDir);
3268
+ rmSync2(skillsDir, { recursive: true });
3243
3269
  logger.step(` ${t("uninstall_clean_empty_dir")}: skills/`);
3244
3270
  }
3245
3271
  } catch {
@@ -3418,7 +3444,7 @@ function listAllSkills() {
3418
3444
  }
3419
3445
  function resolveSkillSourcePath(skill, repoPath) {
3420
3446
  if (skill.filePath) {
3421
- const absPath = skill.filePath.startsWith("/") ? skill.filePath : join13(repoPath, skill.filePath);
3447
+ const absPath = isAbsolute(skill.filePath) ? skill.filePath : join13(repoPath, skill.filePath);
3422
3448
  if (existsSync14(absPath)) {
3423
3449
  return dirname6(absPath);
3424
3450
  }
@@ -4232,7 +4258,7 @@ async function installPlugins(pluginIds, tool, level, repoPath, installPath, yes
4232
4258
  }
4233
4259
 
4234
4260
  // src/commands/uninstall.ts
4235
- import { existsSync as existsSync17, unlinkSync as unlinkSync7, rmdirSync as rmdirSync2, readdirSync as readdirSync6 } from "fs";
4261
+ import { existsSync as existsSync17, unlinkSync as unlinkSync7, rmdirSync, readdirSync as readdirSync6 } from "fs";
4236
4262
  import { resolve, basename as basename3, sep } from "path";
4237
4263
  import chalk11 from "chalk";
4238
4264
  async function uninstallCommand(names, options) {
@@ -4292,7 +4318,7 @@ async function uninstallCommand(names, options) {
4292
4318
  if (existsSync17(dirPath)) {
4293
4319
  const entries = readdirSync6(dirPath);
4294
4320
  if (entries.length === 0) {
4295
- rmdirSync2(dirPath);
4321
+ rmdirSync(dirPath);
4296
4322
  const name = basename3(dirPath);
4297
4323
  logger.step(` ${t("uninstall_clean_empty_dir")}: ${name}/`);
4298
4324
  removedDirs++;