huaweicloud-devkit 0.1.21-dev.0 → 0.1.21

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 (66) hide show
  1. package/.agents/plugins/marketplace.json +20 -20
  2. package/LICENSE +201 -201
  3. package/README.md +169 -148
  4. package/bin/setup.cjs +7 -7
  5. package/integrations/opencode/commands/huaweicloud-doctor.md +14 -14
  6. package/integrations/opencode/opencode.json +14 -14
  7. package/integrations/opencode/skills/huaweicloud-core/SKILL.md +30 -30
  8. package/package.json +43 -43
  9. package/plugins/huaweicloud-core/.claude-plugin/plugin.json +1 -1
  10. package/plugins/huaweicloud-core/.codex-plugin/plugin.json +1 -1
  11. package/plugins/huaweicloud-core/.cursor-plugin/plugin.json +1 -1
  12. package/plugins/huaweicloud-core/.mcp.json +13 -13
  13. package/plugins/huaweicloud-core/hooks/hooks.json +26 -26
  14. package/plugins/huaweicloud-core/hooks/huaweicloud-safety.py +88 -88
  15. package/plugins/huaweicloud-core/safety/policy.json +85 -85
  16. package/plugins/huaweicloud-core/skills/huawei-apig/SKILL.md +144 -144
  17. package/plugins/huaweicloud-core/skills/huawei-billing/SKILL.md +48 -48
  18. package/plugins/huaweicloud-core/skills/huawei-cbr/SKILL.md +50 -50
  19. package/plugins/huaweicloud-core/skills/huawei-cce/SKILL.md +101 -101
  20. package/plugins/huaweicloud-core/skills/huawei-cloud-eye/SKILL.md +73 -73
  21. package/plugins/huaweicloud-core/skills/huawei-cts/SKILL.md +55 -55
  22. package/plugins/huaweicloud-core/skills/huawei-dds-dcs/SKILL.md +70 -70
  23. package/plugins/huaweicloud-core/skills/huawei-dew/SKILL.md +97 -97
  24. package/plugins/huaweicloud-core/skills/huawei-dew/references/csms-usage.md +29 -29
  25. package/plugins/huaweicloud-core/skills/huawei-dew/references/kms-usage.md +23 -23
  26. package/plugins/huaweicloud-core/skills/huawei-ecs/SKILL.md +131 -131
  27. package/plugins/huaweicloud-core/skills/huawei-ecs/references/create-instance.md +96 -96
  28. package/plugins/huaweicloud-core/skills/huawei-ecs/references/evs.md +31 -31
  29. package/plugins/huaweicloud-core/skills/huawei-ecs/references/flavors.md +28 -28
  30. package/plugins/huaweicloud-core/skills/huawei-ecs/references/troubleshooting.md +52 -52
  31. package/plugins/huaweicloud-core/skills/huawei-functiongraph/SKILL.md +132 -132
  32. package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/apig-event-format.md +58 -58
  33. package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/create-function.md +71 -71
  34. package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/deploy-workflow.md +119 -119
  35. package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/triggers.md +142 -142
  36. package/plugins/huaweicloud-core/skills/huawei-gaussdb/SKILL.md +56 -56
  37. package/plugins/huaweicloud-core/skills/huawei-getting-started/SKILL.md +65 -65
  38. package/plugins/huaweicloud-core/skills/huawei-iam/SKILL.md +111 -111
  39. package/plugins/huaweicloud-core/skills/huawei-modelarts/SKILL.md +65 -65
  40. package/plugins/huaweicloud-core/skills/huawei-obs/SKILL.md +118 -118
  41. package/plugins/huaweicloud-core/skills/huawei-obs/references/bucket-lifecycle.md +26 -26
  42. package/plugins/huaweicloud-core/skills/huawei-obs/references/static-website.md +56 -56
  43. package/plugins/huaweicloud-core/skills/huawei-rds/SKILL.md +181 -181
  44. package/plugins/huaweicloud-core/skills/huawei-smn-dms/SKILL.md +69 -69
  45. package/plugins/huaweicloud-core/skills/huawei-vpc/SKILL.md +78 -78
  46. package/plugins/huaweicloud-core/skills/huawei-vpc/references/network.md +76 -76
  47. package/plugins/huaweicloud-core/skills/huawei-vpc/references/security-group.md +59 -59
  48. package/plugins/huaweicloud-core/skills/huawei-waf-aad/SKILL.md +63 -63
  49. package/plugins/huaweicloud-core/skills/huaweicloud-api-and-sdk/agents/openai.yaml +4 -4
  50. package/plugins/huaweicloud-core/skills/huaweicloud-capability-discovery/SKILL.md +47 -47
  51. package/plugins/huaweicloud-core/skills/huaweicloud-capability-discovery/agents/openai.yaml +4 -4
  52. package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/SKILL.md +127 -127
  53. package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/agents/openai.yaml +4 -4
  54. package/plugins/huaweicloud-core/skills/huaweicloud-core/SKILL.md +93 -93
  55. package/plugins/huaweicloud-core/skills/huaweicloud-core/agents/openai.yaml +4 -4
  56. package/plugins/huaweicloud-core/skills/huaweicloud-core/references/report-issue.md +19 -19
  57. package/plugins/huaweicloud-core/skills/huaweicloud-core/references/select.md +27 -27
  58. package/plugins/huaweicloud-core/skills/huaweicloud-safety/SKILL.md +46 -46
  59. package/plugins/huaweicloud-core/skills/huaweicloud-safety/agents/openai.yaml +4 -4
  60. package/plugins/huaweicloud-core/skills/huaweicloud-troubleshooting/SKILL.md +83 -83
  61. package/plugins/huaweicloud-core/skills/huaweicloud-troubleshooting/agents/openai.yaml +4 -4
  62. package/plugins/huaweicloud-core/src/hcloud-cli.mjs +265 -265
  63. package/plugins/huaweicloud-core/src/mcp-server.mjs +93 -93
  64. package/plugins/huaweicloud-core/src/safety-policy.mjs +289 -289
  65. package/plugins/huaweicloud-core/src/setup-cli.mjs +869 -672
  66. package/plugins/huaweicloud-core/src/tools.mjs +677 -672
