huaweicloud-devkit 1.1.2-next.0 → 1.1.2-next.2

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 (125) hide show
  1. package/.agents/plugins/marketplace.json +18 -18
  2. package/README.md +182 -38
  3. package/README.zh-CN.md +180 -36
  4. package/bin/dsh-postinstall.cjs +77 -0
  5. package/bin/setup.cjs +7 -4
  6. package/cordis.patch.yml +13 -0
  7. package/integrations/atomcode/hooks/huaweicloud-telemetry.js +181 -0
  8. package/integrations/atomcode/hooks.json +9 -0
  9. package/integrations/dsh/hook-plugin.mjs +148 -0
  10. package/integrations/hermes/hooks/huaweicloud-telemetry.py +238 -0
  11. package/integrations/hermes/manifest.yaml +43 -0
  12. package/integrations/opencode/hooks/skill-tracker.js +115 -0
  13. package/integrations/opencode/opencode.json +1 -4
  14. package/integrations/workbuddy/hooks/telemetry-tracker.py +226 -0
  15. package/package.json +74 -43
  16. package/plugins/huaweicloud-core/.claude-plugin/plugin.json +4 -17
  17. package/plugins/huaweicloud-core/.codex-plugin/plugin.json +23 -33
  18. package/plugins/huaweicloud-core/.cursor-plugin/plugin.json +4 -17
  19. package/plugins/huaweicloud-core/.hermes-plugin/plugin.json +30 -0
  20. package/plugins/huaweicloud-core/.mcp.json +2 -5
  21. package/plugins/huaweicloud-core/.workbuddy-plugin/plugin.json +4 -18
  22. package/plugins/huaweicloud-core/assets/icon.png +0 -0
  23. package/plugins/huaweicloud-core/assets/logo-dark.png +0 -0
  24. package/plugins/huaweicloud-core/assets/logo.png +0 -0
  25. package/plugins/huaweicloud-core/hooks/huaweicloud-safety.py +104 -28
  26. package/plugins/huaweicloud-core/openclaw.plugin.json +20 -0
  27. package/plugins/huaweicloud-core/safety/policy.json +75 -99
  28. package/plugins/huaweicloud-core/safety/rules/cloud-risk-rules.json +196 -35
  29. package/plugins/huaweicloud-core/skills/huawei-apig/SKILL.md +38 -34
  30. package/plugins/huaweicloud-core/skills/huawei-billing/SKILL.md +21 -20
  31. package/plugins/huaweicloud-core/skills/huawei-cbr/SKILL.md +19 -19
  32. package/plugins/huaweicloud-core/skills/huawei-cce/SKILL.md +38 -32
  33. package/plugins/huaweicloud-core/skills/huawei-cloud-eye/SKILL.md +30 -30
  34. package/plugins/huaweicloud-core/skills/huawei-cts/SKILL.md +20 -20
  35. package/plugins/huaweicloud-core/skills/huawei-dds-dcs/SKILL.md +31 -31
  36. package/plugins/huaweicloud-core/skills/huawei-deployment/SKILL.md +21 -20
  37. package/plugins/huaweicloud-core/skills/huawei-dew/SKILL.md +40 -31
  38. package/plugins/huaweicloud-core/skills/huawei-dew/references/csms-usage.md +8 -1
  39. package/plugins/huaweicloud-core/skills/huawei-dew/references/kms-usage.md +6 -0
  40. package/plugins/huaweicloud-core/skills/huawei-ecs/SKILL.md +45 -37
  41. package/plugins/huaweicloud-core/skills/huawei-ecs/references/create-instance.md +57 -6
  42. package/plugins/huaweicloud-core/skills/huawei-ecs/references/flavors.md +11 -9
  43. package/plugins/huaweicloud-core/skills/huawei-ecs/references/hc-activity.md +27 -0
  44. package/plugins/huaweicloud-core/skills/huawei-ecs/references/troubleshooting.md +13 -13
  45. package/plugins/huaweicloud-core/skills/huawei-functiongraph/SKILL.md +44 -39
  46. package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/apig-event-format.md +12 -10
  47. package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/create-function.md +21 -20
  48. package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/triggers.md +19 -19
  49. package/plugins/huaweicloud-core/skills/huawei-gaussdb/SKILL.md +20 -20
  50. package/plugins/huaweicloud-core/skills/huawei-getting-started/SKILL.md +27 -23
  51. package/plugins/huaweicloud-core/skills/huawei-iac/SKILL.md +93 -0
  52. package/plugins/huaweicloud-core/skills/huawei-iac/references/architectures.md +83 -0
  53. package/plugins/huaweicloud-core/skills/huawei-iac/references/resource-catalog.md +107 -0
  54. package/plugins/huaweicloud-core/skills/huawei-iac/references/state-file.md +104 -0
  55. package/plugins/huaweicloud-core/skills/huawei-iam/SKILL.md +30 -30
  56. package/plugins/huaweicloud-core/skills/huawei-iam/references/policy-examples.md +65 -39
  57. package/plugins/huaweicloud-core/skills/huawei-iam/references/quick-ref.md +9 -9
  58. package/plugins/huaweicloud-core/skills/huawei-modelarts/SKILL.md +33 -25
  59. package/plugins/huaweicloud-core/skills/huawei-obs/SKILL.md +46 -45
  60. package/plugins/huaweicloud-core/skills/huawei-obs/references/bucket-create.md +19 -19
  61. package/plugins/huaweicloud-core/skills/huawei-obs/references/bucket-lifecycle.md +12 -7
  62. package/plugins/huaweicloud-core/skills/huawei-obs/references/common-pitfalls.md +13 -12
  63. package/plugins/huaweicloud-core/skills/huawei-obs/references/single-file-share.md +4 -4
  64. package/plugins/huaweicloud-core/skills/huawei-rds/SKILL.md +71 -61
  65. package/plugins/huaweicloud-core/skills/huawei-sandbox/SKILL.md +776 -44
  66. package/plugins/huaweicloud-core/skills/huawei-sandbox/references/framework-commands.md +84 -0
  67. package/plugins/huaweicloud-core/skills/huawei-sandbox/references/nginx-templates.md +100 -0
  68. package/plugins/huaweicloud-core/skills/huawei-smn-dms/SKILL.md +36 -29
  69. package/plugins/huaweicloud-core/skills/huawei-voucher/SKILL.md +57 -0
  70. package/plugins/huaweicloud-core/skills/huawei-vpc/SKILL.md +39 -39
  71. package/plugins/huaweicloud-core/skills/huawei-vpc/references/network.md +22 -15
  72. package/plugins/huaweicloud-core/skills/huawei-vpc/references/security-group.md +20 -19
  73. package/plugins/huaweicloud-core/skills/huawei-vpc/references/subnet.md +15 -15
  74. package/plugins/huaweicloud-core/skills/huawei-waf-aad/SKILL.md +23 -20
  75. package/plugins/huaweicloud-core/skills/huaweicloud-api-and-sdk/SKILL.md +13 -13
  76. package/plugins/huaweicloud-core/skills/huaweicloud-api-and-sdk/agents/openai.yaml +3 -3
  77. package/plugins/huaweicloud-core/skills/huaweicloud-capability-discovery/SKILL.md +21 -2
  78. package/plugins/huaweicloud-core/skills/huaweicloud-capability-discovery/agents/openai.yaml +3 -3
  79. package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/SKILL.md +30 -4
  80. package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/agents/openai.yaml +3 -3
  81. package/plugins/huaweicloud-core/skills/huaweicloud-core/SKILL.md +68 -54
  82. package/plugins/huaweicloud-core/skills/huaweicloud-core/agents/openai.yaml +3 -3
  83. package/plugins/huaweicloud-core/skills/huaweicloud-core/references/report-issue.md +6 -6
  84. package/plugins/huaweicloud-core/skills/huaweicloud-core/references/select.md +15 -1
  85. package/plugins/huaweicloud-core/skills/huaweicloud-safety/SKILL.md +0 -1
  86. package/plugins/huaweicloud-core/skills/huaweicloud-safety/agents/openai.yaml +3 -3
  87. package/plugins/huaweicloud-core/skills/huaweicloud-troubleshooting/SKILL.md +36 -34
  88. package/plugins/huaweicloud-core/skills/huaweicloud-troubleshooting/agents/openai.yaml +3 -3
  89. package/plugins/huaweicloud-core/src/auth/agent-registration.mjs +142 -5
  90. package/plugins/huaweicloud-core/src/auth/credentials.mjs +217 -5
  91. package/plugins/huaweicloud-core/src/auth/reconcile.mjs +174 -0
  92. package/plugins/huaweicloud-core/src/auth/service.mjs +57 -2
  93. package/plugins/huaweicloud-core/src/data/icons-manifest.v1.json +3517 -0
  94. package/plugins/huaweicloud-core/src/detect-framework.mjs +366 -0
  95. package/plugins/huaweicloud-core/src/hcloud-cli.mjs +203 -16
  96. package/plugins/huaweicloud-core/src/icon-library.mjs +176 -0
  97. package/plugins/huaweicloud-core/src/mcp-protocol.mjs +88 -0
  98. package/plugins/huaweicloud-core/src/mcp-server-remote.mjs +107 -0
  99. package/plugins/huaweicloud-core/src/mcp-server.mjs +154 -99
  100. package/plugins/huaweicloud-core/src/proxy/proxy-agent.mjs +20 -102
  101. package/plugins/huaweicloud-core/src/proxy/proxy-config.mjs +11 -4
  102. package/plugins/huaweicloud-core/src/risk-rule-engine.mjs +4 -1
  103. package/plugins/huaweicloud-core/src/safety-policy.mjs +123 -68
  104. package/plugins/huaweicloud-core/src/sandbox/hdkitservice-api.mjs +48 -12
  105. package/plugins/huaweicloud-core/src/sandbox/hwlink-api.mjs +25 -26
  106. package/plugins/huaweicloud-core/src/sandbox/sandbox-file-server.py +45 -0
  107. package/plugins/huaweicloud-core/src/sandbox/session-manager.mjs +943 -10
  108. package/plugins/huaweicloud-core/src/sandbox/uninstall-cleanup.mjs +50 -0
  109. package/plugins/huaweicloud-core/src/search-market.mjs +49 -14
  110. package/plugins/huaweicloud-core/src/setup-cli.mjs +3091 -498
  111. package/plugins/huaweicloud-core/src/telemetry/agent-detect.mjs +40 -0
  112. package/plugins/huaweicloud-core/src/telemetry/agent-registry.mjs +328 -0
  113. package/plugins/huaweicloud-core/src/telemetry/telemetry.mjs +378 -0
  114. package/plugins/huaweicloud-core/src/tools.mjs +1272 -146
  115. package/plugins/huaweicloud-core/src/update-check.mjs +383 -0
  116. package/plugins/huaweicloud-core/src/ws-exec/hwlink-exec-client.js +72 -38
  117. package/plugins/huaweicloud-core/src/ws-exec/hwlink-fair-queue.js +10 -5
  118. package/plugins/huaweicloud-core/src/ws-exec/hwlink-multiplexer.js +13 -16
  119. package/plugins/huaweicloud-core/src/ws-exec/hwlink-packet.js +12 -16
  120. package/plugins/huaweicloud-core/src/ws-exec/hwlink-terminal-channel.js +46 -31
  121. package/plugins/huaweicloud-core/src/ws-exec/hwlink-tunnel-channel.mjs +268 -0
  122. package/plugins/huaweicloud-core/src/ws-exec/index.js +3 -0
  123. package/plugins/huaweicloud-core/src/ws-exec/ws-exec-client.js +40 -13
  124. package/plugins/huaweicloud-core/skills/huawei-cloud-find-skills/SKILL.md +0 -190
  125. package/plugins/huaweicloud-core/skills/huawei-cloud-find-skills/scripts/search-skills.mjs +0 -124
