refactor(mcp): u6u_* tool 全面 rename 為 arcrun_* + 前綴收斂單一來源
零 u6u 洩漏(leo 要求 1):connector tool 清單只剩 arcrun_*,並移除壞掉/
重複的 u6u_ workflow tool(deploy/execute/get/list_workflows 由 arcrun_
push/run/get/list_workflows 取代);MCP server name 也由 u6u-mcp-server
改 arcrun-mcp-server。
前綴單一真相源(leo 要求 2):新增 mcp/src/brand.ts(TOOL_PREFIX + toolName()
helper),所有 server.tool() 註冊一律走 toolName("suffix"),前綴不再明碼散寫。
未來 rebrand 只改 brand.ts 一行。
- 12 個獨有能力 tool rename(component/tag/gui/search_workflows)
- 4 個重複/壞掉 tool 移除
- inter-tool hint、描述字串、註解內 u6u_ 名字全數更新
- tsc exit 0;vitest 19/19 綠
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015d5jDbuqT5Htwv3Q88XXKk
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* brand.ts — MCP tool 名前綴的單一真相源(single source of truth)。
|
||||
*
|
||||
* 為什麼存在(leo 硬要求 2):
|
||||
* 歷史上 tool 名前綴(早期 "u6u_"、對外改名後應為 "arcrun_")被明碼散寫在
|
||||
* ~39 個 tool 檔裡,每次 rebrand 都得逐檔手改、極易漏 → u6u 洩漏給用戶。
|
||||
* 收斂成這一個常數後,未來再 rebrand「只改這一行」。
|
||||
*
|
||||
* 用法:
|
||||
* import { toolName } from "../brand.js";
|
||||
* server.tool(toolName("push_workflow"), ...) // → "arcrun_push_workflow"
|
||||
*
|
||||
* 語意後綴(push_workflow / list_tags …)保留可讀,只有「品牌前綴」被變數化。
|
||||
*
|
||||
* 可用環境變數 ARCRUN_TOOL_PREFIX 覆蓋(測試 / 未來 rebrand 過渡用),預設 "arcrun"。
|
||||
* (Workers runtime 無 process 全域,故用 globalThis 安全取值,取不到就 fallback。)
|
||||
*/
|
||||
|
||||
const envPrefix = (globalThis as { process?: { env?: Record<string, string | undefined> } })
|
||||
.process?.env?.ARCRUN_TOOL_PREFIX;
|
||||
|
||||
export const TOOL_PREFIX = envPrefix || "arcrun";
|
||||
|
||||
/** 把語意後綴組成完整 tool 名,例:toolName("whoami") → "arcrun_whoami"。 */
|
||||
export const toolName = (suffix: string): string => `${TOOL_PREFIX}_${suffix}`;
|
||||
Reference in New Issue
Block a user