huaweicloud-devkit 1.1.0-next.9 → 1.1.0

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 (35) hide show
  1. package/README.md +27 -1
  2. package/README.zh-CN.md +26 -1
  3. package/package.json +3 -1
  4. package/plugins/huaweicloud-core/.claude-plugin/plugin.json +1 -1
  5. package/plugins/huaweicloud-core/.codex-plugin/plugin.json +1 -1
  6. package/plugins/huaweicloud-core/.cursor-plugin/plugin.json +1 -1
  7. package/plugins/huaweicloud-core/.hermes-plugin/plugin.json +1 -1
  8. package/plugins/huaweicloud-core/.workbuddy-plugin/plugin.json +1 -1
  9. package/plugins/huaweicloud-core/hooks/huaweicloud-safety.py +29 -12
  10. package/plugins/huaweicloud-core/openclaw.plugin.json +1 -1
  11. package/plugins/huaweicloud-core/safety/rules/cloud-risk-rules.json +136 -24
  12. package/plugins/huaweicloud-core/skills/huawei-billing/SKILL.md +15 -14
  13. package/plugins/huaweicloud-core/skills/huawei-dew/SKILL.md +1 -1
  14. package/plugins/huaweicloud-core/skills/huawei-ecs/SKILL.md +5 -1
  15. package/plugins/huaweicloud-core/skills/huawei-ecs/references/hc-activity.md +27 -0
  16. package/plugins/huaweicloud-core/skills/huawei-iam/SKILL.md +11 -11
  17. package/plugins/huaweicloud-core/skills/huawei-rds/SKILL.md +6 -5
  18. package/plugins/huaweicloud-core/skills/huawei-sandbox/SKILL.md +71 -7
  19. package/plugins/huaweicloud-core/skills/huawei-sandbox/references/nginx-templates.md +4 -0
  20. package/plugins/huaweicloud-core/skills/huawei-smn-dms/SKILL.md +19 -12
  21. package/plugins/huaweicloud-core/skills/huawei-vpc/SKILL.md +26 -26
  22. package/plugins/huaweicloud-core/skills/huawei-vpc/references/network.md +12 -6
  23. package/plugins/huaweicloud-core/skills/huawei-waf-aad/SKILL.md +7 -4
  24. package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/SKILL.md +7 -7
  25. package/plugins/huaweicloud-core/src/auth/agent-registration.mjs +14 -0
  26. package/plugins/huaweicloud-core/src/auth/credentials.mjs +30 -1
  27. package/plugins/huaweicloud-core/src/auth/service.mjs +33 -0
  28. package/plugins/huaweicloud-core/src/detect-framework.mjs +25 -3
  29. package/plugins/huaweicloud-core/src/hcloud-cli.mjs +67 -5
  30. package/plugins/huaweicloud-core/src/mcp-server.mjs +23 -0
  31. package/plugins/huaweicloud-core/src/sandbox/hdkitservice-api.mjs +11 -3
  32. package/plugins/huaweicloud-core/src/sandbox/session-manager.mjs +118 -23
  33. package/plugins/huaweicloud-core/src/search-market.mjs +1 -0
  34. package/plugins/huaweicloud-core/src/setup-cli.mjs +491 -64
  35. package/plugins/huaweicloud-core/src/tools.mjs +37 -15
