fix(overwrite): 只有頁面真的不存在才建新頁
- What:worklog、learn、report 三支技能共六處讀取分流改寫,只有結束碼 4 才建新頁; 結束碼 7 與 8 一律中止,一個字都不寫。三份目錄頁樣板補上寫入語意,明寫禁止整頁覆蓋、 不得改動別人的列。usage-stats.sh 的參數護欄改成明確回傳結束碼 2。 - Why:原本把「讀失敗」與「頁面不存在」當成同一件事。金鑰失效時讀取回 7,技能卻讀成 「這頁還沒有」,於是照樣板建一份新頁蓋回去。整份工作日誌會被這一筆條目取代, 既有教訓會被清成空表,報表則產出一份說「這段期間沒有工作」的假數字。 這些內容只活在 wiki 上,蓋掉就救不回來,所以這是本輪最要緊的一項。 - How:每一處讀取都先看結束碼再決定動作,並在技能文件裡列成表格: 0 接在既有內容後面附加,4 才從樣板建頁,5 缺網址就中止,7 金鑰或權限問題就中止, 8 其他 API 失敗就中止。目錄頁一律先讀整頁再改那一列。 stats 也補上分流,參數錯誤不再被讀成「零次」。 - Who:worklog、learn、report、stats 四支技能的 wiki 讀寫與統計輸出。
This commit is contained in:
@@ -17,5 +17,11 @@ Data is recorded continuously by `jsc-hooks/hooks/skill-usage.sh` under `$JSC_HO
|
||||
|
||||
## Reporting
|
||||
|
||||
1. Run the tool directly and present the output as a table. Done when every line the tool printed appears as one table row.
|
||||
2. When the tool prints no rows, explain that `jsc-hooks` must be installed and wired first via `jsc-hooks:hooks-install`. Done when that instruction is reported and no table is shown.
|
||||
1. Run the tool directly and branch on its exit code — never read the printed lines without it.
|
||||
|
||||
| Exit | Do |
|
||||
| --- | --- |
|
||||
| 0 | Present every printed line as one table row. No line printed is still exit 0: the data file under `$JSC_HOME/usage/` does not exist yet, which is a count of zero, not a failure — say the counts are zero and that `jsc-hooks` has to be installed and wired via `jsc-hooks:hooks-install` before anything is recorded, and show no table |
|
||||
| 2 | The subcommand or the `--cli` argument was rejected — the subcommand is neither `skills` nor `chains`, or `--cli` came with no value. Fix the argument and rerun. Never rerun the same command unchanged, and never report the counts as zero: nothing was read |
|
||||
|
||||
Done when the exit code was read and the branch it names was taken.
|
||||
|
||||
Reference in New Issue
Block a user