worklog
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseWorklog
工作记录
个人工作回顾,整合本地 git 统计、GitHub 和云效数据,输出结构化 Markdown 报告。
个人工作回顾,整合本地 git 统计、GitHub 和云效数据,输出结构化 Markdown 报告。
Prerequisites
前置条件
| Tool | Type | Required | Install |
|---|---|---|---|
| git | cli | Yes | |
| gh | cli | No | |
| jq | cli | No | |
| yunxiao | skill | No | Included in |
| yunxiao MCP | mcp | No | See yunxiao skill for setup |
Do NOT proactively verify these tools on skill load. If a command fails due to a missing tool, directly guide the user through installation and configuration step by step.
| 工具 | 类型 | 是否必需 | 安装方式 |
|---|---|---|---|
| git | 命令行工具 | 是 | |
| gh | 命令行工具 | 否 | |
| jq | 命令行工具 | 否 | |
| yunxiao | 技能插件 | 否 | 包含在 |
| yunxiao MCP | 云效MCP | 否 | 查看yunxiao技能插件的设置说明 |
请勿在技能插件加载时主动验证这些工具。如果因缺少工具导致命令执行失败,请直接逐步引导用户完成安装和配置。
Mode Selection
模式选择
| User says | Mode |
|---|---|
| 「日报」「今天做了什么」"daily worklog" | Daily |
| 「周报」「本周总结」"weekly worklog" | Weekly |
| 「工作回顾」「worklog」 | Ask user |
| 用户输入内容 | 模式 |
|---|---|
| 「日报」「今天做了什么」"daily worklog" | 日报模式 |
| 「周报」「本周总结」"weekly worklog" | 周报模式 |
| 「工作回顾」「worklog」 | 询问用户 |
Workflow
工作流程
- Determine mode + dates → 2. Collect data (parallel) → 3. Integrate + render
If no data from any source, output: "No activity recorded for {period}."
- 确定模式与日期 → 2. 收集数据(并行)→ 3. 整合与渲染
如果所有数据源都无数据,输出:"该时间段无活动记录:{period}。"
Step 1: Determine Dates
步骤1:确定日期
| Mode | --since | --until |
|---|---|---|
| Daily | Today ( | Today |
| Weekly | Monday of current week | Today |
| 模式 | --since | --until |
|---|---|---|
| 日报模式 | 当日( | 当日 |
| 周报模式 | 当周周一 | 当日 |
Step 2: Collect Data (Parallel)
步骤2:收集数据(并行)
Run all three sources concurrently using subagents:
Other agent environments: the three sources are independent — run them sequentially if parallel execution is not available.
text
┌─ Bash: stats.sh --since {since} --until {until} (local git)
├─ Bash: github.sh --since {since} --until {until} (GitHub)
└─ subagent: 云效 MR/Bug/Task (yunxiao skill)使用子Agent并行运行三个数据源:
其他Agent环境说明:三个数据源相互独立,如果不支持并行执行,则按顺序运行。
text
┌─ Bash: stats.sh --since {since} --until {until} (local git)
├─ Bash: github.sh --since {since} --until {until} (GitHub)
└─ subagent: 云效 MR/Bug/Task (yunxiao skill)2a. Local Git Statistics
2a. 本地Git统计
bash
bash scripts/stats.sh --since YYYY-MM-DD --until YYYY-MM-DDOutput: JSON with , (name, path, remote_url, commits, insertions, deletions, files_changed, authors, first_commit, last_commit), and (repos_active, repos_scanned, commits, insertions, deletions).
periodrepos[]totalsOther agent environments: run this command directly via shell.
bash
bash scripts/stats.sh --since YYYY-MM-DD --until YYYY-MM-DD输出:包含以下字段的JSON数据:(时间段)、(仓库列表,包含名称、路径、远程地址、提交数、新增代码行数、删除代码行数、修改文件数、作者、首次提交时间、末次提交时间),以及(统计汇总,包含活跃仓库数、扫描仓库数、总提交数、总新增行数、总删除行数)。
periodrepos[]totals其他Agent环境说明:直接通过Shell执行该命令。
2b. GitHub Activity
2b. GitHub活动
bash
bash scripts/github.sh --since YYYY-MM-DD --until YYYY-MM-DDOutput: JSON with , (repo, number, title, state, created_at, merged_at), (repo, number, title, state, created_at), and (prs_merged, prs_open, issues_opened, issues_closed).
periodprs[]issues[]totalsUsername is auto-detected via . No manual configuration needed.
gh api userOther agent environments: run this command directly via shell.
bash
bash scripts/github.sh --since YYYY-MM-DD --until YYYY-MM-DD输出:包含以下字段的JSON数据:(时间段)、(Pull Request列表,包含仓库、编号、标题、状态、创建时间、合并时间)、(问题列表,包含仓库、编号、标题、状态、创建时间),以及(统计汇总,包含已合并PR数、开放PR数、已创建问题数、已关闭问题数)。
periodprs[]issues[]totals用户名通过自动检测,无需手动配置。
gh api user其他Agent环境说明:直接通过Shell执行该命令。
2c. 云效 Activity
2c. 云效活动
Start subagent to invoke yunxiao skill with specific MCP queries:
text
Task tool:
- subagent_type: general-purpose
- prompt: 使用 yunxiao skill 获取 {since} 到 {until} 的工作记录
先通过 MCP 自动获取身份:
- get_current_user → 用户名
- get_current_organization_info → 组织 ID
然后查询:
1. MR: list_change_requests — state=all, authorCodeupIdList=[user_id]
返回: id, title, state, sourceRef, targetRef, createTime, mergeTime
2. Bug: search_workitems — category=Bug, space=..., conditions=[assignee=username]
返回: identifier, subject, status, assignedTo, gmtModified
3. 任务: search_workitems — category=Task, space=..., conditions=[assignee=username]
返回: identifier, subject, status, assignedTo, gmtModifiedOther agent environments: if yunxiao skill is unavailable, skip and note "云效数据未获取".
启动子Agent,通过特定MCP调用yunxiao技能插件:
text
Task tool:
- subagent_type: general-purpose
- prompt: 使用 yunxiao skill 获取 {since} 到 {until} 的工作记录
先通过 MCP 自动获取身份:
- get_current_user → 用户名
- get_current_organization_info → 组织 ID
然后查询:
1. MR: list_change_requests — state=all, authorCodeupIdList=[user_id]
返回: id, title, state, sourceRef, targetRef, createTime, mergeTime
2. Bug: search_workitems — category=Bug, space=..., conditions=[assignee=username]
返回: identifier, subject, status, assignedTo, gmtModified
3. 任务: search_workitems — category=Task, space=..., conditions=[assignee=username]
返回: identifier, subject, status, assignedTo, gmtModified其他Agent环境说明:如果yunxiao技能插件不可用,则跳过该数据源,并标注“云效数据未获取”。
Step 3: Integrate and Render
步骤3:整合与渲染
Merge all sources. For any failed source, note it (e.g., "GitHub 数据未获取") and continue with available data.
Render using template.md.
Weekly mode additionally requires:
-
Commit distribution — For active repos from stats.sh, count commits per weekday:bash
git log --since={since} --until={until_next_day} --author="{author}" --format="%aI" | \ awk -F'T' '{print $1}' | sort | uniq -cRender as ASCII bar chart (Mon–Fri). -
Highlights — From stats.sh data: most active repo (by commits), largest change (by insertions).
整合所有数据源。若某一数据源获取失败,则标注说明(例如:"GitHub 数据未获取"),并继续使用可用数据生成报告。
使用template.md模板进行渲染。
周报模式额外要求:
-
提交分布统计 — 针对stats.sh返回的活跃仓库,统计每个工作日的提交数:bash
git log --since={since} --until={until_next_day} --author="{author}" --format="%aI" | \ awk -F'T' '{print $1}' | sort | uniq -c渲染为ASCII柱状图(周一至周五)。 -
重点内容 — 从stats.sh数据中提取:提交数最多的活跃仓库、新增代码行数最多的变更。
Data Source Degradation
数据源降级处理
| Source failed | Behavior |
|---|---|
| GitHub | Note "GitHub 数据未获取", continue |
| 云效 | Note "云效数据未获取", continue |
| Both remote | Output local git stats only |
| 数据源获取失败 | 处理方式 |
|---|---|
| GitHub | 标注"GitHub 数据未获取",继续执行 |
| 云效 | 标注"云效数据未获取",继续执行 |
| 两个远程数据源 | 仅输出本地Git统计数据 |
Common Issues
常见问题
| Issue | Fix |
|---|---|
| stats.sh empty repos | Check date range and |
| github.sh fails / 401 | Run |
| 云效 MCP not connected | Check MCP server configuration |
| 问题 | 解决方法 |
|---|---|
| stats.sh返回空仓库列表 | 检查日期范围和 |
| github.sh执行失败/返回401错误 | 执行 |
| 云效MCP未连接 | 检查MCP服务器配置 |
Identity Detection
身份识别
All user identities are auto-detected at runtime. See user-config.md for detection sources and prerequisites.
所有用户身份均在运行时自动检测。检测来源及前置条件请查看user-config.md。