20c7610371
leo 2026-07-20 明令:「已經改用 cf 自己的 secrets,不要再說它了」 「我希望以後再也看不到這個詞再出現」 背景:credential 早已遷移至 CF Workers per-script Secrets + D1 目錄, 舊的自管金鑰(client 端 AES-GCM + KV 密文 + crypto_decrypt)是遷移期遺留。 本次連根移除,含一併作廢的死 SaaS 碼。 移除: - 舊 KV 密文解密路徑(credential-injector.ts 整檔、dual-read fallback) 前置驗證:leo21c / youlin 兩帳號 CREDENTIALS_KV 實測 *:cred:* 皆 0 筆 - migrate-to-workers-secrets 搬家端點(回填已完成,無可回填) - /register 路由與 generateApiKey(HMAC 產 ak_ key 是 SaaS 遺物; self-hosted 走 namespace 明碼 D21,已無人使用) - platform_crypto component(三帳號實測 404 已退役,無 workflow 引用) 保留(附理由): - crypto_decrypt 保留為永遠回失敗的 stub——現役三個 auth .wasm 仍宣告該 import,缺項會讓 WASM instantiate 直接失敗。待零件重編後可真正刪除。 順帶修復(原不在範圍,但會實際壞事): - /auth/callback 有 `if (!key) redirect(server_error)` 閘,未設該 secret 的 實例會登入直接失敗 → 已移除 - OAuth 兩處把 provider token 寫進舊加密 KV(租戶鍵與實際 api_key 在 rotate 後必然分歧,已失效)→ 改導向 Workers Secrets,包 try/catch 不影響登入 - acr init Standard 模式呼叫已刪除的 /register → 改引導 OAuth 取 key - .claude/rules 與 system-dev/docs 是同一規範的兩份鏡像,先前只改 rules 導致鏡像仍在教舊做法 → 已同步(此類雙檔同步應納入檢查) 新用戶安裝從此零 secret 前置。 測試 187/188(唯一 fail 為 pre-existing,stash 驗證與本次無關); cypher-executor 與 cli typecheck 全綠。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
50 lines
1.7 KiB
TypeScript
50 lines
1.7 KiB
TypeScript
/**
|
|
* acr config [--where] — 顯示目前生效的設定與每個值的來源層。
|
|
* 解壓測 §1.2 建議 #3:讓使用者一眼確認「現在這個資料夾正用哪個帳號」,避免用錯帳號部署。
|
|
* SDD: sdk-and-website/config-layering.md §3.1
|
|
*/
|
|
import chalk from 'chalk';
|
|
import {
|
|
resolveConfigSources,
|
|
activeProjectConfigPath,
|
|
type ConfigSource,
|
|
} from '../lib/config.js';
|
|
|
|
const SOURCE_LABEL: Record<ConfigSource, string> = {
|
|
env: 'env 變數',
|
|
project: '專案層 .arcrun.yaml',
|
|
global: '全域 ~/.arcrun/config.yaml',
|
|
default: '預設值',
|
|
};
|
|
|
|
/** 敏感欄位只印前綴,避免把 token 完整印到終端 / log。*/
|
|
const SENSITIVE = new Set(['api_key', 'cf_api_token']);
|
|
|
|
function mask(field: string, value: string): string {
|
|
if (SENSITIVE.has(field) && value.length > 8) return `${value.slice(0, 8)}…`;
|
|
return value;
|
|
}
|
|
|
|
export async function cmdConfig(_options: { where?: boolean }): Promise<void> {
|
|
const rows = resolveConfigSources();
|
|
const projectPath = activeProjectConfigPath();
|
|
|
|
console.log(chalk.bold('\n arcrun 目前生效的設定\n'));
|
|
|
|
if (projectPath) {
|
|
console.log(chalk.gray(` 專案層設定:${projectPath}(覆蓋全域)`));
|
|
} else {
|
|
console.log(chalk.gray(' 專案層設定:無(此資料夾未放 .arcrun.yaml,使用全域)'));
|
|
}
|
|
console.log('');
|
|
|
|
const fieldWidth = Math.max(...rows.map(r => r.field.length), 4);
|
|
for (const { field, value, source } of rows) {
|
|
const name = field.padEnd(fieldWidth);
|
|
console.log(
|
|
` ${chalk.cyan(name)} ${mask(field, value)} ${chalk.gray(`← ${SOURCE_LABEL[source]}`)}`,
|
|
);
|
|
}
|
|
console.log(chalk.gray('\n 優先序:env 變數 > 專案層 .arcrun.yaml > 全域 ~/.arcrun/config.yaml\n'));
|
|
}
|