git-weekly-report-cn

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Git 周/日报生成

Git Daily/Weekly Report Generation

Overview

Overview

提取 Git 提交日志并生成结构化日报或周报。输出会把近期工作整理为完成事项、进行中事项、重要事项、计划和风险阻塞,并支持按时间范围、作者和仓库维度汇总,便于复用到站会、日报、周报或项目汇总中。
Extract Git commit logs and generate structured daily or weekly reports. The output organizes recent work into completed items, in-progress items, key items, plans, and risks/blockers, and supports aggregation by time range, author, and repository dimensions, making it easy to reuse in standups, daily reports, weekly reports, or project summaries.

何时使用

When to Use

当用户有以下需求时使用本技能:
  • 从 Git 提交记录生成周报或日报
  • 总结昨天或今天的 Git 活动
  • 汇总一个或多个仓库的近期 Git 活动
  • 回顾某个时间段内完成的工作
  • 将提交历史整理为分类报告
  • 从提交记录准备每日站会汇总
Use this skill when users have the following needs:
  • Generate weekly or daily reports from Git commit records
  • Summarize yesterday's or today's Git activities
  • Aggregate recent Git activities from one or more repositories
  • Review work completed within a specific time period
  • Organize commit history into categorized reports
  • Prepare daily standup summaries from commit records

不要使用

When Not to Use

以下场景不应使用本技能:
  • 对特定变更的代码审查(请使用 code-reviewer)
  • 查看单条提交的详细信息
  • 提取日志以外的 Git 操作(分支、合并等)
  • 与 Git 无关的报告生成
Do not use this skill in the following scenarios:
  • Code review for specific changes (use code-reviewer instead)
  • View detailed information of a single commit
  • Extract Git operations other than logs (branching, merging, etc.)
  • Generate reports unrelated to Git

使用说明

Usage Instructions

  1. 确定日期范围和报告类型:
    • 日报:用户说"昨天"、"今天"、"日报"时 — 默认
      --since
      为昨天,
      --until
      为今天
    • 周报:用户说"这周"、"本周"、"周报"时 — 默认
      --since
      为本周一,
      --until
      为今天
    • 其他情况:默认最近 7 天。接受用户自定义。
  2. 确定作者过滤。如用户指定则使用,默认:全部作者。
  3. 确定仓库路径。默认:当前工作目录。如用户提及多个项目,收集所有路径。
  4. 运行脚本:
bash
python3 scripts/git_weekly_report.py --since <YYYY-MM-DD> --until <YYYY-MM-DD> [--author <名称>] [--repo <路径1> <路径2> ...]
  1. 读取 JSON 输出。脚本按仓库分组提供结构化提交数据。
  2. 使用 weekly-report-format.md 作为分类指南,按类型归类提交。
  3. 使用 weekly-report-template.md 作为输出结构生成最终周报。
  4. "下周计划"和"风险阻塞"板块:需向用户确认是否有内容补充,这些信息无法从 Git 日志推导。日报默认不含这些板块,除非用户要求。
  5. 呈现最终 Markdown 周报。如用户需要,保存到文件。
  1. Determine the date range and report type:
    • Daily Report: When the user says "yesterday", "today", or "daily report" — default
      --since
      is yesterday,
      --until
      is today
    • Weekly Report: When the user says "this week", "current week", or "weekly report" — default
      --since
      is Monday of this week,
      --until
      is today
    • Other cases: Default to the last 7 days. Custom ranges from users are accepted.
  2. Determine author filtering. Use the specified author if provided; default: all authors.
  3. Determine repository paths. Default: current working directory. Collect all paths if the user mentions multiple projects.
  4. Run the script:
bash
python3 scripts/git_weekly_report.py --since <YYYY-MM-DD> --until <YYYY-MM-DD> [--author <Name>] [--repo <Path1> <Path2> ...]
  1. Read the JSON output. The script provides structured commit data grouped by repository.
  2. Use weekly-report-format.md as a classification guide to categorize commits by type.
  3. Use weekly-report-template.md as the output structure to generate the final weekly report.
  4. "Next Week's Plan" and "Risks & Blockers" sections: Confirm with the user whether there is additional content to supplement, as this information cannot be derived from Git logs. Daily reports do not include these sections by default unless requested by the user.
  5. Present the final Markdown weekly report. Save to a file if the user requires it.

脚本使用

Script Usage

bash
undefined
bash
undefined

默认:最近 7 天,当前目录

Default: last 7 days, current directory

python3 scripts/git_weekly_report.py
python3 scripts/git_weekly_report.py

指定日期范围

Specify date range

python3 scripts/git_weekly_report.py --since 2026-04-21 --until 2026-04-28
python3 scripts/git_weekly_report.py --since 2026-04-21 --until 2026-04-28

指定作者

Specify author

python3 scripts/git_weekly_report.py --since 2026-04-21 --author "Yang"
python3 scripts/git_weekly_report.py --since 2026-04-21 --author "Yang"

多个仓库

Multiple repositories

python3 scripts/git_weekly_report.py --since 2026-04-21 --repo /path/to/project-a /path/to/project-b
python3 scripts/git_weekly_report.py --since 2026-04-21 --repo /path/to/project-a /path/to/project-b

保存输出到文件

Save output to file

python3 scripts/git_weekly_report.py --since 2026-04-21 --output /tmp/weekly.json
python3 scripts/git_weekly_report.py --since 2026-04-21 --output /tmp/weekly.json

包含 merge 提交

Include merge commits

python3 scripts/git_weekly_report.py --since 2026-04-21 --merges
undefined
python3 scripts/git_weekly_report.py --since 2026-04-21 --merges
undefined

JSON 输出结构

JSON Output Structure

脚本输出 JSON,结构如下:
  • date_range
    :
    { since, until }
    — 查询的日期范围
  • author_filter
    : 字符串或 null — 应用的作者过滤
  • repositories
    :
    { path, name, commit_count, commits }
    数组
  • total_commits
    : 所有仓库的提交总数
每条提交包含:
hash
short_hash
author
date
subject
body
refs
The script outputs JSON with the following structure:
  • date_range
    :
    { since, until }
    — Query date range
  • author_filter
    : string or null — Applied author filter
  • repositories
    : Array of
    { path, name, commit_count, commits }
  • total_commits
    : Total number of commits across all repositories
Each commit includes:
hash
,
short_hash
,
author
,
date
,
subject
,
body
,
refs
.

周报生成

Weekly Report Generation

当单个仓库的提交数超过 50 条时,按类别汇总而非逐条列出。始终保留 short_hash 以便追溯。
"进行中的工作"板块,留意以下信号:WIP、TODO、临时方案、未合并的功能分支。
"重要事项"板块,识别:breaking change、安全修复、重大功能上线、涉及关键路径的提交。
When the number of commits in a single repository exceeds 50, summarize by category instead of listing each one individually. Always retain the short_hash for traceability.
For the "In-Progress Work" section, watch for signals like WIP, TODO, temporary solutions, and unmerged feature branches.
For the "Key Items" section, identify: breaking changes, security fixes, major feature launches, and commits involving critical paths.