[Developing] Claude Code plugins & marketplace for telecom cloud automation. Wraps O-RAN O2-IMS/DMS, Nephio (Porch/kpt) and Kubernetes as MCP tools to realize Intent→KRM→GitOps with QoS assurance.
$git clone https://github.com/thc1006/telecom-ops-claude-code-pluginsInstalls into the current project.
Install telecom-ops-claude-code-plugins by running `git clone https://github.com/thc1006/telecom-ops-claude-code-plugins`, then use it for the current task and follow its documentation at https://github.com/thc1006/telecom-ops-claude-code-plugins.
| 1 | # Telecom Ops Claude Code Plugin |
| 2 | |
| 3 | 一個針對電信營運(O-RAN/Nephio)的 Claude Code 插件,提供網路切片意圖解析、O2-IMS 狀態查詢等功能。本插件展示了 Claude Code 插件系統的完整能力,包括 Slash Commands、Agents、Hooks 與 MCP Server 整合。 |
| 4 | |
| 5 | ## 功能特性 |
| 6 | |
| 7 | ### 🎯 Slash Commands(斜槓指令) |
| 8 | |
| 9 | #### `/telecom-ops:intent-parse` |
| 10 | 將自然語言的服務意圖轉換為 Nephio 相容的 KRM(Kubernetes Resource Model)配置包。 |
| 11 | |
| 12 | **使用範例:** |
| 13 | ``` |
| 14 | /telecom-ops:intent-parse intent description: VR network, bandwidth: 5 Mbps downlink, latency: 9 ms, single UE test |
| 15 | ``` |
| 16 | |
| 17 | **功能:** |
| 18 | - 解析帶寬、延遲、可靠性等參數 |
| 19 | - 映射到 3GPP S-NSSAI 和 NSST 標準 |
| 20 | - 生成 `QoSIntent.yaml` 和 `NetworkSlice.yaml` |
| 21 | - 建立完整的 Kpt package 結構 |
| 22 | |
| 23 | **輸出:** |
| 24 | ``` |
| 25 | output/ |
| 26 | └── vr-network-package/ |
| 27 | ├── Kptfile |
| 28 | ├── QoSIntent.yaml |
| 29 | ├── NetworkSlice.yaml |
| 30 | └── README.md |
| 31 | ``` |
| 32 | |
| 33 | #### `/telecom-ops:o2-status` |
| 34 | 查詢 O2-IMS(O-RAN O2 Interface for Infrastructure Management Service)清單與站點狀態。 |
| 35 | |
| 36 | **使用範例:** |
| 37 | ``` |
| 38 | /telecom-ops:o2-status edge01 |
| 39 | /telecom-ops:o2-status # 查詢所有站點 |
| 40 | ``` |
| 41 | |
| 42 | **功能:** |
| 43 | - 站點健康狀態監控 |
| 44 | - CPU、記憶體、儲存容量查詢 |
| 45 | - 網路介面使用率統計 |
| 46 | - 告警與部署工作負載狀態 |
| 47 | |
| 48 | ### 🤖 Agent(智能代理) |
| 49 | |
| 50 | **`intent-translator`** - 網路切片意圖翻譯器 |
| 51 | |
| 52 | 專門用於將高層級的電信服務意圖轉換為具體的 Kubernetes 資源清單。 |
| 53 | |
| 54 | **能力:** |
| 55 | - 意圖分析:從自由文本中提取關鍵參數 |
| 56 | - 規格映射:將參數映射到 S-NSSAI 值和網路切片模板 |
| 57 | - 清單生成指引:規劃 KRM package 結構 |
| 58 | - GitOps 整合建議:如何整合到 Porch/ConfigSync 自動化流程 |
| 59 | |
| 60 | **配置:** |
| 61 | - 模型:Haiku(快速響應) |
| 62 | - 工具:NotebookRead, TodoWrite |
| 63 | - 顏色:藍色 |
| 64 | |
| 65 | ### 🪝 Hooks(鉤子事件) |
| 66 | |
| 67 | 插件配置了 PostToolUse hook,在每次工具調用後自動觸發。 |
| 68 | |
| 69 | **當前配置:** |
| 70 | ```json |
| 71 | { |
| 72 | "hooks": { |
| 73 | "PostToolUse": [ |
| 74 | { |
| 75 | "matcher": "*", |
| 76 | "hooks": [ |
| 77 | { |
| 78 | "type": "command", |
| 79 | "command": "${CLAUDE_PLUGIN_ROOT}/scripts/kpt-render.sh" |
| 80 | } |
| 81 | ] |
| 82 | } |
| 83 | ] |
| 84 | } |
| 85 | } |
| 86 | ``` |
| 87 | |
| 88 | **效果:** |
| 89 | 每次工具執行後,終端會顯示: |
| 90 | ``` |
| 91 | [telecom-ops] PostToolUse hook triggered. This is where you could run kpt rendering or validation. |
| 92 | ``` |
| 93 | |
| 94 | **擴充性:** |
| 95 | 可新增 PreToolUse、Notification 等 hooks,實現: |
| 96 | - 檔案寫入前的驗證 |
| 97 | - YAML 語法檢查 |
| 98 | - 自動執行 kpt render |
| 99 | - 錯誤通知與告警 |
| 100 | |
| 101 | ### 🔌 MCP Server 整合 |
| 102 | |
| 103 | **⚠️ (進階)MCP Server:若你替換 `.mcp.json` 為實際 O2-IMS / Nephio / kubectl server,插件啟用時會自動啟動對應 server,成為 Claude 的工具。** |
| 104 | |
| 105 | **此功能尚未完全開發完成。** 目前提供的是 stub 配置範例。 |
| 106 | |
| 107 | **當前配置(示例):** |
| 108 | ```json |
| 109 | { |
| 110 | "mcpServers": { |
| 111 | "telecom-cli": { |
| 112 | "command": "${CLAUDE_PLUGIN_ROOT}/scripts/telecom-mcp-server.sh", |
| 113 | "args": [], |
| 114 | "env": { |
| 115 | "EXAMPLE_ENV": "value" |
| 116 | } |
| 117 | } |
| 118 | } |
| 119 | } |
| 120 | ``` |
| 121 | |
| 122 | **未來規劃:** |
| 123 | 連接實際的 O2-IMS MCP Server 後,將提供以下工具: |
| 124 | - `mcp__o2ims_list_sites` - 列出所有站點 |
| 125 | - `mcp__o2ims_get_site_status` - 獲取站點詳細狀態 |
| 126 | - `mcp__o2ims_list_resource_pools` - 查詢資源池 |
| 127 | - `mcp__o2ims_get_deployments` - 列出部署的工作負載 |
| 128 | - `mcp__o2ims_query_alarms` - 查詢告警事件 |
| 129 | - `mcp__o2ims_get_inventory` - 查詢硬體清單 |
| 130 | |
| 131 | **配置方式:** |
| 132 | 參考 `telecom-ops/.mcp.json`,替換為實際的 MCP server 端點與認證資訊。 |
| 133 | |
| 134 | ## 專案結構 |
| 135 | |
| 136 | ``` |
| 137 | telecom-ops-claude-code-plugins/ |
| 138 | ├── .claude-plugin/ |
| 139 | │ ├── plugin.json # 插件元數據 |
| 140 | │ └── marketplace.json # Marketplace 配置 |
| 141 | │ |
| 142 | ├── telecom-ops/ # 插件主體 |
| 143 | │ ├── agents/ |
| 144 | │ │ └── intent-translator.md # 意圖翻譯 Agent |
| 145 | │ ├── commands/ |
| 146 | │ │ ├── intent-parse.md # Intent Parse 指令 |
| 147 | │ │ └── o2-status.md # O2 Status 指令 |
| 148 | │ ├── hooks/ |
| 149 | │ │ └── hooks.json # Hook 配置 |
| 150 | │ ├── scripts/ |
| 151 | │ │ ├── kpt-render.sh # PostToolUse hook 腳本 |
| 152 | │ │ └── telecom-mcp-server.sh # MCP server stub |
| 153 | │ └── .mcp.json # MCP server 配置 |
| 154 | │ |
| 155 | └── telecom-ops-tests/ # 測試套件 |
| 156 | ├── prompts/ |
| 157 | │ ├── S1_intent_to_krm.md # 測試案例 1:意圖解析 |
| 158 | │ ├── S2_o2_status.md # 測試案例 2:O2 狀態查詢 |
| 159 | │ └── S3_hook_check.md # 測試案例 3:Hook 驗證 |
| 160 | ├── output/ # 生成的 KRM packages |
| 161 | ├── scripts/ |
| 162 | │ └── run_headless.sh # Headless 自動化測試 |
| 163 | └── README.md |
| 164 | ``` |
| 165 | |
| 166 | ## 安裝與使用 |
| 167 | |
| 168 | ### 方法 1:從 GitHub 安裝(推薦) |
| 169 | |
| 170 | ```bash |
| 171 | # 在 Claude Code 中執行 |
| 172 | /plugin marketplace add thc1006/telecom-ops-claude-code-plugins |
| 173 | /plugin install telecom-ops@telecom-ops-marketplace |
| 174 | ``` |
| 175 | |
| 176 | ### 方法 2:本地安裝(開發用) |
| 177 | |
| 178 | ```bash |
| 179 | # 克隆專案 |
| 180 | git clone https://github.com/thc1006/telecom-ops-claude-code-plugins.git |
| 181 | cd telecom-ops-claude-code-plugins |
| 182 | |
| 183 | # 在 Claude Code 中執行 |
| 184 | /plugin marketplace add ./telecom-ops-tests/dev-marketplace |
| 185 | /plugin install telecom-ops@dev-marketplace |
| 186 | ``` |
| 187 | |
| 188 | ### 啟用插件 |
| 189 | |
| 190 | ```bash |
| 191 | /plugin enable telecom-ops |
| 192 | ``` |
| 193 | |
| 194 | ### 驗證安裝 |
| 195 | |
| 196 | 重啟 Claude Code 後,執行: |
| 197 | ```bash |
| 198 | /plugin list |
| 199 | ``` |
| 200 | |
| 201 | 應該會看到 `telecom-ops` 插件已啟用。 |
| 202 | |
| 203 | ## 測試案例 |
| 204 | |
| 205 | ### 測試 1:Intent Parse(意圖解析) |
| 206 | |
| 207 | ``` |
| 208 | 請使用 telecom-ops 插件提供的 /intent parse 指令, |
| 209 | 把這段意圖轉為 KRM 草案並列出預計輸出: |
| 210 | VR network,5 Mbps 下行,9 ms 延遲,單 UE 測試。 |
| 211 | ``` |
| 212 | |
| 213 | **預期結果:** |
| 214 | - 生成 `QoSIntent.yaml`(包含 5QI=7, 9ms latency, 5Mbps bandwidth) |
| 215 | - 生成 `NetworkSlice.yaml`(eMBB 類型,單 UE 配置) |
| 216 | - 生成 `Kptfile` 和 `README.md` |
| 217 | - 輸出路徑提示 |
| 218 | |
| 219 | ### 測試 2:O2 Status(狀態查詢) |
| 220 | |
| 221 | ``` |
| 222 | 請示範 /o2 status --site edge01, |
| 223 | 若目前尚未串到實際 O2-IMS,先用 stub 文本回覆 site/health/capacity 欄位。 |
| 224 | ``` |
| 225 | |
| 226 | **預期結果:** |
| 227 | - 顯示站點 `edge01` 的健康狀態(OK/DEGRADED) |
| 228 | - 顯示 CPU、記憶體、網路容量與使用率 |
| 229 | - 說明如何配置真實的 O2-IMS MCP server |
| 230 | |
| 231 | ### 測試 3:Hook Verification(Hook 驗證) |
| 232 | |
| 233 | ``` |
| 234 | 請執行一個會觸發工具調用的動作,並在回覆中說明: |
| 235 | (1) 我應該在終端看到哪些訊息可判定 PostToolUse hook 已觸發? |
| 236 | (2) 若要再加上 PreToolUse 或 Notification 的 hook,hooks.json 應怎麼擴充? |
| 237 | ``` |
| 238 | |
| 239 | **預期結果:** |
| 240 | - 終端顯示 `[telecom-ops] PostToolUse hook triggered...` |
| 241 | - 提供 PreToolUse 和 Notification hooks 的配置範例 |
| 242 | - 說明 `${CLAUDE_PLUGIN_ROOT}` 變數的使用方式 |
| 243 | |
| 244 | ### 自動化測試 |
| 245 | |
| 246 | 使用 headless 模式執行所有測試: |