Plan — Criz HTML Publish
產生於 2026-09-15 15:54 CST
目標:只有明確呼叫 criz-html-publish 時,才將指定 HTML 與其必要 assets 發布到 crizchien/criz-html-docs,再由 Cloudflare Pages 產生公開 production URL。其他文件維持本地。
1. 預計操作的步驟
Phase 1 — 權限與現況盤點
- read-only檢查 SSH、
gh auth、本機 Repo clone 與 Cloudflare 登入狀態。範圍:local credential state、GitHub、Cloudflare
- read-only首次進入各 Repo 時讀取 context、settings 與 hooks。範圍:local repo
- approval gate列出 hooks 意圖,由 Criz 決定是否 soft-load;不執行 hook 腳本。範圍:agent behavior
Phase 2 — Repo 與發布契約
- read-only檢查
criz-html-docs 現況,確認不覆蓋既有內容。範圍:local repo
- state-changing定義
public/<slug>/、documents.json、首頁、版本與下架規則。範圍:local files
Phase 3 — criz-html-publish 實作
- state-changing新增發布 skill:接收指定 HTML、解析 title/src/href/srcset、收集相對 assets。範圍:criz-html plugin/repo
- state-changing加入敏感資訊、絕對路徑、資產缺失與越界檢查。範圍:local files
- state-changing產生 slug 建議、更新 metadata、完整重建首頁。範圍:criz-html-docs working tree
Phase 4 — Exact-repo direct-main 例外
- state-changing在高優先級 workflow 規則加入只適用於
github.com/crizchien/criz-html-docs 的例外。範圍:shared agent workflow
- read-only驗證 skill identity、remote canonical identity、branch 與 working tree;任一不符即停止。範圍:local git state
Phase 5 — criz-html-docs 初始化
- state-changing建立
public/、空 metadata 與「Criz Shared Documents」首頁。範圍:local files
- read-only以本機瀏覽器確認純靜態首頁。範圍:local browser
- approval gate列出檔案與 diff;經確認後 commit、push。範圍:GitHub repo
Phase 6 — Cloudflare Pages
- state-changing建立獨立 Pages project,production branch 設
main,output directory 設 public。範圍:Cloudflare account
- user action由 Criz 完成 OAuth、帳號選擇與 GitHub App 授權,僅授權指定 Repo。範圍:GitHub、Cloudflare
- read-only確認 production deployment 與首頁 URL。範圍:public web
Phase 7 — 第一份正式文件
- user inputCriz 提供一份確定可公開的 HTML + assets 路徑。範圍:local files
- read-only驗證 assets、敏感內容與 slug。範圍:local files
- approval gate顯示 diff,經確認後 commit、push
main。範圍:GitHub、Cloudflare deployment
- read-only實際開啟 production,檢查首頁、文件、CSS、圖片、附件及固定 URL 更新。範圍:public web
Phase 8 — Cleanup 與交付
- state-changing移除暫存 scaffold,保留正式文件與必要設定。範圍:local files
- read-only回報 production URL、觸發方式、發布/更新/下架範例與精確驗證結果。範圍:delivery
2. 會執行或建議執行的指令
# read-only:檢查既有登入,不顯示 token
gh auth status
ssh -T git@github.com
# state-changing:執行前確認
git clone git@github.com:crizchien/criz-html-docs.git
# state-changing:只 stage 明確列出的發布檔案
git add public/<slug>/index.html public/<slug>/<asset> public/index.html public/documents.json
git commit -m "docs: publish <document-title>"
git push origin main
# 不執行
# source <local-credential-file>
# git add .
# git push --force
# git reset --hard
3. 安全性原則與注意事項
- ⚠️ Repo 是 Private,但 Cloudflare Pages 網站為公開;發布前人工確認仍是最後防線。
- 憑證:優先使用 SSH/既有
gh auth 與 Cloudflare GitHub App;不讀整份 .env,token 不進 skill、Git、plan 或 command history。
- 權限粒度:GitHub App 僅授權
crizchien/criz-html-docs;若日後需要 token,另建立 project-scoped 最小權限 credential。
- Direct-main:例外必須比對完整 remote identity、skill identity 與 branch;不能只比對 Repo basename。
- 撤銷:GitHub 可撤銷 Cloudflare App Repo access;Cloudflare 可刪除 Pages project;疑似 credential 外洩時先 revoke,再處理 Git history 與 deployment。
- 稽核與回滾:Git commit 保存每次發布差異;一般回滾以新 commit 還原。禁止 force push 與未確認的 history rewrite。
- 內容邊界:只發布指定 HTML 與解析到的相對 assets;未引用檔案與其他本地內容不進 Repo。
- Gate:Repo hooks、共用 workflow 例外、commit、push、Pages project、OAuth 授權與首次正式文件都需在對應邊界停下確認。