@catchmexz/fedin-vibe-mcp-server 0.1.1 → 0.1.2

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/dist/index.js CHANGED
@@ -68,7 +68,8 @@ async function getRepositoryIdWithPat(pat) {
68
68
  const query = `
69
69
  SELECT
70
70
  c.*,
71
- ch.pat
71
+ ch.pat,
72
+ ch.id as project_id
72
73
  FROM
73
74
  schema_dev.codeup AS c
74
75
  INNER JOIN
@@ -90,7 +91,10 @@ async function getRepositoryIdWithPat(pat) {
90
91
  });
91
92
  const data = await response.json();
92
93
  if (data.length > 0) {
93
- return data[0].repositoryId;
94
+ return {
95
+ repositoryId: data[0].repositoryId,
96
+ projectId: data[0].project_id
97
+ };
94
98
  }
95
99
  else {
96
100
  throw new Error("pat密钥无效:未找到对应的repositoryId");
@@ -119,11 +123,12 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
119
123
  if (!pat) {
120
124
  throw new Error("缺少项目访问令牌project-pat");
121
125
  }
122
- const repositoryId = await getRepositoryIdWithPat(pat);
126
+ const { repositoryId, projectId } = await getRepositoryIdWithPat(pat);
123
127
  if (!repositoryId) {
124
128
  throw new Error("获取repositoryId失败");
125
129
  }
126
130
  request.params.arguments.repositoryId = repositoryId;
131
+ request.params.arguments.projectId = projectId;
127
132
  // Delegate to our modular tool handler
128
133
  return await handleToolRequest(request);
129
134
  }
@@ -248,7 +248,7 @@ export async function createFileFunc(organizationId, repositoryId, filePath, con
248
248
  });
249
249
  return CreateFileResponseSchema.parse(response);
250
250
  }
251
- export async function pushFilesFunc(organizationId, repositoryId, commitMessage, projectPath) {
251
+ export async function pushFilesFunc(organizationId, repositoryId, commitMessage, projectPath, projectId) {
252
252
  // 读取 .gitignore 模式
253
253
  // const ignorePatterns = readGitignore(projectPath);
254
254
  const ignorePatterns = [
@@ -267,6 +267,21 @@ export async function pushFilesFunc(organizationId, repositoryId, commitMessage,
267
267
  ];
268
268
  // 获取所有文件
269
269
  const files = getAllFiles(projectPath, ignorePatterns);
270
+ // 检测项目类型
271
+ let projectType = "default"; // 默认值
272
+ // 检查是否存在 Next.js 配置文件
273
+ const hasNextConfig = files.some(file => file.path === 'next.config.js' ||
274
+ file.path === 'next.config.ts');
275
+ // 检查是否存在 Vite 配置文件
276
+ const hasViteConfig = files.some(file => file.path === 'vite.config.js' ||
277
+ file.path === 'vite.config.ts');
278
+ // 根据配置文件设置项目类型
279
+ if (hasNextConfig) {
280
+ projectType = "fc";
281
+ }
282
+ else if (hasViteConfig) {
283
+ projectType = "oss";
284
+ }
270
285
  const remoteFileList = await listFilesFunc(organizationId, repositoryId, undefined, "master", "RECURSIVE");
271
286
  const remoteFilePathArr = remoteFileList.map((i) => i.path);
272
287
  const shouldCreateFiles = files.filter((file) => !remoteFilePathArr.includes(file.path));
@@ -308,13 +323,36 @@ export async function pushFilesFunc(organizationId, repositoryId, commitMessage,
308
323
  deleteFileErrors.push(error.message);
309
324
  }
310
325
  }
326
+ const pipelineResponse = await fetch('https://ai.fedin.cn/api/alicloud/create-pipeline-run', {
327
+ method: "POST",
328
+ body: JSON.stringify({
329
+ name: projectId,
330
+ projectId: projectId,
331
+ repoUrl: `https://codeup.aliyun.com/ctrod/fedin-ai-project/${projectId}.git`,
332
+ projectType,
333
+ organizationId: organizationId,
334
+ token: process.env.YUNXIAO_ACCESS_TOKEN
335
+ }),
336
+ headers: {
337
+ "Content-Type": "application/json",
338
+ token: "fedin_ac_9x7k2m8p4w6q1z5n3v7b9c2e8r4t6"
339
+ }
340
+ });
341
+ const pipelineResult = await pipelineResponse.json();
342
+ let onlineUrl;
343
+ if (pipelineResult.success && pipelineResult.data?.onlineUrl) {
344
+ onlineUrl = pipelineResult.data.onlineUrl;
345
+ }
311
346
  return {
312
- createFilesSuccess,
313
- createFileErrors,
314
- updateFilesSuccess,
315
- updateFileErrors,
316
- deleteFilesSuccess,
317
- deleteFileErrors
347
+ pushResult: {
348
+ createFilesSuccess,
349
+ createFileErrors,
350
+ updateFilesSuccess,
351
+ updateFileErrors,
352
+ deleteFilesSuccess,
353
+ deleteFileErrors,
354
+ },
355
+ onlineUrl: onlineUrl || ''
318
356
  };
