@catchmexz/fedin-vibe-mcp-server 0.1.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 (83) hide show
  1. package/LICENSE +202 -0
  2. package/dist/common/errors.js +69 -0
  3. package/dist/common/modularTemplates.js +483 -0
  4. package/dist/common/pipelineTemplates.js +19 -0
  5. package/dist/common/types.js +42 -0
  6. package/dist/common/utils.js +347 -0
  7. package/dist/common/version.js +1 -0
  8. package/dist/index.js +217 -0
  9. package/dist/operations/appstack/appOrchestrations.js +235 -0
  10. package/dist/operations/appstack/appTags.js +147 -0
  11. package/dist/operations/appstack/appTemplates.js +67 -0
  12. package/dist/operations/appstack/applications.js +154 -0
  13. package/dist/operations/appstack/changeOrders.js +293 -0
  14. package/dist/operations/appstack/changeRequests.js +263 -0
  15. package/dist/operations/appstack/deploymentResources.js +265 -0
  16. package/dist/operations/appstack/globalVars.js +200 -0
  17. package/dist/operations/appstack/releaseWorkflows.js +178 -0
  18. package/dist/operations/appstack/variableGroups.js +216 -0
  19. package/dist/operations/codeup/branches.js +144 -0
  20. package/dist/operations/codeup/changeRequestComments.js +89 -0
  21. package/dist/operations/codeup/changeRequests.js +203 -0
  22. package/dist/operations/codeup/compare.js +26 -0
  23. package/dist/operations/codeup/files.js +483 -0
  24. package/dist/operations/codeup/repositories.js +83 -0
  25. package/dist/operations/codeup/types.js +372 -0
  26. package/dist/operations/flow/hostGroup.js +48 -0
  27. package/dist/operations/flow/pipeline.js +530 -0
  28. package/dist/operations/flow/pipelineJob.js +113 -0
  29. package/dist/operations/flow/serviceConnection.js +23 -0
  30. package/dist/operations/flow/types.js +377 -0
  31. package/dist/operations/git/git-repository.js +334 -0
  32. package/dist/operations/git/index.js +210 -0
  33. package/dist/operations/organization/members.js +94 -0
  34. package/dist/operations/organization/organization.js +73 -0
  35. package/dist/operations/organization/types.js +111 -0
  36. package/dist/operations/packages/artifacts.js +64 -0
  37. package/dist/operations/packages/repositories.js +35 -0
  38. package/dist/operations/packages/types.js +56 -0
  39. package/dist/operations/projex/project.js +206 -0
  40. package/dist/operations/projex/sprint.js +90 -0
  41. package/dist/operations/projex/types.js +390 -0
  42. package/dist/operations/projex/workitem.js +452 -0
  43. package/dist/tool-handlers/appstack-change-orders.js +55 -0
  44. package/dist/tool-handlers/appstack-change-requests.js +49 -0
  45. package/dist/tool-handlers/appstack-deployment-resources.js +43 -0
  46. package/dist/tool-handlers/appstack-global-vars.js +43 -0
  47. package/dist/tool-handlers/appstack-orchestrations.js +49 -0
  48. package/dist/tool-handlers/appstack-tags.js +43 -0
  49. package/dist/tool-handlers/appstack-templates.js +19 -0
  50. package/dist/tool-handlers/appstack-variable-groups.js +55 -0
  51. package/dist/tool-handlers/appstack.js +37 -0
  52. package/dist/tool-handlers/code-management.js +174 -0
  53. package/dist/tool-handlers/git/branch-operations.js +1 -0
  54. package/dist/tool-handlers/git/clone-repository.js +36 -0
  55. package/dist/tool-handlers/git/create-branch.js +26 -0
  56. package/dist/tool-handlers/git/get-repository-status.js +33 -0
  57. package/dist/tool-handlers/git/pull-repository.js +27 -0
  58. package/dist/tool-handlers/git/push-repository.js +37 -0
  59. package/dist/tool-handlers/git/switch-branch.js +25 -0
  60. package/dist/tool-handlers/index.js +43 -0
  61. package/dist/tool-handlers/organization.js +90 -0
  62. package/dist/tool-handlers/packages.js +32 -0
  63. package/dist/tool-handlers/pipeline.js +272 -0
  64. package/dist/tool-handlers/project-management.js +152 -0
  65. package/dist/tool-handlers/service-connections.js +16 -0
  66. package/dist/tool-registry/appstack-change-orders.js +40 -0
  67. package/dist/tool-registry/appstack-change-requests.js +35 -0
  68. package/dist/tool-registry/appstack-deployment-resources.js +30 -0
  69. package/dist/tool-registry/appstack-global-vars.js +30 -0
  70. package/dist/tool-registry/appstack-orchestrations.js +35 -0
  71. package/dist/tool-registry/appstack-tags.js +30 -0
  72. package/dist/tool-registry/appstack-templates.js +10 -0
  73. package/dist/tool-registry/appstack-variable-groups.js +40 -0
  74. package/dist/tool-registry/appstack.js +25 -0
  75. package/dist/tool-registry/code-management.js +89 -0
  76. package/dist/tool-registry/git-repository.js +41 -0
  77. package/dist/tool-registry/index.js +6 -0
  78. package/dist/tool-registry/organization.js +65 -0
  79. package/dist/tool-registry/packages.js +21 -0
  80. package/dist/tool-registry/pipeline.js +157 -0
  81. package/dist/tool-registry/project-management.js +108 -0
  82. package/dist/tool-registry/service-connections.js +10 -0
  83. package/package.json +39 -0
