@cannbot-ai/install-helper 0.0.1-beta.0

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 ADDED
@@ -0,0 +1,227 @@
1
+ # install-helper
2
+
3
+ > CANNBot Helper — CANNBot 交互式安装助手
4
+
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
+
8
+ ## 快速开始
9
+
10
+ ```bash
11
+ # 全局安装(推荐)
12
+ npm install -g @cannbot-ai/install-helper
13
+ install-helper
14
+
15
+ # 或 npx 即用(无需安装)
16
+ npx @cannbot-ai/install-helper
17
+ ```
18
+
19
+ 交互式向导会自动检测已安装的 AI 编程工具(OpenCode / Claude Code / Trae / Cursor),通过箭头键选择场景即可完成安装。
20
+
21
+ ## 命令一览
22
+
23
+ | 命令 | 说明 |
24
+ |------|------|
25
+ | `install-helper` / `install-helper init` | 交互式安装向导 |
26
+ | `install-helper list` | 列出可用场景及安装状态 |
27
+ | `install-helper install <name>` | 安装指定插件或 Skill(自动识别) |
28
+ | `install-helper install --list` | 按类别列出所有可用 Skills |
29
+ | `install-helper update [plugin]` | 更新已安装的 Skills |
30
+ | `install-helper uninstall <plugin>` | 卸载指定场景 |
31
+ | `install-helper status` | 查看已安装插件详情 |
32
+ | `install-helper doctor` | 健康检查 |
33
+ | `install-helper doctor --fix` | 健康检查 + 自动修复 |
34
+ | `install-helper info <plugin>` | 查看插件详情 |
35
+ | `install-helper lang show` | 显示当前语言 |
36
+ | `install-helper lang set en_US` | 切换语言 |
37
+
38
+ ## 命令详解
39
+
40
+ ### 交互式安装向导
41
+
42
+ ```bash
43
+ install-helper
44
+ # 或
45
+ install-helper init
46
+ ```
47
+
48
+ 向导会引导你完成:
49
+ 1. 自动检测已安装的 AI 编程工具
50
+ 2. 选择安装级别(project / global)
51
+ 3. 多选要安装的场景(空格切换,回车确认)
52
+ 4. 确认并执行安装
53
+
54
+ **智能记忆**:向导会记住你上次选择的工具和级别,下次运行无需重新选择。已安装的插件会自动标记并默认不勾选。
55
+
56
+ ### 安装指定场景
57
+
58
+ ```bash
59
+ install-helper install ops-direct-invoke # 安装单个
60
+ install-helper install triton --tool claude # 指定工具
61
+ install-helper install ops-direct-invoke --yes # 跳过确认
62
+ install-helper install ops-direct-invoke --level global # 全局安装
63
+ ```
64
+
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(轻量模式)
87
+
88
+ 如果只需要让 AI agent 掌握特定领域知识,不需要完整工作流,可以直接安装单个 Skill:
89
+
90
+ ```bash
91
+ install-helper install npu-arch # 安装 NPU 架构知识
92
+ install-helper install ascendc-precision-debug # 安装精度调试技能
93
+ install-helper install model-infer-kvcache # 安装 KVCache 优化技能
94
+ install-helper install --list # 查看所有可用 Skills
95
+ ```
96
+
97
+ Skills 按 11 个大类组织:知识与参考、环境与工具、调试与诊断、测试与质量、AscendC 开发、PyPTO 开发、TileLang 开发、Triton 开发、模型推理优化、图模式、平台工具。
98
+
99
+ `install` 命令自动识别输入是插件还是 Skill,无需区分。
100
+
101
+ **选项:**
102
+
103
+ | 选项 | 说明 |
104
+ |------|------|
105
+ | `--tool <tool>` | 指定 AI 工具(opencode, claude, trae, cursor, copilot) |
106
+ | `--level <level>` | 安装级别(project, global),默认 project |
107
+ | `--all` | 安装全部场景 |
108
+ | `--yes` | 跳过所有确认提示 |
109
+
110
+ **已装检测**:如果插件已安装,会提示是否覆盖安装。使用 `--yes` 可跳过提示直接覆盖。
111
+
112
+ ### 更新已安装的 Skills
113
+
114
+ ```bash
115
+ install-helper update # 更新所有已安装插件
116
+ install-helper update triton # 更新指定插件
117
+ ```
118
+
119
+ 更新流程:`git pull` 拉取最新 Skills 仓库 → 重新执行安装脚本 → 软链接自动指向最新内容。
120
+
121
+ ### 查看插件详情
122
+
123
+ ```bash
124
+ install-helper info ops-direct-invoke
125
+ ```
126
+
127
+ 输出插件描述、包含的 Skills/Agents 列表、quickstart 文档路径、安装状态。
128
+
129
+ ### 健康检查
130
+
131
+ ```bash
132
+ install-helper doctor # 仅检测
133
+ install-helper doctor --fix # 检测 + 自动修复
134
+ ```
135
+
136
+ 检查项目:
137
+ - AI 工具安装状态
138
+ - 已安装插件状态
139
+ - 软链接完整性
140
+ - 配置文件存在性
141
+
142
+ `--fix` 会自动修复:清理失效软链接、重建缺失目录。
143
+
144
+ ### 语言管理
145
+
146
+ ```bash
147
+ 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
158
+ ```
159
+
160
+ 卸载时根据安装记录(`~/.cannbot/installs/<plugin>.json`)精确删除所有安装产物:
161
+ - Skills 软链接
162
+ - Agents 软链接
163
+ - Workflows 链接
164
+ - 配置文件(AGENTS.md / CLAUDE.md)
165
+ - Manifest 文件
166
+ - 参考仓库链接(asc-devkit 等)
167
+ - 空目录清理
168
+
169
+ ## 可用场景
170
+
171
+ | # | 场景 | ID | 别名 |
172
+ |---|------|----|------|
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 |
183
+
184
+ ## 前置条件
185
+
186
+ - Node.js >= 18
187
+ - 已安装至少一个 AI 编程工具(OpenCode / Claude Code / Trae / Cursor)
188
+ - Git(用于克隆 Skills 仓库)
189
+
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
+ ## 开发
215
+
216
+ ```bash
217
+ git clone https://gitcode.com/cann/cannbot-skills.git
218
+ cd cannbot-skills/packages/install-helper
219
+
220
+ npm install
221
+ npm run dev # watch 模式
222
+ npm run build # 构建
223
+ npm link # 全局注册
224
+ install-helper list # 测试
225
+ ```
226
+
227
+