package/README.md CHANGED
@@ -3,6 +3,7 @@
3
3
  [![Discussions](https://img.shields.io/badge/Discussions-Join%20the%20discussion-blue)](https://github.com/huaweicloud/huaweicloud-devkit/discussions)
4
4
  [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)
5
5
  [![CI](https://github.com/huaweicloud/huaweicloud-devkit/actions/workflows/ci.yml/badge.svg)](https://github.com/huaweicloud/huaweicloud-devkit/actions/workflows/ci.yml)
6
+ [![Beta](https://img.shields.io/badge/beta-v1.1.0-orange)](https://github.com/huaweicloud/huaweicloud-devkit)
6
7
 
7
8
  **[中文](README.zh-CN.md) | English**
8
9
 
@@ -14,6 +15,14 @@ Supports OpenCode, Codex, CodeArts Agent, WorkBuddy, DeepSeek Harness (DSH), Off
14
15
 
15
16
  - Node.js >= 22
16
17
 
18
+ > **China mainland users**: If you experience slow downloads or connection issues with the default npm registry, configure the Huawei Cloud npm mirror:
19
+ >
20
+ > ```bash
21
+ > npm config set registry https://mirrors.huaweicloud.com/repository/npm/
22
+ > ```
23
+ >
24
+ > Restore the default registry: `npm config delete registry`
25
+
17
26
  ## Quick Start
18
27
 
19
28
  > If `--target` is omitted, the installer auto-detects agents on your machine. When multiple agents are detected, **all of them** will be installed. Specify `--target` to control which agent receives the install.
@@ -68,6 +77,23 @@ npx --yes huaweicloud-devkit uninstall --target codearts
68
77
 
69
78
  > **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 → Chats → Agents Terminal Command Running Mode → Auto Running).
70
79
 
80
+ ### CodeArts Work
81
+
82
+ ```bash
83
+ npx --yes huaweicloud-devkit install --target codearts-work
84
+ ```
85
+
86
+ **Restart the session** after installation.
87
+
88
+ ```bash
89
+ npx --yes huaweicloud-devkit doctor --target codearts-work
90
+ npx --yes huaweicloud-devkit status --target codearts-work
91
+ npx --yes huaweicloud-devkit update --target codearts-work
92
+ npx --yes huaweicloud-devkit uninstall --target codearts-work
93
+ ```
94
+
95
+ > **CodeArts Work** (CodeArts Space, appId: `com.codearts.work`) uses user-level config at `%USERPROFILE%\.codeartswork\`. No project-level `.codeartswork` directory is created.
96
+
71
97
  ### WorkBuddy
72
98
 
73
99
  ```bash
@@ -133,7 +159,7 @@ npx --yes huaweicloud-devkit uninstall --target hermes
133
159
  > **Uninstall notes**: On Linux, run `rm -rf ~/.npm/_npx/* && npm cache clean --force` after uninstall to ensure a clean slate. On Windows, close all Hermes sessions first to release file locks, then after uninstall check `%LOCALAPPDATA%\hermes\config.yaml` for YAML corruption and manually remove `%LOCALAPPDATA%\hermes\huaweicloud-plugins` if any files remain.
134
160
  > **Safety hooks**: The installer configures Hermes shell hooks (`config.yaml` → `hooks.pre_tool_call`) to intercept unsafe terminal commands such as credential file reads, environment variable dumps, and unapproved `hcloud` write operations. Hermes shows a consent prompt the first time; approve it or set `hooks_auto_accept: true` in `config.yaml` to auto-accept.
135
161
  > **MCP Python SDK**: The installer automatically installs the `mcp` Python package required by Hermes for MCP tool discovery. If you see `[FAIL] Hermes MCP Python SDK` in `doctor`, run `pip3 install mcp` manually.
136
- > **Windows**: Hermes on Windows stores data under `%LOCALAPPDATA%\hermes` instead of `~/.hermes`. The installer detects this automatically.
162
+ > **Windows**: See [docs/hermes-windows.md](docs/hermes-windows.md) for known issues and workarounds.
137
163
 
138
164
  ### OpenClaw
139
165
 
package/README.zh-CN.md CHANGED
@@ -14,6 +14,14 @@
14
14
 
15
15
  - Node.js >= 22
16
16
 
17
+ > **国内用户**:使用默认 npm 镜像时可能遇到下载缓慢或连接失败的问题,建议配置华为云 npm 镜像:
18
+ >
19
+ > ```bash
20
+ > npm config set registry https://mirrors.huaweicloud.com/repository/npm/
21
+ > ```
22
+ >
23
+ > 恢复默认镜像:`npm config delete registry`
24
+
17
25
  ## 快速开始
18
26
 
19
27
  > 省略 `--target` 时,安装器会自动检测机器上的 agent,检测到多个时**全部安装**。建议始终指定 `--target` 以明确安装目标。
@@ -68,6 +76,23 @@ npx --yes huaweicloud-devkit uninstall --target codearts
68
76
 
69
77
  > **沙箱模式**:码道默认沙箱模式会阻止 KooCLI 运行。`install-hcloud` 自动检测并给出指引——请在码道外终端安装使用 KooCLI,或在码道设置中关闭沙箱模式(设置 → 对话流 → 智能体 终端命令运行模式 → 自动运行)。
70
78
 
79
+ ### CodeArts Work(码道工作空间)
80
+
81
+ ```bash
82
+ npx --yes huaweicloud-devkit install --target codearts-work
83
+ ```
84
+
85
+ 安装后**重启会话**。
86
+
87
+ ```bash
88
+ npx --yes huaweicloud-devkit doctor --target codearts-work
89
+ npx --yes huaweicloud-devkit status --target codearts-work
90
+ npx --yes huaweicloud-devkit update --target codearts-work
91
+ npx --yes huaweicloud-devkit uninstall --target codearts-work
92
+ ```
93
+
94
+ > **CodeArts Work**(工作空间,appId: `com.codearts.work`)使用用户级配置 `%USERPROFILE%\.codeartswork\`,不创建项目级目录。
95
+
71
96
  ### WorkBuddy
72
97
 
73
98
  ```bash
@@ -133,7 +158,7 @@ npx --yes huaweicloud-devkit uninstall --target hermes
133
158
  > **卸载说明**:Linux 上卸载后执行 `rm -rf ~/.npm/_npx/* && npm cache clean --force` 确保下次全新安装。Windows 上先关闭所有 Hermes 会话(释放文件锁),卸载后检查 `%LOCALAPPDATA%\hermes\config.yaml` 是否有 YAML 损坏,如有残留文件手动删除 `%LOCALAPPDATA%\hermes\huaweicloud-plugins`。
134
159
  > **安全钩子(Safety hooks)**:安装器会在 `config.yaml` 中写入 shell hooks 配置(`hooks.pre_tool_call`),拦截不安全的终端命令,如读取凭据文件、导出环境变量、未审批的 `hcloud` 写操作。Hermes 首次使用时会弹出同意提示,可批准或设置 `hooks_auto_accept: true` 自动批准。
135
160
  > **MCP Python SDK**:安装器会自动安装 Hermes 所需的 `mcp` Python 包。如果 doctor 显示 `[FAIL] Hermes MCP Python SDK`,手动执行 `pip3 install mcp`。
136
- > **Windows**:Hermes 在 Windows 上数据存储在 `%LOCALAPPDATA%\hermes` 而非 `~/.hermes`,安装器会自动检测适配。
161
+ > **Windows**:参见 [docs/hermes-windows.md](docs/hermes-windows.md) 了解已知问题和解决方法。
137
162
 
138
163
  ### OpenClaw
139
164
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "huaweicloud-devkit",
3
- "version": "1.1.0-next.9",
3
+ "version": "1.1.0",
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": [
@@ -49,6 +49,8 @@
49
49
  "agent",
50
50
  "codex",
51
51
  "opencode",
52
+ "codearts",
53
+ "codearts-work",
52
54
  "officeace",
53
55
  "office-claw",
54
56
  "workbuddy",
@@ -17,7 +17,7 @@
17
17
  "mcpServers": "./.mcp.json",
18
18
  "description": "Guide coding agents to use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities with safer execution and less context.",
19
19
  "skills": "./skills/",
20
- "version": "1.1.0-next.9",
20
+ "version": "1.1.0",
21
21
  "author": {
22
22
  "name": "HuaweiCloud Mate",
23
23
  "url": "https://github.com/huaweicloud"
@@ -20,7 +20,7 @@
20
20
  "mcpServers": "./.mcp.json",
21
21
  "description": "Agent toolkit that helps coding agents use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities safely and accurately.",
22
22
  "skills": "./skills/",
23
- "version": "1.1.0-next.9",
23
+ "version": "1.1.0",
24
24
  "author": {
25
25
  "name": "HuaweiCloud Mate",
26
26
  "url": "https://github.com/huaweicloud"
@@ -17,7 +17,7 @@
17
17
  "mcpServers": "./.mcp.json",
18
18
  "description": "Guide coding agents to use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities with safer execution and less context.",
19
19
  "skills": "./skills/",
20
- "version": "1.1.0-next.9",
20
+ "version": "1.1.0",
21
21
  "author": {
22
22
  "name": "HuaweiCloud Mate",
23
23
  "url": "https://github.com/huaweicloud"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "huaweicloud-devkit",
3
- "version": "1.1.0-next.9",
3
+ "version": "1.1.0",
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",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "huaweicloud-devkit",
3
- "version": "1.1.0-next.9",
3
+ "version": "1.1.0",
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",
@@ -138,6 +138,31 @@ def first_denied_command_rule(text):
138
138
  return None
139
139
 
140
140
 
141
+ def evaluate(tool_name, tool_input):
142
+ """Run the full safety check and return a raw block reason, or None to allow.
143
+
144
+ Shared by the CLI shell (``main``) and the Hermes Python-plugin hook, which
145
+ reuses this module via ``importlib`` so a single implementation enforces the
146
+ policy everywhere. The returned reason does NOT include ``DENY_PREFIX`` —
147
+ callers decide the exact output shape.
148
+ """
149
+ text = command_text(tool_input)
150
+
151
+ if CONFIG_FILE_RE and CONFIG_FILE_RE.search(text):
152
+ return "reading Huawei Cloud credential/profile files can expose AK/SK or tokens. Use redacted toolkit tools."
153
+ if ENV_DUMP_RE.search(text):
154
+ return "dumping cloud credential environment variables is not allowed."
155
+ if SECRET_READ_RE and SECRET_READ_RE.search(text):
156
+ return "direct secret value retrieval would put plaintext secrets into the agent context."
157
+ denied_rule = first_denied_command_rule(text)
158
+ if denied_rule:
159
+ return f"{denied_rule.get('message')} Remediation: {denied_rule.get('remediation')}"
160
+ if tool_name in ("Bash", "terminal") and HCLOUD_RE.search(text) and WRITE_OPERATION_RE.search(text) and not READ_OPERATION_RE.search(text):
161
+ return "unapproved Huawei Cloud write operations must be planned first and explicitly approved by the user."
162
+
163
+ return None
164
+
165
+
141
166
  def main():
142
167
  try:
143
168
  data = json.load(sys.stdin)
@@ -145,20 +170,12 @@ def main():
145
170
  allow()
146
171
 
147
172
  tool_name = data.get("tool_name", "")
148
- text = command_text(data.get("tool_input", {}))
173
+ tool_input = data.get("tool_input", {})
149
174
  hermes = "hook_event_name" in data
150
175
 
151
- if CONFIG_FILE_RE and CONFIG_FILE_RE.search(text):
152
- deny("reading Huawei Cloud credential/profile files can expose AK/SK or tokens. Use redacted toolkit tools.", hermes)
153
- if ENV_DUMP_RE.search(text):
154
- deny("dumping cloud credential environment variables is not allowed.", hermes)
155
- if SECRET_READ_RE and SECRET_READ_RE.search(text):
156
- deny("direct secret value retrieval would put plaintext secrets into the agent context.", hermes)
157
- denied_rule = first_denied_command_rule(text)
158
- if denied_rule:
159
- deny(f"{denied_rule.get('message')} Remediation: {denied_rule.get('remediation')}", hermes)
160
- if tool_name in ("Bash", "terminal") and HCLOUD_RE.search(text) and WRITE_OPERATION_RE.search(text) and not READ_OPERATION_RE.search(text):
161
- deny("unapproved Huawei Cloud write operations must be planned first and explicitly approved by the user.", hermes)
176
+ reason = evaluate(tool_name, tool_input)
177
+ if reason:
178
+ deny(reason, hermes)
162
179
 
163
180
  allow()
164
181
 
@@ -2,7 +2,7 @@
2
2
  "name": "huaweicloud-devkit",
3
3
  "id": "huaweicloud-devkit",
4
4
  "displayName": "HuaweiCloud DevKit",
5
- "version": "1.1.0-next.9",
5
+ "version": "1.1.0",
6
6
  "family": "bundle-plugin",
7
7
  "bundleFormat": "codex",
8
8
  "description": "Guide coding agents to use Huawei Cloud safely — KooCLI, APIs, SDKs, 28 MCP tools, skills, and safety guardrails.",
@@ -13,7 +13,10 @@
13
13
  "field": "text",
14
14
  "regex": "(^|\\s)(cat|type|Get-Content|gc|less|more)\\s+[^\\n]*(\\.hcloud|\\.huaweicloud)"
15
15
  },
16
- { "field": "text", "regex": "(hcloud|huaweicloud)[/\\\\](config|credentials)" }
16
+ {
17
+ "field": "text",
18
+ "regex": "(hcloud|huaweicloud)[/\\\\](config|credentials)"
19
+ }
17
20
  ]
18
21
  },
19
22
  "message": "The command may read local Huawei Cloud credential or profile files into the agent context.",
@@ -27,8 +30,14 @@
27
30
  "stages": ["command"],
28
31
  "match": {
29
32
  "all": [
30
- { "field": "text", "regex": "(^|\\s)(env|printenv|Get-ChildItem\\s+Env:|gci\\s+Env:|dir\\s+Env:)" },
31
- { "field": "text", "regex": "(HUAWEICLOUD|HWC_|HCLOUD|OS_)" }
33
+ {
34
+ "field": "text",
35
+ "regex": "(^|\\s)(env|printenv|Get-ChildItem\\s+Env:|gci\\s+Env:|dir\\s+Env:)"
36
+ },
37
+ {
38
+ "field": "text",
39
+ "regex": "(HUAWEICLOUD|HWC_|HCLOUD|OS_)"
40
+ }
32
41
  ]
33
42
  },
34
43
  "message": "The command may print cloud credential environment variables.",
@@ -42,13 +51,36 @@
42
51
  "stages": ["command"],
43
52
  "match": {
44
53
  "any": [
45
- { "field": "text", "regex": "(ShowSecretVersion|DownloadSecret|GetSecretValue)" },
46
- { "field": "text", "regex": "(secret_string|secret_binary|secretString|secretBinary)" }
54
+ {
55
+ "field": "text",
56
+ "regex": "(ShowSecretVersion|DownloadSecret|GetSecretValue)"
57
+ },
58
+ {
59
+ "field": "text",
60
+ "regex": "(secret_string|secret_binary|secretString|secretBinary)"
61
+ }
47
62
  ]
48
63
  },
49
64
  "message": "The command appears to retrieve plaintext secret values.",
50
65
  "remediation": "Use runtime secret references, user-side inspection, or redacted metadata checks instead of returning secret values to the agent."
51
66
  },
67
+ {
68
+ "id": "hwc-command-sts-credential",
69
+ "title": "Temporary credential exposure",
70
+ "category": "credential",
71
+ "severity": "warn",
72
+ "stages": ["command"],
73
+ "match": {
74
+ "any": [
75
+ {
76
+ "field": "text",
77
+ "regex": "hcloud\\s+STS\\s+(AssumeAgency|GetCallerIdentity|GetTemporaryCredential)\\b"
78
+ }
79
+ ]
80
+ },
81
+ "message": "此操作将返回临时 AK/SK 和 SecurityToken。注意敏感数据保密,不要将凭证输出到日志或分享给第三方。",
82
+ "remediation": "临时凭证仅用于当前会话,使用完毕后及时销毁,不要持久化存储。"
83
+ },
52
84
  {
53
85
  "id": "hwc-command-encoded-shell-exec",
54
86
  "title": "Encoded payload piped to shell",
@@ -61,8 +93,14 @@
61
93
  "field": "text",
62
94
  "regex": "(base64\\s+(-d|--decode)|xxd\\s+-r|certutil\\s+-decode|FromBase64String|hex\\s*decode)"
63
95
  },
64
- { "field": "text", "regex": "(\\||;|&&)" },
65
- { "field": "text", "regex": "\\b(bash|sh|zsh|powershell|pwsh|cmd|python|node)\\b" }
96
+ {
97
+ "field": "text",
98
+ "regex": "(\\||;|&&)"
99
+ },
100
+ {
101
+ "field": "text",
102
+ "regex": "\\b(bash|sh|zsh|powershell|pwsh|cmd|python|node)\\b"
103
+ }
66
104
  ]
67
105
  },
68
106
  "message": "The command decodes an encoded payload and pipes it into an interpreter.",
@@ -96,7 +134,12 @@
96
134
  "severity": "deny",
97
135
  "stages": ["command", "artifact", "deploy_plan"],
98
136
  "match": {
99
- "all": [{ "field": "text", "regex": "(OBS|obs://|bucket|object|Statement|Principal)" }],
137
+ "all": [
138
+ {
139
+ "field": "text",
140
+ "regex": "(OBS|obs://|bucket|object|Statement|Principal)"
141
+ }
142
+ ],
100
143
  "any": [
101
144
  {
102
145
  "field": "text",
@@ -119,7 +162,10 @@
119
162
  "stages": ["command", "artifact", "deploy_plan"],
120
163
  "match": {
121
164
  "all": [
122
- { "field": "text", "regex": "(FunctionGraph|APIG|CreateTrigger|CreateApi|DEDICATEDGATEWAY|API Gateway)" },
165
+ {
166
+ "field": "text",
167
+ "regex": "(FunctionGraph|APIG|CreateTrigger|CreateApi|DEDICATEDGATEWAY|API Gateway)"
168
+ },
123
169
  {
124
170
  "field": "text",
125
171
  "regex": "(public|PUBLIC|0\\.0\\.0\\.0\\s*/\\s*0|auth[\\\"']?\\s*[=:]\\s*[\\\"']?(NONE|none|false)|security_authentication[\\\"']?\\s*[=:]\\s*[\\\"']?(NONE|none))"
@@ -137,12 +183,18 @@
137
183
  "stages": ["command", "artifact", "deploy_plan"],
138
184
  "match": {
139
185
  "all": [
140
- { "field": "text", "regex": "(IAM|policy|role|agency|Statement|Action)" },
186
+ {
187
+ "field": "text",
188
+ "regex": "(IAM|policy|role|agency|Statement|Action)"
189
+ },
141
190
  {
142
191
  "field": "text",
143
192
  "regex": "(\\\"Action\\\"\\s*:\\s*(\\\"(\\*|\\*:\\*)\\\"|\\[\\s*\\\"(\\*|\\*:\\*)\\\")|Action\\s*[=:]\\s*(\\*|\\*:\\*)|AdministratorAccess|FullAccess)"
144
193
  },
145
- { "field": "text", "regex": "(\\\"Effect\\\"\\s*:\\s*\\\"Allow\\\"|Effect\\s*[=:]\\s*Allow)" }
194
+ {
195
+ "field": "text",
196
+ "regex": "(\\\"Effect\\\"\\s*:\\s*\\\"Allow\\\"|Effect\\s*[=:]\\s*Allow)"
197
+ }
146
198
  ]
147
199
  },
148
200
  "message": "The change appears to grant broad administrator permissions.",
@@ -156,13 +208,40 @@
156
208
  "stages": ["command"],
157
209
  "match": {
158
210
  "all": [
159
- { "field": "text", "regex": "(Delete|BatchDelete|Remove|\\brm\\b|delete)" },
160
- { "field": "text", "regex": "(--force|-f|--recursive|-r|delete_publicip\\s*[=:]\\s*true)" }
211
+ {
212
+ "field": "text",
213
+ "regex": "(Delete|BatchDelete|Remove|\\brm\\b|delete)"
214
+ },
215
+ {
216
+ "field": "text",
217
+ "regex": "(\\s--force|\\s-f\\s|\\s--recursive|\\s-r\\s|delete_publicip\\s*[=:]\\s*true)"
218
+ }
161
219
  ]
162
220
  },
163
221
  "message": "The command combines deletion with force, recursive, or cascading deletion behavior.",
164
222
  "remediation": "Show the exact resources to be deleted, confirm backups or recovery path, and require explicit user approval for the exact command."
165
223
  },
224
+ {
225
+ "id": "hwc-destructive-delete-operation",
226
+ "title": "Destructive cloud resource operation",
227
+ "category": "destructive",
228
+ "severity": "warn",
229
+ "stages": ["command"],
230
+ "match": {
231
+ "any": [
232
+ {
233
+ "field": "text",
234
+ "regex": "hcloud\\s+\\w+\\s+(Delete\\w*|Detach\\w*|Remove\\w*|Dissociate\\w*|Unassign\\w*|Revoke\\w*)\\b"
235
+ },
236
+ {
237
+ "field": "text",
238
+ "regex": "hcloud\\s+\\w+\\s+(BatchDelete\\w*|BatchRemove\\w*)\\b"
239
+ }
240
+ ]
241
+ },
242
+ "message": "This hcloud command will delete, detach, or remove cloud resources. The operation may be irreversible.",
243
+ "remediation": "List the resources to be affected first, confirm with the user, and require explicit approval before executing any destructive operation."
244
+ },
166
245
  {
167
246
  "id": "hwc-sandbox-missing-ttl",
168
247
  "title": "Sandbox deployment missing cleanup metadata",
@@ -175,10 +254,16 @@
175
254
  "field": "text",
176
255
  "regex": "(sandbox|preview|temporary|ephemeral|dev environment|FunctionGraph|ECS|CCE|APIG)"
177
256
  },
178
- { "field": "text", "regex": "(Create|Deploy|Provision|resource|stack|environment)" }
257
+ {
258
+ "field": "text",
259
+ "regex": "(Create|Deploy|Provision|resource|stack|environment)"
260
+ }
179
261
  ],
180
262
  "none": [
181
- { "field": "text", "regex": "(ttl|expires_at|expire_at|cleanup|owner|cost_center|auto_delete|auto-delete)" }
263
+ {
264
+ "field": "text",
265
+ "regex": "(ttl|expires_at|expire_at|cleanup|owner|cost_center|auto_delete|auto-delete)"
266
+ }
182
267
  ]
183
268
  },
184
269
  "message": "The preview or sandbox deployment does not show cleanup or ownership metadata.",
@@ -196,7 +281,10 @@
196
281
  "field": "text",
197
282
  "regex": "(max_instances|max_node_count|max_replica|desired\\s*[=:]\\s*[5-9][0-9]|replicas\\s*[=:]\\s*[5-9][0-9])"
198
283
  },
199
- { "field": "text", "regex": "(GPU|gpu|large|xlarge|charging_mode\\s*[=:]\\s*prePaid|period_type|period_num)" }
284
+ {
285
+ "field": "text",
286
+ "regex": "(GPU|gpu|large|xlarge|charging_mode\\s*[=:]\\s*prePaid|period_type|period_num)"
287
+ }
200
288
  ]
201
289
  },
202
290
  "message": "The generated plan may create high-cost or unbounded capacity.",
@@ -210,14 +298,38 @@
210
298
  "stages": ["command"],
211
299
  "match": {
212
300
  "any": [
213
- { "field": "text", "regex": "rm\\s+-rf\\s+/" },
214
- { "field": "text", "regex": "mkfs" },
215
- { "field": "text", "regex": "dd\\s+if=" },
216
- { "field": "text", "regex": ":\\\\(\\\\)\\\\{[^}]*\\\\|[^}]*&[^}]*\\\\}[^;]*;:" },
217
- { "field": "text", "regex": "\\bshutdown\\b" },
218
- { "field": "text", "regex": "\\breboot\\b" },
219
- { "field": "text", "regex": "\\binit\\s+[06]\\b" },
220
- { "field": "text", "regex": "\\bfdisk\\b" }
301
+ {
302
+ "field": "text",
303
+ "regex": "rm\\s+-rf\\s+/"
304
+ },
305
+ {
306
+ "field": "text",
307
+ "regex": "mkfs"
308
+ },
309
+ {
310
+ "field": "text",
311
+ "regex": "dd\\s+if="
312
+ },
313
+ {
314
+ "field": "text",
315
+ "regex": ":\\\\(\\\\)\\\\{[^}]*\\\\|[^}]*&[^}]*\\\\}[^;]*;:"
316
+ },
317
+ {
318
+ "field": "text",
319
+ "regex": "\\bshutdown\\b"
320
+ },
321
+ {
322
+ "field": "text",
323
+ "regex": "\\breboot\\b"
324
+ },
325
+ {
326
+ "field": "text",
327
+ "regex": "\\binit\\s+[06]\\b"
328
+ },
329
+ {
330
+ "field": "text",
331
+ "regex": "\\bfdisk\\b"
332
+ }
221
333
  ]
222
334
  },
223
335
  "message": "The sandbox terminal command is destructively dangerous and could destroy the workspace.",
@@ -8,7 +8,7 @@ version: 1
8
8
 
9
9
  **STOP - Do not answer from general knowledge.** Follow the procedure below.
10
10
 
11
- Always run `hcloud BSS <Operation> --help` before constructing commands to discover exact parameter names and requirements.
11
+ Always run `hcloud BSS <Operation> --help --cli-region=cn-north-1` before constructing commands to discover exact parameter names and requirements.
12
12
 
13
13
  ## Overview
14
14
 
@@ -16,22 +16,23 @@ Domain expertise for billing queries (BSS). Covers cost tracking, bill details,
16
16
 
17
17
  ## Critical Warnings
18
18
 
19
- | Trap | Why |
20
- | -------------------------- | ---------------------------------------------------- |
21
- | Bills delayed ~24h | Yesterday's costs may not appear until the next day |
22
- | BSS Admin role needed | IAM user must have BSS Administrator or Finance role |
23
- | Currency conversion varies | Cross-region costs use daily exchange rates |
19
+ | Trap | Why |
20
+ | -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
21
+ | Bills delayed ~24h | Yesterday's costs may not appear until the next day |
22
+ | BSS Admin role needed | IAM user must have BSS Administrator or Finance role |
23
+ | Currency conversion varies | Cross-region costs use daily exchange rates |
24
+ | Region fixed to cn-north-1 | BSS operations only support `--cli-region=cn-north-1` in KooCLI. This is a KooCLI metadata limitation — the billing data itself covers all regions. |
24
25
 
25
26
  ## Common Workflows
26
27
 
27
- | Task | Operation |
28
- | -------------------- | --------------------------------------------------------------- |
29
- | List costs | `ListCosts --cli-region=<r> --project_id=<p>` |
30
- | List customer bills | `ListCustomerBills --cli-region=<r> --project_id=<p>` |
31
- | List resource usage | `ListResourceUsage --cli-region=<r> --project_id=<p>` |
32
- | List sub-customers | `ListConsumeSubCustomers --cli-region=<r> --project_id=<p>` |
33
- | Show account balance | `ShowCustomerAccountBalances --cli-region=<r> --project_id=<p>` |
34
- | List conversions | `ListConversions --cli-region=<r> --project_id=<p>` |
28
+ | Task | Operation |
29
+ | -------------------- | ---------------------------------------------------------------------- |
30
+ | List costs | `ListCosts --cli-region=cn-north-1 --project_id=<p>` |
31
+ | List customer bills | `ListCustomerBillsFeeRecords --cli-region=cn-north-1 --project_id=<p>` |
32
+ | List resource usage | `ListResourceUsage --cli-region=cn-north-1 --project_id=<p>` |
33
+ | List sub-customers | `ListConsumeSubCustomers --cli-region=cn-north-1 --project_id=<p>` |
34
+ | Show account balance | `ShowCustomerAccountBalances --cli-region=cn-north-1 --project_id=<p>` |
35
+ | List conversions | `ListConversions --cli-region=cn-north-1 --project_id=<p>` |
35
36
 
36
37
  Discover exact parameters with `--help` before executing any command. All BSS operations are read-only.
37
38
 
@@ -69,7 +69,7 @@ secret_value = client.get_secret(secret_id="my-secret")
69
69
 
70
70
  # hcloud (for approved automation only)
71
71
 
72
- hcloud CSMS DownloadSecret --secret_name=<name>
72
+ hcloud CSMS DownloadSecretBlob --secret_name=<name>
73
73
 
74
74
  # WARNING: Output goes to stdout. Pipe directly, never capture in agent.
75
75
 
@@ -1,6 +1,8 @@
1
1
  ---
2
2
  name: huawei-ecs
3
- description: 'Use when creating, configuring, managing, or troubleshooting ECS instances on Huawei Cloud. Covers instance creation (hcloud ECS CreateServers), flavor selection, image management, security groups, EIP binding, disk attachment, auto-scaling (AS), and troubleshooting. Triggers on: ECS, instance, flavor, image, security group, EIP, EVS, auto-scaling. NOT for: CCE container workloads (use huawei-cce), BMS bare metal servers.'
3
+ description: 'Use when creating, configuring, managing, or troubleshooting ECS instances on Huawei Cloud. Covers instance creation (hcloud ECS CreateServers), flavor selection, image management, security groups, EIP binding, disk attachment, auto-scaling (AS), and troubleshooting. Triggers on: ECS, instance, flavor, image, security group, EIP, EVS, auto-scaling. NOT for: CCE container workloads (use huawei-cce), BMS bare metal servers.
4
+
5
+ HC活动场景(ECS+Nginx部署后端服务)触发词: HC活动, 华为HC, HC大会, 活动部署, HC ECS, 活动流程, 部署后端, Nginx部署, Nodejs部署, 上线后端服务, 部署个人网站, /hc-activity/.'
4
6
  version: 1
5
7
  ---
6
8
 
@@ -59,6 +61,7 @@ Flavor families are **region-dependent**. Always run `hcloud ECS ListFlavors --c
59
61
  | Attach disk | hcloud EVS AttachVolume --volume_id=<id> --server_id=<id> | references/evs.md |
60
62
  | Delete instance | hcloud ECS DeleteServers --servers.1.id=<id> --delete_publicip=true --delete_volume=true | references/create-instance.md |
61
63
  | Reboot instance | hcloud ECS BatchRebootServers --reboot.servers.1.id=<id> --reboot.type=SOFT | NOT `RebootServer` — that operation does not exist |
64
+ | HC活动部署 | 按量付费购买ECS+Nginx部署后端服务 | references/hc-activity.md |
62
65
 
63
66
  ## How to Search for Instances
64
67
 
@@ -186,3 +189,4 @@ For Flexus X, use standard ECS CreateServers flow with `x1.*` flavors. For Flexu
186
189
  - ECS Docs: https://support.huaweicloud.com/ecs/
187
190
  - Flavor specs: references/flavors.md
188
191
  - Create instance: references/create-instance.md
192
+ - HC活动 ECS+Nginx部署: references/hc-activity.md
@@ -0,0 +1,27 @@
1
+ # HC活动 ECS + Nginx/Node.js 部署后端服务
2
+
3
+ ## 目标
4
+
5
+ 在华为云 cn-north-4 区域,按量付费购买 ECS,部署后端代码仓的后端服务。
6
+
7
+ ## 前置条件
8
+
9
+ - 后端代码仓 git 地址
10
+ - 账户已有默认 VPC 和子网(Agent 自动查询)
11
+
12
+ ## 流程
13
+
14
+ 1. 查询 VPC/子网,创建安全组,放通 SSH(22)仅本机IP、HTTP(80)全网
15
+ 2. 查询镜像(推荐 HCE 2.0)和规格,直接购买1核2G
16
+ 3. 创建 keypair,创建按量付费 ECS(系统盘 SSD 40GB),轮询等待 ACTIVE
17
+ 4. 创建 5_bgp 按流量计费 EIP,绑定到 ECS 端口
18
+ 5. SSH 登录,安装 Node.js 18,git clone 代码仓,npm install
19
+ 6. Nginx反向代理:80->:3000
20
+ 7. 验证 /hc-activity/api/title 和 /hc-activity/health
21
+
22
+ ## 注意事项
23
+
24
+ - 后端3000仅监听回环
25
+ - Nginx修改后 nginx -t 再 reload
26
+ - 按量付费停机仍计费
27
+ - 删除实例时 --delete_publicip=true --delete_volume=true
@@ -42,14 +42,14 @@ Domain expertise for Huawei Cloud Identity and Access Management (IAM). Covers u
42
42
 
43
43
  ## Common Workflows
44
44
 
45
- | Task | Command | Steps |
46
- | ------------------------ | ---------------------------------------------------------------------------------------------- | ----------------------------- |
47
- | List users | hcloud IAM ListUsers | references/iam-ops.md |
48
- | Create group | hcloud IAM CreateGroup --group.name=<name> | references/iam-ops.md |
49
- | Create custom policy | hcloud IAM CreateCustomPolicy --policy.name=<n> --policy.document=<json> | references/policy-examples.md |
50
- | Create agency | hcloud IAM CreateAgency --agency.name=<n> --agency.domain_id=<id> --agency.trust_policy=<json> | references/agency.md |
51
- | Get temporary credential | hcloud STS GetTemporaryCredential --agency_name=<n> --domain_id=<id> --duration_seconds=3600 | references/sts.md |
52
- | Attach policy | hcloud IAM AttachGroupPolicy --group_id=<id> --policy_id=<id> | references/iam-ops.md |
45
+ | Task | Command | Steps |
46
+ | ------------------------ | --------------------------------------------------------------------------------------------------------------------------- | ----------------------------- |
47
+ | List users | hcloud IAM KeystoneListUsers --cli-region=<r> | references/iam-ops.md |
48
+ | Create group | hcloud IAM CreateGroupV5 --group_name=<name> | references/iam-ops.md |
49
+ | Create custom policy | hcloud IAM CreateCloudServiceCustomPolicy --role.display_name=<n> --role.type=<type> --role.policy.Statement.1.Effect=Allow | references/policy-examples.md |
50
+ | Create agency | hcloud IAM CreateAgency --agency.name=<n> --agency.domain_id=<id> --agency.trust_domain_name=<domain> | references/agency.md |
51
+ | Get temporary credential | hcloud STS AssumeAgency --agency_urn=<urn> --agency_session_name=<n> --duration_seconds=3600 | references/sts.md |
52
+ | Attach policy to group | hcloud IAM AttachGroupPolicyV5 --group_id=<id> --policy_id=<id> | references/iam-ops.md |
53
53
 
54
54
  ## Policy Examples (Least Privilege)
55
55
 
@@ -88,10 +88,10 @@ FunctionGraph needs an agency to access VPC resources (RDS, DCS, etc.):
88
88
 
89
89
  ```bash
90
90
  # 1. Create agency with FunctionGraph trust
91
- hcloud IAM CreateAgency --agency_name=<name> --trust_domain_name=functiongraph
91
+ hcloud IAM CreateAgency --agency.name=<name> --agency.trust_domain_name=functiongraph
92
92
 
93
- # 2. Attach VPC Administrator role
94
- hcloud IAM GrantRoleToAgency --agency_name=<name> --role_id=<role-id>
93
+ # 2. Grant role to agency
94
+ hcloud IAM AssociateAgencyWithDomainPermission --agency_id=<id> --role_id=<role-id>
95
95
 
96
96
  # 3. Use in CreateFunction
97
97
  hcloud FunctionGraph CreateFunction ... --app_xrole=<agency-name>