@@ -0,0 +1,90 @@
1
+ import * as organization from '../operations/organization/organization.js';
2
+ import * as members from '../operations/organization/members.js';
3
+ import * as types from '../common/types.js';
4
+ export const handleOrganizationTools = async (request) => {
5
+ switch (request.params.name) {
6
+ case "get_current_organization_info": {
7
+ const currentOrgInfo = await organization.getCurrentOrganizationInfoFunc();
8
+ return {
9
+ content: [{ type: "text", text: JSON.stringify(currentOrgInfo, null, 2) }],
10
+ };
11
+ }
12
+ case "get_user_organizations": {
13
+ const userOrgs = await organization.getUserOrganizationsFunc();
14
+ return {
15
+ content: [{ type: "text", text: JSON.stringify(userOrgs, null, 2) }],
16
+ };
17
+ }
18
+ case "get_current_user": {
19
+ const currentUserInfo = await organization.getCurrentUserFunc();
20
+ return {
21
+ content: [{ type: "text", text: JSON.stringify(currentUserInfo, null, 2) }],
22
+ };
23
+ }
24
+ case "list_organization_departments": {
25
+ const args = types.GetOrganizationDepartmentsSchema.parse(request.params.arguments);
26
+ const departments = await organization.getOrganizationDepartmentsFunc(args.organizationId, args.parentId ?? undefined);
27
+ return {
28
+ content: [{ type: "text", text: JSON.stringify(departments, null, 2) }],
29
+ };
30
+ }
31
+ case "get_organization_department_info": {
32
+ const args = types.GetOrganizationDepartmentInfoSchema.parse(request.params.arguments);
33
+ const departmentInfo = await organization.getOrganizationDepartmentInfoFunc(args.organizationId, args.id);
34
+ return {
35
+ content: [{ type: "text", text: JSON.stringify(departmentInfo, null, 2) }],
36
+ };
37
+ }
38
+ case "get_organization_department_ancestors": {
39
+ const args = types.GetOrganizationDepartmentAncestorsSchema.parse(request.params.arguments);
40
+ const ancestors = await organization.getOrganizationDepartmentAncestorsFunc(args.organizationId, args.id);
41
+ return {
42
+ content: [{ type: "text", text: JSON.stringify(ancestors, null, 2) }],
43
+ };
44
+ }
45
+ case "list_organization_members": {
46
+ const args = types.GetOrganizationMembersSchema.parse(request.params.arguments);
47
+ const orgMembers = await members.getOrganizationMembersFunc(args.organizationId, args.page ?? 1, args.perPage ?? 100);
48
+ return {
49
+ content: [{ type: "text", text: JSON.stringify(orgMembers, null, 2) }]
50
+ };
51
+ }
52
+ case "get_organization_member_info": {
53
+ const args = types.GetOrganizationMemberInfoSchema.parse(request.params.arguments);
54
+ const memberInfo = await members.getOrganizationMemberInfoFunc(args.organizationId, args.memberId);
55
+ return {
56
+ content: [{ type: "text", text: JSON.stringify(memberInfo, null, 2) }]
57
+ };
58
+ }
59
+ case "get_organization_member_info_by_user_id": {
60
+ const args = types.GetOrganizationMemberByUserIdInfoSchema.parse(request.params.arguments);
61
+ const memberInfo = await members.getOrganizationMemberByUserIdInfoFunc(args.organizationId, args.userId);
62
+ return {
63
+ content: [{ type: "text", text: JSON.stringify(memberInfo, null, 2) }]
64
+ };
65
+ }
66
+ case "search_organization_members": {
67
+ const args = types.SearchOrganizationMembersSchema.parse(request.params.arguments);
68
+ const membersResult = await members.searchOrganizationMembersFunc(args.organizationId, args.includeChildren ?? false, args.page ?? 1, args.perPage ?? 100, args.deptIds ?? undefined, args.nextToken ?? undefined, args.query ?? undefined, args.roleIds ?? undefined, args.statuses ?? undefined);
69
+ return {
70
+ content: [{ type: "text", text: JSON.stringify(membersResult, null, 2) }]
71
+ };
72
+ }
73
+ case "list_organization_roles": {
74
+ const args = types.ListOrganizationRolesSchema.parse(request.params.arguments);
75
+ const roles = await organization.listOrganizationRolesFunc(args.organizationId);
76
+ return {
77
+ content: [{ type: "text", text: JSON.stringify(roles, null, 2) }]
78
+ };
79
+ }
80
+ case "get_organization_role": {
81
+ const args = types.GetOrganizationRoleSchema.parse(request.params.arguments);
82
+ const role = await organization.getOrganizationRoleFunc(args.organizationId, args.roleId);
83
+ return {
84
+ content: [{ type: "text", text: JSON.stringify(role, null, 2) }]
85
+ };
86
+ }
87
+ default:
88
+ return null;
89
+ }
90
+ };
@@ -0,0 +1,32 @@
1
+ import * as packageRepositories from '../operations/packages/repositories.js';
2
+ import * as artifacts from '../operations/packages/artifacts.js';
3
+ import * as types from '../common/types.js';
4
+ export const handlePackageManagementTools = async (request) => {
5
+ switch (request.params.name) {
6
+ // Package Repository Operations
7
+ case "list_package_repositories": {
8
+ const args = types.ListPackageRepositoriesSchema.parse(request.params.arguments);
9
+ const packageRepoList = await packageRepositories.listPackageRepositoriesFunc(args.organizationId, args.repoTypes ?? undefined, args.repoCategories ?? undefined, args.perPage, args.page);
10
+ return {
11
+ content: [{ type: "text", text: JSON.stringify(packageRepoList, null, 2) }],
12
+ };
13
+ }
14
+ // Package Artifact Operations
15
+ case "list_artifacts": {
16
+ const args = types.ListArtifactsSchema.parse(request.params.arguments);
17
+ const artifactsList = await artifacts.listArtifactsFunc(args.organizationId, args.repoId, args.repoType, args.page, args.perPage, args.search ?? undefined, args.orderBy, args.sort);
18
+ return {
19
+ content: [{ type: "text", text: JSON.stringify(artifactsList, null, 2) }],
20
+ };
21
+ }
22
+ case "get_artifact": {
23
+ const args = types.GetArtifactSchema.parse(request.params.arguments);
24
+ const artifact = await artifacts.getArtifactFunc(args.organizationId, args.repoId, args.id, args.repoType);
25
+ return {
26
+ content: [{ type: "text", text: JSON.stringify(artifact, null, 2) }],
27
+ };
28
+ }
29
+ default:
30
+ return null;
31
+ }
32
+ };
@@ -0,0 +1,272 @@
1
+ import * as pipeline from '../operations/flow/pipeline.js';
2
+ import * as pipelineJob from '../operations/flow/pipelineJob.js';
3
+ import * as types from '../common/types.js';
4
+ import { z } from 'zod';
5
+ export const handlePipelineTools = async (request) => {
6
+ switch (request.params.name) {
7
+ case "get_pipeline": {
8
+ const args = types.GetPipelineSchema.parse(request.params.arguments);
9
+ const pipelineInfo = await pipeline.getPipelineFunc(args.organizationId, args.pipelineId);
10
+ return {
11
+ content: [{ type: "text", text: JSON.stringify(pipelineInfo, null, 2) }],
12
+ };
13
+ }
14
+ case "list_pipelines": {
15
+ const args = types.ListPipelinesSchema.parse(request.params.arguments);
16
+ const pipelines = await pipeline.listPipelinesFunc(args.organizationId, {
17
+ createStartTime: args.createStartTime,
18
+ createEndTime: args.createEndTime,
19
+ executeStartTime: args.executeStartTime,
20
+ executeEndTime: args.executeEndTime,
21
+ pipelineName: args.pipelineName,
22
+ statusList: args.statusList,
23
+ perPage: args.perPage,
24
+ page: args.page
25
+ });
26
+ return {
27
+ content: [{ type: "text", text: JSON.stringify(pipelines, null, 2) }],
28
+ };
29
+ }
30
+ case "generate_pipeline_yaml": {
31
+ try {
32
+ const args = types.CreatePipelineFromDescriptionSchema.parse(request.params.arguments);
33
+ // 检查必需的参数
34
+ if (!args.buildLanguage) {
35
+ throw new Error("The build language parameter is missing.");
36
+ }
37
+ if (!args.buildTool) {
38
+ throw new Error("The build tool parameter is missing.");
39
+ }
40
+ const yamlContent = await pipeline.generatePipelineYamlFunc({
41
+ buildLanguage: args.buildLanguage,
42
+ buildTool: args.buildTool,
43
+ deployTarget: args.deployTarget,
44
+ // Repository configuration
45
+ repoUrl: args.repoUrl,
46
+ branch: args.branch,
47
+ serviceName: args.serviceName,
48
+ serviceConnectionId: args.serviceConnectionId,
49
+ // Version configuration
50
+ jdkVersion: args.jdkVersion,
51
+ mavenVersion: args.mavenVersion,
52
+ nodeVersion: args.nodeVersion,
53
+ pythonVersion: args.pythonVersion,
54
+ goVersion: args.goVersion,
55
+ // Build configuration
56
+ buildCommand: args.buildCommand,
57
+ testCommand: args.testCommand,
58
+ // Artifact upload configuration
59
+ uploadType: args.uploadType,
60
+ packagesServiceConnection: args.packagesServiceConnection,
61
+ artifactName: args.artifactName,
62
+ artifactVersion: args.artifactVersion,
63
+ packagesRepoId: args.packagesRepoId,
64
+ includePathInArtifact: args.includePathInArtifact,
65
+ // VM deployment configuration
66
+ machineGroupId: args.machineGroupId,
67
+ executeUser: args.executeUser,
68
+ artifactDownloadPath: args.artifactDownloadPath,
69
+ deployCommand: args.deployCommand,
70
+ pauseStrategy: args.pauseStrategy,
71
+ batchNumber: args.batchNumber,
72
+ // Kubernetes deployment configuration
73
+ kubernetesClusterId: args.kubernetesClusterId,
74
+ kubectlVersion: args.kubectlVersion,
75
+ namespace: args.namespace,
76
+ yamlPath: args.yamlPath,
77
+ dockerImage: args.dockerImage,
78
+ });
79
+ return {
80
+ content: [{ type: "text", text: yamlContent }],
81
+ };
82
+ }
83
+ catch (error) {
84
+ if (error instanceof Error && error.message.includes("build language parameter is missing")) {
85
+ throw error; // 重新抛出我们自定义的错误
86
+ }
87
+ if (error instanceof Error && error.message.includes("build tool parameter is missing")) {
88
+ throw error; // 重新抛出我们自定义的错误
89
+ }
90
+ // 处理YAML生成过程中的错误
91
+ if (error instanceof Error) {
92
+ throw new Error(`YAML generation failed: ${error.message}`);
93
+ }
94
+ throw error;
95
+ }
96
+ }
97
+ case "create_pipeline_from_description": {
98
+ try {
99
+ const args = types.CreatePipelineFromDescriptionSchema.parse(request.params.arguments);
100
+ // 检查必需的参数
101
+ if (!args.name) {
102
+ throw new Error("The Pipeline name cannot be empty.");
103
+ }
104
+ if (!args.buildLanguage) {
105
+ throw new Error("The build language parameter is missing.");
106
+ }
107
+ if (!args.buildTool) {
108
+ throw new Error("The build tool parameter is missing.");
109
+ }
110
+ const result = await pipeline.createPipelineWithOptionsFunc(args.organizationId, {
111
+ name: args.name,
112
+ repoUrl: args.repoUrl,
113
+ branch: args.branch,
114
+ serviceConnectionId: args.serviceConnectionId,
115
+ // 技术栈参数
116
+ buildLanguage: args.buildLanguage,
117
+ buildTool: args.buildTool,
118
+ deployTarget: args.deployTarget,
119
+ // 版本相关参数
120
+ jdkVersion: args.jdkVersion,
121
+ mavenVersion: args.mavenVersion,
122
+ nodeVersion: args.nodeVersion,
123
+ pythonVersion: args.pythonVersion,
124
+ goVersion: args.goVersion,
125
+ kubectlVersion: args.kubectlVersion,
126
+ // 构建物上传相关参数
127
+ uploadType: args.uploadType,
128
+ artifactName: args.artifactName,
129
+ artifactVersion: args.artifactVersion,
130
+ packagesServiceConnection: args.packagesServiceConnection,
131
+ packagesRepoId: args.packagesRepoId,
132
+ includePathInArtifact: args.includePathInArtifact,
133
+ // 部署相关参数
134
+ executeUser: args.executeUser,
135
+ artifactDownloadPath: args.artifactDownloadPath,
136
+ machineGroupId: args.machineGroupId,
137
+ pauseStrategy: args.pauseStrategy,
138
+ batchNumber: args.batchNumber,
139
+ kubernetesClusterId: args.kubernetesClusterId,
140
+ yamlPath: args.yamlPath,
141
+ namespace: args.namespace,
142
+ dockerImage: args.dockerImage,
143
+ // 自定义命令
144
+ buildCommand: args.buildCommand,
145
+ testCommand: args.testCommand,
146
+ deployCommand: args.deployCommand,
147
+ });
148
+ return {
149
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
150
+ };
151
+ }
152
+ catch (error) {
153
+ if (error instanceof Error && error.message.includes("Pipeline name cannot be empty")) {
154
+ throw error;
155
+ }
156
+ if (error instanceof Error && error.message.includes("build language parameter is missing")) {
157
+ throw error;
158
+ }
159
+ if (error instanceof Error && error.message.includes("build language tool is missing")) {
160
+ throw error;
161
+ }
162
+ // 处理流水线创建过程中的其他错误
163
+ if (error instanceof Error) {
164
+ throw new Error(`Create pipeline failed: ${error.message}\n Suggestion: Please check whether the organization ID, repository configuration, or other parameters are correct, and if generated YAML to check whether YAML content is invalid.`);
165
+ }
166
+ throw error;
167
+ }
168
+ }
169
+ case "smart_list_pipelines": {
170
+ // Parse arguments using the schema defined in the tool registration
171
+ const args = z.object({
172
+ organizationId: z.string(),
173
+ timeReference: z.string().optional(),
174
+ pipelineName: z.string().optional(),
175
+ statusList: z.string().optional(),
176
+ perPage: z.number().int().optional(),
177
+ page: z.number().int().optional()
178
+ }).parse(request.params.arguments);
179
+ // Call the smart list function
180
+ const pipelines = await pipeline.smartListPipelinesFunc(args.organizationId, args.timeReference, {
181
+ pipelineName: args.pipelineName,
182
+ statusList: args.statusList,
183
+ perPage: args.perPage,
184
+ page: args.page
185
+ });
186
+ return {
187
+ content: [{ type: "text", text: JSON.stringify(pipelines, null, 2) }],
188
+ };
189
+ }
190
+ case "create_pipeline_run": {
191
+ const args = types.CreatePipelineRunSchema.parse(request.params.arguments);
192
+ const runId = await pipeline.createPipelineRunFunc(args.organizationId, args.pipelineId, {
193
+ params: args.params,
194
+ description: args.description,
195
+ branches: args.branches,
196
+ branchMode: args.branchMode,
197
+ releaseBranch: args.releaseBranch,
198
+ createReleaseBranch: args.createReleaseBranch,
199
+ environmentVariables: args.environmentVariables,
200
+ repositories: args.repositories
201
+ });
202
+ return {
203
+ content: [{ type: "text", text: JSON.stringify(runId, null, 2) }],
204
+ };
205
+ }
206
+ case "get_latest_pipeline_run": {
207
+ const args = types.GetLatestPipelineRunSchema.parse(request.params.arguments);
208
+ const pipelineRun = await pipeline.getLatestPipelineRunFunc(args.organizationId, args.pipelineId);
209
+ return {
210
+ content: [{ type: "text", text: JSON.stringify(pipelineRun, null, 2) }],
211
+ };
212
+ }
213
+ case "get_pipeline_run": {
214
+ const args = types.GetPipelineRunSchema.parse(request.params.arguments);
215
+ const pipelineRun = await pipeline.getPipelineRunFunc(args.organizationId, args.pipelineId, args.pipelineRunId);
216
+ return {
217
+ content: [{ type: "text", text: JSON.stringify(pipelineRun, null, 2) }],
218
+ };
219
+ }
220
+ case "list_pipeline_runs": {
221
+ const args = types.ListPipelineRunsSchema.parse(request.params.arguments);
222
+ const pipelineRuns = await pipeline.listPipelineRunsFunc(args.organizationId, args.pipelineId, {
223
+ perPage: args.perPage,
224
+ page: args.page,
225
+ startTime: args.startTime,
226
+ endTime: args.endTime,
227
+ status: args.status,
228
+ triggerMode: args.triggerMode
229
+ });
230
+ return {
231
+ content: [{ type: "text", text: JSON.stringify(pipelineRuns, null, 2) }],
232
+ };
233
+ }
234
+ case "list_pipeline_jobs_by_category": {
235
+ const args = types.ListPipelineJobsByCategorySchema.parse(request.params.arguments);
236
+ const jobs = await pipelineJob.listPipelineJobsByCategoryFunc(args.organizationId, args.pipelineId, args.category);
237
+ return {
238
+ content: [{ type: "text", text: JSON.stringify(jobs, null, 2) }],
239
+ };
240
+ }
241
+ case "list_pipeline_job_historys": {
242
+ const args = types.ListPipelineJobHistorysSchema.parse(request.params.arguments);
243
+ const jobHistorys = await pipelineJob.listPipelineJobHistorysFunc(args.organizationId, args.pipelineId, args.category, args.identifier, args.page, args.perPage);
244
+ return {
245
+ content: [{ type: "text", text: JSON.stringify(jobHistorys, null, 2) }],
246
+ };
247
+ }
248
+ case "execute_pipeline_job_run": {
249
+ const args = types.ExecutePipelineJobRunSchema.parse(request.params.arguments);
250
+ const result = await pipelineJob.executePipelineJobRunFunc(args.organizationId, args.pipelineId, args.pipelineRunId, args.jobId);
251
+ return {
252
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
253
+ };
254
+ }
255
+ case "get_pipeline_job_run_log": {
256
+ const args = types.GetPipelineJobRunLogSchema.parse(request.params.arguments);
257
+ const log = await pipelineJob.getPipelineJobRunLogFunc(args.organizationId, args.pipelineId, args.pipelineRunId, args.jobId);
258
+ return {
259
+ content: [{ type: "text", text: JSON.stringify(log, null, 2) }],
260
+ };
261
+ }
262
+ case "update_pipeline": {
263
+ const args = types.UpdatePipelineSchema.parse(request.params.arguments);
264
+ const result = await pipeline.updatePipelineFunc(args.organizationId, args.pipelineId, args.name, args.content);
265
+ return {
266
+ content: [{ type: "text", text: JSON.stringify({ success: result }) }]
267
+ };
268
+ }
269
+ default:
270
+ return null;
271
+ }
272
+ };
@@ -0,0 +1,152 @@
1
+ import * as project from '../operations/projex/project.js';
2
+ import * as workitem from '../operations/projex/workitem.js';
3
+ import * as sprint from '../operations/projex/sprint.js';
4
+ import * as types from '../common/types.js';
5
+ import { z } from 'zod';
6
+ export const handleProjectManagementTools = async (request) => {
7
+ switch (request.params.name) {
8
+ // Project Operations
9
+ case "get_project": {
10
+ const args = types.GetProjectSchema.parse(request.params.arguments);
11
+ const projectInfo = await project.getProjectFunc(args.organizationId, args.id);
12
+ return {
13
+ content: [{ type: "text", text: JSON.stringify(projectInfo, null, 2) }],
14
+ };
15
+ }
16
+ case "search_projects": {
17
+ const args = types.SearchProjectsSchema.parse(request.params.arguments);
18
+ const projects = await project.searchProjectsFunc(args.organizationId, args.name ?? undefined, args.status ?? undefined, args.createdAfter ?? undefined, args.createdBefore ?? undefined, args.creator ?? undefined, args.adminUserId ?? undefined, args.logicalStatus ?? undefined, args.advancedConditions ?? undefined, args.extraConditions ?? undefined, args.orderBy, args.page, args.perPage, args.sort, args.scenarioFilter ?? undefined, args.userId ?? undefined);
19
+ return {
20
+ content: [{ type: "text", text: JSON.stringify(projects, null, 2) }],
21
+ };
22
+ }
23
+ // Sprint Operations
24
+ case "get_sprint": {
25
+ const args = types.GetSprintSchema.parse(request.params.arguments);
26
+ const sprintInfo = await sprint.getSprintFunc(args.organizationId, args.projectId, args.id);
27
+ return {
28
+ content: [{ type: "text", text: JSON.stringify(sprintInfo, null, 2) }],
29
+ };
30
+ }
31
+ case "list_sprints": {
32
+ const args = types.ListSprintsSchema.parse(request.params.arguments);
33
+ const sprints = await sprint.listSprintsFunc(args.organizationId, args.id, args.status, args.page, args.perPage);
34
+ return {
35
+ content: [{ type: "text", text: JSON.stringify(sprints, null, 2) }],
36
+ };
37
+ }
38
+ case "create_sprint": {
39
+ const args = types.CreateSprintSchema.parse(request.params.arguments);
40
+ const sprintResult = await sprint.createSprintFunc(args.organizationId, args.projectId, args.name, args.owners, args.startDate, args.endDate, args.description, args.capacityHours);
41
+ return {
42
+ content: [{ type: "text", text: JSON.stringify(sprintResult, null, 2) }],
43
+ };
44
+ }
45
+ case "update_sprint": {
46
+ const args = types.UpdateSprintSchema.parse(request.params.arguments);
47
+ await sprint.updateSprintFunc(args.organizationId, args.projectId, args.id, args.name, args.owners, args.startDate, args.endDate, args.description, args.capacityHours);
48
+ return {
49
+ content: [{ type: "text", text: "Sprint updated successfully" }],
50
+ };
51
+ }
52
+ // Work Item Operations
53
+ case "get_work_item": {
54
+ const args = types.GetWorkItemSchema.parse(request.params.arguments);
55
+ const workItemInfo = await workitem.getWorkItemFunc(args.organizationId, args.workItemId);
56
+ return {
57
+ content: [{ type: "text", text: JSON.stringify(workItemInfo, null, 2) }],
58
+ };
59
+ }
60
+ case "create_work_item": {
61
+ const args = types.CreateWorkItemSchema.parse(request.params.arguments);
62
+ const workItemInfo = await workitem.createWorkItemFunc(args.organizationId, args.assignedTo, args.spaceId, args.subject, args.workitemTypeId, args.customFieldValues, args.description, args.labels, args.parentId, args.participants, args.sprint, args.trackers, args.verifier, args.versions);
63
+ return {
64
+ content: [{ type: "text", text: JSON.stringify(workItemInfo, null, 2) }],
65
+ };
66
+ }
67
+ case "search_workitems": {
68
+ const args = types.SearchWorkitemsSchema.parse(request.params.arguments);
69
+ const workItems = await workitem.searchWorkitemsFunc(args.organizationId, args.category, args.spaceId, args.subject ?? undefined, args.status ?? undefined, args.createdAfter ?? undefined, args.createdBefore ?? undefined, args.updatedAfter ?? undefined, args.updatedBefore ?? undefined, args.creator ?? undefined, args.assignedTo ?? undefined, args.advancedConditions ?? undefined, args.orderBy ?? "gmtCreate", args.includeDetails ?? false);
70
+ return {
71
+ content: [{ type: "text", text: JSON.stringify(workItems, null, 2) }],
72
+ };
73
+ }
74
+ case "get_work_item_types": {
75
+ const args = z.object({
76
+ organizationId: z.string().describe("organization id"),
77
+ id: z.string().describe("project id or space id"),
78
+ category: z.string().describe("Req、Task、Bug etc.")
79
+ }).parse(request.params.arguments);
80
+ const workItemTypes = await workitem.getWorkItemTypesFunc(args.organizationId, args.id, args.category);
81
+ return {
82
+ content: [{ type: "text", text: JSON.stringify(workItemTypes, null, 2) }],
83
+ };
84
+ }
85
+ case "update_work_item": {
86
+ const args = types.UpdateWorkItemSchema.parse(request.params.arguments);
87
+ await workitem.updateWorkItemFunc(args.organizationId, args.workItemId, args.updateWorkItemFields);
88
+ return {
89
+ content: [{ type: "text", text: "" }],
90
+ };
91
+ }
92
+ // Work Item Type Operations
93
+ case "list_all_work_item_types": {
94
+ const args = types.ListAllWorkItemTypesSchema.parse(request.params.arguments);
95
+ const workItemTypes = await workitem.listAllWorkItemTypesFunc(args.organizationId);
96
+ return {
97
+ content: [{ type: "text", text: JSON.stringify(workItemTypes, null, 2) }],
98
+ };
99
+ }
100
+ case "list_work_item_types": {
101
+ const args = types.ListWorkItemTypesSchema.parse(request.params.arguments);
102
+ const workItemTypes = await workitem.listWorkItemTypesFunc(args.organizationId, args.projectId, args.category);
103
+ return {
104
+ content: [{ type: "text", text: JSON.stringify(workItemTypes, null, 2) }],
105
+ };
106
+ }
107
+ case "get_work_item_type": {
108
+ const args = types.GetWorkItemTypeSchema.parse(request.params.arguments);
109
+ const workItemType = await workitem.getWorkItemTypeFunc(args.organizationId, args.id);
110
+ return {
111
+ content: [{ type: "text", text: JSON.stringify(workItemType, null, 2) }],
112
+ };
113
+ }
114
+ case "list_work_item_relation_work_item_types": {
115
+ const args = types.ListWorkItemRelationWorkItemTypesSchema.parse(request.params.arguments);
116
+ const workItemTypes = await workitem.listWorkItemRelationWorkItemTypesFunc(args.organizationId, args.workItemTypeId, args.relationType);
117
+ return {
118
+ content: [{ type: "text", text: JSON.stringify(workItemTypes, null, 2) }],
119
+ };
120
+ }
121
+ case "get_work_item_type_field_config": {
122
+ const args = types.GetWorkItemTypeFieldConfigSchema.parse(request.params.arguments);
123
+ const fieldConfig = await workitem.getWorkItemTypeFieldConfigFunc(args.organizationId, args.projectId, args.workItemTypeId);
124
+ return {
125
+ content: [{ type: "text", text: JSON.stringify(fieldConfig, null, 2) }],
126
+ };
127
+ }
128
+ case "get_work_item_workflow": {
129
+ const args = types.GetWorkItemWorkflowSchema.parse(request.params.arguments);
130
+ const workflow = await workitem.getWorkItemWorkflowFunc(args.organizationId, args.projectId, args.workItemTypeId);
131
+ return {
132
+ content: [{ type: "text", text: JSON.stringify(workflow, null, 2) }],
133
+ };
134
+ }
135
+ case "list_work_item_comments": {
136
+ const args = types.ListWorkItemCommentsSchema.parse(request.params.arguments);
137
+ const comments = await workitem.listWorkItemCommentsFunc(args.organizationId, args.workItemId, args.page, args.perPage);
138
+ return {
139
+ content: [{ type: "text", text: JSON.stringify(comments, null, 2) }],
140
+ };
141
+ }
142
+ case "create_work_item_comment": {
143
+ const args = types.CreateWorkItemCommentSchema.parse(request.params.arguments);
144
+ const comment = await workitem.createWorkItemCommentFunc(args.organizationId, args.workItemId, args.content);
145
+ return {
146
+ content: [{ type: "text", text: JSON.stringify(comment, null, 2) }],
147
+ };
148
+ }
149
+ default:
150
+ return null;
151
+ }
152
+ };
@@ -0,0 +1,16 @@
1
+ import * as serviceConnection from '../operations/flow/serviceConnection.js';
2
+ import * as types from '../common/types.js';
3
+ export const handleServiceConnectionTools = async (request) => {
4
+ switch (request.params.name) {
5
+ // Service Connection Operations
6
+ case "list_service_connections": {
7
+ const args = types.ListServiceConnectionsSchema.parse(request.params.arguments);
8
+ const serviceConnections = await serviceConnection.listServiceConnectionsFunc(args.organizationId, args.serviceConnectionType);
9
+ return {
10
+ content: [{ type: "text", text: JSON.stringify(serviceConnections, null, 2) }],
11
+ };
12
+ }
13
+ default:
14
+ return null;
15
+ }
16
+ };
@@ -0,0 +1,40 @@
1
+ import { zodToJsonSchema } from 'zod-to-json-schema';
2
+ import { CreateChangeOrderRequestSchema, ListChangeOrderVersionsRequestSchema, GetChangeOrderRequestSchema, ListChangeOrderJobLogsRequestSchema, FindTaskOperationLogRequestSchema, ExecuteJobActionRequestSchema, ListChangeOrdersByOriginRequestSchema } from '../operations/appstack/changeOrders.js';
3
+ // Export all appstack change order tools
4
+ export const getAppStackChangeOrderTools = () => [
5
+ {
6
+ name: 'create_change_order',
7
+ description: '[application delivery] 创建部署单',
8
+ inputSchema: zodToJsonSchema(CreateChangeOrderRequestSchema),
9
+ },
10
+ {
11
+ name: 'list_change_order_versions',
12
+ description: '[application delivery] 查看部署单版本列表',
13
+ inputSchema: zodToJsonSchema(ListChangeOrderVersionsRequestSchema),
14
+ },
15
+ {
16
+ name: 'get_change_order',
17
+ description: '[application delivery] 读取部署单使用的物料和工单状态',
18
+ inputSchema: zodToJsonSchema(GetChangeOrderRequestSchema),
19
+ },
20
+ {
21
+ name: 'list_change_order_job_logs',
22
+ description: '[application delivery] 查询环境部署单日志',
23
+ inputSchema: zodToJsonSchema(ListChangeOrderJobLogsRequestSchema),
24
+ },
25
+ {
26
+ name: 'find_task_operation_log',
27
+ description: '[application delivery] 查询部署任务执行日志,其中通常包含下游部署引擎的调度细节信息',
28
+ inputSchema: zodToJsonSchema(FindTaskOperationLogRequestSchema),
29
+ },
30
+ {
31
+ name: 'execute_job_action',
32
+ description: '[application delivery] 操作环境部署单',
33
+ inputSchema: zodToJsonSchema(ExecuteJobActionRequestSchema),
34
+ },
35
+ {
36
+ name: 'list_change_orders_by_origin',
37
+ description: '[application delivery] 根据创建来源查询部署单',
38
+ inputSchema: zodToJsonSchema(ListChangeOrdersByOriginRequestSchema),
39
+ }
40
+ ];
@@ -0,0 +1,35 @@
1
+ import { zodToJsonSchema } from 'zod-to-json-schema';
2
+ import { CreateChangeRequestRequestSchema, GetChangeRequestAuditItemsRequestSchema, ListChangeRequestExecutionsRequestSchema, ListChangeRequestWorkItemsRequestSchema, CancelChangeRequestRequestSchema, CloseChangeRequestRequestSchema } from '../operations/appstack/changeRequests.js';
3
+ // Export all appstack change requests tools
4
+ export const getAppStackChangeRequestTools = () => [
5
+ {
6
+ name: 'create_appstack_change_request',
7
+ description: '[application delivery] Create a change request',
8
+ inputSchema: zodToJsonSchema(CreateChangeRequestRequestSchema),
9
+ },
10
+ {
11
+ name: 'get_change_request_audit_items',
12
+ description: '[application delivery] Get audit items for a change request',
13
+ inputSchema: zodToJsonSchema(GetChangeRequestAuditItemsRequestSchema),
14
+ },
15
+ {
16
+ name: 'list_change_request_executions',
17
+ description: '[application delivery] List change request executions',
18
+ inputSchema: zodToJsonSchema(ListChangeRequestExecutionsRequestSchema),
19
+ },
20
+ {
21
+ name: 'list_change_request_work_items',
22
+ description: '[application delivery] List work items for a change request',
23
+ inputSchema: zodToJsonSchema(ListChangeRequestWorkItemsRequestSchema),
24
+ },
25
+ {
26
+ name: 'cancel_change_request',
27
+ description: '[application delivery] Cancel a change request',
28
+ inputSchema: zodToJsonSchema(CancelChangeRequestRequestSchema),
29
+ },
30
+ {
31
+ name: 'close_change_request',
32
+ description: '[application delivery] Close a change request',
33
+ inputSchema: zodToJsonSchema(CloseChangeRequestRequestSchema),
34
+ }
35
+ ];