huaweicloud-devkit 0.1.21 → 0.1.25-dev.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 (66) hide show
  1. package/.agents/plugins/marketplace.json +20 -20
  2. package/LICENSE +201 -201
  3. package/README.md +169 -169
  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 +43 -43
  10. package/plugins/huaweicloud-core/.codex-plugin/plugin.json +42 -42
  11. package/plugins/huaweicloud-core/.cursor-plugin/plugin.json +43 -43
  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 +116 -93
  64. package/plugins/huaweicloud-core/src/safety-policy.mjs +289 -289
  65. package/plugins/huaweicloud-core/src/setup-cli.mjs +874 -869
  66. package/plugins/huaweicloud-core/src/tools.mjs +677 -677
@@ -1,93 +1,116 @@
1
- #!/usr/bin/env node
2
- import { stdin, stdout } from 'node:process';
3
- import { TOOL_DEFINITIONS, callTool } from './tools.mjs';
4
-
5
- let buffer = Buffer.alloc(0);
6
-
7
- stdin.on('data', (chunk) => {
8
- buffer = Buffer.concat([buffer, chunk]);
9
- readFrames();
10
- });
11
-
12
- function readFrames() {
13
- while (true) {
14
- const headerEnd = buffer.indexOf('\r\n\r\n');
15
- if (headerEnd === -1) return;
16
- const header = buffer.subarray(0, headerEnd).toString('utf8');
17
- const match = header.match(/Content-Length:\s*(\d+)/i);
18
- if (!match) {
19
- buffer = Buffer.alloc(0);
20
- return;
21
- }
22
- const length = Number(match[1]);
23
- const bodyStart = headerEnd + 4;
24
- const bodyEnd = bodyStart + length;
25
- if (buffer.length < bodyEnd) return;
26
- const body = buffer.subarray(bodyStart, bodyEnd).toString('utf8');
27
- buffer = buffer.subarray(bodyEnd);
28
- void handleMessage(JSON.parse(body));
29
- }
30
- }
31
-
32
- async function handleMessage(message) {
33
- if (!Object.hasOwn(message, 'id')) {
34
- if (message.method === 'notifications/initialized') return;
35
- return;
36
- }
37
- try {
38
- const result = await dispatch(message.method, message.params || {});
39
- writeMessage({ jsonrpc: '2.0', id: message.id, result });
40
- } catch (error) {
41
- writeMessage({
42
- jsonrpc: '2.0',
43
- id: message.id,
44
- error: {
45
- code: -32603,
46
- message: error.message,
47
- },
48
- });
49
- }
50
- }
51
-
52
- async function dispatch(method, params) {
53
- if (method === 'initialize') {
54
- return {
55
- protocolVersion: params.protocolVersion || '2024-11-05',
56
- capabilities: {
57
- tools: {},
58
- },
59
- serverInfo: {
60
- name: 'huaweicloud-devkit',
61
- version: '0.1.0',
62
- },
63
- };
64
- }
65
-
66
- if (method === 'tools/list') {
67
- return { tools: TOOL_DEFINITIONS };
68
- }
69
-
70
- if (method === 'tools/call') {
71
- const result = await callTool(params.name, params.arguments || {});
72
- return {
73
- content: [
74
- {
75
- type: 'text',
76
- text: JSON.stringify(result, null, 2),
77
- },
78
- ],
79
- isError: false,
80
- };
81
- }
82
-
83
- if (method === 'resources/list') {
84
- return { resources: [] };
85
- }
86
-
87
- throw new Error(`Unsupported method: ${method}`);
88
- }
89
-
90
- function writeMessage(message) {
91
- const json = JSON.stringify(message);
92
- stdout.write(`Content-Length: ${Buffer.byteLength(json, 'utf8')}\r\n\r\n${json}`);
93
- }
1
+ #!/usr/bin/env node
2
+ import { stdin, stdout } from 'node:process';
3
+ import { TOOL_DEFINITIONS, callTool } from './tools.mjs';
4
+
5
+ let buffer = Buffer.alloc(0);
6
+ let useContentLengthFraming = true;
7
+
8
+ stdin.on('data', (chunk) => {
9
+ buffer = Buffer.concat([buffer, chunk]);
10
+ readFrames();
11
+ });
12
+
13
+ function readFrames() {
14
+ while (true) {
15
+ const headerEnd = buffer.indexOf('\r\n\r\n');
16
+ if (headerEnd !== -1) {
17
+ useContentLengthFraming = true;
18
+ parseContentLengthFrame(headerEnd);
19
+ continue;
20
+ }
21
+
22
+ const lf = buffer.indexOf('\n');
23
+ if (lf !== -1) {
24
+ useContentLengthFraming = false;
25
+ const line = buffer.subarray(0, lf).toString('utf8').trim();
26
+ buffer = buffer.subarray(lf + 1);
27
+ if (line) void handleMessage(JSON.parse(line));
28
+ continue;
29
+ }
30
+
31
+ return;
32
+ }
33
+ }
34
+
35
+ function parseContentLengthFrame(headerEnd) {
36
+ const header = buffer.subarray(0, headerEnd).toString('utf8');
37
+ const match = header.match(/Content-Length:\s*(\d+)/i);
38
+ if (!match) {
39
+ buffer = Buffer.alloc(0);
40
+ return;
41
+ }
42
+ const length = Number(match[1]);
43
+ const bodyStart = headerEnd + 4;
44
+ const bodyEnd = bodyStart + length;
45
+ if (buffer.length < bodyEnd) return;
46
+ const body = buffer.subarray(bodyStart, bodyEnd).toString('utf8');
47
+ buffer = buffer.subarray(bodyEnd);
48
+ void handleMessage(JSON.parse(body));
49
+ }
50
+
51
+ async function handleMessage(message) {
52
+ if (!Object.hasOwn(message, 'id')) {
53
+ if (message.method === 'notifications/initialized') return;
54
+ return;
55
+ }
56
+ try {
57
+ const result = await dispatch(message.method, message.params || {});
58
+ writeMessage({ jsonrpc: '2.0', id: message.id, result });
59
+ } catch (error) {
60
+ writeMessage({
61
+ jsonrpc: '2.0',
62
+ id: message.id,
63
+ error: {
64
+ code: -32603,
65
+ message: error.message,
66
+ },
67
+ });
68
+ }
69
+ }
70
+
71
+ async function dispatch(method, params) {
72
+ if (method === 'initialize') {
73
+ return {
74
+ protocolVersion: params.protocolVersion || '2024-11-05',
75
+ capabilities: {
76
+ tools: {},
77
+ },
78
+ serverInfo: {
79
+ name: 'huaweicloud-devkit',
80
+ version: '0.1.0',
81
+ },
82
+ };
83
+ }
84
+
85
+ if (method === 'tools/list') {
86
+ return { tools: TOOL_DEFINITIONS };
87
+ }
88
+
89
+ if (method === 'tools/call') {
90
+ const result = await callTool(params.name, params.arguments || {});
91
+ return {
92
+ content: [
93
+ {
94
+ type: 'text',
95
+ text: JSON.stringify(result, null, 2),
96
+ },
97
+ ],
98
+ isError: false,
99
+ };
100
+ }
101
+
102
+ if (method === 'resources/list') {
103
+ return { resources: [] };
104
+ }
105
+
106
+ throw new Error(`Unsupported method: ${method}`);
107
+ }
108
+
109
+ function writeMessage(message) {
110
+ const json = JSON.stringify(message);
111
+ if (useContentLengthFraming) {
112
+ stdout.write(`Content-Length: ${Buffer.byteLength(json, 'utf8')}\r\n\r\n${json}`);
113
+ } else {
114
+ stdout.write(json + '\n');
115
+ }
116
+ }