Files
Arcrun/mcp/src/brand.ts
T
Claude 53080ffa53 docs(mcp): GUIDE/README 全面改教 arcrun_*,清掉死 u6u_ 工具名
死文件治理:GUIDE.md(25 處)與 README.md(21 處)仍在教 u6u_* 工具名,
含本 PR 已刪的 4 個 tool(deploy/execute/get/list_workflows),下個 CC 照著走會撞牆。

- 全部 u6u_* → 現役 arcrun_*(component/tag/gui 那批用新名)
- 已刪 tool 改指現役:execute→run、deploy→push、get/list_workflows→crud 版
- 修正因換工具而失真的流程與參數:沙盒測試段改為 arcrun_validate_yaml(部署前
  schema 驗證)→ arcrun_push_workflow(部署)→ arcrun_run_workflow(觸發,帶
  api_key/name/input);get_workflow 參數 workflow_id→name
- 順帶把兩處品牌 prose "u6u" 改 "Arcrun"
- grep 確認兩檔零 u6u

brand.ts:釐清 ARCRUN_TOOL_PREFIX 覆蓋僅內部 rebrand 過渡 / 測試鉤子,
Workers runtime 無 process 全域基本不生效、勿當對外特性。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015d5jDbuqT5Htwv3Q88XXKk
2026-07-07 05:37:54 +00:00

28 lines
1.4 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* 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"。內部另留一個 rebrand 過渡 / 單元測試用的覆蓋鉤子
* ARCRUN_TOOL_PREFIX,經 globalThis.process 安全取值)——但 Cloudflare
* Workers runtime 沒有 process 全域,部署後此覆蓋「基本不生效」、一律 fallback 到
* "arcrun"。**這不是對外 / 用戶可用特性,勿寫進對外文件**;正式 rebrand 請直接改本檔預設值。
*/
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}`;