@cannbot-ai/install-helper 0.0.2-beta.7 → 0.0.2-beta.70

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
@@ -3,36 +3,58 @@
3
3
  > CANNBot Install Helper — CANNBot 交互式安装助手
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/@cannbot-ai/install-helper.svg)](https://www.npmjs.com/package/@cannbot-ai/install-helper)
6
- [![Node.js](https://img.shields.io/badge/node-%3E%3D18-brightgreen.svg)](https://nodejs.org)
7
6
 
8
7
  ## 快速开始
9
8
 
9
+ ### Linux / macOS
10
+
10
11
  ```bash
11
- # 全局安装(推荐)
12
- npm install -g @cannbot-ai/install-helper
13
- install-helper
12
+ curl -fsSL https://raw.gitcode.com/cann/cannbot-skills/raw/master/install.sh | bash
13
+ ```
14
14
 
15
- # 或 npx 即用(无需安装)
16
- npx @cannbot-ai/install-helper
15
+ ### Windows
16
+
17
+ ```powershell
18
+ irm https://cdn.jsdelivr.net/npm/@cannbot-ai/install-helper@latest/dist/install.ps1 | iex
17
19
  ```
18
20
 
19
- 交互式向导会自动检测已安装的 AI 编程工具(OpenCode / Claude Code / Trae / Cursor),通过箭头键选择场景即可完成安装。
21
+ ### npm(全平台,需要 Node.js 18+)
22
+
23
+ ```bash
24
+ npm install -g @cannbot-ai/install-helper
25
+ ```
26
+
27
+ > 也可以免安装直接运行:`npx @cannbot-ai/install-helper`
28
+
29
+ ---
30
+
31
+ 安装完成后运行 `install-helper` 启动向导。
32
+
33
+ ## 一键安装所有 Skills
34
+
35
+ ```bash
36
+ # 安装全部 Skills 到当前项目
37
+ install-helper install --all --tool opencode --yes
38
+
39
+ # 安装全部 Skills 到全局
40
+ install-helper install --all --tool opencode --level global --yes
41
+ ```
20
42
 
21
43
  ## 命令一览
22
44
 
23
45
  | 命令 | 说明 |
24
46
  |------|------|
25
- | `install-helper` / `install-helper init` | 交互式安装向导 |
47
+ | `install-helper` | 交互式安装向导 |
26
48
  | `install-helper list` | 列出可用场景及安装状态 |
27
49
  | `install-helper install <name>` | 安装指定插件或 Skill(自动识别) |
28
50
  | `install-helper install --list` | 按类别列出所有可用 Skills |
29
- | `install-helper update [plugin]` | 更新已安装的 Skills |
30
- | `install-helper uninstall <plugin>` | 卸载指定场景 |
51
+ | `install-helper install --all --tool <tool> --yes` | 一键安装全部 Skills |
52
+ | `install-helper update [plugin]` | 更新已安装的插件 |
53
+ | `install-helper uninstall <plugin>` | 卸载指定插件 |
31
54
  | `install-helper status` | 查看已安装插件详情 |
32
55
  | `install-helper doctor` | 健康检查 |
33
56
  | `install-helper doctor --fix` | 健康检查 + 自动修复 |
34
57
  | `install-helper info <plugin>` | 查看插件详情 |
35
- | `install-helper lang show` | 显示当前语言 |
36
58
  | `install-helper lang set en_US` | 切换语言 |
37
59
 
38
60
  ## 命令详解
@@ -41,19 +63,13 @@ npx @cannbot-ai/install-helper
41
63
 
42
64
  ```bash
43
65
  install-helper
44
- # 或
45
- install-helper init
46
66
  ```
47
67
 
48
- 向导会引导你完成:
49
- 1. 自动检测已安装的 AI 编程工具
50
- 2. 选择安装级别(project / global)
51
- 3. 多选要安装的场景(空格切换,回车确认)
52
- 4. 确认并执行安装
68
+ 向导引导:选择类型(Plugin/Skill)→ 检测工具 → 选择位置 → 选择插件/Skill → 确认安装。
53
69
 
54
- **智能记忆**:向导会记住你上次选择的工具和级别,下次运行无需重新选择。已安装的插件会自动标记并默认不勾选。
70
+ 已安装的插件会自动标记,上次选择的工具和级别会被记住。
55
71
 
56
- ### 安装指定场景
72
+ ### 安装指定插件
57
73
 
58
74
  ```bash
59
75
  install-helper install ops-direct-invoke # 安装单个
@@ -62,41 +78,19 @@ install-helper install ops-direct-invoke --yes # 跳过确认
62
78
  install-helper install ops-direct-invoke --level global # 全局安装
63
79
  ```
64
80
 
65
- **重要说明**:
66
-
67
- 每个插件都有独立的 `AGENTS.md` 配置文件。如果在同一目录下安装多个插件,后安装的会覆盖前一个的配置文件。
68
-
69
- **推荐做法**:
70
- - 每个项目只安装一个插件
71
- - 如需使用多个插件,在不同目录下分别安装
72
-
73
- **示例**:
74
- ```bash
75
- # 项目 A:使用 Kernel 直调
76
- cd project-a
77
- install-helper install ops-direct-invoke --tool opencode
78
-
79
- # 项目 B:使用 Triton
80
- cd project-b
81
- install-helper install triton --tool opencode
82
- ```
83
-
84
- > **注意**:每个插件有独立的 `AGENTS.md` 配置文件。同一项目目录下安装多个插件时,后安装的会覆盖前一个的 `AGENTS.md`。如需同时使用多个插件,建议分别在不同项目目录中安装。
85
-
86
- ### 安装单个 Skill(轻量模式)
81
+ > 每个插件有独立的 `AGENTS.md`,建议每个项目只安装一个插件。
87
82
 
88
- 如果只需要让 AI agent 掌握特定领域知识,不需要完整工作流,可以直接安装单个 Skill:
83
+ ### 安装单个 Skill
89
84
 
90
85
  ```bash
91
86
  install-helper install npu-arch # 安装 NPU 架构知识
92
87
  install-helper install ascendc-precision-debug # 安装精度调试技能
93
- install-helper install model-infer-kvcache # 安装 KVCache 优化技能
94
88
  install-helper install --list # 查看所有可用 Skills
95
89
  ```
96
90
 
97
- Skills 按 11 个大类组织:知识与参考、环境与工具、调试与诊断、测试与质量、AscendC 开发、PyPTO 开发、TileLang 开发、Triton 开发、模型推理优化、图模式、平台工具。
91
+ `install` 命令自动识别输入是插件还是 Skill。
98
92
 
99
- `install` 命令自动识别输入是插件还是 Skill,无需区分。
93
+ 交互式选择时支持:全选所有 Skills、全选当前类别、跨类别累积选择。
100
94
 
101
95
  **选项:**
102
96
 
@@ -104,27 +98,23 @@ Skills 按 11 个大类组织:知识与参考、环境与工具、调试与诊
104
98
  |------|------|
105
99
  | `--tool <tool>` | 指定 AI 工具(opencode, claude, trae, cursor, copilot) |
106
100
  | `--level <level>` | 安装级别(project, global),默认 project |
107
- | `--all` | 安装全部场景 |
108
- | `--yes` | 跳过所有确认提示 |
101
+ | `--all` `-a` | 安装全部 Skills |
102
+ | `--yes` `-y` | 跳过所有确认提示 |
109
103
 
110
- **已装检测**:如果插件已安装,会提示是否覆盖安装。使用 `--yes` 可跳过提示直接覆盖。
111
-
112
- ### 更新已安装的 Skills
104
+ ### 更新
113
105
 
114
106
  ```bash
115
107
  install-helper update # 更新所有已安装插件
116
108
  install-helper update triton # 更新指定插件
117
109
  ```
118
110
 
119
- 更新流程:`git pull` 拉取最新 Skills 仓库 → 重新执行安装脚本 → 软链接自动指向最新内容。
120
-
121
- ### 查看插件详情
111
+ ### 卸载
122
112
 
123
113
  ```bash
124
- install-helper info ops-direct-invoke
114
+ install-helper uninstall ops-direct-invoke --tool opencode
125
115
  ```
126
116
 
127
- 输出插件描述、包含的 Skills/Agents 列表、quickstart 文档路径、安装状态。
117
+ 根据安装记录精确删除所有产物,自动清理空目录。
128
118
 
129
119
  ### 健康检查
130
120
 
@@ -133,89 +123,38 @@ install-helper doctor # 仅检测
133
123
  install-helper doctor --fix # 检测 + 自动修复
134
124
  ```
135
125
 
136
- 检查项目:
137
- - AI 工具安装状态
138
- - 已安装插件状态
139
- - 软链接完整性
140
- - 配置文件存在性
141
-
142
- `--fix` 会自动修复:清理失效软链接、重建缺失目录。
143
-
144
126
  ### 语言管理
145
127
 
146
128
  ```bash
147
129
  install-helper lang show # 显示当前语言
148
- install-helper lang set zh_CN # 设置为中文(默认)
149
- install-helper lang set en_US # 设置为英文
150
- ```
151
-
152
- 语言设置保存在 `~/.cannbot/config.yaml`,重启后自动生效。
153
-
154
- ### 卸载
155
-
156
- ```bash
157
- install-helper uninstall ops-direct-invoke --tool opencode
130
+ install-helper lang set en_US # 切换为英文
158
131
  ```
159
132
 
160
- 卸载时根据安装记录(`~/.cannbot/installs/<plugin>.json`)精确删除所有安装产物:
161
- - Skills 软链接
162
- - Agents 软链接
163
- - Workflows 链接
164
- - 配置文件(AGENTS.md / CLAUDE.md)
165
- - Manifest 文件
166
- - 参考仓库链接(asc-devkit 等)
167
- - 空目录清理
168
-
169
- ## 可用场景
133
+ ## 可用插件
170
134
 
171
135
  | # | 场景 | ID | 别名 |
172
136
  |---|------|----|------|
173
- | 1 | AscendC Kernel 直调 | ops-direct-invoke | ops-direct, direct, kernel |
174
- | 2 | AscendC Kernel 从零构建 | ops-direct-invoke-flash | flash |
175
- | 3 | AscendC 算子注册调用 | ops-registry-invoke | ops-registry, registry |
176
- | 4 | PyPTO 算子 | pypto-op-orchestrator | pypto |
177
- | 5 | Triton 算子生成 | triton-op-generator | triton |
178
- | 6 | TileLang 算子 | tilelang-op-orchestrator | tilelang |
179
- | 7 | NPU 推理优化 | model-infer-optimize | model-infer, infer |
180
- | 8 | Catlass 算子直调 | catlass-op-generator | catlass |
181
- | 9 | 代码检视 | ops-code-reviewer | code-review, reviewer |
182
- | 10 | torch.compile 图模式 | torch-compile | torch, compile |
137
+ | 1 | AscendC Kernel 直调 | ops-direct-invoke | ops-direct, ascendc-direct, direct, kernel |
138
+ | 2 | AscendC Kernel 直调(快速版) | ops-direct-invoke-flash | flash, kernel-flash |
139
+ | 3 | AscendC 算子注册调用 | ops-registry-invoke | ops-registry, ascendc-registry, registry |
140
+ | 4 | Catlass 算子直调 | catlass-op-generator | catlass |
141
+ | 5 | NPU 推理优化 | model-infer-optimize | model-infer, infer, inference |
142
+ | 6 | PyPTO 算子开发 | pypto-op-orchestrator | pypto, pytorch |
143
+ | 7 | TileLang 算子开发 | tilelang-op-orchestrator | tilelang |
144
+ | 8 | Triton 算子开发 | triton-op-generator | triton |
145
+ | 9 | torch.compile 图模式 | torch-compile | torch, compile, graph |
146
+ | 10 | 代码检视 | ops-code-reviewer | code-review, reviewer, review |
183
147
 
184
148
  ## 前置条件
185
149
 
186
- - Node.js >= 18
187
- - 已安装至少一个 AI 编程工具(OpenCode / Claude Code / Trae / Cursor)
150
+ - 已安装至少一个 AI 编程工具(OpenCode / Claude Code / Trae / Cursor / GitHub Copilot)
188
151
  - Git(用于克隆 Skills 仓库)
189
152
 
190
- ## 工作原理
191
-
192
- install-helper 是一个编排工具:
193
-
194
- 1. **自动检测**已安装的 AI 编程工具
195
- 2. **克隆或更新** cannbot-skills 仓库(缓存到 `~/.cannbot/repo/`)
196
- 3. **调用**各插件的 `init.sh` / `install.sh` 脚本执行实际安装
197
- 4. **追踪**安装状态(`~/.cannbot/config.yaml` + manifest)
198
-
199
- 安装逻辑仍由各插件的 init.sh 脚本负责,install-helper 提供统一的交互式入口和状态管理。
200
-
201
- ## 配置文件
202
-
203
- 配置保存在 `~/.cannbot/config.yaml`:
204
-
205
- ```yaml
206
- language: zh_CN # 界面语言
207
- lastTool: opencode # 上次使用的 AI 工具
208
- lastLevel: project # 上次安装级别
209
- installedPlugins: # 已安装的插件列表
210
- - ops-direct-invoke
211
- - pypto-op-orchestrator
212
- ```
213
-
214
153
  ## 开发
215
154
 
216
155
  ```bash
217
156
  git clone https://gitcode.com/cann/cannbot-skills.git
218
- cd cannbot-skills/packages/install-helper
157
+ cd cannbot-skills/plugins-community/install-helper
219
158
 
220
159
  npm install
221
160
  npm run dev # watch 模式
@@ -223,5 +162,3 @@ npm run build # 构建
223
162
  npm link # 全局注册
224
163
  install-helper list # 测试
225
164
  ```
226
-
227
-
@@ -0,0 +1,59 @@
1
+ #!/usr/bin/env node
2
+ // ----------------------------------------------------------------------------------------------------------
3
+ // Copyright (c) 2026 Huawei Technologies Co., Ltd.
4
+ // This program is free software, you can redistribute it and/or modify it under the terms and conditions of
5
+ // CANN Open Software License Agreement Version 2.0 (the "License").
6
+ // Please refer to the License for details. You may not use this file except in compliance with the License.
7
+ // THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
8
+ // INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
9
+ // See LICENSE in the root of the software repository for the full text of the License.
10
+ // ----------------------------------------------------------------------------------------------------------
11
+
12
+
13
+ const { spawn } = require("child_process");
14
+ const { existsSync } = require("fs");
15
+ const { join, dirname } = require("path");
16
+
17
+ const PLATFORM_MAP = {
18
+ "linux-x64": "@cannbot-ai/install-helper-linux-x64",
19
+ "linux-arm64": "@cannbot-ai/install-helper-linux-arm64",
20
+ "darwin-x64": "@cannbot-ai/install-helper-darwin-x64",
21
+ "darwin-arm64": "@cannbot-ai/install-helper-darwin-arm64",
22
+ "win32-x64": "@cannbot-ai/install-helper-windows-x64",
23
+ };
24
+
25
+ const key = `${process.platform}-${process.arch}`;
26
+ const pkgName = PLATFORM_MAP[key];
27
+ const binaryName = process.platform === "win32" ? "install-helper.exe" : "install-helper";
28
+ const args = process.argv.slice(2);
29
+
30
+ if (pkgName) {
31
+ try {
32
+ const pkgPath = require.resolve(`${pkgName}/package.json`);
33
+ const binaryPath = join(dirname(pkgPath), binaryName);
34
+ if (existsSync(binaryPath)) {
35
+ const child = spawn(binaryPath, args, { stdio: "inherit" });
36
+ child.on("exit", (code, signal) => { process.exit(code ?? (signal ? 1 : 0)); });
37
+ child.on("error", () => runJSFallback());
38
+ return;
39
+ }
40
+ } catch {}
41
+ }
42
+
43
+ runJSFallback();
44
+
45
+ function runJSFallback() {
46
+ const jsPath = join(__dirname, "..", "dist", "index.js");
47
+ if (existsSync(jsPath)) {
48
+ const child = spawn(process.execPath, [jsPath, ...args], { stdio: "inherit" });
49
+ child.on("exit", (code, signal) => { process.exit(code ?? (signal ? 1 : 0)); });
50
+ child.on("error", () => {
51
+ console.error("install-helper: failed to run");
52
+ process.exit(1);
53
+ });
54
+ return;
55
+ }
56
+ console.error(`install-helper binary not found for ${key}`);
57
+ console.error("Try: npm install -g @cannbot-ai/install-helper");
58
+ process.exit(1);
59
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
@@ -0,0 +1,28 @@
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
+
11
+ # Default configuration for install-helper
12
+ repository:
13
+ url: "https://gitcode.com/cann/cannbot-skills.git"
14
+ name: "cannbot-skills"
15
+
16
+ scanDirs:
17
+ - ops
18
+ - model
19
+ - graph
20
+ - infra
21
+ - ops-lab
22
+ - runtime
23
+
24
+ pluginDirs:
25
+ - plugins-official
26
+ - plugins-community
27
+
28
+ scanCacheTtlHours: 24