@h-ai/cli 0.1.0-alpha.54 → 0.1.0-alpha.55

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.
Files changed (64) hide show
  1. package/README.md +4 -0
  2. package/package.json +7 -7
  3. package/templates/base/package.json.hbs +1 -1
  4. package/templates/skills/AGENTS.md +8 -22
  5. package/templates/skills/CLAUDE.md +3 -16
  6. package/templates/skills/bridges/admin/AGENTS.md +3 -16
  7. package/templates/skills/bridges/admin/CLAUDE.md +3 -11
  8. package/templates/skills/bridges/admin/copilot-instructions.md +2 -39
  9. package/templates/skills/bridges/api/AGENTS.md +5 -18
  10. package/templates/skills/bridges/api/CLAUDE.md +3 -11
  11. package/templates/skills/bridges/api/copilot-instructions.md +3 -38
  12. package/templates/skills/bridges/fullstack/AGENTS.md.hbs +24 -59
  13. package/templates/skills/bridges/fullstack/CLAUDE.md.hbs +1 -15
  14. package/templates/skills/bridges/fullstack/copilot-instructions.md.hbs +5 -45
  15. package/templates/skills/bridges/h5/AGENTS.md +4 -17
  16. package/templates/skills/bridges/h5/CLAUDE.md +3 -11
  17. package/templates/skills/bridges/h5/copilot-instructions.md +2 -37
  18. package/templates/skills/bridges/mobile-app/AGENTS.md +5 -18
  19. package/templates/skills/bridges/mobile-app/CLAUDE.md +3 -11
  20. package/templates/skills/bridges/mobile-app/copilot-instructions.md +2 -38
  21. package/templates/skills/bridges/website/AGENTS.md +4 -17
  22. package/templates/skills/bridges/website/CLAUDE.md +3 -11
  23. package/templates/skills/bridges/website/copilot-instructions.md +2 -37
  24. package/templates/skills/copilot-instructions.md +2 -36
  25. package/templates/skills/hai-ai/SKILL.md +35 -389
  26. package/templates/skills/hai-ai/guide.md +383 -0
  27. package/templates/skills/hai-ai/reference.md +1 -1
  28. package/templates/skills/hai-api-client/SKILL.md +6 -6
  29. package/templates/skills/hai-api-contract/SKILL.md +10 -25
  30. package/templates/skills/hai-app-create/SKILL.md +29 -388
  31. package/templates/skills/hai-app-create/reference.md +350 -0
  32. package/templates/skills/hai-app-review/SKILL.md +9 -23
  33. package/templates/skills/hai-app-tests/SKILL.md +29 -494
  34. package/templates/skills/hai-app-tests/reference.md +442 -0
  35. package/templates/skills/hai-audit/SKILL.md +6 -6
  36. package/templates/skills/hai-build/SKILL.md +19 -338
  37. package/templates/skills/hai-build/reference.md +326 -0
  38. package/templates/skills/hai-cache/SKILL.md +27 -32
  39. package/templates/skills/hai-capacitor/SKILL.md +19 -366
  40. package/templates/skills/hai-capacitor/reference.md +352 -0
  41. package/templates/skills/hai-ci/SKILL.md +6 -21
  42. package/templates/skills/hai-core/SKILL.md +25 -566
  43. package/templates/skills/hai-core/reference.md +533 -0
  44. package/templates/skills/hai-crypto/SKILL.md +6 -20
  45. package/templates/skills/hai-datapipe/SKILL.md +9 -23
  46. package/templates/skills/hai-deploy/SKILL.md +6 -24
  47. package/templates/skills/hai-framework-sync/SKILL.md +8 -20
  48. package/templates/skills/hai-iam/SKILL.md +27 -371
  49. package/templates/skills/hai-iam/reference.md +343 -0
  50. package/templates/skills/hai-kit/SKILL.md +6 -6
  51. package/templates/skills/hai-payment/SKILL.md +6 -26
  52. package/templates/skills/hai-pr-review/SKILL.md +6 -22
  53. package/templates/skills/hai-reach/SKILL.md +19 -317
  54. package/templates/skills/hai-reach/reference.md +303 -0
  55. package/templates/skills/hai-reldb/SKILL.md +19 -472
  56. package/templates/skills/hai-reldb/reference.md +452 -0
  57. package/templates/skills/hai-scheduler/SKILL.md +6 -6
  58. package/templates/skills/hai-serv/SKILL.md +27 -759
  59. package/templates/skills/hai-serv/reference.md +736 -0
  60. package/templates/skills/hai-storage/SKILL.md +7 -25
  61. package/templates/skills/hai-ui/SKILL.md +29 -625
  62. package/templates/skills/hai-ui/reference.md +598 -0
  63. package/templates/skills/hai-vecdb/SKILL.md +18 -303
  64. package/templates/skills/hai-vecdb/reference.md +291 -0
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: hai-datapipe
3
- description: 使用 @h-ai/datapipe 进行文本清洗(HTML/URL/空白移除)、多模式分块(句子/段落/Markdown/字符/自定义)和管线组合;当需求涉及文本预处理、文档分块、数据清洗或 RAG 入库前处理时使用。
3
+ description: "使用 @h-ai/datapipe 清洗文本、分块并组合 RAG 入库管线。"
4
4
  ---
