@cannbot-ai/install-helper 0.0.2-beta.49 → 0.0.2-beta.50

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
@@ -12,7 +12,7 @@
12
12
  curl -fsSL https://raw.gitcode.com/cann/cannbot-skills/raw/master/install.sh | bash
13
13
 
14
14
  # Windows PowerShell 一键安装(零依赖)
15
- irm https://cdn.jsdelivr.net/npm/@cannbot-ai/install-helper@beta/dist/install.ps1 | iex
15
+ irm https://cdn.jsdelivr.net/npm/@cannbot-ai/install-helper@latest/dist/install.ps1 | iex
16
16
 
17
17
  # 或通过 npm 全局安装(需要 Node.js 18+)
18
18
  npm install -g @cannbot-ai/install-helper
@@ -271,7 +271,7 @@ install-helper 是一个编排工具:
271
271
  3. **缓存扫描结果**到 `~/.cannbot/scan-cache.json`(24 小时有效)
272
272
  4. **克隆或更新** cannbot-skills 仓库(缓存到 `~/.cannbot/repo/`)
273
273
  5. **备份现有配置**(如果检测到已安装的 AGENTS.md)
274
- 6. **声明式安装**:优先读取插件的 `plugin-manifest.json`,通过 Node.js 原生引擎执行安装(创建 symlink、克隆外部仓库、写 manifest),无需 bash/sh;无 manifest 时 fallback 到 `init.sh` 脚本
274
+ 6. **声明式安装**:从 `plugins.d/*.yml` 读取安装清单(installSkills/installAgents/configFile/externalRepos),通过 Node.js 原生引擎执行安装(创建 symlink、克隆外部仓库、写 manifest),无需 bash/sh;无安装清单时 fallback 到 `init.sh` 脚本
275
275
  7. **追踪**安装状态(`~/.cannbot/config.yaml` + manifest)
276
276
 
277
277
  安装逻辑优先由 manifest 引擎(Node.js 原生,跨平台)负责,install-helper 提供统一的交互式入口和状态管理。
@@ -1,3 +1,13 @@
1
+ // ----------------------------------------------------------------------------------------------------------
2
+ // Copyright (c) 2026 Huawei Technologies Co., Ltd.
3
+ // This program is free software, you can redistribute it and/or modify it under the terms and conditions of
4
+ // CANN Open Software License Agreement Version 2.0 (the "License").
5
+ // Please refer to the License for details. You may not use this file except in compliance with the License.
6
+ // THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
7
+ // INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8
+ // See LICENSE in the root of the software repository for the full text of the License.
9
+ // ----------------------------------------------------------------------------------------------------------
10
+
1
11
  #!/usr/bin/env node
2
12
 
3
13
  const { spawn } = require("child_process");
