@zhouhao4221/devflow-skills 0.2.0 → 0.3.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.
Files changed (83) hide show
  1. package/README.md +57 -235
  2. package/install.js +406 -116
  3. package/package.json +2 -1
  4. package/plugins/api/skills/api/SKILL.md +102 -0
  5. package/plugins/api/skills/api-field-mapper/SKILL.md +95 -0
  6. package/plugins/api/skills/config/SKILL.md +140 -0
  7. package/plugins/api/skills/gen/SKILL.md +345 -0
  8. package/plugins/api/skills/help/SKILL.md +121 -0
  9. package/plugins/api/skills/import/SKILL.md +95 -0
  10. package/plugins/api/skills/map/SKILL.md +152 -0
  11. package/plugins/api/skills/search/SKILL.md +95 -0
  12. package/plugins/diag/skills/audit/SKILL.md +103 -0
  13. package/plugins/diag/skills/diag/SKILL.md +41 -0
  14. package/plugins/diag/skills/diagnose/SKILL.md +167 -0
  15. package/plugins/diag/skills/init/SKILL.md +142 -0
  16. package/plugins/diag/skills/stack-analyzer/SKILL.md +150 -0
  17. package/plugins/pm/skills/ask/SKILL.md +89 -0
  18. package/plugins/pm/skills/brief/SKILL.md +95 -0
  19. package/plugins/pm/skills/export/SKILL.md +93 -0
  20. package/plugins/pm/skills/help/SKILL.md +257 -0
  21. package/plugins/pm/skills/milestone/SKILL.md +102 -0
  22. package/plugins/pm/skills/monthly/SKILL.md +111 -0
  23. package/plugins/pm/skills/plan/SKILL.md +96 -0
  24. package/plugins/pm/skills/pm/SKILL.md +174 -0
  25. package/plugins/pm/skills/progress/SKILL.md +113 -0
  26. package/plugins/pm/skills/report-generator/SKILL.md +104 -0
  27. package/plugins/pm/skills/risk/SKILL.md +223 -0
  28. package/plugins/pm/skills/standup/SKILL.md +96 -0
  29. package/plugins/pm/skills/stats/SKILL.md +158 -0
  30. package/plugins/pm/skills/weekly/SKILL.md +157 -0
  31. package/plugins/req/skills/branch/SKILL.md +447 -0
  32. package/plugins/req/skills/cache/SKILL.md +232 -0
  33. package/plugins/req/skills/changelog/SKILL.md +187 -0
  34. package/plugins/req/skills/changelog-generator/SKILL.md +106 -0
  35. package/plugins/req/skills/code-impact-analyzer/SKILL.md +48 -0
  36. package/plugins/req/skills/commit/SKILL.md +308 -0
  37. package/plugins/req/skills/dev/SKILL.md +229 -0
  38. package/plugins/req/skills/dev-guide/SKILL.md +530 -0
  39. package/plugins/req/skills/do/SKILL.md +191 -0
  40. package/plugins/req/skills/done/SKILL.md +95 -0
  41. package/plugins/req/skills/edit/SKILL.md +187 -0
  42. package/plugins/req/skills/fix/SKILL.md +300 -0
  43. package/plugins/req/skills/help/SKILL.md +136 -0
  44. package/plugins/req/skills/init/SKILL.md +505 -0
  45. package/plugins/req/skills/issue/SKILL.md +237 -0
  46. package/plugins/req/skills/issue-guide/SKILL.md +125 -0
  47. package/plugins/req/skills/migrate/SKILL.md +128 -0
  48. package/plugins/req/skills/modules/SKILL.md +195 -0
  49. package/plugins/req/skills/natural-language-dispatcher/SKILL.md +545 -0
  50. package/plugins/req/skills/new/SKILL.md +172 -0
  51. package/plugins/req/skills/new-quick/SKILL.md +246 -0
  52. package/plugins/req/skills/pr/SKILL.md +157 -0
  53. package/plugins/req/skills/prd/SKILL.md +187 -0
  54. package/plugins/req/skills/prd-analyzer/SKILL.md +131 -0
  55. package/plugins/req/skills/prd-edit/SKILL.md +201 -0
  56. package/plugins/req/skills/projects/SKILL.md +115 -0
  57. package/plugins/req/skills/quick-fix-guide/SKILL.md +51 -0
  58. package/plugins/req/skills/release/SKILL.md +300 -0
  59. package/plugins/req/skills/release-rationale/SKILL.md +213 -0
  60. package/plugins/req/skills/req/SKILL.md +173 -0
  61. package/plugins/req/skills/requirement-analyzer/SKILL.md +274 -0
  62. package/plugins/req/skills/review/SKILL.md +201 -0
  63. package/plugins/req/skills/review-pr/SKILL.md +699 -0
  64. package/plugins/req/skills/show/SKILL.md +302 -0
  65. package/plugins/req/skills/specs/SKILL.md +99 -0
  66. package/plugins/req/skills/split/SKILL.md +164 -0
  67. package/plugins/req/skills/status/SKILL.md +184 -0
  68. package/plugins/req/skills/test/SKILL.md +431 -0
  69. package/plugins/req/skills/test-guide/SKILL.md +304 -0
  70. package/plugins/req/skills/test_new/SKILL.md +417 -0
  71. package/plugins/req/skills/test_regression/SKILL.md +298 -0
  72. package/plugins/req/skills/update/SKILL.md +131 -0
  73. package/plugins/req/skills/update-template/SKILL.md +203 -0
  74. package/plugins/req/skills/upgrade/SKILL.md +178 -0
  75. package/plugins/req/skills/use/SKILL.md +158 -0
  76. package/plugins/req/skills/version-bumper/SKILL.md +113 -0
  77. package/plugins/uat/skills/bug/SKILL.md +153 -0
  78. package/plugins/uat/skills/init/SKILL.md +88 -0
  79. package/plugins/uat/skills/new/SKILL.md +131 -0
  80. package/plugins/uat/skills/report/SKILL.md +48 -0
  81. package/plugins/uat/skills/run/SKILL.md +78 -0
  82. package/plugins/uat/skills/uat/SKILL.md +64 -0
  83. package/plugins/uat/skills/uat-executor/SKILL.md +299 -0