package/package.json CHANGED
@@ -1,46 +1,77 @@
1
1
  {
2
- "name": "huaweicloud-devkit",
3
- "version": "1.1.2-next.0",
4
- "description": "Agent toolkit that helps coding agents use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities safely and accurately.",
5
- "type": "module",
6
- "files": [
7
- "bin",
8
- ".agents",
9
- "plugins/huaweicloud-core",
10
- "integrations/opencode"
11
- ],
12
- "bin": {
13
- "huaweicloud-devkit": "./bin/setup.cjs"
14
- },
15
- "repository": {
16
- "type": "git",
17
- "url": "https://github.com/huaweicloud/HuaweiCloud-Devkit.git"
18
- },
19
- "scripts": {
20
- "test": "node --test",
21
- "lint:md": "markdownlint-cli2 \"**/*.md\" \"#node_modules\" \"#.git\" \"#test/**\" \"#docs/**\"",
22
- "lint": "npm run lint:md",
23
- "validate": "node ./scripts/validate-package.mjs",
24
- "postinstall": "node -e \"console.log('\\nHuaweiCloud DevKit installed. Run: npx huaweicloud-devkit install\\n')\""
25
- },
26
- "devDependencies": {
27
- "markdownlint-cli2": "^0.23.2"
28
- },
29
- "keywords": [
30
- "huaweicloud",
31
- "huawei-cloud",
32
- "agent",
33
- "codex",
34
- "opencode",
35
- "workbuddy",
36
- "dsh",
37
- "deepseek-harness",
38
- "mcp",
39
- "koocli",
40
- "hcloud"
41
- ],
42
- "license": "Apache-2.0",
43
- "engines": {
44
- "node": ">=20"
2
+ "name": "huaweicloud-devkit",
3
+ "version": "1.1.2-next.2",
4
+ "description": "Agent toolkit that helps coding agents use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities safely and accurately.",
5
+ "type": "module",
6
+ "files": [
7
+ "cordis.patch.yml",
8
+ "bin",
9
+ ".agents",
10
+ "plugins/huaweicloud-core",
11
+ "integrations/hermes",
12
+ "integrations/opencode",
13
+ "integrations/dsh",
14
+ "integrations/workbuddy",
15
+ "integrations/atomcode"
16
+ ],
17
+ "bin": {
18
+ "huaweicloud-devkit": "./bin/setup.cjs",
19
+ "huaweicloud-devkit-mcp": "./plugins/huaweicloud-core/src/mcp-server.mjs"
20
+ },
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "https://github.com/huaweicloud/huaweicloud-devkit.git"
24
+ },
25
+ "dsh": {
26
+ "bundle": {
27
+ "patch": "./cordis.patch.yml"
45
28
  }
29
+ },
30
+ "scripts": {
31
+ "test": "node --test \"test/*.test.mjs\"",
32
+ "format": "prettier --write .",
33
+ "format:check": "prettier --check .",
34
+ "lint:md": "markdownlint-cli2 \"**/*.md\" \"#node_modules\" \"#.git\" \"#test/**\" \"#docs/**\"",
35
+ "lint:js": "eslint .",
36
+ "lint": "npm run lint:md && npm run lint:js",
37
+ "validate": "node ./scripts/validate-package.mjs",
38
+ "pack:verify": "node ./scripts/pack-verify.mjs",
39
+ "postinstall": "node ./bin/dsh-postinstall.cjs"
40
+ },
41
+ "dependencies": {
42
+ "undici": "^8.10.0"
43
+ },
44
+ "devDependencies": {
45
+ "@eslint/js": "^10.0.1",
46
+ "eslint": "^10.8.1",
47
+ "eslint-config-prettier": "^10.1.8",
48
+ "eslint-plugin-import-x": "^4.17.1",
49
+ "eslint-plugin-n": "^18.3.0",
50
+ "eslint-plugin-unicorn": "^73.0.0",
51
+ "globals": "^17.11.0",
52
+ "markdownlint-cli2": "^0.23.2",
53
+ "prettier": "^3.9.6"
54
+ },
55
+ "keywords": [
56
+ "huaweicloud",
57
+ "huawei-cloud",
58
+ "agent",
59
+ "codex",
60
+ "opencode",
61
+ "codearts",
62
+ "codearts-work",
63
+ "officeace",
64
+ "office-claw",
65
+ "workbuddy",
66
+ "atomcode",
67
+ "dsh",
68
+ "deepseek-harness",
69
+ "mcp",
70
+ "koocli",
71
+ "hcloud"
72
+ ],
73
+ "license": "Apache-2.0",
74
+ "engines": {
75
+ "node": ">=22"
76
+ }
46
77
  }
