huaweicloud-devkit 0.1.17

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.
Files changed (76) hide show
  1. package/.agents/plugins/marketplace.json +20 -0
  2. package/LICENSE +201 -0
  3. package/README.md +148 -0
  4. package/bin/setup.cjs +8 -0
  5. package/integrations/opencode/commands/huaweicloud-doctor.md +14 -0
  6. package/integrations/opencode/opencode.json +14 -0
  7. package/integrations/opencode/skills/huaweicloud-core/SKILL.md +30 -0
  8. package/package.json +43 -0
  9. package/plugins/huaweicloud-core/.claude-plugin/plugin.json +44 -0
  10. package/plugins/huaweicloud-core/.codex-plugin/plugin.json +43 -0
  11. package/plugins/huaweicloud-core/.cursor-plugin/plugin.json +44 -0
  12. package/plugins/huaweicloud-core/.mcp.json +13 -0
  13. package/plugins/huaweicloud-core/hooks/hooks.json +26 -0
  14. package/plugins/huaweicloud-core/hooks/huaweicloud-safety.py +88 -0
  15. package/plugins/huaweicloud-core/safety/policy.json +86 -0
  16. package/plugins/huaweicloud-core/skills/huawei-apig/SKILL.md +144 -0
  17. package/plugins/huaweicloud-core/skills/huawei-billing/SKILL.md +48 -0
  18. package/plugins/huaweicloud-core/skills/huawei-cbr/SKILL.md +50 -0
  19. package/plugins/huaweicloud-core/skills/huawei-cce/SKILL.md +101 -0
  20. package/plugins/huaweicloud-core/skills/huawei-cloud-eye/SKILL.md +73 -0
  21. package/plugins/huaweicloud-core/skills/huawei-cloud-find-skills/SKILL.md +190 -0
  22. package/plugins/huaweicloud-core/skills/huawei-cloud-find-skills/scripts/search-skills.mjs +124 -0
  23. package/plugins/huaweicloud-core/skills/huawei-cts/SKILL.md +55 -0
  24. package/plugins/huaweicloud-core/skills/huawei-dds-dcs/SKILL.md +70 -0
  25. package/plugins/huaweicloud-core/skills/huawei-deployment/SKILL.md +56 -0
  26. package/plugins/huaweicloud-core/skills/huawei-dew/SKILL.md +97 -0
  27. package/plugins/huaweicloud-core/skills/huawei-dew/references/csms-usage.md +29 -0
  28. package/plugins/huaweicloud-core/skills/huawei-dew/references/kms-usage.md +23 -0
  29. package/plugins/huaweicloud-core/skills/huawei-ecs/SKILL.md +131 -0
  30. package/plugins/huaweicloud-core/skills/huawei-ecs/references/create-instance.md +92 -0
  31. package/plugins/huaweicloud-core/skills/huawei-ecs/references/evs.md +31 -0
  32. package/plugins/huaweicloud-core/skills/huawei-ecs/references/flavors.md +28 -0
  33. package/plugins/huaweicloud-core/skills/huawei-ecs/references/troubleshooting.md +52 -0
  34. package/plugins/huaweicloud-core/skills/huawei-functiongraph/SKILL.md +132 -0
  35. package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/apig-event-format.md +58 -0
  36. package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/create-function.md +71 -0
  37. package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/deploy-workflow.md +119 -0
  38. package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/triggers.md +142 -0
  39. package/plugins/huaweicloud-core/skills/huawei-gaussdb/SKILL.md +56 -0
  40. package/plugins/huaweicloud-core/skills/huawei-getting-started/SKILL.md +65 -0
  41. package/plugins/huaweicloud-core/skills/huawei-iam/SKILL.md +111 -0
  42. package/plugins/huaweicloud-core/skills/huawei-iam/references/policy-examples.md +122 -0
  43. package/plugins/huaweicloud-core/skills/huawei-iam/references/quick-ref.md +56 -0
  44. package/plugins/huaweicloud-core/skills/huawei-modelarts/SKILL.md +65 -0
  45. package/plugins/huaweicloud-core/skills/huawei-obs/SKILL.md +118 -0
  46. package/plugins/huaweicloud-core/skills/huawei-obs/references/bucket-create.md +49 -0
  47. package/plugins/huaweicloud-core/skills/huawei-obs/references/bucket-lifecycle.md +26 -0
  48. package/plugins/huaweicloud-core/skills/huawei-obs/references/common-pitfalls.md +100 -0
  49. package/plugins/huaweicloud-core/skills/huawei-obs/references/static-website.md +56 -0
  50. package/plugins/huaweicloud-core/skills/huawei-rds/SKILL.md +181 -0
  51. package/plugins/huaweicloud-core/skills/huawei-smn-dms/SKILL.md +69 -0
  52. package/plugins/huaweicloud-core/skills/huawei-vpc/SKILL.md +77 -0
  53. package/plugins/huaweicloud-core/skills/huawei-vpc/references/network.md +52 -0
  54. package/plugins/huaweicloud-core/skills/huawei-vpc/references/security-group.md +59 -0
  55. package/plugins/huaweicloud-core/skills/huawei-vpc/references/subnet.md +50 -0
  56. package/plugins/huaweicloud-core/skills/huawei-waf-aad/SKILL.md +63 -0
  57. package/plugins/huaweicloud-core/skills/huaweicloud-api-and-sdk/SKILL.md +56 -0
  58. package/plugins/huaweicloud-core/skills/huaweicloud-api-and-sdk/agents/openai.yaml +4 -0
  59. package/plugins/huaweicloud-core/skills/huaweicloud-capability-discovery/SKILL.md +47 -0
  60. package/plugins/huaweicloud-core/skills/huaweicloud-capability-discovery/agents/openai.yaml +4 -0
  61. package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/SKILL.md +125 -0
  62. package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/agents/openai.yaml +4 -0
  63. package/plugins/huaweicloud-core/skills/huaweicloud-core/SKILL.md +94 -0
  64. package/plugins/huaweicloud-core/skills/huaweicloud-core/agents/openai.yaml +4 -0
  65. package/plugins/huaweicloud-core/skills/huaweicloud-core/references/report-issue.md +20 -0
  66. package/plugins/huaweicloud-core/skills/huaweicloud-core/references/select.md +28 -0
  67. package/plugins/huaweicloud-core/skills/huaweicloud-safety/SKILL.md +46 -0
  68. package/plugins/huaweicloud-core/skills/huaweicloud-safety/agents/openai.yaml +4 -0
  69. package/plugins/huaweicloud-core/skills/huaweicloud-troubleshooting/SKILL.md +83 -0
  70. package/plugins/huaweicloud-core/skills/huaweicloud-troubleshooting/agents/openai.yaml +4 -0
  71. package/plugins/huaweicloud-core/src/hcloud-cli.mjs +265 -0
  72. package/plugins/huaweicloud-core/src/mcp-server.mjs +93 -0
  73. package/plugins/huaweicloud-core/src/safety-policy.mjs +289 -0
  74. package/plugins/huaweicloud-core/src/search-market.mjs +169 -0
  75. package/plugins/huaweicloud-core/src/setup-cli.mjs +628 -0
  76. package/plugins/huaweicloud-core/src/tools.mjs +672 -0
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "huaweicloud-devkit",
3
+ "interface": {
4
+ "displayName": "HuaweiCloud Devkit"
5
+ },
6
+ "plugins": [
7
+ {
8
+ "name": "huaweicloud-core",
9
+ "source": {
10
+ "source": "local",
11
+ "path": "./plugins/huaweicloud-core"
12
+ },
13
+ "policy": {
14
+ "installation": "AVAILABLE",
15
+ "authentication": "ON_USE"
16
+ },
17
+ "category": "Cloud"
18
+ }
19
+ ]
20
+ }
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,148 @@
1
+ # HuaweiCloud DevKit
2
+
3
+ [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)
4
+ [![CI](https://github.com/huaweicloud-mate/huaweicloud-devkit/actions/workflows/ci.yml/badge.svg)](https://github.com/huaweicloud-mate/huaweicloud-devkit/actions/workflows/ci.yml)
5
+
6
+ 帮助 AI 编码助手安全、准确地使用华为云——技能引导、KooCLI 工具、安全策略一站式集成。
7
+
8
+ HuaweiCloud DevKit 为 AI 编码助手提供操作华为云所需的知识、工具和安全护栏,支持 OpenCode、Codex、Claude Code、Cursor 等主流 Agent。
9
+
10
+ ## 快速开始
11
+
12
+ ### OpenCode
13
+
14
+ ```bash
15
+ npx --yes huaweicloud-devkit install
16
+ ```
17
+
18
+ 自动安装 27 个技能、MCP 服务器和安全策略,并更新 OpenCode 配置。安装后**重启会话**使 MCP 工具生效。
19
+
20
+ ```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 # 卸载
25
+ ```
26
+
27
+ ### Codex
28
+
29
+ ```bash
30
+ npx --yes huaweicloud-devkit install --target codex # 暂用于测试
31
+ ```
32
+
33
+ > **注意:** 如果未检测到 Codex CLI,安装程序会自动跳过 Codex。
34
+
35
+ ### Claude Code
36
+
37
+ 通过 **设置 → 插件 → 团队市场 → 添加市场 → 从仓库导入**,指向 `huaweicloud-mate/huaweicloud-devkit`。Claude Code 会自动索引插件。
38
+
39
+ 安装插件:
40
+
41
+ ```
42
+ /plugin install huaweicloud-core@huaweicloud-devkit
43
+ ```
44
+
45
+ ### Cursor
46
+
47
+ 通过 **设置 → 插件 → 团队市场 → 添加市场 → 从仓库导入**,指向 `huaweicloud-mate/huaweicloud-devkit`。
48
+
49
+ 然后在**插件**面板中安装 **huaweicloud-core** 插件。
50
+
51
+ ### 其他 Agent
52
+
53
+ 对于支持 Model Context Protocol (MCP) 的 Agent,手动配置 MCP 服务器:
54
+
55
+ ```json
56
+ {
57
+ "mcp": {
58
+ "huaweicloud": {
59
+ "type": "local",
60
+ "command": ["node", "<路径>/plugins/huaweicloud-core/src/mcp-server.mjs"],
61
+ "enabled": true
62
+ }
63
+ }
64
+ }
65
+ ```
66
+
67
+ 然后安装技能:
68
+
69
+ ```bash
70
+ npx --yes huaweicloud-devkit install
71
+ ```
72
+
73
+ > **前置条件:** 需要安装 [KooCLI](https://support.huaweicloud.com/qs-hcli/hcli_02_003.html)(`hcloud`)并完成认证。MCP 服务器需要 Node.js >= 20。如果 `hcloud` 不在 `PATH` 中,请设置 `HCLOUD_BIN` 环境变量指向完整路径。
74
+
75
+ ## 包含内容
76
+
77
+ ### 插件
78
+
79
+ `huaweicloud-core` 插件将 MCP 服务器配置、27 个 Agent 技能和安全策略打包为一次性安装。
80
+
81
+ | 插件 | 说明 |
82
+ |------|------|
83
+ | [huaweicloud-core](plugins/huaweicloud-core/) | 核心插件,含技能、MCP 服务器、安全策略。**从这里开始。** |
84
+
85
+ ### 技能
86
+
87
+ Agent 技能是经过整理的指令和参考材料包,帮助 Agent 完成特定的华为云任务。技能按需加载——Agent 只发现和检索与当前任务相关的内容。
88
+
89
+ 包含 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)。
90
+
91
+ 浏览 [`skills/`](plugins/huaweicloud-core/skills/) 目录查看所有可用技能。
92
+
93
+ ### Rules 文件
94
+
95
+ 推荐的项目级配置文件,告诉 Agent 如何高效使用华为云——例如优先使用 MCP 服务器、发现可用技能、遵循最小权限 IAM 原则。
96
+
97
+ 详见 [`rules/huawei-agent-rules.md`](rules/huawei-agent-rules.md)。
98
+
99
+ ### MCP 服务器
100
+
101
+ 本地 MCP 服务器(`plugins/huaweicloud-core/src/mcp-server.mjs`)通过 Model Context Protocol 为 Agent 提供安全的 KooCLI 访问。
102
+
103
+ - **安全优先执行** — 所有 `hcloud` 命令执行前自动分类(读/写/密钥),写操作需用户明确批准。
104
+ - **输出脱敏** — 凭证形态的值(AK/SK、Token、密码)自动替换为 `***REDACTED***`。
105
+ - **12 个结构化工具** — 技能搜索、CLI 检查、只读命令、区域发现、错误解释等。
106
+ - **零运行时依赖** — 纯 Node.js(>= 20),无需 npm install。
107
+
108
+ 详见 [MCP 工具表](#mcp-工具)。
109
+
110
+ ## 安全模型
111
+
112
+ 三层防御体系:
113
+
114
+ | 层级 | 机制 | 说明 |
115
+ |------|------|------|
116
+ | 技能层 | `SKILL.md` 流程文档 | 教会 Agent 正确的行为规则和安全用法 |
117
+ | 钩子层 | `huaweicloud-safety.py` | PreToolUse Hook 阻断高风险工具调用(Claude Code、Cursor 可用) |
118
+ | MCP 层 | `safety-policy.mjs` | Node.js 安全策略包装器,在所有 Agent 环境中强制执行 |
119
+
120
+ 详见 [`docs/safety-model.md`](docs/safety-model.md)。
121
+
122
+ ## MCP 工具
123
+
124
+ | 类别 | 工具 | 说明 |
125
+ |------|------|------|
126
+ | 知识发现 | `huaweicloud_search_docs` | 跨技能文件及文档全文搜索 |
127
+ | 知识发现 | `huaweicloud_retrieve_skill` | 按名称加载完整技能内容及参考文件 |
128
+ | 知识发现 | `huaweicloud_list_regions` | 列出可用华为云区域 |
129
+ | 知识发现 | `huaweicloud_get_regional_availability` | 检查目标区域的服务可用性 |
130
+ | CLI | `huaweicloud_check_cli` | 检查 KooCLI `hcloud` 是否已安装 |
131
+ | CLI | `huaweicloud_plan_cli_command` | 分类计划命令(读/写/密钥)但不执行 |
132
+ | CLI | `huaweicloud_list_operations` | 列出服务的可用 KooCLI 操作 |
133
+ | CLI | `huaweicloud_run_readonly_command` | 执行只读命令并脱敏输出 |
134
+ | CLI | `huaweicloud_run_approved_command` | 经用户明确批准后执行写命令 |
135
+ | 安全 | `huaweicloud_show_profile_redacted` | 安全查看 KooCLI 配置(凭证脱敏) |
136
+ | 路由 | `huaweicloud_service_catalog` | 返回推荐的能力来源排序 |
137
+ | 排错 | `huaweicloud_explain_error` | 解释错误码并建议诊断步骤 |
138
+
139
+ ## 文档
140
+
141
+ - [系统架构设计](docs/01-系统架构设计.md)
142
+ - [核心技能设计](docs/02-核心技能设计.md)
143
+ - [安全模型](docs/safety-model.md)
144
+ - [KooCLI 官方文档](https://support.huaweicloud.com/qs-hcli/hcli_02_003.html)
145
+
146
+ ## 许可证
147
+
148
+ 本项目基于 Apache-2.0 许可证发布。详见 [LICENSE](LICENSE)。
package/bin/setup.cjs ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+ const path = require('path');
4
+ const fileUrl = require('url').pathToFileURL(path.join(__dirname, '..', 'plugins', 'huaweicloud-core', 'src', 'setup-cli.mjs')).href;
5
+ import(fileUrl).catch(e => {
6
+ console.error(e.message);
7
+ process.exit(1);
8
+ });
@@ -0,0 +1,14 @@
1
+ ---
2
+ description: Self-check Huawei Cloud DevKit readiness — hcloud, MCP, skills, auth.
3
+ ---
4
+
5
+ Use HuaweiCloud Devkit tools and skills to perform a comprehensive readiness check:
6
+
7
+ 1. Check if KooCLI `hcloud` is installed: `huaweicloud_check_cli`. If not, guide user to install.
8
+ 2. Check if hcloud has active credentials: `hcloud configure list` (redacted).
9
+ 3. List installed skills via `huaweicloud_search_docs` or count directories in `~/.config/opencode/skills/`.
10
+ 4. Verify MCP server is reachable by calling any read-only tool.
11
+ 5. Summarize: installed (OK) vs missing (action needed).
12
+ 6. Do not print AK/SK, tokens, passwords, credential files, or raw profile secrets.
13
+
14
+ If MCP tools are unavailable (fresh install), run `npx huaweicloud-devkit doctor` in terminal.
@@ -0,0 +1,14 @@
1
+ {
2
+ "$schema": "https://opencode.ai/config.json",
3
+ "_note": "Merge this into ~/.config/opencode/opencode.jsonc. Replace the path with the absolute path to your mcp-server.mjs installation.",
4
+ "mcp": {
5
+ "huaweicloud": {
6
+ "type": "local",
7
+ "command": [
8
+ "node",
9
+ "<绝对路径>/plugins/huaweicloud-core/src/mcp-server.mjs"
10
+ ],
11
+ "enabled": true
12
+ }
13
+ }
14
+ }
@@ -0,0 +1,30 @@
1
+ ---
2
+ name: huaweicloud-core
3
+ description: OpenCode entry skill for HuaweiCloud Devkit. Use when a developer asks OpenCode to use Huawei Cloud Skills, KooCLI, APIs, SDKs, future MCP tools, or low-priority Terraform guidance.
4
+ ---
5
+
6
+ # Huawei Cloud Core For OpenCode
7
+
8
+ Use this skill as the OpenCode entry point. Prefer the full skill set under `plugins/huaweicloud-core/skills/` when the repository is available, or install those skills into OpenCode's skill directory with `scripts/install-opencode-local.ps1`.
9
+
10
+ ## Routing
11
+
12
+ 1. Use Huawei Cloud Skills for scenario workflows.
13
+ 2. Use KooCLI `hcloud` for local read-only inspection and reviewed commands.
14
+ 3. Use official API docs for exact request and response contracts.
15
+ 4. Use SDK docs when writing application integration code.
16
+ 5. Use approved MCP tools when they exist.
17
+ 6. Keep Terraform Provider low priority in V1; mention it for reviewed IaC only.
18
+
19
+ ## Safety
20
+
21
+ Never ask the user to paste credentials. Never read `.hcloud` or `.huaweicloud` files into context. Plan writes first, ask for explicit approval, then verify with read-only checks.
22
+
23
+ ## KooCLI Basics
24
+
25
+ - Install guide: `https://support.huaweicloud.com/qs-hcli/hcli_02_003.html`.
26
+ - Verify with `hcloud version`; set `HCLOUD_BIN` if OpenCode cannot find `hcloud`.
27
+ - Discover exact operations with `hcloud <Service> --help` before guessing.
28
+ - Prefer `--param=value`; array indexes start at 1, for example `--server.nics.1.subnet_id=<subnet-id>`.
29
+ - Respect region intent: Singapore -> `ap-southeast-3`, Hong Kong -> `ap-southeast-2`, Beijing -> `cn-north-4`. Do not scan all regions blindly.
30
+ - Warn before commands containing `adminPass`, `password`, tokens, or other values that may remain in shell history.
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "huaweicloud-devkit",
3
+ "version": "0.1.17",
4
+ "description": "Agent toolkit that helps coding agents use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities safely and accurately.",
5
+ "type": "module",
6
+ "files": [
7
+ "bin",
8
+ ".agents",
9
+ "plugins/huaweicloud-core",
10
+ "integrations/opencode"
11
+ ],
12
+ "bin": {
13
+ "huaweicloud-devkit": "./bin/setup.cjs"
14
+ },
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/huaweicloud-mate/huaweicloud-devkit.git"
18
+ },
19
+ "scripts": {
20
+ "test": "node --test",
21
+ "lint:md": "markdownlint-cli2 \"**/*.md\" \"#node_modules\" \"#.git\" \"#test/**\" \"#docs/**\"",
22
+ "lint": "npm run lint:md",
23
+ "validate": "node ./scripts/validate-package.mjs",
24
+ "postinstall": "node -e \"console.log('\\nHuaweiCloud DevKit installed. Run: npx huaweicloud-devkit install\\n')\""
25
+ },
26
+ "devDependencies": {
27
+ "markdownlint-cli2": "^0.23.2"
28
+ },
29
+ "keywords": [
30
+ "huaweicloud",
31
+ "huawei-cloud",
32
+ "agent",
33
+ "codex",
34
+ "opencode",
35
+ "mcp",
36
+ "koocli",
37
+ "hcloud"
38
+ ],
39
+ "license": "Apache-2.0",
40
+ "engines": {
41
+ "node": ">=20"
42
+ }
43
+ }
@@ -0,0 +1,44 @@
1
+ {
2
+ "interface": {
3
+ "displayName": "HuaweiCloud Devkit",
4
+ "shortDescription": "HuaweiCloud Devkit - Huawei Cloud guidance, CLI/API/SDK routing, MCP tools, and safety for coding agents.",
5
+ "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.",
6
+ "developerName": "HuaweiCloud Mate",
7
+ "category": "Cloud",
8
+ "capabilities": [
9
+ "Read",
10
+ "Interactive"
11
+ ],
12
+ "websiteURL": "https://github.com/huaweicloud-mate/huaweicloud-devkit",
13
+ "brandColor": "#C7000B",
14
+ "defaultPrompt": [
15
+ "Help me choose the right Huawei Cloud capability.",
16
+ "Check my Huawei Cloud CLI setup safely.",
17
+ "Plan this Huawei Cloud API or SDK task."
18
+ ]
19
+ },
20
+ "mcpServers": "./.mcp.json",
21
+ "description": "Guide coding agents to use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities with safer execution and less context.",
22
+ "skills": "./skills/",
23
+ "version": "0.1.17",
24
+ "author": {
25
+ "name": "HuaweiCloud Mate",
26
+ "url": "https://github.com/huaweicloud-mate"
27
+ },
28
+ "hooks": "./hooks/",
29
+ "name": "huaweicloud-core",
30
+ "homepage": "https://github.com/huaweicloud-mate/huaweicloud-devkit",
31
+ "repository": "https://github.com/huaweicloud-mate/huaweicloud-devkit",
32
+ "license": "Apache-2.0",
33
+ "keywords": [
34
+ "huaweicloud",
35
+ "huawei-cloud",
36
+ "koocli",
37
+ "hcloud",
38
+ "agent",
39
+ "mcp",
40
+ "api",
41
+ "sdk",
42
+ "skills"
43
+ ]
44
+ }
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "huaweicloud-core",
3
+ "version": "0.1.17",
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-mate"
8
+ },
9
+ "homepage": "https://github.com/huaweicloud-mate/huaweicloud-devkit",
10
+ "repository": "https://github.com/huaweicloud-mate/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
+ "interface": {
26
+ "displayName": "HuaweiCloud Devkit",
27
+ "shortDescription": "HuaweiCloud Devkit - Huawei Cloud guidance, CLI/API/SDK routing, MCP tools, and safety for coding agents.",
28
+ "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.",
29
+ "developerName": "HuaweiCloud Mate",
30
+ "category": "Cloud",
31
+ "capabilities": [
32
+ "Read",
33
+ "Interactive"
34
+ ],
35
+ "websiteURL": "https://github.com/huaweicloud-mate/huaweicloud-devkit",
36
+ "brandColor": "#C7000B",
37
+ "defaultPrompt": [
38
+ "Help me choose the right Huawei Cloud capability.",
39
+ "Check my Huawei Cloud CLI setup safely.",
40
+ "Plan this Huawei Cloud API or SDK task."
41
+ ]
42
+ }
43
+ }
@@ -0,0 +1,44 @@
1
+ {
2
+ "interface": {
3
+ "displayName": "HuaweiCloud Devkit",
4
+ "shortDescription": "HuaweiCloud Devkit - Huawei Cloud guidance, CLI/API/SDK routing, MCP tools, and safety for coding agents.",
5
+ "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.",
6
+ "developerName": "HuaweiCloud Mate",
7
+ "category": "Cloud",
8
+ "capabilities": [
9
+ "Read",
10
+ "Interactive"
11
+ ],
12
+ "websiteURL": "https://github.com/huaweicloud-mate/huaweicloud-devkit",
13
+ "brandColor": "#C7000B",
14
+ "defaultPrompt": [
15
+ "Help me choose the right Huawei Cloud capability.",
16
+ "Check my Huawei Cloud CLI setup safely.",
17
+ "Plan this Huawei Cloud API or SDK task."
18
+ ]
19
+ },
20
+ "mcpServers": "./.mcp.json",
21
+ "description": "Guide coding agents to use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities with safer execution and less context.",
22
+ "skills": "./skills/",
23
+ "version": "0.1.17",
24
+ "author": {
25
+ "name": "HuaweiCloud Mate",
26
+ "url": "https://github.com/huaweicloud-mate"
27
+ },
28
+ "hooks": "./hooks/",
29
+ "name": "huaweicloud-core",
30
+ "homepage": "https://github.com/huaweicloud-mate/huaweicloud-devkit",
31
+ "repository": "https://github.com/huaweicloud-mate/huaweicloud-devkit",
32
+ "license": "Apache-2.0",
33
+ "keywords": [
34
+ "huaweicloud",
35
+ "huawei-cloud",
36
+ "koocli",
37
+ "hcloud",
38
+ "agent",
39
+ "mcp",
40
+ "api",
41
+ "sdk",
42
+ "skills"
43
+ ]
44
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "mcpServers": {
3
+ "huaweicloud": {
4
+ "command": "node",
5
+ "args": [
6
+ "./src/mcp-server.mjs"
7
+ ],
8
+ "env": {
9
+ "HUAWEICLOUD_AGENT_TOOLKIT_MODE": "local"
10
+ }
11
+ }
12
+ }
13
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "hooks": {
3
+ "PreToolUse": [
4
+ {
5
+ "matcher": "Bash",
6
+ "hooks": [
7
+ {
8
+ "type": "command",
9
+ "command": "python3 \"${CLAUDE_PLUGIN_ROOT}/hooks/huaweicloud-safety.py\"",
10
+ "timeout": 5
11
+ }
12
+ ]
13
+ },
14
+ {
15
+ "matcher": "mcp__.*huaweicloud.*|huaweicloud_.*",
16
+ "hooks": [
17
+ {
18
+ "type": "command",
19
+ "command": "python3 \"${CLAUDE_PLUGIN_ROOT}/hooks/huaweicloud-safety.py\"",
20
+ "timeout": 5
21
+ }
22
+ ]
23
+ }
24
+ ]
25
+ }
26
+ }