5
5
 
6
6
  # hai-datapipe
@@ -9,22 +9,18 @@ description: 使用 @h-ai/datapipe 进行文本清洗(HTML/URL/空白移除)
9
9
 
10
10
  | 项目 | 契约 |
11
11
  | --- | --- |
12
- | 能力 | 使用 @h-ai/datapipe 进行文本清洗(HTML/URL/空白移除)、多模式分块(句子/段落/Markdown/字符/自定义)和管线组合;当需求涉及文本预处理、文档分块、数据清洗或 RAG 入库前处理时使用。 |
13
- | 适用场景 | 当任务与 `hai-datapipe` 的能力描述匹配,并且需要遵循本 Skill 的流程和边界时 |
14
- | 输入 | 模块配置、类型化业务参数、依赖初始化状态和目标运行环境 |
15
- | 输出 | 符合模块公共 API 的实现或示例;业务结果使用 HaiResult,并同步必要测试与文档 |
16
- | 限制 | 遵守 init → use → close 生命周期与运行环境边界;不绕过类型、授权、输入校验或敏感信息保护 |
12
+ | 能力 | 使用 @h-ai/datapipe 清洗文本、分块并组合 RAG 入库管线 |
13
+ | 适用场景 | 文档进入检索/知识库前的文本预处理 |
14
+ | 输入 | 文本、清洗/分块选项、管线步骤 |
15
+ | 输出 | 清洗/分块的 HaiResult;管线工厂按签名使用 |
16
+ | 限制 | 纯函数,无 init/close;区分字符数和模型 token 数,分块结果不等于已生成 embedding。 |
17
17
 
18
18
  > `@h-ai/datapipe` 提供文本清洗(clean)、多模式分块(chunk)和可组合管线(pipeline),纯函数模块,无需初始化。
19
19
 
20
- ---
21
-
22
20
  ## 运行环境
23
21
 
24
22
  > **服务端模块(Node.js only)。** 通常在 AI 知识库入库或文档预处理场景中使用,由 `@h-ai/ai` 内部调用或在服务端显式调用。
25
23
 
26
- ---
27
-
28
24
  ## 适用场景
29
25
 
30
26
  - 文本清洗:移除 HTML 标签、URL、Email,标准化空白
@@ -32,8 +28,6 @@ description: 使用 @h-ai/datapipe 进行文本清洗(HTML/URL/空白移除)
32
28
  - RAG 入库前的文档预处理管线
33
29
  - 管线模式组合多步清洗 + 分块 + 自定义转换
34
30
 
35
- ---
36
-
37
31
  ## 使用步骤
38
32
 
39
33
  ### 直接调用(无需 init)
@@ -63,13 +57,11 @@ if (result.success) {
63
57
  }
64
58
  ```
65
59
 
66
- ---
67
-
68
60
  ## 核心 API
69
61
 
70
62
  ### 清洗 — `datapipe.clean`
71
63
 
72
- ```typescript
64
+ ```text
73
65
  datapipe.clean(text: string, options?: CleanOptionsInput): HaiResult<string>
74
66
  ```
75
67
 
@@ -86,7 +78,7 @@ datapipe.clean(text: string, options?: CleanOptionsInput): HaiResult<string>
86
78
 
