Files
log/skills/worklog/SKILL.md
T
2026-08-21 13:08:43 +08:00

46 lines
2.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
name: worklog
description: After finishing a work package, collect ten facts (repo, branch, plan link, work package link, elapsed time from session-timer, token usage per CLI, status, details, difficulties, PR target) and append a templated entry to wiki LOG_{yyyyMM}_W{week} plus LOG_CONTENTS. Week number is derived from the Friday of the work week. Trigger at the end of implement or maintain; not for planning notes.
---
# worklog — 工作日誌
工作完成後蒐集以下十項資訊,套用 `templates/log-entry.md` 附加到 wiki 日誌頁。蒐集與寫入**必須以 sub agent 執行**。
## 蒐集項目
| # | 項目 | 來源 |
| --- | --- | --- |
| 1 | 存取庫名稱 | `git remote get-url origin` 解析出 `{owner}/{repo}` |
| 2 | 分支名稱 | `git branch --show-current` |
| 3 | 計畫名稱 | 連結到計畫頁 `[[PLAN_{...}]]` |
| 4 | 工作包編號 | 連結到分析頁的工作包標題 `[[ANALYZE_{...}#WP-xx]]` |
| 5 | 花費時間 | `jsc-hooks/hooks/session-timer.sh report {session_id}`(秒,換算 h/m) |
| 6 | token 用量 | 見下表,各 CLI 取法不同;不可得填 `N/A` |
| 7 | 任務狀態 | 完成 / 部分完成 / 阻塞(附原因) |
| 8 | 執行細節與產出 | 摘要改了什麼、產出哪些檔案或頁面 |
| 9 | 遇到的困難 + 解決方式 | 一行一組 |
| 10 | PR 的目標分支 | 連結到 PR 頁 |
### token 用量取得方式
| CLI | 取法 |
| --- | --- |
| claude | transcript JSONL(`~/.claude/projects/**/*.jsonl`)的 `usage` 欄位加總,或 `claude -p --output-format json` 的 `usage` |
| codex | `~/.codex/sessions/**` 的 token 計數,或工作階段內 `/status` |
| copilot | 工作階段內 `/usage` |
| antigravity | 介面顯示值;無法讀取時 `N/A` |
| kiro | 無公開來源,填 `N/A` |
## 目標頁與週數計算
- 頁名:`LOG_{yyyyMM}_W{週數}`,兩者都取自**本工作週的週五**:
```sh
dow=$(date +%u)
if [ "$dow" -ge 6 ]; then f=$(date -d 'last friday' +%Y%m%d); else f=$(date -d 'friday' +%Y%m%d); fi
yyyyMM=$(printf '%s' "$f" | cut -c1-6)
W=$(( ( $(printf '%s' "$f" | cut -c7-8 | sed 's/^0//') - 1 ) / 7 + 1 )) # 該週五是當月第幾個週五
```
- 經由 `jsc-gitea:wiki` 讀取該頁;不存在就以 `templates/log-contents.md` 說明的結構新建,存在就把新條目**附加**在文末。
- 同步更新 `LOG_CONTENTS`(套用 `templates/log-contents.md`,該週的列不存在就新增)。