feat: convert --verify 對帳 + 修復 CRLF 使 hash 失準 + raw/** .gitattributes #1

Merged
yellowadmin merged 2 commits from feat/convert-verify-reconcile into main 2026-07-23 02:27:47 +00:00

2 Commits

Author SHA1 Message Date
LittleYellow
d41cb49a45 fix: 加 .gitattributes 對 raw/** 關閉換行正規化
core.autocrlf=true 下,已 commit 的 raw/converted/*.md 於 Windows checkout
會被 git 轉成 CRLF,使磁碟 bytes 與 manifest 登記的 LF-hash 不符、--verify
誤報 mismatch——在 git 層抵銷了轉換器的 write_bytes 修復。以 `raw/** -text`
把「登記 hash == 磁碟 bytes」的不變式延伸到 git 的 checkin/checkout。
AGENTS.md §1.4 補記此機制。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-23 08:23:04 +08:00
LittleYellow
f9a0cd2369 feat: convert 新增 --verify 對帳模式 + 修復 Windows CRLF 使 hash 失準
- convert.py --verify:純唯讀 re-hash 全部登記檔並掃未登記檔,
  報 missing/mismatch/unregistered,不一致退出碼 1(供刪除/竄改後稽核)
- 修 write_text 在 Windows 轉 \n→\r\n 使磁碟 bytes 與登記 SHA-256 不符
  (converted md 與 web 快照原始檔),改 write_bytes 寫入所登記的那份 bytes
- selfcheck 補 clean/missing/mismatch/unregistered 四情境(全程唯讀斷言)
- AGENTS.md §14 raw 完整性與修復流程 + §1.4 hash==磁碟 bytes 不變式

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-23 08:21:39 +08:00