@cannbot-ai/install-helper 0.0.2-beta.6 → 0.0.2-beta.61
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 +134 -35
- package/bin/install-helper.js +59 -0
- package/bin/package.json +3 -0
- package/dist/config/repository.yaml +28 -0
- package/dist/index.js +2525 -896
- package/dist/index.js.map +1 -1
- package/dist/install.ps1 +144 -0
- package/dist/locales/en_US.json +182 -0
- package/dist/locales/zh_CN.json +182 -0
- package/dist/plugins.d/_defaults.yml +4 -0
- package/dist/plugins.d/catlass-op-generator.yml +18 -0
- package/dist/plugins.d/model-infer-optimize.yml +19 -0
- package/dist/plugins.d/ops-code-reviewer.yml +14 -0
- package/dist/plugins.d/ops-direct-invoke-flash.yml +18 -0
- package/dist/plugins.d/ops-direct-invoke.yml +20 -0
- package/dist/plugins.d/ops-registry-invoke.yml +24 -0
- package/dist/plugins.d/pypto-op-orchestrator.yml +18 -0
- package/dist/plugins.d/tilelang-op-orchestrator.yml +20 -0
- package/dist/plugins.d/torch-compile.yml +14 -0
- package/dist/plugins.d/triton-op-generator.yml +14 -0
- package/package.json +17 -6
package/README.md
CHANGED
|
@@ -8,15 +8,63 @@
|
|
|
8
8
|
## 快速开始
|
|
9
9
|
|
|
10
10
|
```bash
|
|
11
|
-
#
|
|
11
|
+
# Linux/macOS 一键安装(零依赖,无需 Node.js)
|
|
12
|
+
curl -fsSL https://raw.gitcode.com/cann/cannbot-skills/raw/master/install.sh | bash
|
|
13
|
+
|
|
14
|
+
# Windows PowerShell 一键安装(零依赖)
|
|
15
|
+
irm https://cdn.jsdelivr.net/npm/@cannbot-ai/install-helper@latest/dist/install.ps1 | iex
|
|
16
|
+
|
|
17
|
+
# 或通过 npm 全局安装(需要 Node.js 18+)
|
|
12
18
|
npm install -g @cannbot-ai/install-helper
|
|
13
19
|
install-helper
|
|
14
20
|
|
|
15
|
-
# 或 npx
|
|
21
|
+
# 或 npx 即用(无需安装,需要 Node.js 18+)
|
|
16
22
|
npx @cannbot-ai/install-helper
|
|
17
23
|
```
|
|
18
24
|
|
|
19
|
-
|
|
25
|
+
curl 和 PowerShell 方式从 npm registry 下载预编译二进制(Bun 编译的独立可执行文件),无需 Node.js、无需 npm。安装后 `install-helper` 命令可直接使用。
|
|
26
|
+
|
|
27
|
+
交互式向导会自动检测已安装的 AI 编程工具(OpenCode / Claude Code / Trae / Cursor / GitHub Copilot),通过箭头键选择场景即可完成安装。
|
|
28
|
+
|
|
29
|
+
## 一键安装所有 Skills
|
|
30
|
+
|
|
31
|
+
如果 AI 编程工具已安装,可直接一键安装全部 Skills(无需逐个点选)。支持所有工具(opencode / claude / trae / cursor / copilot):
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# 一键安装全部 Skills 到当前项目(跳过确认)
|
|
35
|
+
install-helper install --all --tool opencode --yes
|
|
36
|
+
|
|
37
|
+
# 一键安装全部 Skills 到全局
|
|
38
|
+
install-helper install --all --tool opencode --level global --yes
|
|
39
|
+
|
|
40
|
+
# 指定其他 AI 工具
|
|
41
|
+
install-helper install --all --tool claude --yes
|
|
42
|
+
install-helper install --all --tool trae --yes
|
|
43
|
+
|
|
44
|
+
# 不指定 --tool,交互式选择工具
|
|
45
|
+
install-helper install --all --yes
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
> 交互式向导也支持「全选所有 Skills」和「全选当前类别」,详见下文。
|
|
49
|
+
|
|
50
|
+
## 主要特性
|
|
51
|
+
|
|
52
|
+
### 核心功能
|
|
53
|
+
- **动态 Skill 发现**:自动扫描仓库中的 SKILL.md 文件,实时发现可用 Skills
|
|
54
|
+
- **智能缓存机制**:扫描结果缓存 24 小时,大幅提升后续命令执行速度
|
|
55
|
+
- **备份与恢复**:安装新插件时自动备份 AGENTS.md,支持一键恢复
|
|
56
|
+
- **参数校验**:`--tool` 和 `--level` 参数支持校验,提供友好的错误提示(支持中英文)
|
|
57
|
+
- **智能记忆**:记住上次选择的工具和安装级别,下次运行自动填充
|
|
58
|
+
|
|
59
|
+
### 安装管理
|
|
60
|
+
- **交互式向导**:箭头键选择,空格切换,回车确认
|
|
61
|
+
- **列表排序**:插件和 Skills 列表按名称升序排列
|
|
62
|
+
- **描述聚焦**:光标聚焦某项时,下方以青色 + 💡 前缀显示详细描述,支持中文自适应换行
|
|
63
|
+
- **批量选择**:支持全选所有 Skills、全选当前类别、跨类别累积选择
|
|
64
|
+
- **插件安装**:支持 10 个官方插件,自动处理依赖
|
|
65
|
+
- **Skill 安装**:支持 91 个 Skills,按 11 个类别组织
|
|
66
|
+
- **智能卸载**:根据安装记录精确删除,自动清理空目录
|
|
67
|
+
- **健康检查**:检测安装状态,自动修复常见问题
|
|
20
68
|
|
|
21
69
|
## 命令一览
|
|
22
70
|
|
|
@@ -26,6 +74,7 @@ npx @cannbot-ai/install-helper
|
|
|
26
74
|
| `install-helper list` | 列出可用场景及安装状态 |
|
|
27
75
|
| `install-helper install <name>` | 安装指定插件或 Skill(自动识别) |
|
|
28
76
|
| `install-helper install --list` | 按类别列出所有可用 Skills |
|
|
77
|
+
| `install-helper install --all --tool <tool> --yes` | 一键安装全部 Skills |
|
|
29
78
|
| `install-helper update [plugin]` | 更新已安装的 Skills |
|
|
30
79
|
| `install-helper uninstall <plugin>` | 卸载指定场景 |
|
|
31
80
|
| `install-helper status` | 查看已安装插件详情 |
|
|
@@ -46,10 +95,13 @@ install-helper init
|
|
|
46
95
|
```
|
|
47
96
|
|
|
48
97
|
向导会引导你完成:
|
|
49
|
-
1.
|
|
50
|
-
2.
|
|
51
|
-
3.
|
|
52
|
-
4.
|
|
98
|
+
1. 选择安装类型(Plugin 完整工作流 / Skill 轻量知识)
|
|
99
|
+
2. 自动检测已安装的 AI 编程工具
|
|
100
|
+
3. 选择安装级别(project / global)
|
|
101
|
+
4. 多选要安装的插件或 Skills(空格切换,回车确认)
|
|
102
|
+
5. 确认并执行安装
|
|
103
|
+
|
|
104
|
+
**列表展示**:插件和 Skill 列表均按名称升序排列。光标聚焦某项时,下方会以青色 + 💡 前缀显示该项的详细描述,支持中文自适应换行。
|
|
53
105
|
|
|
54
106
|
**智能记忆**:向导会记住你上次选择的工具和级别,下次运行无需重新选择。已安装的插件会自动标记并默认不勾选。
|
|
55
107
|
|
|
@@ -64,11 +116,7 @@ install-helper install ops-direct-invoke --level global # 全局安装
|
|
|
64
116
|
|
|
65
117
|
**重要说明**:
|
|
66
118
|
|
|
67
|
-
每个插件都有独立的 `AGENTS.md`
|
|
68
|
-
|
|
69
|
-
**推荐做法**:
|
|
70
|
-
- 每个项目只安装一个插件
|
|
71
|
-
- 如需使用多个插件,在不同目录下分别安装
|
|
119
|
+
每个插件都有独立的 `AGENTS.md` 配置文件。如果在同一目录下安装多个插件,后安装的会覆盖前一个的配置文件。建议每个项目只安装一个插件,如需使用多个插件,在不同目录下分别安装。
|
|
72
120
|
|
|
73
121
|
**示例**:
|
|
74
122
|
```bash
|
|
@@ -81,8 +129,6 @@ cd project-b
|
|
|
81
129
|
install-helper install triton --tool opencode
|
|
82
130
|
```
|
|
83
131
|
|
|
84
|
-
> **注意**:每个插件有独立的 `AGENTS.md` 配置文件。同一项目目录下安装多个插件时,后安装的会覆盖前一个的 `AGENTS.md`。如需同时使用多个插件,建议分别在不同项目目录中安装。
|
|
85
|
-
|
|
86
132
|
### 安装单个 Skill(轻量模式)
|
|
87
133
|
|
|
88
134
|
如果只需要让 AI agent 掌握特定领域知识,不需要完整工作流,可以直接安装单个 Skill:
|
|
@@ -94,18 +140,25 @@ install-helper install model-infer-kvcache # 安装 KVCache 优化
|
|
|
94
140
|
install-helper install --list # 查看所有可用 Skills
|
|
95
141
|
```
|
|
96
142
|
|
|
97
|
-
Skills 按 11
|
|
143
|
+
Skills 按 11 个大类组织(另有「其他」兜底类别):知识与参考、环境与工具、调试与诊断、测试与质量、AscendC 开发、PyPTO 开发、TileLang 开发、Triton 开发、模型推理优化、图模式、平台工具。
|
|
98
144
|
|
|
99
145
|
`install` 命令自动识别输入是插件还是 Skill,无需区分。
|
|
100
146
|
|
|
147
|
+
**交互式批量选择**:运行 `install-helper install`(不带参数)进入交互式选择时,支持以下批量操作:
|
|
148
|
+
|
|
149
|
+
- **全选所有 Skills**:类别列表顶部有「全选所有 Skills(共 N 个)」,选中即一键安装全部。
|
|
150
|
+
- **全选当前类别**:进入某类别后,顶部有「全选当前类别」,勾选后回车即选中该类别全部 Skills。
|
|
151
|
+
- **跨类别累积选择**:选完一个类别后,可选择「继续选择其他类别」,已选 Skills 会保留累积,不丢失。类别列表中实时显示「确认安装(已选 N 个 Skills)」快捷入口,随时可确认安装。
|
|
152
|
+
- **单选/多选**:在类别内用空格勾选任意多个 Skills,回车确认。
|
|
153
|
+
|
|
101
154
|
**选项:**
|
|
102
155
|
|
|
103
156
|
| 选项 | 说明 |
|
|
104
157
|
|------|------|
|
|
105
158
|
| `--tool <tool>` | 指定 AI 工具(opencode, claude, trae, cursor, copilot) |
|
|
106
159
|
| `--level <level>` | 安装级别(project, global),默认 project |
|
|
107
|
-
| `--all` |
|
|
108
|
-
| `--yes` | 跳过所有确认提示 |
|
|
160
|
+
| `--all` `-a` | 安装全部 Skills(一键安装) |
|
|
161
|
+
| `--yes` `-y` | 跳过所有确认提示 |
|
|
109
162
|
|
|
110
163
|
**已装检测**:如果插件已安装,会提示是否覆盖安装。使用 `--yes` 可跳过提示直接覆盖。
|
|
111
164
|
|
|
@@ -168,41 +221,67 @@ install-helper uninstall ops-direct-invoke --tool opencode
|
|
|
168
221
|
|
|
169
222
|
## 可用场景
|
|
170
223
|
|
|
224
|
+
install-helper 支持 **10 个官方插件** 和 **91 个 Skills**(动态发现,数量可能随仓库更新而变化)。
|
|
225
|
+
|
|
226
|
+
#### 官方插件
|
|
227
|
+
|
|
171
228
|
| # | 场景 | ID | 别名 |
|
|
172
229
|
|---|------|----|------|
|
|
173
|
-
| 1 | AscendC Kernel 直调 | ops-direct-invoke | ops-direct, direct, kernel |
|
|
174
|
-
| 2 | AscendC Kernel
|
|
175
|
-
| 3 | AscendC 算子注册调用 | ops-registry-invoke | ops-registry, registry |
|
|
176
|
-
| 4 |
|
|
177
|
-
| 5 |
|
|
178
|
-
| 6 |
|
|
179
|
-
| 7 |
|
|
180
|
-
| 8 |
|
|
181
|
-
| 9 |
|
|
182
|
-
| 10 |
|
|
230
|
+
| 1 | AscendC Kernel 直调 | ops-direct-invoke | ops-direct, ascendc-direct, direct, kernel |
|
|
231
|
+
| 2 | AscendC Kernel 直调(快速版) | ops-direct-invoke-flash | flash, kernel-flash |
|
|
232
|
+
| 3 | AscendC 算子注册调用 | ops-registry-invoke | ops-registry, ascendc-registry, registry |
|
|
233
|
+
| 4 | Catlass 算子直调 | catlass-op-generator | catlass |
|
|
234
|
+
| 5 | NPU 推理优化 | model-infer-optimize | model-infer, infer, inference |
|
|
235
|
+
| 6 | PyPTO 算子开发 | pypto-op-orchestrator | pypto, pytorch |
|
|
236
|
+
| 7 | TileLang 算子开发 | tilelang-op-orchestrator | tilelang |
|
|
237
|
+
| 8 | Triton 算子开发 | triton-op-generator | triton |
|
|
238
|
+
| 9 | torch.compile 图模式 | torch-compile | torch, compile, graph |
|
|
239
|
+
| 10 | 代码检视 | ops-code-reviewer | code-review, reviewer, review |
|
|
240
|
+
|
|
241
|
+
#### Skills 类别
|
|
242
|
+
|
|
243
|
+
Skills 按 11 个类别组织(另有「其他」兜底类别,动态发现,数量可能随仓库更新而变化):
|
|
244
|
+
- 知识与参考
|
|
245
|
+
- 环境与工具
|
|
246
|
+
- 调试与诊断
|
|
247
|
+
- 测试与质量
|
|
248
|
+
- AscendC 开发
|
|
249
|
+
- PyPTO 开发
|
|
250
|
+
- TileLang 开发
|
|
251
|
+
- Triton 开发
|
|
252
|
+
- 模型推理优化
|
|
253
|
+
- 图模式
|
|
254
|
+
- 平台工具
|
|
255
|
+
- 其他 Skills
|
|
256
|
+
|
|
257
|
+
使用 `install-helper install --list` 查看完整的 Skills 列表。
|
|
183
258
|
|
|
184
259
|
## 前置条件
|
|
185
260
|
|
|
186
|
-
-
|
|
187
|
-
- 已安装至少一个 AI 编程工具(OpenCode / Claude Code / Trae / Cursor)
|
|
261
|
+
- 已安装至少一个 AI 编程工具(OpenCode / Claude Code / Trae / Cursor / GitHub Copilot)
|
|
188
262
|
- Git(用于克隆 Skills 仓库)
|
|
263
|
+
- curl/PowerShell 方式无需 Node.js;npm/npx 方式需要 Node.js >= 18
|
|
189
264
|
|
|
190
265
|
## 工作原理
|
|
191
266
|
|
|
192
267
|
install-helper 是一个编排工具:
|
|
193
268
|
|
|
194
269
|
1. **自动检测**已安装的 AI 编程工具
|
|
195
|
-
2.
|
|
196
|
-
3.
|
|
197
|
-
4.
|
|
270
|
+
2. **动态扫描**仓库中的 SKILL.md 文件,发现可用 Skills
|
|
271
|
+
3. **缓存扫描结果**到 `~/.cannbot/scan-cache.json`(24 小时有效)
|
|
272
|
+
4. **克隆或更新** cannbot-skills 仓库(缓存到 `~/.cannbot/repo/`)
|
|
273
|
+
5. **备份现有配置**(如果检测到已安装的 AGENTS.md)
|
|
274
|
+
6. **声明式安装**:从 `plugins.d/*.yml` 读取安装清单(installSkills/installAgents/configFile/externalRepos),通过 Node.js 原生引擎执行安装(创建 symlink、克隆外部仓库、写 manifest),无需 bash/sh;无安装清单时 fallback 到 `init.sh` 脚本
|
|
275
|
+
7. **追踪**安装状态(`~/.cannbot/config.yaml` + manifest)
|
|
198
276
|
|
|
199
|
-
|
|
277
|
+
安装逻辑优先由 manifest 引擎(Node.js 原生,跨平台)负责,install-helper 提供统一的交互式入口和状态管理。
|
|
200
278
|
|
|
201
279
|
## 配置文件
|
|
202
280
|
|
|
203
|
-
配置保存在 `~/.cannbot
|
|
281
|
+
配置保存在 `~/.cannbot/` 目录:
|
|
204
282
|
|
|
205
283
|
```yaml
|
|
284
|
+
# config.yaml - 用户配置
|
|
206
285
|
language: zh_CN # 界面语言
|
|
207
286
|
lastTool: opencode # 上次使用的 AI 工具
|
|
208
287
|
lastLevel: project # 上次安装级别
|
|
@@ -211,11 +290,31 @@ installedPlugins: # 已安装的插件列表
|
|
|
211
290
|
- pypto-op-orchestrator
|
|
212
291
|
```
|
|
213
292
|
|
|
293
|
+
```json
|
|
294
|
+
// scan-cache.json - 扫描缓存(自动生成,24 小时有效)
|
|
295
|
+
{
|
|
296
|
+
"skills": [...],
|
|
297
|
+
"repoCommit": "a1b2c3d4e5f6...",
|
|
298
|
+
"timestamp": 1234567890
|
|
299
|
+
}
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
```json
|
|
303
|
+
// installs/<plugin>.json - 安装记录(每个插件一个文件)
|
|
304
|
+
{
|
|
305
|
+
"pluginId": "ops-direct-invoke",
|
|
306
|
+
"installTime": "2026-06-23T10:00:00Z",
|
|
307
|
+
"configRoot": "/path/to/config",
|
|
308
|
+
"files": [...],
|
|
309
|
+
"directories": [...]
|
|
310
|
+
}
|
|
311
|
+
```
|
|
312
|
+
|
|
214
313
|
## 开发
|
|
215
314
|
|
|
216
315
|
```bash
|
|
217
316
|
git clone https://gitcode.com/cann/cannbot-skills.git
|
|
218
|
-
cd cannbot-skills/
|
|
317
|
+
cd cannbot-skills/plugins-community/install-helper
|
|
219
318
|
|
|
220
319
|
npm install
|
|
221
320
|
npm run dev # watch 模式
|
|
@@ -0,0 +1,59 @@
|
|
|
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
|
+
#!/usr/bin/env node
|
|
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
|
+
}
|
package/bin/package.json
ADDED
|
@@ -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/yanhf/cann_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
|