@@ -5,10 +5,7 @@
5
5
  "longDescription": "HuaweiCloud Devkit helps coding agents choose and use Huawei Cloud Skills, KooCLI, APIs, SDKs, and MCP tools with less context, safer command execution, and more accurate cloud implementation decisions.",
6
6
  "developerName": "HuaweiCloud Mate",
7
7
  "category": "Cloud",
8
- "capabilities": [
9
- "Read",
10
- "Interactive"
11
- ],
8
+ "capabilities": ["Read", "Interactive"],
12
9
  "websiteURL": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
13
10
  "brandColor": "#C7000B",
14
11
  "defaultPrompt": [
@@ -20,25 +17,15 @@
20
17
  "mcpServers": "./.mcp.json",
21
18
  "description": "Guide coding agents to use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities with safer execution and less context.",
22
19
  "skills": "./skills/",
23
- "version": "1.1.2-next.0",
20
+ "version": "1.1.2-next.2",
24
21
  "author": {
25
22
  "name": "HuaweiCloud Mate",
26
23
  "url": "https://github.com/huaweicloud"
27
24
  },
28
25
  "hooks": "./hooks/",
29
- "name": "huaweicloud-core",
26
+ "name": "huaweicloud-devkit",
30
27
  "homepage": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
31
28
  "repository": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
32
29
  "license": "Apache-2.0",
33
- "keywords": [
34
- "huaweicloud",
35
- "huawei-cloud",
36
- "koocli",
37
- "hcloud",
38
- "agent",
39
- "mcp",
40
- "api",
41
- "sdk",
42
- "skills"
43
- ]
30
+ "keywords": ["huaweicloud", "huawei-cloud", "koocli", "hcloud", "agent", "mcp", "api", "sdk", "skills"]
44
31
  }
