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