AnyBot/docs/restructure/06-migration-roadmap.md

2.7 KiB

06 · 遷移路線(分階段,每階段可獨立全綠)

規則:一個階段 = 一串 pure-move commit(T1 門禁);階段結尾跑 T2 + 受影響區 T3。 任何階段失敗 → 回滚到該階段起點(最後全綠 commit),不硬湊。

階段 內容 驗收
P0 封箱 產生 T0 全部基線(用現況程式);新增 move-check.sh、邊界鎖骨架(此時只有 1 個 crate,鎖為未來預留) 基線可重复产生(跑兩次 sha 相同)
P1 workspace 化 根 Cargo.toml 變 workspace;现有 bin crate 原樣搬進 crates/app-bin;relay 收進 members;.cargo/config.toml cargo test 全綠,執行檔 byte 級對等(T2)
P2 shared 搬 shared/i18n/i18n_table/lock/logfile/store/stats/usage/version/icons/theme 全綠 + appearance/settings 區步驟
P3 core(leaf 先行) 先搬無 UI 依赖的:checkpoints facts evidence find marks docindex garden always hooks mcp mcp_oauth providers model chatgpt m2v embed;再搬 agent 面:agent brains tools policy gate claims triggers intents workflow routines schedule goal plan teach skills memory memstore secrets vault_store doctor speech voice m2v 渲染面留 ui 四大鎖檔全綠 + bots/autonomy/memory/models/routines/schedule/goal/plan/skills/vault 區
P4 platform platform-mac(axread axwrite macapps mic computer)、platform-linux(x11 wl portal desk landlock)、platform-win(win);core 定義 trait,platform 實作 實機測試(--ignored)+ computers/apps/sandbox 區;人類簽名
P5 net + browser httpd net egress tunnel remote lantls bidi;browser botbrowser preview web wire;channels 區模組 → channels crate;relay 對等 server/connectors/browser/pageview/channels/deliver/phone 區 + T2(httpd 端點表)
P6 ui app/*_ui.rs 41 檔 + app.rs 拆成 ui crate 模組;layout_audit 隨行 layout_audit 綠 + 全部 UI 區(大階段,照 README 全面順序)
P7 app-bin 收尾 main.rs 極簡化(照提案:main 只初始化、lib.rs 暴露 App::build);shim 全部移除;src/ 刪除 根 tests/ E2E(04 六張時序圖)+ 全區驗收
P8 清理 根目錄雜物進 assets/(cat-*.png、mechanics.json)、scripts/ 收編、benches/ 收編 bench/;src/chatgpt_test_key.b64 移出 src(資安,獨立 commit 先做) featuremap:: 綠 + 目視清单

里程碑定義

  • P3 完成 = 「agent 可改的極限」解除:core crate 可獨立編譯/測試,Bot 邏輯不再被 UI 拖累。
  • P7 完成 = 目標結構(01)完全落地,鎖檔測試升格為跨 crate 契約。

前置動作(不等重構)

  1. chatgpt_test_key.b64 移出 src —— 資安,馬上做,走正常功能協定 commit。
  2. 本目錄六份文件送「乾淨脈絡獨立審閱」(CLAUDE.md 條件 2):提不出 P0/P1 才開始 P0。