@@ -1,26 +1,26 @@
1
- {
2
- "hooks": {
3
- "PreToolUse": [
4
- {
5
- "matcher": "Bash",
6
- "hooks": [
7
- {
8
- "type": "command",
9
- "command": "python3 \"${CLAUDE_PLUGIN_ROOT}/hooks/huaweicloud-safety.py\"",
10
- "timeout": 5
11
- }
12
- ]
13
- },
14
- {
15
- "matcher": "mcp__.*huaweicloud.*|huaweicloud_.*",
16
- "hooks": [
17
- {
18
- "type": "command",
19
- "command": "python3 \"${CLAUDE_PLUGIN_ROOT}/hooks/huaweicloud-safety.py\"",
20
- "timeout": 5
21
- }
22
- ]
23
- }
24
- ]
25
- }
26
- }
1
+ {
2
+ "hooks": {
3
+ "PreToolUse": [
4
+ {
5
+ "matcher": "Bash",
6
+ "hooks": [
7
+ {
8
+ "type": "command",
9
+ "command": "python3 \"${CLAUDE_PLUGIN_ROOT}/hooks/huaweicloud-safety.py\"",
10
+ "timeout": 5
11
+ }
12
+ ]
13
+ },
14
+ {
15
+ "matcher": "mcp__.*huaweicloud.*|huaweicloud_.*",
16
+ "hooks": [
17
+ {
18
+ "type": "command",
19
+ "command": "python3 \"${CLAUDE_PLUGIN_ROOT}/hooks/huaweicloud-safety.py\"",
20
+ "timeout": 5
21
+ }
22
+ ]
23
+ }
24
+ ]
25
+ }
26
+ }
@@ -1,88 +1,88 @@
1
- #!/usr/bin/env python3
2
- """PreToolUse hook for Huawei Cloud agent safety.
3
-
4
- Blocks the highest-risk leakage paths before an agent tool runs:
5
- - reading local Huawei Cloud credential files
6
- - dumping cloud credential environment variables
7
- - directly retrieving cloud secret values
8
- - running unapproved write operations through hcloud
9
-
10
- The MCP server carries the same policy in Node for platforms that do not support
11
- plugin hooks.
12
- """
13
-
14
- import json
15
- import re
16
- import sys
17
-
18
- DENY_PREFIX = "Huawei Cloud safety hook blocked this action: "
19
-
20
- CONFIG_FILE_RE = re.compile(r"(\.hcloud|\.huaweicloud|hcloud[/\\](config|credentials)|huaweicloud[/\\](config|credentials))", re.I)
21
- ENV_DUMP_RE = re.compile(r"(env|printenv|Get-ChildItem\s+Env:|gci\s+Env:|dir\s+Env:).*(HUAWEICLOUD|HWC_|HCLOUD|OS_)", re.I)
22
- SECRET_READ_RE = re.compile(r"(ShowSecretVersion|GetSecretValue|secret_string|secret_binary)", re.I)
23
- HCLOUD_RE = re.compile(r"(^|\s)hcloud(\.exe)?\s+", re.I)
24
- WRITE_OPERATION_RE = re.compile(
25
- r"\b(BatchCreate|BatchDelete|Create|Delete|Update|Modify|Resize|Reboot|Stop|Start|Restart|Authorize|Revoke|Add|Remove|Associate|Disassociate|Attach|Detach|Enable|Disable)\w*",
26
- re.I,
27
- )
28
- READ_OPERATION_RE = re.compile(r"\b(List|Show|Get|Describe|NovaList|NovaShow)\w*", re.I)
29
-
30
-
31
- def deny(reason):
32
- json.dump(
33
- {
34
- "hookSpecificOutput": {
35
- "hookEventName": "PreToolUse",
36
- "permissionDecision": "deny",
37
- "permissionDecisionReason": DENY_PREFIX + reason,
38
- }
39
- },
40
- sys.stdout,
41
- )
42
- sys.exit(0)
43
-
44
-
45
- def allow():
46
- sys.exit(0)
47
-
48
-
49
- def command_text(tool_input):
50
- if isinstance(tool_input, str):
51
- return tool_input
52
- if isinstance(tool_input, dict):
53
- values = []
54
- for key in ("command", "cmd", "script", "args", "arguments"):
55
- value = tool_input.get(key)
56
- if isinstance(value, list):
57
- values.append(" ".join(str(item) for item in value))
58
- elif value is not None:
59
- values.append(str(value))
60
- if values:
61
- return "\n".join(values)
62
- return json.dumps(tool_input)
63
- return json.dumps(tool_input)
64
-
65
-
66
- def main():
67
- try:
68
- data = json.load(sys.stdin)
69
- except Exception:
70
- allow()
71
-
72
- tool_name = data.get("tool_name", "")
73
- text = command_text(data.get("tool_input", {}))
74
-
75
- if CONFIG_FILE_RE.search(text):
76
- deny("reading Huawei Cloud credential/profile files can expose AK/SK or tokens. Use redacted toolkit tools.")
77
- if ENV_DUMP_RE.search(text):
78
- deny("dumping cloud credential environment variables is not allowed.")
79
- if SECRET_READ_RE.search(text):
80
- deny("direct secret value retrieval would put plaintext secrets into the agent context.")
81
- if tool_name == "Bash" and HCLOUD_RE.search(text) and WRITE_OPERATION_RE.search(text) and not READ_OPERATION_RE.search(text):
82
- deny("unapproved Huawei Cloud write operations must be planned first and explicitly approved by the user.")
83
-
84
- allow()
85
-
86
-
87
- if __name__ == "__main__":
88
- main()
1
+ #!/usr/bin/env python3
2
+ """PreToolUse hook for Huawei Cloud agent safety.
3
+
4
+ Blocks the highest-risk leakage paths before an agent tool runs:
5
+ - reading local Huawei Cloud credential files
6
+ - dumping cloud credential environment variables
7
+ - directly retrieving cloud secret values
8
+ - running unapproved write operations through hcloud
9
+
10
+ The MCP server carries the same policy in Node for platforms that do not support
11
+ plugin hooks.
12
+ """
13
+
14
+ import json
15
+ import re
16
+ import sys
17
+
18
+ DENY_PREFIX = "Huawei Cloud safety hook blocked this action: "
19
+
20
+ CONFIG_FILE_RE = re.compile(r"(\.hcloud|\.huaweicloud|hcloud[/\\](config|credentials)|huaweicloud[/\\](config|credentials))", re.I)
21
+ ENV_DUMP_RE = re.compile(r"(env|printenv|Get-ChildItem\s+Env:|gci\s+Env:|dir\s+Env:).*(HUAWEICLOUD|HWC_|HCLOUD|OS_)", re.I)
22
+ SECRET_READ_RE = re.compile(r"(ShowSecretVersion|GetSecretValue|secret_string|secret_binary)", re.I)
23
+ HCLOUD_RE = re.compile(r"(^|\s)hcloud(\.exe)?\s+", re.I)
24
+ WRITE_OPERATION_RE = re.compile(
25
+ r"\b(BatchCreate|BatchDelete|Create|Delete|Update|Modify|Resize|Reboot|Stop|Start|Restart|Authorize|Revoke|Add|Remove|Associate|Disassociate|Attach|Detach|Enable|Disable)\w*",
26
+ re.I,
27
+ )
28
+ READ_OPERATION_RE = re.compile(r"\b(List|Show|Get|Describe|NovaList|NovaShow)\w*", re.I)
29
+
30
+
31
+ def deny(reason):
32
+ json.dump(
33
+ {
34
+ "hookSpecificOutput": {
35
+ "hookEventName": "PreToolUse",
36
+ "permissionDecision": "deny",
37
+ "permissionDecisionReason": DENY_PREFIX + reason,
38
+ }
39
+ },
40
+ sys.stdout,
41
+ )
42
+ sys.exit(0)
43
+
44
+
45
+ def allow():
46
+ sys.exit(0)
47
+
48
+
49
+ def command_text(tool_input):
50
+ if isinstance(tool_input, str):
51
+ return tool_input
52
+ if isinstance(tool_input, dict):
53
+ values = []
54
+ for key in ("command", "cmd", "script", "args", "arguments"):
55
+ value = tool_input.get(key)
56
+ if isinstance(value, list):
57
+ values.append(" ".join(str(item) for item in value))
58
+ elif value is not None:
59
+ values.append(str(value))
60
+ if values:
61
+ return "\n".join(values)
62
+ return json.dumps(tool_input)
63
+ return json.dumps(tool_input)
64
+
65
+
66
+ def main():
67
+ try:
68
+ data = json.load(sys.stdin)
69
+ except Exception:
70
+ allow()
71
+
72
+ tool_name = data.get("tool_name", "")
73
+ text = command_text(data.get("tool_input", {}))
74
+
75
+ if CONFIG_FILE_RE.search(text):
76
+ deny("reading Huawei Cloud credential/profile files can expose AK/SK or tokens. Use redacted toolkit tools.")
77
+ if ENV_DUMP_RE.search(text):
78
+ deny("dumping cloud credential environment variables is not allowed.")
79
+ if SECRET_READ_RE.search(text):
80
+ deny("direct secret value retrieval would put plaintext secrets into the agent context.")
81
+ if tool_name == "Bash" and HCLOUD_RE.search(text) and WRITE_OPERATION_RE.search(text) and not READ_OPERATION_RE.search(text):
82
+ deny("unapproved Huawei Cloud write operations must be planned first and explicitly approved by the user.")
83
+
84
+ allow()
85
+
86
+
87
+ if __name__ == "__main__":
88
+ main()
@@ -1,86 +1,86 @@
1
- {
2
- "version": "0.1.0",
3
- "secretKeyNamePatterns": [
4
- "access[_-]?key",
5
- "secret[_-]?key",
6
- "security[_-]?token",
7
- "x[_-]?auth[_-]?token",
8
- "authorization",
9
- "password",
10
- "passwd",
11
- "token",
12
- "credential",
13
- "private[_-]?key",
14
- "ak",
15
- "sk"
16
- ],
17
- "credentialFilePatterns": [
18
- "\\.hcloud",
19
- "\\.huaweicloud",
20
- "hcloud[/\\\\](config|credentials)",
21
- "huaweicloud[/\\\\](config|credentials)"
22
- ],
23
- "blockedConfigureSubcommands": [
24
- "show",
25
- "get",
26
- "list",
27
- "export",
28
- "init"
29
- ],
30
- "blockedSecretOperations": [
31
- "ShowSecretVersion",
32
- "DownloadSecret",
33
- "GetSecretValue"
34
- ],
35
- "writeOperationPrefixes": [
36
- "Create",
37
- "BatchCreate",
38
- "Delete",
39
- "BatchDelete",
40
- "Update",
41
- "Modify",
42
- "Resize",
43
- "Reboot",
44
- "Stop",
45
- "Start",
46
- "Restart",
47
- "Authorize",
48
- "Revoke",
49
- "Add",
50
- "Remove",
51
- "Associate",
52
- "Disassociate",
53
- "Attach",
54
- "Detach",
55
- "Enable",
56
- "Disable",
57
- "Set",
58
- "Put",
59
- "Upload",
60
- "Install",
61
- "Publish",
62
- "Bind",
63
- "Unbind",
64
- "Invoke",
65
- "Execute",
66
- "Trigger",
67
- "Deploy"
68
- ],
69
- "readOperationPrefixes": [
70
- "List",
71
- "Show",
72
- "Get",
73
- "Describe",
74
- "NovaList",
75
- "NovaShow"
76
- ],
77
- "safeTextReadCommands": [
78
- "rg",
79
- "grep",
80
- "findstr",
81
- "git",
82
- "ls",
83
- "dir",
84
- "Get-ChildItem"
85
- ]
1
+ {
2
+ "version": "0.1.0",
3
+ "secretKeyNamePatterns": [
4
+ "access[_-]?key",
5
+ "secret[_-]?key",
6
+ "security[_-]?token",
7
+ "x[_-]?auth[_-]?token",
8
+ "authorization",
9
+ "password",
10
+ "passwd",
11
+ "token",
12
+ "credential",
13
+ "private[_-]?key",
14
+ "ak",
15
+ "sk"
16
+ ],
17
+ "credentialFilePatterns": [
18
+ "\\.hcloud",
19
+ "\\.huaweicloud",
20
+ "hcloud[/\\\\](config|credentials)",
21
+ "huaweicloud[/\\\\](config|credentials)"
22
+ ],
23
+ "blockedConfigureSubcommands": [
24
+ "show",
25
+ "get",
26
+ "list",
27
+ "export",
28
+ "init"
29
+ ],
30
+ "blockedSecretOperations": [
31
+ "ShowSecretVersion",
32
+ "DownloadSecret",
33
+ "GetSecretValue"
34
+ ],
35
+ "writeOperationPrefixes": [
36
+ "Create",
37
+ "BatchCreate",
38
+ "Delete",
39
+ "BatchDelete",
40
+ "Update",
41
+ "Modify",
42
+ "Resize",
43
+ "Reboot",
44
+ "Stop",
45
+ "Start",
46
+ "Restart",
47
+ "Authorize",
48
+ "Revoke",
49
+ "Add",
50
+ "Remove",
51
+ "Associate",
52
+ "Disassociate",
53
+ "Attach",
54
+ "Detach",
55
+ "Enable",
56
+ "Disable",
57
+ "Set",
58
+ "Put",
59
+ "Upload",
60
+ "Install",
61
+ "Publish",
62
+ "Bind",
63
+ "Unbind",
64
+ "Invoke",
65
+ "Execute",
66
+ "Trigger",
67
+ "Deploy"
68
+ ],
69
+ "readOperationPrefixes": [
70
+ "List",
71
+ "Show",
72
+ "Get",
73
+ "Describe",
74
+ "NovaList",
75
+ "NovaShow"
76
+ ],
77
+ "safeTextReadCommands": [
78
+ "rg",
79
+ "grep",
80
+ "findstr",
81
+ "git",
82
+ "ls",
83
+ "dir",
84
+ "Get-ChildItem"
85
+ ]
86
86
  }