319
357
  }
320
358
  /**
@@ -53,9 +53,11 @@ export const handleCodeManagementTools = async (request) => {
53
53
  }
54
54
  case "push_files": {
55
55
  const args = request.params.arguments;
56
- const result = await files.pushFilesFunc(args.organizationId, args.repositoryId, args.commitMessage, args.projectPath);
56
+ const result = await files.pushFilesFunc(args.organizationId, args.repositoryId, args.commitMessage, args.projectPath, args.projectId);
57
+ const returnText = `项目部署地址:${result.onlineUrl}\n文件推送结果:${JSON.stringify(result.pushResult)}
58
+ `;
57
59
  return {
58
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }]
60
+ content: [{ type: "text", text: returnText }]
59
61
  };
60
62
  }
61
63
  case "pull_files": {
@@ -2,11 +2,6 @@ import { zodToJsonSchema } from 'zod-to-json-schema';
2
2
  import * as types from '../common/types.js';
3
3
  export const getCodeManagementTools = () => [
4
4
  // Branch Operations
5
- {
6
- name: "create_branch",
7
- description: "[Code Management] Create a new branch in a Codeup repository",
8
- inputSchema: zodToJsonSchema(types.CreateBranchSchema),
9
- },
10
5
  {
11
6
  name: "get_branch",
12
7
  description: "[Code Management] Get information about a branch in a Codeup repository",
@@ -34,11 +29,6 @@ export const getCodeManagementTools = () => [
34
29
  inputSchema: zodToJsonSchema(types.PullFilesSchema),
35
30
  },
36
31
  // Repository Operations
37
- {
38
- name: "create_repository",
39
- description: "[Code Management] Create a new repository",
40
- inputSchema: zodToJsonSchema(types.CreateRepositorySchema),
41
- },
42
32
  {
43
33
  name: "get_repository",
44
34
  description: "[Code Management] Get information about a Codeup repository",
@@ -66,16 +56,6 @@ export const getCodeManagementTools = () => [
66
56
  description: "[Code Management] List change requests",
67
57
  inputSchema: zodToJsonSchema(types.ListChangeRequestsSchema),
68
58
  },
69
- {
70
- name: "create_change_request",
71
- description: "[Code Management] Create a new change request",
72
- inputSchema: zodToJsonSchema(types.CreateChangeRequestSchema),
73
- },
74
- {
75
- name: "create_change_request_comment",
76
- description: "[Code Management] Create a comment on a change request",
77
- inputSchema: zodToJsonSchema(types.CreateChangeRequestCommentSchema),
78
- },
79
59
  {
80
60
  name: "list_change_request_comments",
81
61
  description: "[Code Management] List comments on a change request",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@catchmexz/fedin-vibe-mcp-server",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "publishConfig": {