87
79
  ### 分块 — `datapipe.chunk`
88
80
 
89
- ```typescript
81
+ ```text
90
82
  datapipe.chunk(text: string, options: ChunkOptionsInput): HaiResult<DataChunk[]>
91
83
  ```
92
84
 
@@ -127,7 +119,7 @@ interface DataChunk {
127
119
 
128
120
  ```typescript
129
121
  datapipe.pipeline()
130
- .clean(options?) // 添加清洗步骤
122
+ .clean(options) // 添加清洗步骤
131
123
  .transform(fn) // 添加文本转换步骤(同步/异步)
132
124
  .chunk(options) // 添加分块步骤
133
125
  .chunkTransform(fn) // 添加分块后处理步骤
@@ -143,8 +135,6 @@ interface PipelineResult {
143
135
  }
144
136
  ```
145
137
 
146
- ---
147
-
148
138
  ## 错误码 — `HaiDatapipeError`
149
139
 
150
140
  | 错误码 | code | 说明 |
@@ -156,8 +146,6 @@ interface PipelineResult {
156
146
  | `HaiDatapipeError.CONFIG_ERROR` | `hai:datapipe:005` | 配置错误 |
157
147
  | `HaiDatapipeError.MISSING_SEPARATOR` | `hai:datapipe:006` | 自定义分隔符缺失 |
158
148
 
159
- ---
160
-
161
149
  ## 常见模式
162
150
 
163
151
  ### RAG 文档入库前处理
@@ -221,8 +209,6 @@ if (!result.success) {
221
209
  }
222
210
  ```
223
211
 
224
- ---
225
-
226
212
  ## 相关 Skills
227
213
 
228
214
  - `hai-vecdb`:向量数据库存储(分块后入库)
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: hai-deploy
3
- description: 使用 @h-ai/deploy 进行自动化部署:Vercel 部署 + 基础设施开通(Neon/Upstash/R2/Resend/Aliyun);当需求涉及应用部署、环境配置、凭证管理或云服务开通时使用。
3
+ description: "使用 @h-ai/deploy 配置部署和 Vercel/Neon/Upstash/R2 等基础设施。"
4
4
  ---
5
5
 
6
6
  # hai-deploy
@@ -11,22 +11,18 @@ description: 使用 @h-ai/deploy 进行自动化部署:Vercel 部署 + 基础
11
11
 
12
12
  | 项目 | 契约 |
13
13
  | --- | --- |
14
- | 能力 | 使用 @h-ai/deploy 进行自动化部署:Vercel 部署 + 基础设施开通(Neon/Upstash/R2/Resend/Aliyun);当需求涉及应用部署、环境配置、凭证管理或云服务开通时使用。 |
15
- | 适用场景 | 当任务与 `hai-deploy` 的能力描述匹配,并且需要遵循本 Skill 的流程和边界时 |
16
- | 输入 | 用户目标、仓库与运行环境上下文、现有配置、授权范围和质量门禁 |
17
- | 输出 | 与目标匹配的配置/代码/文档或审查结论,以及可复现的验证结果 |
18
- | 限制 | 不扩张用户授权,不输出或固化密钥,不跳过失败门禁,不假定外部服务状态 |
14
+ | 能力 | 使用 @h-ai/deploy 配置部署和 Vercel/Neon/Upstash/R2 等基础设施 |
15
+ | 适用场景 | 部署目标配置、云资源开通或部署故障排查 |
16
+ | 输入 | 项目构建产物、部署目标、环境配置与凭据引用 |
17
+ | 输出 | 部署/资源操作结果和可验证的目标状态 |
18
+ | 限制 | 核对实际 provider 与应用运行时;开通收费资源、发布或删除必须在用户授权范围内,凭据不写入仓库。 |
19
19
 
20
20
  > `@h-ai/deploy` 提供自动化部署能力,将 SvelteKit 应用部署到 Vercel,并自动开通 PostgreSQL (Neon)、Redis (Upstash)、S3 (Cloudflare R2)、邮件 (Resend)、短信 (阿里云) 等基础设施服务。
21
21
 
22
- ---
23
-
24
22
  ## 运行环境
25
23
 
26
24
  > ⚠️ **Node.js CLI / 服务端模块。** 通过 `hai deploy` CLI 命令或在 Node.js 脚本中使用。
