feat(registry): aliases.yaml scope synonym table + contract aliases field

- registry/aliases.yaml: scope-level synonym table for 21 built-in components
  covers api (gmail/google_sheets/telegram/line_notify/http_request),
  data (string/array/date/number/json), logic (if/foreach/switch/try_catch/wait),
  ai scopes; includes zh/en/abbrev variants
- types.ts: add optional aliases[] field to ComponentContractSchema
- CONTRIBUTING.md: explain aliases auto-merge from aliases.yaml vs manual contract aliases

Note: manual maintenance for now; aliases.yaml becomes KBDB synonym graph seed data
when KBDB is introduced.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-16 14:34:16 +08:00
parent 875ecd2265
commit d8028eabe0
3 changed files with 159 additions and 0 deletions
+21
View File
@@ -143,6 +143,27 @@ description: "Gmail 發信零件" # 只是名稱的同義詞,搜不到任何
原則:把這個 description 給一個不知道這個零件存在的人看,他能判斷「這就是我要的東西」嗎?
### aliases(搜尋同義詞)
arcrun 在 `registry/aliases.yaml` 維護一份 scope 級別的同義詞表。當你的零件 `canonical_id` 以已知 scope 為前綴,Registry 建立搜尋索引時會**自動**把對應的同義詞合併進去,不需要在 contract 裡手動填。
例如 `canonical_id: google_sheets_append`Registry 會自動從 aliases.yaml 取得 `google_sheets` scope 的同義詞(`gsheets``試算表``spreadsheet`...),搜這些詞都能找到你的零件。
**如果你的零件有額外的情境同義詞**(超出 scope 範圍),可以在 contract 內手動補充:
```yaml
canonical_id: "google_sheets_append"
aliases:
- "新增資料列" # 情境同義詞,超出 scope 範圍
- "insert row"
# google_sheets scope 的同義詞(gsheets / 試算表 / spreadsheet...
# 由 registry/aliases.yaml 自動合併,不需要重複填寫
```
**想新增新 scope 的同義詞**(例如你要加一個 `notion` 零件):在 `registry/aliases.yaml` 的對應 category 下加一個新 key,開 PRmerge 後所有以 `notion_` 開頭的零件都自動繼承。
> 這個機制目前是手工維護。未來接入 KBDB 後,`canonical_id` 將獲得系統派發的唯一 hash id,同義詞表將成為 KBDB synonym graph 的初始資料。
---
## TinyGo 零件開發