Generate weekly or monthly reports based on Git commit records.
Usage
/ac-report [参数]
Trigger Parsing
Parse user input and extract the following parameters:
| Parameter | Default Value | Example |
|---|---|---|
| Type | Weekly Report | "Weekly Report" / "Monthly Report" |
| User | Current git user.name | "@Zhang San" |
| Date | This week/this month | "December", "2025-01", "last 10 days" |
Parsing example:
"/ac-report 生成本周周报" → 类型=周报, 用户=当前, 日期=本周
"/ac-report 生成12月月报" → 类型=月报, 用户=当前, 日期=12月
"/ac-report 生成周报 @张三" → 类型=周报, 用户=张三, 日期=本周
"/ac-report 生成最近10天的周报" → 类型=周报, 用户=当前, 日期=最近10天
Execution Flow
1. Check MCP availability
Prefer using mcp__server-git__git_log, if unavailable use Bash git log。
2. Calculate date range
周报(无指定)→ 本周一 00:00 ~ 今天 23:59
月报(无指定)→ 本月1日 00:00 ~ 今天 23:59
"12月月报" → 12月1日 ~ 12月31日(或今天,若当月)
"最近N天" → N天前 00:00 ~ 今天 23:59
3. Get username
If @用户名 is specified, use that user; otherwise:
git config user.name
4. Query commit records
Use MCP (preferred):
mcp__server-git__git_log
repo_path: 当前目录
start_timestamp: 起始日期
end_timestamp: 结束日期
Then filter by author.
Use Bash (fallback):
git log --author="用户名" --since="起始日期" --until="结束日期" --pretty=format:"%h - %s (%ai)" --no-merges
5. Beautify commit records
Do not output git log as-is, the following processing must be performed:
- Merge similar commits: merge multiple commits of the same feature into one
- Filter noise: ignore meaningless commits such as Merge commits and Delete directories
- Standardize descriptions: supplement short "update", "modify" into complete descriptions
- Categorize and organize: group by functional module or type
Output format: numbered list, without dates
1. 完成用户认证模块开发,包括登录、注册、密码重置功能
2. 添加签到日志请求详情和状态筛选功能
3. 修复打包配置问题
6. Fill template
Read assets/templates/weekly.md or assets/templates/monthly.md, replace variables:
| Variable | Description |
|---|---|
{{DATE_RANGE}} |
Date range, such as "2025-01-06 ~ 2025-01-10" |
{{USER}} |
Username |
{{COMMITS}} |
BeautifiedWork content |
{{COMMIT_COUNT}} |
Total commits |
{{REPOS}} |
Involved repository names (extracted from repo_path) |
{{STAT_LINES}} |
Code line statistics (calculated only when the template includes it) |
7. Output result
Output the filled template content to the user.
Template Customization
Templates are located at assets/templates/, users can modify or add templates.
Optional variable {{STAT_LINES}}: if the template includes this variable, additionally execute:
git log --author="用户名" --since="起始" --until="结束" --shortstat --oneline | grep -E "^\s*\d+\s+file"
Aggregate insertions/deletions.
Multi-repository support
If the user specifies multiple paths, query each path separately, merge the results, and then generate the report.