27
25
 
28
- ---
29
-
30
26
  ## 适用场景
31
27
 
32
28
  - 一键部署 SvelteKit 应用到 Vercel
@@ -35,8 +31,6 @@ description: 使用 @h-ai/deploy 进行自动化部署:Vercel 部署 + 基础
35
31
  - 扫描应用依赖,自动检测所需服务
36
32
  - CLI 部署流程(`hai deploy`)
37
33
 
38
- ---
39
-
40
34
  ## 使用步骤
41
35
 
42
36
  ### 1. 配置
@@ -128,8 +122,6 @@ if (result.success) {
128
122
  }
129
123
  ```
130
124
 
131
- ---
132
-
133
125
  ## 核心 API
134
126
 
135
127
  | 方法 | 签名 | 说明 |
@@ -146,16 +138,12 @@ if (result.success) {
146
138
  | `deploy.config` | `DeployConfig \| null` | 当前配置 |
147
139
  | `deploy.isInitialized` | `boolean` | 初始化状态 |
148
140
 
149
- ---
150
-
151
141
  ## 凭证管理
152
142
 
153
143
  所有凭证操作都通过 `deploy.credentials.*` 访问,模块入口不再单独导出自由函数。
154
144
 
155
145
  > `deploy.credentials.*()` 与 `deploy.scan()` 都不依赖 `deploy.init()`,可用于 CLI 在读取 `_deploy.yml` 之前准备环境。
156
146
 
157
- ---
158
-
159
147
  ## 错误码 — `HaiDeployError`
160
148
 
161
149
  | 错误码 | code | 说明 |
@@ -175,8 +163,6 @@ if (result.success) {
175
163
  | `HaiDeployError.CONFIG_ERROR` | `hai:deploy:013` | 配置错误 |
176
164
  | `HaiDeployError.CREDENTIAL_ERROR` | `hai:deploy:014` | 凭证读写失败 |
177
165
 
178
- ---
179
-
180
166
  ## CLI 命令
181
167
 
182
168
  ```bash
@@ -196,8 +182,6 @@ hai deploy --skip-build
196
182
  hai deploy --project-name my-custom-name
197
183
  ```
198
184
 
199
- ---
200
-
201
185
  ## 常见模式
202
186
 
203
187
  ### 仅部署(跳过基础设施)
@@ -229,8 +213,6 @@ await deploy.init({
229
213
  const result = await deploy.deployApp('./apps/my-app')
230
214
  ```
231
215
 
232
- ---
233
-
234
216
  ## 相关 Skills
235
217
 
236
218
  - **hai-core** — 配置加载、日志、HaiResult 类型
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: hai-framework-sync
3
- description: 管理 hai-framework 与应用仓库之间的依赖、技能模板、Copilot/AGENTS 指令和本地联调同步;当需求涉及 hai-framework 源头修改、skills 同步、framework:use:local、framework:watch、版本漂移或双仓 PR 时使用。
3
+ description: "同步 hai-framework 通用 skills、AI 入口与应用依赖,排查 npm/本地联调漂移。"
4
4
  ---
5
5
 
6
6
  # hai-framework-sync — hai-framework 与应用仓库同步规范
@@ -9,16 +9,14 @@ description: 管理 hai-framework 与应用仓库之间的依赖、技能模板
9
9
 
10
10
  | 项目 | 契约 |
11
11
  | --- | --- |
12
- | 能力 | 管理 hai-framework 与应用仓库之间的依赖、技能模板、Copilot/AGENTS 指令和本地联调同步;当需求涉及 hai-framework 源头修改、skills 同步、framework:use:local、framework:watch、版本漂移或双仓 PR 时使用。 |
13
- | 适用场景 | 当任务与 `hai-framework-sync` 的能力描述匹配,并且需要遵循本 Skill 的流程和边界时 |
14
- | 输入 | 用户目标、仓库与运行环境上下文、现有配置、授权范围和质量门禁 |
15
- | 输出 | 与目标匹配的配置/代码/文档或审查结论,以及可复现的验证结果 |
16
- | 限制 | 不扩张用户授权,不输出或固化密钥,不跳过失败门禁,不假定外部服务状态 |
12
+ | 能力 | 同步 hai-framework 通用 skills、AI 入口与应用依赖,排查 npm/本地联调漂移 |
13
+ | 适用场景 | 有明确源/目标仓库的模板或版本同步 |
14
+ | 输入 | 框架源目录、应用目录、版本、现有本地覆盖 |
15
+ | 输出 | 同步后的完整 skill 目录、入口及版本验证结果 |
16
+ | 限制 | 仅操作授权仓库;保留应用私有规则。先查 scripts,不假定 framework:* 联调命令存在;未发布行为不能当 npm 已支持。 |
17
17
 
