huaweicloud-devkit 1.1.2-next.2 → 1.1.2-next.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/integrations/hermes/skills-snapshot.json +175 -0
- package/package.json +3 -1
- package/plugins/huaweicloud-core/.claude-plugin/plugin.json +1 -1
- package/plugins/huaweicloud-core/.codex-plugin/plugin.json +1 -1
- package/plugins/huaweicloud-core/.cursor-plugin/plugin.json +1 -1
- package/plugins/huaweicloud-core/.hermes-plugin/plugin.json +1 -1
- package/plugins/huaweicloud-core/.workbuddy-plugin/plugin.json +1 -1
- package/plugins/huaweicloud-core/openclaw.plugin.json +1 -1
- package/plugins/huaweicloud-core/skills/huawei-apig/SKILL.md +1 -1
- package/plugins/huaweicloud-core/skills/huawei-dew/SKILL.md +6 -7
- package/plugins/huaweicloud-core/skills/huawei-dew/references/csms-usage.md +7 -6
- package/plugins/huaweicloud-core/skills/huawei-dew/references/kms-usage.md +1 -1
- package/plugins/huaweicloud-core/skills/huawei-ecs/SKILL.md +1 -1
- package/plugins/huaweicloud-core/skills/huawei-ecs/references/evs.md +3 -1
- package/plugins/huaweicloud-core/skills/huawei-ecs/references/troubleshooting.md +10 -10
- package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/create-function.md +2 -2
- package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/deploy-workflow.md +1 -1
- package/plugins/huaweicloud-core/skills/huawei-getting-started/SKILL.md +15 -9
- package/plugins/huaweicloud-core/skills/huawei-iac/SKILL.md +1 -1
- package/plugins/huaweicloud-core/skills/huawei-iac/references/resource-catalog.md +1 -1
- package/plugins/huaweicloud-core/skills/huawei-iam/references/quick-ref.md +3 -3
- package/plugins/huaweicloud-core/skills/huawei-obs/SKILL.md +15 -15
- package/plugins/huaweicloud-core/skills/huawei-vpc/references/network.md +1 -1
- package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/SKILL.md +18 -16
- package/plugins/huaweicloud-core/src/hcloud-cli.mjs +11 -0
- package/plugins/huaweicloud-core/src/koocli-version.mjs +47 -0
- package/plugins/huaweicloud-core/src/setup-cli.mjs +41 -14
- package/plugins/huaweicloud-core/src/tools.mjs +17 -2
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
{
|
|
2
|
+
"hermes_version": "0.1.0",
|
|
3
|
+
"exported_at": "2026-09-07T00:00:00Z",
|
|
4
|
+
"skills": [
|
|
5
|
+
{
|
|
6
|
+
"name": "huawei-apig",
|
|
7
|
+
"source": "official",
|
|
8
|
+
"identifier": "official/huaweicloud/huawei-apig",
|
|
9
|
+
"category": "huaweicloud"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"name": "huawei-billing",
|
|
13
|
+
"source": "official",
|
|
14
|
+
"identifier": "official/huaweicloud/huawei-billing",
|
|
15
|
+
"category": "huaweicloud"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"name": "huawei-cbr",
|
|
19
|
+
"source": "official",
|
|
20
|
+
"identifier": "official/huaweicloud/huawei-cbr",
|
|
21
|
+
"category": "huaweicloud"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"name": "huawei-cce",
|
|
25
|
+
"source": "official",
|
|
26
|
+
"identifier": "official/huaweicloud/huawei-cce",
|
|
27
|
+
"category": "huaweicloud"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"name": "huawei-cloud-eye",
|
|
31
|
+
"source": "official",
|
|
32
|
+
"identifier": "official/huaweicloud/huawei-cloud-eye",
|
|
33
|
+
"category": "huaweicloud"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"name": "huawei-cloud-find-skills",
|
|
37
|
+
"source": "official",
|
|
38
|
+
"identifier": "official/huaweicloud/huawei-cloud-find-skills",
|
|
39
|
+
"category": "huaweicloud"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"name": "huawei-cts",
|
|
43
|
+
"source": "official",
|
|
44
|
+
"identifier": "official/huaweicloud/huawei-cts",
|
|
45
|
+
"category": "huaweicloud"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"name": "huawei-dds-dcs",
|
|
49
|
+
"source": "official",
|
|
50
|
+
"identifier": "official/huaweicloud/huawei-dds-dcs",
|
|
51
|
+
"category": "huaweicloud"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"name": "huawei-deployment",
|
|
55
|
+
"source": "official",
|
|
56
|
+
"identifier": "official/huaweicloud/huawei-deployment",
|
|
57
|
+
"category": "huaweicloud"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"name": "huawei-dew",
|
|
61
|
+
"source": "official",
|
|
62
|
+
"identifier": "official/huaweicloud/huawei-dew",
|
|
63
|
+
"category": "huaweicloud"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"name": "huawei-ecs",
|
|
67
|
+
"source": "official",
|
|
68
|
+
"identifier": "official/huaweicloud/huawei-ecs",
|
|
69
|
+
"category": "huaweicloud"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"name": "huawei-functiongraph",
|
|
73
|
+
"source": "official",
|
|
74
|
+
"identifier": "official/huaweicloud/huawei-functiongraph",
|
|
75
|
+
"category": "huaweicloud"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"name": "huawei-gaussdb",
|
|
79
|
+
"source": "official",
|
|
80
|
+
"identifier": "official/huaweicloud/huawei-gaussdb",
|
|
81
|
+
"category": "huaweicloud"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"name": "huawei-getting-started",
|
|
85
|
+
"source": "official",
|
|
86
|
+
"identifier": "official/huaweicloud/huawei-getting-started",
|
|
87
|
+
"category": "huaweicloud"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"name": "huawei-iam",
|
|
91
|
+
"source": "official",
|
|
92
|
+
"identifier": "official/huaweicloud/huawei-iam",
|
|
93
|
+
"category": "huaweicloud"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"name": "huawei-modelarts",
|
|
97
|
+
"source": "official",
|
|
98
|
+
"identifier": "official/huaweicloud/huawei-modelarts",
|
|
99
|
+
"category": "huaweicloud"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"name": "huawei-obs",
|
|
103
|
+
"source": "official",
|
|
104
|
+
"identifier": "official/huaweicloud/huawei-obs",
|
|
105
|
+
"category": "huaweicloud"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"name": "huawei-rds",
|
|
109
|
+
"source": "official",
|
|
110
|
+
"identifier": "official/huaweicloud/huawei-rds",
|
|
111
|
+
"category": "huaweicloud"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"name": "huawei-sandbox",
|
|
115
|
+
"source": "official",
|
|
116
|
+
"identifier": "official/huaweicloud/huawei-sandbox",
|
|
117
|
+
"category": "huaweicloud"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"name": "huawei-smn-dms",
|
|
121
|
+
"source": "official",
|
|
122
|
+
"identifier": "official/huaweicloud/huawei-smn-dms",
|
|
123
|
+
"category": "huaweicloud"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"name": "huawei-vpc",
|
|
127
|
+
"source": "official",
|
|
128
|
+
"identifier": "official/huaweicloud/huawei-vpc",
|
|
129
|
+
"category": "huaweicloud"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"name": "huawei-waf-aad",
|
|
133
|
+
"source": "official",
|
|
134
|
+
"identifier": "official/huaweicloud/huawei-waf-aad",
|
|
135
|
+
"category": "huaweicloud"
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"name": "huaweicloud-api-and-sdk",
|
|
139
|
+
"source": "official",
|
|
140
|
+
"identifier": "official/huaweicloud/huaweicloud-api-and-sdk",
|
|
141
|
+
"category": "huaweicloud"
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"name": "huaweicloud-capability-discovery",
|
|
145
|
+
"source": "official",
|
|
146
|
+
"identifier": "official/huaweicloud/huaweicloud-capability-discovery",
|
|
147
|
+
"category": "huaweicloud"
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"name": "huaweicloud-cli-and-auth",
|
|
151
|
+
"source": "official",
|
|
152
|
+
"identifier": "official/huaweicloud/huaweicloud-cli-and-auth",
|
|
153
|
+
"category": "huaweicloud"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"name": "huaweicloud-core",
|
|
157
|
+
"source": "official",
|
|
158
|
+
"identifier": "official/huaweicloud/huaweicloud-core",
|
|
159
|
+
"category": "huaweicloud"
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"name": "huaweicloud-safety",
|
|
163
|
+
"source": "official",
|
|
164
|
+
"identifier": "official/huaweicloud/huaweicloud-safety",
|
|
165
|
+
"category": "huaweicloud"
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"name": "huaweicloud-troubleshooting",
|
|
169
|
+
"source": "official",
|
|
170
|
+
"identifier": "official/huaweicloud/huaweicloud-troubleshooting",
|
|
171
|
+
"category": "huaweicloud"
|
|
172
|
+
}
|
|
173
|
+
],
|
|
174
|
+
"taps": []
|
|
175
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "huaweicloud-devkit",
|
|
3
|
-
"
|
|
3
|
+
"mcpName": "io.github.huaweicloud/huaweicloud-devkit",
|
|
4
|
+
"version": "1.1.2-next.3",
|
|
5
|
+
"kooCliVersion": "7.2.12",
|
|
4
6
|
"description": "Agent toolkit that helps coding agents use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities safely and accurately.",
|
|
5
7
|
"type": "module",
|
|
6
8
|
"files": [
|
|
@@ -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.2-next.
|
|
20
|
+
"version": "1.1.2-next.3",
|
|
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.2-next.
|
|
23
|
+
"version": "1.1.2-next.3",
|
|
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.2-next.
|
|
20
|
+
"version": "1.1.2-next.3",
|
|
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.2-next.
|
|
3
|
+
"version": "1.1.2-next.3",
|
|
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.2-next.
|
|
3
|
+
"version": "1.1.2-next.3",
|
|
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",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "huaweicloud-devkit",
|
|
3
3
|
"id": "huaweicloud-devkit",
|
|
4
4
|
"displayName": "HuaweiCloud DevKit",
|
|
5
|
-
"version": "1.1.2-next.
|
|
5
|
+
"version": "1.1.2-next.3",
|
|
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.",
|
|
@@ -119,7 +119,7 @@ hcloud APIG BatchPublishOrOfflineApiV2 \
|
|
|
119
119
|
## Throttling
|
|
120
120
|
|
|
121
121
|
```bash
|
|
122
|
-
hcloud APIG
|
|
122
|
+
hcloud APIG CreateRequestThrottlingPolicyV2 --instance_id=<id> --name=<n> --api_call_limits=1000
|
|
123
123
|
```
|
|
124
124
|
|
|
125
125
|
## Common Workflows
|
|
@@ -31,16 +31,15 @@ Domain expertise for Huawei Cloud Data Encryption Workshop (DEW). Covers CSMS fo
|
|
|
31
31
|
| Operation | Description |
|
|
32
32
|
| ------------------ | ------------------------------------------------------ |
|
|
33
33
|
| ListSecrets | List all secrets (names only, no values) |
|
|
34
|
-
|
|
|
34
|
+
| ShowSecret | Get secret metadata (rotation config, KMS key, status) |
|
|
35
35
|
| ListSecretVersions | List version IDs and stages (no values) |
|
|
36
36
|
|
|
37
37
|
### Secret Value (blocked by policy — use runtime injection)
|
|
38
38
|
|
|
39
|
-
| Operation
|
|
40
|
-
|
|
|
41
|
-
|
|
|
42
|
-
| ShowSecretVersion
|
|
43
|
-
| GetSecretValue | Blocked. Use MCP proxy resolve pattern |
|
|
39
|
+
| Operation | Safe Alternative |
|
|
40
|
+
| ------------------ | --------------------------------------------- |
|
|
41
|
+
| DownloadSecretBlob | Use {{resolve:csms:secret-id}} in IaC or SDK |
|
|
42
|
+
| ShowSecretVersion | Use runtime injection, never in agent context |
|
|
44
43
|
|
|
45
44
|
## KMS Operations
|
|
46
45
|
|
|
@@ -80,7 +79,7 @@ hcloud CSMS DownloadSecretBlob --secret_name=<name>
|
|
|
80
79
|
| Error | Root Cause -> Fix |
|
|
81
80
|
| -------------------- | --------------------------------------------------------------------------- |
|
|
82
81
|
| Secret not found | Wrong region or project -> Verify secret ARN includes region/project |
|
|
83
|
-
| AccessDenied on CSMS | Missing IAM CSMS policy -> Add csms:
|
|
82
|
+
| AccessDenied on CSMS | Missing IAM CSMS policy -> Add csms:ShowSecret + kms:Decrypt |
|
|
84
83
|
| KMS key disabled | Key scheduled for deletion or manually disabled -> Enable or create new key |
|
|
85
84
|
| Rotation stuck | Lambda/Python function error -> Check rotation function logs |
|
|
86
85
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Create Secret
|
|
4
4
|
|
|
5
|
-
hcloud CSMS CreateSecret --
|
|
5
|
+
hcloud CSMS CreateSecret --name=prod-db-password --secret_string='{"password":"CHANGE_ME"}'
|
|
6
6
|
|
|
7
7
|
## List Secrets (metadata only)
|
|
8
8
|
|
|
@@ -10,7 +10,7 @@ hcloud CSMS ListSecrets
|
|
|
10
10
|
|
|
11
11
|
## Describe Secret
|
|
12
12
|
|
|
13
|
-
hcloud CSMS
|
|
13
|
+
hcloud CSMS ShowSecret --secret_name=prod-db-password
|
|
14
14
|
|
|
15
15
|
## List Versions
|
|
16
16
|
|
|
@@ -25,12 +25,13 @@ Use: data.huaweicloud_csms_secret.db.secret_string
|
|
|
25
25
|
|
|
26
26
|
## Rotation
|
|
27
27
|
|
|
28
|
-
- Enable auto-rotation: hcloud CSMS
|
|
29
|
-
-
|
|
28
|
+
- Enable auto-rotation: `hcloud CSMS UpdateSecret --secret_name=<name> --auto_rotation=true --rotation_period=<days> --rotation_func_urn=<fn>` (or set at CreateSecret time)
|
|
29
|
+
- Trigger rotation now: `hcloud CSMS RotateSecret --secret_name=<name>`
|
|
30
|
+
- Rotation function ARN: provide a FunctionGraph rotation function to generate new secret values
|
|
30
31
|
|
|
31
32
|
## Policy Rules
|
|
32
33
|
|
|
33
|
-
- hcloud CSMS
|
|
34
|
+
- hcloud CSMS DownloadSecretBlob -> BLOCKED (use runtime injection)
|
|
34
35
|
- hcloud CSMS ShowSecretVersion -> BLOCKED
|
|
35
36
|
- hcloud CSMS ListSecrets -> ALLOWED (metadata only)
|
|
36
|
-
- hcloud CSMS
|
|
37
|
+
- hcloud CSMS ShowSecret -> ALLOWED (metadata only)
|
|
@@ -24,6 +24,6 @@ Use SDK with KMS client in application runtime.
|
|
|
24
24
|
|
|
25
25
|
## Key Deletion
|
|
26
26
|
|
|
27
|
-
- Schedule: hcloud KMS
|
|
27
|
+
- Schedule: hcloud KMS DeleteKey --key_id=<key-id> --pending_days=7
|
|
28
28
|
- Cancel during pending window: hcloud KMS CancelKeyDeletion --key_id=<key-id>
|
|
29
29
|
- WARNING: After deletion window passes, data encrypted with this key is UNRECOVERABLE
|
|
@@ -59,7 +59,7 @@ Flavor families are **region-dependent**. Always run `hcloud ECS ListFlavors --c
|
|
|
59
59
|
| Find by name | See "How to search for instances" below | |
|
|
60
60
|
| 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` |
|
|
61
61
|
| Security group rule | hcloud VPC CreateSecurityGroupRule --security_group_id=<id> --direction=<direction> --protocol=<protocol> | references/sg.md |
|
|
62
|
-
| Attach disk | hcloud
|
|
62
|
+
| Attach disk | hcloud ECS AttachServerVolume --server_id=<id> --volumeAttachment.volumeId=<id> | references/evs.md |
|
|
63
63
|
| Delete instance | hcloud ECS DeleteServers --servers.1.id=<id> --delete_publicip=true --delete_volume=true | references/create-instance.md |
|
|
64
64
|
| Reboot instance | hcloud ECS BatchRebootServers --reboot.servers.1.id=<id> --reboot.type=SOFT | NOT `RebootServer` — that operation does not exist |
|
|
65
65
|
| HC活动部署 | 按量付费购买ECS+Nginx部署后端服务 | references/hc-activity.md |
|
|
@@ -18,9 +18,11 @@ hcloud EVS CreateVolume \
|
|
|
18
18
|
## Attach to ECS
|
|
19
19
|
|
|
20
20
|
```bash
|
|
21
|
-
hcloud
|
|
21
|
+
hcloud ECS AttachServerVolume --server_id=<ecs-id> --volumeAttachment.volumeId=<vol-id>
|
|
22
22
|
```
|
|
23
23
|
|
|
24
|
+
> The attach operation lives under `ECS` (not `EVS`), and the volume id uses the nested `--volumeAttachment.volumeId` parameter.
|
|
25
|
+
|
|
24
26
|
## List / Delete
|
|
25
27
|
|
|
26
28
|
```bash
|
|
@@ -4,16 +4,16 @@
|
|
|
4
4
|
|
|
5
5
|
## 错误码映射
|
|
6
6
|
|
|
7
|
-
| 错误 | 根因 | 修复
|
|
8
|
-
| --------------------------------------- | ------------------------------- |
|
|
9
|
-
| `Ecs.0005` flavor-image 不匹配 | 镜像虚拟化类型与规格不兼容 | 检查 image `__support_amd`/`__support_xen` 与 flavor `os_extra_specs`。BareMetal 镜像不兼容标准 ECS 规格
|
|
10
|
-
| `[USE_ERROR]不正确的参数:imagetype` | 参数名错误 | KooCLI 使用双下划线前缀:`--__imagetype=gold`(不是 `--imagetype`)
|
|
11
|
-
| `[USE_ERROR]不正确的参数:chargingMode` | 参数路径错误 | 计费模式参数路径:`--server.extendparam.chargingMode=postPaid`。不传默认按需付费
|
|
12
|
-
| `[USE_ERROR]不正确的参数:__support_amd` | 参数无效 | `IMS ListImages` 某些版本不支持此过滤。去掉该参数,使用 client-side 过滤
|
|
13
|
-
| Cannot SSH | 安全组未开放22端口 或 未绑定EIP | 1) 添加入方向规则 tcp 22。2) `hcloud EIP
|
|
14
|
-
| Flavor unavailable | 区域不支持该规格 | `hcloud ECS ListFlavors --cli-region=<r>` 先查。不硬编码 s6/m6 等规格名
|
|
15
|
-
| Insufficient resources | AZ 库存不足 | 换规格、换 AZ、或等待资源释放
|
|
16
|
-
| AuthFailure | AK/SK 过期或无效 | `npx huaweicloud-devkit auth init` 重新配置统一凭据
|
|
7
|
+
| 错误 | 根因 | 修复 |
|
|
8
|
+
| --------------------------------------- | ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
9
|
+
| `Ecs.0005` flavor-image 不匹配 | 镜像虚拟化类型与规格不兼容 | 检查 image `__support_amd`/`__support_xen` 与 flavor `os_extra_specs`。BareMetal 镜像不兼容标准 ECS 规格 |
|
|
10
|
+
| `[USE_ERROR]不正确的参数:imagetype` | 参数名错误 | KooCLI 使用双下划线前缀:`--__imagetype=gold`(不是 `--imagetype`) |
|
|
11
|
+
| `[USE_ERROR]不正确的参数:chargingMode` | 参数路径错误 | 计费模式参数路径:`--server.extendparam.chargingMode=postPaid`。不传默认按需付费 |
|
|
12
|
+
| `[USE_ERROR]不正确的参数:__support_amd` | 参数无效 | `IMS ListImages` 某些版本不支持此过滤。去掉该参数,使用 client-side 过滤 |
|
|
13
|
+
| Cannot SSH | 安全组未开放22端口 或 未绑定EIP | 1) 添加入方向规则 tcp 22。2) `hcloud EIP AssociatePublicips --publicip_id=<id> --publicip.associate_instance_id=<port-id> --publicip.associate_instance_type=PORT` |
|
|
14
|
+
| Flavor unavailable | 区域不支持该规格 | `hcloud ECS ListFlavors --cli-region=<r>` 先查。不硬编码 s6/m6 等规格名 |
|
|
15
|
+
| Insufficient resources | AZ 库存不足 | 换规格、换 AZ、或等待资源释放 |
|
|
16
|
+
| AuthFailure | AK/SK 过期或无效 | `npx huaweicloud-devkit auth init` 重新配置统一凭据 |
|
|
17
17
|
|
|
18
18
|
## 创建失败诊断流程
|
|
19
19
|
|
|
@@ -62,9 +62,9 @@ To access VPC-internal resources from FunctionGraph:
|
|
|
62
62
|
|
|
63
63
|
```bash
|
|
64
64
|
# 1. Create agency (see huawei-iam skill)
|
|
65
|
-
hcloud IAM CreateAgency --
|
|
65
|
+
hcloud IAM CreateAgency --agency.name=<name> --agency.trust_domain_name=functiongraph --agency.domain_id=<id>
|
|
66
66
|
# 2. Grant role (e.g., VPC Administrator)
|
|
67
|
-
hcloud IAM
|
|
67
|
+
hcloud IAM AssociateAgencyWithDomainPermission --agency_id=<id> --domain_id=<id> --role_id=<role-id>
|
|
68
68
|
# 3. Use in CreateFunction
|
|
69
69
|
hcloud FunctionGraph CreateFunction --func_vpc.vpc_id=<vpc> --func_vpc.subnet_id=<subnet> --app_xrole=<name> ...
|
|
70
70
|
```
|
|
@@ -10,11 +10,15 @@ version: 1
|
|
|
10
10
|
|
|
11
11
|
## KooCLI Installation
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
|
16
|
-
|
|
|
17
|
-
|
|
|
13
|
+
This plugin is paired with **KooCLI v7.2.12**. Install the pinned version:
|
|
14
|
+
|
|
15
|
+
| OS | Command |
|
|
16
|
+
| -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
17
|
+
| Windows (PowerShell) | See https://support.huaweicloud.com/qs-hcli/hcli_02_003.html for MSI download |
|
|
18
|
+
| Linux | curl -LO "https://cn-north-4-hdn-koocli.obs.cn-north-4.myhuaweicloud.com/cli/7.2.12/huaweicloud-cli-linux-amd64.tar.gz" && tar -zxvf huaweicloud-cli-linux-amd64.tar.gz |
|
|
19
|
+
| macOS | curl -LO "https://cn-north-4-hdn-koocli.obs.cn-north-4.myhuaweicloud.com/cli/7.2.12/huaweicloud-cli-mac-amd64.tar.gz" && tar -zxvf huaweicloud-cli-mac-amd64.tar.gz |
|
|
20
|
+
|
|
21
|
+
> See `huaweicloud-cli-and-auth` skill for arm64 variants and the one-liner (latest) option.
|
|
18
22
|
|
|
19
23
|
## First-Time Setup
|
|
20
24
|
|
|
@@ -24,20 +28,22 @@ version: 1
|
|
|
24
28
|
4. **Verify**: `hcloud configure list` to confirm profile, then `hcloud ECS ListServersDetails --cli-region=cn-north-4`
|
|
25
29
|
5. For detailed auth guidance, see `huaweicloud-cli-and-auth` skill
|
|
26
30
|
|
|
27
|
-
> **Security**: Never pass AK/SK as command-line arguments (`--ak=...`). Always use `npx huaweicloud-devkit auth init` (unified, interactive
|
|
31
|
+
> **Security**: Never pass AK/SK as command-line arguments (`--ak=...`). Always use `npx huaweicloud-devkit auth init` (unified, interactive) or `hcloud configure init` (KooCLI only) to avoid secrets in shell history.
|
|
28
32
|
|
|
29
33
|
### Non-Interactive Setup (Agent/CI Environments)
|
|
30
34
|
|
|
31
|
-
When the interactive TUI is unavailable (Agent tools, CI/CD),
|
|
35
|
+
When the interactive TUI is unavailable (Agent tools, CI/CD), configure credentials outside agent chat using the unified entry point:
|
|
32
36
|
|
|
33
37
|
```bash
|
|
34
38
|
# User executes in their terminal (NOT in agent chat):
|
|
35
|
-
|
|
39
|
+
npx huaweicloud-devkit auth init
|
|
36
40
|
|
|
37
|
-
# Agent verifies:
|
|
41
|
+
# Agent verifies through redacted tooling only:
|
|
38
42
|
hcloud configure list
|
|
39
43
|
```
|
|
40
44
|
|
|
45
|
+
> Do **not** instruct the user to run `hcloud configure set --cli-access-key=... --cli-secret-key=...` — AK/SK would enter shell history. Use `npx huaweicloud-devkit auth init` instead.
|
|
46
|
+
|
|
41
47
|
## Critical Warnings
|
|
42
48
|
|
|
43
49
|
| Trap | Why |
|
|
@@ -34,7 +34,7 @@ Always run `hcloud <Service> <Operation> --help` before constructing commands to
|
|
|
34
34
|
## Provisioning Rules (Stage 6)
|
|
35
35
|
|
|
36
36
|
1. Generate `deployment_id` (`d-xxx`), initialize the session state file (path and schema: `references/state-file.md`).
|
|
37
|
-
2. **Batch approval: show the RESOURCE LIST (name / type / purpose), never the raw commands.** After the user approves, execute each resource via `huaweicloud_run_approved_command
|
|
37
|
+
2. **Batch approval: show the RESOURCE LIST (name / type / purpose), never the raw commands.** Present the numbered manifest BEFORE any `huaweicloud_plan_cli_command` call and get ONE explicit list-level approval. After the user approves the manifest, execute each resource via `huaweicloud_plan_cli_command` → `huaweicloud_run_approved_command` without re-asking list-level consent (per-command approval tokens are still required by the tool gate). Never execute anything outside the approved list.
|
|
38
38
|
3. Create in dependency-topological order (network → compute/db → bindings). After each success, extract the resource ID and write it to state immediately.
|
|
39
39
|
4. Any failure: stop immediately, mark state `partial`, report the error, offer destroy of already-created resources. No automatic rollback.
|
|
40
40
|
|
|
@@ -22,7 +22,7 @@ Every resource type the orchestration flow can purchase, bind, and destroy. This
|
|
|
22
22
|
| Resource | Create | Delete | Skill | Depends on |
|
|
23
23
|
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ---------- | -------------------------------------------------------------------------- |
|
|
24
24
|
| ECS instance | `hcloud ECS CreateServers --server.name=<n> --server.flavorRef=<id> --server.imageRef=<id> --server.vpcid=<id> --server.nics.1.subnet_id=<id> --server.security_groups.1.id=<id> --server.availability_zone=<az> --server.root_volume.volumetype=<type>` (hidden required: `vpcid` + `root_volume.volumetype`; check flavor family vs image arch, e.g. kc1 = ARM needs an ARM image) | `hcloud ECS DeleteServers --servers.1.id=<id> --delete_publicip=true --delete_volume=true` | huawei-ecs | VPC + Subnet + SG. Set both delete flags true on teardown or EIP/disk leak |
|
|
25
|
-
| EVS data disk | `hcloud EVS CreateVolume` | `hcloud EVS DeleteVolume` | huawei-ecs | - (attach with `hcloud
|
|
25
|
+
| EVS data disk | `hcloud EVS CreateVolume` | `hcloud EVS DeleteVolume` | huawei-ecs | - (attach with `hcloud ECS AttachServerVolume`) |
|
|
26
26
|
|
|
27
27
|
## Databases
|
|
28
28
|
|
|
@@ -15,9 +15,9 @@ hcloud IAM KeystoneShowUser # show user detail
|
|
|
15
15
|
## Credential Management
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
|
-
hcloud IAM
|
|
19
|
-
hcloud IAM CreateLoginToken
|
|
20
|
-
hcloud IAM
|
|
18
|
+
hcloud IAM ListAccessKeysV5 --user_id=<id> # list AK/SK for user
|
|
19
|
+
hcloud IAM CreateLoginToken # create login token
|
|
20
|
+
hcloud IAM GetAccountSummaryV5 # account summary
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
## Security Best Practices
|
|
@@ -62,21 +62,21 @@ hcloud OBS config -e=<endpoint> -i=<AK> -k=<SK> -t=token
|
|
|
62
62
|
|
|
63
63
|
## Common Workflows
|
|
64
64
|
|
|
65
|
-
| Task | Command
|
|
66
|
-
| ---------------------------- |
|
|
67
|
-
| Create bucket | `hcloud OBS mb obs://<bucket> -location=<region>`
|
|
68
|
-
| List buckets/objects | `hcloud OBS ls [obs://<bucket>]`
|
|
69
|
-
| Upload file | `hcloud OBS cp <file> obs://<bucket>/<key>`
|
|
70
|
-
| Upload directory (recursive) | `hcloud OBS cp <dir>/ obs://<bucket>/ -r -f -flat`
|
|
71
|
-
| Download object | `hcloud OBS cp obs://<bucket>/<key> <local-path>`
|
|
72
|
-
| Set bucket ACL | `hcloud OBS chattri obs://<bucket> -acl=public-read`
|
|
73
|
-
| Set object ACL | `hcloud OBS chattri obs://<bucket>/<key> -acl=public-read`
|
|
74
|
-
| Set lifecycle | `hcloud OBS lifecycle obs://<bucket> -method=put -localfile=<json>`
|
|
75
|
-
| Set bucket policy | `hcloud OBS bucketpolicy obs://<bucket> -method=put -localfile=<json>`
|
|
76
|
-
| Set CORS | `hcloud OBS
|
|
77
|
-
| Delete bucket | `hcloud OBS rm obs://<bucket> -r` (must be empty)
|
|
78
|
-
| Presigned URL | `hcloud OBS sign obs://<bucket>/<key> -e=<seconds>`
|
|
79
|
-
| Object metadata | `hcloud OBS stat obs://<bucket>/<key>`
|
|
65
|
+
| Task | Command |
|
|
66
|
+
| ---------------------------- | ------------------------------------------------------------------------- |
|
|
67
|
+
| Create bucket | `hcloud OBS mb obs://<bucket> -location=<region>` |
|
|
68
|
+
| List buckets/objects | `hcloud OBS ls [obs://<bucket>]` |
|
|
69
|
+
| Upload file | `hcloud OBS cp <file> obs://<bucket>/<key>` |
|
|
70
|
+
| Upload directory (recursive) | `hcloud OBS cp <dir>/ obs://<bucket>/ -r -f -flat` |
|
|
71
|
+
| Download object | `hcloud OBS cp obs://<bucket>/<key> <local-path>` |
|
|
72
|
+
| Set bucket ACL | `hcloud OBS chattri obs://<bucket> -acl=public-read` |
|
|
73
|
+
| Set object ACL | `hcloud OBS chattri obs://<bucket>/<key> -acl=public-read` | Bucket ACL does NOT cascade — anonymous reads need both |
|
|
74
|
+
| Set lifecycle | `hcloud OBS lifecycle obs://<bucket> -method=put -localfile=<json>` |
|
|
75
|
+
| Set bucket policy | `hcloud OBS bucketpolicy obs://<bucket> -method=put -localfile=<json>` |
|
|
76
|
+
| Set CORS | Not available via `hcloud OBS` — use API/SDK (`SetBucketCors`) or console |
|
|
77
|
+
| Delete bucket | `hcloud OBS rm obs://<bucket> -r` (must be empty) |
|
|
78
|
+
| Presigned URL | `hcloud OBS sign obs://<bucket>/<key> -e=<seconds>` |
|
|
79
|
+
| Object metadata | `hcloud OBS stat obs://<bucket>/<key>` |
|
|
80
80
|
|
|
81
81
|
## Static Website Deployment Workflow
|
|
82
82
|
|
|
@@ -54,7 +54,7 @@ hcloud EIP AssociatePublicips --publicip_id=<id> \
|
|
|
54
54
|
--publicip.associate_instance_id=<port-id> --publicip.associate_instance_type=PORT
|
|
55
55
|
|
|
56
56
|
# Unbind
|
|
57
|
-
hcloud EIP
|
|
57
|
+
hcloud EIP DisassociatePublicips --publicip_id=<id>
|
|
58
58
|
|
|
59
59
|
# List
|
|
60
60
|
hcloud EIP ListPublicips
|
|
@@ -13,56 +13,58 @@ Use KooCLI `hcloud` for local inspection and reviewed operations. Never ask the
|
|
|
13
13
|
|
|
14
14
|
Official guide: `https://support.huaweicloud.com/qs-hcli/hcli_02_003.html`.
|
|
15
15
|
|
|
16
|
+
> **Version pairing**: this plugin is paired with **KooCLI v7.2.12** (`kooCliVersion` in `package.json`). Prefer the pinned download below. The one-liner script `hcloud_install.sh` always installs the `latest` version and cannot be pinned — if you use it, `check_cli`/`doctor` will warn when the installed version does not match v7.2.12.
|
|
17
|
+
|
|
16
18
|
### Windows
|
|
17
19
|
|
|
18
|
-
1. Download and unzip: `https://cn-north-4-hdn-koocli.obs.cn-north-4.myhuaweicloud.com/cli/
|
|
20
|
+
1. Download and unzip: `https://cn-north-4-hdn-koocli.obs.cn-north-4.myhuaweicloud.com/cli/7.2.12/huaweicloud-cli-windows-amd64.zip`
|
|
19
21
|
2. Extract to `%USERPROFILE%\hcloud`, add to user `PATH`
|
|
20
22
|
3. Verify: `hcloud version`
|
|
21
23
|
|
|
22
24
|
### Linux (amd64 / arm64)
|
|
23
25
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
curl -sSL https://cn-north-4-hdn-koocli.obs.cn-north-4.myhuaweicloud.com/cli/latest/hcloud_install.sh -o ./hcloud_install.sh && bash ./hcloud_install.sh -y
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
Or manual download:
|
|
26
|
+
Fixed download (recommended):
|
|
31
27
|
|
|
32
28
|
```bash
|
|
33
29
|
# amd64
|
|
34
|
-
curl -LO "https://cn-north-4-hdn-koocli.obs.cn-north-4.myhuaweicloud.com/cli/
|
|
30
|
+
curl -LO "https://cn-north-4-hdn-koocli.obs.cn-north-4.myhuaweicloud.com/cli/7.2.12/huaweicloud-cli-linux-amd64.tar.gz"
|
|
35
31
|
tar -zxvf huaweicloud-cli-linux-amd64.tar.gz
|
|
36
32
|
# arm64
|
|
37
|
-
curl -LO "https://cn-north-4-hdn-koocli.obs.cn-north-4.myhuaweicloud.com/cli/
|
|
33
|
+
curl -LO "https://cn-north-4-hdn-koocli.obs.cn-north-4.myhuaweicloud.com/cli/7.2.12/huaweicloud-cli-linux-arm64.tar.gz"
|
|
38
34
|
tar -zxvf huaweicloud-cli-linux-arm64.tar.gz
|
|
39
35
|
```
|
|
40
36
|
|
|
41
37
|
Move to PATH: `mv $(pwd)/hcloud ~/.local/bin/`
|
|
42
38
|
Verify: `hcloud version`
|
|
43
39
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
One-liner (recommended):
|
|
40
|
+
One-liner (installs `latest`, may drift from v7.2.12):
|
|
47
41
|
|
|
48
42
|
```bash
|
|
49
43
|
curl -sSL https://cn-north-4-hdn-koocli.obs.cn-north-4.myhuaweicloud.com/cli/latest/hcloud_install.sh -o ./hcloud_install.sh && bash ./hcloud_install.sh -y
|
|
50
44
|
```
|
|
51
45
|
|
|
52
|
-
|
|
46
|
+
### macOS (amd64 / arm64)
|
|
47
|
+
|
|
48
|
+
Fixed download (recommended):
|
|
53
49
|
|
|
54
50
|
```bash
|
|
55
51
|
# amd64
|
|
56
|
-
curl -LO "https://cn-north-4-hdn-koocli.obs.cn-north-4.myhuaweicloud.com/cli/
|
|
52
|
+
curl -LO "https://cn-north-4-hdn-koocli.obs.cn-north-4.myhuaweicloud.com/cli/7.2.12/huaweicloud-cli-mac-amd64.tar.gz"
|
|
57
53
|
tar -zxvf huaweicloud-cli-mac-amd64.tar.gz
|
|
58
54
|
# arm64 (Apple Silicon)
|
|
59
|
-
curl -LO "https://cn-north-4-hdn-koocli.obs.cn-north-4.myhuaweicloud.com/cli/
|
|
55
|
+
curl -LO "https://cn-north-4-hdn-koocli.obs.cn-north-4.myhuaweicloud.com/cli/7.2.12/huaweicloud-cli-mac-arm64.tar.gz"
|
|
60
56
|
tar -zxvf huaweicloud-cli-mac-arm64.tar.gz
|
|
61
57
|
```
|
|
62
58
|
|
|
63
59
|
Move to PATH: `mv $(pwd)/hcloud /usr/local/bin/`
|
|
64
60
|
Verify: `hcloud version`
|
|
65
61
|
|
|
62
|
+
One-liner (installs `latest`, may drift from v7.2.12):
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
curl -sSL https://cn-north-4-hdn-koocli.obs.cn-north-4.myhuaweicloud.com/cli/latest/hcloud_install.sh -o ./hcloud_install.sh && bash ./hcloud_install.sh -y
|
|
66
|
+
```
|
|
67
|
+
|
|
66
68
|
Agent processes find executables through `PATH`. If OpenCode/Codex cannot find `hcloud`, restart after updating `PATH`, or set `HCLOUD_BIN`.
|
|
67
69
|
|
|
68
70
|
## Configure Credentials Outside Chat
|
|
@@ -131,11 +131,22 @@ function applyPreflightFindings(classification, sgFindings) {
|
|
|
131
131
|
return classification;
|
|
132
132
|
}
|
|
133
133
|
|
|
134
|
+
const OBS_WRITE_SUBCOMMANDS = new Set(['mb', 'cp', 'mv', 'rm', 'chattri', 'restore']);
|
|
135
|
+
|
|
136
|
+
function obsWriteHint(args) {
|
|
137
|
+
if (!Array.isArray(args) || args.length < 2) return null;
|
|
138
|
+
if (String(args[0]).toUpperCase() !== 'OBS') return null;
|
|
139
|
+
if (!OBS_WRITE_SUBCOMMANDS.has(String(args[1]).toLowerCase())) return null;
|
|
140
|
+
return 'OBS write operations are obsutil-style and always write-class. Before executing, present the full resource manifest (bucket/object list) to the user for ONE batch approval, then run each command through plan → approve (see huawei-iac skill, Provisioning Rules).';
|
|
141
|
+
}
|
|
142
|
+
|
|
134
143
|
export function planHcloudCommand(args, options = {}) {
|
|
135
144
|
const normalizedArgs = Array.isArray(args) ? args.map(String) : [];
|
|
136
145
|
const classification = classifyHcloudArgs(normalizedArgs, options);
|
|
137
146
|
const command = ['hcloud', ...normalizedArgs].map((arg) => quoteShellArg(arg)).join(' ');
|
|
138
147
|
const warnings = planningWarnings(normalizedArgs);
|
|
148
|
+
const obsHint = obsWriteHint(normalizedArgs);
|
|
149
|
+
if (obsHint) warnings.push(obsHint);
|
|
139
150
|
const sgFindings = preflightSecurityGroupCheck(normalizedArgs);
|
|
140
151
|
if (sgFindings.length > 0) {
|
|
141
152
|
for (const f of sgFindings) warnings.push(f);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { resolve, dirname } from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
|
|
5
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
const PACKAGE_JSON = resolve(__dirname, '..', '..', '..', 'package.json');
|
|
7
|
+
|
|
8
|
+
export const KOO_CLI_BASE = 'https://cn-north-4-hdn-koocli.obs.cn-north-4.myhuaweicloud.com/cli';
|
|
9
|
+
|
|
10
|
+
const VERSION_RE = /\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?/;
|
|
11
|
+
|
|
12
|
+
export function getKooCliVersion() {
|
|
13
|
+
try {
|
|
14
|
+
const pkg = JSON.parse(readFileSync(PACKAGE_JSON, 'utf8'));
|
|
15
|
+
return pkg.kooCliVersion || null;
|
|
16
|
+
} catch {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function parseHcloudVersion(out) {
|
|
22
|
+
if (!out) return null;
|
|
23
|
+
const match = String(out).match(VERSION_RE);
|
|
24
|
+
return match ? match[0] : null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function compareVersion(a, b) {
|
|
28
|
+
const pa = String(a || '')
|
|
29
|
+
.split(/[-+]/)[0]
|
|
30
|
+
.split('.')
|
|
31
|
+
.map((n) => Number.parseInt(n, 10) || 0);
|
|
32
|
+
const pb = String(b || '')
|
|
33
|
+
.split(/[-+]/)[0]
|
|
34
|
+
.split('.')
|
|
35
|
+
.map((n) => Number.parseInt(n, 10) || 0);
|
|
36
|
+
for (let i = 0; i < Math.max(pa.length, pb.length); i += 1) {
|
|
37
|
+
const va = pa[i] || 0;
|
|
38
|
+
const vb = pb[i] || 0;
|
|
39
|
+
if (va > vb) return 1;
|
|
40
|
+
if (va < vb) return -1;
|
|
41
|
+
}
|
|
42
|
+
return 0;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function kooCliDownloadBase() {
|
|
46
|
+
return `${KOO_CLI_BASE}/${getKooCliVersion() || 'latest'}`;
|
|
47
|
+
}
|
|
@@ -36,6 +36,13 @@ import {
|
|
|
36
36
|
} from './proxy/proxy-config.mjs';
|
|
37
37
|
import { removeKooCli, removeObsConfig } from './sandbox/uninstall-cleanup.mjs';
|
|
38
38
|
import { queryDistTagsSync, determineTarget, semverCompare } from './update-check.mjs';
|
|
39
|
+
import {
|
|
40
|
+
getKooCliVersion,
|
|
41
|
+
parseHcloudVersion,
|
|
42
|
+
compareVersion,
|
|
43
|
+
kooCliDownloadBase,
|
|
44
|
+
KOO_CLI_BASE,
|
|
45
|
+
} from './koocli-version.mjs';
|
|
39
46
|
|
|
40
47
|
const { DatabaseSync } = createRequire(import.meta.url)('node:sqlite');
|
|
41
48
|
|
|
@@ -3668,12 +3675,28 @@ async function cmdDoctor() {
|
|
|
3668
3675
|
const hcloudOk = hcloudCheck.status === 0 && /KooCLI|Current.*version|当前KooCLI/i.test(hcloudOut);
|
|
3669
3676
|
check('hcloud CLI installed', hcloudOk, 'Run: npx huaweicloud-devkit install-hcloud');
|
|
3670
3677
|
|
|
3678
|
+
const kooCliTarget = getKooCliVersion();
|
|
3679
|
+
if (hcloudOk && kooCliTarget) {
|
|
3680
|
+
const installed = parseHcloudVersion(hcloudOut);
|
|
3681
|
+
if (installed && compareVersion(installed, kooCliTarget) !== 0) {
|
|
3682
|
+
warn++;
|
|
3683
|
+
console.log(
|
|
3684
|
+
` \x1b[33m[WARN]\x1b[0m KooCLI version mismatch: installed ${installed}, this plugin is paired with ${kooCliTarget}.`,
|
|
3685
|
+
);
|
|
3686
|
+
console.log(
|
|
3687
|
+
` Reinstall the pinned version: curl -LO "${kooCliDownloadBase()}/huaweicloud-cli-linux-amd64.tar.gz" (or your platform's package), or run \`npx huaweicloud-devkit install-hcloud\`.`,
|
|
3688
|
+
);
|
|
3689
|
+
}
|
|
3690
|
+
}
|
|
3691
|
+
|
|
3671
3692
|
// CodeArts sandbox mode warning
|
|
3672
3693
|
const sandboxMode = detectCodeartsSandbox();
|
|
3673
3694
|
if (sandboxMode === 'sandbox') {
|
|
3674
|
-
console.log(` \x1b[33m[WARN]\x1b[0m
|
|
3675
|
-
console.log(` KooCLI
|
|
3676
|
-
console.log(
|
|
3695
|
+
console.log(` \x1b[33m[WARN]\x1b[0m 检测到码道沙箱模式 (bash_mode: sandbox)`);
|
|
3696
|
+
console.log(` KooCLI 可能无法写入 ~/.hcloud/ 配置目录,并卡在隐私协议确认。`);
|
|
3697
|
+
console.log(
|
|
3698
|
+
` 修复:在码道设置中关闭沙箱模式后重试 (设置 → 对话流 → 智能体 终端命令运行模式 → 自动运行),或改用码道外的终端。`,
|
|
3699
|
+
);
|
|
3677
3700
|
warn++;
|
|
3678
3701
|
}
|
|
3679
3702
|
|
|
@@ -4016,7 +4039,9 @@ async function cmdInstallHcloud() {
|
|
|
4016
4039
|
|
|
4017
4040
|
const os = platform();
|
|
4018
4041
|
const arch = process.arch;
|
|
4019
|
-
const baseUrl =
|
|
4042
|
+
const baseUrl = kooCliDownloadBase();
|
|
4043
|
+
const kooCliVersion = getKooCliVersion();
|
|
4044
|
+
const latestUrl = `${KOO_CLI_BASE}/latest`;
|
|
4020
4045
|
const installDir = os === 'win32' ? join(homedir(), 'hcloud') : join(homedir(), '.local', 'bin');
|
|
4021
4046
|
|
|
4022
4047
|
if (os === 'win32') {
|
|
@@ -4113,28 +4138,30 @@ async function cmdInstallHcloud() {
|
|
|
4113
4138
|
}
|
|
4114
4139
|
}
|
|
4115
4140
|
} else if (os === 'linux') {
|
|
4116
|
-
console.log('[Linux]
|
|
4117
|
-
console.log(
|
|
4118
|
-
' curl -sSL https://cn-north-4-hdn-koocli.obs.cn-north-4.myhuaweicloud.com/cli/latest/hcloud_install.sh -o ./hcloud_install.sh && bash ./hcloud_install.sh -y',
|
|
4119
|
-
);
|
|
4120
|
-
console.log(`\nOr manual: ${arch === 'arm64' ? 'ARM64' : 'AMD64'}`);
|
|
4141
|
+
console.log('[Linux] Auto-install (pinned to KooCLI <version>):'.replace('<version>', kooCliVersion || ''));
|
|
4121
4142
|
const pkg = arch === 'arm64' ? 'linux-arm64' : 'linux-amd64';
|
|
4122
4143
|
console.log(` curl -LO "${baseUrl}/huaweicloud-cli-${pkg}.tar.gz"`);
|
|
4123
4144
|
console.log(` tar -zxvf huaweicloud-cli-${pkg}.tar.gz`);
|
|
4124
4145
|
console.log(` mv hcloud ~/.local/bin/`);
|
|
4125
4146
|
console.log(` hcloud version`);
|
|
4126
|
-
console.log(`\
|
|
4127
|
-
}
|
|
4128
|
-
console.log('[macOS] One-liner install:');
|
|
4147
|
+
console.log(`\n Or one-liner (installs LATEST, may differ from pinned ${kooCliVersion || ''}):`);
|
|
4148
|
+
console.log(` curl -sSL ${latestUrl}/hcloud_install.sh -o ./hcloud_install.sh && bash ./hcloud_install.sh -y`);
|
|
4129
4149
|
console.log(
|
|
4130
|
-
|
|
4150
|
+
` \x1b[33m⚠️ The one-liner installs the latest KooCLI. If \`hcloud version\` != ${kooCliVersion}, doctor/check_cli will warn — use the pinned download above instead.\x1b[0m`,
|
|
4131
4151
|
);
|
|
4132
|
-
console.log(`\
|
|
4152
|
+
console.log(`\nFull guide: https://support.huaweicloud.com/qs-hcli/hcli_02_003_02.html`);
|
|
4153
|
+
} else if (os === 'darwin') {
|
|
4154
|
+
console.log('[macOS] Auto-install (pinned to KooCLI <version>):'.replace('<version>', kooCliVersion || ''));
|
|
4133
4155
|
const pkg = arch === 'arm64' ? 'mac-arm64' : 'mac-amd64';
|
|
4134
4156
|
console.log(` curl -LO "${baseUrl}/huaweicloud-cli-${pkg}.tar.gz"`);
|
|
4135
4157
|
console.log(` tar -zxvf huaweicloud-cli-${pkg}.tar.gz`);
|
|
4136
4158
|
console.log(` mv hcloud /usr/local/bin/`);
|
|
4137
4159
|
console.log(` hcloud version`);
|
|
4160
|
+
console.log(`\n Or one-liner (installs LATEST, may differ from pinned ${kooCliVersion || ''}):`);
|
|
4161
|
+
console.log(` curl -sSL ${latestUrl}/hcloud_install.sh -o ./hcloud_install.sh && bash ./hcloud_install.sh -y`);
|
|
4162
|
+
console.log(
|
|
4163
|
+
` \x1b[33m⚠️ The one-liner installs the latest KooCLI. If \`hcloud version\` != ${kooCliVersion}, doctor/check_cli will warn — use the pinned download above instead.\x1b[0m`,
|
|
4164
|
+
);
|
|
4138
4165
|
console.log(`\nFull guide: https://support.huaweicloud.com/qs-hcli/hcli_02_003_03.html`);
|
|
4139
4166
|
}
|
|
4140
4167
|
|
|
@@ -57,6 +57,7 @@ import {
|
|
|
57
57
|
resolveSkipFilePath,
|
|
58
58
|
upgradePackage,
|
|
59
59
|
} from './update-check.mjs';
|
|
60
|
+
import { getKooCliVersion, parseHcloudVersion, compareVersion } from './koocli-version.mjs';
|
|
60
61
|
|
|
61
62
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
62
63
|
const SKILLS_ROOT_DEV = join(__dirname, '..', 'skills');
|
|
@@ -174,7 +175,8 @@ const SKILLS_ROOT = resolveSkillsRoot();
|
|
|
174
175
|
export const TOOL_DEFINITIONS = [
|
|
175
176
|
{
|
|
176
177
|
name: 'huaweicloud_check_cli',
|
|
177
|
-
description:
|
|
178
|
+
description:
|
|
179
|
+
'Check whether Huawei Cloud KooCLI hcloud is installed and whether its version matches the plugin paired version. Returns redacted output.',
|
|
178
180
|
inputSchema: {
|
|
179
181
|
type: 'object',
|
|
180
182
|
properties: {},
|
|
@@ -1386,13 +1388,26 @@ export async function runVersionCheck(options = {}) {
|
|
|
1386
1388
|
});
|
|
1387
1389
|
const errorText = result.error || result.stderr || '';
|
|
1388
1390
|
const isSpawnError = /ENOENT|SPAWN_ERROR/i.test(errorText) || result.code === 'SPAWN_ERROR';
|
|
1391
|
+
const requiredVersion = getKooCliVersion();
|
|
1392
|
+
const installedVersion = parseHcloudVersion(result.stdout || '');
|
|
1393
|
+
const versionMismatch = !!(
|
|
1394
|
+
result.ok &&
|
|
1395
|
+
requiredVersion &&
|
|
1396
|
+
installedVersion &&
|
|
1397
|
+
compareVersion(installedVersion, requiredVersion) !== 0
|
|
1398
|
+
);
|
|
1389
1399
|
return {
|
|
1390
1400
|
installed: result.ok,
|
|
1391
1401
|
authenticated: result.ok && !/配置文件中不存在配置项|USE_ERROR.*配置/i.test(result.stdout || ''),
|
|
1392
1402
|
errorCode: isSpawnError ? 'HCLOUD_NOT_FOUND' : undefined,
|
|
1393
1403
|
output: result.ok ? result.stdout : errorText,
|
|
1404
|
+
kooCliVersion: requiredVersion || undefined,
|
|
1405
|
+
installedVersion: installedVersion || undefined,
|
|
1406
|
+
versionMismatch,
|
|
1394
1407
|
nextStep: result.ok
|
|
1395
|
-
?
|
|
1408
|
+
? versionMismatch
|
|
1409
|
+
? `KooCLI version mismatch: installed ${installedVersion}, this plugin is paired with ${requiredVersion}. Reinstall the pinned version (see huaweicloud-cli-and-auth skill) and restart the agent.`
|
|
1410
|
+
: 'Use huaweicloud_show_profile_redacted to inspect the active KooCLI profile safely.'
|
|
1396
1411
|
: isSpawnError
|
|
1397
1412
|
? 'hcloud executable not found. Set HCLOUD_BIN to the full hcloud path, or install KooCLI: npx huaweicloud-devkit install-hcloud. Then restart the agent.'
|
|
1398
1413
|
: 'Install Huawei Cloud KooCLI: npx huaweicloud-devkit install-hcloud. Configure credentials outside the agent conversation.',
|