huaweicloud-devkit 0.1.17 → 0.1.19

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 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
- > **注意:** 如果未检测到 Codex CLI,安装程序会自动跳过 Codex。
33
+ > 需要先安装 Codex CLI。`--target all` 会在 Codex CLI 缺失时跳过 Codex。
34
34
 
35
35
  ### Claude Code
36
36
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "huaweicloud-devkit",
3
- "version": "0.1.17",
3
+ "version": "0.1.19",
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": [
@@ -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.17",
23
+ "version": "0.1.19",
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.17",
3
+ "version": "0.1.19",
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.17",
23
+ "version": "0.1.19",
24
24
  "author": {
25
25
  "name": "HuaweiCloud Mate",
26
26
  "url": "https://github.com/huaweicloud-mate"
@@ -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
- Common image IDs (cn-south-1, verify with region):
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
- Always run ListImages to get the latest image IDs — they change over time.
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 --keypair.name=<name>
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:
@@ -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 UnbindPublicIp --publicip_id=<id> | references/eip.md |
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 UnbindPublicIp --publicip_id=<id>
50
+ hcloud EIP DisassociatePublicip --publicip_id=<id>
27
51
 
28
52
  # List
29
53
  hcloud EIP ListPublicips
@@ -57,12 +57,14 @@ Agent processes find executables through `PATH`. If OpenCode/Codex cannot find `
57
57
 
58
58
  ## Configure Credentials Outside Chat
59
59
 
60
+ **NEVER let AK/SK enter shell history. This is the #1 credential leak vector.**
61
+
60
62
  - Create AK/SK in the Huawei Cloud console under `My Credentials -> Access Keys`.
61
- - **Interactive** (preferred): `hcloud configure init` — prompts safely for AK/SK/region.
62
- - **Non-interactive** (Agent/CI environments): `hcloud configure set --cli-access-key=<AK> --cli-secret-key=<SK> --cli-region=<region>` user must execute outside agent chat.
63
- - Required concepts: Access Key ID, Secret Access Key, Region such as `ap-southeast-3`, and Project ID.
63
+ - **Interactive** (preferred, SAFE): `hcloud configure init` — prompts for AK/SK via terminal input. Values do NOT enter shell history.
64
+ - **Non-interactive** (DANGEROUS — AK/SK in shell history): `hcloud configure set --cli-access-key=<AK> --cli-secret-key=<SK> --cli-region=<region>`. Only use in ephemeral CI/CD shells. User must execute outside agent chat.
65
+ - If MCP is available, use `huaweicloud_show_profile_redacted` to check status without ever seeing credentials.
64
66
  - Never paste AK/SK, passwords, tokens, or profile files into the agent conversation.
65
- - KooCLI stores credentials in `~/.hcloud/config.json`, NOT environment variables. `HCLOUD_ACCESS_KEY` / `HCLOUD_SECRET_KEY` / `HCLOUD_REGION` env vars are NOT read by KooCLI 7.x. Always use `hcloud configure set`.
67
+ - KooCLI stores credentials in `~/.hcloud/config.json`, NOT environment variables. `HCLOUD_ACCESS_KEY` / `HCLOUD_SECRET_KEY` / `HCLOUD_REGION` env vars are NOT read by KooCLI 7.x.
66
68
 
67
69
  ## Safe Flow
68
70
 
@@ -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
- console.log(` \x1b[33mCodex CLI not found. Skipping Codex install.\x1b[0m`);
327
- console.log(' To install for Codex, first install Codex CLI, then run:');
328
- console.log(' npx huaweicloud-devkit install --target codex');
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
- console.log(` Download: ${url}`);
539
- console.log(` Unzip to: ${installDir}`);
540
- console.log(` Add to PATH: ${installDir}`);
541
- console.log(` Verify: hcloud version`);
542
- console.log('\n\x1b[33mWindows auto-install not supported yet. Run commands above manually.\x1b[0m');
543
- console.log(`\nFull guide: https://support.huaweicloud.com/qs-hcli/hcli_02_003_01.html`);
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');
@@ -564,7 +592,10 @@ async function cmdInstallHcloud() {
564
592
  }
565
593
 
566
594
  console.log('\nAfter install, set HCLOUD_BIN if hcloud is not on PATH.');
567
- console.log('Then run: npx huaweicloud-devkit doctor');
595
+ console.log('\n\x1b[1m\x1b[33m=== Configure credentials SAFELY ===\x1b[0m');
596
+ console.log(' Interactive (safe): hcloud configure init');
597
+ console.log(' NEVER: hcloud configure set --cli-access-key=xxx (AK/SK in shell history!)');
598
+ console.log('\nThen run: npx huaweicloud-devkit doctor');
568
599
  }
569
600
 
570
601
  async function main() {