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.
- package/.agents/plugins/marketplace.json +20 -20
- package/LICENSE +201 -201
- package/README.md +169 -169
- package/bin/setup.cjs +7 -7
- package/integrations/opencode/commands/huaweicloud-doctor.md +14 -14
- package/integrations/opencode/opencode.json +14 -14
- package/integrations/opencode/skills/huaweicloud-core/SKILL.md +30 -30
- package/package.json +43 -43
- package/plugins/huaweicloud-core/.claude-plugin/plugin.json +43 -43
- package/plugins/huaweicloud-core/.codex-plugin/plugin.json +42 -42
- package/plugins/huaweicloud-core/.cursor-plugin/plugin.json +43 -43
- package/plugins/huaweicloud-core/.mcp.json +13 -13
- package/plugins/huaweicloud-core/hooks/hooks.json +26 -26
- package/plugins/huaweicloud-core/hooks/huaweicloud-safety.py +88 -88
- package/plugins/huaweicloud-core/safety/policy.json +85 -85
- package/plugins/huaweicloud-core/skills/huawei-apig/SKILL.md +144 -144
- package/plugins/huaweicloud-core/skills/huawei-billing/SKILL.md +48 -48
- package/plugins/huaweicloud-core/skills/huawei-cbr/SKILL.md +50 -50
- package/plugins/huaweicloud-core/skills/huawei-cce/SKILL.md +101 -101
- package/plugins/huaweicloud-core/skills/huawei-cloud-eye/SKILL.md +73 -73
- package/plugins/huaweicloud-core/skills/huawei-cts/SKILL.md +55 -55
- package/plugins/huaweicloud-core/skills/huawei-dds-dcs/SKILL.md +70 -70
- package/plugins/huaweicloud-core/skills/huawei-dew/SKILL.md +97 -97
- package/plugins/huaweicloud-core/skills/huawei-dew/references/csms-usage.md +29 -29
- package/plugins/huaweicloud-core/skills/huawei-dew/references/kms-usage.md +23 -23
- package/plugins/huaweicloud-core/skills/huawei-ecs/SKILL.md +131 -131
- package/plugins/huaweicloud-core/skills/huawei-ecs/references/create-instance.md +96 -96
- package/plugins/huaweicloud-core/skills/huawei-ecs/references/evs.md +31 -31
- package/plugins/huaweicloud-core/skills/huawei-ecs/references/flavors.md +28 -28
- package/plugins/huaweicloud-core/skills/huawei-ecs/references/troubleshooting.md +52 -52
- package/plugins/huaweicloud-core/skills/huawei-functiongraph/SKILL.md +132 -132
- package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/apig-event-format.md +58 -58
- package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/create-function.md +71 -71
- package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/deploy-workflow.md +119 -119
- package/plugins/huaweicloud-core/skills/huawei-functiongraph/references/triggers.md +142 -142
- package/plugins/huaweicloud-core/skills/huawei-gaussdb/SKILL.md +56 -56
- package/plugins/huaweicloud-core/skills/huawei-getting-started/SKILL.md +65 -65
- package/plugins/huaweicloud-core/skills/huawei-iam/SKILL.md +111 -111
- package/plugins/huaweicloud-core/skills/huawei-modelarts/SKILL.md +65 -65
- package/plugins/huaweicloud-core/skills/huawei-obs/SKILL.md +118 -118
- package/plugins/huaweicloud-core/skills/huawei-obs/references/bucket-lifecycle.md +26 -26
- package/plugins/huaweicloud-core/skills/huawei-obs/references/static-website.md +56 -56
- package/plugins/huaweicloud-core/skills/huawei-rds/SKILL.md +181 -181
- package/plugins/huaweicloud-core/skills/huawei-smn-dms/SKILL.md +69 -69
- package/plugins/huaweicloud-core/skills/huawei-vpc/SKILL.md +78 -78
- package/plugins/huaweicloud-core/skills/huawei-vpc/references/network.md +76 -76
- package/plugins/huaweicloud-core/skills/huawei-vpc/references/security-group.md +59 -59
- package/plugins/huaweicloud-core/skills/huawei-waf-aad/SKILL.md +63 -63
- package/plugins/huaweicloud-core/skills/huaweicloud-api-and-sdk/agents/openai.yaml +4 -4
- package/plugins/huaweicloud-core/skills/huaweicloud-capability-discovery/SKILL.md +47 -47
- package/plugins/huaweicloud-core/skills/huaweicloud-capability-discovery/agents/openai.yaml +4 -4
- package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/SKILL.md +127 -127
- package/plugins/huaweicloud-core/skills/huaweicloud-cli-and-auth/agents/openai.yaml +4 -4
- package/plugins/huaweicloud-core/skills/huaweicloud-core/SKILL.md +93 -93
- package/plugins/huaweicloud-core/skills/huaweicloud-core/agents/openai.yaml +4 -4
- package/plugins/huaweicloud-core/skills/huaweicloud-core/references/report-issue.md +19 -19
- package/plugins/huaweicloud-core/skills/huaweicloud-core/references/select.md +27 -27
- package/plugins/huaweicloud-core/skills/huaweicloud-safety/SKILL.md +46 -46
- package/plugins/huaweicloud-core/skills/huaweicloud-safety/agents/openai.yaml +4 -4
- package/plugins/huaweicloud-core/skills/huaweicloud-troubleshooting/SKILL.md +83 -83
- package/plugins/huaweicloud-core/skills/huaweicloud-troubleshooting/agents/openai.yaml +4 -4
- package/plugins/huaweicloud-core/src/hcloud-cli.mjs +265 -265
- package/plugins/huaweicloud-core/src/mcp-server.mjs +116 -93
- package/plugins/huaweicloud-core/src/safety-policy.mjs +289 -289
- package/plugins/huaweicloud-core/src/setup-cli.mjs +874 -869
- 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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
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
|
+
}
|