18
18
  > hai-framework 是能力与 skill 模板源头;应用仓库消费这些能力,并可以有少量项目本地覆盖。同步的目标是减少漂移,而不是把两个仓库混成一个仓库。
19
19
 
20
- ---
21
-
22
20
  ## 适用场景
23
21
 
24
22
  - 修改 `.agents/skills/**`,且内容应成为所有 hai-framework 应用通用规范
@@ -28,8 +26,6 @@ description: 管理 hai-framework 与应用仓库之间的依赖、技能模板
28
26
  - 排查应用仓库与 hai-framework npm 版本不一致
29
27
  - 规划双仓 PR 或同步发布
30
28
 
31
- ---
32
-
33
29
  ## 同步原则
34
30
 
35
31
  1. **通用规范先改 hai-framework**:可复用的 skill、模板、AI 工作流从 `packages/cli/templates/skills/` 起源。
@@ -38,8 +34,6 @@ description: 管理 hai-framework 与应用仓库之间的依赖、技能模板
38
34
  4. **双仓改动要成套**:framework 模板、应用本地 `.agents/skills`、AGENTS/Copilot 路由同时更新。
39
35
  5. **不复制敏感聊天记录**:只同步脱敏后的团队规则和流程。
40
36
 
41
- ---
42
-
43
37
  ## 标准同步流程
44
38
 
45
39
  ### 1. 判断来源
@@ -57,7 +51,7 @@ description: 管理 hai-framework 与应用仓库之间的依赖、技能模板
57
51
 
58
52
  ### 3. 同步到应用仓库
59
53
 
60
- 把源头 skill 复制到应用仓库 `.agents/skills/<skill>/SKILL.md`,并同步入口引用:
54
+ 把源头完整 skill 目录(含 reference.md 等被引用资源)复制到应用仓库 `.agents/skills/<skill>/`,并同步入口引用:
61
55
 
62
56
  - `AGENTS.md`
63
57
  - `.github/copilot-instructions.md`
@@ -70,7 +64,7 @@ description: 管理 hai-framework 与应用仓库之间的依赖、技能模板
70
64
 
71
65
  - 仅模板 / skill 变更:检查 diff、入口引用与模板泛化程度。
72
66
  - 同步到应用仓库:按 `hai-ci` 定义的质量门禁运行。
73
- - 涉及 framework runtime 时,再选择:
67
+ - 涉及 framework runtime 时,先确认应用 package.json 已定义下列脚本;没有时按 README 的本地联调方式操作:
74
68
 
75
69
  ```bash
76
70
  pnpm framework:status
@@ -78,8 +72,6 @@ pnpm framework:use:local <package>
78
72
  pnpm framework:watch <package>
79
73
  ```
80
74
 
81
- ---
82
-
83
75
  ## 漂移检查清单
84
76
 
85
77
  - [ ] framework 模板和应用 `.agents/skills` 对同名 skill 内容一致,除非 PR 明确说明本地覆盖
@@ -89,8 +81,6 @@ pnpm framework:watch <package>
89
81
  - [ ] 本地联调结束后可恢复 npm 模式
90
82
  - [ ] README 或 PR 描述说明双仓改动顺序
91
83
 
92
- ---
93
-
94
84
  ## 禁止事项
95
85
 
96
86
  - ❌ 只改应用 `.agents/skills`,忘记更新 hai-framework 模板中的通用规范
@@ -99,8 +89,6 @@ pnpm framework:watch <package>
99
89
  - ❌ 把聊天记录原文、token、私有 URL 写入模板
100
90
  - ❌ 双仓 PR 没有关联 issue 或同步说明
101
91
 
102
- ---
103
-
104
92
  ## 相关 Skills
105
93
 
106
94
  - `hai-ci` — CI 对 npm/local framework 模式的验证策略