GitLab Weekly Report Generator
生成适合团队复盘、周会同步和对外汇报的 GitLab 周报。
执行流程
- 读取
config/config.json;如果不存在,先从config/config.example.json复制一份再填写。 - 运行
scripts/generate-report.sh生成周报主文件。 - 如需图表,运行
scripts/generate-charts.py;如果环境缺少matplotlib,接受 Mermaid 回退方案。 - 如需发布到飞书,使用
scripts/upload-to-feishu.sh或scripts/upload-to-feishu.js。 - 优先修改配置和分类规则,不要直接改业务脚本,除非需求本身变了。
主要能力
- 按 一级分类 → 二级分类 → MR 组织产品功能周报
- 按 人 → repo 汇总 MR、commit、贡献摘要
- 输出
weekly_report.md与weekly_report.html - 生成
stats.json、图表和reports/index.html - 保持 Markdown 尽量兼容飞书文档
- 为 MR 和成员附上 GitLab 链接
- 支持“规则优先 + 启发式补全”的分类方式
关键文件
scripts/generate-report.sh:命令入口scripts/generate-report.py:主逻辑scripts/generate-charts.py:图表生成scripts/upload-to-feishu.sh/scripts/upload-to-feishu.js:飞书上传config/config.example.json:配置示例config/classification.rules.example.json:分类规则示例templates/report.template.md:报告模板
配置方式
优先使用以下文件:
config/config.jsonconfig/classification.rules.json
如果规则文件不存在,就从对应的 *.example.json 复制后再修改。
优先调整顺序:
repo_rules:适合仓库名、路径、项目归属明显的场景keyword_rules:适合 title / label / branch 关键词补充判断default_category:兜底分类
基本用法
cd /path/to/gitlab-weekly-report
cp config/config.example.json config/config.json
cp config/classification.rules.example.json config/classification.rules.json
./scripts/generate-report.sh \
-c config/config.json \
-s 2026-03-14 \
-e 2026-03-19
可选参数:
| 参数 | 说明 |
|---|---|
-c, --config | 配置文件 |
-s, --start-date | 开始日期 |
-e, --end-date | 结束日期 |
-o, --output | 输出目录 |
--no-charts | 跳过图表生成 |
典型输出
reports/
├── index.html
├── latest -> 2026-03-14_to_2026-03-19/
└── 2026-03-14_to_2026-03-19/
├── weekly_report.md
├── weekly_report.html
├── stats.json
└── charts/
依赖
必需:
python3jq
推荐:
matplotlibpandasrequests
安装:
pip3 install -r requirements.txt
注意事项
- 保持
SKILL.md聚焦流程和决策,不要把大段样例配置塞进来。 - 优先通过配置和规则文件调整分类结果。
- 接受图表回退到 Mermaid 的情况,不要因为缺少
matplotlib阻塞周报生成。 - 飞书上传依赖本地配置和权限;发布 skill 时不要分发真实 token 或私有配置文件。