huaweicloud-devkit 1.0.0 → 1.0.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 +75 -93
- package/README.zh-CN.md +138 -0
- package/package.json +2 -1
- package/plugins/huaweicloud-core/.claude-plugin/plugin.json +1 -1
- package/plugins/huaweicloud-core/.codex-plugin/plugin.json +1 -1
- package/plugins/huaweicloud-core/.cursor-plugin/plugin.json +1 -1
- package/plugins/huaweicloud-core/.mcp.json +3 -1
- package/plugins/huaweicloud-core/.workbuddy-plugin/plugin.json +44 -0
- package/plugins/huaweicloud-core/safety/policy.json +15 -1
- package/plugins/huaweicloud-core/safety/rules/cloud-risk-rules.json +21 -0
- package/plugins/huaweicloud-core/skills/huawei-apig/SKILL.md +22 -2
- package/plugins/huaweicloud-core/skills/huawei-cloud-eye/SKILL.md +17 -0
- package/plugins/huaweicloud-core/skills/huawei-ecs/SKILL.md +51 -1
- package/plugins/huaweicloud-core/skills/huawei-ecs/references/create-instance.md +20 -2
- package/plugins/huaweicloud-core/skills/huawei-ecs/references/troubleshooting.md +1 -1
- package/plugins/huaweicloud-core/skills/huawei-functiongraph/SKILL.md +1 -1
- package/plugins/huaweicloud-core/skills/huawei-getting-started/SKILL.md +2 -2
- package/plugins/huaweicloud-core/skills/huawei-obs/SKILL.md +21 -3
- package/plugins/huaweicloud-core/skills/huawei-obs/references/single-file-share.md +40 -0
- package/plugins/huaweicloud-core/skills/huawei-rds/SKILL.md +48 -5
- package/plugins/huaweicloud-core/skills/huawei-sandbox/SKILL.md +134 -0
- package/plugins/huaweicloud-core/skills/huawei-vpc/SKILL.md +5 -2
- package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/SKILL.md +2 -1
- package/plugins/huaweicloud-core/skills/huaweicloud-core/SKILL.md +3 -1
- package/plugins/huaweicloud-core/skills/huaweicloud-troubleshooting/SKILL.md +1 -1
- package/plugins/huaweicloud-core/src/auth/agent-registration.mjs +87 -0
- package/plugins/huaweicloud-core/src/auth/credentials.mjs +95 -0
- package/plugins/huaweicloud-core/src/auth/service.mjs +63 -0
- package/plugins/huaweicloud-core/src/mcp-server.mjs +11 -0
- package/plugins/huaweicloud-core/src/sandbox/hdkitservice-api.mjs +87 -0
- package/plugins/huaweicloud-core/src/sandbox/hwlink-api.mjs +153 -0
- package/plugins/huaweicloud-core/src/sandbox/session-manager.mjs +105 -0
- package/plugins/huaweicloud-core/src/setup-cli.mjs +732 -73
- package/plugins/huaweicloud-core/src/tools.mjs +164 -3
- package/plugins/huaweicloud-core/src/ws-exec/hwlink-exec-client.js +427 -0
- package/plugins/huaweicloud-core/src/ws-exec/hwlink-fair-queue.js +132 -0
- package/plugins/huaweicloud-core/src/ws-exec/hwlink-multiplexer.js +227 -0
- package/plugins/huaweicloud-core/src/ws-exec/hwlink-packet.js +202 -0
- package/plugins/huaweicloud-core/src/ws-exec/hwlink-terminal-channel.js +158 -0
- package/plugins/huaweicloud-core/src/ws-exec/index.js +19 -0
- package/plugins/huaweicloud-core/src/ws-exec/ws-exec-client.js +338 -0
package/README.md
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
# HuaweiCloud DevKit
|
|
2
|
+
[]
|
|
3
3
|
[](LICENSE)
|
|
4
4
|
[](https://github.com/huaweicloud/HuaweiCloud-Devkit/actions/workflows/ci.yml)
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
**[中文](README.zh-CN.md) | English**
|
|
7
|
+
|
|
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
|
+
|
|
10
|
+
Supports OpenCode, Codex, CodeArts Agent, and WorkBuddy.
|
|
11
|
+
|
|
12
|
+
## Prerequisites
|
|
7
13
|
|
|
8
|
-
|
|
14
|
+
- Node.js >= 22
|
|
9
15
|
|
|
10
|
-
##
|
|
16
|
+
## Quick Start
|
|
11
17
|
|
|
12
18
|
### OpenCode
|
|
13
19
|
|
|
@@ -15,13 +21,13 @@ HuaweiCloud DevKit 为 AI 编码助手提供操作华为云所需的知识、工
|
|
|
15
21
|
npx --yes huaweicloud-devkit install
|
|
16
22
|
```
|
|
17
23
|
|
|
18
|
-
|
|
24
|
+
Installs the DevKit into OpenCode automatically. **Restart the session** after installation.
|
|
19
25
|
|
|
20
26
|
```bash
|
|
21
|
-
npx --yes huaweicloud-devkit doctor
|
|
22
|
-
npx --yes huaweicloud-devkit status
|
|
23
|
-
npx --yes huaweicloud-devkit update
|
|
24
|
-
npx --yes huaweicloud-devkit uninstall #
|
|
27
|
+
npx --yes huaweicloud-devkit doctor # self-check
|
|
28
|
+
npx --yes huaweicloud-devkit status # show status
|
|
29
|
+
npx --yes huaweicloud-devkit update # update
|
|
30
|
+
npx --yes huaweicloud-devkit uninstall # uninstall
|
|
25
31
|
```
|
|
26
32
|
|
|
27
33
|
### Codex
|
|
@@ -30,127 +36,103 @@ npx --yes huaweicloud-devkit uninstall # 卸载
|
|
|
30
36
|
npx --yes huaweicloud-devkit install --target codex
|
|
31
37
|
```
|
|
32
38
|
|
|
33
|
-
>
|
|
39
|
+
> The Codex CLI must be installed first.
|
|
34
40
|
|
|
35
|
-
|
|
41
|
+
```bash
|
|
42
|
+
npx --yes huaweicloud-devkit doctor # self-check
|
|
43
|
+
npx --yes huaweicloud-devkit status --target codex
|
|
44
|
+
npx --yes huaweicloud-devkit update --target codex # update
|
|
45
|
+
npx --yes huaweicloud-devkit uninstall --target codex
|
|
46
|
+
```
|
|
36
47
|
|
|
37
|
-
|
|
48
|
+
> **Codex Desktop** (Windows): use `--target codex-desktop` with the same commands.
|
|
49
|
+
|
|
50
|
+
### CodeArts Agent
|
|
38
51
|
|
|
39
52
|
```bash
|
|
40
53
|
npx --yes huaweicloud-devkit install --target codearts
|
|
41
54
|
```
|
|
42
55
|
|
|
43
|
-
|
|
56
|
+
**Restart the session** after installation.
|
|
44
57
|
|
|
45
58
|
```bash
|
|
46
|
-
npx --yes huaweicloud-devkit install-hcloud #
|
|
47
|
-
npx --yes huaweicloud-devkit doctor #
|
|
48
|
-
npx --yes huaweicloud-devkit status --target codearts
|
|
49
|
-
npx --yes huaweicloud-devkit
|
|
59
|
+
npx --yes huaweicloud-devkit install-hcloud # install KooCLI
|
|
60
|
+
npx --yes huaweicloud-devkit doctor # self-check
|
|
61
|
+
npx --yes huaweicloud-devkit status --target codearts
|
|
62
|
+
npx --yes huaweicloud-devkit update --target codearts
|
|
63
|
+
npx --yes huaweicloud-devkit uninstall --target codearts
|
|
50
64
|
```
|
|
51
65
|
|
|
52
|
-
>
|
|
66
|
+
> **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
67
|
>
|
|
54
|
-
>
|
|
68
|
+
> **Authentication**: Run `npx huaweicloud-devkit auth init` to configure unified AK/SK credentials for KooCLI, OBS, and sandbox APIs.
|
|
69
|
+
|
|
70
|
+
### WorkBuddy
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
npx --yes huaweicloud-devkit install --target workbuddy
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**Restart the session** after installation.
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
npx --yes huaweicloud-devkit doctor
|
|
80
|
+
npx --yes huaweicloud-devkit status --target workbuddy
|
|
81
|
+
npx --yes huaweicloud-devkit update --target workbuddy # update
|
|
82
|
+
npx --yes huaweicloud-devkit uninstall --target workbuddy
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
> **Updating**: `update` is incremental per agent — it refreshes only the installed files and leaves your config untouched. Use `update --target all` to update every installed agent at once.
|
|
55
86
|
|
|
56
|
-
###
|
|
87
|
+
### Other Agents
|
|
57
88
|
|
|
58
|
-
|
|
89
|
+
For agents that support the Model Context Protocol (MCP):
|
|
59
90
|
|
|
60
91
|
```json
|
|
61
92
|
{
|
|
62
93
|
"mcp": {
|
|
63
94
|
"huaweicloud-devkit": {
|
|
64
95
|
"type": "local",
|
|
65
|
-
"command": ["node", "
|
|
96
|
+
"command": ["node", "<path>/plugins/huaweicloud-core/src/mcp-server.mjs"],
|
|
66
97
|
"enabled": true
|
|
67
98
|
}
|
|
68
99
|
}
|
|
69
100
|
}
|
|
70
101
|
```
|
|
71
102
|
|
|
72
|
-
|
|
103
|
+
Then install:
|
|
73
104
|
|
|
74
105
|
```bash
|
|
75
106
|
npx --yes huaweicloud-devkit install
|
|
76
107
|
```
|
|
77
108
|
|
|
78
|
-
>
|
|
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-工具)。
|
|
109
|
+
> **Prerequisite:** Node.js >= 22. Run `npx huaweicloud-devkit auth init` for unified credentials.
|
|
114
110
|
|
|
115
|
-
##
|
|
111
|
+
## What It Does
|
|
116
112
|
|
|
117
|
-
|
|
113
|
+
- **Guided cloud operations** — agents get step-by-step guidance for 20+ Huawei Cloud services (ECS, OBS, VPC, RDS, GaussDB, FunctionGraph, APIG, CCE, and more)
|
|
114
|
+
- **Safety-first execution** — all write operations require explicit user approval; credentials and secrets are automatically redacted from output
|
|
115
|
+
- **Pre-execution risk checks** — public exposure, credential leaks, and destructive operations are caught before they run
|
|
116
|
+
- **Regional awareness** — auto-discovers available regions and checks service availability before creating resources
|
|
118
117
|
|
|
119
|
-
|
|
120
|
-
|------|------|------|
|
|
121
|
-
| 技能层 | `SKILL.md` 流程文档 | 教会 Agent 正确的行为规则和安全用法 |
|
|
122
|
-
| 钩子层 | `huaweicloud-safety.py` | PreToolUse Hook 阻断高风险工具调用 |
|
|
123
|
-
| MCP 层 | `safety-policy.mjs` | Node.js 安全策略包装器,在所有 Agent 环境中强制执行 |
|
|
118
|
+
## Supported Services
|
|
124
119
|
|
|
125
|
-
|
|
120
|
+
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
121
|
|
|
127
|
-
##
|
|
122
|
+
## Documentation
|
|
128
123
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
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` | 解释错误码并建议诊断步骤 |
|
|
124
|
+
- [Architecture](docs/architecture.md)
|
|
125
|
+
- [Safety Model](docs/safety-model.md)
|
|
126
|
+
- [Hook Rule Model](docs/hook-rule-model.md)
|
|
127
|
+
- [Changelog](docs/CHANGELOG.md)
|
|
128
|
+
- [KooCLI official docs](https://support.huaweicloud.com/qs-hcli/hcli_02_003.html)
|
|
146
129
|
|
|
147
|
-
##
|
|
130
|
+
## Contributors
|
|
148
131
|
|
|
149
|
-
|
|
150
|
-
-
|
|
151
|
-
|
|
152
|
-
- [KooCLI 官方文档](https://support.huaweicloud.com/qs-hcli/hcli_02_003.html)
|
|
132
|
+
<a href="https://github.com/huaweicloud/huaweicloud-devkit/graphs/contributors">
|
|
133
|
+
<img src="https://contrib.rocks/image?repo=huaweicloud/huaweicloud-devkit" />
|
|
134
|
+
</a>
|
|
153
135
|
|
|
154
|
-
##
|
|
136
|
+
## License
|
|
155
137
|
|
|
156
|
-
|
|
138
|
+
This project is licensed under the Apache-2.0 License. See [LICENSE](LICENSE).
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# HuaweiCloud DevKit
|
|
2
|
+
[]
|
|
3
|
+
[](LICENSE)
|
|
4
|
+
[](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
|
+
- Node.js >= 22
|
|
15
|
+
|
|
16
|
+
## 快速开始
|
|
17
|
+
|
|
18
|
+
### OpenCode
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npx --yes huaweicloud-devkit install
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
自动安装 DevKit。安装后**重启会话**。
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npx --yes huaweicloud-devkit doctor # 自检
|
|
28
|
+
npx --yes huaweicloud-devkit status # 查看状态
|
|
29
|
+
npx --yes huaweicloud-devkit update # 更新
|
|
30
|
+
npx --yes huaweicloud-devkit uninstall # 卸载
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Codex
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npx --yes huaweicloud-devkit install --target codex
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
> 需要先安装 Codex CLI。
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npx --yes huaweicloud-devkit doctor # 自检
|
|
43
|
+
npx --yes huaweicloud-devkit status --target codex
|
|
44
|
+
npx --yes huaweicloud-devkit update --target codex # 更新
|
|
45
|
+
npx --yes huaweicloud-devkit uninstall --target codex
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
> **Codex Desktop**(Windows):将 `--target codex` 换成 `--target codex-desktop`,命令相同。
|
|
49
|
+
|
|
50
|
+
### CodeArts Agent(码道)
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
npx --yes huaweicloud-devkit install --target codearts
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
安装后**重启会话**。
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
npx --yes huaweicloud-devkit install-hcloud # 安装 KooCLI
|
|
60
|
+
npx --yes huaweicloud-devkit doctor # 自检
|
|
61
|
+
npx --yes huaweicloud-devkit status --target codearts
|
|
62
|
+
npx --yes huaweicloud-devkit update --target codearts
|
|
63
|
+
npx --yes huaweicloud-devkit uninstall --target codearts
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
> **沙箱模式**:码道默认沙箱模式会阻止 KooCLI 运行。`install-hcloud` 自动检测并给出指引——请在码道外终端安装使用 KooCLI,或在码道设置中关闭沙箱模式(设置 → 权限 → Bash 模式)。
|
|
67
|
+
>
|
|
68
|
+
> **认证**:执行 `npx huaweicloud-devkit auth init`,统一配置 KooCLI、OBS 和沙箱接口所需的 AK/SK。
|
|
69
|
+
|
|
70
|
+
### WorkBuddy
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
npx --yes huaweicloud-devkit install --target workbuddy
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
安装后**重启会话**。
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
npx --yes huaweicloud-devkit doctor
|
|
80
|
+
npx --yes huaweicloud-devkit status --target workbuddy
|
|
81
|
+
npx --yes huaweicloud-devkit update --target workbuddy # 更新
|
|
82
|
+
npx --yes huaweicloud-devkit uninstall --target workbuddy
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
> **更新机制**:`update` 按 agent 增量更新,只刷新必要文件、不动你的配置文件。`update --target all` 可一次更新所有已安装的 agent。
|
|
86
|
+
|
|
87
|
+
### 其他 Agent
|
|
88
|
+
|
|
89
|
+
支持 MCP 协议的 Agent,手动配置:
|
|
90
|
+
|
|
91
|
+
```json
|
|
92
|
+
{
|
|
93
|
+
"mcp": {
|
|
94
|
+
"huaweicloud-devkit": {
|
|
95
|
+
"type": "local",
|
|
96
|
+
"command": ["node", "<路径>/plugins/huaweicloud-core/src/mcp-server.mjs"],
|
|
97
|
+
"enabled": true
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
然后安装:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
npx --yes huaweicloud-devkit install
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
> **前置条件:** Node.js >= 22。执行 `npx huaweicloud-devkit auth init` 完成统一认证。
|
|
110
|
+
|
|
111
|
+
## 功能特性
|
|
112
|
+
|
|
113
|
+
- **引导式云操作** — Agent 获得 20+ 华为云服务的分步操作指引(ECS、OBS、VPC、RDS、GaussDB、FunctionGraph、APIG、CCE 等)
|
|
114
|
+
- **安全优先执行** — 所有写操作需用户明确批准;凭证和密钥自动脱敏
|
|
115
|
+
- **执行前风险检查** — 公网暴露、凭证泄露、破坏性操作在执行前即被拦截
|
|
116
|
+
- **区域感知** — 自动发现可用区域,创建资源前检查服务可用性
|
|
117
|
+
|
|
118
|
+
## 支持的服务
|
|
119
|
+
|
|
120
|
+
ECS、OBS、VPC、IAM、RDS、GaussDB、FunctionGraph、APIG、CCE、SMN/DMS、ModelArts、Cloud Eye、CTS、DEW、Billing、CBR、WAF/AAD、DDS/DCS、Deployment,以及入门指南。
|
|
121
|
+
|
|
122
|
+
## 文档
|
|
123
|
+
|
|
124
|
+
- [架构](docs/architecture.md)
|
|
125
|
+
- [安全模型](docs/safety-model.md)
|
|
126
|
+
- [Hook 规则模型](docs/hook-rule-model.md)
|
|
127
|
+
- [变更记录](docs/CHANGELOG.md)
|
|
128
|
+
- [KooCLI 官方文档](https://support.huaweicloud.com/qs-hcli/hcli_02_003.html)
|
|
129
|
+
|
|
130
|
+
## 贡献者
|
|
131
|
+
|
|
132
|
+
<a href="https://github.com/huaweicloud/huaweicloud-devkit/graphs/contributors">
|
|
133
|
+
<img src="https://contrib.rocks/image?repo=huaweicloud/huaweicloud-devkit" />
|
|
134
|
+
</a>
|
|
135
|
+
|
|
136
|
+
## 许可证
|
|
137
|
+
|
|
138
|
+
本项目基于 Apache-2.0 许可证发布。详见 [LICENSE](LICENSE)。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "huaweicloud-devkit",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.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"
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"mcpServers": "./.mcp.json",
|
|
21
21
|
"description": "Guide coding agents to use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities with safer execution and less context.",
|
|
22
22
|
"skills": "./skills/",
|
|
23
|
-
"version": "1.0.
|
|
23
|
+
"version": "1.0.1",
|
|
24
24
|
"author": {
|
|
25
25
|
"name": "HuaweiCloud Mate",
|
|
26
26
|
"url": "https://github.com/huaweicloud"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "huaweicloud-core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Guide coding agents to use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities with safer execution and less context.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "HuaweiCloud Mate",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"mcpServers": "./.mcp.json",
|
|
21
21
|
"description": "Guide coding agents to use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities with safer execution and less context.",
|
|
22
22
|
"skills": "./skills/",
|
|
23
|
-
"version": "1.0.
|
|
23
|
+
"version": "1.0.1",
|
|
24
24
|
"author": {
|
|
25
25
|
"name": "HuaweiCloud Mate",
|
|
26
26
|
"url": "https://github.com/huaweicloud"
|
|
@@ -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
|
+
}
|
|
@@ -82,5 +82,19 @@
|
|
|
82
82
|
"ls",
|
|
83
83
|
"dir",
|
|
84
84
|
"Get-ChildItem"
|
|
85
|
-
]
|
|
85
|
+
],
|
|
86
|
+
"blockedSandboxCommands": [
|
|
87
|
+
"rm\\s+-rf\\s+/",
|
|
88
|
+
"mkfs",
|
|
89
|
+
"dd\\s+if=",
|
|
90
|
+
":\\(\\)\\{:\\|:&\\};:",
|
|
91
|
+
"shutdown",
|
|
92
|
+
"reboot",
|
|
93
|
+
"init\\s+[06]",
|
|
94
|
+
"fdisk"
|
|
95
|
+
],
|
|
96
|
+
"sandboxWriteTools": [
|
|
97
|
+
"huaweicloud_sandbox_connect",
|
|
98
|
+
"huaweicloud_sandbox_credentials"
|
|
99
|
+
]
|
|
86
100
|
}
|
|
@@ -173,6 +173,27 @@
|
|
|
173
173
|
},
|
|
174
174
|
"message": "The generated plan may create high-cost or unbounded capacity.",
|
|
175
175
|
"remediation": "Use small preview defaults, explicit quotas, budget labels, and user approval before creating high-cost resources."
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"id": "hwc-sandbox-destructive-command",
|
|
179
|
+
"title": "Destructive command in sandbox terminal",
|
|
180
|
+
"category": "destructive",
|
|
181
|
+
"severity": "deny",
|
|
182
|
+
"stages": ["command"],
|
|
183
|
+
"match": {
|
|
184
|
+
"any": [
|
|
185
|
+
{ "field": "text", "regex": "rm\\s+-rf\\s+/" },
|
|
186
|
+
{ "field": "text", "regex": "mkfs" },
|
|
187
|
+
{ "field": "text", "regex": "dd\\s+if=" },
|
|
188
|
+
{ "field": "text", "regex": ":\\\\(\\\\)\\\\{[^}]*\\\\|[^}]*&[^}]*\\\\}[^;]*;:" },
|
|
189
|
+
{ "field": "text", "regex": "\\bshutdown\\b" },
|
|
190
|
+
{ "field": "text", "regex": "\\breboot\\b" },
|
|
191
|
+
{ "field": "text", "regex": "\\binit\\s+[06]\\b" },
|
|
192
|
+
{ "field": "text", "regex": "\\bfdisk\\b" }
|
|
193
|
+
]
|
|
194
|
+
},
|
|
195
|
+
"message": "The sandbox terminal command is destructively dangerous and could destroy the workspace.",
|
|
196
|
+
"remediation": "Use targeted deletions instead of recursive root removal. Avoid disk format, fork bombs, and system shutdown commands in sandbox terminals."
|
|
176
197
|
}
|
|
177
198
|
]
|
|
178
199
|
}
|
|
@@ -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
|
|
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
|
|
@@ -82,7 +132,7 @@ Abort if the result set is larger than `--limit` and ask the user to narrow the
|
|
|
82
132
|
| Cannot SSH | SG missing port 22 or no EIP -> Add ingress rule / Bind EIP |
|
|
83
133
|
| Flavor unavailable | Region limitation -> ListFlavors in target region |
|
|
84
134
|
| Insufficient resources | Stock depleted -> Change flavor or AZ |
|
|
85
|
-
| AuthFailure | Expired AK/SK ->
|
|
135
|
+
| AuthFailure | Expired AK/SK -> re-run `npx huaweicloud-devkit auth init` |
|
|
86
136
|
| APIGW.0802 / region permission | IAM user has no access to this region -> IAM console → User → Permissions → add region, or switch to another region |
|
|
87
137
|
| Cannot SSH (port 22 open) | SCP policy may be blocking SSH. Check `SYS.0403` errors in command output -> Use cloud-init/user_data for initial setup instead. See `references/create-instance.md` §Bootstrap |
|
|
88
138
|
|