Files
log/README.md
T
jiantw83 e6fafd4132 feat(report): 新增工作日誌總結技能
What: 新增 jsc-log:report,把工作日誌總結成年報、月報、週報或日報,寫進 wiki REPORT_{HASH}。另加 tools/report-range.sh 算期間、tools/report-template.sh 解析範本,以及四份報表範本與報表目錄範本。
Why: worklog 只記單筆工作,累積起來沒有工具看得出一週或一個月做了什麼、什麼在卡。要總結只能自己翻頁面加總。
How: 期間換算交給系統的 date,不自己算閏年與週界;週次採 ISO-8601。範本解析採工作目錄優先,.jsc/templates/report-{period}.md 蓋過技能自帶的那份,專案要換格式不必改技能。資料讀 LOG_CONTENTS 列出的所有日誌頁,取工作日期落在期間內的條目,只加總條目真的寫了的數字。
Who: 工作日誌的期間總結。
2026-08-26 10:47:07 +08:00

80 lines
6.8 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.
# jsc-log — 工作日誌與統計
jsc 技能組的 log domain:工作完成後把十項資訊寫入 wiki 日誌頁(`LOG_{HASH}`,`HASH` 依共享規則計算;首碼若是數字或 `A`/`B`/`C`,改成 `H` 加上原前 7 碼;頁內仍按工作週週五整理),統計技能使用次數與呼叫鏈次數,並把技能執行的教訓記到 `LEARN_{HASH}`,供下次執行前查閱。
## 安裝、更新、移除
Marketplace 統一為 `jsc`(https://gitea.jsc.idv.tw/plugins/meta.git),安裝 token 為 `jsc-log@jsc`。每個指令一行:
| CLI | 安裝 | 更新 | 移除 |
| --- | --- | --- | --- |
| claude | `claude plugin marketplace add https://gitea.jsc.idv.tw/plugins/meta.git && claude plugin install jsc-log@jsc` | `claude plugin marketplace update jsc && claude plugin update jsc-log@jsc` | `claude plugin uninstall jsc-log@jsc` |
| codex | `codex plugin marketplace add https://gitea.jsc.idv.tw/plugins/meta.git && codex plugin add jsc-log@jsc` | `codex plugin marketplace upgrade jsc` | `codex plugin remove jsc-log@jsc` |
| copilot | `copilot plugin marketplace add https://gitea.jsc.idv.tw/plugins/meta.git && copilot plugin install jsc-log@jsc` | `copilot plugin marketplace update jsc && copilot plugin update jsc-log@jsc` | `copilot plugin uninstall jsc-log@jsc` |
| antigravity | `git clone https://gitea.jsc.idv.tw/plugins/log.git ~/plugins/log && agy plugin install ~/plugins/log` | `git -C ~/plugins/log pull && agy plugin uninstall jsc-log && agy plugin install ~/plugins/log` | `agy plugin uninstall jsc-log` |
| kiro | `kiro-cli plugin marketplace add https://gitea.jsc.idv.tw/plugins/meta.git && kiro-cli plugin install jsc-log@jsc` | `kiro-cli plugin marketplace update jsc && kiro-cli plugin update jsc-log@jsc` | `kiro-cli plugin uninstall jsc-log@jsc` |
> antigravity 不支援 gitea URL 安裝,改用本地 clone 路徑。批次操作五個 CLI:使用 `/jsc-cli:deploy`。
> 舊入口 `plugins/jsc` 已移除,marketplace 正本移到 `plugins/meta`。marketplace 名稱仍是 `jsc`(取自 marketplace.json 的 `name` 欄位,與存取庫名無關),安裝 token 不變;已從舊入口安裝過的人先執行 `claude plugin marketplace remove jsc`,再依上表重新 add。
## 工具
| 工具 | 用途 |
| --- | --- |
| `tools/usage-stats.sh` | 聚合 `$JSC_HOME/usage/*.jsonl`:`skills` 列技能使用次數、`chains` 列呼叫鏈次數(皆降冪),`--cli <name>` 過濾 |
| `tools/worklog-target.sh` | 接收已由 `jsc-gitea/tools/hash-id` 算好的 `HASH`,組出 `LOG_{HASH}`、`LOG_CONTENTS`(本身不再計算 SHA-1) |
| `tools/worklog-pending.sh` | 待寫入日誌的暫存區,存放於 `$JSC_HOME/worklog-pending/{HASH}/`。`add {HASH} {檔案}` 存一段內容(`jsc-sdlc` 的階段回報發現沒寫日誌時會呼叫),`cat {HASH}` 依時間印出全部、`list` 列路徑、`clear` 清除。結束碼 `3` 代表沒有暫存內容。**寫進 wiki 成功之後才 clear**,先清再寫會兩邊都沒有 |
| `tools/report-range.sh` | 算報表期間:`report-range.sh {daily\|weekly\|monthly\|yearly} [yyyy-MM-dd]` 印出「起<TAB>訖<TAB>標籤<TAB>期間」,含頭含尾。週採 ISO-8601(週一起算),標籤如 `2026-W35`。日期運算交給系統的 `date`,不自己算閏年 |
| `tools/report-template.sh` | 解析報表範本位置:`resolve {period}` 印出「路徑<TAB>project\|skill」,`list` 一次列四種期間。工作目錄的 `.jsc/templates/report-{period}.md` 優先於技能自帶的 `templates/` |
| `tools/token-usage.sh` | 讀單一 CLI 這次工作的 token 用量,印出「input(tab)output」;來源讀不到就印「N/A(tab)N/A」並正常結束。第二個參數傳 session id,就只讀該階段的 transcript,數字才會跟花費時間對得上。各 CLI 的取得方式寫在腳本開頭註解 |
## Skills 目錄
呼叫方式:Claude / Antigravity `/jsc-log:{name}`;Codex `${name}`;Copilot / Kiro 描述需求自動觸發。
<!-- JSC-SKILLS:START -->
### `worklog`
工作完成後蒐集十項資訊(存取庫、分支、計畫連結、工作包連結、花費時間、token 用量、任務狀態、執行細節、困難與解決、PR 目標分支),用 `tools/worklog-target.sh` 產生目標頁,再套範本附加到 `LOG_{HASH}` 與 `LOG_CONTENTS`。寫入前先讀 `tools/worklog-pending.sh cat {HASH}`:之前有階段跑完沒寫日誌,內容會暫存在那裡,這次一併寫進去,**寫成功之後才清暫存**。
### `stats`
統計本技能組各技能的使用次數與呼叫鏈使用次數,資料來源為 jsc-hooks 記錄的 `skills.jsonl` 與 `chains.jsonl`。
### `learn`
技能執行後把教訓(日期、技能、CLI、情境、教訓、下次做法)附加到 `LEARN_{HASH}` 並更新 `LEARN_CONTENTS`;技能執行前查閱同兩頁,套用相符的「下次做法」。
### `report`
把工作日誌總結成年報、月報、週報或日報。期間由 `tools/report-range.sh` 算出(週次採 ISO-8601),範本由 `tools/report-template.sh` 解析——工作目錄的 `.jsc/templates/report-{period}.md` 優先,沒有才用技能自帶的那份。讀 `LOG_CONTENTS` 列出的所有日誌頁,取工作日期落在期間內的條目,統計條目數、涵蓋存取庫、花費時間、token 用量、困難與未結項目,填進範本後寫入 wiki `REPORT_{HASH}`(`HASH` 取 `{owner}/{repo}/{期間}`),同一期間重跑只換掉那一節。單筆工作紀錄請用 `worklog`。
<!-- JSC-SKILLS:END -->
## 範本
| 檔案 | 用途 |
| --- | --- |
| `templates/log-entry.md` | 單筆工作日誌(十欄位) |
| `templates/log-contents.md` | 日誌目錄 `LOG_CONTENTS` |
| `templates/learn-page.md` | 教訓紀錄頁 `LEARN_{HASH}`(六欄表格,逐列附加) |
| `templates/learn-contents.md` | 教訓目錄 `LEARN_CONTENTS` |
| `templates/report-daily.md` | 日報:當天產出、卡住的地方、明天接著做 |
| `templates/report-weekly.md` | 週報:本週產出、用時分布、困難與解法、滾到下週的項目 |
| `templates/report-monthly.md` | 月報:本月成果、逐週推進、重複出現的困難、月底未結 |
| `templates/report-yearly.md` | 年報:全年總覽、逐月推進、里程碑、全年教訓、年底未結 |
| `templates/report-contents.md` | 報表目錄 `REPORT_CONTENTS` |
工作目錄放一份同名的 `.jsc/templates/report-{period}.md`,就會蓋過技能自帶的範本,不必改技能。
## 環境變數
Wiki 位置:日誌頁用 `JSC_WIKI_REPO_LOG`、教訓頁用 `JSC_WIKI_REPO_LEARN`、報表頁用 `JSC_WIKI_REPO_REPORT`,未設定退回 `JSC_WIKI_REPO`,再未設定就詢問(見 `jsc-gitea`)。先讀目前 shell 繼承的環境變數,缺值才詢問。
## 相關 domain
- [`jsc-hooks`](https://gitea.jsc.idv.tw/plugins/hooks):花費時間(`session-timer.sh report`)與用量資料來源
- [`jsc-gitea`](https://gitea.jsc.idv.tw/plugins/gitea):wiki 讀寫