@@ -1,43 +1,33 @@
1
1
  {
2
- "name": "huaweicloud-core",
3
- "version": "1.1.2-next.0",
4
- "description": "Guide coding agents to use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities with safer execution and less context.",
5
- "author": {
6
- "name": "HuaweiCloud Mate",
7
- "url": "https://github.com/huaweicloud"
8
- },
9
- "homepage": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
10
- "repository": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
11
- "license": "Apache-2.0",
12
- "keywords": [
13
- "huaweicloud",
14
- "huawei-cloud",
15
- "koocli",
16
- "hcloud",
17
- "agent",
18
- "mcp",
19
- "api",
20
- "sdk",
21
- "skills"
22
- ],
23
- "skills": "./skills/",
24
- "mcpServers": "./.mcp.json",
25
2
  "interface": {
26
- "displayName": "HuaweiCloud Devkit",
27
3
  "shortDescription": "HuaweiCloud Devkit - Huawei Cloud guidance, CLI/API/SDK routing, MCP tools, and safety for coding agents.",
28
- "longDescription": "HuaweiCloud Devkit helps coding agents choose and use Huawei Cloud Skills, KooCLI, APIs, SDKs, and MCP tools with less context, safer command execution, and more accurate cloud implementation decisions.",
29
4
  "developerName": "HuaweiCloud Mate",
30
- "category": "Cloud",
31
- "capabilities": [
32
- "Read",
33
- "Interactive"
34
- ],
35
- "websiteURL": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
5
+ "capabilities": ["Read", "Interactive"],
36
6
  "brandColor": "#C7000B",
7
+ "composerIcon": "./assets/icon.png",
8
+ "logo": "./assets/logo.png",
9
+ "logoDark": "./assets/logo-dark.png",
10
+ "category": "Cloud",
37
11
  "defaultPrompt": [
38
12
  "Help me choose the right Huawei Cloud capability.",
39
13
  "Check my Huawei Cloud CLI setup safely.",
40
14
  "Plan this Huawei Cloud API or SDK task."
41
- ]
42
- }
15
+ ],
16
+ "longDescription": "HuaweiCloud Devkit helps coding agents choose and use Huawei Cloud Skills, KooCLI, APIs, SDKs, and MCP tools with less context, safer command execution, and more accurate cloud implementation decisions.",
17
+ "websiteURL": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
18
+ "displayName": "HuaweiCloud Devkit"
19
+ },
20
+ "mcpServers": "./.mcp.json",
21
+ "description": "Agent toolkit that helps coding agents use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities safely and accurately.",
22
+ "skills": "./skills/",
23
+ "version": "1.1.2-next.2",
24
+ "author": {
25
+ "name": "HuaweiCloud Mate",
26
+ "url": "https://github.com/huaweicloud"
27
+ },
28
+ "name": "huaweicloud-devkit",
29
+ "homepage": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
30
+ "repository": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
31
+ "license": "Apache-2.0",
32
+ "keywords": ["huaweicloud", "huawei-cloud", "koocli", "hcloud", "agent", "mcp", "api", "sdk", "skills"]
43
33
  }
