huaweicloud-devkit 1.0.0 → 1.0.2-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,13 +1,15 @@
1
- # HuaweiCloud DevKit
1
+ # HuaweiCloud DevKit
2
2
 
3
3
  [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)
4
4
  [![CI](https://github.com/huaweicloud/HuaweiCloud-Devkit/actions/workflows/ci.yml/badge.svg)](https://github.com/huaweicloud/HuaweiCloud-Devkit/actions/workflows/ci.yml)
5
5
 
6
- 帮助 AI 编码助手安全、准确地使用华为云——技能引导、KooCLI 工具、安全策略一站式集成。
6
+ **[中文](README.zh-CN.md) | English**
7
7
 
8
- HuaweiCloud DevKit AI 编码助手提供操作华为云所需的知识、工具和安全护栏,支持 OpenCode、Codex、码道(CodeArts Agent)等主流 Agent。
8
+ Help AI coding agents use Huawei Cloud safely and accurately — a single integration that gives agents cloud knowledge, CLI tooling, and safety guardrails.
9
9
 
10
- ## 快速开始
10
+ Supports OpenCode, Codex, CodeArts Agent, and WorkBuddy.
11
+
12
+ ## Quick Start
11
13
 
12
14
  ### OpenCode
13
15
 
@@ -15,13 +17,13 @@ HuaweiCloud DevKit 为 AI 编码助手提供操作华为云所需的知识、工
15
17
  npx --yes huaweicloud-devkit install
16
18
  ```
17
19
 
18
- 自动安装 27 个技能、MCP 服务器和安全策略,并更新 OpenCode 配置。安装后**重启会话**使 MCP 工具生效。
20
+ Installs the DevKit into OpenCode automatically. **Restart the session** after installation.
19
21
 
20
22
  ```bash
21
- npx --yes huaweicloud-devkit doctor # 自检:hcloud、MCP、技能、认证
22
- npx --yes huaweicloud-devkit status # 查看安装状态
23
- npx --yes huaweicloud-devkit update # 更新到最新版
24
- npx --yes huaweicloud-devkit uninstall # 卸载
23
+ npx --yes huaweicloud-devkit doctor # self-check
24
+ npx --yes huaweicloud-devkit status # show status
25
+ npx --yes huaweicloud-devkit update # update
26
+ npx --yes huaweicloud-devkit uninstall # uninstall
25
27
  ```
26
28
 
27
29
  ### Codex
@@ -30,127 +32,84 @@ npx --yes huaweicloud-devkit uninstall # 卸载
30
32
  npx --yes huaweicloud-devkit install --target codex
31
33
  ```
32
34
 
33
- > 需要先安装 Codex CLI。`--target all` 会在 Codex CLI 缺失时跳过 Codex。
34
-
35
- ### CodeArts Agent(码道)
35
+ > The Codex CLI must be installed first.
36
36
 
37
- 码道没有插件市场,通过技能 + MCP 机制适配:
37
+ ### CodeArts Agent
38
38
 
39
39
  ```bash
40
40
  npx --yes huaweicloud-devkit install --target codearts
41
41
  ```
42
42
 
43
- 自动安装 27 个技能到 `~/.codeartsdoer/skills/` 与项目级 `.codeartsdoer/skills/`,MCP 服务器注册到用户级与项目级 `.codeartsdoer/mcp/mcp_settings.json`。若本机已存在 KooCLI(`~/hcloud/hcloud.exe`),会自动将 `HCLOUD_BIN` 注入 MCP 配置。安装后**重启会话**使 MCP 工具生效。
43
+ **Restart the session** after installation.
44
44
 
45
45
  ```bash
46
- npx --yes huaweicloud-devkit install-hcloud # 安装 KooCLI(自动接受隐私协议)
47
- npx --yes huaweicloud-devkit doctor # 自检:hcloud、MCP、技能、沙箱模式
48
- npx --yes huaweicloud-devkit status --target codearts # 查看码道安装状态
49
- npx --yes huaweicloud-devkit uninstall --target codearts # 卸载
46
+ npx --yes huaweicloud-devkit install-hcloud # install KooCLI
47
+ npx --yes huaweicloud-devkit doctor # self-check
48
+ npx --yes huaweicloud-devkit status --target codearts
49
+ npx --yes huaweicloud-devkit uninstall --target codearts
50
50
  ```
51
51
 
52
- > **沙箱模式**:码道默认 `bash_mode: sandbox` 会阻止 KooCLI 写入配置目录(如 `~/.hcloud/root`),导致隐私协议无法持久化、KooCLI 无法运行。`install-hcloud` 会自动检测沙箱模式并给出明确指引——请在**码道外终端**安装使用 KooCLI,或在码道设置中关闭沙箱模式(设置权限 → Bash 模式)后重试。
52
+ > **Sandbox mode**: CodeArts defaults to sandbox mode which blocks KooCLI. `install-hcloud` detects this and shows how to resolve it — install KooCLI outside the sandbox terminal, or disable sandbox mode in CodeArts settings (Settings Permissions → Bash mode).
53
53
  >
54
- > **认证**:KooCLI 就绪后,还需在码道外终端执行 `hcloud configure init` 配置 AK/SK 与区域,然后即可在码道中描述你的华为云任务。
54
+ > **Authentication**: Run `hcloud configure init` to configure AK/SK and region.
55
+
56
+ ### WorkBuddy
57
+
58
+ ```bash
59
+ npx --yes huaweicloud-devkit install --target workbuddy
60
+ ```
55
61
 
56
- ### 其他 Agent
62
+ **Restart the session** after installation.
57
63
 
58
- 对于支持 Model Context Protocol (MCP) 的 Agent,手动配置 MCP 服务器:
64
+ ### Other Agents
65
+
66
+ For agents that support the Model Context Protocol (MCP):
59
67
 
60
68
  ```json
61
69
  {
62
70
  "mcp": {
63
71
  "huaweicloud-devkit": {
64
72
  "type": "local",
65
- "command": ["node", "<路径>/plugins/huaweicloud-core/src/mcp-server.mjs"],
73
+ "command": ["node", "<path>/plugins/huaweicloud-core/src/mcp-server.mjs"],
66
74
  "enabled": true
67
75
  }
68
76
  }
69
77
  }
70
78
  ```
71
79
 
72
- 然后安装技能:
80
+ Then install:
73
81
 
74
82
  ```bash
75
83
  npx --yes huaweicloud-devkit install
76
84
  ```
77
85
 
78
- > **前置条件:** 需要安装 [KooCLI](https://support.huaweicloud.com/qs-hcli/hcli_02_003.html)(`hcloud`)并完成认证。MCP 服务器需要 Node.js >= 20。如果 `hcloud` 不在 `PATH` 中,请设置 `HCLOUD_BIN` 环境变量指向完整路径。
79
-
80
- ## 包含内容
81
-
82
- ### 插件
83
-
84
- `huaweicloud-core` 插件将 MCP 服务器配置、27 个 Agent 技能和安全策略打包为一次性安装。
85
-
86
- | 插件 | 说明 |
87
- |------|------|
88
- | [huaweicloud-core](plugins/huaweicloud-core/) | 核心插件,含技能、MCP 服务器、安全策略。**从这里开始。** |
89
-
90
- ### 技能
91
-
92
- Agent 技能是经过整理的指令和参考材料包,帮助 Agent 完成特定的华为云任务。技能按需加载——Agent 只发现和检索与当前任务相关的内容。
93
-
94
- 包含 6 个元技能(路由、发现、CLI/认证、API/SDK、安全、排错)和 20 个服务技能(覆盖 ECS、OBS、VPC、IAM、RDS、GaussDB、FunctionGraph、APIG、CCE、SMN/DMS、ModelArts、Cloud Eye、CTS、DEW、Billing、CBR、WAF/AAD、DDS/DCS、Deployment、Getting Started)。
95
-
96
- 浏览 [`skills/`](plugins/huaweicloud-core/skills/) 目录查看所有可用技能。
97
-
98
- ### Rules 文件
99
-
100
- 推荐的项目级配置文件,告诉 Agent 如何高效使用华为云——例如优先使用 MCP 服务器、发现可用技能、遵循最小权限 IAM 原则。
101
-
102
- 详见 [`rules/huawei-agent-rules.md`](rules/huawei-agent-rules.md)。
103
-
104
- ### MCP 服务器
105
-
106
- 本地 MCP 服务器(`plugins/huaweicloud-core/src/mcp-server.mjs`)通过 Model Context Protocol 为 Agent 提供安全的 KooCLI 访问。
107
-
108
- - **安全优先执行** — 所有 `hcloud` 命令执行前自动分类(读/写/密钥),写操作需用户明确批准。
109
- - **输出脱敏** — 凭证形态的值(AK/SK、Token、密码)自动替换为 `***REDACTED***`。
110
- - **16 个结构化工具** — 技能搜索、CLI 检查、只读命令、区域发现、错误解释、Hook 风险检查等。
111
- - **零运行时依赖** — 纯 Node.js(>= 20),无需 npm install。
112
-
113
- 详见 [MCP 工具表](#mcp-工具)。
86
+ > **Prerequisites:** [KooCLI](https://support.huaweicloud.com/qs-hcli/hcli_02_003.html) (`hcloud`) installed and authenticated. Node.js >= 20 required.
114
87
 
115
- ## 安全模型
88
+ ## What It Does
116
89
 
117
- 三层防御体系:
90
+ - **Guided cloud operations** — agents get step-by-step guidance for 20+ Huawei Cloud services (ECS, OBS, VPC, RDS, GaussDB, FunctionGraph, APIG, CCE, and more)
91
+ - **Safety-first execution** — all write operations require explicit user approval; credentials and secrets are automatically redacted from output
92
+ - **Pre-execution risk checks** — public exposure, credential leaks, and destructive operations are caught before they run
93
+ - **Regional awareness** — auto-discovers available regions and checks service availability before creating resources
118
94
 
119
- | 层级 | 机制 | 说明 |
120
- |------|------|------|
121
- | 技能层 | `SKILL.md` 流程文档 | 教会 Agent 正确的行为规则和安全用法 |
122
- | 钩子层 | `huaweicloud-safety.py` | PreToolUse Hook 阻断高风险工具调用 |
123
- | MCP 层 | `safety-policy.mjs` | Node.js 安全策略包装器,在所有 Agent 环境中强制执行 |
95
+ ## Supported Services
124
96
 
125
- 详见 [`docs/safety-model.md`](docs/safety-model.md)。
97
+ ECS, OBS, VPC, IAM, RDS, GaussDB, FunctionGraph, APIG, CCE, SMN/DMS, ModelArts, Cloud Eye, CTS, DEW, Billing, CBR, WAF/AAD, DDS/DCS, Deployment, and Getting Started guides.
126
98
 
127
- ## MCP 工具
99
+ ## Documentation
128
100
 
129
- | 类别 | 工具 | 说明 |
130
- |------|------|------|
131
- | 知识发现 | `huaweicloud_search_docs` | 跨技能文件及文档全文搜索 |
132
- | 知识发现 | `huaweicloud_retrieve_skill` | 按名称加载完整技能内容及参考文件 |
133
- | 知识发现 | `huaweicloud_list_regions` | 列出可用华为云区域 |
134
- | 知识发现 | `huaweicloud_get_regional_availability` | 检查目标区域的服务可用性 |
135
- | CLI | `huaweicloud_check_cli` | 检查 KooCLI `hcloud` 是否已安装 |
136
- | CLI | `huaweicloud_plan_cli_command` | 分类计划命令(读/写/密钥)但不执行 |
137
- | CLI | `huaweicloud_list_operations` | 列出服务的可用 KooCLI 操作 |
138
- | CLI | `huaweicloud_run_readonly_command` | 执行只读命令并脱敏输出 |
139
- | CLI | `huaweicloud_run_approved_command` | 经用户明确批准后执行写命令 |
140
- | 安全 | `huaweicloud_show_profile_redacted` | 安全查看 KooCLI 配置(凭证脱敏) |
141
- | 安全 | `huaweicloud_hook_check_command` | 执行前检查 Shell/KooCLI 命令风险 |
142
- | 安全 | `huaweicloud_hook_check_artifacts` | 检查生成的代码、IaC、IAM/OBS 策略和配置文件风险 |
143
- | 安全 | `huaweicloud_hook_check_deploy_plan` | 检查沙箱、预览环境和云资源部署计划风险 |
144
- | 路由 | `huaweicloud_service_catalog` | 返回推荐的能力来源排序 |
145
- | 排错 | `huaweicloud_explain_error` | 解释错误码并建议诊断步骤 |
101
+ - [Architecture](docs/architecture.md)
102
+ - [Safety Model](docs/safety-model.md)
103
+ - [Hook Rule Model](docs/hook-rule-model.md)
104
+ - [Changelog](docs/CHANGELOG.md)
105
+ - [KooCLI official docs](https://support.huaweicloud.com/qs-hcli/hcli_02_003.html)
146
106
 
147
- ## 文档
107
+ ## Contributors
148
108
 
149
- - [系统架构设计](docs/01-系统架构设计.md)
150
- - [核心技能设计](docs/02-核心技能设计.md)
151
- - [安全模型](docs/safety-model.md)
152
- - [KooCLI 官方文档](https://support.huaweicloud.com/qs-hcli/hcli_02_003.html)
109
+ <a href="https://github.com/huaweicloud/huaweicloud-devkit/graphs/contributors">
110
+ <img src="https://contrib.rocks/image?repo=huaweicloud/huaweicloud-devkit" />
111
+ </a>
153
112
 
154
- ## 许可证
113
+ ## License
155
114
 
156
- 本项目基于 Apache-2.0 许可证发布。详见 [LICENSE](LICENSE)
115
+ This project is licensed under the Apache-2.0 License. See [LICENSE](LICENSE).
@@ -0,0 +1,115 @@
1
+ # HuaweiCloud DevKit
2
+
3
+ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)
4
+ [![CI](https://github.com/huaweicloud/HuaweiCloud-Devkit/actions/workflows/ci.yml/badge.svg)](https://github.com/huaweicloud/HuaweiCloud-Devkit/actions/workflows/ci.yml)
5
+
6
+ **中文 | [English](README.md)**
7
+
8
+ 帮助 AI 编码助手安全、准确地使用华为云——一站式集成云知识、CLI 工具和安全护栏。
9
+
10
+ 支持 OpenCode、Codex、码道(CodeArts Agent)、WorkBuddy。
11
+
12
+ ## 快速开始
13
+
14
+ ### OpenCode
15
+
16
+ ```bash
17
+ npx --yes huaweicloud-devkit install
18
+ ```
19
+
20
+ 自动安装 DevKit。安装后**重启会话**。
21
+
22
+ ```bash
23
+ npx --yes huaweicloud-devkit doctor # 自检
24
+ npx --yes huaweicloud-devkit status # 查看状态
25
+ npx --yes huaweicloud-devkit update # 更新
26
+ npx --yes huaweicloud-devkit uninstall # 卸载
27
+ ```
28
+
29
+ ### Codex
30
+
31
+ ```bash
32
+ npx --yes huaweicloud-devkit install --target codex
33
+ ```
34
+
35
+ > 需要先安装 Codex CLI。
36
+
37
+ ### CodeArts Agent(码道)
38
+
39
+ ```bash
40
+ npx --yes huaweicloud-devkit install --target codearts
41
+ ```
42
+
43
+ 安装后**重启会话**。
44
+
45
+ ```bash
46
+ npx --yes huaweicloud-devkit install-hcloud # 安装 KooCLI
47
+ npx --yes huaweicloud-devkit doctor # 自检
48
+ npx --yes huaweicloud-devkit status --target codearts
49
+ npx --yes huaweicloud-devkit uninstall --target codearts
50
+ ```
51
+
52
+ > **沙箱模式**:码道默认沙箱模式会阻止 KooCLI 运行。`install-hcloud` 自动检测并给出指引——请在码道外终端安装使用 KooCLI,或在码道设置中关闭沙箱模式(设置 → 权限 → Bash 模式)。
53
+ >
54
+ > **认证**:执行 `hcloud configure init` 配置 AK/SK 与区域。
55
+
56
+ ### WorkBuddy
57
+
58
+ ```bash
59
+ npx --yes huaweicloud-devkit install --target workbuddy
60
+ ```
61
+
62
+ 安装后**重启会话**。
63
+
64
+ ### 其他 Agent
65
+
66
+ 支持 MCP 协议的 Agent,手动配置:
67
+
68
+ ```json
69
+ {
70
+ "mcp": {
71
+ "huaweicloud-devkit": {
72
+ "type": "local",
73
+ "command": ["node", "<路径>/plugins/huaweicloud-core/src/mcp-server.mjs"],
74
+ "enabled": true
75
+ }
76
+ }
77
+ }
78
+ ```
79
+
80
+ 然后安装:
81
+
82
+ ```bash
83
+ npx --yes huaweicloud-devkit install
84
+ ```
85
+
86
+ > **前置条件:** 需要安装 [KooCLI](https://support.huaweicloud.com/qs-hcli/hcli_02_003.html)(`hcloud`)并完成认证。Node.js >= 20。
87
+
88
+ ## 功能特性
89
+
90
+ - **引导式云操作** — Agent 获得 20+ 华为云服务的分步操作指引(ECS、OBS、VPC、RDS、GaussDB、FunctionGraph、APIG、CCE 等)
91
+ - **安全优先执行** — 所有写操作需用户明确批准;凭证和密钥自动脱敏
92
+ - **执行前风险检查** — 公网暴露、凭证泄露、破坏性操作在执行前即被拦截
93
+ - **区域感知** — 自动发现可用区域,创建资源前检查服务可用性
94
+
95
+ ## 支持的服务
96
+
97
+ ECS、OBS、VPC、IAM、RDS、GaussDB、FunctionGraph、APIG、CCE、SMN/DMS、ModelArts、Cloud Eye、CTS、DEW、Billing、CBR、WAF/AAD、DDS/DCS、Deployment,以及入门指南。
98
+
99
+ ## 文档
100
+
101
+ - [架构](docs/architecture.md)
102
+ - [安全模型](docs/safety-model.md)
103
+ - [Hook 规则模型](docs/hook-rule-model.md)
104
+ - [变更记录](docs/CHANGELOG.md)
105
+ - [KooCLI 官方文档](https://support.huaweicloud.com/qs-hcli/hcli_02_003.html)
106
+
107
+ ## 贡献者
108
+
109
+ <a href="https://github.com/huaweicloud/huaweicloud-devkit/graphs/contributors">
110
+ <img src="https://contrib.rocks/image?repo=huaweicloud/huaweicloud-devkit" />
111
+ </a>
112
+
113
+ ## 许可证
114
+
115
+ 本项目基于 Apache-2.0 许可证发布。详见 [LICENSE](LICENSE)。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "huaweicloud-devkit",
3
- "version": "1.0.0",
3
+ "version": "1.0.2-dev.1",
4
4
  "description": "Agent toolkit that helps coding agents use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities safely and accurately.",
5
5
  "type": "module",
6
6
  "files": [
@@ -32,6 +32,7 @@
32
32
  "agent",
33
33
  "codex",
34
34
  "opencode",
35
+ "workbuddy",
35
36
  "mcp",
36
37
  "koocli",
37
38
  "hcloud"
@@ -5,6 +5,7 @@
5
5
  "args": [
6
6
  "./src/mcp-server.mjs"
7
7
  ],
8
+ "cwd": ".",
8
9
  "env": {
9
10
  "HUAWEICLOUD_AGENT_TOOLKIT_MODE": "local"
10
11
  }
@@ -0,0 +1,44 @@
1
+ {
2
+ "name": "huaweicloud-core",
3
+ "version": "1.0.0",
4
+ "description": "Guide coding agents to use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities with safer execution and less context.",
5
+ "author": {
6
+ "name": "HuaweiCloud Mate",
7
+ "url": "https://github.com/huaweicloud"
8
+ },
9
+ "homepage": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
10
+ "repository": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
11
+ "license": "Apache-2.0",
12
+ "keywords": [
13
+ "huaweicloud",
14
+ "huawei-cloud",
15
+ "koocli",
16
+ "hcloud",
17
+ "agent",
18
+ "mcp",
19
+ "api",
20
+ "sdk",
21
+ "skills"
22
+ ],
23
+ "skills": "./skills/",
24
+ "mcpServers": "./.mcp.json",
25
+ "hooks": "./hooks/",
26
+ "interface": {
27
+ "displayName": "HuaweiCloud Devkit",
28
+ "shortDescription": "HuaweiCloud Devkit - Huawei Cloud guidance, CLI/API/SDK routing, MCP tools, and safety for coding agents.",
29
+ "longDescription": "HuaweiCloud Devkit helps coding agents choose and use Huawei Cloud Skills, KooCLI, APIs, SDKs, and MCP tools with less context, safer command execution, and more accurate cloud implementation decisions.",
30
+ "developerName": "HuaweiCloud Mate",
31
+ "category": "Cloud",
32
+ "capabilities": [
33
+ "Read",
34
+ "Interactive"
35
+ ],
36
+ "websiteURL": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
37
+ "brandColor": "#C7000B",
38
+ "defaultPrompt": [
39
+ "Help me choose the right Huawei Cloud capability.",
40
+ "Check my Huawei Cloud CLI setup safely.",
41
+ "Plan this Huawei Cloud API or SDK task."
42
+ ]
43
+ }
44
+ }
@@ -54,14 +54,34 @@ Key gotchas when creating:
54
54
 
55
55
  ### Add Public Access (ELB Provider Only)
56
56
 
57
+ `BASIC` instances have no public IP. Use `PROFESSIONAL` + `elb` provider for public access (`lvs` is internal-only).
58
+
57
59
  ```bash
58
60
  hcloud APIG AddIngressEipV2 \
59
61
  --instance_id=<id> \
60
62
  --bandwidth_charging_mode=bandwidth \
61
- --bandwidth_size=5
63
+ --bandwidth_size=<size>
64
+ ```
65
+
66
+ To use an existing EIP instead of creating a new one:
67
+
68
+ ```bash
69
+ hcloud APIG AddIngressEipV2 \
70
+ --instance_id=<id> \
71
+ --eip_id=<existing-eip-id>
62
72
  ```
63
73
 
64
- > `AddIngressEipV2` only works with `elb` provider. `AddEipV2` requires `lvs` provider. Bandwidth minimum is 5 Mbps.
74
+ > `AddIngressEipV2` only works with `elb` provider. `AddEipV2` (without "Ingress") requires `lvs` provider. Bandwidth minimum is 5 Mbps.
75
+
76
+ **Verification** — After binding, poll the instance to confirm EIP is active:
77
+
78
+ ```bash
79
+ hcloud APIG ListInstancesV2 --cli-region=<region> --instance_id=<id> --cli-output=json | jq '.instances[0].eip_address'
80
+ ```
81
+
82
+ Wait for `eip_address` to show a valid IP (may take up to 2 minutes). If `eip_address` is still `null` after 2 minutes, the EIP may not have been assigned.
83
+
84
+ > **Trap**: `sl_domain` from `CreateApiGroupV2` is an **internal-only** domain (e.g., `*.apic.cn-north-4.huaweicloudapis.com`). It may resolve to internal IP only (NXDOMAIN from public internet). **For public access, always use the `eip_address` from the instance**, not the `sl_domain` or trigger `invoke_url`.
65
85
 
66
86
  ## API Group
67
87
 
@@ -53,6 +53,23 @@ hcloud CES CreateAlarm --help
53
53
  # --condition.comparison_operator, --condition.count
54
54
  ```
55
55
 
56
+ ### `--condition.comparison_operator` Legal Values
57
+
58
+ For metric alarms use **symbols** (NOT words like `gt`/`lt`):
59
+
60
+ | Value | Meaning |
61
+ |-------|---------|
62
+ | `>` | Greater than |
63
+ | `>=` | Greater than or equal |
64
+ | `<` | Less than |
65
+ | `<=` | Less than or equal |
66
+ | `=` | Equal |
67
+ | `!=` | Not equal |
68
+
69
+ For event alarms: `cycle_decrease`, `cycle_increase`, `cycle_wave`.
70
+
71
+ > **Trap**: Shell may interpret `>` and `<` as redirect operators. Always quote: `--condition.comparison_operator=">="` or use `--cli-jsonInput=<file>`.
72
+
56
73
  ## Troubleshooting
57
74
 
58
75
  | Error | Fix |
@@ -57,6 +57,7 @@ Flavor families are **region-dependent**. Always run `hcloud ECS ListFlavors --c
57
57
  | Security group rule | hcloud VPC CreateSecurityGroupRule --security_group_id=<id> --direction=<direction> --protocol=<protocol> | references/sg.md |
58
58
  | Attach disk | hcloud EVS AttachVolume --volume_id=<id> --server_id=<id> | references/evs.md |
59
59
  | Delete instance | hcloud ECS DeleteServers --servers.1.id=<id> --delete_publicip=true --delete_volume=true | references/create-instance.md |
60
+ | Reboot instance | hcloud ECS BatchRebootServers --reboot.servers.1.id=<id> --reboot.type=SOFT | NOT `RebootServer` — that operation does not exist |
60
61
 
61
62
  ## How to Search for Instances
62
63
 
@@ -66,8 +67,57 @@ Flavor families are **region-dependent**. Always run `hcloud ECS ListFlavors --c
66
67
  2. Filter client-side by name substring, tag, or status
67
68
  3. Use `--server_tags` filter if instances are tagged: `hcloud ECS ListServersDetails --server_tags.1.key=Project`
68
69
 
70
+ > **Return structure**: `ListServersDetails` returns `{"servers": [...]}` (array), NOT `{"server": ...}`. Parse as `.servers[0].status`, NOT `.server.status`.
71
+
69
72
  Abort if the result set is larger than `--limit` and ask the user to narrow the search.
70
73
 
74
+ ## Instance Status Polling
75
+
76
+ ECS creation is asynchronous. Status transitions: `BUILD` → `ACTIVE` (or `ERROR`). Wait times vary widely (20s–3min), never use fixed sleep.
77
+
78
+ Poll strategy:
79
+
80
+ ```bash
81
+ for i in $(seq 1 30); do
82
+ status=$(hcloud ECS ListServersDetails --cli-region=<region> --server_id=<id> --cli-output=json | jq -r '.servers[0].status')
83
+ if [ "$status" = "ACTIVE" ]; then break; fi
84
+ if [ "$status" = "ERROR" ]; then echo "Creation failed"; exit 1; fi
85
+ sleep 10
86
+ done
87
+ ```
88
+
89
+ - Poll interval: 10 seconds
90
+ - Maximum wait: 5 minutes (30 iterations)
91
+ - Check for `ERROR` status to detect creation failures early
92
+
93
+ ## SSH Connection Verification
94
+
95
+ After ECS is ACTIVE and EIP is bound, verify SSH connectivity:
96
+
97
+ ```bash
98
+ hcloud ECS ListServersDetails --cli-region=<region> --server_id=<id>
99
+ # → addresses.<vpc-id>[].OS-EXT-IPS:addr
100
+
101
+ ssh -o StrictHostKeyChecking=accept-new -i <path-to-private-key> root@<eip-address>
102
+ ```
103
+
104
+ > **SSH verification checklist**: EIP bound → security group has port 22 ingress → keypair private key saved locally → known_hosts handled with `StrictHostKeyChecking=accept-new` (or delete stale entries with `ssh-keygen -R <ip>`).
105
+
106
+ ### Running Commands Inside the Instance
107
+
108
+ Use SSH for any in-instance operations (install software, check logs, start services):
109
+
110
+ ```bash
111
+ ssh -o StrictHostKeyChecking=accept-new -i <key> root@<eip> 'command'
112
+ ```
113
+
114
+ Example — re-run failed cloud-init setup manually:
115
+ ```bash
116
+ ssh -o StrictHostKeyChecking=accept-new -i <key> root@<eip> 'dnf install -y nginx && systemctl enable --now nginx'
117
+ ```
118
+
119
+ > If SCP blocks SSH, use cloud-init `--server.user_data` for full deployment instead. See `references/create-instance.md` §Bootstrap.
120
+
71
121
  ## Deleting Instances
72
122
 
73
123
  - Show the user the exact command and get explicit approval before running
@@ -61,6 +61,11 @@ hcloud ECS CreateServers ... --server.user_data=$user_data
61
61
  > **Security**: Never embed secrets (passwords, AK/SK, tokens) in user_data. It is stored unencrypted and readable from within the instance via IMDS. Fetch secrets at boot from DEW/CSMS instead.
62
62
  >
63
63
  > **Debugging**: If the script didn't run, check `/var/log/cloud-init-output.log` on the instance.
64
+ >
65
+ > **Recovery after failure**: user_data only executes on **first boot**. Restarting the instance will NOT re-run user_data scripts. If cloud-init fails (e.g., DNS missing → `yum`/`apt` cannot resolve repos):
66
+ > 1. Fix the root cause (e.g., update subnet DNS via `VPC UpdateSubnet`)
67
+ > 2. Either: SSH into the instance and run the setup commands manually (see `huawei-ecs` → SSH Connection Verification → Running Commands Inside the Instance)
68
+ > 3. Or: Delete the instance and recreate with corrected user_data (fresh boot)
64
69
 
65
70
  ## 7. EIP (two methods)
66
71
 
@@ -91,8 +96,21 @@ hcloud EIP AssociatePublicips --publicip_id=<eip-id> --publicip.associate_instan
91
96
  ```
92
97
 
93
98
  ## 8. Verify
94
- hcloud ECS ListServersDetails --cli-region=<region> --server_id=<instance-id>
95
- Expected: status=ACTIVE
99
+
100
+ ECS creation is asynchronous. Wait times vary widely (20s to 3min). Status transitions: `BUILD` → `ACTIVE` (or `ERROR`). Never use fixed sleep — poll actively:
101
+
102
+ ```bash
103
+ for i in $(seq 1 30); do
104
+ status=$(hcloud ECS ListServersDetails --cli-region=<region> --server_id=<instance-id> --cli-output=json | jq -r '.servers[0].status')
105
+ if [ "$status" = "ACTIVE" ]; then break; fi
106
+ if [ "$status" = "ERROR" ]; then echo "Creation failed"; exit 1; fi
107
+ sleep 10
108
+ done
109
+ ```
110
+
111
+ - Poll interval: 10 seconds
112
+ - Maximum wait: 5 minutes (30 iterations)
113
+ - After ACTIVE, confirm once more: `hcloud ECS ListServersDetails --cli-region=<region> --server_id=<instance-id>`
96
114
 
97
115
  ### Verify HTTP accessibility (if EIP bound)
98
116
 
@@ -31,7 +31,7 @@ Domain expertise for Huawei Cloud Object Storage Service (OBS). Covers bucket/ob
31
31
 
32
32
  | Trap | Why |
33
33
  |------|-----|
34
- | Bucket name is global | All users share bucket namespace |
34
+ | Bucket name is global | All users share bucket namespace. Always use a unique name: `{prefix}-{timestamp}` (e.g. `mybucket-20260810155048`) |
35
35
  | Three-layer permissions | IAM > Bucket Policy > ACL. Most restrictive wins |
36
36
  | Versioning is irreversible | Once enabled, cannot be disabled, only suspended |
37
37
  | OBS uses AK/SK directly | NOT IAM tokens. Auth errors mean check AK/SK validity |
@@ -42,7 +42,17 @@ Domain expertise for Huawei Cloud Object Storage Service (OBS). Covers bucket/ob
42
42
 
43
43
  ## OBS Credential Setup (Required Before First Use)
44
44
 
45
- KooCLI OBS uses a separate config file (`~/.obsutilconfig`), NOT `~/.hcloud/config.json`. Call `huaweicloud_setup_obs_config` to automatically sync credentials from the active hcloud profile. No manual AK/SK entry needed.
45
+ KooCLI OBS uses a separate config file (`~/.obsutilconfig`), NOT `~/.hcloud/config.json`. All OBS commands fail with credential errors until this is configured.
46
+
47
+ **In-session bootstrap (recommended)**: Call `huaweicloud_setup_obs_config` — it syncs AK/SK from the active hcloud profile automatically. No manual key entry needed. Run this once per session before any OBS command.
48
+
49
+ **CLI fallback** (if MCP tools unavailable):
50
+
51
+ ```bash
52
+ hcloud OBS config -e=<endpoint> -i=<AK> -k=<SK> -t=token
53
+ ```
54
+
55
+ > `huaweicloud_setup_obs_config` should be called at the start of every OBS task — never assume credentials are pre-configured from a previous session.
46
56
 
47
57
  ## Common Workflows
48
58
 
@@ -69,6 +79,13 @@ Build → Create bucket → Upload → Set bucket ACL → Set object ACL → Con
69
79
 
70
80
  > KooCLI OBS does NOT support `SetBucketWebsite`. Configure static website hosting via REST API (`PUT /?website`) or the Huawei Cloud console.
71
81
 
82
+ ## Single-File Quick Share
83
+
84
+ See `references/single-file-share.md` for the full workflow to host one file and get a shareable link in seconds:
85
+
86
+ - **Private, time-limited**: `hcloud OBS sign obs://<bucket>/<key> -e=<seconds>` (max 7 days)
87
+ - **Public, permanent**: `hcloud OBS cp <file> obs://<bucket>/<key> -f` + `hcloud OBS chattri obs://<bucket>/<key> -acl=public-read`, then share `https://<bucket>.obs.<region>.myhuaweicloud.com/<key>`
88
+
72
89
  ## Storage Classes
73
90
 
74
91
  | Class | Use Case | Min Storage | Retrieval Fee |
@@ -82,7 +99,7 @@ Build → Create bucket → Upload → Set bucket ACL → Set object ACL → Con
82
99
  | Error | Root Cause -> Fix |
83
100
  |-------|------------------|
84
101
  | AccessDenied on bucket | IAM/bucket policy/ACL conflict -> Check all three layers |
85
- | BucketAlreadyExists | Name taken globally -> Choose different name |
102
+ | BucketAlreadyExists | Name taken globally -> Generate unique name with timestamp suffix: `{prefix}-{yyyymmddHHMMSS}` |
86
103
  | NoSuchKey | Object doesn't exist or wrong region -> Verify key and region |
87
104
  | InvalidAccessKeyId | OBS uses AK/SK directly -> Verify AK/SK validity, OBS endpoint, OBS permissions |
88
105
  | EntityTooLarge | Single PUT limit 5GB -> Use multipart upload |
@@ -105,5 +122,6 @@ Build → Create bucket → Upload → Set bucket ACL → Set object ACL → Con
105
122
 
106
123
  - OBS Docs: https://support.huaweicloud.com/obs/
107
124
  - Static website: references/static-website.md
125
+ - Single-file share: references/single-file-share.md
108
126
  - Lifecycle: references/bucket-lifecycle.md
109
127
  - Replication: references/replication.md
@@ -0,0 +1,40 @@
1
+ # OBS Single-File Quick Share
2
+
3
+ Host one file and get a shareable link in seconds. Two options:
4
+
5
+ | Option | Link type | Bucket/object visibility | Expiry |
6
+ |--------|-----------|--------------------------|--------|
7
+ | Presigned URL | Time-limited private link | Keep private | `-e=<seconds>`, max 7 days |
8
+ | Public URL | Permanent public link | Set object `-acl=public-read` | None |
9
+
10
+ ## Option 1: Presigned URL (private, time-limited)
11
+
12
+ No ACL change needed. The object stays private; the link grants temporary access.
13
+
14
+ ```bash
15
+ hcloud OBS cp <file> obs://<bucket>/<key> -f
16
+ hcloud OBS sign obs://<bucket>/<key> -e=3600 # valid 1 hour, max 604800 (7 days)
17
+ ```
18
+
19
+ The `sign` command prints the full presigned URL directly — share it as-is.
20
+
21
+ ## Option 2: Public URL (permanent, public-read)
22
+
23
+ ```bash
24
+ hcloud OBS cp <file> obs://<bucket>/<key> -f
25
+ hcloud OBS chattri obs://<bucket>/<key> -acl=public-read
26
+ ```
27
+
28
+ The shareable public URL follows the OBS endpoint format (NOT the `obs-website` static-site endpoint):
29
+
30
+ ```
31
+ https://<bucket>.obs.<region>.myhuaweicloud.com/<key>
32
+ ```
33
+
34
+ ## Key Gotchas
35
+
36
+ - **Bucket ACL does NOT cascade**: `chattri obs://<bucket> -acl=public-read` alone does not make objects public. Set the object-level ACL explicitly.
37
+ - **`-f` is mandatory**: `cp` without `-f` prompts "Please input (y/n)" on overwrite → agent hangs (TIMEOUT).
38
+ - **Public-read means anyone with the link can access**: use presigned URLs when the file is sensitive.
39
+ - **Presigned URL max expiry is 7 days** (`-e=604800`). For longer-lived public access, use the public-read option.
40
+ - **Credential setup**: OBS uses a separate config (`~/.obsutilconfig`). Call `huaweicloud_setup_obs_config` before first use.
@@ -29,7 +29,7 @@ hcloud RDS <Operation> --cli-region=<region> [--key=value ...]
29
29
  | Operation | PascalCase: `ListInstances`, `CreateManualBackup` |
30
30
  | Params | `--key=value` format. JSON params: `--key='{"k":"v"}'` |
31
31
  | Array params | 1-based: `--instance_ids.1=xxx` |
32
- | Password param | Conflicts with KooCLI system param; pipe `echo \|` to bypass |
32
+ | Password param | Conflicts with KooCLI system param; use `--cli-jsonInput` (see Critical Warnings) |
33
33
 
34
34
  ## Critical Warnings
35
35
 
@@ -38,9 +38,12 @@ hcloud RDS <Operation> --cli-region=<region> [--key=value ...]
38
38
  | Engine version immutable | Cannot change MySQL to PostgreSQL in-place |
39
39
  | Automated backups use OBS | Backup storage incurs separate charges. Set retention period explicitly |
40
40
  | Storage auto-scaling off by default | Enable before storage runs out or instance goes read-only |
41
- | `--password` conflicts with KooCLI | Non-interactive: `printf "b\n" \| hcloud RDS CreateInstance ...` to select API param. Or use `--cli-jsonInput` |
41
+ | `--password` conflicts with KooCLI | Use `--cli-jsonInput=<file>` with JSON file (see `--cli-jsonInput` section below). The `printf "b\n"` workaround is broken in KooCLI 7.2.12+ |
42
42
  | Volume type must match flavor | General→CLOUDSSD; Dedicated→CLOUDSSD\|ESSD; ARM→ULTRAHIGH |
43
43
  | Flavor not in region | Always `ListFlavors` first. Spec codes vary by region |
44
+ | `database_name` is case-sensitive | Use `MySQL` / `PostgreSQL` / `SQLServer` / `MariaDB` — NOT lower-case `mysql` |
45
+ | Instance creation takes 3–8 min | Status: BUILD→MODIFYING→ACTIVE. Poll every 15s: `hcloud RDS ListInstances --cli-region=<r> --instance_id=<id> \| jq '.instances[0].status'` |
46
+ | Body `--region` is required | CreateInstance body requires `--region=<r>` (same as `--cli-region`) or `DBS.280243` |
44
47
  | Restore creates new instance | No in-place restore. Verify target flavor before restoring |
45
48
 
46
49
  ## Instance Management
@@ -56,6 +59,7 @@ hcloud RDS ListEngineFlavors --instance_id=<id> --cli-region=<r>
56
59
  ### Create Instance
57
60
  ```bash
58
61
  hcloud RDS CreateInstance --cli-region=<r> \
62
+ --region=<r> \
59
63
  --name=<name> \
60
64
  --datastore.type=<engine> \
61
65
  --datastore.version=<version> \
@@ -66,11 +70,36 @@ hcloud RDS CreateInstance --cli-region=<r> \
66
70
  --subnet_id=<subnet-id> \
67
71
  --security_group_id=<sg-id> \
68
72
  --availability_zone=<az> \
69
- --charge_info.charge_mode=<mode> \
70
- --password=<pw>
73
+ --charge_info.charge_mode=<mode>
71
74
  ```
72
75
 
73
- > `--password` conflicts with a KooCLI system param. Pipe `echo "b\n" |` before the command or use `--cli-jsonInput` (see Critical Warnings).
76
+ > `--password` conflicts with a KooCLI system param. Use `--cli-jsonInput` (see below). The `printf "b\n"` pipe workaround is broken in KooCLI 7.2.12+.
77
+
78
+ ### `--cli-jsonInput` for CreateInstance
79
+
80
+ ```json
81
+ {
82
+ "path": {
83
+ "project_id": "<project-id>"
84
+ },
85
+ "body": {
86
+ "name": "<name>",
87
+ "region": "<region>",
88
+ "datastore": { "type": "<engine>", "version": "<version>" },
89
+ "ha": { "mode": "single", "replication_mode": "semisync" },
90
+ "flavor_ref": "<flavor-id>",
91
+ "volume": { "type": "<vol-type>", "size": <gb> },
92
+ "vpc_id": "<vpc-id>",
93
+ "subnet_id": "<subnet-id>",
94
+ "security_group_id": "<sg-id>",
95
+ "availability_zone": "<az>",
96
+ "password": "<pw>",
97
+ "charge_info": { "charge_mode": "postPaid" }
98
+ }
99
+ }
100
+ ```
101
+
102
+ > Save as `rds-create.json` then: `hcloud RDS CreateInstance --cli-jsonInput=rds-create.json`. For `project_id`, run `hcloud IAM KeystoneListProjects`.
74
103
 
75
104
  | Param | Required | Note |
76
105
  |-------|----------|------|
@@ -139,6 +168,20 @@ psql -h <private_ip> -p 5432 -U root -d postgres
139
168
  > hcloud does NOT support SQL execution. Use a database client.
140
169
  > For public access, bind an EIP (see `huawei-vpc`).
141
170
 
171
+ ### Database Client Acquisition
172
+
173
+ If a database client is not installed on the agent's machine, install one:
174
+
175
+ | Platform | MySQL | PostgreSQL |
176
+ |----------|-------|------------|
177
+ | **Linux** | `apt install mysql-client` / `yum install mysql` | `apt install postgresql-client` |
178
+ | **macOS** | `brew install mysql-client` | `brew install libpq` |
179
+ | **Windows** | Download MySQL Workbench or `winget install Oracle.MySQL` | Download pgAdmin or `winget install PostgreSQL.PostgreSQL` |
180
+ | **Python (any)** | `pip install pymysql` then `python -c "import pymysql; ..."` | `pip install psycopg2` then `python -c "import psycopg2; ..."` |
181
+ | **Docker (any)** | `docker run -it --rm mysql:8 mysql -h <ip> -u root -p` | `docker run -it --rm postgres:16 psql -h <ip> -U root` |
182
+
183
+ > If no client can be installed, use the Huawei Cloud **Data Studio** console: https://console.huaweicloud.com/dms/
184
+
142
185
  ## Mutating Operations (Require Approval)
143
186
 
144
187
  | Operation | Effect |
@@ -28,15 +28,17 @@ Domain expertise for Huawei Cloud Virtual Private Cloud (VPC). Covers VPC/subnet
28
28
  | EIP PER type needs `--bandwidth.name` | PER bandwidth requires explicit name; `--help` marks it optional but it's required |
29
29
  | **VPC params need nested prefix** | KooCLI 7.x VPC API uses `--vpc.<param>`, `--subnet.<param>`, `--security_group.<param>`. Example: `--vpc.name=xxx` NOT `--name=xxx` |
30
30
  | **Security group needs no vpc_id** | VPC v3 API `CreateSecurityGroup` does NOT accept `vpc_id`. Security groups are region-level, not VPC-bound |
31
- | Subnet DNS empty → ECS no DNS | DNS params (`--subnet.primary_dns`, `--subnet.secondary_dns`) marked optional but empty default breaks cloud-init domain resolution — `yum`/`apt` installs fail silently. Always set both. See `--help` for region-specific DNS IPs |
31
+ | Subnet DNS empty → ECS no DNS | DNS params (`--subnet.primary_dns`, `--subnet.secondary_dns`) marked optional but empty default breaks cloud-init domain resolution — `yum`/`apt` installs fail silently. Always set both. Common DNS IPs: cn-north-4 (100.125.1.250 / 100.125.1.251), cn-north-1 (100.125.1.250 / 100.125.129.250), cn-east-3 (100.125.1.250 / 100.125.129.250), ap-southeast-3 (100.125.1.250 / 100.125.128.250) |
32
32
  | SCP blocks 0.0.0.0/0 SG rules | If `CreateSecurityGroupRule` with `--remote_ip_prefix=0.0.0.0/0` fails with `SYS.0403`, an org-level SCP policy is denying wide-open rules. Narrow to a specific CIDR range (e.g., your office IP) instead |
33
+ | **VPC tags use `*` separator** | VPC tag format: `--vpc.tags.1=env*test` (asterisk between key and value). NOT `--vpc.tags.1.key=env` (ECS-style). This is different from ECS `--server.metadata.key=value` |
33
34
 
34
35
  ## Common Workflows
35
36
 
36
37
  | Task | Command | Steps |
37
38
  |------|---------|-------|
38
39
  | Create VPC | hcloud VPC CreateVpc --vpc.name=<name> --vpc.cidr=<cidr> | CIDR must not conflict with existing VPCs. Run `hcloud VPC ListVpcs` first |
39
- | Create subnet | hcloud VPC CreateSubnet --subnet.name=<name> --subnet.vpc_id=<id> --subnet.cidr=<cidr> --subnet.gateway_ip=<gw> --subnet.primary_dns=<dns1> --subnet.secondary_dns=<dns2> --subnet.availability_zone=<az> | Subnet CIDR must be a subset of the VPC CIDR. DNS addresses vary by region — see `hcloud VPC CreateSubnet --help` |
40
+ | Create subnet | hcloud VPC CreateSubnet --subnet.name=<name> --subnet.vpc_id=<id> --subnet.cidr=<cidr> --subnet.gateway_ip=<gw> --subnet.primary_dns=<dns1> --subnet.secondary_dns=<dns2> --subnet.availability_zone=<az> | Subnet CIDR must be a subset of the VPC CIDR. DNS addresses vary by region — see Critical Warnings for common values |
41
+ | Update subnet | hcloud VPC UpdateSubnet --subnet_id=<id> --subnet.dnsList.1=<dns1> --subnet.dnsList.2=<dns2> | Fix DNS after creation. Restart ECS after updating DNS for cloud-init to pick up changes |
40
42
  | Security group | hcloud VPC CreateSecurityGroup --security_group.name=<name> | references/security-group.md |
41
43
  | SG rule | hcloud VPC CreateSecurityGroupRule --security_group_rule.security_group_id=<id> --security_group_rule.direction=<direction> --security_group_rule.protocol=<protocol> --security_group_rule.multiport=<port> --security_group_rule.remote_ip_prefix=<cidr> | references/security-group.md |
42
44
  | Create EIP | hcloud EIP CreatePublicip --publicip.type=<type> --bandwidth.size=<size> --bandwidth.share_type=<share-type> --bandwidth.name=<name> | Run `hcloud EIP CreatePublicip --help` to confirm valid type values per region |
@@ -58,6 +60,7 @@ Domain expertise for Huawei Cloud Virtual Private Cloud (VPC). Covers VPC/subnet
58
60
  | VPC.0301: Bandwidth name invalid | PER type requires `--bandwidth.name`, even though `--help` marks it optional |
59
61
  | EIP has no public IP after binding | May need AddIngressEipV2 for ELB-type resources (see huawei-apig) |
60
62
  | ECS cloud-init fails silently (port 80/443 closed) | Subnet likely has no DNS. Check `hcloud VPC ShowSubnet --subnet_id=<id>` → `dnsList` empty? Rebuild subnet with `--subnet.primary_dns=<dns1> --subnet.secondary_dns=<dns2>`. DNS addresses per region: `hcloud VPC CreateSubnet --help` |
63
+ | VPC.0209: Subnet still used | Subnet has dependent resources (ECS/RDS) — delete instances first, then subnet |
61
64
  | SYS.0403 / SCP deny | Service Control Policy explicitly denies this operation — contact org admin to adjust SCP, or use an account/region without the restriction. If SSH is blocked, bootstrap via cloud-init user_data instead: see `huawei-ecs` — no SSH needed |
62
65
 
63
66
  ## Security Considerations
@@ -40,7 +40,7 @@ function opencodeConfigFile() {
40
40
  function codexDesktopSkillsDir() { return join(homedir(), '.agents', 'skills'); }
41
41
  function codexDesktopCommandsDir() { return join(homedir(), '.agents', 'commands'); }
42
42
  function codexDesktopPluginsDir() { return join(homedir(), '.agents', 'huaweicloud-plugins'); }
43
- function codexDesktopConfigFile() { return join(homedir(), '.agents', 'opencode.json'); }
43
+ function codexConfigToml() { return join(homedir(), '.codex', 'config.toml'); }
44
44
 
45
45
  function codeartsSkillsDir() { return join(homedir(), '.codeartsdoer', 'skills'); }
46
46
  function codeartsMcpSettingsDir() { return join(homedir(), '.codeartsdoer', 'mcp'); }
@@ -50,6 +50,10 @@ function codeartsProjectSkillsDir() { return join(codeartsProjectDir(), 'skills'
50
50
  function codeartsProjectMcpSettingsFile() { return join(codeartsProjectDir(), 'mcp', 'mcp_settings.json'); }
51
51
  function codeartsPluginsDir() { return join(homedir(), '.codeartsdoer', 'huaweicloud-plugins'); }
52
52
 
53
+ function workbuddySkillsDir() { return join(homedir(), '.workbuddy', 'skills'); }
54
+ function workbuddyMcpConfigFile() { return join(homedir(), '.workbuddy', 'mcp.json'); }
55
+ function workbuddyPluginsDir() { return join(homedir(), '.workbuddy', 'huaweicloud-plugins'); }
56
+
53
57
  // Detect CodeArts sandbox mode (bash_mode in permission config).
54
58
  function detectCodeartsSandbox() {
55
59
  try {
@@ -110,8 +114,13 @@ function copyDir(src, dest) {
110
114
 
111
115
  function removeIfExists(p) {
112
116
  if (existsSync(p)) {
113
- rmSync(p, { recursive: true, force: true });
114
- return true;
117
+ try {
118
+ rmSync(p, { recursive: true, force: true });
119
+ return true;
120
+ } catch (e) {
121
+ console.log(` \x1b[33m[WARN]\x1b[0m Could not remove ${p}: ${e.message}`);
122
+ return false;
123
+ }
115
124
  }
116
125
  return false;
117
126
  }
@@ -221,6 +230,14 @@ function uninstallCodex() {
221
230
  shell: true, windowsHide: true, stdio: 'pipe',
222
231
  });
223
232
  console.log(` ${r.stdout ? r.stdout.toString().trim() : r.stderr.toString().trim()}`);
233
+
234
+ for (const name of new Set([marketplaceName, 'HuaweiCloud-Devkit'])) {
235
+ console.log(` Removing Codex marketplace: ${name}`);
236
+ const r2 = spawnSync(`codex plugin marketplace remove "${name}"`, [], {
237
+ shell: true, windowsHide: true, stdio: 'pipe',
238
+ });
239
+ console.log(` ${r2.stdout ? r2.stdout.toString().trim() : r2.stderr.toString().trim()}`);
240
+ }
224
241
  }
225
242
 
226
243
  function codexStatus() {
@@ -317,18 +334,27 @@ async function installCodexDesktop() {
317
334
  }
318
335
 
319
336
  const mcpPath = join(codexDesktopPluginsDir(), 'src', 'mcp-server.mjs').replace(/\\/g, '/');
320
- const configPath = codexDesktopConfigFile();
321
- let config = {};
337
+ const configPath = codexConfigToml();
338
+ const section = [
339
+ '[mcp_servers.huaweicloud-devkit]',
340
+ 'command = "node"',
341
+ `args = ["${mcpPath}"]`,
342
+ '',
343
+ '[mcp_servers.huaweicloud-devkit.env]',
344
+ 'HUAWEICLOUD_AGENT_TOOLKIT_MODE = "local"',
345
+ '',
346
+ ].join('\n');
347
+ let existing = '';
322
348
  if (existsSync(configPath)) {
323
- try { config = JSON.parse(readFileSync(configPath, 'utf8')); } catch {}
349
+ try { existing = readFileSync(configPath, 'utf8'); } catch {}
350
+ if (existing.includes('[mcp_servers.huaweicloud-devkit]')) {
351
+ console.log(` Config already configured: ${configPath}`);
352
+ return;
353
+ }
324
354
  }
325
- config.mcp = config.mcp || {};
326
- config.mcp['huaweicloud-devkit'] = {
327
- type: 'local',
328
- command: ['node', mcpPath],
329
- enabled: true,
330
- };
331
- writeFileSync(configPath, JSON.stringify(config, null, 2));
355
+ mkdirSync(dirname(configPath), { recursive: true });
356
+ if (existing && !existing.endsWith('\n')) existing += '\n';
357
+ writeFileSync(configPath, existing + section);
332
358
  console.log(` Config updated: ${configPath}`);
333
359
  }
334
360
 
@@ -360,16 +386,19 @@ function uninstallCodexDesktop() {
360
386
  if (removeIfExists(codexDesktopPluginsDir())) {
361
387
  console.log(' Removed MCP server and safety policy');
362
388
  }
363
- const configPath = codexDesktopConfigFile();
389
+ const configPath = codexConfigToml();
364
390
  if (existsSync(configPath)) {
365
- let config = {};
366
- try { config = JSON.parse(readFileSync(configPath, 'utf8')); } catch {}
367
- if (config.mcp?.['huaweicloud-devkit']) {
368
- delete config.mcp['huaweicloud-devkit'];
369
- if (Object.keys(config.mcp).length === 0) delete config.mcp;
370
- writeFileSync(configPath, JSON.stringify(config, null, 2));
371
- console.log(' Config cleaned');
391
+ const lines = readFileSync(configPath, 'utf8').split(/\r?\n/);
392
+ const out = [];
393
+ let skip = false;
394
+ for (const line of lines) {
395
+ if (/^\[mcp_servers\.huaweicloud-devkit(\]|\.)/.test(line)) { skip = true; continue; }
396
+ if (skip && line.startsWith('[')) skip = false;
397
+ if (!skip) out.push(line);
372
398
  }
399
+ while (out.length > 0 && out[out.length - 1].trim() === '') out.pop();
400
+ writeFileSync(configPath, out.join('\n') + (out.length > 0 ? '\n' : ''));
401
+ console.log(' Config cleaned');
373
402
  }
374
403
  }
375
404
 
@@ -463,6 +492,93 @@ function codeartsStatus() {
463
492
  }
464
493
  }
465
494
 
495
+ async function installWorkBuddy() {
496
+ const skillsSrc = join(PLUGIN_ROOT, 'skills');
497
+ const srcDir = join(PLUGIN_ROOT, 'src');
498
+ const safetyDir = join(PLUGIN_ROOT, 'safety');
499
+ const pluginDest = workbuddyPluginsDir();
500
+
501
+ copyDir(skillsSrc, workbuddySkillsDir());
502
+ console.log(` Skills -> ${workbuddySkillsDir()}`);
503
+
504
+ copyDir(srcDir, join(pluginDest, 'src'));
505
+ console.log(` MCP Server -> ${join(pluginDest, 'src')}`);
506
+ copyDir(safetyDir, join(pluginDest, 'safety'));
507
+ console.log(` Safety Policy -> ${join(pluginDest, 'safety')}`);
508
+
509
+ // Write MCP config to ~/.workbuddy/mcp.json
510
+ const mcpPath = join(pluginDest, 'src', 'mcp-server.mjs').replace(/\\/g, '/');
511
+ const configPath = workbuddyMcpConfigFile();
512
+ let config = {};
513
+ if (existsSync(configPath)) {
514
+ try { config = JSON.parse(readFileSync(configPath, 'utf8')); } catch {}
515
+ }
516
+ const env = { HUAWEICLOUD_AGENT_TOOLKIT_MODE: 'local' };
517
+ const hcloudBin = findHcloudBin();
518
+ if (hcloudBin) env.HCLOUD_BIN = hcloudBin.replace(/\\/g, '/');
519
+ config.mcpServers = config.mcpServers || {};
520
+ config.mcpServers['huaweicloud-devkit'] = {
521
+ command: 'node',
522
+ args: [mcpPath],
523
+ env,
524
+ };
525
+ mkdirSync(dirname(configPath), { recursive: true });
526
+ writeFileSync(configPath, JSON.stringify(config, null, 2));
527
+ console.log(` MCP config updated: ${configPath}`);
528
+ }
529
+
530
+ function uninstallWorkBuddy() {
531
+ const skillsDir = workbuddySkillsDir();
532
+ let removed = 0;
533
+ if (existsSync(skillsDir)) {
534
+ for (const entry of readdirSync(skillsDir, { withFileTypes: true })) {
535
+ if (entry.name.startsWith('huawei')) {
536
+ removeIfExists(join(skillsDir, entry.name));
537
+ removed++;
538
+ }
539
+ }
540
+ if (removed > 0) console.log(` Removed ${removed} skills`);
541
+ }
542
+
543
+ if (removeIfExists(workbuddyPluginsDir())) {
544
+ console.log(' Removed MCP server and safety policy');
545
+ }
546
+
547
+ const configPath = workbuddyMcpConfigFile();
548
+ if (existsSync(configPath)) {
549
+ let config = {};
550
+ try { config = JSON.parse(readFileSync(configPath, 'utf8')); } catch {}
551
+ if (config.mcpServers?.['huaweicloud-devkit']) {
552
+ delete config.mcpServers['huaweicloud-devkit'];
553
+ if (Object.keys(config.mcpServers).length === 0) delete config.mcpServers;
554
+ writeFileSync(configPath, JSON.stringify(config, null, 2));
555
+ console.log(` MCP config cleaned: ${configPath}`);
556
+ }
557
+ }
558
+ }
559
+
560
+ function workbuddyStatus() {
561
+ const pluginDir = workbuddyPluginsDir();
562
+ const skillsDir = workbuddySkillsDir();
563
+ console.log(` MCP Server: ${existsSync(join(pluginDir, 'src', 'mcp-server.mjs')) ? '\x1b[32mInstalled\x1b[0m' : '\x1b[31mNot installed\x1b[0m'}`);
564
+ console.log(` Safety Policy: ${existsSync(join(pluginDir, 'safety', 'policy.json')) ? '\x1b[32mInstalled\x1b[0m' : '\x1b[31mNot installed\x1b[0m'}`);
565
+ let skillCount = 0;
566
+ if (existsSync(skillsDir)) {
567
+ skillCount = readdirSync(skillsDir, { withFileTypes: true })
568
+ .filter((d) => d.isDirectory() && d.name.startsWith('huawei')).length;
569
+ }
570
+ console.log(` Skills: ${skillCount > 0 ? `\x1b[32m${skillCount} installed\x1b[0m` : '\x1b[31mNot installed\x1b[0m'}`);
571
+ const configPath = workbuddyMcpConfigFile();
572
+ if (existsSync(configPath)) {
573
+ try {
574
+ const config = JSON.parse(readFileSync(configPath, 'utf8'));
575
+ console.log(` MCP config: ${config.mcpServers?.['huaweicloud-devkit'] ? '\x1b[32mConfigured\x1b[0m' : '\x1b[31mNot configured\x1b[0m'}`);
576
+ } catch {
577
+ console.log(` MCP config: \x1b[31mInvalid\x1b[0m`);
578
+ }
579
+ }
580
+ }
581
+
466
582
  function opencodeStatus() {
467
583
  const pluginDir = opencodePluginsDir();
468
584
  const skillsDir = opencodeSkillsDir();
@@ -492,6 +608,7 @@ function parseTarget() {
492
608
  if (val === 'codex') return 'codex';
493
609
  if (val === 'codex-desktop') return 'codex-desktop';
494
610
  if (val === 'codearts') return 'codearts';
611
+ if (val === 'workbuddy') return 'workbuddy';
495
612
  if (val === 'all') return 'all';
496
613
  return 'opencode';
497
614
  }
@@ -514,6 +631,10 @@ async function cmdInstall() {
514
631
  console.log('\n[CodeArts]');
515
632
  await installCodeArts();
516
633
  }
634
+ if (target === 'workbuddy' || target === 'all') {
635
+ console.log('\n[WorkBuddy]');
636
+ await installWorkBuddy();
637
+ }
517
638
  if (target === 'codex' || target === 'all') {
518
639
  console.log('\n[Codex]');
519
640
  if (!hasCodexCLI()) {
@@ -539,7 +660,9 @@ async function cmdInstall() {
539
660
  } console.log(`\n\x1b[32mInstallation complete!\x1b[0m`);
540
661
  const appName = target === 'codearts' ? 'CodeArts'
541
662
  : target === 'codex-desktop' ? 'Codex Desktop'
542
- : target === 'codex' ? 'Codex' : 'OpenCode';
663
+ : target === 'codex' ? 'Codex'
664
+ : target === 'workbuddy' ? 'WorkBuddy'
665
+ : 'OpenCode';
543
666
  const pad = ' '.repeat(24 - appName.length);
544
667
  console.log(`\n\x1b[1m\x1b[33m╔══════════════════════════════════════════════════════╗`);
545
668
  console.log(`\x1b[1m\x1b[33m║ MCP 工具在重启 ${appName} 会话后才生效${pad}║`);
@@ -558,7 +681,11 @@ async function cmdInstall() {
558
681
  console.log(`\nAfter restart + hcloud setup, run: npx huaweicloud-devkit doctor`);
559
682
 
560
683
  // Write install marker for doctor to detect
561
- const markerDir = target === 'codearts' ? codeartsPluginsDir() : opencodePluginsDir();
684
+ const markerDir = target === 'codearts' ? codeartsPluginsDir()
685
+ : target === 'workbuddy' ? workbuddyPluginsDir()
686
+ : target === 'codex-desktop' ? codexDesktopPluginsDir()
687
+ : opencodePluginsDir();
688
+ mkdirSync(markerDir, { recursive: true });
562
689
  writeFileSync(join(markerDir, '.installed'), new Date().toISOString());
563
690
  if (target === 'opencode' || target === 'all') {
564
691
  console.log('Or describe your Huawei Cloud task in OpenCode');
@@ -569,6 +696,9 @@ async function cmdInstall() {
569
696
  if (target === 'codex' || target === 'all') {
570
697
  console.log('Or mention @huaweicloud-core in Codex');
571
698
  }
699
+ if (target === 'workbuddy' || target === 'all') {
700
+ console.log('Or describe your Huawei Cloud task in WorkBuddy');
701
+ }
572
702
  }
573
703
 
574
704
  async function cmdUninstall() {
@@ -584,13 +714,19 @@ async function cmdUninstall() {
584
714
  console.log('\n[CodeArts]');
585
715
  uninstallCodeArts();
586
716
  }
587
- if (target === 'codex' || target === 'all') {
717
+ if (target === 'workbuddy' || target === 'all') {
718
+ console.log('\n[WorkBuddy]');
719
+ uninstallWorkBuddy();
720
+ }
721
+ if (target === 'codex-desktop' || target === 'codex' || target === 'all') {
588
722
  console.log('\n[Codex]');
589
723
  uninstallCodexDesktop();
590
- if (!hasCodexCLI()) {
591
- console.log(' \x1b[33mCodex CLI not found. Run "npm uninstall -g codex" to fully remove.\x1b[0m');
592
- } else {
593
- uninstallCodex();
724
+ if (target === 'codex' || target === 'all') {
725
+ if (!hasCodexCLI()) {
726
+ console.log(' \x1b[33mCodex CLI not found. Run "npm uninstall -g codex" to fully remove.\x1b[0m');
727
+ } else {
728
+ uninstallCodex();
729
+ }
594
730
  }
595
731
  }
596
732
  console.log(`\n\x1b[32mUninstall complete.\x1b[0m`);
@@ -609,6 +745,10 @@ async function cmdStatus() {
609
745
  console.log('\n[CodeArts]');
610
746
  codeartsStatus();
611
747
  }
748
+ if (target === 'workbuddy' || target === 'all') {
749
+ console.log('\n[WorkBuddy]');
750
+ workbuddyStatus();
751
+ }
612
752
  if (target === 'codex' || target === 'all') {
613
753
  console.log('\n[Codex]');
614
754
  if (!hasCodexCLI()) {
@@ -636,13 +776,16 @@ async function cmdDoctor() {
636
776
  // Node.js
637
777
  check('Node.js >= 20', process.versions.node.split('.')[0] >= 20, 'Run: nvm install 20 && nvm use 20');
638
778
 
639
- // MCP server — check OpenCode and Codex Desktop paths
779
+ // MCP server — check OpenCode, Codex Desktop, CodeArts, and WorkBuddy paths
640
780
  const opencodePluginDir = opencodePluginsDir();
641
781
  const codexPluginDir = codexDesktopPluginsDir();
782
+ const workbuddyPluginDir = workbuddyPluginsDir();
642
783
  const mcpOk = existsSync(join(opencodePluginDir, 'src', 'mcp-server.mjs'))
643
- || existsSync(join(codexPluginDir, 'src', 'mcp-server.mjs'));
784
+ || existsSync(join(codexPluginDir, 'src', 'mcp-server.mjs'))
785
+ || existsSync(join(workbuddyPluginDir, 'src', 'mcp-server.mjs'));
644
786
  const mcpTarget = existsSync(join(opencodePluginDir, 'src', 'mcp-server.mjs')) ? 'OpenCode'
645
- : existsSync(join(codexPluginDir, 'src', 'mcp-server.mjs')) ? 'Codex Desktop' : '';
787
+ : existsSync(join(codexPluginDir, 'src', 'mcp-server.mjs')) ? 'Codex Desktop'
788
+ : existsSync(join(workbuddyPluginDir, 'src', 'mcp-server.mjs')) ? 'WorkBuddy' : '';
646
789
  check('MCP server installed', mcpOk, 'Run: npx huaweicloud-devkit install');
647
790
 
648
791
  if (mcpOk) {
@@ -650,10 +793,11 @@ async function cmdDoctor() {
650
793
  }
651
794
 
652
795
  const safetyOk = existsSync(join(opencodePluginDir, 'safety', 'policy.json'))
653
- || existsSync(join(codexPluginDir, 'safety', 'policy.json'));
796
+ || existsSync(join(codexPluginDir, 'safety', 'policy.json'))
797
+ || existsSync(join(workbuddyPluginDir, 'safety', 'policy.json'));
654
798
  check('Safety policy installed', safetyOk, 'Run: npx huaweicloud-devkit install');
655
799
 
656
- // MCP config — check OpenCode and Codex Desktop
800
+ // MCP config — check OpenCode, Codex Desktop, and WorkBuddy
657
801
  let mcpConfigured = false;
658
802
  let mcpCfgTarget = '';
659
803
  const opencodeCfg = opencodeConfigFile();
@@ -663,11 +807,18 @@ async function cmdDoctor() {
663
807
  if (cfg.mcp && cfg.mcp['huaweicloud-devkit']) { mcpConfigured = true; mcpCfgTarget = 'OpenCode'; }
664
808
  } catch {}
665
809
  }
666
- const codexCfg = codexDesktopConfigFile();
810
+ const codexCfg = codexConfigToml();
667
811
  if (!mcpConfigured && existsSync(codexCfg)) {
668
812
  try {
669
- const cfg = JSON.parse(readFileSync(codexCfg, 'utf8'));
670
- if (cfg.mcp && cfg.mcp['huaweicloud-devkit']) { mcpConfigured = true; mcpCfgTarget = 'Codex Desktop'; }
813
+ const cfg = readFileSync(codexCfg, 'utf8');
814
+ if (cfg.includes('[mcp_servers.huaweicloud-devkit]')) { mcpConfigured = true; mcpCfgTarget = 'Codex Desktop'; }
815
+ } catch {}
816
+ }
817
+ const workbuddyCfg = workbuddyMcpConfigFile();
818
+ if (!mcpConfigured && existsSync(workbuddyCfg)) {
819
+ try {
820
+ const cfg = JSON.parse(readFileSync(workbuddyCfg, 'utf8'));
821
+ if (cfg.mcpServers && cfg.mcpServers['huaweicloud-devkit']) { mcpConfigured = true; mcpCfgTarget = 'WorkBuddy'; }
671
822
  } catch {}
672
823
  }
673
824
  check('MCP configured', mcpConfigured, mcpCfgTarget ? `Found in ${mcpCfgTarget} config` : 'Run: npx huaweicloud-devkit install');
@@ -699,36 +850,52 @@ async function cmdDoctor() {
699
850
  }
700
851
 
701
852
  // Skills
702
- const skillsOptions = [opencodeSkillsDir(), codexDesktopSkillsDir(), codeartsSkillsDir()];
703
- let skillCount = 0, skillsDir = '';
853
+ const skillsOptions = [opencodeSkillsDir(), codexDesktopSkillsDir(), codeartsSkillsDir(), workbuddySkillsDir()];
854
+ let skillCount = 0, skillsDir = '', missingSkills = [];
704
855
  for (const dir of skillsOptions) {
705
856
  if (!existsSync(dir)) continue;
706
- const count = readdirSync(dir, { withFileTypes: true })
707
- .filter((d) => d.isDirectory() && d.name.startsWith('huawei')).length;
857
+ const entries = readdirSync(dir, { withFileTypes: true })
858
+ .filter((d) => d.isDirectory() && d.name.startsWith('huawei'));
859
+ const count = entries.length;
708
860
  if (count > skillCount) { skillCount = count; skillsDir = dir; }
861
+ for (const d of entries) {
862
+ if (!existsSync(join(dir, d.name, 'SKILL.md'))) missingSkills.push(d.name);
863
+ }
709
864
  }
710
865
  const skillsOk = skillCount >= 6;
711
- check(`Skills installed (${skillCount})`, skillsOk, 'Run: npx huaweicloud-devkit-test install');
866
+ check(`Skills installed (${skillCount})`, skillsOk, 'Run: npx huaweicloud-devkit install');
867
+ if (missingSkills.length > 0) {
868
+ console.log(` \x1b[33m[WARN]\x1b[0m ${missingSkills.length} skill(s) missing SKILL.md: ${missingSkills.join(', ')} — Run: npx huaweicloud-devkit install`);
869
+ warn++;
870
+ }
712
871
 
713
872
  console.log(`\nResults: ${pass} pass, ${warn} warn, ${fail} fail`);
714
873
 
715
874
  if (mcpConfigured && !hcloudOk) {
716
- console.log('\n\x1b[33mMCP is configured but hcloud is not installed. Install hcloud then restart OpenCode.\x1b[0m');
875
+ console.log('\n\x1b[33mMCP is configured but hcloud is not installed. Install hcloud then restart your session.\x1b[0m');
717
876
  }
718
877
  if (fail > 0) {
719
- console.log('\x1b[33mFix failures above, then restart your OpenCode / Codex session.\x1b[0m');
878
+ console.log('\x1b[33mFix failures above, then restart your session.\x1b[0m');
720
879
  }
721
880
  if (fail === 0 && mcpConfigured) {
722
- console.log('\n\x1b[32mAll checks passed.\x1b[0m Restart OpenCode, then describe your Huawei Cloud task');
881
+ console.log('\n\x1b[32mAll checks passed.\x1b[0m Restart your session, then describe your Huawei Cloud task');
723
882
  }
724
883
 
725
- // Detect "installed but not restarted" scenario
726
- const installedMarker = join(opencodePluginsDir(), '.installed');
727
- if (mcpConfigured && existsSync(installedMarker)) {
728
- console.log(`\n\x1b[1m\x1b[31m╔══════════════════════════════════════════╗`);
729
- console.log(`\x1b[1m\x1b[31m║ 请重启 OpenCode!MCP 工具尚未激活 ║`);
730
- console.log(`\x1b[1m\x1b[31m║ 关闭当前会话 重新打开即可 ║`);
731
- console.log(`\x1b[1m\x1b[31m╚══════════════════════════════════════════╝\x1b[0m`);
884
+ // Detect "installed but not restarted" — check all supported agents
885
+ const installedMarkers = [
886
+ { path: join(opencodePluginsDir(), '.installed'), name: 'OpenCode' },
887
+ { path: join(codexDesktopPluginsDir(), '.installed'), name: 'Codex Desktop' },
888
+ { path: join(workbuddyPluginsDir(), '.installed'), name: 'WorkBuddy' },
889
+ { path: join(codeartsPluginsDir(), '.installed'), name: 'CodeArts' },
890
+ ];
891
+ for (const marker of installedMarkers) {
892
+ if (existsSync(marker.path)) {
893
+ console.log(`\n\x1b[1m\x1b[31m╔══════════════════════════════════════════╗`);
894
+ console.log(`\x1b[1m\x1b[31m║ 请重启 ${marker.name}!MCP 工具尚未激活 ║`);
895
+ console.log(`\x1b[1m\x1b[31m║ 关闭当前会话 → 重新打开即可 ║`);
896
+ console.log(`\x1b[1m\x1b[31m╚══════════════════════════════════════════╝\x1b[0m`);
897
+ break;
898
+ }
732
899
  }
733
900
  }
734
901
 
@@ -737,7 +904,9 @@ async function cmdUpdate() {
737
904
  const target = parseTarget();
738
905
 
739
906
  if (target === 'opencode' || target === 'all') {
740
- if (!existsSync(join(opencodePluginsDir(), 'src', 'mcp-server.mjs')) && !codexStatus()) {
907
+ if (!existsSync(join(opencodePluginsDir(), 'src', 'mcp-server.mjs'))
908
+ && !existsSync(join(workbuddyPluginsDir(), 'src', 'mcp-server.mjs'))
909
+ && !codexStatus()) {
741
910
  console.log('\x1b[33mNot installed. Use "install" command first.\x1b[0m');
742
911
  return;
743
912
  }
@@ -908,7 +1077,7 @@ async function main() {
908
1077
  case '-h':
909
1078
  default:
910
1079
  console.log(BANNER);
911
- console.log('Usage: npx huaweicloud-devkit <command> [--target <opencode|codex|codearts|all>]\n');
1080
+ console.log('Usage: npx huaweicloud-devkit <command> [--target <opencode|codex|codearts|workbuddy|all>]\n');
912
1081
  console.log('Commands:');
913
1082
  console.log(' install Install skills, MCP server, safety policy');
914
1083
  console.log(' uninstall Remove installed files');
@@ -919,11 +1088,12 @@ async function main() {
919
1088
  console.log(' install-hcloud Show KooCLI install commands for your OS');
920
1089
  console.log(' help Show this help');
921
1090
  console.log('\nOptions:');
922
- console.log(' --target Target agent: opencode (default), codex, codearts, all');
1091
+ console.log(' --target Target agent: opencode (default), codex, codearts, workbuddy, all');
923
1092
  console.log('\nExamples:');
924
1093
  console.log(' npx huaweicloud-devkit install');
925
1094
  console.log(' npx huaweicloud-devkit install --target codex');
926
1095
  console.log(' npx huaweicloud-devkit install --target codearts');
1096
+ console.log(' npx huaweicloud-devkit install --target workbuddy');
927
1097
  console.log(' npx huaweicloud-devkit install --target all');
928
1098
  break;
929
1099
  }
@@ -17,10 +17,15 @@ function codeartsSkillsDir() {
17
17
  const home = homedir();
18
18
  return join(home, '.codeartsdoer', 'skills');
19
19
  }
20
+ function workbuddySkillsDir() {
21
+ const home = homedir();
22
+ return join(home, '.workbuddy', 'skills');
23
+ }
20
24
  function resolveSkillsRoot() {
21
25
  if (existsSync(SKILLS_ROOT_DEV)) return SKILLS_ROOT_DEV;
22
26
  if (existsSync(codeartsSkillsDir())) return codeartsSkillsDir();
23
27
  if (existsSync(opencodeSkillsDir())) return opencodeSkillsDir();
28
+ if (existsSync(workbuddySkillsDir())) return workbuddySkillsDir();
24
29
  return SKILLS_ROOT_DEV;
25
30
  }
26
31
  const SKILLS_ROOT = resolveSkillsRoot();