@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.
- package/LICENSE +202 -0
- package/dist/common/errors.js +69 -0
- package/dist/common/modularTemplates.js +483 -0
- package/dist/common/pipelineTemplates.js +19 -0
- package/dist/common/types.js +42 -0
- package/dist/common/utils.js +347 -0
- package/dist/common/version.js +1 -0
- package/dist/index.js +217 -0
- package/dist/operations/appstack/appOrchestrations.js +235 -0
- package/dist/operations/appstack/appTags.js +147 -0
- package/dist/operations/appstack/appTemplates.js +67 -0
- package/dist/operations/appstack/applications.js +154 -0
- package/dist/operations/appstack/changeOrders.js +293 -0
- package/dist/operations/appstack/changeRequests.js +263 -0
- package/dist/operations/appstack/deploymentResources.js +265 -0
- package/dist/operations/appstack/globalVars.js +200 -0
- package/dist/operations/appstack/releaseWorkflows.js +178 -0
- package/dist/operations/appstack/variableGroups.js +216 -0
- package/dist/operations/codeup/branches.js +144 -0
- package/dist/operations/codeup/changeRequestComments.js +89 -0
- package/dist/operations/codeup/changeRequests.js +203 -0
- package/dist/operations/codeup/compare.js +26 -0
- package/dist/operations/codeup/files.js +483 -0
- package/dist/operations/codeup/repositories.js +83 -0
- package/dist/operations/codeup/types.js +372 -0
- package/dist/operations/flow/hostGroup.js +48 -0
- package/dist/operations/flow/pipeline.js +530 -0
- package/dist/operations/flow/pipelineJob.js +113 -0
- package/dist/operations/flow/serviceConnection.js +23 -0
- package/dist/operations/flow/types.js +377 -0
- package/dist/operations/git/git-repository.js +334 -0
- package/dist/operations/git/index.js +210 -0
- package/dist/operations/organization/members.js +94 -0
- package/dist/operations/organization/organization.js +73 -0
- package/dist/operations/organization/types.js +111 -0
- package/dist/operations/packages/artifacts.js +64 -0
- package/dist/operations/packages/repositories.js +35 -0
- package/dist/operations/packages/types.js +56 -0
- package/dist/operations/projex/project.js +206 -0
- package/dist/operations/projex/sprint.js +90 -0
- package/dist/operations/projex/types.js +390 -0
- package/dist/operations/projex/workitem.js +452 -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 +43 -0
- package/dist/tool-handlers/appstack-global-vars.js +43 -0
- package/dist/tool-handlers/appstack-orchestrations.js +49 -0
- package/dist/tool-handlers/appstack-tags.js +43 -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/code-management.js +174 -0
- package/dist/tool-handlers/git/branch-operations.js +1 -0
- package/dist/tool-handlers/git/clone-repository.js +36 -0
- package/dist/tool-handlers/git/create-branch.js +26 -0
- package/dist/tool-handlers/git/get-repository-status.js +33 -0
- package/dist/tool-handlers/git/pull-repository.js +27 -0
- package/dist/tool-handlers/git/push-repository.js +37 -0
- package/dist/tool-handlers/git/switch-branch.js +25 -0
- package/dist/tool-handlers/index.js +43 -0
- package/dist/tool-handlers/organization.js +90 -0
- package/dist/tool-handlers/packages.js +32 -0
- package/dist/tool-handlers/pipeline.js +272 -0
- package/dist/tool-handlers/project-management.js +152 -0
- package/dist/tool-handlers/service-connections.js +16 -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 +30 -0
- package/dist/tool-registry/appstack-global-vars.js +30 -0
- package/dist/tool-registry/appstack-orchestrations.js +35 -0
- package/dist/tool-registry/appstack-tags.js +30 -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/code-management.js +89 -0
- package/dist/tool-registry/git-repository.js +41 -0
- package/dist/tool-registry/index.js +6 -0
- package/dist/tool-registry/organization.js +65 -0
- package/dist/tool-registry/packages.js +21 -0
- package/dist/tool-registry/pipeline.js +157 -0
- package/dist/tool-registry/project-management.js +108 -0
- package/dist/tool-registry/service-connections.js +10 -0
- package/package.json +39 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { getLatestOrchestration, listAppOrchestration, createAppOrchestration, deleteAppOrchestration, getAppOrchestration, updateAppOrchestration, GetLatestOrchestrationRequestSchema, ListAppOrchestrationRequestSchema, CreateAppOrchestrationRequestSchema, DeleteAppOrchestrationRequestSchema, GetAppOrchestrationRequestSchema, UpdateAppOrchestrationRequestSchema } from '../operations/appstack/appOrchestrations.js';
|
|
2
|
+
/**
|
|
3
|
+
* Handle the appstack application orchestrations tool requests
|
|
4
|
+
*
|
|
5
|
+
* @param request - The tool request
|
|
6
|
+
* @returns The tool response or null if not handled
|
|
7
|
+
*/
|
|
8
|
+
export async function handleAppStackOrchestrationTools(request) {
|
|
9
|
+
switch (request.params.name) {
|
|
10
|
+
case 'get_latest_orchestration':
|
|
11
|
+
const getLatestParams = GetLatestOrchestrationRequestSchema.parse(request.params.arguments);
|
|
12
|
+
const getLatestResult = await getLatestOrchestration(getLatestParams);
|
|
13
|
+
return {
|
|
14
|
+
content: [{ type: "text", text: JSON.stringify(getLatestResult, null, 2) }],
|
|
15
|
+
};
|
|
16
|
+
case 'list_app_orchestration':
|
|
17
|
+
const listParams = ListAppOrchestrationRequestSchema.parse(request.params.arguments);
|
|
18
|
+
const listResult = await listAppOrchestration(listParams);
|
|
19
|
+
return {
|
|
20
|
+
content: [{ type: "text", text: JSON.stringify(listResult, null, 2) }],
|
|
21
|
+
};
|
|
22
|
+
case 'create_app_orchestration':
|
|
23
|
+
const createParams = CreateAppOrchestrationRequestSchema.parse(request.params.arguments);
|
|
24
|
+
const createResult = await createAppOrchestration(createParams);
|
|
25
|
+
return {
|
|
26
|
+
content: [{ type: "text", text: JSON.stringify(createResult, null, 2) }],
|
|
27
|
+
};
|
|
28
|
+
case 'delete_app_orchestration':
|
|
29
|
+
const deleteParams = DeleteAppOrchestrationRequestSchema.parse(request.params.arguments);
|
|
30
|
+
const deleteResult = await deleteAppOrchestration(deleteParams);
|
|
31
|
+
return {
|
|
32
|
+
content: [{ type: "text", text: JSON.stringify(deleteResult, null, 2) }],
|
|
33
|
+
};
|
|
34
|
+
case 'get_app_orchestration':
|
|
35
|
+
const getAppParams = GetAppOrchestrationRequestSchema.parse(request.params.arguments);
|
|
36
|
+
const getAppResult = await getAppOrchestration(getAppParams);
|
|
37
|
+
return {
|
|
38
|
+
content: [{ type: "text", text: JSON.stringify(getAppResult, null, 2) }],
|
|
39
|
+
};
|
|
40
|
+
case 'update_app_orchestration':
|
|
41
|
+
const updateParams = UpdateAppOrchestrationRequestSchema.parse(request.params.arguments);
|
|
42
|
+
const updateResult = await updateAppOrchestration(updateParams);
|
|
43
|
+
return {
|
|
44
|
+
content: [{ type: "text", text: JSON.stringify(updateResult, null, 2) }],
|
|
45
|
+
};
|
|
46
|
+
default:
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { createAppTag, updateAppTag, deleteAppTag, searchAppTag, updateAppTagBind, CreateAppTagRequestSchema, UpdateAppTagRequestSchema, DeleteAppTagRequestSchema, SearchAppTagRequestSchema, UpdateAppTagBindRequestSchema } from '../operations/appstack/appTags.js';
|
|
2
|
+
/**
|
|
3
|
+
* Handle the appstack tag tool requests
|
|
4
|
+
*
|
|
5
|
+
* @param request - The tool request
|
|
6
|
+
* @returns The tool response or null if not handled
|
|
7
|
+
*/
|
|
8
|
+
export async function handleAppStackTagTools(request) {
|
|
9
|
+
switch (request.params.name) {
|
|
10
|
+
case 'create_app_tag':
|
|
11
|
+
const createParams = CreateAppTagRequestSchema.parse(request.params.arguments);
|
|
12
|
+
const createResult = await createAppTag(createParams);
|
|
13
|
+
return {
|
|
14
|
+
content: [{ type: "text", text: JSON.stringify(createResult, null, 2) }],
|
|
15
|
+
};
|
|
16
|
+
case 'update_app_tag':
|
|
17
|
+
const updateParams = UpdateAppTagRequestSchema.parse(request.params.arguments);
|
|
18
|
+
const updateResult = await updateAppTag(updateParams);
|
|
19
|
+
return {
|
|
20
|
+
content: [{ type: "text", text: JSON.stringify(updateResult, null, 2) }],
|
|
21
|
+
};
|
|
22
|
+
case 'delete_app_tag':
|
|
23
|
+
const deleteParams = DeleteAppTagRequestSchema.parse(request.params.arguments);
|
|
24
|
+
await deleteAppTag(deleteParams);
|
|
25
|
+
return {
|
|
26
|
+
content: [{ type: "text", text: "Application tag deleted successfully" }],
|
|
27
|
+
};
|
|
28
|
+
case 'search_app_tags':
|
|
29
|
+
const searchParams = SearchAppTagRequestSchema.parse(request.params.arguments);
|
|
30
|
+
const searchResult = await searchAppTag(searchParams);
|
|
31
|
+
return {
|
|
32
|
+
content: [{ type: "text", text: JSON.stringify(searchResult, null, 2) }],
|
|
33
|
+
};
|
|
34
|
+
case 'update_app_tag_bind':
|
|
35
|
+
const bindParams = UpdateAppTagBindRequestSchema.parse(request.params.arguments);
|
|
36
|
+
await updateAppTagBind(bindParams);
|
|
37
|
+
return {
|
|
38
|
+
content: [{ type: "text", text: "Application tag bindings updated successfully" }],
|
|
39
|
+
};
|
|
40
|
+
default:
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { searchAppTemplates, SearchAppTemplatesRequestSchema } from '../operations/appstack/appTemplates.js';
|
|
2
|
+
/**
|
|
3
|
+
* Handle the appstack template tool requests
|
|
4
|
+
*
|
|
5
|
+
* @param request - The tool request
|
|
6
|
+
* @returns The tool response or null if not handled
|
|
7
|
+
*/
|
|
8
|
+
export async function handleAppStackTemplateTools(request) {
|
|
9
|
+
switch (request.params.name) {
|
|
10
|
+
case 'search_app_templates':
|
|
11
|
+
const searchParams = SearchAppTemplatesRequestSchema.parse(request.params.arguments);
|
|
12
|
+
const searchResult = await searchAppTemplates(searchParams);
|
|
13
|
+
return {
|
|
14
|
+
content: [{ type: "text", text: JSON.stringify(searchResult, null, 2) }],
|
|
15
|
+
};
|
|
16
|
+
default:
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { getEnvVariableGroups, createVariableGroup, deleteVariableGroup, getVariableGroup, updateVariableGroup, getAppVariableGroups, getAppVariableGroupsRevision, GetEnvVariableGroupsRequestSchema, CreateVariableGroupRequestSchema, DeleteVariableGroupRequestSchema, GetVariableGroupRequestSchema, UpdateVariableGroupRequestSchema, GetAppVariableGroupsRequestSchema, GetAppVariableGroupsRevisionRequestSchema } from '../operations/appstack/variableGroups.js';
|
|
2
|
+
/**
|
|
3
|
+
* Handle the appstack variable groups tool requests
|
|
4
|
+
*
|
|
5
|
+
* @param request - The tool request
|
|
6
|
+
* @returns The tool response or null if not handled
|
|
7
|
+
*/
|
|
8
|
+
export async function handleAppStackVariableGroupTools(request) {
|
|
9
|
+
switch (request.params.name) {
|
|
10
|
+
case 'get_env_variable_groups':
|
|
11
|
+
const getEnvParams = GetEnvVariableGroupsRequestSchema.parse(request.params.arguments);
|
|
12
|
+
const getEnvResult = await getEnvVariableGroups(getEnvParams);
|
|
13
|
+
return {
|
|
14
|
+
content: [{ type: "text", text: JSON.stringify(getEnvResult, null, 2) }],
|
|
15
|
+
};
|
|
16
|
+
case 'create_variable_group':
|
|
17
|
+
const createParams = CreateVariableGroupRequestSchema.parse(request.params.arguments);
|
|
18
|
+
const createResult = await createVariableGroup(createParams);
|
|
19
|
+
return {
|
|
20
|
+
content: [{ type: "text", text: JSON.stringify(createResult, null, 2) }],
|
|
21
|
+
};
|
|
22
|
+
case 'delete_variable_group':
|
|
23
|
+
const deleteParams = DeleteVariableGroupRequestSchema.parse(request.params.arguments);
|
|
24
|
+
const deleteResult = await deleteVariableGroup(deleteParams);
|
|
25
|
+
return {
|
|
26
|
+
content: [{ type: "text", text: JSON.stringify(deleteResult, null, 2) }],
|
|
27
|
+
};
|
|
28
|
+
case 'get_variable_group':
|
|
29
|
+
const getParams = GetVariableGroupRequestSchema.parse(request.params.arguments);
|
|
30
|
+
const getResult = await getVariableGroup(getParams);
|
|
31
|
+
return {
|
|
32
|
+
content: [{ type: "text", text: JSON.stringify(getResult, null, 2) }],
|
|
33
|
+
};
|
|
34
|
+
case 'update_variable_group':
|
|
35
|
+
const updateParams = UpdateVariableGroupRequestSchema.parse(request.params.arguments);
|
|
36
|
+
const updateResult = await updateVariableGroup(updateParams);
|
|
37
|
+
return {
|
|
38
|
+
content: [{ type: "text", text: JSON.stringify(updateResult, null, 2) }],
|
|
39
|
+
};
|
|
40
|
+
case 'get_app_variable_groups':
|
|
41
|
+
const getAppParams = GetAppVariableGroupsRequestSchema.parse(request.params.arguments);
|
|
42
|
+
const getAppResult = await getAppVariableGroups(getAppParams);
|
|
43
|
+
return {
|
|
44
|
+
content: [{ type: "text", text: JSON.stringify(getAppResult, null, 2) }],
|
|
45
|
+
};
|
|
46
|
+
case 'get_app_variable_groups_revision':
|
|
47
|
+
const getAppRevParams = GetAppVariableGroupsRevisionRequestSchema.parse(request.params.arguments);
|
|
48
|
+
const getAppRevResult = await getAppVariableGroupsRevision(getAppRevParams);
|
|
49
|
+
return {
|
|
50
|
+
content: [{ type: "text", text: JSON.stringify(getAppRevResult, null, 2) }],
|
|
51
|
+
};
|
|
52
|
+
default:
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { listApplications, getApplication, createApplication, updateApplication, ListApplicationsRequestSchema, GetApplicationRequestSchema, CreateApplicationRequestSchema, UpdateApplicationRequestSchema } from '../operations/appstack/applications.js';
|
|
2
|
+
/**
|
|
3
|
+
* Handle the appstack tool requests
|
|
4
|
+
*
|
|
5
|
+
* @param request - The tool request
|
|
6
|
+
* @returns The tool response or null if not handled
|
|
7
|
+
*/
|
|
8
|
+
export async function handleAppStackTools(request) {
|
|
9
|
+
switch (request.params.name) {
|
|
10
|
+
case 'list_applications':
|
|
11
|
+
const listParams = ListApplicationsRequestSchema.parse(request.params.arguments);
|
|
12
|
+
const listResult = await listApplications(listParams);
|
|
13
|
+
return {
|
|
14
|
+
content: [{ type: "text", text: JSON.stringify(listResult, null, 2) }],
|
|
15
|
+
};
|
|
16
|
+
case 'get_application':
|
|
17
|
+
const getParams = GetApplicationRequestSchema.parse(request.params.arguments);
|
|
18
|
+
const getResult = await getApplication(getParams);
|
|
19
|
+
return {
|
|
20
|
+
content: [{ type: "text", text: JSON.stringify(getResult, null, 2) }],
|
|
21
|
+
};
|
|
22
|
+
case 'create_application':
|
|
23
|
+
const createParams = CreateApplicationRequestSchema.parse(request.params.arguments);
|
|
24
|
+
const createResult = await createApplication(createParams);
|
|
25
|
+
return {
|
|
26
|
+
content: [{ type: "text", text: JSON.stringify(createResult, null, 2) }],
|
|
27
|
+
};
|
|
28
|
+
case 'update_application':
|
|
29
|
+
const updateParams = UpdateApplicationRequestSchema.parse(request.params.arguments);
|
|
30
|
+
const updateResult = await updateApplication(updateParams);
|
|
31
|
+
return {
|
|
32
|
+
content: [{ type: "text", text: JSON.stringify(updateResult, null, 2) }],
|
|
33
|
+
};
|
|
34
|
+
default:
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import * as branches from "../operations/codeup/branches.js";
|
|
2
|
+
import * as files from "../operations/codeup/files.js";
|
|
3
|
+
import * as repositories from "../operations/codeup/repositories.js";
|
|
4
|
+
import * as changeRequests from "../operations/codeup/changeRequests.js";
|
|
5
|
+
import * as changeRequestComments from "../operations/codeup/changeRequestComments.js";
|
|
6
|
+
import * as compare from "../operations/codeup/compare.js";
|
|
7
|
+
import * as types from "../common/types.js";
|
|
8
|
+
export const handleCodeManagementTools = async (request) => {
|
|
9
|
+
switch (request.params.name) {
|
|
10
|
+
// Branch Operations
|
|
11
|
+
case "create_branch": {
|
|
12
|
+
const args = types.CreateBranchSchema.parse(request.params.arguments);
|
|
13
|
+
const branch = await branches.createBranchFunc(args.organizationId, args.repositoryId, args.branch, args.ref);
|
|
14
|
+
return {
|
|
15
|
+
content: [{ type: "text", text: JSON.stringify(branch, null, 2) }]
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
case "get_branch": {
|
|
19
|
+
const args = types.GetBranchSchema.parse(request.params.arguments);
|
|
20
|
+
const branch = await branches.getBranchFunc(args.organizationId, args.repositoryId, args.branchName);
|
|
21
|
+
return {
|
|
22
|
+
content: [{ type: "text", text: JSON.stringify(branch, null, 2) }]
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
case "delete_branch": {
|
|
26
|
+
const args = types.DeleteBranchSchema.parse(request.params.arguments);
|
|
27
|
+
const result = await branches.deleteBranchFunc(args.organizationId, args.repositoryId, args.branchName);
|
|
28
|
+
return {
|
|
29
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
case "list_branches": {
|
|
33
|
+
const args = types.ListBranchesSchema.parse(request.params.arguments);
|
|
34
|
+
const branchList = await branches.listBranchesFunc(args.organizationId, args.repositoryId, args.page, args.perPage, args.sort, args.search ?? undefined);
|
|
35
|
+
return {
|
|
36
|
+
content: [{ type: "text", text: JSON.stringify(branchList, null, 2) }]
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
// File Operations
|
|
40
|
+
case "get_file_blobs": {
|
|
41
|
+
const args = types.GetFileBlobsSchema.parse(request.params.arguments);
|
|
42
|
+
const fileContent = await files.getFileBlobsFunc(args.organizationId, args.repositoryId, args.filePath, args.ref);
|
|
43
|
+
return {
|
|
44
|
+
content: [{ type: "text", text: JSON.stringify(fileContent, null, 2) }]
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
case "create_file": {
|
|
48
|
+
const args = types.CreateFileSchema.parse(request.params.arguments);
|
|
49
|
+
const result = await files.createFileFunc(args.organizationId, args.repositoryId, args.filePath, args.content, args.commitMessage, args.branch, args.encoding);
|
|
50
|
+
return {
|
|
51
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
case "push_files": {
|
|
55
|
+
const args = request.params.arguments;
|
|
56
|
+
const result = await files.pushFilesFunc(args.organizationId, args.repositoryId, args.commitMessage, args.projectPath);
|
|
57
|
+
return {
|
|
58
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
case "pull_files": {
|
|
62
|
+
const args = request.params.arguments;
|
|
63
|
+
const result = await files.pullFilesFunc(args.organizationId, args.repositoryId, args.currntProjectPath);
|
|
64
|
+
return {
|
|
65
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
case "update_file": {
|
|
69
|
+
const args = types.UpdateFileSchema.parse(request.params.arguments);
|
|
70
|
+
const result = await files.updateFileFunc(args.organizationId, args.repositoryId, args.filePath, args.content, args.commitMessage, args.branch, args.encoding);
|
|
71
|
+
return {
|
|
72
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
case "delete_file": {
|
|
76
|
+
const args = types.DeleteFileSchema.parse(request.params.arguments);
|
|
77
|
+
const result = await files.deleteFileFunc(args.organizationId, args.repositoryId, args.filePath, args.commitMessage, args.branch);
|
|
78
|
+
return {
|
|
79
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
case "list_files": {
|
|
83
|
+
const args = types.ListFilesSchema.parse(request.params.arguments);
|
|
84
|
+
const fileList = await files.listFilesFunc(args.organizationId, args.repositoryId, args.path, args.ref, args.type);
|
|
85
|
+
return {
|
|
86
|
+
content: [{ type: "text", text: JSON.stringify(fileList, null, 2) }]
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
case "compare": {
|
|
90
|
+
const args = types.GetCompareSchema.parse(request.params.arguments);
|
|
91
|
+
const compareResult = await compare.getCompareFunc(args.organizationId, args.repositoryId, args.from, args.to, args.sourceType ?? undefined, args.targetType ?? undefined, args.straight ?? undefined);
|
|
92
|
+
return {
|
|
93
|
+
content: [
|
|
94
|
+
{ type: "text", text: JSON.stringify(compareResult, null, 2) }
|
|
95
|
+
]
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
// Repository Operations
|
|
99
|
+
case "create_repository": {
|
|
100
|
+
const args = types.CreateRepositorySchema.parse(request.params.arguments);
|
|
101
|
+
const repository = await repositories.createRepositoryFunc(args.organizationId, args.name, args.description);
|
|
102
|
+
return {
|
|
103
|
+
content: [{ type: "text", text: JSON.stringify(repository, null, 2) }]
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
case "get_repository": {
|
|
107
|
+
const args = types.GetRepositorySchema.parse(request.params.arguments);
|
|
108
|
+
const repository = await repositories.getRepositoryFunc(args.organizationId, args.repositoryId);
|
|
109
|
+
return {
|
|
110
|
+
content: [{ type: "text", text: JSON.stringify(repository, null, 2) }]
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
case "list_repositories": {
|
|
114
|
+
const args = types.ListRepositoriesSchema.parse(request.params.arguments);
|
|
115
|
+
const repositoryList = await repositories.listRepositoriesFunc(args.organizationId, args.page, args.perPage, args.orderBy, args.sort, args.search ?? undefined, args.archived);
|
|
116
|
+
return {
|
|
117
|
+
content: [
|
|
118
|
+
{ type: "text", text: JSON.stringify(repositoryList, null, 2) }
|
|
119
|
+
]
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
// Change Request Operations
|
|
123
|
+
case "get_change_request": {
|
|
124
|
+
const args = types.GetChangeRequestSchema.parse(request.params.arguments);
|
|
125
|
+
const changeRequest = await changeRequests.getChangeRequestFunc(args.organizationId, args.repositoryId, args.localId);
|
|
126
|
+
return {
|
|
127
|
+
content: [
|
|
128
|
+
{ type: "text", text: JSON.stringify(changeRequest, null, 2) }
|
|
129
|
+
]
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
case "list_change_requests": {
|
|
133
|
+
const args = types.ListChangeRequestsSchema.parse(request.params.arguments);
|
|
134
|
+
const changeRequestList = await changeRequests.listChangeRequestsFunc(args.organizationId, args.page, args.perPage, args.projectIds ?? undefined, args.authorIds ?? undefined, args.reviewerIds ?? undefined, args.state ?? undefined, args.search ?? undefined, args.orderBy, args.sort, args.createdBefore ?? undefined, args.createdAfter ?? undefined);
|
|
135
|
+
return {
|
|
136
|
+
content: [
|
|
137
|
+
{ type: "text", text: JSON.stringify(changeRequestList, null, 2) }
|
|
138
|
+
]
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
case "create_change_request": {
|
|
142
|
+
const args = types.CreateChangeRequestSchema.parse(request.params.arguments);
|
|
143
|
+
const changeRequest = await changeRequests.createChangeRequestFunc(args.organizationId, args.repositoryId, args.title, args.sourceBranch, args.targetBranch, args.description ?? undefined, args.sourceProjectId, args.targetProjectId, args.reviewerUserIds ?? undefined, args.workItemIds ?? undefined, args.createFrom);
|
|
144
|
+
return {
|
|
145
|
+
content: [
|
|
146
|
+
{ type: "text", text: JSON.stringify(changeRequest, null, 2) }
|
|
147
|
+
]
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
case "create_change_request_comment": {
|
|
151
|
+
const args = types.CreateChangeRequestCommentSchema.parse(request.params.arguments);
|
|
152
|
+
const comment = await changeRequestComments.createChangeRequestCommentFunc(args.organizationId, args.repositoryId, args.localId, args.comment_type, args.content, args.draft, args.resolved, args.patchset_biz_id, args.file_path ?? undefined, args.line_number ?? undefined, args.from_patchset_biz_id ?? undefined, args.to_patchset_biz_id ?? undefined, args.parent_comment_biz_id ?? undefined);
|
|
153
|
+
return {
|
|
154
|
+
content: [{ type: "text", text: JSON.stringify(comment, null, 2) }]
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
case "list_change_request_comments": {
|
|
158
|
+
const args = types.ListChangeRequestCommentsSchema.parse(request.params.arguments);
|
|
159
|
+
const comments = await changeRequestComments.listChangeRequestCommentsFunc(args.organizationId, args.repositoryId, args.localId, args.patchSetBizIds ?? undefined, args.commentType, args.state, args.resolved, args.filePath ?? undefined);
|
|
160
|
+
return {
|
|
161
|
+
content: [{ type: "text", text: JSON.stringify(comments, null, 2) }]
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
case "list_change_request_patch_sets": {
|
|
165
|
+
const args = types.ListChangeRequestPatchSetsSchema.parse(request.params.arguments);
|
|
166
|
+
const patchSets = await changeRequests.listChangeRequestPatchSetsFunc(args.organizationId, args.repositoryId, args.localId);
|
|
167
|
+
return {
|
|
168
|
+
content: [{ type: "text", text: JSON.stringify(patchSets, null, 2) }]
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
default:
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
174
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { gitOperations, CloneRepositorySchema } from '../../operations/git/index.js';
|
|
2
|
+
export const cloneRepositoryTool = {
|
|
3
|
+
name: 'clone_repository',
|
|
4
|
+
description: '[Git Operations] 克隆整个代码库到本地',
|
|
5
|
+
inputSchema: CloneRepositorySchema,
|
|
6
|
+
handler: async (args) => {
|
|
7
|
+
try {
|
|
8
|
+
const repo = {
|
|
9
|
+
url: args.repositoryUrl,
|
|
10
|
+
branch: args.branch,
|
|
11
|
+
localPath: args.localPath,
|
|
12
|
+
credentials: args.username && args.password ? {
|
|
13
|
+
username: args.username,
|
|
14
|
+
password: args.password,
|
|
15
|
+
} : undefined,
|
|
16
|
+
};
|
|
17
|
+
const localPath = await gitOperations.cloneRepository(repo);
|
|
18
|
+
return {
|
|
19
|
+
success: true,
|
|
20
|
+
message: '代码库克隆成功',
|
|
21
|
+
data: {
|
|
22
|
+
localPath,
|
|
23
|
+
repositoryUrl: args.repositoryUrl,
|
|
24
|
+
branch: args.branch || 'master',
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
return {
|
|
30
|
+
success: false,
|
|
31
|
+
message: `克隆代码库失败: ${error}`,
|
|
32
|
+
error: error instanceof Error ? error.message : String(error),
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { gitOperations } from '../../operations/git/index.js';
|
|
2
|
+
export async function createBranch(args) {
|
|
3
|
+
try {
|
|
4
|
+
const { organizationId, localPath, branchName, fromBranch } = args;
|
|
5
|
+
if (!localPath) {
|
|
6
|
+
throw new Error('本地路径是必需的');
|
|
7
|
+
}
|
|
8
|
+
if (!branchName) {
|
|
9
|
+
throw new Error('分支名称是必需的');
|
|
10
|
+
}
|
|
11
|
+
await gitOperations.createBranch(localPath, branchName, fromBranch);
|
|
12
|
+
return {
|
|
13
|
+
success: true,
|
|
14
|
+
message: `成功创建分支 ${branchName}`,
|
|
15
|
+
localPath,
|
|
16
|
+
branchName,
|
|
17
|
+
fromBranch: fromBranch || 'current',
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
return {
|
|
22
|
+
success: false,
|
|
23
|
+
error: `创建分支失败: ${error.message}`,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { gitOperations, RepositoryStatusSchema } from '../../operations/git/index.js';
|
|
2
|
+
export const getRepositoryStatusTool = {
|
|
3
|
+
name: 'get_repository_status',
|
|
4
|
+
description: '[Git Operations] 获取本地代码库的状态信息',
|
|
5
|
+
inputSchema: RepositoryStatusSchema,
|
|
6
|
+
handler: async (args) => {
|
|
7
|
+
try {
|
|
8
|
+
const status = await gitOperations.getRepositoryStatus(args.localPath);
|
|
9
|
+
return {
|
|
10
|
+
success: true,
|
|
11
|
+
message: '获取代码库状态成功',
|
|
12
|
+
data: {
|
|
13
|
+
localPath: args.localPath,
|
|
14
|
+
currentBranch: status.currentBranch,
|
|
15
|
+
ahead: status.ahead,
|
|
16
|
+
behind: status.behind,
|
|
17
|
+
modified: status.modified,
|
|
18
|
+
created: status.created,
|
|
19
|
+
deleted: status.deleted,
|
|
20
|
+
recentCommits: status.recentCommits.slice(0, 5), // 只返回最近5个提交
|
|
21
|
+
hasChanges: status.status.files.length > 0,
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
return {
|
|
27
|
+
success: false,
|
|
28
|
+
message: `获取代码库状态失败: ${error}`,
|
|
29
|
+
error: error instanceof Error ? error.message : String(error),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { gitOperations } from '../../operations/git/index.js';
|
|
2
|
+
export async function pullRepository(args) {
|
|
3
|
+
try {
|
|
4
|
+
const { organizationId, localPath, repositoryUrl, branch, username, password } = args;
|
|
5
|
+
if (!localPath) {
|
|
6
|
+
throw new Error('本地路径是必需的');
|
|
7
|
+
}
|
|
8
|
+
const repo = {
|
|
9
|
+
url: repositoryUrl || '',
|
|
10
|
+
branch: branch || 'master',
|
|
11
|
+
credentials: username && password ? { username, password } : undefined,
|
|
12
|
+
};
|
|
13
|
+
await gitOperations.pullRepository(localPath, repo);
|
|
14
|
+
return {
|
|
15
|
+
success: true,
|
|
16
|
+
message: `成功从远程仓库拉取更新到 ${localPath}`,
|
|
17
|
+
localPath,
|
|
18
|
+
branch: branch || 'master',
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
return {
|
|
23
|
+
success: false,
|
|
24
|
+
error: `拉取代码库失败: ${error.message}`,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { gitOperations, PushRepositorySchema } from '../../operations/git/index.js';
|
|
2
|
+
export const pushRepositoryTool = {
|
|
3
|
+
name: 'push_repository',
|
|
4
|
+
description: '[Git Operations] 推送整个代码库的更改到远程仓库',
|
|
5
|
+
inputSchema: PushRepositorySchema,
|
|
6
|
+
handler: async (args) => {
|
|
7
|
+
try {
|
|
8
|
+
const repo = {
|
|
9
|
+
url: args.repositoryUrl,
|
|
10
|
+
branch: args.branch,
|
|
11
|
+
credentials: args.username && args.password ? {
|
|
12
|
+
username: args.username,
|
|
13
|
+
password: args.password,
|
|
14
|
+
} : undefined,
|
|
15
|
+
};
|
|
16
|
+
await gitOperations.pushRepository(args.localPath, repo, args.commitMessage, args.files);
|
|
17
|
+
return {
|
|
18
|
+
success: true,
|
|
19
|
+
message: '代码库推送成功',
|
|
20
|
+
data: {
|
|
21
|
+
localPath: args.localPath,
|
|
22
|
+
repositoryUrl: args.repositoryUrl,
|
|
23
|
+
commitMessage: args.commitMessage,
|
|
24
|
+
branch: args.branch || 'master',
|
|
25
|
+
filesCount: args.files?.length || '所有更改',
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
return {
|
|
31
|
+
success: false,
|
|
32
|
+
message: `推送代码库失败: ${error}`,
|
|
33
|
+
error: error instanceof Error ? error.message : String(error),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { gitOperations } from '../../operations/git/index.js';
|
|
2
|
+
export async function switchBranch(args) {
|
|
3
|
+
try {
|
|
4
|
+
const { organizationId, localPath, branchName } = args;
|
|
5
|
+
if (!localPath) {
|
|
6
|
+
throw new Error('本地路径是必需的');
|
|
7
|
+
}
|
|
8
|
+
if (!branchName) {
|
|
9
|
+
throw new Error('分支名称是必需的');
|
|
10
|
+
}
|
|
11
|
+
await gitOperations.switchBranch(localPath, branchName);
|
|
12
|
+
return {
|
|
13
|
+
success: true,
|
|
14
|
+
message: `成功切换到分支 ${branchName}`,
|
|
15
|
+
localPath,
|
|
16
|
+
branchName,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
return {
|
|
21
|
+
success: false,
|
|
22
|
+
error: `切换分支失败: ${error.message}`,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { handleCodeManagementTools } from './code-management.js';
|
|
2
|
+
import { handleOrganizationTools } from './organization.js';
|
|
3
|
+
import { handleProjectManagementTools } from './project-management.js';
|
|
4
|
+
import { handlePipelineTools } from './pipeline.js';
|
|
5
|
+
import { handlePackageManagementTools } from './packages.js';
|
|
6
|
+
import { handleServiceConnectionTools } from './service-connections.js';
|
|
7
|
+
import { handleAppStackTools } from './appstack.js';
|
|
8
|
+
import { handleAppStackTagTools } from './appstack-tags.js';
|
|
9
|
+
import { handleAppStackTemplateTools } from './appstack-templates.js';
|
|
10
|
+
import { handleAppStackGlobalVarTools } from './appstack-global-vars.js';
|
|
11
|
+
import { handleAppStackVariableGroupTools } from './appstack-variable-groups.js';
|
|
12
|
+
import { handleAppStackOrchestrationTools } from './appstack-orchestrations.js';
|
|
13
|
+
import { handleAppStackChangeRequestTools } from './appstack-change-requests.js';
|
|
14
|
+
import { handleAppStackDeploymentResourceTools } from './appstack-deployment-resources.js';
|
|
15
|
+
import { handleAppStackChangeOrderTools } from './appstack-change-orders.js';
|
|
16
|
+
export const handleToolRequest = async (request) => {
|
|
17
|
+
// Try each handler in sequence until one returns a result
|
|
18
|
+
const handlers = [
|
|
19
|
+
handleCodeManagementTools,
|
|
20
|
+
handleOrganizationTools,
|
|
21
|
+
handleProjectManagementTools,
|
|
22
|
+
handlePipelineTools,
|
|
23
|
+
handlePackageManagementTools,
|
|
24
|
+
handleServiceConnectionTools,
|
|
25
|
+
handleAppStackTools,
|
|
26
|
+
handleAppStackTagTools,
|
|
27
|
+
handleAppStackTemplateTools,
|
|
28
|
+
handleAppStackGlobalVarTools,
|
|
29
|
+
handleAppStackVariableGroupTools,
|
|
30
|
+
handleAppStackOrchestrationTools,
|
|
31
|
+
handleAppStackChangeRequestTools,
|
|
32
|
+
handleAppStackDeploymentResourceTools,
|
|
33
|
+
handleAppStackChangeOrderTools
|
|
34
|
+
];
|
|
35
|
+
for (const handler of handlers) {
|
|
36
|
+
const result = await handler(request);
|
|
37
|
+
if (result !== null) {
|
|
38
|
+
return result;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
// If no handler matched, throw an error
|
|
42
|
+
throw new Error(`Unknown tool: ${request.params.name}`);
|
|
43
|
+
};
|