@@ -5,10 +5,7 @@
5
5
  "longDescription": "HuaweiCloud Devkit helps coding agents choose and use Huawei Cloud Skills, KooCLI, APIs, SDKs, and MCP tools with less context, safer command execution, and more accurate cloud implementation decisions.",
6
6
  "developerName": "HuaweiCloud Mate",
7
7
  "category": "Cloud",
8
- "capabilities": [
9
- "Read",
10
- "Interactive"
11
- ],
8
+ "capabilities": ["Read", "Interactive"],
12
9
  "websiteURL": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
13
10
  "brandColor": "#C7000B",
14
11
  "defaultPrompt": [
@@ -20,25 +17,15 @@
20
17
  "mcpServers": "./.mcp.json",
21
18
  "description": "Guide coding agents to use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities with safer execution and less context.",
22
19
  "skills": "./skills/",
23
- "version": "1.1.2-next.0",
20
+ "version": "1.1.2-next.2",
24
21
  "author": {
25
22
  "name": "HuaweiCloud Mate",
26
23
  "url": "https://github.com/huaweicloud"
27
24
  },
28
25
  "hooks": "./hooks/",
29
- "name": "huaweicloud-core",
26
+ "name": "huaweicloud-devkit",
30
27
  "homepage": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
31
28
  "repository": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
32
29
  "license": "Apache-2.0",
33
- "keywords": [
34
- "huaweicloud",
35
- "huawei-cloud",
36
- "koocli",
37
- "hcloud",
38
- "agent",
39
- "mcp",
40
- "api",
41
- "sdk",
42
- "skills"
43
- ]
30
+ "keywords": ["huaweicloud", "huawei-cloud", "koocli", "hcloud", "agent", "mcp", "api", "sdk", "skills"]
44
31
  }
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "huaweicloud-devkit",
3
+ "version": "1.1.2-next.2",
4
+ "description": "Guide coding agents to use Huawei Cloud Skills, KooCLI, APIs, SDKs, and future MCP capabilities with safer execution and less context.",
5
+ "author": {
6
+ "name": "HuaweiCloud Mate",
7
+ "url": "https://github.com/huaweicloud"
8
+ },
9
+ "homepage": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
10
+ "repository": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
11
+ "license": "Apache-2.0",
12
+ "keywords": ["huaweicloud", "huawei-cloud", "koocli", "hcloud", "agent", "mcp", "api", "sdk", "skills"],
13
+ "skills": "./skills/",
14
+ "mcpServers": "./.mcp.json",
15
+ "interface": {
16
+ "displayName": "HuaweiCloud Devkit",
17
+ "shortDescription": "HuaweiCloud Devkit - Huawei Cloud guidance, CLI/API/SDK routing, MCP tools, and safety for coding agents.",
18
+ "longDescription": "HuaweiCloud Devkit helps coding agents choose and use Huawei Cloud Skills, KooCLI, APIs, SDKs, and MCP tools with less context, safer command execution, and more accurate cloud implementation decisions.",
19
+ "developerName": "HuaweiCloud Mate",
20
+ "category": "Cloud",
21
+ "capabilities": ["Read", "Interactive"],
22
+ "websiteURL": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
23
+ "brandColor": "#C7000B",
24
+ "defaultPrompt": [
25
+ "Help me choose the right Huawei Cloud capability.",
26
+ "Check my Huawei Cloud CLI setup safely.",
27
+ "Plan this Huawei Cloud API or SDK task."
28
+ ]
29
+ }
30
+ }
@@ -2,13 +2,10 @@
2
2
  "mcpServers": {
3
3
  "huaweicloud-devkit": {
4
4
  "command": "node",
5
- "args": [
6
- "./src/mcp-server.mjs"
7
- ],
5
+ "args": ["./src/mcp-server.mjs"],
8
6
  "cwd": ".",
9
7
  "env": {
10
- "HUAWEICLOUD_AGENT_TOOLKIT_MODE": "local",
11
- "HDKITSERVICE_ENDPOINT": ""
8
+ "HUAWEICLOUD_AGENT_TOOLKIT_MODE": "local"
12
9
  }
13
10
  }
14
11
  }
