fix(worklog): 下放 LOG 目標頁計算並統一 hash

This commit is contained in:
2026-08-21 16:53:17 +00:00
parent e70ee90efe
commit f81da60d02
9 changed files with 73 additions and 27 deletions
+8 -12
View File
@@ -1,6 +1,6 @@
---
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.
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_{HASH} plus LOG_CONTENTS. HASH follows the shared 8-char rule with the H-prefix fallback, and the work-week Friday still drives the page content. Trigger at the end of implement or maintain; not for planning notes.
---
# worklog — work log
@@ -13,8 +13,8 @@ After work completes, collect the ten items below and append a `templates/log-en
| --- | --- | --- |
| 1 | Repository name | Parse `{owner}/{repo}` from `git remote get-url origin` |
| 2 | Branch name | `git branch --show-current` |
| 3 | Plan name | Link to the plan page `[[PLAN_{...}]]` |
| 4 | Work package id | Link to the work package heading on the analyze page `[[ANALYZE_{...}#WP-xx]]` |
| 3 | Plan name | Link to the plan page `[[PLAN_{HASH}]]` |
| 4 | Work package id | Link to the work package heading on the analyze page `[[ANALYZE_{HASH}#WP-xx]]` |
| 5 | Elapsed time | `jsc-hooks/hooks/session-timer.sh report {session_id}` (seconds; convert to h/m) |
| 6 | Token usage | See the table below; per-CLI methods differ. Fill `N/A` when unavailable |
| 7 | Task status | One of the literal values 「完成」、「部分完成」、「阻塞」 (with reason when blocked) |
@@ -32,14 +32,10 @@ After work completes, collect the ten items below and append a `templates/log-en
| antigravity | Value shown in the UI; `N/A` when unreadable |
| kiro | No public source; fill `N/A` |
## Target page and week number
## Target page and work week
- Page name: `LOG_{yyyyMM}_W{週數}`. Both values come from the Friday of the current work week:
```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 )) # which Friday of the month
```
- Page name: `LOG_{HASH}`.
- Compute the target page by running `tools/worklog-target.sh "{owner}/{repo}" all`. Use `PAGE` for `LOG_{HASH}` and `CONTENTS` for `LOG_CONTENTS`.
- The work-week Friday still drives the page content and the row dates.
- Read the page via `jsc-gitea:wiki`. If it does not exist, create it with the structure described in `templates/log-contents.md`; otherwise APPEND the new entry at the end.
- Update `LOG_CONTENTS` in the same pass (apply `templates/log-contents.md`; add the week's row if missing).
- Update `LOG_CONTENTS` in the same pass (apply `templates/log-contents.md`; add the row if missing).