worklog

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Worklog

工作记录

个人工作回顾,整合本地 git 统计、GitHub 和云效数据,输出结构化 Markdown 报告。
个人工作回顾,整合本地 git 统计、GitHub 和云效数据,输出结构化 Markdown 报告。

Prerequisites

前置条件

ToolTypeRequiredInstall
gitcliYes
brew install git
or git-scm.com
ghcliNo
brew install gh
then
gh auth login
jqcliNo
brew install jq
yunxiaoskillNoIncluded in
npx skills add niracler/skill
yunxiao MCPmcpNoSee 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命令行工具
brew install git
git-scm.com
gh命令行工具
brew install gh
然后执行
gh auth login
jq命令行工具
brew install jq
yunxiao技能插件包含在
npx skills add niracler/skill
yunxiao MCP云效MCP查看yunxiao技能插件的设置说明
请勿在技能插件加载时主动验证这些工具。如果因缺少工具导致命令执行失败,请直接逐步引导用户完成安装和配置。

Mode Selection

模式选择

User saysMode
「日报」「今天做了什么」"daily worklog"Daily
「周报」「本周总结」"weekly worklog"Weekly
「工作回顾」「worklog」Ask user
用户输入内容模式
「日报」「今天做了什么」"daily worklog"日报模式
「周报」「本周总结」"weekly worklog"周报模式
「工作回顾」「worklog」询问用户

Workflow

工作流程

  1. Determine mode + dates → 2. Collect data (parallel) → 3. Integrate + render
If no data from any source, output: "No activity recorded for {period}."
  1. 确定模式与日期 → 2. 收集数据(并行)→ 3. 整合与渲染
如果所有数据源都无数据,输出:"该时间段无活动记录:{period}。"

Step 1: Determine Dates

步骤1:确定日期

Mode--since--until
DailyToday (
YYYY-MM-DD
)
Today
WeeklyMonday of current weekToday
模式--since--until
日报模式当日(
YYYY-MM-DD
当日
周报模式当周周一当日

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-DD
Output: JSON with
period
,
repos[]
(name, path, remote_url, commits, insertions, deletions, files_changed, authors, first_commit, last_commit), and
totals
(repos_active, repos_scanned, commits, insertions, deletions).
Other agent environments: run this command directly via shell.
bash
bash scripts/stats.sh --since YYYY-MM-DD --until YYYY-MM-DD
输出:包含以下字段的JSON数据:
period
(时间段)、
repos[]
(仓库列表,包含名称、路径、远程地址、提交数、新增代码行数、删除代码行数、修改文件数、作者、首次提交时间、末次提交时间),以及
totals
(统计汇总,包含活跃仓库数、扫描仓库数、总提交数、总新增行数、总删除行数)。
其他Agent环境说明:直接通过Shell执行该命令。

2b. GitHub Activity

2b. GitHub活动

bash
bash scripts/github.sh --since YYYY-MM-DD --until YYYY-MM-DD
Output: JSON with
period
,
prs[]
(repo, number, title, state, created_at, merged_at),
issues[]
(repo, number, title, state, created_at), and
totals
(prs_merged, prs_open, issues_opened, issues_closed).
Username is auto-detected via
gh api user
. No manual configuration needed.
Other agent environments: run this command directly via shell.
bash
bash scripts/github.sh --since YYYY-MM-DD --until YYYY-MM-DD
输出:包含以下字段的JSON数据:
period
(时间段)、
prs[]
(Pull Request列表,包含仓库、编号、标题、状态、创建时间、合并时间)、
issues[]
(问题列表,包含仓库、编号、标题、状态、创建时间),以及
totals
(统计汇总,包含已合并PR数、开放PR数、已创建问题数、已关闭问题数)。
用户名通过
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, gmtModified
Other 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:
  1. 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 -c
    Render as ASCII bar chart (Mon–Fri).
  2. Highlights — From stats.sh data: most active repo (by commits), largest change (by insertions).
整合所有数据源。若某一数据源获取失败,则标注说明(例如:"GitHub 数据未获取"),并继续使用可用数据生成报告。
使用template.md模板进行渲染。
周报模式额外要求:
  1. 提交分布统计 — 针对stats.sh返回的活跃仓库,统计每个工作日的提交数:
    bash
    git log --since={since} --until={until_next_day} --author="{author}" --format="%aI" | \
      awk -F'T' '{print $1}' | sort | uniq -c
    渲染为ASCII柱状图(周一至周五)。
  2. 重点内容 — 从stats.sh数据中提取:提交数最多的活跃仓库、新增代码行数最多的变更。

Data Source Degradation

数据源降级处理

Source failedBehavior
GitHubNote "GitHub 数据未获取", continue
云效Note "云效数据未获取", continue
Both remoteOutput local git stats only
数据源获取失败处理方式
GitHub标注"GitHub 数据未获取",继续执行
云效标注"云效数据未获取",继续执行
两个远程数据源仅输出本地Git统计数据

Common Issues

常见问题

IssueFix
stats.sh empty reposCheck date range and
--author
filter
github.sh fails / 401Run
gh auth login
云效 MCP not connectedCheck MCP server configuration
问题解决方法
stats.sh返回空仓库列表检查日期范围和
--author
过滤条件
github.sh执行失败/返回401错误执行
gh auth login
云效MCP未连接检查MCP服务器配置

Identity Detection

身份识别

All user identities are auto-detected at runtime. See user-config.md for detection sources and prerequisites.
所有用户身份均在运行时自动检测。检测来源及前置条件请查看user-config.md