@@ -0,0 +1,237 @@
1
+ ---
2
+ name: issue
3
+ description: |
4
+ Issue 工作流 - 创建/编辑/关闭/列表/查看/评论 issue
5
+ ---
6
+
7
+ # Issue 工作流
8
+
9
+ 统一管理 GitHub / Gitea issue 的全生命周期:创建、编辑、关闭、重开、列表、查看、评论。
10
+
11
+ > 不受仓库角色限制,readonly 也可执行。不触发缓存同步。
12
+ >
13
+ > **CLI 优先级**:GitHub 走 `gh`;Gitea 按 [`_gitea_cli.md`](./_gitea_cli.md) 检测 `tea`,可用即走 `tea`,否则回退 curl。`tea` 不支持的操作(评论列表、标签增删等)始终走 curl。
14
+
15
+ ---
16
+
17
+ ## 子命令路由
18
+
19
+ | 参数 | 功能 |
20
+ |------|------|
21
+ | `new` | 创建 issue |
22
+ | `edit` | 修改字段 |
23
+ | `close` | 关闭(可附留言) |
24
+ | `reopen` | 重开 |
25
+ | `list` | 列出 |
26
+ | `show` | 查看详情和评论 |
27
+ | `comment` | 添加或列出评论 |
28
+ | 无 / `help` | 打印摘要并终止 |
29
+
30
+ issue 编号支持 `#42` 和 `42` 两种写法。所有子命令都先执行前置检查。
31
+
32
+ ---
33
+
34
+ ## §1 前置检查
35
+
36
+ 读取 `.claude/settings.local.json` 的 `branchStrategy`:
37
+
38
+ | repoType | 要求 | 失败时 |
39
+ |---------|------|-------|
40
+ | `gitea` | `giteaUrl` + `giteaToken` 非空;检测 `tea` 可用性 | 提示执行 `/req:branch init` 后终止 |
41
+ | `github` | `gh` CLI 已安装 | 提示安装 gh 后终止 |
42
+ | `other` / 未配置 | 无 | 写操作输出手动提示;list/show 报错 |
43
+
44
+ OWNER/REPO 从 `git remote get-url origin` 解析,支持 SSH 和 HTTPS 格式,见 [_issue.md](./_issue.md#ownerrepo-解析)。
45
+
46
+ ---
47
+
48
+ ## §2 共用行为
49
+
50
+ ### 2.1 关联需求
51
+
52
+ 写操作可自动附需求上下文。`--req=REQ-XXX` 显式指定,未指定时从当前分支名提取(匹配 `REQ-\d+` / `QUICK-\d+`)。命中后读需求文档,提取元信息(标题/类型/模块/状态)和功能清单首段作摘要。
53
+
54
+ ### 2.2 标签匹配
55
+
56
+ **禁止硬编码中英文对照表**,始终从仓库拉取真实 labels 再匹配。
57
+
58
+ 匹配顺序:完全匹配(忽略大小写)→ 去空格/连字符/下划线后匹配 → 子串包含。
59
+
60
+ 无匹配时询问是否在仓库创建该标签;用户拒绝则跳过,不终止。
61
+
62
+ ### 2.3 指派人解析
63
+
64
+ 从仓库协作者列表匹配,匹配策略同 §2.2。`@me` 自动解析为当前登录用户(GitHub 原生支持,Gitea 需先 `GET /user`)。无匹配时跳过,不终止。
65
+
66
+ ### 2.4 JSON 安全
67
+
68
+ **禁止字符串拼接构造 JSON**,含引号、换行、反斜杠的文本必须用 `python3 -c 'import json,sys; print(json.dumps(sys.stdin.read()))'` 或 `jq -Rs` 转义后再传入请求体。
69
+
70
+ ### 2.5 错误处理
71
+
72
+ | 错误 | 提示 |
73
+ |------|------|
74
+ | 401 / 403 | 鉴权失败,检查 giteaToken 或 gh auth status |
75
+ | 404 | Issue 不存在或仓库路径错误 |
76
+ | 422 | 回显 API message 字段,标出不合法字段 |
77
+ | 423 locked | Issue 已锁定,无法评论/编辑 |
78
+ | curl 非 0 | 请求失败,检查网络后重试 |
79
+
80
+ ### 2.6 `--auto` 模式
81
+
82
+ 检测 `.claude/.req-auto` 且 mtime < 10 分钟时跳过交互确认。`new` 强制预览,不受影响。
83
+
84
+ ---
85
+
86
+ ## §3 new
87
+
88
+ ```
89
+ /req:issue new <标题> [--body=] [--labels=a,b] [--assignees=u1,u2] [--req=REQ-XXX]
90
+ ```
91
+
92
+ **正文生成**:有 `--body` 直接用;无则 AI 生成含「问题描述/复现步骤/预期行为/实际行为/环境信息」的结构化模板,环境信息从 `git branch --show-current` 和 `git rev-parse --short HEAD` 取值。关联需求时在末尾用 `---` 分隔附加需求上下文。
93
+
94
+ **防误关闭**:正文含 `closes #N` / `fixes #N` 时警告,确认后再提交。
95
+
96
+ **强制预览**,不受 `--auto` 影响:
97
+
98
+ ```
99
+ Issue 草稿:
100
+ 仓库:owner/repo (gitea)
101
+ 标题:登录超时后 token 未清除
102
+ 标签:bug, authentication
103
+ 指派:@haiqing
104
+ 关联:REQ-001
105
+
106
+ 正文(前 10 行):...
107
+
108
+ 是否提交?(y/n/e - 编辑某字段)
109
+ ```
110
+
111
+ `e` 可选择修改字段,改完回到预览。
112
+
113
+ 成功输出:
114
+
115
+ ```
116
+ ✅ Issue 已创建
117
+ <url>
118
+ #170 登录超时后 token 未清除
119
+
120
+ /req:fix --from-issue=#170 创建修复
121
+ /req:new --from-issue=#170 创建正式需求
122
+ ```
123
+
124
+ ---
125
+
126
+ ## §4 edit
127
+
128
+ ```
129
+ /req:issue edit #N [--title=] [--body=] [--add-labels=] [--remove-labels=] [--assignees=]
130
+ ```
131
+
132
+ 无字段参数时展示当前状态并提示可用字段,不修改。
133
+
134
+ **Gitea 限制**:labels 必须走独立端点(`POST /labels` 新增、`DELETE /labels/{id}` 逐个删除),不能通过 PATCH body 修改。title/body/assignees 走 PATCH。
135
+
136
+ 预览变更后提交,`--auto` 跳过预览。
137
+
138
+ ---
139
+
140
+ ## §5 close
141
+
142
+ ```
143
+ /req:issue close #N [--comment=<留言>] [--reason=completed|not_planned]
144
+ ```
145
+
146
+ **Gitea 执行顺序**:先发评论再改状态——评论失败不阻止关闭,关闭失败时评论已留痕。
147
+
148
+ **Gitea 不支持 `--reason`**,首次遇到时静默忽略并提示一次(GitHub 专属字段)。
149
+
150
+ ---
151
+
152
+ ## §6 reopen
153
+
154
+ ```
155
+ /req:issue reopen #N
156
+ ```
157
+
158
+ 无预览,直接执行。
159
+
160
+ ---
161
+
162
+ ## §7 list
163
+
164
+ ```
165
+ /req:issue list [--state=open|closed|all] [--labels=] [--assignee=] [--limit=20] [--page=1]
166
+ ```
167
+
168
+ **Gitea 注意**:`type=issues` 在部分版本未完全过滤 PR,需客户端二次过滤 `pull_request != null` 的条目。limit 上限 50。
169
+
170
+ 输出格式:
171
+
172
+ ```
173
+ Open issues @owner/repo(第 1 页 / 20 条)
174
+
175
+ # 状态 标题 标签 指派 更新
176
+
177
+ 170 open 登录超时后 token 未清除 bug @haiqing 2h
178
+ 165 open 导出 Excel 中文乱码 bug, 紧急 - 1d
179
+
180
+ /req:issue list --page=2
181
+ ```
182
+
183
+ ---
184
+
185
+ ## §8 show
186
+
187
+ ```
188
+ /req:issue show #N
189
+ ```
190
+
191
+ 拉取 issue 主体和全部评论,渲染格式:
192
+
193
+ ```
194
+ Issue #170 登录超时后 token 未清除
195
+ 状态:open 作者:@haiqing(2026-04-15 14:32)
196
+ 标签:bug 指派:@haiqing
197
+
198
+ 正文
199
+ ...
200
+
201
+ 评论(共 3 条)
202
+ [1] @alice(15:01) 我能复现。
203
+ [2] @haiqing(16:22)已定位到 src/interceptors/request.ts:45
204
+
205
+ /req:issue comment 170 <文本>
206
+ ```
207
+
208
+ ---
209
+
210
+ ## §9 comment
211
+
212
+ ```
213
+ /req:issue comment #N <评论文本>
214
+ /req:issue comment #N --list
215
+ ```
216
+
217
+ `--list` 仅渲染评论列表,不显示 issue 主体。
218
+
219
+ add 模式:关联需求时评论末尾附需求摘要(用 `---` 分隔)。预览后提交,`--auto` 跳过预览。
220
+
221
+ ---
222
+
223
+ ## 与其他命令的分工
224
+
225
+ | 场景 | 命令 |
226
+ |------|------|
227
+ | 从 issue 派生需求 | `/req:new --from-issue=#N` |
228
+ | 从 issue 派生修复 | `/req:fix --from-issue=#N` |
229
+ | 从 issue 派生任务 | `/req:do --from-issue=#N` |
230
+ | 需求完成时关闭 issue | `/req:done` / `/req:fix` 结束时询问 |
231
+ | commit 自动关联 | message 末尾加 `closes #N` |
232
+
233
+ ---
234
+
235
+ ## 用户输入
236
+
237
+ $ARGUMENTS
@@ -0,0 +1,125 @@
1
+ ---
2
+ name: issue-guide
3
+ description: |
4
+ Issue 操作引导助手。在执行 /req:issue 命令,或需要创建/查看/关闭 GitHub/Gitea
5
+ issue 时触发。提供平台检测、标签匹配、JSON 安全处理等关键约束。
6
+ ---
7
+
8
+ # Issue 操作引导助手
9
+
10
+ 在执行任何 issue 相关操作时激活,确保平台差异、数据安全和交互一致性。
11
+
12
+ ---
13
+
14
+ ## 一、前置:读取平台配置
15
+
16
+ 所有操作开始前,读取 `.claude/settings.local.json` 的 `branchStrategy`:
17
+
18
+ | 字段 | 用途 |
19
+ |------|------|
20
+ | `repoType` | `github` / `gitea` / `other` — 决定使用哪套 CLI |
21
+ | `giteaUrl` | Gitea 实例地址(**必须从配置读取,禁止从 git remote 猜测**) |
22
+ | `giteaToken` | Gitea API Token |
23
+
24
+ **OWNER/REPO 解析**:从 `git remote get-url origin` 提取,去掉 `.git` 后缀取最后两段路径。支持 SSH(`git@host:owner/repo.git`)和 HTTPS(`https://host/owner/repo.git`)。
25
+
26
+ **未配置时**:提示执行 `/req:branch init`,终止操作。
27
+
28
+ ---
29
+
30
+ ## 二、CLI 优先级
31
+
32
+ | 平台 | 优先 | 回退 |
33
+ |------|------|------|
34
+ | GitHub | `gh` | — |
35
+ | Gitea | `tea`(先检测可用性) | `curl + giteaToken` |
36
+
37
+ `tea` 不支持的操作(评论列表、标签增删)始终走 `curl`。
38
+
39
+ ---
40
+
41
+ ## 三、关键约束
42
+
43
+ ### 3.1 JSON 安全(必须遵守)
44
+
45
+ **禁止字符串拼接构造 JSON**。含引号、换行、反斜杠的文本必须转义后再传入请求体:
46
+
47
+ ```bash
48
+ # 方法 A:python3
49
+ python3 -c 'import json,sys; print(json.dumps(sys.stdin.read()))' <<< "$body"
50
+
51
+ # 方法 B:jq
52
+ echo "$body" | jq -Rs .
53
+ ```
54
+
55
+ ### 3.2 标签匹配
56
+
57
+ **禁止硬编码中英文对照表**,始终从仓库拉取真实 labels 再匹配:
58
+
59
+ 1. 完全匹配(忽略大小写)
60
+ 2. 去空格/连字符/下划线后匹配
61
+ 3. 子串包含匹配
62
+
63
+ 无匹配时:询问用户是否在仓库创建该标签;拒绝则跳过(不终止操作)。
64
+
65
+ ### 3.3 Gitea labels 限制
66
+
67
+ Gitea 的 labels **不能**通过 PATCH body 修改,必须走独立端点:
68
+ - 新增:`POST /repos/{owner}/{repo}/issues/{index}/labels`
69
+ - 删除:`DELETE /repos/{owner}/{repo}/issues/{index}/labels/{id}`(逐个删除)
70
+ - title / body / assignees 走 `PATCH /repos/{owner}/{repo}/issues/{index}`
71
+
72
+ ### 3.4 指派人解析
73
+
74
+ 从仓库协作者列表匹配(策略同 §3.2)。`@me` 自动解析为当前登录用户(GitHub 原生支持,Gitea 需先 `GET /user`)。无匹配时跳过,不终止。
75
+
76
+ ### 3.5 Gitea list 过滤
77
+
78
+ `GET /issues?type=issues` 在部分 Gitea 版本未完全过滤 PR,需客户端二次过滤掉 `pull_request != null` 的条目。limit 上限 50。
79
+
80
+ ---
81
+
82
+ ## 四、关联需求上下文
83
+
84
+ 写操作(new / edit / comment)可附需求摘要:
85
+
86
+ - `--req=REQ-XXX` 显式指定
87
+ - 未指定时从当前分支名提取(匹配 `REQ-\d+` / `QUICK-\d+`)
88
+ - 命中后读需求文档,提取标题/类型/模块/状态和功能清单首段
89
+
90
+ ---
91
+
92
+ ## 五、new 操作 — 正文生成
93
+
94
+ 无 `--body` 时 AI 生成结构化模板,包含:
95
+
96
+ - 问题描述 / 复现步骤 / 预期行为 / 实际行为
97
+ - 环境信息:从 `git branch --show-current` 和 `git rev-parse --short HEAD` 取值
98
+
99
+ **强制预览**(不受 `--auto` 影响):展示草稿,等待用户 y/n/e 确认。
100
+
101
+ 成功后输出:
102
+ ```
103
+ ✅ Issue 已创建
104
+ 🔗 <url>
105
+
106
+ 💡 /req:fix --from-issue=#N 创建修复
107
+ 💡 /req:new --from-issue=#N 创建正式需求
108
+ ```
109
+
110
+ ---
111
+
112
+ ## 六、close 操作 — Gitea 执行顺序
113
+
114
+ 先发评论 → 再改状态(评论失败不阻止关闭)。`--reason` 是 GitHub 专属字段,Gitea 静默忽略并提示一次。
115
+
116
+ ---
117
+
118
+ ## 七、与其他命令的分工
119
+
120
+ | 需求 | 命令 |
121
+ |------|------|
122
+ | 从 issue 派生需求 | `/req:new --from-issue=#N` |
123
+ | 从 issue 派生修复 | `/req:fix --from-issue=#N` |
124
+ | 需求完成时关闭 issue | `/req:done` 结束时询问 |
125
+ | commit 自动关联 | message 末尾加 `closes #N` |
@@ -0,0 +1,128 @@
1
+ ---
2
+ name: migrate
3
+ description: |
4
+ 迁移需求 - 将本地需求迁移到全局缓存
5
+ ---
6
+
7
+ # 迁移需求
8
+
9
+ 将本地 `docs/requirements/` 中的需求迁移到全局缓存。
10
+
11
+ ## 命令格式
12
+
13
+ ```
14
+ /req:migrate <project-name> [--keep]
15
+ ```
16
+
17
+ ## 参数
18
+
19
+ - `project-name`: 目标项目名称(必填)
20
+ - `--keep`: 保留本地文件(可选,默认删除)
21
+
22
+ ---
23
+
24
+ ## 执行流程
25
+
26
+ ### 1. 前置检查
27
+
28
+ `docs/requirements/active` 和 `completed` 均不存在时报错退出,提示使用 `/req:init`。统计本地活跃/已完成需求数量。
29
+
30
+ ### 2. 检查目标项目
31
+
32
+ 目标路径 `~/.claude-requirements/projects/<project-name>/`。项目不存在时自动创建;已存在且有需求文档时,询问合并策略:合并(编号冲突时重新编号)、覆盖、取消。
33
+
34
+ ### 3. 显示迁移预览
35
+
36
+ ```
37
+ 需求迁移预览
38
+
39
+ 源目录: docs/requirements/
40
+ 目标项目: <project-name>
41
+ 目标路径: ~/.claude-requirements/projects/<project-name>/
42
+
43
+ 迁移内容:
44
+ - 活跃需求: X 个
45
+ - 已完成需求: Y 个
46
+ - 模板文件: 1 个
47
+
48
+ 文件列表:
49
+ 活跃需求:
50
+ REQ-001-部门渠道关联.md
51
+ REQ-002-用户积分系统.md
52
+ REQ-003-订单导出优化.md
53
+
54
+ 已完成:
55
+ REQ-000-初始化项目.md
56
+ ```
57
+
58
+ ### 4. 执行迁移
59
+
60
+ 将 active/、completed/、templates/(如存在)分别复制到目标项目对应目录。
61
+
62
+ ### 5. 处理编号冲突(合并模式)
63
+
64
+ 如果目标项目已有需求,检查编号冲突:
65
+
66
+ ```
67
+ ⚠️ 检测到编号冲突
68
+
69
+ 冲突列表:
70
+ - REQ-001 (本地: 部门渠道关联 vs 远程: 用户管理)
71
+ - REQ-002 (本地: 用户积分系统 vs 远程: 权限配置)
72
+
73
+ 处理方式:
74
+ - REQ-001 → 保留远程,本地重命名为 REQ-004
75
+ - REQ-002 → 保留远程,本地重命名为 REQ-005
76
+ ```
77
+
78
+ ### 6. 绑定当前仓库
79
+
80
+ > 写入规范见 [_storage.md](./_storage.md#settingslocaljson-写入规范)。
81
+
82
+ 读取已有 `.claude/settings.local.json`,合并以下字段后写回(不覆盖已有的 `branchStrategy` 等字段):
83
+
84
+ ```json
85
+ {
86
+ "requirementProject": "<project-name>"
87
+ }
88
+ ```
89
+
90
+ ### 7. 清理本地文件(默认行为)
91
+
92
+ 无 `--keep` 时删除本地 active/、completed/、templates/ 目录。指定 `--keep` 时保留并提示手动清理命令。
93
+
94
+ ### 8. 输出结果
95
+
96
+ ```
97
+ ✅ 迁移完成!
98
+
99
+ 迁移统计:
100
+ - 迁移活跃需求: X 个
101
+ - 迁移已完成需求: Y 个
102
+ - 重新编号: Z 个
103
+
104
+ 新位置: ~/.claude-requirements/projects/<project-name>/
105
+
106
+ 当前仓库已绑定到项目 "<project-name>"
107
+
108
+ 下一步:
109
+ - 查看需求列表: /req
110
+ - 在其他仓库绑定: /req:use <project-name>
111
+ ```
112
+
113
+ ---
114
+
115
+ ## 错误处理
116
+
117
+ | 错误场景 | 处理方式 |
118
+ |---------|---------|
119
+ | 本地无需求 | 提示使用 `/req:init` |
120
+ | 目标项目有冲突 | 提供合并策略选择 |
121
+ | 权限不足 | 提示检查目录权限 |
122
+ | 迁移中断 | 回滚已迁移文件 |
123
+
124
+ ---
125
+
126
+ ## 用户输入
127
+
128
+ $ARGUMENTS
@@ -0,0 +1,195 @@
1
+ ---
2
+ name: modules
3
+ description: |
4
+ 模块管理 - 列出所有模块及其需求概览
5
+ ---
6
+
7
+ # 模块管理
8
+
9
+ 列出所有模块及其关联的需求,支持创建和查看模块文档。
10
+
11
+ ## 命令格式
12
+
13
+ ```
14
+ /req:modules [子命令] [模块名]
15
+ ```
16
+
17
+ ## 子命令
18
+
19
+ | 子命令 | 说明 | 示例 |
20
+ |--------|------|------|
21
+ | (空) | 列出所有模块概览 | `/req:modules` |
22
+ | `new` | 创建新模块文档 | `/req:modules new 用户模块` |
23
+ | `show` | 查看模块详情 | `/req:modules show user` |
24
+
25
+ ---
26
+
27
+ ## 存储路径
28
+
29
+ ```
30
+ <需求根目录>/
31
+ modules/ # 模块文档目录
32
+ user.md # 用户模块
33
+ order.md # 订单模块
34
+ ...
35
+ active/ # 进行中的需求
36
+ completed/ # 已完成的需求
37
+ INDEX.md # 需求索引(自动生成)
38
+ ```
39
+
40
+ ---
41
+
42
+ ## 执行流程(列表模式)
43
+
44
+ ### 1. 扫描模块目录
45
+
46
+ 优先使用 `docs/requirements/modules/`;若已绑定项目则同时扫描 `~/.claude-requirements/projects/$PROJECT/modules/`。
47
+
48
+ ### 2. 解析模块文档
49
+
50
+ 从每个模块文档提取:
51
+ - 模块名称
52
+ - 核心功能数量
53
+ - 关联需求列表及状态
54
+
55
+ ### 3. 扫描需求文档
56
+
57
+ 从需求元信息中提取模块字段,统计各模块的需求分布。
58
+
59
+ ### 4. 展示模块列表
60
+
61
+ ```
62
+ 模块概览
63
+
64
+ | 模块 | 功能数 | 需求 | 开发中 | 已完成 |
65
+ |------|--------|------|--------|--------|
66
+ | 用户模块 | 8 | 5 | 1 | 4 |
67
+ | 订单模块 | 12 | 8 | 2 | 6 |
68
+ | 支付模块 | 6 | 3 | 0 | 3 |
69
+
70
+ 可用操作:
71
+ - /req:modules show user - 查看用户模块详情
72
+ - /req:modules new 新模块 - 创建新模块
73
+ - /req --module=user - 筛选用户模块的需求
74
+ ```
75
+
76
+ ---
77
+
78
+ ## 创建模块(new)
79
+
80
+ ### 流程
81
+
82
+ 1. 检查模块是否已存在
83
+ 2. 从模板创建模块文档
84
+ 3. 引导填写模块信息
85
+
86
+ ### 示例
87
+
88
+ ```
89
+ /req:modules new 积分模块
90
+ ```
91
+
92
+ 输出:
93
+
94
+ ```
95
+ 创建模块:积分模块
96
+
97
+ 已创建模块文档:docs/requirements/modules/points.md
98
+
99
+ 请完善以下信息:
100
+ 1. 模块概述 - 描述核心职责
101
+ 2. 业务规则 - 列出关键约束
102
+ 3. 关键文件 - 标注代码位置
103
+
104
+ 创建需求时可关联此模块:/req:new --module=积分模块
105
+ ```
106
+
107
+ ---
108
+
109
+ ## 查看模块详情(show)
110
+
111
+ ### 流程
112
+
113
+ 1. 读取模块文档
114
+ 2. 扫描关联需求的最新状态
115
+ 3. 展示模块完整信息
116
+
117
+ ### 示例
118
+
119
+ ```
120
+ /req:modules show user
121
+ ```
122
+
123
+ 输出:
124
+
125
+ ```
126
+ 用户模块
127
+
128
+ ## 概述
129
+ 管理用户账户、认证、权限
130
+
131
+ ## 核心功能
132
+ | 功能 | 需求 | 状态 |
133
+ |------|------|------|
134
+ | 注册登录 | REQ-001 | ✅ 已完成 |
135
+ | 个人信息 | REQ-003 | ✅ 已完成 |
136
+ | 密码重置 | REQ-007 | 开发中 |
137
+ | 用户积分 | REQ-012 | 草稿 |
138
+
139
+ ## 业务规则
140
+ - 手机号唯一
141
+ - 密码至少 8 位
142
+ - 积分有效期 1 年
143
+
144
+ ## 关键文件
145
+ - internal/user/model/
146
+ - internal/user/biz/
147
+ - internal/user/controller/
148
+
149
+ 可用操作:
150
+ - /req:dev REQ-007 - 继续开发密码重置
151
+ - /req:new --module=用户模块 - 创建新需求
152
+ ```
153
+
154
+ ---
155
+
156
+ ## 与其他命令集成
157
+
158
+ ### /req:new
159
+
160
+ 创建需求时选择模块:
161
+
162
+ ```
163
+ /req:new 用户积分系统 --module=用户模块,订单模块
164
+ ```
165
+
166
+ 或在创建过程中交互选择。
167
+
168
+ ### /req
169
+
170
+ 列出需求时按模块筛选:
171
+
172
+ ```
173
+ /req --module=用户模块
174
+ ```
175
+
176
+ ### /req:done
177
+
178
+ 完成需求时自动更新模块文档的功能状态。
179
+
180
+ ---
181
+
182
+ ## 索引自动更新
183
+
184
+ 当以下操作发生时,自动更新 `INDEX.md`:
185
+
186
+ - `/req:new` - 新增需求
187
+ - `/req:done` - 完成需求
188
+ - `/req:modules new` - 新增模块
189
+ - 需求状态变更
190
+
191
+ ---
192
+
193
+ ## 用户输入
194
+
195
+ $ARGUMENTS