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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/.agents/plugins/marketplace.json +20 -20
  2. package/LICENSE +201 -201
  3. package/README.md +163 -138
  4. package/README.zh-CN.md +161 -138
  5. package/bin/setup.cjs +8 -8
  6. package/integrations/opencode/commands/huaweicloud-doctor.md +14 -14
  7. package/integrations/opencode/opencode.json +14 -14
  8. package/integrations/opencode/skills/huaweicloud-core/SKILL.md +32 -32
  9. package/package.json +46 -44
  10. package/plugins/huaweicloud-core/.claude-plugin/plugin.json +44 -44
  11. package/plugins/huaweicloud-core/.codex-plugin/plugin.json +43 -43
  12. package/plugins/huaweicloud-core/.cursor-plugin/plugin.json +44 -44
  13. package/plugins/huaweicloud-core/.mcp.json +15 -15
  14. package/plugins/huaweicloud-core/.workbuddy-plugin/plugin.json +44 -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 +99 -99
  18. package/plugins/huaweicloud-core/safety/rules/cloud-risk-rules.json +199 -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 +101 -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 +190 -190
  25. package/plugins/huaweicloud-core/skills/huawei-cloud-find-skills/scripts/search-skills.mjs +124 -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 +56 -56
  29. package/plugins/huaweicloud-core/skills/huawei-dew/SKILL.md +97 -97
  30. package/plugins/huaweicloud-core/skills/huawei-dew/references/csms-usage.md +29 -29
  31. package/plugins/huaweicloud-core/skills/huawei-dew/references/kms-usage.md +23 -23
  32. package/plugins/huaweicloud-core/skills/huawei-ecs/SKILL.md +185 -185
  33. package/plugins/huaweicloud-core/skills/huawei-ecs/references/create-instance.md +133 -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 +55 -55
  36. package/plugins/huaweicloud-core/skills/huawei-ecs/references/troubleshooting.md +52 -52
  37. package/plugins/huaweicloud-core/skills/huawei-functiongraph/SKILL.md +131 -131
  38. package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/apig-event-format.md +58 -58
  39. package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/create-function.md +71 -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 +65 -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 +122 -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 +133 -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 +26 -26
  51. package/plugins/huaweicloud-core/skills/huawei-obs/references/common-pitfalls.md +100 -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 +224 -224
  55. package/plugins/huaweicloud-core/skills/huawei-sandbox/SKILL.md +135 -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 +76 -76
  59. package/plugins/huaweicloud-core/skills/huawei-vpc/references/security-group.md +59 -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 +51 -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 +128 -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 +110 -95
  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 +19 -19
  71. package/plugins/huaweicloud-core/skills/huaweicloud-core/references/select.md +27 -27
  72. package/plugins/huaweicloud-core/skills/huaweicloud-safety/SKILL.md +60 -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 +105 -87
  77. package/plugins/huaweicloud-core/src/auth/credentials.mjs +95 -95
  78. package/plugins/huaweicloud-core/src/auth/service.mjs +63 -63
  79. package/plugins/huaweicloud-core/src/hcloud-cli.mjs +265 -265
  80. package/plugins/huaweicloud-core/src/mcp-server.mjs +129 -129
  81. package/plugins/huaweicloud-core/src/proxy/proxy-agent.mjs +155 -0
  82. package/plugins/huaweicloud-core/src/proxy/proxy-config.mjs +87 -0
  83. package/plugins/huaweicloud-core/src/risk-rule-engine.mjs +137 -137
  84. package/plugins/huaweicloud-core/src/safety-policy.mjs +302 -302
  85. package/plugins/huaweicloud-core/src/sandbox/hdkitservice-api.mjs +91 -87
  86. package/plugins/huaweicloud-core/src/sandbox/hwlink-api.mjs +162 -153
  87. package/plugins/huaweicloud-core/src/sandbox/session-manager.mjs +112 -105
  88. package/plugins/huaweicloud-core/src/search-market.mjs +174 -169
  89. package/plugins/huaweicloud-core/src/setup-cli.mjs +2017 -1594
  90. package/plugins/huaweicloud-core/src/tools.mjs +1008 -993
  91. package/plugins/huaweicloud-core/src/ws-exec/hwlink-exec-client.js +427 -427
  92. package/plugins/huaweicloud-core/src/ws-exec/hwlink-fair-queue.js +132 -132
  93. package/plugins/huaweicloud-core/src/ws-exec/hwlink-multiplexer.js +227 -227
  94. package/plugins/huaweicloud-core/src/ws-exec/hwlink-packet.js +202 -202
  95. package/plugins/huaweicloud-core/src/ws-exec/hwlink-terminal-channel.js +158 -158
  96. package/plugins/huaweicloud-core/src/ws-exec/index.js +19 -19
  97. package/plugins/huaweicloud-core/src/ws-exec/ws-exec-client.js +338 -338