package/dist/index.js CHANGED
@@ -586,6 +586,7 @@ var embedded_plugins_default = [
586
586
  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",
587
587
  version: "1.2.2",
588
588
  configFile: "AGENTS.md",
589
+ configRootConfigLink: false,
589
590
  installSkills: [
590
591
  {
591
592
  dir: "ops",
@@ -626,7 +627,8 @@ var embedded_plugins_default = [
626
627
  externalRepos: [
627
628
  {
628
629
  url: "https://gitcode.com/cann/asc-devkit.git",
629
- dir: "plugins-official/ops-direct-invoke/asc-devkit"
630
+ dir: "plugins-official/ops-direct-invoke/asc-devkit",
631
+ configRootLink: false
630
632
  }
631
633
  ]
632
634
  },
@@ -644,6 +646,7 @@ var embedded_plugins_default = [
644
646
  description: "\u4ECE\u6570\u5B66\u516C\u5F0F\u6216\u4EE3\u7801\u7247\u6BB5\u5FEB\u901F\u6784\u5EFA\u5E76\u9A8C\u8BC1 Ascend NPU \u6838\u51FD\u6570",
645
647
  version: "1.2.2",
646
648
  configFile: "AGENTS.md",
649
+ configRootConfigLink: true,
647
650
  installSkills: [
648
651
  {
649
652
  dir: "plugins-official/ops-direct-invoke-flash/skills",
@@ -687,6 +690,7 @@ var embedded_plugins_default = [
687
690
  description: "\u751F\u4EA7\u7EA7 ACLNN \u6CE8\u518C\u7B97\u5B50\u5168\u6D41\u7A0B\uFF1A\u4EE3\u7801\u2192UT/ST\u2192\u4E0A\u5E93",
688
691
  version: "1.2.2",
689
692
  configFile: "AGENTS.md",
693
+ configRootConfigLink: false,
690
694
  installSkills: [
691
695
  {
692
696
  dir: "ops",
@@ -741,7 +745,8 @@ var embedded_plugins_default = [
741
745
  externalRepos: [
742
746
  {
743
747
  url: "https://gitcode.com/cann/asc-devkit.git",
744
- dir: "plugins-official/ops-registry-invoke/asc-devkit"
748
+ dir: "plugins-official/ops-registry-invoke/asc-devkit",
749
+ configRootLink: false
745
750
  }
746
751
  ]
747
752
  },
@@ -758,6 +763,7 @@ var embedded_plugins_default = [
758
763
  description: "Catlass \u6A21\u677F\u62FC\u88C5 GEMM/Matmul/Epilogue \u7B97\u5B50\u5F00\u53D1",
759
764
  version: "1.2.2",
760
765
  configFile: "AGENTS.md",
766
+ configRootConfigLink: true,
761
767
  installSkills: [
762
768
  {
763
769
  dir: "ops",
@@ -787,7 +793,8 @@ var embedded_plugins_default = [
787
793
  externalRepos: [
788
794
  {
789
795
  url: "https://gitcode.com/cann/asc-devkit.git",
790
- dir: "plugins-official/catlass-op-generator/asc-devkit"
796
+ dir: "plugins-official/catlass-op-generator/asc-devkit",
797
+ configRootLink: false
791
798
  }
792
799
  ]
793
800
  },
@@ -806,6 +813,7 @@ var embedded_plugins_default = [
806
813
  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",
807
814
  version: "1.2.2",
808
815
  configFile: "AGENTS.md",
816
+ configRootConfigLink: true,
809
817
  installSkills: [
810
818
  {
811
819
  dir: "model",
@@ -834,7 +842,8 @@ var embedded_plugins_default = [
834
842
  {
835
843
  url: "https://gitcode.com/cann/cann-recipes-infer.git",
836
844
  dir: "plugins-official/model-infer-optimize/cann-recipes-infer",
837
- depth: 1
845
+ depth: 1,
846
+ configRootLink: true
838
847
  }
839
848
  ]
840
849
  },
@@ -852,6 +861,7 @@ var embedded_plugins_default = [
852
861
  description: "PyPTO Python API \u7B97\u5B50\u5168\u6D41\u7A0B\u5F00\u53D1\uFF0C\u8986\u76D6\u9700\u6C42\u7406\u89E3\u3001API \u63A2\u7D22\u3001\u5B9E\u73B0\u4E0E\u8C03\u4F18",
853
862
  version: "1.2.2",
854
863
  configFile: "AGENTS.md",
864
+ configRootConfigLink: false,
855
865
  installSkills: [
856
866
  {
857
867
  dir: "ops",
@@ -875,7 +885,8 @@ var embedded_plugins_default = [
875
885
  externalRepos: [
876
886
  {
877
887
  url: "https://gitcode.com/cann/pypto.git",
878
- dir: "plugins-official/pypto-op-orchestrator/pypto"
888
+ dir: "plugins-official/pypto-op-orchestrator/pypto",
889
+ configRootLink: false
879
890
  }
880
891
  ]
881
892
  },
@@ -892,6 +903,7 @@ var embedded_plugins_default = [
892
903
  description: "TileLang Python DSL + @tilelang.jit \u7B97\u5B50\u5F00\u53D1\uFF08\u652F\u6301 Developer/Expert \u53CC\u6A21\u5F0F\uFF09",
893
904
  version: "1.2.2",
894
905
  configFile: "AGENTS.md",
906
+ configRootConfigLink: false,
895
907
  installSkills: [
896
908
  {
897
909
  dir: "ops",
@@ -918,7 +930,8 @@ var embedded_plugins_default = [
918
930
  url: "https://github.com/tile-ai/tilelang-ascend.git",
919
931
  dir: "plugins-official/tilelang-op-orchestrator/tilelang-ascend",
920
932
  depth: 1,
921
- recursive: true
933
+ recursive: true,
934
+ configRootLink: false
922
935
  }
923
936
  ]
924
937
  },
@@ -935,6 +948,7 @@ var embedded_plugins_default = [
935
948
  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",
936
949
  version: "1.2.2",
937
950
  configFile: "AGENTS.md",
951
+ configRootConfigLink: false,
938
952
  installSkills: [
939
953
  {
940
954
  dir: "ops",
@@ -965,6 +979,7 @@ var embedded_plugins_default = [
965
979
  description: "NPU \u56FE\u6A21\u5F0F npugraph_ex \u914D\u7F6E\u3001\u811A\u672C\u8FC1\u79FB\u3001\u7F16\u8BD1\u8BCA\u65AD\u4E0E\u81EA\u5B9A\u4E49\u7B97\u5B50\u5165\u56FE",
966
980
  version: "1.2.2",
967
981
  configFile: "AGENTS.md",
982
+ configRootConfigLink: true,
968
983
  installSkills: [
969
984
  {
970
985
  dir: "graph",
@@ -997,6 +1012,7 @@ var embedded_plugins_default = [
997
1012
  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",
998
1013
  version: "1.2.2",
999
1014
  configFile: "AGENTS.md",
1015
+ configRootConfigLink: false,
1000
1016
  installSkills: [
1001
1017
  {
1002
1018
  dir: "ops",
@@ -1056,6 +1072,7 @@ function loadPluginsFromYaml() {
1056
1072
  description: content.description || "",
1057
1073
  version: content.version,
1058
1074
  configFile: content.configFile,
1075
+ configRootConfigLink: content.configRootConfigLink,
1059
1076
  installSkills: content.installSkills,
1060
1077
  installAgents: content.installAgents,
1061
1078
  externalRepos: content.externalRepos
@@ -2706,7 +2723,7 @@ function installLink(source, target) {
2706
2723
  return "failed";
2707
2724
  }
2708
2725
  }
2709
- function installConfigFile(pluginDir, configFile, tool, level, configRoot, installPath) {
2726
+ function installConfigFile(pluginDir, configFile, tool, level, configRoot, installPath, configRootConfigLink) {
2710
2727
  const sourcePath = join11(pluginDir, configFile);
2711
2728
  if (!existsSync12(sourcePath)) return;
2712
2729
  const agentsFileName = getAgentsFileName(tool);
@@ -2730,6 +2747,7 @@ function installConfigFile(pluginDir, configFile, tool, level, configRoot, insta
2730
2747
  }
2731
2748
  }
2732
2749
  if (isProjectLevel && primaryTarget !== join11(configRoot, agentsFileName)) {
2750
+ if (configRootConfigLink === false) return;
2733
2751
  const configRootTarget = join11(configRoot, agentsFileName);
2734
2752
  if (existsSync12(configRootTarget) || isSymlink(configRootTarget)) {
2735
2753
  unlinkSync4(configRootTarget);
@@ -2765,20 +2783,23 @@ async function installExternalRepos(repos, repoPath, configRoot, installPath, le
2765
2783
  }
2766
2784
  const linkName = basename(repo.dir);
2767
2785
  const resolved = realpathSync(targetDir);
2768
- const configRootLink = join11(configRoot, linkName);
2769
- try {
2770
- if (existsSync12(configRootLink) || isSymlink(configRootLink)) {
2771
- unlinkSync4(configRootLink);
2772
- }
2786
+ const shouldConfigRootLink = repo.configRootLink !== false && (level === "global" || repo.configRootLink === true);
2787
+ if (shouldConfigRootLink) {
2788
+ const configRootLink = join11(configRoot, linkName);
2773
2789
  try {
2774
- symlinkSync(resolved, configRootLink);
2775
- } catch (e) {
2776
- if (e.code === "EPERM") {
2777
- cpSync(resolved, configRootLink, { recursive: true });
2790
+ if (existsSync12(configRootLink) || isSymlink(configRootLink)) {
2791
+ unlinkSync4(configRootLink);
2792
+ }
2793
+ try {
2794
+ symlinkSync(resolved, configRootLink);
2795
+ } catch (e) {
2796
+ if (e.code === "EPERM") {
2797
+ cpSync(resolved, configRootLink, { recursive: true });
2798
+ }
2778
2799
  }
2800
+ } catch {
2801
+ logger.warn(` Failed to link ${linkName} to config directory`);
2779
2802
  }
2780
- } catch {
2781
- logger.warn(` Failed to link ${linkName} to config directory`);
2782
2803
  }
2783
2804
  if (level === "project") {
2784
2805
  const projectLink = join11(installPath, linkName);
@@ -2884,7 +2905,7 @@ async function installViaManifest(plugin, repoPath, tool, level, installPath) {
2884
2905
  logger.warn(` Failed to install agent: ${agentFile}`);
2885
2906
  }
2886
2907
  }
2887
- installConfigFile(pluginDir, plugin.configFile || "AGENTS.md", tool, level, configRoot, cwd);
2908
+ installConfigFile(pluginDir, plugin.configFile || "AGENTS.md", tool, level, configRoot, cwd, plugin.configRootConfigLink);
2888
2909
  installWorkflows(pluginDir, configRoot);
2889
2910
  await installExternalRepos(plugin.externalRepos, repoPath, configRoot, cwd, level);
2890
2911
  const cannbotManifest = writeCannbotManifest(