huaweicloud-devkit 0.1.17 → 0.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -2
- package/package.json +1 -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/skills/huawei-cloud-find-skills/SKILL.md +1 -1
- package/plugins/huaweicloud-core/skills/huawei-dds-dcs/SKILL.md +2 -2
- package/plugins/huaweicloud-core/skills/huawei-ecs/references/create-instance.md +15 -9
- package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/triggers.md +1 -1
- package/plugins/huaweicloud-core/skills/huawei-vpc/SKILL.md +2 -1
- package/plugins/huaweicloud-core/skills/huawei-vpc/references/network.md +25 -1
- package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/SKILL.md +5 -5
- package/plugins/huaweicloud-core/src/setup-cli.mjs +38 -10
package/README.md
CHANGED
|
@@ -27,10 +27,10 @@ npx --yes huaweicloud-devkit uninstall # 卸载
|
|
|
27
27
|
### Codex
|
|
28
28
|
|
|
29
29
|
```bash
|
|
30
|
-
npx --yes huaweicloud-devkit install --target codex
|
|
30
|
+
npx --yes huaweicloud-devkit install --target codex
|
|
31
31
|
```
|
|
32
32
|
|
|
33
|
-
>
|
|
33
|
+
> 需要先安装 Codex CLI。`--target all` 会在 Codex CLI 缺失时跳过 Codex。
|
|
34
34
|
|
|
35
35
|
### Claude Code
|
|
36
36
|
|
|
@@ -143,6 +143,13 @@ Agent 技能是经过整理的指令和参考材料包,帮助 Agent 完成特
|
|
|
143
143
|
- [安全模型](docs/safety-model.md)
|
|
144
144
|
- [KooCLI 官方文档](https://support.huaweicloud.com/qs-hcli/hcli_02_003.html)
|
|
145
145
|
|
|
146
|
+
## 发布流程
|
|
147
|
+
|
|
148
|
+
发布采用两步 workflow,全部在 GitHub Actions 中完成:
|
|
149
|
+
|
|
150
|
+
1. **Prepare Release**(手动触发,选 `patch` / `minor` / `major`):自动 bump 版本、跑质量门、推 `release/vX.Y.Z` 分支并创建 PR,CI 全绿后自动合并进 `main`。
|
|
151
|
+
2. **Publish Release**(PR 合并后手动触发):读取 `main` 版本,创建并推送 `vX.Y.Z` tag,生成 GitHub Release;tag 触发 `CD Production`,经 `production` 环境人工审批后发布到 npm(包名 `huaweicloud-devkit`)。
|
|
152
|
+
|
|
146
153
|
## 许可证
|
|
147
154
|
|
|
148
155
|
本项目基于 Apache-2.0 许可证发布。详见 [LICENSE](LICENSE)。
|
package/package.json
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"mcpServers": "./.mcp.json",
|
|
21
21
|
"description": "Guide coding agents to use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities with safer execution and less context.",
|
|
22
22
|
"skills": "./skills/",
|
|
23
|
-
"version": "0.1.
|
|
23
|
+
"version": "0.1.20",
|
|
24
24
|
"author": {
|
|
25
25
|
"name": "HuaweiCloud Mate",
|
|
26
26
|
"url": "https://github.com/huaweicloud-mate"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "huaweicloud-core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.20",
|
|
4
4
|
"description": "Guide coding agents to use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities with safer execution and less context.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "HuaweiCloud Mate",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"mcpServers": "./.mcp.json",
|
|
21
21
|
"description": "Guide coding agents to use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities with safer execution and less context.",
|
|
22
22
|
"skills": "./skills/",
|
|
23
|
-
"version": "0.1.
|
|
23
|
+
"version": "0.1.20",
|
|
24
24
|
"author": {
|
|
25
25
|
"name": "HuaweiCloud Mate",
|
|
26
26
|
"url": "https://github.com/huaweicloud-mate"
|
|
@@ -12,7 +12,7 @@ description: |
|
|
|
12
12
|
|
|
13
13
|
# Huawei Cloud Agent Skills Search and Discovery
|
|
14
14
|
|
|
15
|
-
This skill enables users to efficiently search, discover, and install Huawei Cloud skills.
|
|
15
|
+
This skill enables users to efficiently search, discover, and install Huawei Cloud skills.
|
|
16
16
|
|
|
17
17
|
## Scenario Description
|
|
18
18
|
|
|
@@ -12,7 +12,7 @@ Always run `hcloud DDS <Operation> --help` or `hcloud DCS <Operation> --help` be
|
|
|
12
12
|
|
|
13
13
|
## DDS (Document Database Service — MongoDB Compatible)
|
|
14
14
|
|
|
15
|
-
## Critical Warnings
|
|
15
|
+
## DDS Critical Warnings
|
|
16
16
|
|
|
17
17
|
| Trap | Why |
|
|
18
18
|
|------|-----|
|
|
@@ -35,7 +35,7 @@ Discover exact parameters with `--help` before executing any command.
|
|
|
35
35
|
|
|
36
36
|
## DCS (Distributed Cache Service — Redis/Memcached)
|
|
37
37
|
|
|
38
|
-
## Critical Warnings
|
|
38
|
+
## DCS Critical Warnings
|
|
39
39
|
|
|
40
40
|
| Trap | Why |
|
|
41
41
|
|------|-----|
|
|
@@ -9,16 +9,20 @@ hcloud ECS ListFlavors --cli-region=<region> --cli-output=json
|
|
|
9
9
|
hcloud ECS NovaListAvailabilityZones --cli-region=<region>
|
|
10
10
|
|
|
11
11
|
## 3. Find image
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Broad search — specific names may return empty in some regions
|
|
12
15
|
hcloud IMS ListImages --cli-region=<region> --__imagetype=gold --__isregistered=true --limit=20
|
|
16
|
+
```
|
|
13
17
|
|
|
14
|
-
|
|
15
|
-
| Image | ID |
|
|
16
|
-
|-------|----|
|
|
17
|
-
| Ubuntu 22.04 | Query live via ListImages |
|
|
18
|
-
| CentOS 8.2 64bit | Query live via ListImages |
|
|
19
|
-
| EulerOS 2.9 64bit | Query live via ListImages |
|
|
18
|
+
If searching by name (e.g. --name="Ubuntu") returns empty: use broad search without name filter, pick from results. Some regions only offer Huawei Cloud EulerOS (HCE).
|
|
20
19
|
|
|
21
|
-
|
|
20
|
+
Common images (verify live per region):
|
|
21
|
+
| Image | Region | ID |
|
|
22
|
+
|-------|--------|----|
|
|
23
|
+
| HCE 2.0 Standard | cn-north-4 | 7d940784-ac0a-425f-b3fa-8478f1a1df70 |
|
|
24
|
+
| Ubuntu 22.04 | Query live | Query live |
|
|
25
|
+
| CentOS 8.2 | Query live | Query live |
|
|
22
26
|
|
|
23
27
|
## 4. Verify or create VPC/subnet
|
|
24
28
|
hcloud VPC ListVpcs --cli-region=<region>
|
|
@@ -26,7 +30,7 @@ hcloud VPC ListSubnets --vpc_id=<vpc-id> --cli-region=<region>
|
|
|
26
30
|
If no VPC/subnet exists: load `huawei-vpc` skill → create VPC → create subnet (with DNS) → create security group → return here.
|
|
27
31
|
|
|
28
32
|
## 5. Create keypair (recommended over adminPass)
|
|
29
|
-
hcloud ECS NovaCreateKeypair --
|
|
33
|
+
hcloud ECS NovaCreateKeypair --keypair_name=<name>
|
|
30
34
|
Save the returned private key to a local file. The public key is auto-injected.
|
|
31
35
|
|
|
32
36
|
Password alternative:
|
|
@@ -54,18 +58,20 @@ hcloud ECS CreateServers ... --server.user_data=$user_data
|
|
|
54
58
|
```
|
|
55
59
|
|
|
56
60
|
> **Security**: Never embed secrets (passwords, AK/SK, tokens) in user_data. It is stored unencrypted and readable from within the instance via IMDS. Fetch secrets at boot from DEW/CSMS instead.
|
|
57
|
-
|
|
61
|
+
>
|
|
58
62
|
> **Debugging**: If the script didn't run, check `/var/log/cloud-init-output.log` on the instance.
|
|
59
63
|
|
|
60
64
|
## 7. EIP (optional)
|
|
61
65
|
hcloud EIP CreatePublicip --publicip.type=<type> --bandwidth.size=<size> --bandwidth.share_type=<share-type> --bandwidth.name=<name>
|
|
62
66
|
|
|
67
|
+
```bash
|
|
63
68
|
# Get the ECS network port ID
|
|
64
69
|
hcloud ECS ListServersDetails --cli-region=<region> --server_id=<instance-id>
|
|
65
70
|
# → addresses.<vpc-id>[].OS-EXT-IPS:port_id
|
|
66
71
|
|
|
67
72
|
# Bind EIP via port
|
|
68
73
|
hcloud EIP AssociatePublicips --publicip_id=<eip-id> --publicip.associate_instance_id=<port-id> --publicip.associate_instance_type=PORT
|
|
74
|
+
```
|
|
69
75
|
|
|
70
76
|
## 8. Verify
|
|
71
77
|
hcloud ECS ListServersDetails --cli-region=<region> --server_id=<instance-id>
|
|
@@ -138,5 +138,5 @@ hcloud FunctionGraph DeleteFunctionTrigger --function_urn=<urn> --trigger_type_c
|
|
|
138
138
|
```
|
|
139
139
|
|
|
140
140
|
> Deleting a trigger does NOT cascade-delete the associated APIG API. After `DeleteFunctionTrigger`, also run `hcloud APIG ListApisV2 --instance_id=<id>` and delete orphaned APIs to avoid resource residue.
|
|
141
|
-
|
|
141
|
+
>
|
|
142
142
|
> **APIG event format**: When using DEDICATEDGATEWAY, the event body is Base64 encoded and uses a non-standard structure. See `apig-event-format.md` for handler templates.
|
|
@@ -38,7 +38,8 @@ Domain expertise for Huawei Cloud Virtual Private Cloud (VPC). Covers VPC/subnet
|
|
|
38
38
|
| SG rule | hcloud VPC CreateSecurityGroupRule --security_group_rule.security_group_id=<id> --security_group_rule.direction=<direction> --security_group_rule.protocol=<protocol> --security_group_rule.multiport=<port> --security_group_rule.remote_ip_prefix=<cidr> | references/security-group.md |
|
|
39
39
|
| Create EIP | hcloud EIP CreatePublicip --publicip.type=<type> --bandwidth.size=<size> --bandwidth.share_type=<share-type> --bandwidth.name=<name> | Run `hcloud EIP CreatePublicip --help` to confirm valid type values per region |
|
|
40
40
|
| Bind EIP to ECS | 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` |
|
|
41
|
-
| Unbind EIP | hcloud EIP
|
|
41
|
+
| Unbind EIP | hcloud EIP DisassociatePublicip --publicip_id=<id> | references/eip.md |
|
|
42
|
+
| Delete EIP | hcloud EIP DeletePublicip --publicip_id=<id> | references/eip.md |
|
|
42
43
|
| List EIPs | hcloud EIP ListPublicips | |
|
|
43
44
|
| NAT gateway | hcloud NAT CreateNatGateway --nat.name=<name> --nat.spec=<spec> --router_id=<vpc-id> --internal_network_id=<subnet-id> | Run `hcloud NAT CreateNatGateway --help` for available spec values |
|
|
44
45
|
|
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# VPC Network Management Reference
|
|
2
2
|
|
|
3
|
+
## DNS Addresses by Region
|
|
4
|
+
|
|
5
|
+
Subnets without DNS configuration will fail cloud-init. Use these DNS addresses:
|
|
6
|
+
|
|
7
|
+
| Region | Primary DNS | Secondary DNS |
|
|
8
|
+
|--------|------------|---------------|
|
|
9
|
+
| cn-north-1 | 100.125.1.250 | 100.125.129.250 |
|
|
10
|
+
| cn-north-4 | 100.125.1.250 | 100.125.129.250 |
|
|
11
|
+
| cn-east-3 | 100.125.1.250 | 100.125.129.250 |
|
|
12
|
+
| cn-south-1 | 100.125.1.250 | 100.125.129.250 |
|
|
13
|
+
| ap-southeast-3 | 100.125.1.250 | 100.125.129.250 |
|
|
14
|
+
|
|
15
|
+
**Subnet create with DNS**:
|
|
16
|
+
```bash
|
|
17
|
+
hcloud VPC CreateSubnet \
|
|
18
|
+
--subnet.name=<name> \
|
|
19
|
+
--subnet.vpc_id=<id> \
|
|
20
|
+
--subnet.cidr=10.50.1.0/24 \
|
|
21
|
+
--subnet.gateway_ip=10.50.1.1 \
|
|
22
|
+
--subnet.availability_zone=<az> \
|
|
23
|
+
--subnet.dnsList.1=100.125.1.250 \
|
|
24
|
+
--subnet.dnsList.2=100.125.129.250
|
|
25
|
+
```
|
|
26
|
+
|
|
3
27
|
## Nested Prefix Summary
|
|
4
28
|
|
|
5
29
|
KooCLI 7.x VPC API requires nested prefixes:
|
|
@@ -23,7 +47,7 @@ hcloud EIP AssociatePublicips --publicip_id=<id> \
|
|
|
23
47
|
--publicip.associate_instance_id=<port-id> --publicip.associate_instance_type=PORT
|
|
24
48
|
|
|
25
49
|
# Unbind
|
|
26
|
-
hcloud EIP
|
|
50
|
+
hcloud EIP DisassociatePublicip --publicip_id=<id>
|
|
27
51
|
|
|
28
52
|
# List
|
|
29
53
|
hcloud EIP ListPublicips
|
|
@@ -70,14 +70,14 @@ Agent processes find executables through `PATH`. If OpenCode/Codex cannot find `
|
|
|
70
70
|
2. **KooCLI first-run privacy agreement**: On a fresh KooCLI install, `hcloud` blocks with `同意并继续使用(y)/不同意并退出(N)` and fails with `[USE_ERROR]您输入的是无效字符` in non-interactive mode. Detection: check command output for these strings. Ask the user: "KooCLI needs to accept its privacy agreement. May I accept it on your behalf?" If the user agrees, run `huaweicloud_run_readonly_command` with `args=["version"]` and `stdin="y\n"`. This accepts the agreement once, after which hcloud works normally.
|
|
71
71
|
3. Ask the user to configure credentials outside the agent conversation when setup is needed.
|
|
72
72
|
4. Inspect profile and region only through redacted tooling.
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
5. Discover exact operation names with `hcloud <Service> --help` before guessing. Example: ECS instance listing is commonly `ECS ListServersDetails`; ECS creation is commonly `ECS CreateServers`; image lookup may be under `IMS GlanceShowImage`.
|
|
74
|
+
6. Use `--cli-output=json` for machine-readable responses when supported.
|
|
75
|
+
7. For resource operations, include `--cli-region`, `--cli-profile`, and service-specific project information when required.
|
|
76
|
+
8. Classify every command before running it:
|
|
77
77
|
- Read-only: `List*`, `Show*`, `Get*`, `Describe*`.
|
|
78
78
|
- Write: `Create*`, `Delete*`, `Update*`, `Resize*`, `Start*`, `Stop*`, `Authorize*`, and similar.
|
|
79
79
|
- Secret: any operation returning secret string, binary secret, token, or password.
|
|
80
|
-
|
|
80
|
+
9. For write operations, show the exact command and ask for explicit approval.
|
|
81
81
|
|
|
82
82
|
## KooCLI Syntax Notes
|
|
83
83
|
|
|
@@ -323,9 +323,13 @@ async function cmdInstall() {
|
|
|
323
323
|
if (target === 'codex' || target === 'all') {
|
|
324
324
|
console.log('\n[Codex]');
|
|
325
325
|
if (!hasCodexCLI()) {
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
326
|
+
if (target === 'codex') {
|
|
327
|
+
console.log(` \x1b[31mCodex CLI not found. Install Codex first: https://github.com/openai/codex-cli\x1b[0m`);
|
|
328
|
+
console.log(` Then re-run: npx huaweicloud-devkit install --target codex`);
|
|
329
|
+
process.exit(1);
|
|
330
|
+
}
|
|
331
|
+
console.log(` \x1b[33mCodex CLI not found. Skipping Codex.\x1b[0m`);
|
|
332
|
+
console.log(' Install Codex CLI to enable: npx huaweicloud-devkit install --target codex');
|
|
329
333
|
} else {
|
|
330
334
|
installCodex();
|
|
331
335
|
}
|
|
@@ -533,14 +537,38 @@ async function cmdInstallHcloud() {
|
|
|
533
537
|
: join(homedir(), '.local', 'bin');
|
|
534
538
|
|
|
535
539
|
if (os === 'win32') {
|
|
536
|
-
console.log(`[Windows] Download and unzip to ${installDir}`);
|
|
537
540
|
const url = `${baseUrl}/huaweicloud-cli-windows-amd64.zip`;
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
console.log(`
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
541
|
+
const zipPath = join(installDir, 'hcloud.zip');
|
|
542
|
+
|
|
543
|
+
console.log(`[Windows] Auto-installing to ${installDir}...`);
|
|
544
|
+
|
|
545
|
+
try {
|
|
546
|
+
mkdirSync(installDir, { recursive: true });
|
|
547
|
+
|
|
548
|
+
// Download
|
|
549
|
+
console.log(` Downloading ${url}...`);
|
|
550
|
+
const psCmd = `[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12; Invoke-WebRequest -Uri '${url}' -OutFile '${zipPath}' -UseBasicParsing`;
|
|
551
|
+
spawnSync('powershell', ['-NoProfile', '-Command', psCmd], { stdio: 'inherit', windowsHide: true });
|
|
552
|
+
|
|
553
|
+
// Extract
|
|
554
|
+
console.log(' Extracting...');
|
|
555
|
+
spawnSync('powershell', ['-NoProfile', '-Command', `Expand-Archive -Path '${zipPath}' -DestinationPath '${installDir}' -Force`], { stdio: 'inherit', windowsHide: true });
|
|
556
|
+
|
|
557
|
+
// Clean up zip
|
|
558
|
+
rmSync(zipPath, { force: true });
|
|
559
|
+
|
|
560
|
+
// Add to PATH
|
|
561
|
+
console.log(' Adding to user PATH...');
|
|
562
|
+
spawnSync('setx', ['PATH', `${process.env.PATH};${installDir}`], { stdio: 'inherit', windowsHide: true });
|
|
563
|
+
|
|
564
|
+
console.log(`\n\x1b[32mInstall complete.\x1b[0m`);
|
|
565
|
+
console.log(` Verify: ${join(installDir, 'hcloud.exe')} version`);
|
|
566
|
+
console.log(' Or restart terminal and: hcloud version');
|
|
567
|
+
} catch (e) {
|
|
568
|
+
console.log(`\n\x1b[33mAuto-install failed: ${e.message}\x1b[0m`);
|
|
569
|
+
console.log(` Manual: download ${url}, unzip to ${installDir}, add to PATH`);
|
|
570
|
+
console.log(` Guide: https://support.huaweicloud.com/qs-hcli/hcli_02_003_01.html`);
|
|
571
|
+
}
|
|
544
572
|
} else if (os === 'linux') {
|
|
545
573
|
console.log('[Linux] One-liner install:');
|
|
546
574
|
console.log(' 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');
|