@@ -1,20 +1,20 @@
1
- # Issue Reporting Procedure
2
-
3
- Use when the user reports an issue with a previous routing decision.
4
-
5
- ## Procedure
6
-
7
- 1. Acknowledge the feedback without defensiveness
8
- 2. Re-check the Sub-skill registry for a better match
9
- 3. If a different service is clearly right, load that skill
10
- 4. If unclear, broaden the search: use huaweicloud_search_docs
11
- 5. Document the mismatch so the registry can be improved
12
-
13
- ## Common Corrections
14
-
15
- | Wrong Routing | Likely Correct |
16
- |---------------|---------------|
17
- | ECS for containers | CCE |
18
- | OBS for block storage | EVS (via huawei-ecs) |
19
- | RDS for cache | DCS (via huawei-dds-dcs) |
1
+ # Issue Reporting Procedure
2
+
3
+ Use when the user reports an issue with a previous routing decision.
4
+
5
+ ## Procedure
6
+
7
+ 1. Acknowledge the feedback without defensiveness
8
+ 2. Re-check the Sub-skill registry for a better match
9
+ 3. If a different service is clearly right, load that skill
10
+ 4. If unclear, broaden the search: use huaweicloud_search_docs
11
+ 5. Document the mismatch so the registry can be improved
12
+
13
+ ## Common Corrections
14
+
15
+ | Wrong Routing | Likely Correct |
16
+ |---------------|---------------|
17
+ | ECS for containers | CCE |
18
+ | OBS for block storage | EVS (via huawei-ecs) |
19
+ | RDS for cache | DCS (via huawei-dds-dcs) |
20
20
  | FunctionGraph for long-running tasks | ECS or CCE |
@@ -1,28 +1,28 @@
1
- # Service Selection Procedure
2
-
3
- Use when the user asks which service to use or compares services.
4
-
5
- ## Decision Flow
6
-
7
- 1. Classify workload: compute, storage, database, network, serverless, AI, messaging, security, observability
8
- 2. Check Service Map in huaweicloud-core SKILL.md
9
- 3. If multiple services match, ask clarifying questions:
10
- - Expected scale (small demo vs production)
11
- - Data model (relational vs document vs key-value)
12
- - Latency requirements
13
- - Budget constraints
14
- 4. Present top 1-2 recommendations with rationale
15
- 5. Hand off to the selected service skill
16
-
17
- ## Example: I need a database
18
-
19
- Ask:
20
- - What type of data? Structured (tables) or flexible (documents)?
21
- - What scale? Small app or enterprise?
22
- - Do you need SQL queries?
23
-
24
- Route based on answers:
25
- - SQL + standard scale -> huawei-rds
26
- - SQL + massive scale / distributed -> huawei-gaussdb
27
- - Document model (MongoDB-compatible) -> huawei-dds-dcs
1
+ # Service Selection Procedure
2
+
3
+ Use when the user asks which service to use or compares services.
4
+
5
+ ## Decision Flow
6
+
7
+ 1. Classify workload: compute, storage, database, network, serverless, AI, messaging, security, observability
8
+ 2. Check Service Map in huaweicloud-core SKILL.md
9
+ 3. If multiple services match, ask clarifying questions:
10
+ - Expected scale (small demo vs production)
11
+ - Data model (relational vs document vs key-value)
12
+ - Latency requirements
13
+ - Budget constraints
14
+ 4. Present top 1-2 recommendations with rationale
15
+ 5. Hand off to the selected service skill
16
+
17
+ ## Example: I need a database
18
+
19
+ Ask:
20
+ - What type of data? Structured (tables) or flexible (documents)?
21
+ - What scale? Small app or enterprise?
22
+ - Do you need SQL queries?
23
+
24
+ Route based on answers:
25
+ - SQL + standard scale -> huawei-rds
26
+ - SQL + massive scale / distributed -> huawei-gaussdb
27
+ - Document model (MongoDB-compatible) -> huawei-dds-dcs
28
28
  - Cache / key-value -> huawei-dds-dcs (DCS)
