huaweicloud-devkit 1.0.2-dev.9 → 1.0.2-next.10

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 (99) hide show
  1. package/.agents/plugins/marketplace.json +20 -20
  2. package/LICENSE +201 -201
  3. package/README.md +178 -138
  4. package/README.zh-CN.md +176 -138
  5. package/bin/setup.cjs +10 -8
  6. package/integrations/opencode/commands/huaweicloud-doctor.md +14 -14
  7. package/integrations/opencode/opencode.json +11 -14
  8. package/integrations/opencode/skills/huaweicloud-core/SKILL.md +32 -32
  9. package/package.json +60 -44
  10. package/plugins/huaweicloud-core/.claude-plugin/plugin.json +31 -44
  11. package/plugins/huaweicloud-core/.codex-plugin/plugin.json +30 -43
  12. package/plugins/huaweicloud-core/.cursor-plugin/plugin.json +31 -44
  13. package/plugins/huaweicloud-core/.mcp.json +13 -15
  14. package/plugins/huaweicloud-core/.workbuddy-plugin/plugin.json +31 -44
  15. package/plugins/huaweicloud-core/hooks/hooks.json +26 -26
  16. package/plugins/huaweicloud-core/hooks/huaweicloud-safety.py +136 -136
  17. package/plugins/huaweicloud-core/safety/policy.json +76 -100
  18. package/plugins/huaweicloud-core/safety/rules/cloud-risk-rules.json +227 -199
  19. package/plugins/huaweicloud-core/skills/huawei-apig/SKILL.md +164 -164
  20. package/plugins/huaweicloud-core/skills/huawei-billing/SKILL.md +48 -48
  21. package/plugins/huaweicloud-core/skills/huawei-cbr/SKILL.md +50 -50
  22. package/plugins/huaweicloud-core/skills/huawei-cce/SKILL.md +103 -101
  23. package/plugins/huaweicloud-core/skills/huawei-cloud-eye/SKILL.md +90 -90
  24. package/plugins/huaweicloud-core/skills/huawei-cloud-find-skills/SKILL.md +191 -190
  25. package/plugins/huaweicloud-core/skills/huawei-cloud-find-skills/scripts/search-skills.mjs +171 -124
  26. package/plugins/huaweicloud-core/skills/huawei-cts/SKILL.md +55 -55
  27. package/plugins/huaweicloud-core/skills/huawei-dds-dcs/SKILL.md +70 -70
  28. package/plugins/huaweicloud-core/skills/huawei-deployment/SKILL.md +57 -56
  29. package/plugins/huaweicloud-core/skills/huawei-dew/SKILL.md +106 -97
  30. package/plugins/huaweicloud-core/skills/huawei-dew/references/csms-usage.md +36 -29
  31. package/plugins/huaweicloud-core/skills/huawei-dew/references/kms-usage.md +29 -23
  32. package/plugins/huaweicloud-core/skills/huawei-ecs/SKILL.md +188 -185
  33. package/plugins/huaweicloud-core/skills/huawei-ecs/references/create-instance.md +144 -133
  34. package/plugins/huaweicloud-core/skills/huawei-ecs/references/evs.md +31 -31
  35. package/plugins/huaweicloud-core/skills/huawei-ecs/references/flavors.md +57 -55
  36. package/plugins/huaweicloud-core/skills/huawei-ecs/references/troubleshooting.md +52 -52
  37. package/plugins/huaweicloud-core/skills/huawei-functiongraph/SKILL.md +132 -131
  38. package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/apig-event-format.md +60 -58
  39. package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/create-function.md +72 -71
  40. package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/deploy-workflow.md +119 -119
  41. package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/triggers.md +142 -142
  42. package/plugins/huaweicloud-core/skills/huawei-gaussdb/SKILL.md +56 -56
  43. package/plugins/huaweicloud-core/skills/huawei-getting-started/SKILL.md +69 -65
  44. package/plugins/huaweicloud-core/skills/huawei-iam/SKILL.md +111 -111
  45. package/plugins/huaweicloud-core/skills/huawei-iam/references/policy-examples.md +148 -122
  46. package/plugins/huaweicloud-core/skills/huawei-iam/references/quick-ref.md +56 -56
  47. package/plugins/huaweicloud-core/skills/huawei-modelarts/SKILL.md +65 -65
  48. package/plugins/huaweicloud-core/skills/huawei-obs/SKILL.md +134 -127
  49. package/plugins/huaweicloud-core/skills/huawei-obs/references/bucket-create.md +49 -49
  50. package/plugins/huaweicloud-core/skills/huawei-obs/references/bucket-lifecycle.md +31 -26
  51. package/plugins/huaweicloud-core/skills/huawei-obs/references/common-pitfalls.md +101 -100
  52. package/plugins/huaweicloud-core/skills/huawei-obs/references/single-file-share.md +40 -40
  53. package/plugins/huaweicloud-core/skills/huawei-obs/references/static-website.md +56 -56
  54. package/plugins/huaweicloud-core/skills/huawei-rds/SKILL.md +229 -224
  55. package/plugins/huaweicloud-core/skills/huawei-sandbox/SKILL.md +173 -134
  56. package/plugins/huaweicloud-core/skills/huawei-smn-dms/SKILL.md +69 -69
  57. package/plugins/huaweicloud-core/skills/huawei-vpc/SKILL.md +84 -84
  58. package/plugins/huaweicloud-core/skills/huawei-vpc/references/network.md +77 -76
  59. package/plugins/huaweicloud-core/skills/huawei-vpc/references/security-group.md +60 -59
  60. package/plugins/huaweicloud-core/skills/huawei-vpc/references/subnet.md +50 -50
  61. package/plugins/huaweicloud-core/skills/huawei-waf-aad/SKILL.md +63 -63
  62. package/plugins/huaweicloud-core/skills/huaweicloud-api-and-sdk/SKILL.md +56 -56
  63. package/plugins/huaweicloud-core/skills/huaweicloud-api-and-sdk/agents/openai.yaml +4 -4
  64. package/plugins/huaweicloud-core/skills/huaweicloud-capability-discovery/SKILL.md +56 -47
  65. package/plugins/huaweicloud-core/skills/huaweicloud-capability-discovery/agents/openai.yaml +4 -4
  66. package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/SKILL.md +138 -128
  67. package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/agents/openai.yaml +4 -4
  68. package/plugins/huaweicloud-core/skills/huaweicloud-core/SKILL.md +111 -96
  69. package/plugins/huaweicloud-core/skills/huaweicloud-core/agents/openai.yaml +4 -4
  70. package/plugins/huaweicloud-core/skills/huaweicloud-core/references/report-issue.md +20 -20
  71. package/plugins/huaweicloud-core/skills/huaweicloud-core/references/select.md +30 -28
  72. package/plugins/huaweicloud-core/skills/huaweicloud-safety/SKILL.md +59 -60
  73. package/plugins/huaweicloud-core/skills/huaweicloud-safety/agents/openai.yaml +4 -4
  74. package/plugins/huaweicloud-core/skills/huaweicloud-troubleshooting/SKILL.md +83 -83
  75. package/plugins/huaweicloud-core/skills/huaweicloud-troubleshooting/agents/openai.yaml +4 -4
  76. package/plugins/huaweicloud-core/src/auth/agent-registration.mjs +54 -1
  77. package/plugins/huaweicloud-core/src/auth/credentials.mjs +103 -95
  78. package/plugins/huaweicloud-core/src/auth/service.mjs +63 -63
  79. package/plugins/huaweicloud-core/src/data/icons-manifest.v1.json +3517 -0
  80. package/plugins/huaweicloud-core/src/hcloud-cli.mjs +283 -265
  81. package/plugins/huaweicloud-core/src/icon-library.mjs +171 -0
  82. package/plugins/huaweicloud-core/src/mcp-server.mjs +130 -129
  83. package/plugins/huaweicloud-core/src/proxy/proxy-agent.mjs +68 -0
  84. package/plugins/huaweicloud-core/src/proxy/proxy-config.mjs +94 -0
  85. package/plugins/huaweicloud-core/src/risk-rule-engine.mjs +140 -137
  86. package/plugins/huaweicloud-core/src/safety-policy.mjs +356 -302
  87. package/plugins/huaweicloud-core/src/sandbox/hdkitservice-api.mjs +86 -87
  88. package/plugins/huaweicloud-core/src/sandbox/hwlink-api.mjs +150 -153
  89. package/plugins/huaweicloud-core/src/sandbox/session-manager.mjs +196 -105
  90. package/plugins/huaweicloud-core/src/search-market.mjs +208 -169
  91. package/plugins/huaweicloud-core/src/setup-cli.mjs +2622 -1594
  92. package/plugins/huaweicloud-core/src/tools.mjs +463 -111
  93. package/plugins/huaweicloud-core/src/ws-exec/hwlink-exec-client.js +447 -427
  94. package/plugins/huaweicloud-core/src/ws-exec/hwlink-fair-queue.js +128 -132
  95. package/plugins/huaweicloud-core/src/ws-exec/hwlink-multiplexer.js +215 -227
  96. package/plugins/huaweicloud-core/src/ws-exec/hwlink-packet.js +189 -202
  97. package/plugins/huaweicloud-core/src/ws-exec/hwlink-terminal-channel.js +164 -158
  98. package/plugins/huaweicloud-core/src/ws-exec/index.js +19 -19
  99. package/plugins/huaweicloud-core/src/ws-exec/ws-exec-client.js +338 -338
