Skip to content

Commit bd43f9f

Browse files
committed
add summary reporter
1 parent d81263d commit bd43f9f

File tree

11 files changed

+1556
-27
lines changed

11 files changed

+1556
-27
lines changed
Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
# Task Checker 摘要功能增强
2+
3+
## 概述
4+
5+
为 Task Checker 组件增加了按优先级分类显示提醒 issues 的功能。现在摘要报告不仅显示统计数字,还会列出所有发送提醒的 issues,并按照 P0/P1/P2 优先级进行分类展示。
6+
7+
## 主要改动
8+
9+
### 1. `task_checker.py` - 数据收集
10+
11+
**改动内容:**
12+
- `check_task_timeout()` 现在返回包含详细信息的字典,而不是简单的 True/False
13+
- 返回数据包括:优先级、issue 编号、标题、URL、距上次更新时间
14+
- `scan_repo_tasks()``scan_org_tasks()` 的摘要中新增 `reminded_issues` 字段
15+
16+
**返回数据格式:**
17+
```python
18+
{
19+
"total_issues": 25,
20+
"reminders_sent": 7,
21+
"skipped": 5,
22+
"reminded_issues": [
23+
{
24+
"priority": "P0",
25+
"issue_number": 123,
26+
"title": "Critical Bug: System crash on startup",
27+
"url": "https://github.com/mcpp-community/mcpp/issues/123",
28+
"hours_since_update": 48.5,
29+
},
30+
# ... more issues
31+
]
32+
}
33+
```
34+
35+
### 2. `summary_reporter.py` - 格式化展示
36+
37+
**改动内容:**
38+
- 增强 `_format_task_checker_summary()` 方法
39+
- 自动按优先级(P0/P1/P2)分组显示
40+
- 为不同优先级添加彩色图标:
41+
- 🔴 P0 (最高优先级)
42+
- 🟡 P1 (重要)
43+
- 🟢 P2 (一般)
44+
- 显示每个 issue 的链接、标题和距上次更新时间
45+
- 自动截断过长的标题(超过 60 字符)
46+
47+
## 功能展示
48+
49+
### 摘要报告示例
50+
51+
```markdown
52+
### ⏰ 任务检查器 (Task Checker)
53+
- **扫描仓库数:** 3
54+
- **检查的任务:** 25
55+
- **发送提醒:** 7 📬
56+
- **跳过:** 5
57+
58+
#### 发送提醒的任务
59+
60+
**🔴 P0 级别任务** (2 个):
61+
- [#123](https://github.com/mcpp-community/mcpp/issues/123) Critical Bug: System crash on startup (已 48.5h 未更新)
62+
- [#125](https://github.com/mcpp-community/mcpp/issues/125) Security vulnerability in authentication module (已 36.2h 未更新)
63+
64+
**🟡 P1 级别任务** (3 个):
65+
- [#130](https://github.com/mcpp-community/mcpp/issues/130) Feature request: Add support for dark mode (已 72.0h 未更新)
66+
- [#135](https://github.com/mcpp-community/mcpp/issues/135) Performance optimization for large datasets processing (已 80.5h 未更新)
67+
- [#140](https://github.com/mcpp-community/mcpp/issues/140) Improve error messages to be more user-friendly and provi... (已 65.3h 未更新)
68+
69+
**🟢 P2 级别任务** (2 个):
70+
- [#150](https://github.com/mcpp-community/mcpp/issues/150) Update documentation for new features (已 120.0h 未更新)
71+
- [#155](https://github.com/mcpp-community/mcpp/issues/155) Refactor legacy code in utils module (已 96.7h 未更新)
72+
```
73+
74+
### 在 GitHub Issue 中的效果
75+
76+
在 GitHub Issue 评论中,上述 Markdown 会被渲染为:
77+
78+
- ✅ 自动生成的 issue 链接可点击
79+
- ✅ 按优先级分类,一目了然
80+
- ✅ 彩色图标直观标识优先级
81+
- ✅ 显示距上次更新时间,便于评估紧急程度
82+
- ✅ 长标题自动截断,保持版面整洁
83+
84+
## 使用方法
85+
86+
### 运行 Task Checker
87+
88+
```bash
89+
# 运行 task checker 并生成摘要
90+
python src/main.py task-checker --verbose
91+
92+
# 运行所有组件(包括自动发布摘要)
93+
python src/main.py all
94+
```
95+
96+
### 测试功能
97+
98+
```bash
99+
# 运行专门的测试脚本
100+
python examples/test_task_checker_summary.py
101+
```
102+
103+
## 技术细节
104+
105+
### 优先级识别
106+
107+
通过配置文件中的 `priority_pattern` 识别优先级标签:
108+
```yaml
109+
priority_pattern: "^P([012])$" # 匹配 P0, P1, P2
110+
```
111+
112+
### 数据流
113+
114+
```
115+
task_checker.py
116+
└─> 扫描 issues
117+
└─> 检查超时
118+
└─> 发送提醒
119+
└─> 收集详细信息 (priority, issue_number, title, url, hours)
120+
└─> 返回 summary with reminded_issues[]
121+
122+
main.py
123+
└─> 接收 summary
124+
└─> 传递给 SummaryReporter
125+
126+
summary_reporter.py
127+
└─> 按优先级分组 reminded_issues
128+
└─> 格式化为 Markdown
129+
└─> 发布到 GitHub Issue
130+
```
131+
132+
## 优势
133+
134+
1. **透明度提升**: 用户可以直接看到哪些任务被提醒了
135+
2. **优先级明确**: 通过颜色和分组一眼识别优先级
136+
3. **快速访问**: 直接点击链接跳转到相关 issue
137+
4. **上下文信息**: 显示距上次更新时间,帮助判断紧急程度
138+
5. **可追溯**: 每次运行的详细记录,便于审计和分析
139+
140+
## 向后兼容性
141+
142+
- ✅ 完全向后兼容
143+
- ✅ 如果组件不返回 `reminded_issues`,仍能正常工作
144+
- ✅ 旧的摘要报告格式仍然支持
145+
- ✅ 不影响其他组件的功能
146+
147+
## 测试覆盖
148+
149+
- ✅ 有提醒 issues 的情况
150+
- ✅ 无提醒 issues 的情况
151+
- ✅ 多优先级混合的情况
152+
- ✅ 长标题自动截断
153+
- ✅ 多组件混合摘要
154+
- ✅ 详细模式和简要模式
155+
156+
## 未来扩展
157+
158+
可以考虑的增强:
159+
- [ ] 添加 assignees 信息显示
160+
- [ ] 显示 issue 创建时间
161+
- [ ] 支持自定义优先级图标
162+
- [ ] 支持更多优先级级别(P3, P4...)
163+
- [ ] 添加过滤选项(只显示特定优先级)
164+
165+
## 相关文件
166+
167+
- `src/components/task_checker.py` - Task Checker 核心逻辑
168+
- `src/libs/summary_reporter.py` - 通用摘要报告库
169+
- `src/config/summary-config.yml` - 摘要配置文件
170+
- `examples/test_task_checker_summary.py` - 测试脚本
171+
- `src/libs/README_summary_reporter.md` - 详细文档

0 commit comments

Comments
 (0)