usage 0.29.13
修正 1 項
移除 usage 不誤刪狀態列,讀壞掛鉤檔就停手
你曾把自己設定的終端機狀態列(終端機最底下顯示目前狀況的地方)留著,卻在移除 usage 加上的 Codex 狀態列時擔心它一起消失嗎?現在移除動作會逐字核對,只有完全等於 CODEX_STATUS_LINE 的那一列才會動;備份檔壞掉或內容型別不對時,設定和備份都原封不動。另一道保護留給掛鉤(特定事件發生時被觸發的小程式):~/.codex/hooks.json 不可讀時,usage 會中止,不再把它當空檔重寫,避免清掉你全部掛鉤,也不會留下半套安裝。像收走租來的衣架,先認準自己的標籤;看不清置物櫃裡的東西,就先不碰。
官方原文
**Removing the Codex status line no longer deletes one that usage never installed.** _unsetup_codex() only checked whether a tui.status_line existed at all, not whether it was ours. Anyone who had configured their own status line and then ran the removal lost it. Worse, a corrupt backup file made the restore path overwrite the config with an empty list and then delete the only backup, losing both at once. Removal now acts only when the status line matches CODEX_STATUS_LINE exactly, and an unreadable or wrong-typed backup leaves both the config and the backup untouched.
**A corrupt ~/.codex/hooks.json is no longer treated as an empty one.** _load_codex_hooks() returned {} for "file missing" and "file exists but won't parse" alike; terse mode then rebuilt from that empty dict and wrote it back, permanently erasing every Codex hook the user had, with no backup and no message. Codex writing that file while usage reads it is enough to trigger this. The unreadable case now aborts before anything is copied or written, so a failed run can no longer leave a half-installed state either.