@@ -1,185 +1,188 @@
1
- ---
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."
4
- version: 1
5
- ---
6
-
7
- # Huawei Cloud ECS
8
-
9
- **STOP - Do not answer from general knowledge.** Follow the procedure below.
10
-
11
- Always run `hcloud <Service> <Operation> --help` before constructing commands to discover exact parameter names and requirements.
12
-
13
- ## Overview
14
-
15
- Domain expertise for Huawei Cloud Elastic Cloud Server (ECS). Covers instance lifecycle, flavor selection, image management, networking, storage attachment, auto-scaling, and troubleshooting.
16
-
17
- ## Prerequisites
18
-
19
- Before creating an ECS instance from scratch, you MUST have:
20
- - A VPC (see `huawei-vpc`)
21
- - A subnet with DNS configured (see `huawei-vpc`)
22
- - A security group with application ports open (see `huawei-vpc`)
23
-
24
- If these do not exist, load the `huawei-vpc` skill first and create them before returning here.
25
-
26
- ## Critical Warnings
27
-
28
- | Trap | Why |
29
- |------|-----|
30
- | Flavor not in region | Not all flavors available everywhere. Check with ECS ListFlavors first |
31
- | Security group denies all | New SGs deny ALL inbound. Must explicitly add rules |
32
- | EIP bills when idle | Unattached EIP still incurs charges |
33
- | Stopped instance still bills | Pay-per-use instances bill when stopped (unless shutdown-no-billing flavor) |
34
- | Disk survives instance delete | Deleting instance does NOT delete system disk by default |
35
-
36
- ## Flavor Selection Guide
37
-
38
- Flavor families are **region-dependent**. Always run `hcloud ECS ListFlavors --cli-region=<r>` to discover available flavors before recommending.
39
-
40
- | Scenario | Family | What to look for |
41
- |----------|--------|-----------------|
42
- | Web app / microservices | General-purpose (ac, s, sn, c) | 2-4 vCPU, 4-8 GB RAM |
43
- | Database / big data | Memory-optimized (m, r) | 4-8 vCPU, 16-64 GB RAM |
44
- | AI inference | GPU (g, p) | 8+ vCPU, 64+ GB RAM + GPU |
45
- | HPC | High-IO (h, ir, i) | 8+ vCPU, local SSD |
46
-
47
- > See `references/flavors.md` for discovery workflow. **Do not hardcode flavor names** — availability changes by region and over time.
48
-
49
- ## Common Workflows
50
-
51
- | Task | Command | Steps |
52
- |------|---------|-------|
53
- | List flavors | hcloud ECS ListFlavors --cli-region=<region> | references/flavors.md |
54
- | Create instance | hcloud ECS CreateServers --server.name=<n> --server.flavorRef=<id> --server.imageRef=<id> --server.nics.1.subnet_id=<id> --server.availability_zone=<az> | references/create-instance.md |
55
- | Find by name | See "How to search for instances" below | |
56
- | Bind EIP | hcloud EIP AssociatePublicips --publicip_id=<id> --publicip.associate_instance_id=<port-id> --publicip.associate_instance_type=PORT | Get port ID from `hcloud ECS ListServersDetails --server_id=<id>` → `OS-EXT-IPS:port_id` |
57
- | Security group rule | hcloud VPC CreateSecurityGroupRule --security_group_id=<id> --direction=<direction> --protocol=<protocol> | references/sg.md |
58
- | Attach disk | hcloud EVS AttachVolume --volume_id=<id> --server_id=<id> | references/evs.md |
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 |
61
-
62
- ## How to Search for Instances
63
-
64
- `ListServersDetails` supports `--name` for exact match only. For fuzzy search:
65
-
66
- 1. List all instances: `hcloud ECS ListServersDetails --cli-region=<region> --limit=100`
67
- 2. Filter client-side by name substring, tag, or status
68
- 3. Use `--server_tags` filter if instances are tagged: `hcloud ECS ListServersDetails --server_tags.1.key=Project`
69
-
70
- > **Return structure**: `ListServersDetails` returns `{"servers": [...]}` (array), NOT `{"server": ...}`. Parse as `.servers[0].status`, NOT `.server.status`.
71
-
72
- Abort if the result set is larger than `--limit` and ask the user to narrow the search.
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
-
121
- ## Deleting Instances
122
-
123
- - Show the user the exact command and get explicit approval before running
124
- - By default, `--delete_publicip` and `--delete_volume` are **false** — public IP and system disk survive deletion
125
- - Set both to `true` to avoid orphaned resources and unexpected billing
126
- - Data disks ARE deleted by default (unlike system disk)
127
-
128
- ## Troubleshooting
129
-
130
- | Error | Root Cause -> Fix |
131
- |-------|------------------|
132
- | Cannot SSH | SG missing port 22 or no EIP -> Add ingress rule / Bind EIP |
133
- | Flavor unavailable | Region limitation -> ListFlavors in target region |
134
- | Insufficient resources | Stock depleted -> Change flavor or AZ |
135
- | AuthFailure | Expired AK/SK -> re-run `npx huaweicloud-devkit auth init` |
136
- | APIGW.0802 / region permission | IAM user has no access to this region -> IAM console → User → Permissions → add region, or switch to another region |
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 |
138
-
139
- ## Security Considerations
140
-
141
- - MUST use security groups, not iptables
142
- - MUST store SSH keys in DEW, never in user-data
143
- - SHOULD enable CTS audit logging
144
- - MUST NOT open 0.0.0.0/0 for SSH
145
-
146
- ## MCP Tools
147
-
148
- Prefer these tools over raw hcloud CLI — they enforce safety policies:
149
-
150
- - huaweicloud_list_operations service=ECS
151
- - huaweicloud_run_readonly_command for discovery (auto-redacts output)
152
- - huaweicloud_plan_cli_command for command planning (returns command text + safety classification)
153
- - huaweicloud_run_approved_command for writes (requires exact command approval)
154
- - huaweicloud_check_cli to verify hcloud is available
155
-
156
- > **approvedCommand trap**: `huaweicloud_run_approved_command` validates that `approvedCommand` matches the planned command EXACTLY (including `<redacted>` placeholders). Always use the `command` field value returned by `huaweicloud_plan_cli_command` verbatim — never reconstruct or retype it. Mismatches cause rejection with "approvedCommand must exactly match the planned hcloud command."
157
-
158
- ## Without MCP (Fallback)
159
-
160
- If MCP tools are NOT available (new install, session not restarted):
161
- - Raw hcloud commands WILL appear in shell history — passwords and secrets are at risk
162
- - Always use key_name instead of adminPass
163
- - Verify safety manually: no secret value reads, no credential file access
164
- - Restart session as soon as possible to enable safety policies
165
-
166
- ## Without MCP
167
-
168
- Fall back to hcloud CLI. State: "MCP unavailable, using local hcloud CLI."
169
-
170
- ## Flexus (Lightweight ECS)
171
-
172
- Flexus is the lightweight ECS family. Two variants:
173
-
174
- | Variant | API | CLI | Billing |
175
- |---------|-----|:---:|---------|
176
- | **Flexus L** | HCSS (hcss:lightInstances) | ❌ No hcloud — Python SDK only | Prepaid only |
177
- | **Flexus X** | Standard ECS API | ✅ `hcloud ECS` with `x1.*` flavors | On-demand & prepaid |
178
-
179
- For Flexus X, use standard ECS CreateServers flow with `x1.*` flavors. For Flexus L, manual console provisioning is recommended — no KooCLI path exists.
180
-
181
- ## References
182
-
183
- - ECS Docs: https://support.huaweicloud.com/ecs/
184
- - Flavor specs: references/flavors.md
185
- - Create instance: references/create-instance.md
1
+ ---
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.'
4
+ version: 1
5
+ ---
6
+
7
+ # Huawei Cloud ECS
8
+
9
+ **STOP - Do not answer from general knowledge.** Follow the procedure below.
10
+
11
+ Always run `hcloud <Service> <Operation> --help` before constructing commands to discover exact parameter names and requirements.
12
+
13
+ ## Overview
14
+
15
+ Domain expertise for Huawei Cloud Elastic Cloud Server (ECS). Covers instance lifecycle, flavor selection, image management, networking, storage attachment, auto-scaling, and troubleshooting.
16
+
17
+ ## Prerequisites
18
+
19
+ Before creating an ECS instance from scratch, you MUST have:
20
+
21
+ - A VPC (see `huawei-vpc`)
22
+ - A subnet with DNS configured (see `huawei-vpc`)
23
+ - A security group with application ports open (see `huawei-vpc`)
24
+
25
+ If these do not exist, load the `huawei-vpc` skill first and create them before returning here.
26
+
27
+ ## Critical Warnings
28
+
29
+ | Trap | Why |
30
+ | ----------------------------- | --------------------------------------------------------------------------- |
31
+ | Flavor not in region | Not all flavors available everywhere. Check with ECS ListFlavors first |
32
+ | Security group denies all | New SGs deny ALL inbound. Must explicitly add rules |
33
+ | EIP bills when idle | Unattached EIP still incurs charges |
34
+ | Stopped instance still bills | Pay-per-use instances bill when stopped (unless shutdown-no-billing flavor) |
35
+ | Disk survives instance delete | Deleting instance does NOT delete system disk by default |
36
+
37
+ ## Flavor Selection Guide
38
+
39
+ Flavor families are **region-dependent**. Always run `hcloud ECS ListFlavors --cli-region=<r>` to discover available flavors before recommending.
40
+
41
+ | Scenario | Family | What to look for |
42
+ | ----------------------- | ------------------------------ | ------------------------- |
43
+ | Web app / microservices | General-purpose (ac, s, sn, c) | 2-4 vCPU, 4-8 GB RAM |
44
+ | Database / big data | Memory-optimized (m, r) | 4-8 vCPU, 16-64 GB RAM |
45
+ | AI inference | GPU (g, p) | 8+ vCPU, 64+ GB RAM + GPU |
46
+ | HPC | High-IO (h, ir, i) | 8+ vCPU, local SSD |
47
+
48
+ > See `references/flavors.md` for discovery workflow. **Do not hardcode flavor names** — availability changes by region and over time.
49
+
50
+ ## Common Workflows
51
+
52
+ | Task | Command | Steps |
53
+ | ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------- |
54
+ | List flavors | hcloud ECS ListFlavors --cli-region=<region> | references/flavors.md |
55
+ | Create instance | hcloud ECS CreateServers --server.name=<n> --server.flavorRef=<id> --server.imageRef=<id> --server.nics.1.subnet_id=<id> --server.availability_zone=<az> | references/create-instance.md |
56
+ | Find by name | See "How to search for instances" below | |
57
+ | Bind EIP | hcloud EIP AssociatePublicips --publicip_id=<id> --publicip.associate_instance_id=<port-id> --publicip.associate_instance_type=PORT | Get port ID from `hcloud ECS ListServersDetails --server_id=<id>` `OS-EXT-IPS:port_id` |
58
+ | Security group rule | hcloud VPC CreateSecurityGroupRule --security_group_id=<id> --direction=<direction> --protocol=<protocol> | references/sg.md |
59
+ | Attach disk | hcloud EVS AttachVolume --volume_id=<id> --server_id=<id> | references/evs.md |
60
+ | Delete instance | hcloud ECS DeleteServers --servers.1.id=<id> --delete_publicip=true --delete_volume=true | references/create-instance.md |
61
+ | Reboot instance | hcloud ECS BatchRebootServers --reboot.servers.1.id=<id> --reboot.type=SOFT | NOT `RebootServer` — that operation does not exist |
62
+
63
+ ## How to Search for Instances
64
+
65
+ `ListServersDetails` supports `--name` for exact match only. For fuzzy search:
66
+
67
+ 1. List all instances: `hcloud ECS ListServersDetails --cli-region=<region> --limit=100`
68
+ 2. Filter client-side by name substring, tag, or status
69
+ 3. Use `--server_tags` filter if instances are tagged: `hcloud ECS ListServersDetails --server_tags.1.key=Project`
70
+
71
+ > **Return structure**: `ListServersDetails` returns `{"servers": [...]}` (array), NOT `{"server": ...}`. Parse as `.servers[0].status`, NOT `.server.status`.
72
+
73
+ Abort if the result set is larger than `--limit` and ask the user to narrow the search.
74
+
75
+ ## Instance Status Polling
76
+
77
+ ECS creation is asynchronous. Status transitions: `BUILD` → `ACTIVE` (or `ERROR`). Wait times vary widely (20s–3min), never use fixed sleep.
78
+
79
+ Poll strategy:
80
+
81
+ ```bash
82
+ for i in $(seq 1 30); do
83
+ status=$(hcloud ECS ListServersDetails --cli-region=<region> --server_id=<id> --cli-output=json | jq -r '.servers[0].status')
84
+ if [ "$status" = "ACTIVE" ]; then break; fi
85
+ if [ "$status" = "ERROR" ]; then echo "Creation failed"; exit 1; fi
86
+ sleep 10
87
+ done
88
+ ```
89
+
90
+ - Poll interval: 10 seconds
91
+ - Maximum wait: 5 minutes (30 iterations)
92
+ - Check for `ERROR` status to detect creation failures early
93
+
94
+ ## SSH Connection Verification
95
+
96
+ After ECS is ACTIVE and EIP is bound, verify SSH connectivity:
97
+
98
+ ```bash
99
+ hcloud ECS ListServersDetails --cli-region=<region> --server_id=<id>
100
+ # → addresses.<vpc-id>[].OS-EXT-IPS:addr
101
+
102
+ ssh -o StrictHostKeyChecking=accept-new -i <path-to-private-key> root@<eip-address>
103
+ ```
104
+
105
+ > **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>`).
106
+
107
+ ### Running Commands Inside the Instance
108
+
109
+ Use SSH for any in-instance operations (install software, check logs, start services):
110
+
111
+ ```bash
112
+ ssh -o StrictHostKeyChecking=accept-new -i <key> root@<eip> 'command'
113
+ ```
114
+
115
+ Example — re-run failed cloud-init setup manually:
116
+
117
+ ```bash
118
+ ssh -o StrictHostKeyChecking=accept-new -i <key> root@<eip> 'dnf install -y nginx && systemctl enable --now nginx'
119
+ ```
120
+
121
+ > If SCP blocks SSH, use cloud-init `--server.user_data` for full deployment instead. See `references/create-instance.md` §Bootstrap.
122
+
123
+ ## Deleting Instances
124
+
125
+ - Show the user the exact command and get explicit approval before running
126
+ - By default, `--delete_publicip` and `--delete_volume` are **false** — public IP and system disk survive deletion
127
+ - Set both to `true` to avoid orphaned resources and unexpected billing
128
+ - Data disks ARE deleted by default (unlike system disk)
129
+
130
+ ## Troubleshooting
131
+
132
+ | Error | Root Cause -> Fix |
133
+ | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
134
+ | Cannot SSH | SG missing port 22 or no EIP -> Add ingress rule / Bind EIP |
135
+ | Flavor unavailable | Region limitation -> ListFlavors in target region |
136
+ | Insufficient resources | Stock depleted -> Change flavor or AZ |
137
+ | AuthFailure | Expired AK/SK -> re-run `npx huaweicloud-devkit auth init` |
138
+ | APIGW.0802 / region permission | IAM user has no access to this region -> IAM console → User → Permissions → add region, or switch to another region |
139
+ | 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 |
140
+
141
+ ## Security Considerations
142
+
143
+ - MUST use security groups, not iptables
144
+ - MUST store SSH keys in DEW, never in user-data
145
+ - SHOULD enable CTS audit logging
146
+ - MUST NOT open 0.0.0.0/0 for SSH
147
+
148
+ ## MCP Tools
149
+
150
+ Prefer these tools over raw hcloud CLI — they enforce safety policies:
151
+
152
+ - huaweicloud_list_operations service=ECS
153
+ - huaweicloud_run_readonly_command for discovery (auto-redacts output)
154
+ - huaweicloud_plan_cli_command for command planning (returns command text + safety classification)
155
+ - huaweicloud_run_approved_command for writes (requires exact command approval)
156
+ - huaweicloud_check_cli to verify hcloud is available
157
+
158
+ > **approvedCommand trap**: `huaweicloud_run_approved_command` validates that `approvedCommand` matches the planned command EXACTLY (including `<redacted>` placeholders). Always use the `command` field value returned by `huaweicloud_plan_cli_command` verbatim — never reconstruct or retype it. Mismatches cause rejection with "approvedCommand must exactly match the planned hcloud command."
159
+
160
+ ## Without MCP (Fallback)
161
+
162
+ If MCP tools are NOT available (new install, session not restarted):
163
+
164
+ - Raw hcloud commands WILL appear in shell history passwords and secrets are at risk
165
+ - Always use key_name instead of adminPass
166
+ - Verify safety manually: no secret value reads, no credential file access
167
+ - Restart session as soon as possible to enable safety policies
168
+
169
+ ## Without MCP
170
+
171
+ Fall back to hcloud CLI. State: "MCP unavailable, using local hcloud CLI."
172
+
173
+ ## Flexus (Lightweight ECS)
174
+
175
+ Flexus is the lightweight ECS family. Two variants:
176
+
177
+ | Variant | API | CLI | Billing |
178
+ | ------------ | -------------------------- | :---------------------------------: | ------------------- |
179
+ | **Flexus L** | HCSS (hcss:lightInstances) | ❌ No hcloud Python SDK only | Prepaid only |
180
+ | **Flexus X** | Standard ECS API | ✅ `hcloud ECS` with `x1.*` flavors | On-demand & prepaid |
181
+
182
+ For Flexus X, use standard ECS CreateServers flow with `x1.*` flavors. For Flexus L, manual console provisioning is recommended — no KooCLI path exists.
183
+
184
+ ## References
185
+
186
+ - ECS Docs: https://support.huaweicloud.com/ecs/
187
+ - Flavor specs: references/flavors.md
188
+ - Create instance: references/create-instance.md