@@ -1,60 +1,60 @@
1
- ---
2
- name: huaweicloud-safety
3
- description: Huawei Cloud safety policy for agents. Use when handling credentials, secrets, IAM, public exposure, billing, destructive actions, scaling, write operations, hooks, command approval, output redaction, or risk review.
4
- ---
5
-
6
- # Huawei Cloud Safety
7
-
8
-
9
- **STOP - Do not answer from general knowledge.** Follow the procedure below.
10
-
11
- Use this skill before any Huawei Cloud action that may expose secrets, change resources, affect cost, change IAM, or expose a network endpoint.
12
-
13
- ## Rules
14
-
15
- 1. Never ask the user to paste AK/SK, SK, tokens, passwords, private keys, or credential files.
16
- 2. Never read local `.hcloud` or `.huaweicloud` credential files into the agent context.
17
- 3. Never call APIs or CLI operations that return secret values directly into the agent context.
18
- 4. Always classify operations before execution:
19
- - read-only
20
- - write
21
- - secret
22
- - IAM/security
23
- - cost/payment
24
- - public exposure
25
- 5. For any non-read-only operation, show the exact planned change and wait for explicit user approval.
26
- 6. Redact secrets from command output, errors, JSON, logs, and generated reports.
27
- 7. If a command contains `adminPass`, `password`, token, or any secret-like field, warn that plaintext can remain in shell history. Prefer local-only input, runtime injection, or user-side execution.
28
-
29
- ## Enforcement Layers
30
-
31
- - Hooks: `hooks/huaweicloud-safety.py` can block risky tool calls on platforms that support plugin hooks.
32
- - MCP wrapper: the Node MCP server applies the same safety policy for Codex/OpenCode paths that do not enforce hooks.
33
- - Skills: this document teaches agents the rule before they act.
34
-
35
- ## Write Execution Boundary
36
-
37
- - Default path: use `huaweicloud_plan_cli_command` to produce a reviewed command block, then let the user or host agent execute it after approval.
38
- - Approved tool path: use `huaweicloud_run_approved_command` only when the exact planned command has been shown and the user explicitly approved that exact command.
39
- - After a write, verify with `huaweicloud_run_readonly_command` or another read-only check.
40
-
41
- ## Proactive Hook Checks
42
-
43
- Before executing, deploying, or handing generated cloud artifacts to the user, run the matching check when available:
44
-
45
- - `huaweicloud_hook_check_command` for shell or KooCLI command text.
46
- - `huaweicloud_hook_check_artifacts` for generated policy, IaC, config, workflow, or deployment files.
47
- - `huaweicloud_hook_check_deploy_plan` for sandbox, preview, FunctionGraph, ECS, CCE, APIG, OBS, IAM, or cost-affecting plans.
48
-
49
- If the result is `deny`, repair the command, artifact, or deployment plan before execution. If the result is `warn`, show the warning to the user and repair or ask for explicit confirmation.
50
-
51
- ## Static Analysis Boundary
52
-
53
- Hook checks inspect the command or plan text that is available before execution. If a command builds cloud parameters through shell variables, string concatenation, subshells, encoded payloads, or generated scripts, first expand the final command into reviewable text and run `huaweicloud_hook_check_command` on that final form. When the final values cannot be determined, stop and ask the user to review the expanded command or use `huaweicloud_plan_cli_command` before execution.
54
-
55
- ## Safe Alternatives
56
-
57
- - Use redacted profile inspection instead of raw `hcloud configure show`.
58
- - Use runtime secret injection instead of fetching secret values into chat.
59
- - Use read-only verification after a write.
60
- - Prefer reviewed IaC for durable infrastructure changes.
1
+ ---
2
+ name: huaweicloud-safety
3
+ description: Huawei Cloud safety policy for agents. Use when handling credentials, secrets, IAM, public exposure, billing, destructive actions, scaling, write operations, hooks, command approval, output redaction, or risk review.
4
+ ---
5
+
6
+ # Huawei Cloud Safety
7
+
8
+
9
+ **STOP - Do not answer from general knowledge.** Follow the procedure below.
10
+
11
+ Use this skill before any Huawei Cloud action that may expose secrets, change resources, affect cost, change IAM, or expose a network endpoint.
12
+
13
+ ## Rules
14
+
15
+ 1. Never ask the user to paste AK/SK, SK, tokens, passwords, private keys, or credential files.
16
+ 2. Never read local `.hcloud` or `.huaweicloud` credential files into the agent context.
17
+ 3. Never call APIs or CLI operations that return secret values directly into the agent context.
18
+ 4. Always classify operations before execution:
19
+ - read-only
20
+ - write
21
+ - secret
22
+ - IAM/security
23
+ - cost/payment
24
+ - public exposure
25
+ 5. For any non-read-only operation, show the exact planned change and wait for explicit user approval.
26
+ 6. Redact secrets from command output, errors, JSON, logs, and generated reports.
27
+ 7. If a command contains `adminPass`, `password`, token, or any secret-like field, warn that plaintext can remain in shell history. Prefer local-only input, runtime injection, or user-side execution.
28
+
29
+ ## Enforcement Layers
30
+
31
+ - Hooks: `hooks/huaweicloud-safety.py` can block risky tool calls on platforms that support plugin hooks.
32
+ - MCP wrapper: the Node MCP server applies the same safety policy for Codex/OpenCode paths that do not enforce hooks.
33
+ - Skills: this document teaches agents the rule before they act.
34
+
35
+ ## Write Execution Boundary
36
+
37
+ - Default path: use `huaweicloud_plan_cli_command` to produce a reviewed command block, then let the user or host agent execute it after approval.
38
+ - Approved tool path: use `huaweicloud_run_approved_command` only when the exact planned command has been shown and the user explicitly approved that exact command.
39
+ - After a write, verify with `huaweicloud_run_readonly_command` or another read-only check.
40
+
41
+ ## Proactive Hook Checks
42
+
43
+ Before executing, deploying, or handing generated cloud artifacts to the user, run the matching check when available:
44
+
45
+ - `huaweicloud_hook_check_command` for shell or KooCLI command text.
46
+ - `huaweicloud_hook_check_artifacts` for generated policy, IaC, config, workflow, or deployment files.
47
+ - `huaweicloud_hook_check_deploy_plan` for sandbox, preview, FunctionGraph, ECS, CCE, APIG, OBS, IAM, or cost-affecting plans.
48
+
49
+ If the result is `deny`, repair the command, artifact, or deployment plan before execution. If the result is `warn`, show the warning to the user and repair or ask for explicit confirmation.
50
+
51
+ ## Static Analysis Boundary
52
+
53
+ Hook checks inspect the command or plan text that is available before execution. If a command builds cloud parameters through shell variables, string concatenation, subshells, encoded payloads, or generated scripts, first expand the final command into reviewable text and run `huaweicloud_hook_check_command` on that final form. When the final values cannot be determined, stop and ask the user to review the expanded command or use `huaweicloud_plan_cli_command` before execution.
54
+
55
+ ## Safe Alternatives
56
+
57
+ - Use redacted profile inspection instead of raw `hcloud configure show`.
58
+ - Use runtime secret injection instead of fetching secret values into chat.
59
+ - Use read-only verification after a write.
60
+ - Prefer reviewed IaC for durable infrastructure changes.
@@ -1,4 +1,4 @@
1
- interface:
2
- display_name: "Huawei Cloud Safety"
3
- short_description: "Keep Huawei Cloud agent operations safe and redacted."
4
- default_prompt: "Use $huaweicloud-safety to review this Huawei Cloud operation."
1
+ interface:
2
+ display_name: "Huawei Cloud Safety"
3
+ short_description: "Keep Huawei Cloud agent operations safe and redacted."
4
+ default_prompt: "Use $huaweicloud-safety to review this Huawei Cloud operation."
@@ -1,83 +1,83 @@
1
- ---
2
- name: huaweicloud-troubleshooting
3
- description: Troubleshoot Huawei Cloud CLI, API, SDK, deployment, permission, region, quota, endpoint, and resource errors. Use when commands fail, APIs return errors, resources are missing, or the user needs a structured diagnosis.
4
- ---
5
-
6
- # Huawei Cloud Troubleshooting
7
-
8
- **STOP - Do not answer from general knowledge.** Follow the procedure below.
9
-
10
- Use evidence before fixes. Do not guess service behavior when request IDs, region, project_id, and exact errors can identify the issue.
11
-
12
- ## Critical Warnings
13
-
14
- | Trap | Why |
15
- |------|-----|
16
- | Error in response body, not HTTP status | Many APIs return HTTP 200 with error in JSON body. Always check `error_code` and `error_msg` |
17
- | Missing `project_id` is common | New users often omit project_id from API path or CLI. Get it from `IAM KeystoneListProjects` |
18
- | Sandbox may block hcloud | OpenCode/Codex sandbox can block hcloud metadata files in `~/.hcloud/`. Use `dangerouslyDisableSandbox` or Bash tool |
19
- | KooCLI param prefix varies | VPC params need `--vpc.x`, ECS params need `--server.x`, ALWAYS check `--help` first |
20
-
21
- ## Workflow
22
-
23
- 1. Capture the redacted error message, service, operation, region, project_id, and request_id.
24
- 2. Classify likely cause:
25
- - auth or permission
26
- - wrong region or endpoint
27
- - wrong project_id
28
- - missing resource
29
- - quota or account limit
30
- - invalid request body
31
- - service-side failure
32
- 3. Run the smallest read-only check that can prove or disprove the cause.
33
- 4. Compare with official API/SDK docs or Huawei Cloud Skills if the operation contract is uncertain.
34
- 5. Propose one fix at a time.
35
- 6. Verify with read-only observation after the fix.
36
-
37
- ## Common Checks
38
-
39
- | Check | Command |
40
- |-------|---------|
41
- | Authentication | `hcloud configure list` (redacted) |
42
- | Region | Match CLI region, endpoint, and resource region |
43
- | Project ID | `hcloud IAM KeystoneListProjects` |
44
- | Pagination | Add `--limit=100` and check `marker` |
45
- | Quota | Check service quotas in console or API |
46
- | IAM Permission | Verify user/role has required action — see `huawei-iam` skill |
47
- | KooCLI version | `hcloud version` |
48
-
49
- ## Common Error Codes
50
-
51
- | Error | Likely Cause | Fix |
52
- |-------|-------------|-----|
53
- | AuthFailure / 401 | AK/SK invalid or expired | Regenerate AK/SK, re-run `npx huaweicloud-devkit auth init` |
54
- | AccessDenied / 403 | IAM permission missing | Check `huawei-iam` skill, add required policy action |
55
- | NoSuchKey / 404 | Resource not found | Verify resource ID, region, and project_id |
56
- | QuotaExceeded | Account limit reached | Request quota increase in console |
57
- | [USE_ERROR] 不正确的参数 | Wrong param name | Run `--help`, check `--param=value` format and nested prefix |
58
- | Ecs.0005 | Flavor-image mismatch | Check image `__support_*` against flavor virtualization type |
59
- | FSS.0400 | FunctionGraph latest version error | Strip `:latest` from function URN |
60
- | FSS.1417 | DEDICATEDGATEWAY missing params | Add instance_id, group_id, protocol, env_name, env_id |
61
- | APIC.7201 | Missing security_group_id | Add `--security_group_id` param for APIG CreateInstanceV2 |
62
- | [NETWORK_ERROR] | Transient network failure | Retry with `maxRetries` param or wait and retry |
63
-
64
- ## KooCLI Error Types
65
-
66
- KooCLI classifies errors into 5 types. The error type prefix in the message guides initial diagnosis:
67
-
68
- | Type | Meaning | First Check |
69
- |------|---------|-------------|
70
- | `[NETWORK_ERROR]` | HTTP request exception | Network connectivity, firewall, endpoint reachability |
71
- | `[CLI_ERROR]` | KooCLI internal error | Contact KooCLI support |
72
- | `[USE_ERROR]` | Incorrect command parameters | Run `--help`, check param names and format |
73
- | `[OPENAPI_ERROR]` | Cloud service API error | Check service docs, contact service support |
74
- | `[APIE_ERROR]` | API Explorer metadata error | Contact API Explorer support |
75
-
76
- Enable debug with `--cli-debug=true` to see the underlying HTTP request/response and pinpoint network or endpoint issues.
77
-
78
- ## Cross-Skill References
79
-
80
- - **IAM permissions**: See `huawei-iam`
81
- - **CLI auth setup**: See `huaweicloud-cli-and-auth`
82
- - **ECS specific errors**: See `huawei-ecs`
83
- - **FunctionGraph specific**: See `huawei-functiongraph`
1
+ ---
2
+ name: huaweicloud-troubleshooting
3
+ description: Troubleshoot Huawei Cloud CLI, API, SDK, deployment, permission, region, quota, endpoint, and resource errors. Use when commands fail, APIs return errors, resources are missing, or the user needs a structured diagnosis.
4
+ ---
5
+
6
+ # Huawei Cloud Troubleshooting
7
+
8
+ **STOP - Do not answer from general knowledge.** Follow the procedure below.
9
+
10
+ Use evidence before fixes. Do not guess service behavior when request IDs, region, project_id, and exact errors can identify the issue.
11
+
12
+ ## Critical Warnings
13
+
14
+ | Trap | Why |
15
+ |------|-----|
16
+ | Error in response body, not HTTP status | Many APIs return HTTP 200 with error in JSON body. Always check `error_code` and `error_msg` |
17
+ | Missing `project_id` is common | New users often omit project_id from API path or CLI. Get it from `IAM KeystoneListProjects` |
18
+ | Sandbox may block hcloud | OpenCode/Codex sandbox can block hcloud metadata files in `~/.hcloud/`. Use `dangerouslyDisableSandbox` or Bash tool |
19
+ | KooCLI param prefix varies | VPC params need `--vpc.x`, ECS params need `--server.x`, ALWAYS check `--help` first |
20
+
21
+ ## Workflow
22
+
23
+ 1. Capture the redacted error message, service, operation, region, project_id, and request_id.
24
+ 2. Classify likely cause:
25
+ - auth or permission
26
+ - wrong region or endpoint
27
+ - wrong project_id
28
+ - missing resource
29
+ - quota or account limit
30
+ - invalid request body
31
+ - service-side failure
32
+ 3. Run the smallest read-only check that can prove or disprove the cause.
33
+ 4. Compare with official API/SDK docs or Huawei Cloud Skills if the operation contract is uncertain.
34
+ 5. Propose one fix at a time.
35
+ 6. Verify with read-only observation after the fix.
36
+
37
+ ## Common Checks
38
+
39
+ | Check | Command |
40
+ |-------|---------|
41
+ | Authentication | `hcloud configure list` (redacted) |
42
+ | Region | Match CLI region, endpoint, and resource region |
43
+ | Project ID | `hcloud IAM KeystoneListProjects` |
44
+ | Pagination | Add `--limit=100` and check `marker` |
45
+ | Quota | Check service quotas in console or API |
46
+ | IAM Permission | Verify user/role has required action — see `huawei-iam` skill |
47
+ | KooCLI version | `hcloud version` |
48
+
49
+ ## Common Error Codes
50
+
51
+ | Error | Likely Cause | Fix |
52
+ |-------|-------------|-----|
53
+ | AuthFailure / 401 | AK/SK invalid or expired | Regenerate AK/SK, re-run `npx huaweicloud-devkit auth init` |
54
+ | AccessDenied / 403 | IAM permission missing | Check `huawei-iam` skill, add required policy action |
55
+ | NoSuchKey / 404 | Resource not found | Verify resource ID, region, and project_id |
56
+ | QuotaExceeded | Account limit reached | Request quota increase in console |
57
+ | [USE_ERROR] 不正确的参数 | Wrong param name | Run `--help`, check `--param=value` format and nested prefix |
58
+ | Ecs.0005 | Flavor-image mismatch | Check image `__support_*` against flavor virtualization type |
59
+ | FSS.0400 | FunctionGraph latest version error | Strip `:latest` from function URN |
60
+ | FSS.1417 | DEDICATEDGATEWAY missing params | Add instance_id, group_id, protocol, env_name, env_id |
61
+ | APIC.7201 | Missing security_group_id | Add `--security_group_id` param for APIG CreateInstanceV2 |
62
+ | [NETWORK_ERROR] | Transient network failure | Retry with `maxRetries` param or wait and retry |
63
+
64
+ ## KooCLI Error Types
65
+
66
+ KooCLI classifies errors into 5 types. The error type prefix in the message guides initial diagnosis:
67
+
68
+ | Type | Meaning | First Check |
69
+ |------|---------|-------------|
70
+ | `[NETWORK_ERROR]` | HTTP request exception | Network connectivity, firewall, endpoint reachability |
71
+ | `[CLI_ERROR]` | KooCLI internal error | Contact KooCLI support |
72
+ | `[USE_ERROR]` | Incorrect command parameters | Run `--help`, check param names and format |
73
+ | `[OPENAPI_ERROR]` | Cloud service API error | Check service docs, contact service support |
74
+ | `[APIE_ERROR]` | API Explorer metadata error | Contact API Explorer support |
75
+
76
+ Enable debug with `--cli-debug=true` to see the underlying HTTP request/response and pinpoint network or endpoint issues.
77
+
78
+ ## Cross-Skill References
79
+
80
+ - **IAM permissions**: See `huawei-iam`
81
+ - **CLI auth setup**: See `huaweicloud-cli-and-auth`
82
+ - **ECS specific errors**: See `huawei-ecs`
83
+ - **FunctionGraph specific**: See `huawei-functiongraph`
@@ -1,4 +1,4 @@
1
- interface:
2
- display_name: "Huawei Cloud Troubleshooting"
3
- short_description: "Diagnose Huawei Cloud errors using evidence and read-only checks."
4
- default_prompt: "Use $huaweicloud-troubleshooting to diagnose this Huawei Cloud error."
1
+ interface:
2
+ display_name: "Huawei Cloud Troubleshooting"
3
+ short_description: "Diagnose Huawei Cloud errors using evidence and read-only checks."
4
+ default_prompt: "Use $huaweicloud-troubleshooting to diagnose this Huawei Cloud error."
@@ -1,87 +1,105 @@
1
- import { existsSync, readFileSync } from 'node:fs';
2
- import { join } from 'node:path';
3
- import { homedir } from 'node:os';
4
- import { spawnSync } from 'node:child_process';
5
-
6
- export const SUPPORTED_AGENT_TARGETS = ['opencode', 'codex', 'codex-desktop', 'codearts', 'workbuddy'];
7
-
8
- function baseHome() {
9
- return process.env.HUAWEICLOUD_HOME || homedir();
10
- }
11
-
12
- function opencodeConfigFile() {
13
- const jsonc = join(baseHome(), '.config', 'opencode', 'opencode.jsonc');
14
- if (existsSync(jsonc)) return jsonc;
15
- return join(baseHome(), '.config', 'opencode', 'opencode.json');
16
- }
17
-
18
- function readJsonSafe(path) {
19
- if (!existsSync(path)) return null;
20
- try {
21
- return JSON.parse(readFileSync(path, 'utf8'));
22
- } catch {
23
- return null;
24
- }
25
- }
26
-
27
- function opencodeRegistered() {
28
- const path = opencodeConfigFile();
29
- const cfg = readJsonSafe(path);
30
- return Boolean(cfg?.mcp?.['huaweicloud-devkit']);
31
- }
32
-
33
- function codexDesktopRegistered() {
34
- const path = join(baseHome(), '.codex', 'config.toml');
35
- if (!existsSync(path)) return false;
36
- try {
37
- return readFileSync(path, 'utf8').includes('[mcp_servers.huaweicloud-devkit]');
38
- } catch {
39
- return false;
40
- }
41
- }
42
-
43
- function codexCliRegistered() {
44
- try {
45
- const r = spawnSync('codex', ['plugin', 'list'], {
46
- shell: false,
47
- windowsHide: true,
48
- stdio: 'pipe',
49
- timeout: 10000,
50
- });
51
- const out = `${r.stdout || ''}${r.stderr || ''}`;
52
- return out.includes('huaweicloud-core');
53
- } catch {
54
- return false;
55
- }
56
- }
57
-
58
- function codeartsRegistered() {
59
- const paths = [
60
- join(baseHome(), '.codeartsdoer', 'mcp', 'mcp_settings.json'),
61
- join(process.cwd(), '.codeartsdoer', 'mcp', 'mcp_settings.json'),
62
- ];
63
- return paths.some((path) => {
64
- const cfg = readJsonSafe(path);
65
- return Boolean(cfg?.mcpServers?.['huaweicloud-devkit']);
66
- });
67
- }
68
-
69
- function workbuddyRegistered() {
70
- const cfg = readJsonSafe(join(baseHome(), '.workbuddy', 'mcp.json'));
71
- return Boolean(cfg?.mcpServers?.['huaweicloud-devkit']);
72
- }
73
-
74
- export function getAgentRegistrationStatuses(target = 'all') {
75
- const requested = target === 'all' ? SUPPORTED_AGENT_TARGETS : [target];
76
- const result = { target, agents: {} };
77
- for (const agent of requested) {
78
- let configured = false;
79
- if (agent === 'opencode') configured = opencodeRegistered();
80
- if (agent === 'codex-desktop') configured = codexDesktopRegistered();
81
- if (agent === 'codex') configured = codexCliRegistered();
82
- if (agent === 'codearts') configured = codeartsRegistered();
83
- if (agent === 'workbuddy') configured = workbuddyRegistered();
84
- result.agents[agent] = { configured };
85
- }
86
- return result;
87
- }
1
+ import { existsSync, readFileSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ import { homedir } from 'node:os';
4
+ import { spawnSync } from 'node:child_process';
5
+
6
+ export const SUPPORTED_AGENT_TARGETS = ['opencode', 'codex', 'codex-desktop', 'codearts', 'workbuddy', 'dsh'];
7
+
8
+ function baseHome() {
9
+ return process.env.HUAWEICLOUD_HOME || homedir();
10
+ }
11
+
12
+ function opencodeConfigFile() {
13
+ const jsonc = join(baseHome(), '.config', 'opencode', 'opencode.jsonc');
14
+ if (existsSync(jsonc)) return jsonc;
15
+ return join(baseHome(), '.config', 'opencode', 'opencode.json');
16
+ }
17
+
18
+ function readJsonSafe(path) {
19
+ if (!existsSync(path)) return null;
20
+ try {
21
+ return JSON.parse(readFileSync(path, 'utf8'));
22
+ } catch {
23
+ return null;
24
+ }
25
+ }
26
+
27
+ function opencodeRegistered() {
28
+ const path = opencodeConfigFile();
29
+ const cfg = readJsonSafe(path);
30
+ return Boolean(cfg?.mcp?.['huaweicloud-devkit']);
31
+ }
32
+
33
+ function codexDesktopRegistered() {
34
+ const path = join(baseHome(), '.codex', 'config.toml');
35
+ if (!existsSync(path)) return false;
36
+ try {
37
+ return readFileSync(path, 'utf8').includes('[mcp_servers.huaweicloud-devkit]');
38
+ } catch {
39
+ return false;
40
+ }
41
+ }
42
+
43
+ function codexCliRegistered() {
44
+ try {
45
+ const r = spawnSync('codex', ['plugin', 'list'], {
46
+ shell: false,
47
+ windowsHide: true,
48
+ stdio: 'pipe',
49
+ timeout: 10000,
50
+ });
51
+ const out = `${r.stdout || ''}${r.stderr || ''}`;
52
+ return out.includes('huaweicloud-core');
53
+ } catch {
54
+ return false;
55
+ }
56
+ }
57
+
58
+ function codeartsRegistered() {
59
+ const paths = [
60
+ join(baseHome(), '.codeartsdoer', 'mcp', 'mcp_settings.json'),
61
+ join(process.cwd(), '.codeartsdoer', 'mcp', 'mcp_settings.json'),
62
+ ];
63
+ return paths.some((path) => {
64
+ const cfg = readJsonSafe(path);
65
+ return Boolean(cfg?.mcpServers?.['huaweicloud-devkit']);
66
+ });
67
+ }
68
+
69
+ function workbuddyRegistered() {
70
+ const cfg = readJsonSafe(join(baseHome(), '.workbuddy', 'mcp.json'));
71
+ return Boolean(cfg?.mcpServers?.['huaweicloud-devkit']);
72
+ }
73
+
74
+ function dshRoot() {
75
+ return process.env.DSH_HOME || join(baseHome(), '.dsh');
76
+ }
77
+
78
+ function dshRegistered() {
79
+ const patchPath = join(dshRoot(), 'profiles', 'web', 'cordis.patch.yml');
80
+ if (!existsSync(patchPath)) return false;
81
+ try {
82
+ const patch = readFileSync(patchPath, 'utf8');
83
+ return patch.includes('id: mcp-huaweicloud')
84
+ && patch.includes("@deepseek-ai/dsh-mcp-client")
85
+ && patch.includes('serverName: huaweicloud');
86
+ } catch {
87
+ return false;
88
+ }
89
+ }
90
+
91
+ export function getAgentRegistrationStatuses(target = 'all') {
92
+ const requested = target === 'all' ? SUPPORTED_AGENT_TARGETS : [target];
93
+ const result = { target, agents: {} };
94
+ for (const agent of requested) {
95
+ let configured = false;
96
+ if (agent === 'opencode') configured = opencodeRegistered();
97
+ if (agent === 'codex-desktop') configured = codexDesktopRegistered();
98
+ if (agent === 'codex') configured = codexCliRegistered();
99
+ if (agent === 'codearts') configured = codeartsRegistered();
100
+ if (agent === 'workbuddy') configured = workbuddyRegistered();
101
+ if (agent === 'dsh') configured = dshRegistered();
102
+ result.agents[agent] = { configured };
103
+ }
104
+ return result;
105
+ }