devops-mcp-server-extension 1.0.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/LICENSE +218 -0
- package/README.md +527 -0
- package/README.zh-cn.md +503 -0
- package/dist/common/errors.js +77 -0
- package/dist/common/modularTemplates.js +483 -0
- package/dist/common/pipelineTemplates.js +19 -0
- package/dist/common/toolsetManager.js +123 -0
- package/dist/common/toolsets.js +23 -0
- package/dist/common/types.js +60 -0
- package/dist/common/utils.js +381 -0
- package/dist/common/version.js +1 -0
- package/dist/index.js +225 -0
- package/dist/operations/appstack/appOrchestrations.js +260 -0
- package/dist/operations/appstack/appTags.js +168 -0
- package/dist/operations/appstack/appTemplates.js +72 -0
- package/dist/operations/appstack/applications.js +171 -0
- package/dist/operations/appstack/changeOrders.js +320 -0
- package/dist/operations/appstack/changeRequests.js +288 -0
- package/dist/operations/appstack/deploymentResources.js +286 -0
- package/dist/operations/appstack/globalVars.js +221 -0
- package/dist/operations/appstack/releaseWorkflows.js +695 -0
- package/dist/operations/appstack/variableGroups.js +245 -0
- package/dist/operations/codeup/branches.js +157 -0
- package/dist/operations/codeup/changeRequestComments.js +140 -0
- package/dist/operations/codeup/changeRequests.js +230 -0
- package/dist/operations/codeup/commits.js +121 -0
- package/dist/operations/codeup/compare.js +30 -0
- package/dist/operations/codeup/files.js +249 -0
- package/dist/operations/codeup/repositories.js +71 -0
- package/dist/operations/codeup/types.js +414 -0
- package/dist/operations/flow/hostGroup.js +52 -0
- package/dist/operations/flow/pipeline.js +609 -0
- package/dist/operations/flow/pipelineJob.js +126 -0
- package/dist/operations/flow/resourceMember.js +137 -0
- package/dist/operations/flow/serviceConnection.js +27 -0
- package/dist/operations/flow/tag.js +191 -0
- package/dist/operations/flow/types.js +523 -0
- package/dist/operations/flow/vmDeployOrder.js +171 -0
- package/dist/operations/organization/members.js +106 -0
- package/dist/operations/organization/organization.js +110 -0
- package/dist/operations/organization/types.js +111 -0
- package/dist/operations/packages/artifacts.js +71 -0
- package/dist/operations/packages/repositories.js +39 -0
- package/dist/operations/packages/types.js +56 -0
- package/dist/operations/projex/effort.js +122 -0
- package/dist/operations/projex/project.js +243 -0
- package/dist/operations/projex/sprint.js +103 -0
- package/dist/operations/projex/types.js +618 -0
- package/dist/operations/projex/workitem.js +826 -0
- package/dist/operations/testhub/testcases.js +240 -0
- package/dist/operations/testhub/testplans.js +128 -0
- package/dist/tool-handlers/appstack-app-release-workflows.js +103 -0
- package/dist/tool-handlers/appstack-change-orders.js +55 -0
- package/dist/tool-handlers/appstack-change-requests.js +49 -0
- package/dist/tool-handlers/appstack-deployment-resources.js +31 -0
- package/dist/tool-handlers/appstack-global-vars.js +37 -0
- package/dist/tool-handlers/appstack-orchestrations.js +49 -0
- package/dist/tool-handlers/appstack-release-workflows.js +37 -0
- package/dist/tool-handlers/appstack-tags.js +37 -0
- package/dist/tool-handlers/appstack-templates.js +19 -0
- package/dist/tool-handlers/appstack-variable-groups.js +55 -0
- package/dist/tool-handlers/appstack.js +37 -0
- package/dist/tool-handlers/base.js +25 -0
- package/dist/tool-handlers/code-management.js +150 -0
- package/dist/tool-handlers/commit.js +31 -0
- package/dist/tool-handlers/effort.js +103 -0
- package/dist/tool-handlers/index.js +119 -0
- package/dist/tool-handlers/organization.js +72 -0
- package/dist/tool-handlers/packages.js +32 -0
- package/dist/tool-handlers/pipeline.js +289 -0
- package/dist/tool-handlers/project-management.js +201 -0
- package/dist/tool-handlers/resourceMember.js +43 -0
- package/dist/tool-handlers/service-connections.js +16 -0
- package/dist/tool-handlers/tag.js +64 -0
- package/dist/tool-handlers/test-management.js +74 -0
- package/dist/tool-handlers/vmDeployOrder.js +50 -0
- package/dist/tool-registry/appstack-app-release-workflows.js +80 -0
- package/dist/tool-registry/appstack-change-orders.js +40 -0
- package/dist/tool-registry/appstack-change-requests.js +35 -0
- package/dist/tool-registry/appstack-deployment-resources.js +20 -0
- package/dist/tool-registry/appstack-global-vars.js +25 -0
- package/dist/tool-registry/appstack-orchestrations.js +35 -0
- package/dist/tool-registry/appstack-release-workflows.js +25 -0
- package/dist/tool-registry/appstack-tags.js +25 -0
- package/dist/tool-registry/appstack-templates.js +10 -0
- package/dist/tool-registry/appstack-variable-groups.js +40 -0
- package/dist/tool-registry/appstack.js +25 -0
- package/dist/tool-registry/base.js +19 -0
- package/dist/tool-registry/code-management.js +109 -0
- package/dist/tool-registry/commit.js +20 -0
- package/dist/tool-registry/effort.js +39 -0
- package/dist/tool-registry/index.js +7 -0
- package/dist/tool-registry/organization.js +65 -0
- package/dist/tool-registry/packages.js +21 -0
- package/dist/tool-registry/pipeline.js +190 -0
- package/dist/tool-registry/project-management.js +143 -0
- package/dist/tool-registry/resourceMember.js +29 -0
- package/dist/tool-registry/service-connections.js +10 -0
- package/dist/tool-registry/tag.js +44 -0
- package/dist/tool-registry/test-management.js +59 -0
- package/dist/tool-registry/vmDeployOrder.js +34 -0
- package/package.json +52 -0
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { yunxiaoRequest, isRegionEdition } from '../../common/utils.js';
|
|
3
|
+
import { resolveOrganizationId } from '../organization/organization.js';
|
|
4
|
+
// Schema for TestcaseDirectoryDTO
|
|
5
|
+
export const TestcaseDirectoryDTOSchema = z.object({
|
|
6
|
+
id: z.string().describe("目录id"),
|
|
7
|
+
name: z.string().describe("目录名称"),
|
|
8
|
+
parentId: z.string().nullable().optional().describe("父目录id"),
|
|
9
|
+
});
|
|
10
|
+
// Schema for CreateTestcaseDirectoryRequest
|
|
11
|
+
export const CreateTestcaseDirectoryRequestSchema = z.object({
|
|
12
|
+
organizationId: z.string().describe("组织ID"),
|
|
13
|
+
testRepoId: z.string().describe("用例库唯一标识"),
|
|
14
|
+
name: z.string().describe("目录名称"),
|
|
15
|
+
parentIdentifier: z.string().optional().describe("父目录ID"),
|
|
16
|
+
});
|
|
17
|
+
export const CreateTestcaseDirectoryResponseSchema = TestcaseDirectoryDTOSchema;
|
|
18
|
+
// Schema for ListDirectories
|
|
19
|
+
export const ListDirectoriesRequestSchema = z.object({
|
|
20
|
+
organizationId: z.string().describe("组织ID"),
|
|
21
|
+
testRepoId: z.string().describe("用例库唯一标识"),
|
|
22
|
+
});
|
|
23
|
+
export const ListDirectoriesResponseSchema = z.array(TestcaseDirectoryDTOSchema);
|
|
24
|
+
// Schema for WorkitemSimpleFiled
|
|
25
|
+
export const WorkitemSimpleFiledSchema = z.object({
|
|
26
|
+
id: z.string().describe("字段id"),
|
|
27
|
+
name: z.string().describe("名称"),
|
|
28
|
+
type: z.string().describe("字段类型"),
|
|
29
|
+
format: z.string().nullable().optional().describe("字段格式"),
|
|
30
|
+
required: z.boolean().optional().describe("是否必填"),
|
|
31
|
+
showWhenCreate: z.boolean().optional().describe("创建时是否展示"),
|
|
32
|
+
description: z.string().nullable().optional().describe("描述"),
|
|
33
|
+
defaultValue: z.string().nullable().optional().describe("默认值"),
|
|
34
|
+
options: z.array(z.object({
|
|
35
|
+
id: z.string().optional(),
|
|
36
|
+
value: z.string().optional(),
|
|
37
|
+
displayValue: z.string().optional(),
|
|
38
|
+
valueEn: z.string().optional(),
|
|
39
|
+
})).optional().describe("可选值"),
|
|
40
|
+
cascadingOptions: z.any().nullable().optional().describe("层级字段的待选择"),
|
|
41
|
+
});
|
|
42
|
+
// Schema for GetTestcaseFieldConfig
|
|
43
|
+
export const GetTestcaseFieldConfigRequestSchema = z.object({
|
|
44
|
+
organizationId: z.string().describe("组织ID"),
|
|
45
|
+
testRepoId: z.string().describe("用例库唯一标识"),
|
|
46
|
+
});
|
|
47
|
+
export const GetTestcaseFieldConfigResponseSchema = z.array(WorkitemSimpleFiledSchema);
|
|
48
|
+
// Schema for TestStep
|
|
49
|
+
export const TestStepSchema = z.object({
|
|
50
|
+
step: z.string().describe("测试步骤"),
|
|
51
|
+
expected: z.string().describe("期望结果"),
|
|
52
|
+
});
|
|
53
|
+
// Schema for TestStepsDTO
|
|
54
|
+
export const TestStepsDTOSchema = z.object({
|
|
55
|
+
contentType: z.enum(["TABLE", "TEXT"]).describe("内容格式"),
|
|
56
|
+
stepContent: z.string().nullable().optional().describe("当contentType为TEXT时,该字段描述了测试步骤的内容"),
|
|
57
|
+
expectedResult: z.string().nullable().optional().describe("当contentType为TEXT时,该字段描述了期望结果的内容"),
|
|
58
|
+
content: z.array(TestStepSchema).nullable().optional().describe("当contentType为TABLE时,该字段描述了测试步骤的内容;当contentType为TEXT时,该字段为null"),
|
|
59
|
+
});
|
|
60
|
+
// Schema for CreateTestcaseRequest
|
|
61
|
+
export const CreateTestcaseRequestSchema = z.object({
|
|
62
|
+
organizationId: z.string().describe("组织ID"),
|
|
63
|
+
testRepoId: z.string().describe("用例库唯一标识"),
|
|
64
|
+
subject: z.string().min(0).max(256).optional().describe("标题"),
|
|
65
|
+
assignedTo: z.string().optional().describe("负责人userId"),
|
|
66
|
+
directoryId: z.string().optional().describe("目录id"),
|
|
67
|
+
preCondition: z.string().optional().describe("前置条件"),
|
|
68
|
+
labels: z.array(z.string()).optional().describe("标签ids"),
|
|
69
|
+
customFieldValues: z.record(z.any()).optional().describe("自定义字段值"),
|
|
70
|
+
testSteps: TestStepsDTOSchema.optional().describe("测试步骤"),
|
|
71
|
+
});
|
|
72
|
+
export const CreateTestcaseResponseSchema = z.object({
|
|
73
|
+
id: z.string().describe("id"),
|
|
74
|
+
});
|
|
75
|
+
// Schema for SearchTestcasesRequest
|
|
76
|
+
export const SearchTestcasesRequestSchema = z.object({
|
|
77
|
+
organizationId: z.string().describe("组织ID"),
|
|
78
|
+
testRepoId: z.string().describe("用例库唯一标识"),
|
|
79
|
+
page: z.number().int().optional().default(1).describe("分页参数,第几页"),
|
|
80
|
+
perPage: z.number().int().min(0).max(200).optional().default(20).describe("分页参数,每页大小"),
|
|
81
|
+
orderBy: z.enum(["gmtCreate", "name"]).optional().default("gmtCreate").describe("排序字段"),
|
|
82
|
+
sort: z.enum(["desc", "asc"]).optional().default("desc").describe("排序方式"),
|
|
83
|
+
directoryId: z.string().optional().describe("目录id"),
|
|
84
|
+
conditions: z.string().optional().describe("过滤条件,是一个json串"),
|
|
85
|
+
});
|
|
86
|
+
// Schema for MiniUser
|
|
87
|
+
export const MiniUserSchema = z.object({
|
|
88
|
+
id: z.string().describe("用户id"),
|
|
89
|
+
name: z.string().describe("名称"),
|
|
90
|
+
});
|
|
91
|
+
// Schema for MiniLabel
|
|
92
|
+
export const MiniLabelSchema = z.object({
|
|
93
|
+
id: z.string().describe("id"),
|
|
94
|
+
name: z.string().describe("名称"),
|
|
95
|
+
color: z.string().optional().describe("颜色"),
|
|
96
|
+
});
|
|
97
|
+
// Schema for MiniItemDTO
|
|
98
|
+
export const MiniItemDTOSchema = z.object({
|
|
99
|
+
id: z.string().describe("id"),
|
|
100
|
+
name: z.string().describe("名称"),
|
|
101
|
+
});
|
|
102
|
+
// Schema for FieldValue
|
|
103
|
+
export const FieldValueSchema = z.object({
|
|
104
|
+
fieldId: z.string().describe("字段id"),
|
|
105
|
+
fieldName: z.string().describe("字段名称"),
|
|
106
|
+
fieldFormat: z.string().describe("字段类型"),
|
|
107
|
+
values: z.array(z.object({
|
|
108
|
+
identifier: z.string().describe("值的唯一标识"),
|
|
109
|
+
displayValue: z.string().describe("显示的名称"),
|
|
110
|
+
})).optional().describe("字段值"),
|
|
111
|
+
});
|
|
112
|
+
// Schema for TestcaseDTO
|
|
113
|
+
export const TestcaseDTOSchema = z.object({
|
|
114
|
+
id: z.string().describe("id"),
|
|
115
|
+
subject: z.string().describe("标题"),
|
|
116
|
+
customCode: z.string().nullable().optional().describe("编号"),
|
|
117
|
+
assignedTo: MiniUserSchema.nullable().optional().describe("负责人"),
|
|
118
|
+
creator: MiniUserSchema.nullable().optional().describe("创建人"),
|
|
119
|
+
modifier: MiniUserSchema.nullable().optional().describe("修改人"),
|
|
120
|
+
directory: MiniItemDTOSchema.nullable().optional().describe("目录"),
|
|
121
|
+
preCondition: z.string().nullable().optional().describe("前置条件内容"),
|
|
122
|
+
preConditionFormat: z.enum(["RICHTEXT", "TEXT"]).nullable().optional().describe("前置条件内容格式"),
|
|
123
|
+
labels: z.array(MiniLabelSchema).nullable().optional().describe("标签"),
|
|
124
|
+
customFieldValues: z.array(FieldValueSchema).nullable().optional().describe("自定义字段值"),
|
|
125
|
+
testSteps: TestStepsDTOSchema.nullable().optional().describe("测试步骤"),
|
|
126
|
+
gmtCreate: z.union([z.string(), z.number()]).nullable().optional().describe("创建时间(时间戳或ISO字符串)"),
|
|
127
|
+
gmtModified: z.union([z.string(), z.number()]).nullable().optional().describe("修改时间(时间戳或ISO字符串)"),
|
|
128
|
+
testRepo: z.object({
|
|
129
|
+
id: z.string().describe("id"),
|
|
130
|
+
name: z.string().describe("名称"),
|
|
131
|
+
}).nullable().optional().describe("测试用例库"),
|
|
132
|
+
});
|
|
133
|
+
export const SearchTestcasesResponseSchema = z.array(TestcaseDTOSchema);
|
|
134
|
+
// Schema for GetTestcase
|
|
135
|
+
export const GetTestcaseRequestSchema = z.object({
|
|
136
|
+
organizationId: z.string().describe("组织ID"),
|
|
137
|
+
testRepoId: z.string().describe("用例库唯一标识"),
|
|
138
|
+
testcaseId: z.string().describe("用例唯一标识"),
|
|
139
|
+
});
|
|
140
|
+
export const GetTestcaseResponseSchema = TestcaseDTOSchema;
|
|
141
|
+
// Schema for DeleteTestcase
|
|
142
|
+
export const DeleteTestcaseRequestSchema = z.object({
|
|
143
|
+
organizationId: z.string().describe("组织ID"),
|
|
144
|
+
testRepoId: z.string().describe("用例库唯一标识"),
|
|
145
|
+
testcaseId: z.string().describe("用例唯一标识"),
|
|
146
|
+
});
|
|
147
|
+
// DELETE 请求可能返回空响应(空字符串、空对象或 undefined)
|
|
148
|
+
export const DeleteTestcaseResponseSchema = z.union([
|
|
149
|
+
z.object({}),
|
|
150
|
+
z.string(),
|
|
151
|
+
z.undefined(),
|
|
152
|
+
]).transform(() => ({}));
|
|
153
|
+
/**
|
|
154
|
+
* 获取测试用例目录列表
|
|
155
|
+
*/
|
|
156
|
+
export async function listDirectories(params) {
|
|
157
|
+
const { organizationId, testRepoId } = params;
|
|
158
|
+
const finalOrgId = await resolveOrganizationId(organizationId);
|
|
159
|
+
const url = isRegionEdition()
|
|
160
|
+
? `/oapi/v1/testhub/testRepos/${testRepoId}/directories`
|
|
161
|
+
: `/oapi/v1/testhub/organizations/${finalOrgId}/testRepos/${testRepoId}/directories`;
|
|
162
|
+
const response = await yunxiaoRequest(url, { method: 'GET' });
|
|
163
|
+
return ListDirectoriesResponseSchema.parse(response);
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* 创建测试用例目录
|
|
167
|
+
*/
|
|
168
|
+
export async function createTestcaseDirectory(params) {
|
|
169
|
+
const { organizationId, testRepoId, name, parentIdentifier } = params;
|
|
170
|
+
const finalOrgId = await resolveOrganizationId(organizationId);
|
|
171
|
+
const url = isRegionEdition()
|
|
172
|
+
? `/oapi/v1/testhub/testRepos/${testRepoId}/directories`
|
|
173
|
+
: `/oapi/v1/testhub/organizations/${finalOrgId}/testRepos/${testRepoId}/directories`;
|
|
174
|
+
const body = { name };
|
|
175
|
+
if (parentIdentifier) {
|
|
176
|
+
body.parentIdentifier = parentIdentifier;
|
|
177
|
+
}
|
|
178
|
+
const response = await yunxiaoRequest(url, { method: 'POST', body });
|
|
179
|
+
return CreateTestcaseDirectoryResponseSchema.parse(response);
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* 获取测试用例字段配置
|
|
183
|
+
*/
|
|
184
|
+
export async function getTestcaseFieldConfig(params) {
|
|
185
|
+
const { organizationId, testRepoId } = params;
|
|
186
|
+
const finalOrgId = await resolveOrganizationId(organizationId);
|
|
187
|
+
const url = isRegionEdition()
|
|
188
|
+
? `/oapi/v1/testhub/testRepos/${testRepoId}/testcases/fields`
|
|
189
|
+
: `/oapi/v1/testhub/organizations/${finalOrgId}/testRepos/${testRepoId}/testcases/fields`;
|
|
190
|
+
const response = await yunxiaoRequest(url, { method: 'GET' });
|
|
191
|
+
return GetTestcaseFieldConfigResponseSchema.parse(response);
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* 创建测试用例
|
|
195
|
+
*/
|
|
196
|
+
export async function createTestcase(params) {
|
|
197
|
+
const { organizationId, testRepoId, ...body } = params;
|
|
198
|
+
const finalOrgId = await resolveOrganizationId(organizationId);
|
|
199
|
+
const url = isRegionEdition()
|
|
200
|
+
? `/oapi/v1/testhub/testRepos/${testRepoId}/testcases`
|
|
201
|
+
: `/oapi/v1/testhub/organizations/${finalOrgId}/testRepos/${testRepoId}/testcases`;
|
|
202
|
+
const response = await yunxiaoRequest(url, { method: 'POST', body });
|
|
203
|
+
return CreateTestcaseResponseSchema.parse(response);
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* 搜索测试用例
|
|
207
|
+
*/
|
|
208
|
+
export async function searchTestcases(params) {
|
|
209
|
+
const { organizationId, testRepoId, ...body } = params;
|
|
210
|
+
const finalOrgId = await resolveOrganizationId(organizationId);
|
|
211
|
+
const url = isRegionEdition()
|
|
212
|
+
? `/oapi/v1/testhub/testRepos/${testRepoId}/testcases:search`
|
|
213
|
+
: `/oapi/v1/testhub/organizations/${finalOrgId}/testRepos/${testRepoId}/testcases:search`;
|
|
214
|
+
const response = await yunxiaoRequest(url, { method: 'POST', body });
|
|
215
|
+
return SearchTestcasesResponseSchema.parse(response);
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* 获取测试用例信息
|
|
219
|
+
*/
|
|
220
|
+
export async function getTestcase(params) {
|
|
221
|
+
const { organizationId, testRepoId, testcaseId } = params;
|
|
222
|
+
const finalOrgId = await resolveOrganizationId(organizationId);
|
|
223
|
+
const url = isRegionEdition()
|
|
224
|
+
? `/oapi/v1/testhub/testRepos/${testRepoId}/testcases/${testcaseId}`
|
|
225
|
+
: `/oapi/v1/testhub/organizations/${finalOrgId}/testRepos/${testRepoId}/testcases/${testcaseId}`;
|
|
226
|
+
const response = await yunxiaoRequest(url, { method: 'GET' });
|
|
227
|
+
return GetTestcaseResponseSchema.parse(response);
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* 删除测试用例
|
|
231
|
+
*/
|
|
232
|
+
export async function deleteTestcase(params) {
|
|
233
|
+
const { organizationId, testRepoId, testcaseId } = params;
|
|
234
|
+
const finalOrgId = await resolveOrganizationId(organizationId);
|
|
235
|
+
const url = isRegionEdition()
|
|
236
|
+
? `/oapi/v1/testhub/testRepos/${testRepoId}/testcases/${testcaseId}`
|
|
237
|
+
: `/oapi/v1/testhub/organizations/${finalOrgId}/testRepos/${testRepoId}/testcases/${testcaseId}`;
|
|
238
|
+
const response = await yunxiaoRequest(url, { method: 'DELETE' });
|
|
239
|
+
return DeleteTestcaseResponseSchema.parse(response);
|
|
240
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { yunxiaoRequest, isRegionEdition } from '../../common/utils.js';
|
|
3
|
+
import { resolveOrganizationId } from '../organization/organization.js';
|
|
4
|
+
import { isYunxiaoError } from '../../common/errors.js';
|
|
5
|
+
// Schema for TestPlanDTO
|
|
6
|
+
export const TestPlanDTOSchema = z.object({
|
|
7
|
+
testPlanIdentifier: z.string().describe("测试计划id"),
|
|
8
|
+
name: z.string().describe("测试计划名称"),
|
|
9
|
+
managers: z.array(z.string()).nullable().optional().describe("测试计划管理员id"),
|
|
10
|
+
gmtCreate: z.union([z.string(), z.number()]).nullable().optional().describe("创建时间(时间戳或ISO字符串)"),
|
|
11
|
+
spaceIdentifier: z.string().nullable().optional().describe("关联项目id"),
|
|
12
|
+
});
|
|
13
|
+
// Schema for ListTestPlan
|
|
14
|
+
export const ListTestPlanRequestSchema = z.object({
|
|
15
|
+
organizationId: z.string().describe("组织ID"),
|
|
16
|
+
});
|
|
17
|
+
export const ListTestPlanResponseSchema = z.array(TestPlanDTOSchema);
|
|
18
|
+
// Schema for MiniUser (reuse from testcases.ts)
|
|
19
|
+
// 字段设为可选,因为 API 可能返回空对象或 null,或者字段可能缺失
|
|
20
|
+
export const MiniUserSchema = z.object({
|
|
21
|
+
id: z.string().optional().nullable().describe("用户id"),
|
|
22
|
+
name: z.string().optional().nullable().describe("名称"),
|
|
23
|
+
}).passthrough(); // 允许额外的字段,处理空对象的情况
|
|
24
|
+
// Schema for FieldValue (from testplan.swagger.json)
|
|
25
|
+
export const TestPlanFieldValueSchema = z.object({
|
|
26
|
+
fieldFormat: z.string().optional().describe("字段格式"),
|
|
27
|
+
fieldIdentifier: z.string().optional().describe("字段id"),
|
|
28
|
+
fieldClassName: z.string().optional().describe("字段类型"),
|
|
29
|
+
value: z.string().optional().describe("字段值"),
|
|
30
|
+
});
|
|
31
|
+
// Schema for TestcaseTestResultSummary
|
|
32
|
+
export const TestcaseTestResultSummarySchema = z.object({
|
|
33
|
+
identifier: z.string().describe("测试用例 id,测试用例唯一标识"),
|
|
34
|
+
gmtCreate: z.union([z.string(), z.number()]).nullable().optional().describe("测试用例创建时间"),
|
|
35
|
+
subject: z.string().nullable().optional().describe("测试用例标题"),
|
|
36
|
+
// 使用 union 来正确处理 null 值或空对象,.optional() 处理 undefined
|
|
37
|
+
assignedTo: z.union([MiniUserSchema, z.null()]).optional().describe("负责人信息"),
|
|
38
|
+
spaceIdentifier: z.string().nullable().optional().describe("测试用例所属的测试库 id"),
|
|
39
|
+
// customFields 实际返回的是数组,不是单个对象
|
|
40
|
+
customFields: z.array(TestPlanFieldValueSchema).nullable().optional().describe("自定义字段数组"),
|
|
41
|
+
testResultIdentifier: z.string().nullable().optional().describe("测试结果的id"),
|
|
42
|
+
testResultStatus: z.enum(["TODO", "PASS", "FAILURE", "POSTPONE"]).nullable().optional().describe("测试结果的状态"),
|
|
43
|
+
testResultExecutorIdentifier: z.string().nullable().optional().describe("测试计划执行人id"),
|
|
44
|
+
// 使用 union 来正确处理 null 值或空对象,.optional() 处理 undefined
|
|
45
|
+
testResultExecutor: z.union([MiniUserSchema, z.null()]).optional().describe("测试计划执行人对象"),
|
|
46
|
+
testResultGmtCreate: z.union([z.string(), z.number()]).nullable().optional().describe("测试结果创建时间"),
|
|
47
|
+
testResultGmtModified: z.union([z.string(), z.number()]).nullable().optional().describe("测试结果最后创建时间"),
|
|
48
|
+
bugCount: z.number().int().nullable().optional().describe("测试执行结果关联缺陷数量"),
|
|
49
|
+
});
|
|
50
|
+
// Schema for GetTestResultList
|
|
51
|
+
export const GetTestResultListRequestSchema = z.object({
|
|
52
|
+
organizationId: z.string().describe("组织ID"),
|
|
53
|
+
testPlanIdentifier: z.string().describe("测试计划id"),
|
|
54
|
+
directoryIdentifier: z.string().describe("目录id"),
|
|
55
|
+
});
|
|
56
|
+
export const GetTestResultListResponseSchema = z.array(TestcaseTestResultSummarySchema);
|
|
57
|
+
// Schema for UpdateTestResultRequest
|
|
58
|
+
export const UpdateTestResultRequestSchema = z.object({
|
|
59
|
+
organizationId: z.string().describe("组织ID"),
|
|
60
|
+
testplanId: z.string().describe("测试计划唯一标识"),
|
|
61
|
+
testcaseId: z.string().describe("测试用例唯一标识"),
|
|
62
|
+
executor: z.string().optional().describe("执行人userId"),
|
|
63
|
+
status: z.enum(["TODO", "PASS", "FAILURE", "POSTPONE"]).optional().describe("状态"),
|
|
64
|
+
});
|
|
65
|
+
export const UpdateTestResultResponseSchema = z.union([
|
|
66
|
+
z.object({}),
|
|
67
|
+
z.string(),
|
|
68
|
+
z.undefined(),
|
|
69
|
+
]).transform(() => ({}));
|
|
70
|
+
/**
|
|
71
|
+
* 获取测试计划列表
|
|
72
|
+
*/
|
|
73
|
+
export async function listTestPlan(params) {
|
|
74
|
+
const { organizationId } = params;
|
|
75
|
+
const finalOrgId = await resolveOrganizationId(organizationId);
|
|
76
|
+
const url = isRegionEdition()
|
|
77
|
+
? `/oapi/v1/projex/testPlan/list`
|
|
78
|
+
: `/oapi/v1/projex/organizations/${finalOrgId}/testPlan/list`;
|
|
79
|
+
const response = await yunxiaoRequest(url, { method: 'POST', body: {} });
|
|
80
|
+
return ListTestPlanResponseSchema.parse(response);
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* 获取测试计划中测试用例列表
|
|
84
|
+
* 如果第一个 API 返回 404,则自动回退到第二个 API
|
|
85
|
+
*/
|
|
86
|
+
export async function getTestResultList(params) {
|
|
87
|
+
const { organizationId, testPlanIdentifier, directoryIdentifier } = params;
|
|
88
|
+
const finalOrgId = await resolveOrganizationId(organizationId);
|
|
89
|
+
// 首先尝试使用 projex API
|
|
90
|
+
try {
|
|
91
|
+
const url = isRegionEdition()
|
|
92
|
+
? `/oapi/v1/projex/${testPlanIdentifier}/result/list/${directoryIdentifier}`
|
|
93
|
+
: `/oapi/v1/projex/organizations/${finalOrgId}/${testPlanIdentifier}/result/list/${directoryIdentifier}`;
|
|
94
|
+
const response = await yunxiaoRequest(url, { method: 'POST', body: {} });
|
|
95
|
+
return GetTestResultListResponseSchema.parse(response);
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
// 如果是 404 错误,尝试使用 testhub API
|
|
99
|
+
if (isYunxiaoError(error) && error.status === 404) {
|
|
100
|
+
const url = isRegionEdition()
|
|
101
|
+
? `/oapi/v1/testhub/${testPlanIdentifier}/result/list/${directoryIdentifier}`
|
|
102
|
+
: `/oapi/v1/testhub/organizations/${finalOrgId}/${testPlanIdentifier}/result/list/${directoryIdentifier}`;
|
|
103
|
+
const response = await yunxiaoRequest(url, { method: 'POST', body: {} });
|
|
104
|
+
return GetTestResultListResponseSchema.parse(response);
|
|
105
|
+
}
|
|
106
|
+
// 其他错误直接抛出
|
|
107
|
+
throw error;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* 更新测试结果
|
|
112
|
+
*/
|
|
113
|
+
export async function updateTestResult(params) {
|
|
114
|
+
const { organizationId, testplanId, testcaseId, executor, status } = params;
|
|
115
|
+
const finalOrgId = await resolveOrganizationId(organizationId);
|
|
116
|
+
const url = isRegionEdition()
|
|
117
|
+
? `/oapi/v1/testhub/testPlans/${testplanId}/testcases/${testcaseId}`
|
|
118
|
+
: `/oapi/v1/testhub/organizations/${finalOrgId}/testPlans/${testplanId}/testcases/${testcaseId}`;
|
|
119
|
+
const body = {};
|
|
120
|
+
if (executor !== undefined) {
|
|
121
|
+
body.executor = executor;
|
|
122
|
+
}
|
|
123
|
+
if (status !== undefined) {
|
|
124
|
+
body.status = status;
|
|
125
|
+
}
|
|
126
|
+
const response = await yunxiaoRequest(url, { method: 'PUT', body });
|
|
127
|
+
return UpdateTestResultResponseSchema.parse(response);
|
|
128
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { listAllReleaseWorkflows, listAllReleaseWorkflowBriefs, getReleaseWorkflowStage, listAllReleaseStageBriefs, updateAppReleaseStage, listAppReleaseStageRuns, executeChangeRequestReleaseStage, cancelExecutionReleaseStage, retryChangeRequestStagePipeline, skipChangeRequestStagePipeline, listAppReleaseStageExecutionIntegratedMetadata, getReleaseStagePipelineRun, passReleaseStagePipelineValidate, getAppReleaseStageExecutionPipelineJobLog, refuseReleaseStagePipelineValidate, ListAllReleaseWorkflowsRequestSchema, ListAllReleaseWorkflowBriefsRequestSchema, GetReleaseWorkflowStageRequestSchema, ListAllReleaseStageBriefsRequestSchema, UpdateAppReleaseStageRequestSchema, ListAppReleaseStageRunsRequestSchema, ExecuteChangeRequestReleaseStageRequestSchema, CancelExecutionReleaseStageRequestSchema, RetryChangeRequestStagePipelineRequestSchema, SkipChangeRequestStagePipelineRequestSchema, ListAppReleaseStageExecutionIntegratedMetadataRequestSchema, GetReleaseStagePipelineRunRequestSchema, PassReleaseStagePipelineValidateRequestSchema, GetAppReleaseStageExecutionPipelineJobLogRequestSchema, RefuseReleaseStagePipelineValidateRequestSchema } from '../operations/appstack/releaseWorkflows.js';
|
|
2
|
+
/**
|
|
3
|
+
* Handle the appstack app release workflow tool requests (application level)
|
|
4
|
+
*
|
|
5
|
+
* @param request - The tool request
|
|
6
|
+
* @returns The tool response or null if not handled
|
|
7
|
+
*/
|
|
8
|
+
export async function handleAppStackAppReleaseWorkflowTools(request) {
|
|
9
|
+
switch (request.params.name) {
|
|
10
|
+
case 'list_app_release_workflows':
|
|
11
|
+
const listParams = ListAllReleaseWorkflowsRequestSchema.parse(request.params.arguments);
|
|
12
|
+
const listResult = await listAllReleaseWorkflows(listParams);
|
|
13
|
+
return {
|
|
14
|
+
content: [{ type: "text", text: JSON.stringify(listResult, null, 2) }],
|
|
15
|
+
};
|
|
16
|
+
case 'list_app_release_workflow_briefs':
|
|
17
|
+
const listBriefsParams = ListAllReleaseWorkflowBriefsRequestSchema.parse(request.params.arguments);
|
|
18
|
+
const listBriefsResult = await listAllReleaseWorkflowBriefs(listBriefsParams);
|
|
19
|
+
return {
|
|
20
|
+
content: [{ type: "text", text: JSON.stringify(listBriefsResult, null, 2) }],
|
|
21
|
+
};
|
|
22
|
+
case 'get_app_release_workflow_stage':
|
|
23
|
+
const getStageParams = GetReleaseWorkflowStageRequestSchema.parse(request.params.arguments);
|
|
24
|
+
const getStageResult = await getReleaseWorkflowStage(getStageParams);
|
|
25
|
+
return {
|
|
26
|
+
content: [{ type: "text", text: JSON.stringify(getStageResult, null, 2) }],
|
|
27
|
+
};
|
|
28
|
+
case 'list_app_release_stage_briefs':
|
|
29
|
+
const listStageBriefsParams = ListAllReleaseStageBriefsRequestSchema.parse(request.params.arguments);
|
|
30
|
+
const listStageBriefsResult = await listAllReleaseStageBriefs(listStageBriefsParams);
|
|
31
|
+
return {
|
|
32
|
+
content: [{ type: "text", text: JSON.stringify(listStageBriefsResult, null, 2) }],
|
|
33
|
+
};
|
|
34
|
+
case 'update_app_release_stage':
|
|
35
|
+
const updateParams = UpdateAppReleaseStageRequestSchema.parse(request.params.arguments);
|
|
36
|
+
const updateResult = await updateAppReleaseStage(updateParams);
|
|
37
|
+
return {
|
|
38
|
+
content: [{ type: "text", text: JSON.stringify(updateResult, null, 2) }],
|
|
39
|
+
};
|
|
40
|
+
case 'list_app_release_stage_runs':
|
|
41
|
+
const listRunsParams = ListAppReleaseStageRunsRequestSchema.parse(request.params.arguments);
|
|
42
|
+
const listRunsResult = await listAppReleaseStageRuns(listRunsParams);
|
|
43
|
+
return {
|
|
44
|
+
content: [{ type: "text", text: JSON.stringify(listRunsResult, null, 2) }],
|
|
45
|
+
};
|
|
46
|
+
case 'execute_app_release_stage':
|
|
47
|
+
const executeParams = ExecuteChangeRequestReleaseStageRequestSchema.parse(request.params.arguments);
|
|
48
|
+
const executeResult = await executeChangeRequestReleaseStage(executeParams);
|
|
49
|
+
return {
|
|
50
|
+
content: [{ type: "text", text: JSON.stringify(executeResult, null, 2) }],
|
|
51
|
+
};
|
|
52
|
+
case 'cancel_app_release_stage_execution':
|
|
53
|
+
const cancelParams = CancelExecutionReleaseStageRequestSchema.parse(request.params.arguments);
|
|
54
|
+
const cancelResult = await cancelExecutionReleaseStage(cancelParams);
|
|
55
|
+
return {
|
|
56
|
+
content: [{ type: "text", text: JSON.stringify(cancelResult, null, 2) }],
|
|
57
|
+
};
|
|
58
|
+
case 'retry_app_release_stage_pipeline':
|
|
59
|
+
const retryParams = RetryChangeRequestStagePipelineRequestSchema.parse(request.params.arguments);
|
|
60
|
+
const retryResult = await retryChangeRequestStagePipeline(retryParams);
|
|
61
|
+
return {
|
|
62
|
+
content: [{ type: "text", text: JSON.stringify(retryResult, null, 2) }],
|
|
63
|
+
};
|
|
64
|
+
case 'skip_app_release_stage_pipeline':
|
|
65
|
+
const skipParams = SkipChangeRequestStagePipelineRequestSchema.parse(request.params.arguments);
|
|
66
|
+
const skipResult = await skipChangeRequestStagePipeline(skipParams);
|
|
67
|
+
return {
|
|
68
|
+
content: [{ type: "text", text: JSON.stringify(skipResult, null, 2) }],
|
|
69
|
+
};
|
|
70
|
+
case 'list_app_release_stage_metadata':
|
|
71
|
+
const listMetadataParams = ListAppReleaseStageExecutionIntegratedMetadataRequestSchema.parse(request.params.arguments);
|
|
72
|
+
const listMetadataResult = await listAppReleaseStageExecutionIntegratedMetadata(listMetadataParams);
|
|
73
|
+
return {
|
|
74
|
+
content: [{ type: "text", text: JSON.stringify(listMetadataResult, null, 2) }],
|
|
75
|
+
};
|
|
76
|
+
case 'get_app_release_stage_pipeline_run':
|
|
77
|
+
const getPipelineRunParams = GetReleaseStagePipelineRunRequestSchema.parse(request.params.arguments);
|
|
78
|
+
const getPipelineRunResult = await getReleaseStagePipelineRun(getPipelineRunParams);
|
|
79
|
+
return {
|
|
80
|
+
content: [{ type: "text", text: JSON.stringify(getPipelineRunResult, null, 2) }],
|
|
81
|
+
};
|
|
82
|
+
case 'pass_app_release_stage_validate':
|
|
83
|
+
const passValidateParams = PassReleaseStagePipelineValidateRequestSchema.parse(request.params.arguments);
|
|
84
|
+
const passValidateResult = await passReleaseStagePipelineValidate(passValidateParams);
|
|
85
|
+
return {
|
|
86
|
+
content: [{ type: "text", text: JSON.stringify(passValidateResult, null, 2) }],
|
|
87
|
+
};
|
|
88
|
+
case 'get_app_release_stage_job_log':
|
|
89
|
+
const getJobLogParams = GetAppReleaseStageExecutionPipelineJobLogRequestSchema.parse(request.params.arguments);
|
|
90
|
+
const getJobLogResult = await getAppReleaseStageExecutionPipelineJobLog(getJobLogParams);
|
|
91
|
+
return {
|
|
92
|
+
content: [{ type: "text", text: JSON.stringify(getJobLogResult, null, 2) }],
|
|
93
|
+
};
|
|
94
|
+
case 'refuse_app_release_stage_validate':
|
|
95
|
+
const refuseValidateParams = RefuseReleaseStagePipelineValidateRequestSchema.parse(request.params.arguments);
|
|
96
|
+
const refuseValidateResult = await refuseReleaseStagePipelineValidate(refuseValidateParams);
|
|
97
|
+
return {
|
|
98
|
+
content: [{ type: "text", text: JSON.stringify(refuseValidateResult, null, 2) }],
|
|
99
|
+
};
|
|
100
|
+
default:
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { createChangeOrder, listChangeOrderVersions, getChangeOrder, listChangeOrderJobLogs, findTaskOperationLog, executeJobAction, listChangeOrdersByOrigin, CreateChangeOrderRequestSchema, ListChangeOrderVersionsRequestSchema, GetChangeOrderRequestSchema, ListChangeOrderJobLogsRequestSchema, FindTaskOperationLogRequestSchema, ExecuteJobActionRequestSchema, ListChangeOrdersByOriginRequestSchema } from '../operations/appstack/changeOrders.js';
|
|
2
|
+
/**
|
|
3
|
+
* Handle the appstack change order tool requests
|
|
4
|
+
*
|
|
5
|
+
* @param request - The tool request
|
|
6
|
+
* @returns The tool response or null if not handled
|
|
7
|
+
*/
|
|
8
|
+
export async function handleAppStackChangeOrderTools(request) {
|
|
9
|
+
switch (request.params.name) {
|
|
10
|
+
case 'create_change_order':
|
|
11
|
+
const createParams = CreateChangeOrderRequestSchema.parse(request.params.arguments);
|
|
12
|
+
const createResult = await createChangeOrder(createParams);
|
|
13
|
+
return {
|
|
14
|
+
content: [{ type: "text", text: JSON.stringify(createResult, null, 2) }],
|
|
15
|
+
};
|
|
16
|
+
case 'list_change_order_versions':
|
|
17
|
+
const listVersionsParams = ListChangeOrderVersionsRequestSchema.parse(request.params.arguments);
|
|
18
|
+
const listVersionsResult = await listChangeOrderVersions(listVersionsParams);
|
|
19
|
+
return {
|
|
20
|
+
content: [{ type: "text", text: JSON.stringify(listVersionsResult, null, 2) }],
|
|
21
|
+
};
|
|
22
|
+
case 'get_change_order':
|
|
23
|
+
const getParams = GetChangeOrderRequestSchema.parse(request.params.arguments);
|
|
24
|
+
const getResult = await getChangeOrder(getParams);
|
|
25
|
+
return {
|
|
26
|
+
content: [{ type: "text", text: JSON.stringify(getResult, null, 2) }],
|
|
27
|
+
};
|
|
28
|
+
case 'list_change_order_job_logs':
|
|
29
|
+
const listLogsParams = ListChangeOrderJobLogsRequestSchema.parse(request.params.arguments);
|
|
30
|
+
const listLogsResult = await listChangeOrderJobLogs(listLogsParams);
|
|
31
|
+
return {
|
|
32
|
+
content: [{ type: "text", text: JSON.stringify(listLogsResult, null, 2) }],
|
|
33
|
+
};
|
|
34
|
+
case 'find_task_operation_log':
|
|
35
|
+
const findLogParams = FindTaskOperationLogRequestSchema.parse(request.params.arguments);
|
|
36
|
+
const findLogResult = await findTaskOperationLog(findLogParams);
|
|
37
|
+
return {
|
|
38
|
+
content: [{ type: "text", text: JSON.stringify(findLogResult, null, 2) }],
|
|
39
|
+
};
|
|
40
|
+
case 'execute_job_action':
|
|
41
|
+
const executeParams = ExecuteJobActionRequestSchema.parse(request.params.arguments);
|
|
42
|
+
const executeResult = await executeJobAction(executeParams);
|
|
43
|
+
return {
|
|
44
|
+
content: [{ type: "text", text: JSON.stringify(executeResult, null, 2) }],
|
|
45
|
+
};
|
|
46
|
+
case 'list_change_orders_by_origin':
|
|
47
|
+
const listByOriginParams = ListChangeOrdersByOriginRequestSchema.parse(request.params.arguments);
|
|
48
|
+
const listByOriginResult = await listChangeOrdersByOrigin(listByOriginParams);
|
|
49
|
+
return {
|
|
50
|
+
content: [{ type: "text", text: JSON.stringify(listByOriginResult, null, 2) }],
|
|
51
|
+
};
|
|
52
|
+
default:
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { createChangeRequest, getChangeRequestAuditItems, listChangeRequestExecutions, listChangeRequestWorkItems, cancelChangeRequest, closeChangeRequest, CreateChangeRequestRequestSchema, GetChangeRequestAuditItemsRequestSchema, ListChangeRequestExecutionsRequestSchema, ListChangeRequestWorkItemsRequestSchema, CancelChangeRequestRequestSchema, CloseChangeRequestRequestSchema } from '../operations/appstack/changeRequests.js';
|
|
2
|
+
/**
|
|
3
|
+
* Handle the appstack change requests tool requests
|
|
4
|
+
*
|
|
5
|
+
* @param request - The tool request
|
|
6
|
+
* @returns The tool response or null if not handled
|
|
7
|
+
*/
|
|
8
|
+
export async function handleAppStackChangeRequestTools(request) {
|
|
9
|
+
switch (request.params.name) {
|
|
10
|
+
case 'create_appstack_change_request':
|
|
11
|
+
const createParams = CreateChangeRequestRequestSchema.parse(request.params.arguments);
|
|
12
|
+
const createResult = await createChangeRequest(createParams);
|
|
13
|
+
return {
|
|
14
|
+
content: [{ type: "text", text: JSON.stringify(createResult, null, 2) }],
|
|
15
|
+
};
|
|
16
|
+
case 'get_appstack_change_request_audit_items':
|
|
17
|
+
const getAuditParams = GetChangeRequestAuditItemsRequestSchema.parse(request.params.arguments);
|
|
18
|
+
const getAuditResult = await getChangeRequestAuditItems(getAuditParams);
|
|
19
|
+
return {
|
|
20
|
+
content: [{ type: "text", text: JSON.stringify(getAuditResult, null, 2) }],
|
|
21
|
+
};
|
|
22
|
+
case 'list_appstack_change_request_executions':
|
|
23
|
+
const listExecParams = ListChangeRequestExecutionsRequestSchema.parse(request.params.arguments);
|
|
24
|
+
const listExecResult = await listChangeRequestExecutions(listExecParams);
|
|
25
|
+
return {
|
|
26
|
+
content: [{ type: "text", text: JSON.stringify(listExecResult, null, 2) }],
|
|
27
|
+
};
|
|
28
|
+
case 'list_appstack_change_request_work_items':
|
|
29
|
+
const listWorkParams = ListChangeRequestWorkItemsRequestSchema.parse(request.params.arguments);
|
|
30
|
+
const listWorkResult = await listChangeRequestWorkItems(listWorkParams);
|
|
31
|
+
return {
|
|
32
|
+
content: [{ type: "text", text: JSON.stringify(listWorkResult, null, 2) }],
|
|
33
|
+
};
|
|
34
|
+
case 'cancel_appstack_change_request':
|
|
35
|
+
const cancelParams = CancelChangeRequestRequestSchema.parse(request.params.arguments);
|
|
36
|
+
const cancelResult = await cancelChangeRequest(cancelParams);
|
|
37
|
+
return {
|
|
38
|
+
content: [{ type: "text", text: JSON.stringify(cancelResult, null, 2) }],
|
|
39
|
+
};
|
|
40
|
+
case 'close_appstack_change_request':
|
|
41
|
+
const closeParams = CloseChangeRequestRequestSchema.parse(request.params.arguments);
|
|
42
|
+
const closeResult = await closeChangeRequest(closeParams);
|
|
43
|
+
return {
|
|
44
|
+
content: [{ type: "text", text: JSON.stringify(closeResult, null, 2) }],
|
|
45
|
+
};
|
|
46
|
+
default:
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { getMachineDeployLog, addHostListToHostGroup, addHostListToDeployGroup, GetMachineDeployLogRequestSchema, AddHostListToHostGroupRequestSchema, AddHostListToDeployGroupRequestSchema } from '../operations/appstack/deploymentResources.js';
|
|
2
|
+
/**
|
|
3
|
+
* Handle the appstack deployment resources tool requests
|
|
4
|
+
*
|
|
5
|
+
* @param request - The tool request
|
|
6
|
+
* @returns The tool response or null if not handled
|
|
7
|
+
*/
|
|
8
|
+
export async function handleAppStackDeploymentResourceTools(request) {
|
|
9
|
+
switch (request.params.name) {
|
|
10
|
+
case 'get_machine_deploy_log':
|
|
11
|
+
const getLogParams = GetMachineDeployLogRequestSchema.parse(request.params.arguments);
|
|
12
|
+
const getLogResult = await getMachineDeployLog(getLogParams);
|
|
13
|
+
return {
|
|
14
|
+
content: [{ type: "text", text: JSON.stringify(getLogResult, null, 2) }],
|
|
15
|
+
};
|
|
16
|
+
case 'add_host_list_to_host_group':
|
|
17
|
+
const addHostGroupParams = AddHostListToHostGroupRequestSchema.parse(request.params.arguments);
|
|
18
|
+
const addHostGroupResult = await addHostListToHostGroup(addHostGroupParams);
|
|
19
|
+
return {
|
|
20
|
+
content: [{ type: "text", text: JSON.stringify(addHostGroupResult, null, 2) }],
|
|
21
|
+
};
|
|
22
|
+
case 'add_host_list_to_deploy_group':
|
|
23
|
+
const addDeployGroupParams = AddHostListToDeployGroupRequestSchema.parse(request.params.arguments);
|
|
24
|
+
const addDeployGroupResult = await addHostListToDeployGroup(addDeployGroupParams);
|
|
25
|
+
return {
|
|
26
|
+
content: [{ type: "text", text: JSON.stringify(addDeployGroupResult, null, 2) }],
|
|
27
|
+
};
|
|
28
|
+
default:
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { createGlobalVar, getGlobalVar, updateGlobalVar, listGlobalVars, CreateGlobalVarRequestSchema, GetGlobalVarRequestSchema, UpdateGlobalVarRequestSchema, ListGlobalVarsRequestSchema } from '../operations/appstack/globalVars.js';
|
|
2
|
+
/**
|
|
3
|
+
* Handle the appstack global variables tool requests
|
|
4
|
+
*
|
|
5
|
+
* @param request - The tool request
|
|
6
|
+
* @returns The tool response or null if not handled
|
|
7
|
+
*/
|
|
8
|
+
export async function handleAppStackGlobalVarTools(request) {
|
|
9
|
+
switch (request.params.name) {
|
|
10
|
+
case 'create_global_var':
|
|
11
|
+
const createParams = CreateGlobalVarRequestSchema.parse(request.params.arguments);
|
|
12
|
+
const createResult = await createGlobalVar(createParams);
|
|
13
|
+
return {
|
|
14
|
+
content: [{ type: "text", text: JSON.stringify(createResult, null, 2) }],
|
|
15
|
+
};
|
|
16
|
+
case 'get_global_var':
|
|
17
|
+
const getParams = GetGlobalVarRequestSchema.parse(request.params.arguments);
|
|
18
|
+
const getResult = await getGlobalVar(getParams);
|
|
19
|
+
return {
|
|
20
|
+
content: [{ type: "text", text: JSON.stringify(getResult, null, 2) }],
|
|
21
|
+
};
|
|
22
|
+
case 'update_global_var':
|
|
23
|
+
const updateParams = UpdateGlobalVarRequestSchema.parse(request.params.arguments);
|
|
24
|
+
const updateResult = await updateGlobalVar(updateParams);
|
|
25
|
+
return {
|
|
26
|
+
content: [{ type: "text", text: JSON.stringify(updateResult, null, 2) }],
|
|
27
|
+
};
|
|
28
|
+
case 'list_global_vars':
|
|
29
|
+
const listParams = ListGlobalVarsRequestSchema.parse(request.params.arguments);
|
|
30
|
+
const listResult = await listGlobalVars(listParams);
|
|
31
|
+
return {
|
|
32
|
+
content: [{ type: "text", text: JSON.stringify(listResult, null, 2) }],
|
|
33
|
+
};
|
|
34
|
+
default:
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
}
|