yunxiao-code 1.2.0 → 1.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.
package/README.md CHANGED
@@ -1,311 +1,219 @@
1
- # yx-code
1
+ # yx-commands
2
2
 
3
- 阿里云云效 CLI 工具,支持 Git 提交、推送、克隆及创建合并请求,让开发者可以在终端中完成日常开发工作流,无需打开浏览器。
3
+ 阿里云云效代码仓库 yx-commands Skills,基于 [Agent Skills](https://agentskills.io/) 开放标准,让 Claude Code、Cursor 等 AI 编程工具可以自动完成代码提交、推送、创建合并请求、工作项查询和工作总结等开发工作流。
4
4
 
5
5
  ## 功能特性
6
6
 
7
- - 🚀 **克隆仓库** - 支持从主分支自动创建新分支
8
- - 📝 **提交代码** - 一键 add + commit
9
- - 📤 **推送代码** - 自动推送当前分支到远程
10
- - 🔀 **合并请求** - 快速创建 MR,支持指定目标分支
11
- - 📊 **代码差异** - 查看分支间的代码差异统计
12
- - 🤖 **AI Agent 集成** - 基于 Agent Skills 标准,兼容 Claude Code、Cursor 等 AI 编程工具
7
+ - 🤖 **智能提交** - AI 分析代码变更,自动生成 commit message
8
+ - 📤 **自动推送** - 推送当前分支到远程仓库
9
+ - 🔀 **创建 MR** - 自动创建合并请求,默认目标分支 develop
10
+ - 📊 **代码审查** - 查看分支间的代码差异统计
11
+ - **一键工作流** - 提交 → 推送 → 创建 MR 一条龙完成
12
+ - 📋 **工作项查询** - 列出我负责或参与的工作项,支持状态/角色/项目过滤
13
+ - 📈 **工作总结** - 生成周报/月报/季报/年报,支持 JSON 输出供 AI 分析
13
14
 
14
15
  ## 安装
15
16
 
16
- ### npm 安装(推荐)
17
-
18
17
  ```bash
19
18
  npm install -g yunxiao-code
20
19
  ```
21
20
 
22
- 支持平台:
23
- - macOS (Intel/Apple Silicon)
24
- - Linux (x64)
25
-
26
- ### 从源码编译
27
-
28
- ```bash
29
- git clone https://github.com/ZLStream/yunxiao-code.git
30
- cd yunxiao-code
31
- make build-local
32
- sudo make install
33
- ```
21
+ 安装后自动部署 skill 到 `~/.claude/skills/`,Claude Code 和 Cursor 会自动加载。
34
22
 
35
- 或手动编译:
36
-
37
- ```bash
38
- go build -o yx-code ./cmd/yx-code
39
- sudo mv yx-code /usr/local/bin/
40
- ```
41
-
42
- #### 安装 AI Agent 插件(可选)
43
-
44
- 如需使用斜杠命令,手动为每个 skill 创建软链接:
45
-
46
- ```bash
47
- for dir in claude-plugin/skills/*/; do
48
- ln -s "$(pwd)/$dir" ~/.claude/skills/"$(basename $dir)"
49
- done
50
- ```
51
-
52
- 安装后可在 Claude Code 或 Cursor Agent 中使用:
53
- - `/yx-commands-commit` - 分析代码变更并提交
54
- - `/yx-commands-push` - 推送代码
55
- - `/yx-commands-mr` - 创建合并请求
56
- - `/yx-commands-review` - 查看代码差异
57
- - `/yx-commands-commit-push-mr` - 一键完成完整工作流
58
-
59
- ## 系统要求
60
-
61
- - Go 1.26.1+(从源码编译时)
62
- - Git CLI(运行时依赖)
63
- - Node.js 14+(npm 安装时)
23
+ 支持平台:macOS (Intel/Apple Silicon)、Linux (x64)
64
24
 
65
25
  ## 快速开始
66
26
 
67
- ### 1. 初始化配置
27
+ ### 初始化配置
68
28
 
69
29
  ```bash
70
30
  yx-code init
71
31
  ```
72
32
 
73
- 在当前目录生成 `.yunxiao.yaml` 配置文件:
33
+ `~/.yunxiao/config.yaml` 生成全局配置文件,填写 `organization_id` 和 `token`:
74
34
 
75
35
  ```yaml
76
- # 云效合并请求 CLI 配置
77
36
  domain: openapi-rdc.aliyuncs.com
78
- organization_id: ""
79
- token: ""
37
+ organization_id: "你的组织ID"
38
+ token: "你的个人访问令牌"
80
39
  ```
81
40
 
82
- 填写 `organization_id` 和 `token`(个人访问令牌)。
83
-
84
41
  > **获取 Token**: 云效控制台 → 个人设置 → 个人访问令牌 → 创建令牌
85
42
 
86
- ### 2. 配置项说明
87
-
88
- | 字段 | 说明 | 默认值 |
89
- |------|------|--------|
90
- | `domain` | 云效 API 域名 | `openapi-rdc.aliyuncs.com` |
91
- | `organization_id` | 组织 ID(必填) | 无 |
92
- | `token` | 个人访问令牌(必填) | 无 |
43
+ > **user_id 无需手动配置**,首次使用工作项功能时会通过 token 自动获取并缓存。
93
44
 
94
- ### 3. 环境变量配置
45
+ ### 一键提交(推荐)
95
46
 
96
- 也可以通过环境变量配置:
47
+ 开发完成后,直接输入:
97
48
 
98
- ```bash
99
- export YUNXIAO_DOMAIN="openapi-rdc.aliyuncs.com"
100
- export YUNXIAO_ORGANIZATION_ID="your-org-id"
101
- export YUNXIAO_TOKEN="your-token"
102
49
  ```
103
-
104
- ### 4. 配置优先级(从低到高)
105
-
106
- 1. 默认值
107
- 2. `.yunxiao.yaml` 配置文件(从当前目录向上逐级查找)
108
- 3. 环境变量:`YUNXIAO_DOMAIN`、`YUNXIAO_ORGANIZATION_ID`、`YUNXIAO_TOKEN`
109
- 4. CLI 参数:`--domain`、`--org`、`--token`
110
-
111
- ## 命令参考
112
-
113
- ### yx-code init
114
-
115
- 初始化云效配置文件。
116
-
117
- ```bash
118
- yx-code init
50
+ /yx-commands-commit-push-mr
119
51
  ```
120
52
 
121
- ### yx-code clone
53
+ AI 自动完成:分析变更 → 提交 → 推送 → 创建 MR
122
54
 
123
- 克隆云效代码仓库。
55
+ ### 生成周报
124
56
 
125
- ```bash
126
- yx-code clone <git-url> [flags]
57
+ ```
58
+ /yx-commands-summary
127
59
  ```
128
60
 
129
- | 参数 | 简写 | 必填 | 说明 |
130
- |------|------|------|------|
131
- | `<git-url>` | | 是 | Git 仓库地址 |
132
- | `--branch` | `-b` | 否 | 新分支名称,指定后会从主分支创建新分支 |
133
- | `--path` | `-p` | 否 | 克隆目标路径,默认从 URL 提取仓库名 |
61
+ AI 获取工作项数据,自动生成工作总结。
134
62
 
135
- ```bash
136
- # 基本克隆
137
- yx-code clone https://codeup.aliyun.com/your-org/your-repo.git
63
+ ## Skill 命令
138
64
 
139
- # 克隆并创建新分支
140
- yx-code clone https://codeup.aliyun.com/your-org/your-repo.git -b feature/new-feature
141
- ```
65
+ | 命令 | 功能 | 使用场景 |
66
+ |------|------|----------|
67
+ | `/yx-commands-commit` | 智能提交 | AI 分析变更生成 commit message |
68
+ | `/yx-commands-push` | 推送代码 | 推送当前分支到远程 |
69
+ | `/yx-commands-mr` | 创建 MR | 创建合并请求(默认目标 develop) |
70
+ | `/yx-commands-review` | 代码审查 | 查看分支差异统计 |
71
+ | `/yx-commands-commit-push-mr` | 完整工作流 | 一键完成提交、推送、创建 MR |
72
+ | `/yx-commands-workitems` | 查询工作项 | 列出我负责/参与的工作项 |
73
+ | `/yx-commands-summary` | 工作总结 | 生成周报/月报/季报/年报 |
142
74
 
143
- ### yx-code commit
75
+ ## 典型工作流
144
76
 
145
- 提交代码变更。
77
+ ### 一键完成
146
78
 
147
- ```bash
148
- yx-code commit -m "<message>"
149
79
  ```
150
-
151
- | 参数 | 简写 | 必填 | 说明 |
152
- |------|------|------|------|
153
- | `--message` | `-m` | 是 | 提交信息 |
154
-
155
- ```bash
156
- yx-code commit -m "feat: 添加用户登录功能"
80
+ /yx-commands-commit-push-mr
157
81
  ```
158
82
 
159
- ### yx-code push
83
+ AI 会自动:
84
+ 1. 分析代码变更,生成 commit message
85
+ 2. 执行 `git add .` 和 `git commit`
86
+ 3. 推送到远程仓库
87
+ 4. 创建合并请求
160
88
 
161
- 推送当前分支到远程仓库。
89
+ ### 分步执行
162
90
 
163
- ```bash
164
- yx-code push
91
+ ```
92
+ /yx-commands-commit → AI 分析变更并提交
93
+ /yx-commands-push → 推送到远程
94
+ /yx-commands-mr → 创建合并请求
165
95
  ```
166
96
 
167
- ### yx-code mr
97
+ ### 代码审查
168
98
 
169
- 创建合并请求。
99
+ 查看当前分支与目标分支的差异:
170
100
 
171
- ```bash
172
- yx-code mr -m "<title>" [flags]
101
+ ```
102
+ /yx-commands-review
173
103
  ```
174
104
 
175
- | 参数 | 简写 | 必填 | 说明 |
176
- |------|------|------|------|
177
- | `--message` | `-m` | 是 | MR 标题 |
178
- | `--description` | `-d` | 否 | MR 描述 |
179
- | `--target` | `-t` | 否 | 目标分支,默认: develop |
105
+ ### 工作总结
180
106
 
181
107
  ```bash
182
- # 基本用法(目标分支默认 develop)
183
- yx-code mr -m "添加用户登录功能"
108
+ # 交互式选择时间范围
109
+ /yx-commands-summary
184
110
 
185
- # 指定目标分支
186
- yx-code mr -m "添加用户登录功能" -t develop
111
+ # 指定时间周期
112
+ yx-code summary --period week # 本周
113
+ yx-code summary --period month # 本月
114
+ yx-code summary --period quarter # 本季度
115
+ yx-code summary --period year # 本年
187
116
 
188
- # 带描述
189
- yx-code mr -m "添加用户登录功能" -d "实现用户登录、注销功能"
190
- ```
117
+ # 自定义时间范围
118
+ yx-code summary --start 2024-01-01 --end 2024-03-31
191
119
 
192
- ### yx-code diff
120
+ # JSON 格式输出(AI 友好)
121
+ yx-code summary --period month --json
122
+ ```
193
123
 
194
- 查看分支间的代码差异统计。
124
+ ### 工作项查询
195
125
 
196
126
  ```bash
197
- yx-code diff [flags]
198
- ```
127
+ # 列出我负责的进行中工作项(默认)
128
+ yx-code workitems
199
129
 
200
- | 参数 | 简写 | 必填 | 说明 |
201
- |------|------|------|------|
202
- | `--target` | `-t` | 否 | 目标分支,默认: develop |
203
- | `--source` | `-s` | 否 | 源分支,默认: 当前分支 |
130
+ # 按角色和状态过滤
131
+ yx-code workitems --role participated --status all
132
+ yx-code workitems --role assigned --status done
204
133
 
205
- ```bash
206
- # 查看当前分支与 develop 的差异
207
- yx-code diff
134
+ # 指定项目
135
+ yx-code workitems --project <项目标识符>
208
136
 
209
- # 指定分支
210
- yx-code diff -t main -s feature/new-feature
137
+ # JSON 格式输出
138
+ yx-code workitems --json
211
139
  ```
212
140
 
213
- ### 全局参数
141
+ ## 配置
214
142
 
215
- 所有子命令支持以下全局参数,用于覆盖配置文件:
143
+ ### 配置文件
216
144
 
217
- ```bash
218
- yx-code <command> --domain <域名> --org <组织ID> --token <令牌>
145
+ 配置统一存放在 `~/.yunxiao/config.yaml`:
146
+
147
+ ```yaml
148
+ domain: openapi-rdc.aliyuncs.com
149
+ organization_id: "你的组织ID"
150
+ token: "你的个人访问令牌"
151
+ user_id: "" # 自动获取,无需手动填写
219
152
  ```
220
153
 
221
- | 参数 | 说明 |
222
- |------|------|
223
- | `--domain` | 云效 API 域名 |
224
- | `--org` | 组织 ID |
225
- | `--token` | 个人访问令牌 |
154
+ | 字段 | 说明 | 默认值 |
155
+ |------|------|--------|
156
+ | `domain` | 云效 API 域名 | `openapi-rdc.aliyuncs.com` |
157
+ | `organization_id` | 组织 ID(必填) | 无 |
158
+ | `token` | 个人访问令牌(必填) | 无 |
159
+ | `user_id` | 用户 ID | 自动获取 |
226
160
 
227
- ## 工作流示例
161
+ ### 环境变量
228
162
 
229
163
  ```bash
230
- # 1. 初始化配置
231
- yx-code init
232
- # 编辑 .yunxiao.yaml 填写凭证
233
-
234
- # 2. 克隆仓库并创建特性分支
235
- yx-code clone https://codeup.aliyun.com/org/repo.git -b feature/login
164
+ export YUNXIAO_ORGANIZATION_ID="your-org-id"
165
+ export YUNXIAO_TOKEN="your-token"
166
+ ```
236
167
 
237
- # 3. 进入仓库目录
238
- cd repo
168
+ ### 配置优先级(从低到高)
239
169
 
240
- # 4. 开发完成后提交
241
- yx-code commit -m "feat: 实现登录功能"
170
+ 1. 默认值
171
+ 2. `~/.yunxiao/config.yaml` 全局配置文件
172
+ 3. 环境变量:`YUNXIAO_DOMAIN`、`YUNXIAO_ORGANIZATION_ID`、`YUNXIAO_TOKEN`、`YUNXIAO_USER_ID`
173
+ 4. CLI 参数:`--domain`、`--org`、`--token`
242
174
 
243
- # 5. 推送到远程
244
- yx-code push
175
+ ## CLI 命令
245
176
 
246
- # 6. 创建合并请求
247
- yx-code mr -m "添加用户登录功能"
177
+ Skill 底层通过 `yx-code` CLI 与云效 API 交互:
248
178
 
249
- # 7. 查看代码差异
250
- yx-code diff
179
+ ```bash
180
+ yx-code init # 初始化配置 (~/.yunxiao/config.yaml)
181
+ yx-code clone <url> -b <branch> # 克隆仓库并创建分支
182
+ yx-code commit -m "msg" # 提交代码
183
+ yx-code push # 推送代码
184
+ yx-code mr -m "title" # 创建合并请求
185
+ yx-code diff # 查看代码差异
186
+ yx-code workitems # 列出工作项
187
+ yx-code summary --period week # 生成工作总结
251
188
  ```
252
189
 
253
- ## AI Agent 集成
254
-
255
- 本工具基于 [Agent Skills](https://agentskills.io/) 开放标准,兼容 Claude Code、Cursor 等支持该标准的 AI 编程工具,可通过斜杠命令自动化云效工作流。
256
-
257
- ### 兼容性
190
+ ## 兼容性
258
191
 
259
192
  | 工具 | 支持 | 说明 |
260
193
  |------|------|------|
261
- | [Claude Code](https://claude.ai/code) | ✅ | 原生支持,从 `~/.claude/skills/` 加载 |
262
- | [Cursor](https://cursor.com) | ✅ | 兼容加载 `~/.claude/skills/` 目录 |
263
-
264
- ### 可用命令
265
-
266
- | 命令 | 功能 |
267
- |------|------|
268
- | `/yx-commands-commit` | 分析代码变更并提交 |
269
- | `/yx-commands-push` | 推送代码到远程 |
270
- | `/yx-commands-mr` | 创建合并请求 |
271
- | `/yx-commands-review` | 查看分支代码差异 |
272
- | `/yx-commands-commit-push-mr` | 一键完成提交、推送、创建MR |
273
-
274
- ### 使用示例
275
-
276
- 在 Claude Code 或 Cursor Agent 中直接输入命令:
277
-
278
- ```
279
- /yx-commands-commit-push-mr
280
- ```
281
-
282
- AI 会自动:
283
- 1. 分析代码变更
284
- 2. 生成 commit message
285
- 3. 执行 commit、push
286
- 4. 创建合并请求
194
+ | [Claude Code](https://claude.ai/code) | ✅ | 原生支持 Agent Skills |
195
+ | [Cursor](https://cursor.com) | ✅ | 兼容 `~/.claude/skills/` 目录 |
287
196
 
288
- ### 安装
197
+ ## 从源码安装
289
198
 
290
- npm 安装后自动将每个 skill 部署为独立符号链接到 `~/.claude/skills/`:
199
+ ```bash
200
+ git clone https://github.com/ZLStream/yunxiao-commands.git
201
+ cd yunxiao-commands
202
+ make build-local
203
+ sudo make install
291
204
 
205
+ # 手动链接 skills
206
+ for dir in claude-plugin/skills/*/; do
207
+ ln -s "$(pwd)/$dir" ~/.claude/skills/"$(basename $dir)"
208
+ done
292
209
  ```
293
- ~/.claude/skills/
294
- ├── yx-commands/ ← 主 skill(工作流路由)
295
- ├── yx-commands-commit/ ← 提交命令
296
- ├── yx-commands-push/ ← 推送命令
297
- ├── yx-commands-mr/ ← 创建 MR
298
- ├── yx-commands-review/ ← 代码审查
299
- └── yx-commands-commit-push-mr/ ← 一键完整工作流
300
- ```
301
-
302
- Cursor 会自动从 `~/.claude/skills/` 加载,无需额外配置。
303
210
 
304
211
  ## 相关链接
305
212
 
213
+ - [Agent Skills 标准](https://agentskills.io/)
306
214
  - [阿里云云效官方文档](https://help.aliyun.com/zh/yunxiao/)
307
215
  - [云效 OpenAPI 文档](https://help.aliyun.com/zh/yunxiao/developer-reference/)
308
216
 
309
217
  ## License
310
218
 
311
- MIT
219
+ MIT
package/bin/yx-code CHANGED
Binary file
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: yx-commands
3
- description: 阿里云云效(codeup)代码仓库工作流自动化。功能包括:智能提交代码、推送、创建MR(合并请求)、代码审查、分支差异对比。触发场景:用户提到云效、codeup、阿里云代码仓库、yx-code工具;git地址以git@codeup.aliyun.com开头;需要提交代码并创建MR;说"提交合并"触发完整工作流。注意:github相关操作或纯git命令不要使用此技能。
3
+ description: 阿里云云效(codeup)代码仓库工作流自动化。功能包括:智能提交代码、推送、创建MR(合并请求)、代码审查、分支差异对比、工作项查询、工作总结生成。触发场景:用户提到云效、codeup、阿里云代码仓库、yx-code工具;git地址以git@codeup.aliyun.com开头;需要提交代码并创建MR;说"提交合并"触发完整工作流;说"工作总结""周报""月报"触发总结功能。注意:github相关操作或纯git命令不要使用此技能。
4
4
  tools: Bash, Read
5
5
  ---
6
6
 
@@ -31,6 +31,8 @@ tools: Bash, Read
31
31
  | `/yx-commands-mr` | 创建 MR | 提交合并请求(默认 develop) |
32
32
  | `/yx-commands-review` | 代码审查 | 查看分支差异 |
33
33
  | `/yx-commands-commit-push-mr` | 完整工作流 | 一键完成提交、推送、创建MR |
34
+ | `/yx-commands-workitems` | 查询工作项 | 列出我负责/参与的工作项 |
35
+ | `/yx-commands-summary` | 工作总结 | 生成周报/月报/季报/年报 |
34
36
 
35
37
  ## 典型工作流
36
38
 
@@ -53,7 +55,15 @@ tools: Bash, Read
53
55
  /yx-commands-review -t develop -s feature-branch
54
56
  ```
55
57
 
58
+ ### 工作总结
59
+ ```
60
+ /yx-commands-summary → 交互式选择时间范围
61
+ /yx-commands-summary --period month → 本月总结
62
+ /yx-commands-workitems → 查看当前进行中工作项
63
+ ```
64
+
56
65
  ## 前置条件
57
66
 
58
67
  - 已安装 `yx-code` CLI 工具
59
- - `yx-code` 在系统 PATH 中可用
68
+ - `yx-code` 在系统 PATH 中可用
69
+ - 已运行 `yx-code init` 完成配置(`~/.yunxiao/config.yaml`)
@@ -1,7 +1,7 @@
1
1
  ---
2
+ name: yx-commands-review
2
3
  allowed-tools: Bash(yx-code diff:*), Bash(yx-code --help:*), Bash(git branch:*), Bash(git remote:*), Bash(git log:*), Bash(git show:*), Bash(git blame:*), Read, Grep, Glob
3
4
  description: 查看分支代码差异并进行代码审查
4
- disable-model-invocation: false
5
5
  ---
6
6
 
7
7
  ## Context
@@ -0,0 +1,153 @@
1
+ ---
2
+ name: yx-commands-summary
3
+ description: 生成云效工作项总结,支持按周/月/季度/年或自定义时间范围,同时汇总本地云效仓库的 git 提交记录
4
+ ---
5
+
6
+ 生成指定时间范围内的工作总结(含需求、任务、缺陷 + git 提交记录),适合写周报、月报或绩效总结。
7
+
8
+ **AI 生成工作总结的完整流程:**
9
+
10
+ ## 第一步:确定时间范围
11
+
12
+ 根据用户请求确定 `START_DATE` 和 `END_DATE`(格式 `YYYY-MM-DD`),例如本月:
13
+ - START_DATE = 本月第一天
14
+ - END_DATE = 今天
15
+
16
+ ---
17
+
18
+ ## 第二步:获取云效工作项
19
+
20
+ ```bash
21
+ yx-code summary --start <START_DATE> --end <END_DATE> --json
22
+ ```
23
+
24
+ 也可使用预设周期:
25
+ ```bash
26
+ yx-code summary --period week --json # 本周
27
+ yx-code summary --period month --json # 本月
28
+ yx-code summary --period quarter --json # 本季度
29
+ yx-code summary --period year --json # 本年
30
+ ```
31
+
32
+ **参数说明:**
33
+
34
+ | 参数 | 说明 | 可选值 | 默认值 |
35
+ |------|------|--------|--------|
36
+ | `--period` / `-p` | 时间周期 | week/month/quarter/year | 交互提示 |
37
+ | `--start` | 开始日期 | YYYY-MM-DD 格式 | - |
38
+ | `--end` | 结束日期 | YYYY-MM-DD 格式 | 今天 |
39
+ | `--status` / `-s` | 状态过滤 | all(默认)/ undone(排除已完成)/ 中文状态名 | all |
40
+ | `--json` | JSON 格式输出 | - | false |
41
+
42
+ ---
43
+
44
+ ## 第三步:扫描本地云效 git 仓库并收集提交记录
45
+
46
+ **3.1 获取 git 用户名**
47
+
48
+ ```bash
49
+ git config --global user.name
50
+ ```
51
+
52
+ **3.2 扫描所有 remote 指向 codeup.aliyun.com 的本地仓库**
53
+
54
+ 在常见代码目录中查找,深度限制 5 层,并通过项目根目录 mtime 预过滤,跳过时间范围内未活动的仓库:
55
+
56
+ ```bash
57
+ for gitdir in $(find ~/IdeaProjects ~/Projects ~/code ~/workspace ~/repos ~/src ~/dev ~/work ~/Documents/code 2>/dev/null -maxdepth 5 -name ".git" -type d); do
58
+ repo=$(dirname "$gitdir")
59
+ # 1. mtime 预过滤:项目根目录在时间范围内未被修改则跳过(纯文件系统操作,无需启动 git)
60
+ if ! find "$repo" -maxdepth 0 -newermt "<START_DATE>" 2>/dev/null | grep -q .; then
61
+ continue
62
+ fi
63
+ # 2. 检查 remote 是否为云效仓库
64
+ if git -C "$repo" remote -v 2>/dev/null | grep -q "codeup.aliyun.com"; then
65
+ echo "$repo"
66
+ fi
67
+ done
68
+ ```
69
+
70
+ > - 项目根目录 mtime 在任何文件编辑、IDE 打开等操作时均会更新,比 `.git/` 内部文件更灵敏
71
+ > - mtime 检查为纯文件系统操作,优先于需要启动 git 进程的 remote URL 检查
72
+ > - 某个目录不存在时 `2>/dev/null` 静默跳过,不影响其他目录扫描
73
+
74
+ **3.3 对每个仓库查询时间范围内的 commit**
75
+
76
+ ```bash
77
+ git -C <repo_path> log \
78
+ --after="<START_DATE> 00:00:00" \
79
+ --before="<END_DATE> 23:59:59" \
80
+ --author="<用户名>" \
81
+ --format="%h|%s|%ai" \
82
+ --no-merges
83
+ ```
84
+
85
+ 从 remote URL 提取仓库名作为展示标识:
86
+ ```bash
87
+ git -C <repo_path> remote get-url origin
88
+ # git@codeup.aliyun.com:org/repo-name.git → 取最后一段去掉 .git → repo-name
89
+ ```
90
+
91
+ ---
92
+
93
+ ## 第四步:整合展示
94
+
95
+ 将云效工作项和 git 提交记录合并为以下结构:
96
+
97
+ ```
98
+ ## 工作总结(2024-03-01 ~ 2024-03-31)
99
+
100
+ ### 云效工作项(N 项)
101
+
102
+ **总计:N 项**(需求 X 项 / 任务 Y 项 / 缺陷 Z 项)
103
+
104
+ #### 需求(X 项)
105
+ | 编号 | 标题 | 状态 | 优先级 | 所在项目 | 创建日期 |
106
+ |------|------|------|--------|----------|----------|
107
+ | XJHS-1898 | 太保:兼容团险网点人员 | 已上线 | 中 | 芯计划书 | 2024-03-10 |
108
+
109
+ #### 任务(Y 项)
110
+ ...
111
+
112
+ #### 缺陷(Z 项)
113
+ ...
114
+
115
+ #### 按项目汇总
116
+ | 项目 | 工作项数 |
117
+ |------|----------|
118
+ | 展业赋能 | 7 |
119
+
120
+ ---
121
+
122
+ ### Git 提交记录(共 N 次提交,涉及 R 个仓库)
123
+
124
+ #### 仓库:repo-a(M 次提交)
125
+ | 提交哈希 | 提交信息 | 日期 |
126
+ |----------|----------|------|
127
+ | a1b2c3d | feat: 新增XX功能 | 2024-03-15 |
128
+
129
+ #### 仓库:repo-b(K 次提交)
130
+ | 提交哈希 | 提交信息 | 日期 |
131
+ |----------|----------|------|
132
+ | e4f5g6h | fix: 修复登录问题 | 2024-03-20 |
133
+
134
+ ---
135
+
136
+ ### 综合统计
137
+ | 维度 | 数量 |
138
+ |------|------|
139
+ | 云效工作项 | X 项 |
140
+ | Git 提交 | Y 次 |
141
+ | 涉及云效项目 | Z 个 |
142
+ | 涉及代码仓库 | R 个 |
143
+ ```
144
+
145
+ **展示规则:**
146
+ - 云效工作项按 `category` 字段分组:`Req`=需求、`Task`=任务、`Bug`=缺陷,无数据的类别跳过
147
+ - 标题超过 30 字时截断并加"..."
148
+ - 若 `parent_id` 非空,在标题后附注"(子项)"
149
+ - 优先级为空时显示"-"
150
+ - Git 提交按仓库分组,同一仓库内按日期倒序
151
+ - 未找到任何 codeup 仓库时,跳过 Git 部分
152
+ - yx-code 未安装时,跳过云效工作项部分
153
+ - 如需进一步分析,可请求:"根据以上数据,帮我写一份适合汇报给领导的月度总结"
@@ -0,0 +1,68 @@
1
+ ---
2
+ name: yx-commands-workitems
3
+ description: 列出云效工作项(我负责的,含需求、任务、缺陷)
4
+ ---
5
+
6
+ 列出当前用户在云效中负责的工作项(需求、任务、缺陷)。用户 ID 会在首次运行时通过 token 自动获取并缓存。
7
+
8
+ **步骤:**
9
+
10
+ 1. 列出我负责的未完成工作项(默认,按类别分组展示):
11
+ ```bash
12
+ yx-code workitems
13
+ ```
14
+
15
+ 2. 按状态过滤:
16
+ ```bash
17
+ # 列出所有状态的工作项
18
+ yx-code workitems --status all
19
+
20
+ # 列出指定中文状态的工作项
21
+ yx-code workitems --status 开发中
22
+
23
+ # 列出指定项目的工作项
24
+ yx-code workitems --project <项目标识符>
25
+ ```
26
+
27
+ 3. 获取完整 JSON 数据(供 AI 整理展示):
28
+ ```bash
29
+ yx-code workitems --json
30
+ ```
31
+
32
+ **参数说明:**
33
+
34
+ | 参数 | 说明 | 可选值 | 默认值 |
35
+ |------|------|--------|--------|
36
+ | `--status` / `-s` | 状态过滤 | undone(排除已完成)/ all / 中文状态名 | undone |
37
+ | `--project` / `-p` | 指定项目 | 项目标识符或名称 | 全部项目 |
38
+ | `--json` | JSON 格式输出 | - | false |
39
+
40
+ **AI 整理展示格式:**
41
+
42
+ 当用户请求查看工作项时,执行 `yx-code workitems --json`,然后将 JSON 数据整理成以下格式展示:
43
+
44
+ ```
45
+ ## 我负责的工作项(未完成)
46
+
47
+ ### 需求(N 项)
48
+ | 编号 | 标题 | 状态 | 优先级 | 创建人 | 所在项目 | 创建日期 |
49
+ |------|------|------|--------|--------|----------|----------|
50
+ | XJHS-1898 | 太保:兼容团险网点人员 | 处理中 | 中 | 谢思超 | 芯计划书 | 2024-11-26 |
51
+
52
+ ### 任务(N 项)
53
+ | 编号 | 标题 | 状态 | 优先级 | 创建人 | 所在项目 | 创建日期 |
54
+ |------|------|------|--------|--------|----------|----------|
55
+ ...
56
+
57
+ ### 缺陷(N 项)
58
+ | 编号 | 标题 | 状态 | 优先级 | 创建人 | 所在项目 | 创建日期 |
59
+ |------|------|------|--------|--------|----------|----------|
60
+ ...
61
+ ```
62
+
63
+ 规则:
64
+ - 按 category 字段分组:`Req`=需求、`Task`=任务、`Bug`=缺陷
65
+ - 若某类别无数据则跳过
66
+ - 标题过长时截断显示(保留前 30 个字符)
67
+ - 若 `parent_id` 非空,在标题后附注"(子项)"
68
+ - 优先级为空时显示"-"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yunxiao-code",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "阿里云云效 CLI 工具",
5
5
  "keywords": [
6
6
  "aliyun",
@@ -13,11 +13,11 @@
13
13
  ],
14
14
  "repository": {
15
15
  "type": "git",
16
- "url": "git+https://github.com/ZLStream/yunxiao-code.git"
16
+ "url": "git+https://github.com/ZLStream/yunxiao-commands.git"
17
17
  },
18
- "homepage": "https://github.com/ZLStream/yunxiao-code#readme",
18
+ "homepage": "https://github.com/ZLStream/yunxiao-commands#readme",
19
19
  "bugs": {
20
- "url": "https://github.com/ZLStream/yunxiao-code/issues"
20
+ "url": "https://github.com/ZLStream/yunxiao-commands/issues"
21
21
  },
22
22
  "bin": {
23
23
  "yx-code": "bin/yx-code.js"
@@ -71,7 +71,7 @@ function deployPlugin() {
71
71
  linked.forEach(name => console.log(' - ' + name));
72
72
  }
73
73
 
74
- console.log('\n可用命令: /yx-commands-commit, /yx-commands-push, /yx-commands-mr, /yx-commands-review, /yx-commands-commit-push-mr\n');
74
+ console.log('\n可用命令: /yx-commands-commit, /yx-commands-push, /yx-commands-mr, /yx-commands-review, /yx-commands-commit-push-mr, /yx-commands-workitems, /yx-commands-summary\n');
75
75
  }
76
76
 
77
77
  console.log('\n✅ yx-code CLI installed successfully!\n');
@@ -81,7 +81,9 @@ console.log(' yx-code clone - 克隆仓库');
81
81
  console.log(' yx-code commit - 提交代码');
82
82
  console.log(' yx-code push - 推送代码');
83
83
  console.log(' yx-code mr - 创建合并请求');
84
- console.log(' yx-code diff - 查看代码差异\n');
84
+ console.log(' yx-code diff - 查看代码差异');
85
+ console.log(' yx-code workitems - 列出工作项');
86
+ console.log(' yx-code summary - 生成工作总结\n');
85
87
 
86
88
  try {
87
89
  deployPlugin();