Skip to content

Commit bf4dd03

Browse files
committed
Merge branch '3.6.x'
2 parents 03beccf + 4f8fc57 commit bf4dd03

5 files changed

Lines changed: 158 additions & 6 deletions

File tree

.claude/commands/refine-title.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
---
2+
name: "refine-title"
3+
description: "深度分析 Issue 或 PR 内容,并将其标题重构为 Conventional Commits 格式"
4+
usage: "/refine-title <id>"
5+
---
6+
7+
# Refine Title Command
8+
9+
## 功能说明
10+
11+
针对指定的 GitHub Issue 或 PR,读取其详细描述(Body)、标签(Labels)以及代码变更(如果是 PR),深度理解其意图,然后生成符合 `type(scope): subject` 规范的新标题并执行修改。
12+
13+
## 执行流程
14+
15+
### 1. 识别对象与获取信息
16+
17+
尝试判断 ID 是 Issue 还是 PR,并获取详细信息。
18+
19+
```bash
20+
# 尝试获取 Issue 信息
21+
gh issue view <id> --json number,title,body,labels,state
22+
23+
# 如果提示是 PR,或者查不到 Issue 但存在同号 PR,则获取 PR 信息
24+
gh pr view <id> --json number,title,body,labels,state,files
25+
```
26+
27+
### 2. 智能分析
28+
29+
根据获取到的 JSON 数据进行分析:
30+
31+
1. **确定 Type (类型)**
32+
- 阅读 `body` 中的 "变更类型" 或描述。
33+
- 检查 `labels` (如 `type: bug` -> `fix`, `type: feature` -> `feat`)。
34+
- 如果是 PR,分析 `files` (仅文档变动 -> `docs`,仅测试变动 -> `test`)。
35+
36+
2. **确定 Scope (范围)**
37+
- 阅读 `body` 提及的模块。
38+
- 检查 `labels` (如 `in: fit` -> `fit`)。
39+
- 如果是 PR,分析 `files` 路径 (如 `framework/fit/java/...` -> `fit`)。
40+
41+
3. **生成 Subject (摘要)**
42+
- **忽略原标题**(避免受干扰),直接从 `body` 中提炼核心意图。
43+
- 确保简练(20字以内)、中文描述、无句号。
44+
45+
### 3. 生成建议与交互
46+
47+
输出分析结果供用户确认:
48+
49+
```text
50+
🔍 分析对象: Issue #<id> / PR #<id>
51+
52+
当前标题: [原标题]
53+
--------------------------------------------------
54+
🧠 分析依据:
55+
- 原始意图: (从 Body 提取的一句话摘要)
56+
- 推断类型: Fix (依据: 标签 type:bug, Body 关键词 "修复")
57+
- 推断范围: fit (依据: 涉及文件路径 framework/fit/...)
58+
--------------------------------------------------
59+
✨ 建议标题: fix(fit): 修复并发场景下的空指针异常
60+
```
61+
62+
询问用户:*"是否确认修改?(y/n)"*
63+
64+
### 4. 执行修改
65+
66+
用户确认(y)后,根据对象类型执行命令:
67+
68+
```bash
69+
# 如果是 Issue
70+
gh issue edit <id> --title "<new-title>"
71+
72+
# 如果是 PR
73+
gh pr edit <id> --title "<new-title>"
74+
```
75+
76+
## 参数说明
77+
78+
- `<id>`: Issue 或 PR 的编号(必需)。
79+
80+
## 使用示例
81+
82+
```bash
83+
# 智能重命名 Issue #1024
84+
/refine-title 1024
85+
```
86+
87+
## 优势
88+
89+
相比于批量修改 (`/normalize-titles`),本命令:
90+
1. **修正错误**:如果原标题是 "Help me",此命令能读懂内容并改为 "fix(core): 修复启动报错"。
91+
2. **更精准的 Scope**:通过分析 PR 的文件变动,能自动判断是 `fit` 还是 `waterflow`,无需人工指定。
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: PR Title Check
2+
3+
on:
4+
pull_request:
5+
types: [opened, edited, synchronize]
6+
7+
permissions:
8+
pull-requests: read
9+
10+
jobs:
11+
validate:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: amannn/action-semantic-pull-request@v5.5.2
15+
with:
16+
# 允许的提交类型
17+
types: |
18+
feat
19+
fix
20+
docs
21+
style
22+
refactor
23+
perf
24+
test
25+
chore
26+
build
27+
ci
28+
revert
29+
30+
# 不限制 scope,允许任意模块名
31+
# requireScope: false - scope 是可选的
32+
33+
# 标题描述长度 5-100 字符
34+
subjectPattern: '^.{5,100}$'
35+
subjectPatternError: '标题描述长度应在 5-100 字符之间'
36+
37+
# 禁用首字母大写检查(兼容中文)
38+
enforceSingleSentence: false
39+
40+
# 支持 WIP 前缀标记进行中的工作
41+
wip: true
42+
43+
env:
44+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

CONTRIBUTING.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,27 @@ exec git-hooks/check-utf8-encoding.sh
8686
8787
### 提交信息格式
8888

89-
- 用简短的语句描述提交的主要内容,不要太长,建议 20 个字以内,需要使用中文,结尾不需要句号。
90-
- 如有必要,在简短的描述后添加一个空行,然后补充详细说明,可以使用多行来描述。
91-
- 说明中可以包括问题的原因、解决方法和影响范围等。
92-
- 样例:`修复某问题`
89+
我们采用 [Conventional Commits](https://www.conventionalcommits.org/) 规范,格式如下:
90+
`<type>(<scope>): <subject>`
91+
92+
- **type(类型)**
93+
- `feat`: 新功能 (feature)
94+
- `fix`: 问题修复 (bug fix)
95+
- `docs`: 文档变更 (documentation)
96+
- `style`: 代码格式 (formatting, missing semi colons, etc; no code change)
97+
- `refactor`: 代码重构 (neither fixes a bug nor adds a feature)
98+
- `perf`: 性能优化 (performance)
99+
- `test`: 测试相关 (adding missing tests)
100+
- `chore`: 构建过程或辅助工具变动 (maintain)
101+
- **scope(范围/模块)**:对应项目模块名,如 `fit`, `waterflow`, `fel`, `framework`, `ohscript` 等。如果涉及多个模块或全局变动,可以使用 `*` 或留空。
102+
- **subject(描述)**:简短描述主要内容,建议 20 个字以内,需要使用中文,结尾不需要句号。
103+
104+
如有必要,在简短的描述后添加一个空行,然后补充详细说明,可以使用多行来描述(包括问题原因、解决方法和影响范围等)。
105+
106+
**样例:**
107+
- `feat(fit): 支持 HTTPS 双向认证`
108+
- `fix(waterflow): 修复调度引擎的空指针异常`
109+
- `docs(framework): 修正快速开始指南中的拼写错误`
93110

94111
## 代码审查
95112

framework/fel/java/plugins/tool-mcp-client/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
<dependency>
4141
<groupId>io.modelcontextprotocol.sdk</groupId>
4242
<artifactId>mcp</artifactId>
43-
<version>0.15.0</version>
43+
<version>0.17.1</version>
4444
</dependency>
4545

4646
<!-- Test -->

framework/fel/java/plugins/tool-mcp-server/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
<dependency>
4545
<groupId>io.modelcontextprotocol.sdk</groupId>
4646
<artifactId>mcp</artifactId>
47-
<version>0.15.0</version>
47+
<version>0.17.1</version>
4848
</dependency>
4949

5050
<!-- Test -->

0 commit comments

Comments
 (0)