fix(self-hosted): 修壓測四阻斷項 + 設定分層 + init 非互動
壓測(docs/壓測報告.md)發現 acr init --self-hosted 對任何非官方 CF 帳號都裝不起來,且設定寫死全域單檔 + 強制 TTY。本次一併修: R2 dead storage 全清(#3#4,registry-canon Phase 1.5 補完): - cypher-executor wrangler.toml/test.toml/types.ts 移除 WASM_BUCKET binding - CLI deploy.ts/init.ts/cf-api.ts/config.ts 移除 R2 建立邏輯與 wasm_bucket - R2 綁信用卡違背「開源免費自架」核心;bucket 名 WASM_BUCKET 本就非法 → self-hosted 改為只需 Workers + KV(皆免費額度、不綁卡) fork 帳號部署阻斷(#1#2): - deploy.ts 新增 stripOfficialOnlyBindings(),注入暫存副本時移除 [[routes]]/zone_name/[[r2_buckets]]/[ai](fork 沒有 arcrun.dev zone) - 不刪 repo 內 toml(官方 prod CI 部署仍需 routes),只在 CLI self-hosted 路徑 strip 設定分層 + 非互動(#7#8): - config.ts loadConfig 改三層:env > 專案層 .arcrun.yaml(就近往上找)> 全域 - init 支援 --account-id/--api-token flag + CLOUDFLARE_* env,缺才互動 - 新增 acr config --where 顯示每個值的來源層(token 自動遮罩) - gitignore 一併排除 .arcrun.yaml 驗收:tsc 全綠;三層 merge 端對端測試 8/8;strip 對真實 toml 驗證 routes/R2/AI 移除而 name/workers_dev/KV 保留。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+2
-16
@@ -78,7 +78,8 @@ export class CfKvClient {
|
||||
/**
|
||||
* Cloudflare Account-level API wrapper(self-hosted installer 用)。
|
||||
*
|
||||
* 負責 acr init --self-hosted 的資源建立:驗 token、建/列 KV namespace、建 R2 bucket、查 workers.dev subdomain。
|
||||
* 負責 acr init --self-hosted 的資源建立:驗 token、建/列 KV namespace、查 workers.dev subdomain。
|
||||
* (不建 R2:R2 是 dead storage 且綁卡違背開源免費;見 init.ts step 2 + registry-canon Phase 1.5。)
|
||||
* 與 CfKvClient(綁單一 namespace 的 KV 操作)職責不同——這個是帳號層級的資源管理。
|
||||
* 對應 SDD:.agents/specs/arcrun/sdk-and-website/self-hosted-init.md §3 step 1-2
|
||||
*/
|
||||
@@ -138,21 +139,6 @@ export class CfAccountClient {
|
||||
return result.id;
|
||||
}
|
||||
|
||||
/** 建立 R2 bucket(已存在則略過,冪等)。*/
|
||||
async ensureR2Bucket(name: string): Promise<void> {
|
||||
try {
|
||||
await this.cf<{ name: string }>('/r2/buckets', {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ name }),
|
||||
});
|
||||
} catch (e) {
|
||||
// bucket 已存在 → CF 回 10004 之類;視為冪等成功
|
||||
const msg = e instanceof Error ? e.message : String(e);
|
||||
if (/already exists|10004/i.test(msg)) return;
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查 workers.dev subdomain(cypher-executor WORKER_SUBDOMAIN 用,組對內 component URL)。*/
|
||||
async getWorkersSubdomain(): Promise<string> {
|
||||
const result = await this.cf<{ subdomain: string }>('/workers/subdomain');
|
||||
|
||||
Reference in New Issue
Block a user