@@ -1,6 +1,6 @@
1
1
  {
2
- "name": "huaweicloud-core",
3
- "version": "1.1.2-next.0",
2
+ "name": "huaweicloud-devkit",
3
+ "version": "1.1.2-next.2",
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",
@@ -9,30 +9,16 @@
9
9
  "homepage": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
10
10
  "repository": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
11
11
  "license": "Apache-2.0",
12
- "keywords": [
13
- "huaweicloud",
14
- "huawei-cloud",
15
- "koocli",
16
- "hcloud",
17
- "agent",
18
- "mcp",
19
- "api",
20
- "sdk",
21
- "skills"
22
- ],
12
+ "keywords": ["huaweicloud", "huawei-cloud", "koocli", "hcloud", "agent", "mcp", "api", "sdk", "skills"],
23
13
  "skills": "./skills/",
24
14
  "mcpServers": "./.mcp.json",
25
- "hooks": "./hooks/",
26
15
  "interface": {
27
16
  "displayName": "HuaweiCloud Devkit",
28
17
  "shortDescription": "HuaweiCloud Devkit - Huawei Cloud guidance, CLI/API/SDK routing, MCP tools, and safety for coding agents.",
29
18
  "longDescription": "HuaweiCloud Devkit helps coding agents choose and use Huawei Cloud Skills, KooCLI, APIs, SDKs, and MCP tools with less context, safer command execution, and more accurate cloud implementation decisions.",
30
19
  "developerName": "HuaweiCloud Mate",
31
20
  "category": "Cloud",
32
- "capabilities": [
33
- "Read",
34
- "Interactive"
35
- ],
21
+ "capabilities": ["Read", "Interactive"],
36
22
  "websiteURL": "https://github.com/huaweicloud/HuaweiCloud-Devkit",
37
23
  "brandColor": "#C7000B",
38
24
  "defaultPrompt": [
@@ -15,31 +15,65 @@ import json
15
15
  import re
16
16
  import sys
17
17
  from pathlib import Path
18
+ from datetime import datetime, timezone
18
19
 
19
20
  DENY_PREFIX = "Huawei Cloud safety hook blocked this action: "
20
21
  RULES_PATH = Path(__file__).resolve().parents[1] / "safety" / "rules" / "cloud-risk-rules.json"
22
+ POLICY_PATH = Path(__file__).resolve().parents[1] / "safety" / "policy.json"
21
23
 
22
- CONFIG_FILE_RE = re.compile(r"(\.hcloud|\.huaweicloud|hcloud[/\\](config|credentials)|huaweicloud[/\\](config|credentials))", re.I)
23
- ENV_DUMP_RE = re.compile(r"(env|printenv|Get-ChildItem\s+Env:|gci\s+Env:|dir\s+Env:).*(HUAWEICLOUD|HWC_|HCLOUD|OS_)", re.I)
24
- SECRET_READ_RE = re.compile(r"(ShowSecretVersion|GetSecretValue|secret_string|secret_binary)", re.I)
25
- HCLOUD_RE = re.compile(r"(^|\s)hcloud(\.exe)?\s+", re.I)
26
- WRITE_OPERATION_RE = re.compile(
27
- r"\b(BatchCreate|BatchDelete|Create|Delete|Update|Modify|Resize|Reboot|Stop|Start|Restart|Authorize|Revoke|Add|Remove|Associate|Disassociate|Attach|Detach|Enable|Disable)\w*",
28
- re.I,
24
+ PLUGIN_DIR = Path(__file__).resolve().parents[2]
25
+ TELEMETRY_DIR = PLUGIN_DIR / "telemetry"
26
+ HOOK_EVENTS_PATH = TELEMETRY_DIR / "hook-events.jsonl"
27
+
28
+ CONFIG_FILE_RE = None
29
+ SECRET_READ_RE = None
30
+ WRITE_OPERATION_RE = None
31
+
32
+
33
+ def load_policy():
34
+ global CONFIG_FILE_RE, SECRET_READ_RE, WRITE_OPERATION_RE
35
+ try:
36
+ with POLICY_PATH.open("r", encoding="utf-8") as file_obj:
37
+ policy = json.load(file_obj)
38
+ cred_patterns = policy.get("credentialFilePatterns", [])
39
+ if cred_patterns:
40
+ CONFIG_FILE_RE = re.compile("|".join(cred_patterns), re.I)
41
+ blocked_secrets = policy.get("blockedSecretOperations", [])
42
+ if blocked_secrets:
43
+ SECRET_READ_RE = re.compile("|".join(re.escape(op) for op in blocked_secrets), re.I)
44
+ write_prefixes = policy.get("writeOperationPrefixes", [])
45
+ if write_prefixes:
46
+ WRITE_OPERATION_RE = re.compile(r"\b(" + "|".join(write_prefixes) + r")\w*", re.I)
47
+ except Exception:
48
+ pass
49
+
50
+
51
+ load_policy()
52
+
53
+ ENV_DUMP_RE = re.compile(
54
+ r"(env|printenv|Get-ChildItem\s+Env:|gci\s+Env:|dir\s+Env:).*(HUAWEICLOUD|HWC_|HCLOUD|OS_)", re.I,
29
55
  )
56
+ HCLOUD_RE = re.compile(r"(^|\s)hcloud(\.exe)?\s+", re.I)
30
57
  READ_OPERATION_RE = re.compile(r"\b(List|Show|Get|Describe|NovaList|NovaShow)\w*", re.I)
31
58
 
32
59
 
33
- def deny(reason):
34
- json.dump(
35
- {
36
- "hookSpecificOutput": {
37
- "hookEventName": "PreToolUse",
38
- "permissionDecision": "deny",
39
- "permissionDecisionReason": DENY_PREFIX + reason,
60
+ def deny(reason, hermes=False):
61
+ sys.stdout.write(
62
+ json.dumps(
63
+ {
64
+ "action": "block",
65
+ "message": DENY_PREFIX + reason,
66
+ }
67
+ if hermes
68
+ else {
69
+ "hookSpecificOutput": {
70
+ "hookEventName": "PreToolUse",
71
+ "permissionDecision": "deny",
72
+ "permissionDecisionReason": DENY_PREFIX + reason,
73
+ }
40
74
  }
41
- },
42
- sys.stdout,
75
+ )
76
+ + "\n"
43
77
  )
44
78
  sys.exit(0)
45
79
 
@@ -48,6 +82,27 @@ def allow():
48
82
  sys.exit(0)
49
83
 
50
84
 
85
+ def record_cli_event(text):
86
+ m = HCLOUD_RE.search(text)
87
+ if not m:
88
+ return
89
+ rest = text[m.end():].strip()
90
+ parts = rest.split()
91
+ cmd = " ".join(p for p in parts if not p.startswith("--") and not p.startswith("-") and "=" not in p)
92
+ if not cmd:
93
+ return
94
+ is_read = bool(READ_OPERATION_RE.search(cmd))
95
+ is_write = bool(WRITE_OPERATION_RE.search(cmd)) if WRITE_OPERATION_RE else False
96
+ event_key = "cli:read" if is_read else ("cli:write" if is_write else "cli:invoke")
97
+ event = {"key": event_key, "value": f"hcloud {cmd}", "capability": "cli"}
98
+ try:
99
+ TELEMETRY_DIR.mkdir(parents=True, exist_ok=True)
100
+ with HOOK_EVENTS_PATH.open("a", encoding="utf-8") as f:
101
+ f.write(json.dumps(event) + "\n")
102
+ except Exception:
103
+ pass
104
+
105
+
51
106
  def command_text(tool_input):
52
107
  if isinstance(tool_input, str):
53
108
  return tool_input
@@ -108,6 +163,31 @@ def first_denied_command_rule(text):
108
163
  return None
109
164
 
110
165
 
166
+ def evaluate(tool_name, tool_input):
167
+ """Run the full safety check and return a raw block reason, or None to allow.
168
+
169
+ Shared by the CLI shell (``main``) and the Hermes Python-plugin hook, which
170
+ reuses this module via ``importlib`` so a single implementation enforces the
171
+ policy everywhere. The returned reason does NOT include ``DENY_PREFIX`` —
172
+ callers decide the exact output shape.
173
+ """
174
+ text = command_text(tool_input)
175
+
176
+ if CONFIG_FILE_RE and CONFIG_FILE_RE.search(text):
177
+ return "reading Huawei Cloud credential/profile files can expose AK/SK or tokens. Use redacted toolkit tools."
178
+ if ENV_DUMP_RE.search(text):
179
+ return "dumping cloud credential environment variables is not allowed."
180
+ if SECRET_READ_RE and SECRET_READ_RE.search(text):
181
+ return "direct secret value retrieval would put plaintext secrets into the agent context."
182
+ denied_rule = first_denied_command_rule(text)
183
+ if denied_rule:
184
+ return f"{denied_rule.get('message')} Remediation: {denied_rule.get('remediation')}"
185
+ if tool_name in ("Bash", "terminal") and HCLOUD_RE.search(text) and WRITE_OPERATION_RE.search(text) and not READ_OPERATION_RE.search(text):
186
+ return "unapproved Huawei Cloud write operations must be planned first and explicitly approved by the user."
187
+
188
+ return None
189
+
190
+
111
191
  def main():
112
192
  try:
113
193
  data = json.load(sys.stdin)
@@ -115,19 +195,15 @@ def main():
115
195
  allow()
116
196
 
117
197
  tool_name = data.get("tool_name", "")
118
- text = command_text(data.get("tool_input", {}))
198
+ tool_input = data.get("tool_input", {})
199
+ hermes = "hook_event_name" in data
119
200
 
120
- if CONFIG_FILE_RE.search(text):
121
- deny("reading Huawei Cloud credential/profile files can expose AK/SK or tokens. Use redacted toolkit tools.")
122
- if ENV_DUMP_RE.search(text):
123
- deny("dumping cloud credential environment variables is not allowed.")
124
- if SECRET_READ_RE.search(text):
125
- deny("direct secret value retrieval would put plaintext secrets into the agent context.")
126
- denied_rule = first_denied_command_rule(text)
127
- if denied_rule:
128
- deny(f"{denied_rule.get('message')} Remediation: {denied_rule.get('remediation')}")
129
- if tool_name == "Bash" and HCLOUD_RE.search(text) and WRITE_OPERATION_RE.search(text) and not READ_OPERATION_RE.search(text):
130
- deny("unapproved Huawei Cloud write operations must be planned first and explicitly approved by the user.")
201
+ text = command_text(tool_input)
202
+ record_cli_event(text)
203
+
204
+ reason = evaluate(tool_name, tool_input)
205
+ if reason:
206
+ deny(reason, hermes)
131
207
 
132
208
  allow()
133
209
 
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "huaweicloud-devkit",
3
+ "id": "huaweicloud-devkit",
4
+ "displayName": "HuaweiCloud DevKit",
5
+ "version": "1.1.2-next.2",
6
+ "family": "bundle-plugin",
7
+ "bundleFormat": "codex",
8
+ "description": "Guide coding agents to use Huawei Cloud safely — KooCLI, APIs, SDKs, 28 MCP tools, skills, and safety guardrails.",
9
+ "author": {
10
+ "name": "HuaweiCloud Mate",
11
+ "url": "https://github.com/huaweicloud"
12
+ },
13
+ "homepage": "https://github.com/huaweicloud/huaweicloud-devkit",
14
+ "repository": "https://github.com/huaweicloud/huaweicloud-devkit",
15
+ "license": "Apache-2.0",
16
+ "keywords": ["huaweicloud", "huawei-cloud", "koocli", "hcloud", "agent", "mcp", "api", "sdk", "skills", "cloud"],
17
+ "category": "Cloud",
18
+ "capabilities": ["Read", "Interactive"],
19
+ "brandColor": "#C7000B"
20
+ }