Compare commits

..

5 Commits

Author SHA1 Message Date
LittleYellow
50f03d8939 ci: checkout 改為完整歷史(fetch-depth: 0)
預設淺層 clone 只有一個 commit,Claude 需要完整歷史才能比對分支與產生 diff。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-25 17:49:16 +08:00
LittleYellow
61d35dd851 ci: workflow 指定 claude 執行檔路徑
加 path_to_claude_code_executable 指向 /usr/local/bin/claude,
避免 runner 環境 PATH 找不到執行檔;順帶移除 GITEA_SERVER_URL 上方註解。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-25 17:37:42 +08:00
45fd1d5874 ci: 新增 Gitea Actions workflow 讓 Claude 回應 issue/PR 事件 (#8)
## 摘要

新增 `.gitea/workflows/claude.yml`,以 `markwylde/claude-code-gitea-action@v1.0.20` 掛在 issue/PR 事件上,讓 Claude 能回應留言與審查。

單一檔案、26 行、無既有檔案異動。

## 內容

- 觸發事件:`issue_comment`(created)、`pull_request_review_comment`(created)、`issues`(opened/assigned/labeled)、`pull_request_review`(submitted)
- runner label:`yellow-zeabur-runner`
- `GITEA_SERVER_URL` 覆寫為 `https://yellow-git.zeabur.app`,避免容器內部連結 `http://gitea:3000` 在外部無法存取

## 前提

合併後要生效,需 repo 已設定 secrets `ANTHROPIC_API_KEY` 與 `USER_TOKEN`,且 runner label `yellow-zeabur-runner` 已註冊。

## 審核注意

- 不含任何 `raw/`、`wiki/` 內容或 manifest 帳本變更(AGENTS.md §1.4/§14 不受影響)。
- 本分支原本還帶著 4 個 commit,但那些內容已由 PR #1#5 squash 合併進 main;分支已重設到 main 之上,只保留這一支 commit。

Co-authored-by: LittleYellow <crazytea@gmail.com>
Reviewed-on: #8
2026-07-25 06:19:16 +00:00
b90727fc11 feat: diag_refs 對帳診斷 + ingest 進度可見性/Ctrl-C 安全 (Closes #2) (#5)
## 摘要

本 PR 含兩個獨立關注點,各一 commit。

### 1. `diag_refs` — source_ref↔manifest 對帳診斷 (`04f4fd5`) — 回應 #4

lint 的「source_ref 不在 manifest」只報對不上、不辨成因。新增 `tools/diag_refs.py`,把每個對不上的 source_ref 分成五類(hash 不符/路徑字串岔開/檔名 hash 後綴岔開/檔在磁碟未登記/完全無對應),各附修法,讓「補帳本(§14.3)」與「修規則(§12)」的相反處置不再混為一談。純唯讀、結束碼 `0/1`,可當搬機或改 manifest 後的閘門。附 selfcheck 驗五型別分類、結束碼與零寫檔。README §3.3/§6/§7/§8 同步。

### 2. ingest 進度可見性 + Ctrl-C 安全回復 (`4add7fa`) — Closes #2

`--all-pending` 長時間本地 Ollama 攝入全程靜默,使用者不確定有沒有在跑、又不敢中斷:

- **進度可見**:每份來源 `[i/N]`、長文件逐段 `分段 k/n`、每個 item `↳ 新增/更新`、完成 `✓`,全 `flush=True` 即時顯示。
- **Ctrl-C 安全**:獨立攔 `KeyboardInterrupt`(它不是 `Exception` 子類,原本會略過善後)。因 commit 在迴圈之後,**main 必然未受影響**;中斷時印可照做的回復指令並以結束碼 130 收場。

## 測試

- `python tools/selfcheck_diag_refs.py` — ALL PASS
- `python tools/selfcheck_ingest.py` — ALL PASS(含進度標記、中斷後 main 未動、回復指令實測可回乾淨 main)
- README markdownlint 0 issues

Closes #2

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: LittleYellow <crazytea@gmail.com>
Reviewed-on: #5
2026-07-24 05:42:35 +00:00
356ae9367c feat: convert --verify 對帳 + 修復 CRLF 使 hash 失準 + raw/** .gitattributes (#1)
## 目的

`convert` 後檔案被手動刪除/就地改動時,提供正規的稽核與修復途徑;並修掉一個讓「還原後 re-hash 比對」在 Windows 失效的既有 bug。

## 變更

- **`convert.py --verify`(純唯讀對帳)**:re-hash 全部登記檔、掃未登記檔,回報 missing / mismatch / unregistered,不一致以退出碼 1 表示(可當 CI/排程閘門)。`converted/assets/*` 與 `.gitkeep` 正確略過。
- **修 CRLF 使 hash 失準**:`write_text` 在 Windows 把 `\n`→`\r\n`,但登記的 SHA-256 算在 `\n` bytes 上 → 磁碟 bytes 與帳本永遠對不上(converted md + web 快照原始檔)。改為 `write_bytes` 寫入所登記的那份 bytes。
- **`.gitattributes`(`raw/** -text`)**:`core.autocrlf=true` 下 checkout 會在 git 層重新引入 CRLF,抵銷上一項修復;關閉 raw 的換行正規化,把「登記 hash == 磁碟 bytes」不變式延伸到 git checkin/checkout。
- **selfcheck**:補 clean / missing / mismatch / unregistered 四情境(全程唯讀斷言;clean 案例含未入帳本的 assets,順帶證明不誤報)。
- **AGENTS.md**:新增 §14「raw 完整性與修復(對帳)」,並於 §1.4 補「登記 hash == 磁碟 bytes」不變式與 `.gitattributes` 機制。

## 驗證

`.venv/Scripts/python.exe tools/convert/selfcheck.py` → `ALL PASS`。

## 備註

`--verify` 是唯讀稽核工具,不改任何檔(含 manifest),符合 §7「lint 絕不擅自刪改」精神。修復決策(可衍生 vs 信任根、先 `git restore` 不改帳本、動 manifest 走 PR)詳見 AGENTS.md §14。

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: LittleYellow <crazytea@gmail.com>
Reviewed-on: #1
2026-07-23 02:27:47 +00:00

View File

@@ -0,0 +1,27 @@
name: Claude Assistant
on:
issue_comment:
types: [created]
pull_request_review_comment:
types: [created]
issues:
types: [opened, assigned, labeled]
pull_request_review:
types: [submitted]
jobs:
claude-response:
runs-on: yellow-zeabur-runner
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: markwylde/claude-code-gitea-action@v1.0.20
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
gitea_token: ${{ secrets.USER_TOKEN }}
claude_git_name: Claude
claude_git_email: claude@anthropic.com
path_to_claude_code_executable: /usr/local/bin/claude
env:
GITEA_SERVER_URL: https://yellow-git.zeabur.app