@zereight/mcp-gitlab 2.3.22-next.205 → 2.3.23-next.208
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/README.ko.md +1 -1
- package/README.md +1 -1
- package/README.pt-BR.md +1 -1
- package/README.zh-CN.md +1 -1
- package/build/index.js +30 -515
- package/build/tools/milestones.js +541 -0
- package/package.json +1 -1
package/README.ko.md
CHANGED
|
@@ -254,7 +254,7 @@ command = lib.getExe inputs.gitlab-mcp.packages.${system}.default;
|
|
|
254
254
|
|
|
255
255
|
예시는 기존 `mcp-gitlab`보다 충돌 가능성이 낮은 `zereight-mcp-gitlab` 별칭을 사용합니다. MCP 클라이언트가 찾지 못하면 `which zereight-mcp-gitlab`의 절대 경로를 사용하세요.
|
|
256
256
|
|
|
257
|
-
전역 설치를 쓰지 않으려면 `npx -y @zereight/mcp-gitlab@2.3.
|
|
257
|
+
전역 설치를 쓰지 않으려면 `npx -y @zereight/mcp-gitlab@2.3.21`처럼 직전 안정 버전(문서가 권장하는 버전)으로 고정하세요. 항상 최신 버전을 원하면 `npx -y @zereight/mcp-gitlab@latest`를 사용하세요. `main`에 머지된 수정을 다음 안정 버전 전에 확인하려면 프리릴리스 빌드인 `npx -y @zereight/mcp-gitlab@next`를 사용하세요(운영 환경용이 아닙니다). 새 버전이 나오면 서버가 시작 시 stderr로 알려줍니다(`GITLAB_DISABLE_VERSION_CHECK=true`로 비활성화 가능).
|
|
258
258
|
|
|
259
259
|
#### Claude Desktop 원클릭 설치(MCP Bundle)
|
|
260
260
|
|
package/README.md
CHANGED
|
@@ -260,7 +260,7 @@ The store path is pinned by your lock file; update it with `nix flake update git
|
|
|
260
260
|
|
|
261
261
|
The examples use `zereight-mcp-gitlab`, a less collision-prone alias for the legacy `mcp-gitlab` binary. If your MCP client cannot find it, use the absolute path from `which zereight-mcp-gitlab`.
|
|
262
262
|
|
|
263
|
-
No global install? Pin `npx` to the previous stable release (the version these docs recommend), for example `npx -y @zereight/mcp-gitlab@2.3.
|
|
263
|
+
No global install? Pin `npx` to the previous stable release (the version these docs recommend), for example `npx -y @zereight/mcp-gitlab@2.3.21`. If you always want the newest release, use `npx -y @zereight/mcp-gitlab@latest` instead. To try a fix merged to `main` before the next stable release, use `npx -y @zereight/mcp-gitlab@next`, a pre-release build that is not meant for production. The server prints a notice to stderr on startup when a newer version is available (disable with `GITLAB_DISABLE_VERSION_CHECK=true`).
|
|
264
264
|
|
|
265
265
|
#### Claude Desktop one-click install (MCP Bundle)
|
|
266
266
|
|
package/README.pt-BR.md
CHANGED
|
@@ -254,7 +254,7 @@ O caminho no store é fixado pelo seu lock file; atualize-o com `nix flake updat
|
|
|
254
254
|
|
|
255
255
|
Os exemplos usam `zereight-mcp-gitlab`, um alias com menor chance de conflito que o binário legado `mcp-gitlab`. Se o seu cliente MCP não o encontrar, use o caminho absoluto retornado por `which zereight-mcp-gitlab`.
|
|
256
256
|
|
|
257
|
-
Não quer instalar globalmente? Fixe o `npx` na versão estável anterior (a versão recomendada por esta documentação), por exemplo `npx -y @zereight/mcp-gitlab@2.3.
|
|
257
|
+
Não quer instalar globalmente? Fixe o `npx` na versão estável anterior (a versão recomendada por esta documentação), por exemplo `npx -y @zereight/mcp-gitlab@2.3.21`. Se quiser sempre a versão mais recente, use `npx -y @zereight/mcp-gitlab@latest`. Para testar uma correção já mesclada na `main` antes da próxima versão estável, use `npx -y @zereight/mcp-gitlab@next`, um build de pré-lançamento que não é indicado para produção. O servidor exibe um aviso no stderr durante a inicialização quando existe uma versão mais nova disponível (desative com `GITLAB_DISABLE_VERSION_CHECK=true`).
|
|
258
258
|
|
|
259
259
|
#### Instalação com um clique no Claude Desktop (MCP Bundle)
|
|
260
260
|
|
package/README.zh-CN.md
CHANGED
|
@@ -254,7 +254,7 @@ command = lib.getExe inputs.gitlab-mcp.packages.${system}.default;
|
|
|
254
254
|
|
|
255
255
|
示例使用 `zereight-mcp-gitlab`,这是比旧的 `mcp-gitlab` 更不容易冲突的别名。如果 MCP 客户端找不到它,请使用 `which zereight-mcp-gitlab` 输出的绝对路径。
|
|
256
256
|
|
|
257
|
-
如果不想全局安装,请将 `npx` 固定到上一个稳定版本(即文档推荐的版本),例如 `npx -y @zereight/mcp-gitlab@2.3.
|
|
257
|
+
如果不想全局安装,请将 `npx` 固定到上一个稳定版本(即文档推荐的版本),例如 `npx -y @zereight/mcp-gitlab@2.3.21`。如果始终想使用最新版本,请改用 `npx -y @zereight/mcp-gitlab@latest`。如需在下一个稳定版本发布前试用已合并到 `main` 的修复,请使用 `npx -y @zereight/mcp-gitlab@next`(预发布版本,不适用于生产环境)。有新版本发布时,服务器会在启动时通过 stderr 提示(可用 `GITLAB_DISABLE_VERSION_CHECK=true` 关闭)。
|
|
258
258
|
|
|
259
259
|
#### Claude Desktop 一键安装(MCP Bundle)
|
|
260
260
|
|
package/build/index.js
CHANGED
|
@@ -133,19 +133,20 @@ import { GitLabClientPool } from "./gitlab-client-pool.js";
|
|
|
133
133
|
import { advertisesReadOnly, allTools, readOnlyTools, destructiveTools, deleteTools, parseEnabledToolsets, parseIndividualTools, buildFeatureFlagOverrides, isToolInEnabledToolset, findSmallestToolsetForTool, isExplicitOnlyToolsetId, isExplicitToolsetOnlyTool, isToolsetFullyActive, listDiscoverableCategories, TOOLSET_DEFINITIONS, DISCOVERABLE_TOOLSET_IDS, } from "./tools/registry.js";
|
|
134
134
|
import { executeGitLabApiRequestAsync, GitLabApiRequestHttpError, GitLabApiRequestInputError, } from "./tools/gitlab-api-request.js";
|
|
135
135
|
import { configureWikiTools, handleWikiToolCall } from "./tools/wiki.js";
|
|
136
|
+
import { configureMilestoneTools, handleMilestoneToolCall } from "./tools/milestones.js";
|
|
136
137
|
import { buildUnavailableToolMessage, isSkippedByDiscoverActivation, } from "./tools/discover-activation.js";
|
|
137
138
|
import { selectCallableHiddenToolNames, selectExposedTools } from "./tools/exposed-tools.js";
|
|
138
139
|
import { createListedToolsCache, decorateToolsForList, } from "./tools/listed-tools.js";
|
|
139
140
|
import { isExcludedBySlimProfile, shouldApplySlimToolProfile } from "./tools/tool-profile.js";
|
|
140
141
|
import { shouldCompactToolResult } from "./utils/compact-tool-allowlist.js";
|
|
141
142
|
import { BulkPublishDraftNotesSchema, CancelPipelineJobSchema, ErasePipelineJobSchema, CancelPipelineSchema, CreateBranchSchema, CreateDraftNoteSchema, CreateIssueLinkSchema, CreateIssueNoteSchema, CreateIssueSchema, CreateIssueEmojiReactionSchema, CreateIssueNoteEmojiReactionSchema, ListIssueEmojiReactionsSchema, ListIssueNoteEmojiReactionsSchema, CreateLabelSchema, // Added
|
|
142
|
-
CreateMergeRequestNoteSchema, CreateMergeRequestDiscussionNoteSchema, CreateMergeRequestEmojiReactionSchema, CreateMergeRequestNoteEmojiReactionSchema, ListMergeRequestEmojiReactionsSchema, ListMergeRequestNoteEmojiReactionsSchema, CreateMergeRequestSchema, CreateMergeRequestThreadSchema, CreateNoteSchema, CreateCommitStatusSchema, CreateOrUpdateFileSchema, CreatePipelineSchema,
|
|
143
|
+
CreateMergeRequestNoteSchema, CreateMergeRequestDiscussionNoteSchema, CreateMergeRequestEmojiReactionSchema, CreateMergeRequestNoteEmojiReactionSchema, ListMergeRequestEmojiReactionsSchema, ListMergeRequestNoteEmojiReactionsSchema, CreateMergeRequestSchema, CreateMergeRequestThreadSchema, CreateNoteSchema, CreateCommitStatusSchema, CreateOrUpdateFileSchema, CreatePipelineSchema, CreateRepositorySchema, CreateGroupSchema, DeleteBranchSchema, GetProtectedBranchSchema, ListProtectedBranchesSchema, ProtectBranchSchema, UpdateProtectedBranchSchema, UnprotectBranchSchema, UpdateDefaultBranchSchema, DeleteDraftNoteSchema, DeleteIssueLinkSchema, DeleteIssueSchema, DeleteIssueEmojiReactionSchema, DeleteIssueNoteEmojiReactionSchema, DeleteLabelSchema, DeleteMergeRequestNoteSchema, DeleteMergeRequestEmojiReactionSchema, DeleteMergeRequestNoteEmojiReactionSchema, ForkRepositorySchema, GetBranchDiffsSchema, GetBranchSchema, GetCommitDiffSchema, GetCommitSchema, GetFileBlameSchema, GitLabBlameEntrySchema, GetDraftNoteSchema, GetFileContentsSchema, GetIssueLinkSchema, GetIssueSchema, GetLabelSchema, GetMergeRequestDiffsSchema, GetMergeRequestSchema, GetDeploymentSchema, CreateDeploymentSchema, UpdateDeploymentSchema, DeploymentApprovalSchema, ListDeploymentMergeRequestsSchema, GetEnvironmentSchema, UpdateEnvironmentSchema, StopEnvironmentSchema, StopStaleEnvironmentsSchema, DeleteReviewAppEnvironmentsSchema, PipelineTriggerIdSchema, ListPipelineTriggersSchema, CreatePipelineTriggerSchema, UpdatePipelineTriggerSchema, TriggerPipelineSchema, GetNamespaceSchema, GitLabCiLintResultSchema, GetPipelineJobOutputSchema, PipelineJobControlSchema, GetPipelineSchema, GetPipelineVariablesSchema, UpdatePipelineMetadataSchema, DeletePipelineSchema, PipelineReportSchema, WaitForPipelineSchema, WaitForPipelineJobSchema, PlayPipelineJobsSchema, GetProjectSchema, GetRepositoryTreeSchema, GetUsersSchema, GetUserSchema, GitLabUserFullSchema, WhoAmISchema, GitLabCurrentUserSchema, GitLabCommitSchema, GitLabCommitStatusSchema, GitLabCompareResultSchema, GitLabContentSchema, GitLabCreateUpdateFileResponseSchema, GitLabDiffSchema,
|
|
143
144
|
// Discussion Schemas
|
|
144
145
|
GitLabDiscussionNoteSchema, // Added
|
|
145
146
|
GitLabDiscussionSchema,
|
|
146
147
|
// Draft Notes Schemas
|
|
147
|
-
GitLabDraftNoteSchema, GitLabForkSchema, GitLabBranchSchema, GitLabProtectedBranchSchema, GitLabProtectedTagSchema, GitLabGroupSchema, GitLabIssueLinkSchema, GitLabIssueSchema, GitLabIssueWithLinkDetailsSchema, GitLabMarkdownUploadSchema, GitLabMergeRequestPipelineSchema, GitLabMergeRequestSchema,
|
|
148
|
-
GetMergeRequestFileDiffSchema, ListMergeRequestChangedFilesSchema, ListMergeRequestDiscussionsSchema, ListMergeRequestPipelinesSchema, ListMergeRequestsSchema, ListGroupMergeRequestsSchema, ListMergeRequestVersionsSchema, GetMergeRequestVersionSchema, GitLabMergeRequestVersionSchema, GitLabMergeRequestVersionDetailSchema, ListNamespacesSchema, ListPipelineJobsSchema, ListPipelinesSchema, ListDeploymentsSchema, ListEnvironmentsSchema, ListProjectRunnersSchema, GetRunnerSchema, ListPipelineTriggerJobsSchema, ValidateCiLintSchema, ValidateProjectCiLintSchema, ListCiCatalogResourcesSchema, GetCiCatalogResourceSchema, ListProjectMembersSchema, ListGroupMembersSchema,
|
|
148
|
+
GitLabDraftNoteSchema, GitLabForkSchema, GitLabBranchSchema, GitLabProtectedBranchSchema, GitLabProtectedTagSchema, GitLabGroupSchema, GitLabIssueLinkSchema, GitLabIssueSchema, GitLabIssueWithLinkDetailsSchema, GitLabMarkdownUploadSchema, GitLabMergeRequestPipelineSchema, GitLabMergeRequestSchema, GitLabNamespaceExistsResponseSchema, GitLabNamespaceSchema, GitLabPipelineJobSchema, GitLabDeploymentSchema, GitLabEnvironmentSchema, GitLabPipelineSchema, GitLabPipelineScheduleSchema, GitLabPipelineScheduleVariableSchema, GitLabPipelineSchedulePlayResultSchema, ListPipelineSchedulesSchema, GetPipelineScheduleSchema, ListPipelineSchedulePipelinesSchema, CreatePipelineScheduleSchema, UpdatePipelineScheduleSchema, DeletePipelineScheduleSchema, PlayPipelineScheduleSchema, TakeOwnershipPipelineScheduleSchema, GetPipelineScheduleVariableSchema, CreatePipelineScheduleVariableSchema, UpdatePipelineScheduleVariableSchema, DeletePipelineScheduleVariableSchema, GitLabPipelineTriggerJobSchema, GitLabProjectMemberSchema, GitLabProjectSchema, GitLabTodoSchema, GitLabReferenceSchema, GitLabRepositorySchema, GitLabSearchBlobResultSchema, GitLabSearchResponseSchema, GitLabTreeItemSchema, GitLabUserSchema, GitLabUsersResponseSchema, GroupIteration, ListCommitStatusesSchema, ListBranchesSchema, ListCommitsSchema, ListDraftNotesSchema, ListGroupIterationsSchema, GetGroupIterationSchema, UpdateGroupIterationSchema, CreateGroupIterationSchema, GroupIterationCadence, ListGroupIterationCadencesSchema, DeleteGroupIterationSchema, ListProjectIterationsSchema, CreateGroupIterationCadenceSchema, UpdateGroupIterationCadenceSchema, DeleteGroupIterationCadenceSchema, ListGroupProjectsSchema, GitLabCiVariableSchema, ListProjectVariablesSchema, GetProjectVariableSchema, CreateProjectVariableSchema, UpdateProjectVariableSchema, DeleteProjectVariableSchema, ListGroupVariablesSchema, GetGroupVariableSchema, CreateGroupVariableSchema, UpdateGroupVariableSchema, DeleteGroupVariableSchema, GitLabDependencyProxySchema, GitLabDependencyProxyBlobSchema, GetDependencyProxySettingsSchema, UpdateDependencyProxySettingsSchema, ListDependencyProxyBlobsSchema, PurgeDependencyProxyCacheSchema, ListProjectVulnerabilitiesSchema, GetVulnerabilitySchema, DismissVulnerabilitySchema, ConfirmVulnerabilitySchema, ListIssueDiscussionsSchema, ListIssueLinksSchema, ListIssuesSchema, ListTodosSchema, ListLabelsSchema, ListMergeRequestDiffsSchema, // Added
|
|
149
|
+
GetMergeRequestFileDiffSchema, ListMergeRequestChangedFilesSchema, ListMergeRequestDiscussionsSchema, ListMergeRequestPipelinesSchema, ListMergeRequestsSchema, ListGroupMergeRequestsSchema, ListMergeRequestVersionsSchema, GetMergeRequestVersionSchema, GitLabMergeRequestVersionSchema, GitLabMergeRequestVersionDetailSchema, ListNamespacesSchema, ListPipelineJobsSchema, ListPipelinesSchema, ListDeploymentsSchema, ListEnvironmentsSchema, ListProjectRunnersSchema, GetRunnerSchema, ListPipelineTriggerJobsSchema, ValidateCiLintSchema, ValidateProjectCiLintSchema, ListCiCatalogResourcesSchema, GetCiCatalogResourceSchema, ListProjectMembersSchema, ListGroupMembersSchema, ListProjectsSchema, MarkdownUploadSchema, MarkdownUploadRemoteSchema, DownloadAttachmentSchema, DownloadJobArtifactsSchema, GetJobArtifactFileSchema, GitLabArtifactEntrySchema, ListJobArtifactsSchema, MergeMergeRequestSchema, ApproveMergeRequestSchema, UnapproveMergeRequestSchema, RebaseMergeRequestSchema, GetMergeRequestApprovalStateSchema, GetMergeRequestConflictsSchema, GitLabMergeRequestApprovalStateSchema, MyIssuesSchema, OrbitQuerySchema, OrbitSchemaSchema, OrbitStatusSchema, OrbitToolsSchema, MarkAllTodosDoneSchema, MarkTodoDoneSchema, PaginatedDiscussionsResponseSchema, PublishDraftNoteSchema, PlayPipelineJobSchema, PushFilesSchema, RetryPipelineJobSchema, RetryPipelineSchema, SearchCodeSchema, SearchGroupCodeSchema, SearchProjectCodeSchema, SearchRepositoriesSchema, UpdateDraftNoteSchema, UpdateIssueNoteSchema, UpdateIssueSchema, UpdateIssueDescriptionPatchSchema, ReorderIssueSchema, UpdateLabelSchema, UpdateProjectSchema, UpdateMergeRequestNoteSchema, UpdateMergeRequestDiscussionNoteSchema, UpdateMergeRequestSchema, VerifyNamespaceSchema, GitLabEventSchema, ListEventsSchema, GetProjectEventsSchema, ExecuteGraphQLSchema, GitLabReleaseSchema, ListReleasesSchema, GetReleaseSchema, CreateReleaseSchema, UpdateReleaseSchema, DeleteReleaseSchema, CreateReleaseEvidenceSchema, DownloadReleaseAssetSchema, ListTagsSchema, GetTagSchema, CreateTagSchema, DeleteTagSchema, GetTagSignatureSchema, ListProtectedTagsSchema, GetProtectedTagSchema, ProtectTagSchema, UnprotectTagSchema, GitLabTagSchema, GitLabTagSignatureSchema, ListSnippetsSchema, GetSnippetSchema, CreateSnippetSchema, UpdateSnippetSchema, DeleteSnippetSchema, GitLabSnippetSchema, GetMergeRequestNotesSchema, GetMergeRequestNoteSchema, GetMergeRequestDiscussionSchema, DeleteMergeRequestDiscussionNoteSchema, ResolveMergeRequestThreadSchema, GetWorkItemSchema, ListWorkItemsSchema, CreateWorkItemSchema, UpdateWorkItemSchema, ConvertWorkItemTypeSchema, ListWorkItemStatusesSchema, ListWorkItemNotesSchema, CreateWorkItemNoteSchema, CreateWorkItemEmojiReactionSchema, CreateWorkItemNoteEmojiReactionSchema, ListWorkItemEmojiReactionsSchema, ListWorkItemNoteEmojiReactionsSchema, DeleteWorkItemEmojiReactionSchema, DeleteWorkItemNoteEmojiReactionSchema, MoveWorkItemSchema, ListCustomFieldDefinitionsSchema, GetTimelineEventsSchema, CreateTimelineEventSchema, ListWebhooksSchema, CreateWebhookSchema, UpdateWebhookSchema, DeleteWebhookSchema, ListWebhookEventsSchema, GetWebhookEventSchema, HealthCheckSchema, } from "./schemas.js";
|
|
149
150
|
import { createHash, randomUUID, timingSafeEqual } from "node:crypto";
|
|
150
151
|
import { createLogger, flushBufferedLogs, flushStartupLogs } from "./utils/logger.js";
|
|
151
152
|
const logger = createLogger();
|
|
@@ -988,14 +989,20 @@ configureGitLabRequestContext({
|
|
|
988
989
|
getDispatcherForUrl: apiUrl => clientPool.getDispatcherForUrl(apiUrl),
|
|
989
990
|
getOAuthAccessToken: () => OAUTH_ACCESS_TOKEN,
|
|
990
991
|
});
|
|
991
|
-
// The wiki handlers call back into the fetch, error handling, and project
|
|
992
|
-
// helpers below; fetch is read at call time because the cookie reload replaces it.
|
|
992
|
+
// The wiki and milestone handlers call back into the fetch, error handling, and project
|
|
993
|
+
// scope helpers below; fetch is read at call time because the cookie reload replaces it.
|
|
993
994
|
configureWikiTools({
|
|
994
995
|
getFetch: () => fetch,
|
|
995
996
|
handleGitLabError,
|
|
996
997
|
getEffectiveProjectId,
|
|
997
998
|
rejectIfStrictProjectScope,
|
|
998
999
|
});
|
|
1000
|
+
configureMilestoneTools({
|
|
1001
|
+
getFetch: () => fetch,
|
|
1002
|
+
handleGitLabError,
|
|
1003
|
+
getEffectiveProjectId,
|
|
1004
|
+
rejectIfStrictProjectScope,
|
|
1005
|
+
});
|
|
999
1006
|
// Create cookie jar with clean Netscape file parsing
|
|
1000
1007
|
// Resolve cookie path once using os.homedir() for cross-platform support
|
|
1001
1008
|
const resolvedCookiePath = GITLAB_AUTH_COOKIE_PATH
|
|
@@ -6257,298 +6264,6 @@ async function getRepositoryTree(options) {
|
|
|
6257
6264
|
const next_page = response.headers.get("x-next-page") || undefined;
|
|
6258
6265
|
return { items, next_page_token, next_page };
|
|
6259
6266
|
}
|
|
6260
|
-
/**
|
|
6261
|
-
* List project milestones in a GitLab project
|
|
6262
|
-
* @param {string} projectId - The ID or URL-encoded path of the project
|
|
6263
|
-
* @param {Object} options - Options for listing milestones
|
|
6264
|
-
* @returns {Promise<GitLabMilestones[]>} List of milestones
|
|
6265
|
-
*/
|
|
6266
|
-
async function listProjectMilestones(projectId, options) {
|
|
6267
|
-
projectId = decodeURIComponent(projectId);
|
|
6268
|
-
const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(getEffectiveProjectId(projectId))}/milestones`);
|
|
6269
|
-
Object.entries(options).forEach(([key, value]) => {
|
|
6270
|
-
// Drop blank entries inside arrays so they behave like the scalar blank guard below
|
|
6271
|
-
const normalized = dropBlankArrayEntries(value);
|
|
6272
|
-
if (isBlankFilterValue(normalized)) {
|
|
6273
|
-
return;
|
|
6274
|
-
}
|
|
6275
|
-
if (key === "iids" && Array.isArray(normalized)) {
|
|
6276
|
-
normalized.forEach(iid => {
|
|
6277
|
-
url.searchParams.append("iids[]", String(iid));
|
|
6278
|
-
});
|
|
6279
|
-
}
|
|
6280
|
-
else {
|
|
6281
|
-
url.searchParams.append(key, String(normalized));
|
|
6282
|
-
}
|
|
6283
|
-
});
|
|
6284
|
-
const response = await fetch(url.toString(), {
|
|
6285
|
-
...getFetchConfig(),
|
|
6286
|
-
});
|
|
6287
|
-
await handleGitLabError(response);
|
|
6288
|
-
const data = await response.json();
|
|
6289
|
-
return z.array(GitLabMilestonesSchema).parse(data);
|
|
6290
|
-
}
|
|
6291
|
-
/**
|
|
6292
|
-
* Get a single milestone in a GitLab project
|
|
6293
|
-
* @param {string} projectId - The ID or URL-encoded path of the project
|
|
6294
|
-
* @param {number} milestoneId - The ID of the milestone
|
|
6295
|
-
* @returns {Promise<GitLabMilestones>} Milestone details
|
|
6296
|
-
*/
|
|
6297
|
-
async function getProjectMilestone(projectId, milestoneId) {
|
|
6298
|
-
projectId = decodeURIComponent(projectId);
|
|
6299
|
-
const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(getEffectiveProjectId(projectId))}/milestones/${encodeGitLabPathSegment(milestoneId)}`);
|
|
6300
|
-
const response = await fetch(url.toString(), {
|
|
6301
|
-
...getFetchConfig(),
|
|
6302
|
-
});
|
|
6303
|
-
await handleGitLabError(response);
|
|
6304
|
-
const data = await response.json();
|
|
6305
|
-
return GitLabMilestonesSchema.parse(data);
|
|
6306
|
-
}
|
|
6307
|
-
/**
|
|
6308
|
-
* Create a new milestone in a GitLab project
|
|
6309
|
-
* @param {string} projectId - The ID or URL-encoded path of the project
|
|
6310
|
-
* @param {Object} options - Options for creating a milestone
|
|
6311
|
-
* @returns {Promise<GitLabMilestones>} Created milestone
|
|
6312
|
-
*/
|
|
6313
|
-
async function createProjectMilestone(projectId, options) {
|
|
6314
|
-
projectId = decodeURIComponent(projectId);
|
|
6315
|
-
const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(getEffectiveProjectId(projectId))}/milestones`);
|
|
6316
|
-
const response = await fetch(url.toString(), {
|
|
6317
|
-
...getFetchConfig(),
|
|
6318
|
-
method: "POST",
|
|
6319
|
-
body: JSON.stringify(options),
|
|
6320
|
-
});
|
|
6321
|
-
await handleGitLabError(response);
|
|
6322
|
-
const data = await response.json();
|
|
6323
|
-
return GitLabMilestonesSchema.parse(data);
|
|
6324
|
-
}
|
|
6325
|
-
/**
|
|
6326
|
-
* Edit an existing milestone in a GitLab project
|
|
6327
|
-
* @param {string} projectId - The ID or URL-encoded path of the project
|
|
6328
|
-
* @param {number} milestoneId - The ID of the milestone
|
|
6329
|
-
* @param {Object} options - Options for editing a milestone
|
|
6330
|
-
* @returns {Promise<GitLabMilestones>} Updated milestone
|
|
6331
|
-
*/
|
|
6332
|
-
async function editProjectMilestone(projectId, milestoneId, options) {
|
|
6333
|
-
projectId = decodeURIComponent(projectId);
|
|
6334
|
-
const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(getEffectiveProjectId(projectId))}/milestones/${encodeGitLabPathSegment(milestoneId)}`);
|
|
6335
|
-
const response = await fetch(url.toString(), {
|
|
6336
|
-
...getFetchConfig(),
|
|
6337
|
-
method: "PUT",
|
|
6338
|
-
body: JSON.stringify(options),
|
|
6339
|
-
});
|
|
6340
|
-
await handleGitLabError(response);
|
|
6341
|
-
const data = await response.json();
|
|
6342
|
-
return GitLabMilestonesSchema.parse(data);
|
|
6343
|
-
}
|
|
6344
|
-
/**
|
|
6345
|
-
* Delete a milestone from a GitLab project
|
|
6346
|
-
* @param {string} projectId - The ID or URL-encoded path of the project
|
|
6347
|
-
* @param {number} milestoneId - The ID of the milestone
|
|
6348
|
-
* @returns {Promise<void>}
|
|
6349
|
-
*/
|
|
6350
|
-
async function deleteProjectMilestone(projectId, milestoneId) {
|
|
6351
|
-
projectId = decodeURIComponent(projectId);
|
|
6352
|
-
const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(getEffectiveProjectId(projectId))}/milestones/${encodeGitLabPathSegment(milestoneId)}`);
|
|
6353
|
-
const response = await fetch(url.toString(), {
|
|
6354
|
-
...getFetchConfig(),
|
|
6355
|
-
method: "DELETE",
|
|
6356
|
-
});
|
|
6357
|
-
await handleGitLabError(response);
|
|
6358
|
-
}
|
|
6359
|
-
/**
|
|
6360
|
-
* Get all issues assigned to a single milestone
|
|
6361
|
-
* @param {string} projectId - The ID or URL-encoded path of the project
|
|
6362
|
-
* @param {number} milestoneId - The ID of the milestone
|
|
6363
|
-
* @returns {Promise<GitLabIssue[]>} List of issues
|
|
6364
|
-
*/
|
|
6365
|
-
async function getMilestoneIssues(projectId, milestoneId, options = {}) {
|
|
6366
|
-
projectId = decodeURIComponent(projectId);
|
|
6367
|
-
const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(getEffectiveProjectId(projectId))}/milestones/${encodeGitLabPathSegment(milestoneId)}/issues`);
|
|
6368
|
-
appendFilterParams(url.searchParams, options);
|
|
6369
|
-
const response = await fetch(url.toString(), {
|
|
6370
|
-
...getFetchConfig(),
|
|
6371
|
-
});
|
|
6372
|
-
await handleGitLabError(response);
|
|
6373
|
-
const data = await response.json();
|
|
6374
|
-
return z.array(GitLabIssueSchema).parse(data);
|
|
6375
|
-
}
|
|
6376
|
-
/**
|
|
6377
|
-
* Get all merge requests assigned to a single milestone
|
|
6378
|
-
* @param {string} projectId - The ID or URL-encoded path of the project
|
|
6379
|
-
* @param {number} milestoneId - The ID of the milestone
|
|
6380
|
-
* @returns {Promise<GitLabMergeRequest[]>} List of merge requests
|
|
6381
|
-
*/
|
|
6382
|
-
async function getMilestoneMergeRequests(projectId, milestoneId, options = {}) {
|
|
6383
|
-
projectId = decodeURIComponent(projectId);
|
|
6384
|
-
const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(getEffectiveProjectId(projectId))}/milestones/${encodeGitLabPathSegment(milestoneId)}/merge_requests`);
|
|
6385
|
-
appendFilterParams(url.searchParams, options);
|
|
6386
|
-
const response = await fetch(url.toString(), {
|
|
6387
|
-
...getFetchConfig(),
|
|
6388
|
-
});
|
|
6389
|
-
await handleGitLabError(response);
|
|
6390
|
-
const data = await response.json();
|
|
6391
|
-
return z.array(GitLabMergeRequestSchema).parse(data);
|
|
6392
|
-
}
|
|
6393
|
-
/**
|
|
6394
|
-
* Promote a project milestone to a group milestone
|
|
6395
|
-
* @param {string} projectId - The ID or URL-encoded path of the project
|
|
6396
|
-
* @param {number} milestoneId - The ID of the milestone
|
|
6397
|
-
* @returns {Promise<GitLabGroupMilestones>} Promoted milestone
|
|
6398
|
-
*/
|
|
6399
|
-
async function promoteProjectMilestone(projectId, milestoneId) {
|
|
6400
|
-
projectId = decodeURIComponent(projectId);
|
|
6401
|
-
const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(getEffectiveProjectId(projectId))}/milestones/${encodeGitLabPathSegment(milestoneId)}/promote`);
|
|
6402
|
-
const response = await fetch(url.toString(), {
|
|
6403
|
-
...getFetchConfig(),
|
|
6404
|
-
method: "POST",
|
|
6405
|
-
});
|
|
6406
|
-
await handleGitLabError(response);
|
|
6407
|
-
const data = await response.json();
|
|
6408
|
-
return GitLabGroupMilestonesSchema.parse(data);
|
|
6409
|
-
}
|
|
6410
|
-
/**
|
|
6411
|
-
* Get all burndown chart events for a single milestone
|
|
6412
|
-
* @param {string} projectId - The ID or URL-encoded path of the project
|
|
6413
|
-
* @param {number} milestoneId - The ID of the milestone
|
|
6414
|
-
* @returns {Promise<any[]>} Burndown chart events
|
|
6415
|
-
*/
|
|
6416
|
-
async function getMilestoneBurndownEvents(projectId, milestoneId, options = {}) {
|
|
6417
|
-
projectId = decodeURIComponent(projectId);
|
|
6418
|
-
const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(getEffectiveProjectId(projectId))}/milestones/${encodeGitLabPathSegment(milestoneId)}/burndown_events`);
|
|
6419
|
-
appendFilterParams(url.searchParams, options);
|
|
6420
|
-
const response = await fetch(url.toString(), {
|
|
6421
|
-
...getFetchConfig(),
|
|
6422
|
-
});
|
|
6423
|
-
await handleGitLabError(response);
|
|
6424
|
-
const data = await response.json();
|
|
6425
|
-
return data;
|
|
6426
|
-
}
|
|
6427
|
-
/**
|
|
6428
|
-
* List milestones in a GitLab group
|
|
6429
|
-
*/
|
|
6430
|
-
async function listGroupMilestones(groupId, options) {
|
|
6431
|
-
groupId = decodeURIComponent(groupId);
|
|
6432
|
-
const url = new URL(`${getEffectiveApiUrl()}/groups/${encodeGitLabPathSegment(groupId)}/milestones`);
|
|
6433
|
-
Object.entries(options).forEach(([key, value]) => {
|
|
6434
|
-
// Drop blank entries inside arrays so they behave like the scalar blank guard below
|
|
6435
|
-
const normalized = dropBlankArrayEntries(value);
|
|
6436
|
-
if (isBlankFilterValue(normalized)) {
|
|
6437
|
-
return;
|
|
6438
|
-
}
|
|
6439
|
-
if (key === "iids" && Array.isArray(normalized)) {
|
|
6440
|
-
normalized.forEach(iid => {
|
|
6441
|
-
url.searchParams.append("iids[]", String(iid));
|
|
6442
|
-
});
|
|
6443
|
-
}
|
|
6444
|
-
else {
|
|
6445
|
-
url.searchParams.append(key, String(normalized));
|
|
6446
|
-
}
|
|
6447
|
-
});
|
|
6448
|
-
const response = await fetch(url.toString(), {
|
|
6449
|
-
...getFetchConfig(),
|
|
6450
|
-
});
|
|
6451
|
-
await handleGitLabError(response);
|
|
6452
|
-
const data = await response.json();
|
|
6453
|
-
return z.array(GitLabGroupMilestonesSchema).parse(data);
|
|
6454
|
-
}
|
|
6455
|
-
/**
|
|
6456
|
-
* Get a single milestone in a GitLab group
|
|
6457
|
-
*/
|
|
6458
|
-
async function getGroupMilestone(groupId, milestoneId) {
|
|
6459
|
-
groupId = decodeURIComponent(groupId);
|
|
6460
|
-
const url = new URL(`${getEffectiveApiUrl()}/groups/${encodeGitLabPathSegment(groupId)}/milestones/${encodeGitLabPathSegment(milestoneId)}`);
|
|
6461
|
-
const response = await fetch(url.toString(), {
|
|
6462
|
-
...getFetchConfig(),
|
|
6463
|
-
});
|
|
6464
|
-
await handleGitLabError(response);
|
|
6465
|
-
const data = await response.json();
|
|
6466
|
-
return GitLabGroupMilestonesSchema.parse(data);
|
|
6467
|
-
}
|
|
6468
|
-
/**
|
|
6469
|
-
* Create a new milestone in a GitLab group
|
|
6470
|
-
*/
|
|
6471
|
-
async function createGroupMilestone(groupId, options) {
|
|
6472
|
-
groupId = decodeURIComponent(groupId);
|
|
6473
|
-
const url = new URL(`${getEffectiveApiUrl()}/groups/${encodeGitLabPathSegment(groupId)}/milestones`);
|
|
6474
|
-
const response = await fetch(url.toString(), {
|
|
6475
|
-
...getFetchConfig(),
|
|
6476
|
-
method: "POST",
|
|
6477
|
-
body: JSON.stringify(options),
|
|
6478
|
-
});
|
|
6479
|
-
await handleGitLabError(response);
|
|
6480
|
-
const data = await response.json();
|
|
6481
|
-
return GitLabGroupMilestonesSchema.parse(data);
|
|
6482
|
-
}
|
|
6483
|
-
/**
|
|
6484
|
-
* Edit an existing milestone in a GitLab group
|
|
6485
|
-
*/
|
|
6486
|
-
async function editGroupMilestone(groupId, milestoneId, options) {
|
|
6487
|
-
groupId = decodeURIComponent(groupId);
|
|
6488
|
-
const url = new URL(`${getEffectiveApiUrl()}/groups/${encodeGitLabPathSegment(groupId)}/milestones/${encodeGitLabPathSegment(milestoneId)}`);
|
|
6489
|
-
const response = await fetch(url.toString(), {
|
|
6490
|
-
...getFetchConfig(),
|
|
6491
|
-
method: "PUT",
|
|
6492
|
-
body: JSON.stringify(options),
|
|
6493
|
-
});
|
|
6494
|
-
await handleGitLabError(response);
|
|
6495
|
-
const data = await response.json();
|
|
6496
|
-
return GitLabGroupMilestonesSchema.parse(data);
|
|
6497
|
-
}
|
|
6498
|
-
/**
|
|
6499
|
-
* Delete a milestone from a GitLab group
|
|
6500
|
-
*/
|
|
6501
|
-
async function deleteGroupMilestone(groupId, milestoneId) {
|
|
6502
|
-
groupId = decodeURIComponent(groupId);
|
|
6503
|
-
const url = new URL(`${getEffectiveApiUrl()}/groups/${encodeGitLabPathSegment(groupId)}/milestones/${encodeGitLabPathSegment(milestoneId)}`);
|
|
6504
|
-
const response = await fetch(url.toString(), {
|
|
6505
|
-
...getFetchConfig(),
|
|
6506
|
-
method: "DELETE",
|
|
6507
|
-
});
|
|
6508
|
-
await handleGitLabError(response);
|
|
6509
|
-
}
|
|
6510
|
-
/**
|
|
6511
|
-
* Get all issues assigned to a single group milestone
|
|
6512
|
-
*/
|
|
6513
|
-
async function getGroupMilestoneIssues(groupId, milestoneId, options = {}) {
|
|
6514
|
-
groupId = decodeURIComponent(groupId);
|
|
6515
|
-
const url = new URL(`${getEffectiveApiUrl()}/groups/${encodeGitLabPathSegment(groupId)}/milestones/${encodeGitLabPathSegment(milestoneId)}/issues`);
|
|
6516
|
-
appendFilterParams(url.searchParams, options);
|
|
6517
|
-
const response = await fetch(url.toString(), {
|
|
6518
|
-
...getFetchConfig(),
|
|
6519
|
-
});
|
|
6520
|
-
await handleGitLabError(response);
|
|
6521
|
-
const data = await response.json();
|
|
6522
|
-
return z.array(GitLabIssueSchema).parse(data);
|
|
6523
|
-
}
|
|
6524
|
-
/**
|
|
6525
|
-
* Get all merge requests assigned to a single group milestone
|
|
6526
|
-
*/
|
|
6527
|
-
async function getGroupMilestoneMergeRequests(groupId, milestoneId, options = {}) {
|
|
6528
|
-
groupId = decodeURIComponent(groupId);
|
|
6529
|
-
const url = new URL(`${getEffectiveApiUrl()}/groups/${encodeGitLabPathSegment(groupId)}/milestones/${encodeGitLabPathSegment(milestoneId)}/merge_requests`);
|
|
6530
|
-
appendFilterParams(url.searchParams, options);
|
|
6531
|
-
const response = await fetch(url.toString(), {
|
|
6532
|
-
...getFetchConfig(),
|
|
6533
|
-
});
|
|
6534
|
-
await handleGitLabError(response);
|
|
6535
|
-
const data = await response.json();
|
|
6536
|
-
return z.array(GitLabMergeRequestSchema).parse(data);
|
|
6537
|
-
}
|
|
6538
|
-
/**
|
|
6539
|
-
* Get burndown chart events for a group milestone
|
|
6540
|
-
*/
|
|
6541
|
-
async function getGroupMilestoneBurndownEvents(groupId, milestoneId, options = {}) {
|
|
6542
|
-
groupId = decodeURIComponent(groupId);
|
|
6543
|
-
const url = new URL(`${getEffectiveApiUrl()}/groups/${encodeGitLabPathSegment(groupId)}/milestones/${encodeGitLabPathSegment(milestoneId)}/burndown_events`);
|
|
6544
|
-
appendFilterParams(url.searchParams, options);
|
|
6545
|
-
const response = await fetch(url.toString(), {
|
|
6546
|
-
...getFetchConfig(),
|
|
6547
|
-
});
|
|
6548
|
-
await handleGitLabError(response);
|
|
6549
|
-
const data = await response.json();
|
|
6550
|
-
return data;
|
|
6551
|
-
}
|
|
6552
6267
|
/**
|
|
6553
6268
|
* Get a single user from GitLab
|
|
6554
6269
|
*
|
|
@@ -10393,224 +10108,24 @@ async function handleToolCall(params) {
|
|
|
10393
10108
|
content: [{ type: "text", text: JSON.stringify(mergeRequests) }],
|
|
10394
10109
|
};
|
|
10395
10110
|
}
|
|
10396
|
-
case "list_milestones":
|
|
10397
|
-
|
|
10398
|
-
|
|
10399
|
-
|
|
10400
|
-
|
|
10401
|
-
|
|
10402
|
-
|
|
10403
|
-
|
|
10404
|
-
|
|
10405
|
-
|
|
10406
|
-
|
|
10407
|
-
|
|
10408
|
-
case "
|
|
10409
|
-
|
|
10410
|
-
|
|
10411
|
-
|
|
10412
|
-
|
|
10413
|
-
|
|
10414
|
-
type: "text",
|
|
10415
|
-
text: JSON.stringify(milestone),
|
|
10416
|
-
},
|
|
10417
|
-
],
|
|
10418
|
-
};
|
|
10419
|
-
}
|
|
10420
|
-
case "create_milestone": {
|
|
10421
|
-
const { project_id, ...options } = CreateProjectMilestoneSchema.parse(params.arguments);
|
|
10422
|
-
const milestone = await createProjectMilestone(project_id, options);
|
|
10423
|
-
return {
|
|
10424
|
-
content: [
|
|
10425
|
-
{
|
|
10426
|
-
type: "text",
|
|
10427
|
-
text: JSON.stringify(milestone),
|
|
10428
|
-
},
|
|
10429
|
-
],
|
|
10430
|
-
};
|
|
10431
|
-
}
|
|
10432
|
-
case "edit_milestone": {
|
|
10433
|
-
const { project_id, milestone_id, ...options } = EditProjectMilestoneSchema.parse(params.arguments);
|
|
10434
|
-
const milestone = await editProjectMilestone(project_id, milestone_id, options);
|
|
10435
|
-
return {
|
|
10436
|
-
content: [
|
|
10437
|
-
{
|
|
10438
|
-
type: "text",
|
|
10439
|
-
text: JSON.stringify(milestone),
|
|
10440
|
-
},
|
|
10441
|
-
],
|
|
10442
|
-
};
|
|
10443
|
-
}
|
|
10444
|
-
case "delete_milestone": {
|
|
10445
|
-
const { project_id, milestone_id } = DeleteProjectMilestoneSchema.parse(params.arguments);
|
|
10446
|
-
await deleteProjectMilestone(project_id, milestone_id);
|
|
10447
|
-
return {
|
|
10448
|
-
content: [
|
|
10449
|
-
{
|
|
10450
|
-
type: "text",
|
|
10451
|
-
text: JSON.stringify({
|
|
10452
|
-
status: "success",
|
|
10453
|
-
message: "Milestone deleted successfully",
|
|
10454
|
-
}),
|
|
10455
|
-
},
|
|
10456
|
-
],
|
|
10457
|
-
};
|
|
10458
|
-
}
|
|
10459
|
-
case "get_milestone_issue": {
|
|
10460
|
-
const { project_id, milestone_id, ...options } = GetMilestoneIssuesSchema.parse(params.arguments);
|
|
10461
|
-
const issues = await getMilestoneIssues(project_id, milestone_id, options);
|
|
10462
|
-
return {
|
|
10463
|
-
content: [
|
|
10464
|
-
{
|
|
10465
|
-
type: "text",
|
|
10466
|
-
text: JSON.stringify(issues),
|
|
10467
|
-
},
|
|
10468
|
-
],
|
|
10469
|
-
};
|
|
10470
|
-
}
|
|
10471
|
-
case "get_milestone_merge_requests": {
|
|
10472
|
-
const { project_id, milestone_id, ...options } = GetMilestoneMergeRequestsSchema.parse(params.arguments);
|
|
10473
|
-
const mergeRequests = await getMilestoneMergeRequests(project_id, milestone_id, options);
|
|
10474
|
-
return {
|
|
10475
|
-
content: [
|
|
10476
|
-
{
|
|
10477
|
-
type: "text",
|
|
10478
|
-
text: JSON.stringify(mergeRequests),
|
|
10479
|
-
},
|
|
10480
|
-
],
|
|
10481
|
-
};
|
|
10482
|
-
}
|
|
10483
|
-
case "promote_milestone": {
|
|
10484
|
-
const { project_id, milestone_id } = PromoteProjectMilestoneSchema.parse(params.arguments);
|
|
10485
|
-
const milestone = await promoteProjectMilestone(project_id, milestone_id);
|
|
10486
|
-
return {
|
|
10487
|
-
content: [
|
|
10488
|
-
{
|
|
10489
|
-
type: "text",
|
|
10490
|
-
text: JSON.stringify(milestone),
|
|
10491
|
-
},
|
|
10492
|
-
],
|
|
10493
|
-
};
|
|
10494
|
-
}
|
|
10495
|
-
case "get_milestone_burndown_events": {
|
|
10496
|
-
const { project_id, milestone_id, ...options } = GetMilestoneBurndownEventsSchema.parse(params.arguments);
|
|
10497
|
-
const events = await getMilestoneBurndownEvents(project_id, milestone_id, options);
|
|
10498
|
-
return {
|
|
10499
|
-
content: [
|
|
10500
|
-
{
|
|
10501
|
-
type: "text",
|
|
10502
|
-
text: JSON.stringify(events),
|
|
10503
|
-
},
|
|
10504
|
-
],
|
|
10505
|
-
};
|
|
10506
|
-
}
|
|
10507
|
-
case "list_group_milestones": {
|
|
10508
|
-
rejectIfStrictProjectScope("list_group_milestones");
|
|
10509
|
-
const { group_id, ...options } = ListGroupMilestonesSchema.parse(params.arguments);
|
|
10510
|
-
const milestones = await listGroupMilestones(group_id, options);
|
|
10511
|
-
return {
|
|
10512
|
-
content: [
|
|
10513
|
-
{
|
|
10514
|
-
type: "text",
|
|
10515
|
-
text: JSON.stringify(milestones),
|
|
10516
|
-
},
|
|
10517
|
-
],
|
|
10518
|
-
};
|
|
10519
|
-
}
|
|
10520
|
-
case "get_group_milestone": {
|
|
10521
|
-
rejectIfStrictProjectScope("get_group_milestone");
|
|
10522
|
-
const { group_id, milestone_id } = GetGroupMilestoneSchema.parse(params.arguments);
|
|
10523
|
-
const milestone = await getGroupMilestone(group_id, milestone_id);
|
|
10524
|
-
return {
|
|
10525
|
-
content: [
|
|
10526
|
-
{
|
|
10527
|
-
type: "text",
|
|
10528
|
-
text: JSON.stringify(milestone),
|
|
10529
|
-
},
|
|
10530
|
-
],
|
|
10531
|
-
};
|
|
10532
|
-
}
|
|
10533
|
-
case "create_group_milestone": {
|
|
10534
|
-
rejectIfStrictProjectScope("create_group_milestone");
|
|
10535
|
-
const { group_id, ...options } = CreateGroupMilestoneSchema.parse(params.arguments);
|
|
10536
|
-
const milestone = await createGroupMilestone(group_id, options);
|
|
10537
|
-
return {
|
|
10538
|
-
content: [
|
|
10539
|
-
{
|
|
10540
|
-
type: "text",
|
|
10541
|
-
text: JSON.stringify(milestone),
|
|
10542
|
-
},
|
|
10543
|
-
],
|
|
10544
|
-
};
|
|
10545
|
-
}
|
|
10546
|
-
case "edit_group_milestone": {
|
|
10547
|
-
rejectIfStrictProjectScope("edit_group_milestone");
|
|
10548
|
-
const { group_id, milestone_id, ...options } = EditGroupMilestoneSchema.parse(params.arguments);
|
|
10549
|
-
const milestone = await editGroupMilestone(group_id, milestone_id, options);
|
|
10550
|
-
return {
|
|
10551
|
-
content: [
|
|
10552
|
-
{
|
|
10553
|
-
type: "text",
|
|
10554
|
-
text: JSON.stringify(milestone),
|
|
10555
|
-
},
|
|
10556
|
-
],
|
|
10557
|
-
};
|
|
10558
|
-
}
|
|
10559
|
-
case "delete_group_milestone": {
|
|
10560
|
-
rejectIfStrictProjectScope("delete_group_milestone");
|
|
10561
|
-
const { group_id, milestone_id } = DeleteGroupMilestoneSchema.parse(params.arguments);
|
|
10562
|
-
await deleteGroupMilestone(group_id, milestone_id);
|
|
10563
|
-
return {
|
|
10564
|
-
content: [
|
|
10565
|
-
{
|
|
10566
|
-
type: "text",
|
|
10567
|
-
text: JSON.stringify({
|
|
10568
|
-
status: "success",
|
|
10569
|
-
message: "Group milestone deleted successfully",
|
|
10570
|
-
}),
|
|
10571
|
-
},
|
|
10572
|
-
],
|
|
10573
|
-
};
|
|
10574
|
-
}
|
|
10575
|
-
case "get_group_milestone_issue": {
|
|
10576
|
-
rejectIfStrictProjectScope("get_group_milestone_issue");
|
|
10577
|
-
const { group_id, milestone_id, ...options } = GetGroupMilestoneIssuesSchema.parse(params.arguments);
|
|
10578
|
-
const issues = await getGroupMilestoneIssues(group_id, milestone_id, options);
|
|
10579
|
-
return {
|
|
10580
|
-
content: [
|
|
10581
|
-
{
|
|
10582
|
-
type: "text",
|
|
10583
|
-
text: JSON.stringify(issues),
|
|
10584
|
-
},
|
|
10585
|
-
],
|
|
10586
|
-
};
|
|
10587
|
-
}
|
|
10588
|
-
case "get_group_milestone_merge_requests": {
|
|
10589
|
-
rejectIfStrictProjectScope("get_group_milestone_merge_requests");
|
|
10590
|
-
const { group_id, milestone_id, ...options } = GetGroupMilestoneMergeRequestsSchema.parse(params.arguments);
|
|
10591
|
-
const mergeRequests = await getGroupMilestoneMergeRequests(group_id, milestone_id, options);
|
|
10592
|
-
return {
|
|
10593
|
-
content: [
|
|
10594
|
-
{
|
|
10595
|
-
type: "text",
|
|
10596
|
-
text: JSON.stringify(mergeRequests),
|
|
10597
|
-
},
|
|
10598
|
-
],
|
|
10599
|
-
};
|
|
10600
|
-
}
|
|
10601
|
-
case "get_group_milestone_burndown_events": {
|
|
10602
|
-
rejectIfStrictProjectScope("get_group_milestone_burndown_events");
|
|
10603
|
-
const { group_id, milestone_id, ...options } = GetGroupMilestoneBurndownEventsSchema.parse(params.arguments);
|
|
10604
|
-
const events = await getGroupMilestoneBurndownEvents(group_id, milestone_id, options);
|
|
10605
|
-
return {
|
|
10606
|
-
content: [
|
|
10607
|
-
{
|
|
10608
|
-
type: "text",
|
|
10609
|
-
text: JSON.stringify(events),
|
|
10610
|
-
},
|
|
10611
|
-
],
|
|
10612
|
-
};
|
|
10613
|
-
}
|
|
10111
|
+
case "list_milestones":
|
|
10112
|
+
case "get_milestone":
|
|
10113
|
+
case "create_milestone":
|
|
10114
|
+
case "edit_milestone":
|
|
10115
|
+
case "delete_milestone":
|
|
10116
|
+
case "get_milestone_issue":
|
|
10117
|
+
case "get_milestone_merge_requests":
|
|
10118
|
+
case "promote_milestone":
|
|
10119
|
+
case "get_milestone_burndown_events":
|
|
10120
|
+
case "list_group_milestones":
|
|
10121
|
+
case "get_group_milestone":
|
|
10122
|
+
case "create_group_milestone":
|
|
10123
|
+
case "edit_group_milestone":
|
|
10124
|
+
case "delete_group_milestone":
|
|
10125
|
+
case "get_group_milestone_issue":
|
|
10126
|
+
case "get_group_milestone_merge_requests":
|
|
10127
|
+
case "get_group_milestone_burndown_events":
|
|
10128
|
+
return await handleMilestoneToolCall(params);
|
|
10614
10129
|
case "list_commits": {
|
|
10615
10130
|
const args = ListCommitsSchema.parse(params.arguments);
|
|
10616
10131
|
const commits = await listCommits(args.project_id, args);
|
|
@@ -0,0 +1,541 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { CreateGroupMilestoneSchema, CreateProjectMilestoneSchema, DeleteGroupMilestoneSchema, DeleteProjectMilestoneSchema, EditGroupMilestoneSchema, EditProjectMilestoneSchema, GetGroupMilestoneBurndownEventsSchema, GetGroupMilestoneIssuesSchema, GetGroupMilestoneMergeRequestsSchema, GetGroupMilestoneSchema, GetMilestoneBurndownEventsSchema, GetMilestoneIssuesSchema, GetMilestoneMergeRequestsSchema, GetProjectMilestoneSchema, GitLabGroupMilestonesSchema, GitLabIssueSchema, GitLabMergeRequestSchema, GitLabMilestonesSchema, ListGroupMilestonesSchema, ListProjectMilestonesSchema, PromoteProjectMilestoneSchema, } from "../schemas.js";
|
|
3
|
+
import { getEffectiveApiUrl, getFetchConfig } from "../server/gitlab-request-context.js";
|
|
4
|
+
import { appendFilterParams, dropBlankArrayEntries, isBlankFilterValue, } from "../utils/tool-args.js";
|
|
5
|
+
import { encodeGitLabPathSegment } from "../utils/url.js";
|
|
6
|
+
let deps;
|
|
7
|
+
export function configureMilestoneTools(next) {
|
|
8
|
+
deps = next;
|
|
9
|
+
}
|
|
10
|
+
function requireDeps() {
|
|
11
|
+
if (!deps) {
|
|
12
|
+
throw new Error("Milestone tools used before configureMilestoneTools()");
|
|
13
|
+
}
|
|
14
|
+
return deps;
|
|
15
|
+
}
|
|
16
|
+
const fetch = (input, init) => requireDeps().getFetch()(input, init);
|
|
17
|
+
function handleGitLabError(response) {
|
|
18
|
+
return requireDeps().handleGitLabError(response);
|
|
19
|
+
}
|
|
20
|
+
function getEffectiveProjectId(projectId) {
|
|
21
|
+
return requireDeps().getEffectiveProjectId(projectId);
|
|
22
|
+
}
|
|
23
|
+
function rejectIfStrictProjectScope(toolName) {
|
|
24
|
+
requireDeps().rejectIfStrictProjectScope(toolName);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* List project milestones in a GitLab project
|
|
28
|
+
* @param {string} projectId - The ID or URL-encoded path of the project
|
|
29
|
+
* @param {Object} options - Options for listing milestones
|
|
30
|
+
* @returns {Promise<GitLabMilestones[]>} List of milestones
|
|
31
|
+
*/
|
|
32
|
+
async function listProjectMilestones(projectId, options) {
|
|
33
|
+
projectId = decodeURIComponent(projectId);
|
|
34
|
+
const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(getEffectiveProjectId(projectId))}/milestones`);
|
|
35
|
+
Object.entries(options).forEach(([key, value]) => {
|
|
36
|
+
// Drop blank entries inside arrays so they behave like the scalar blank guard below
|
|
37
|
+
const normalized = dropBlankArrayEntries(value);
|
|
38
|
+
if (isBlankFilterValue(normalized)) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (key === "iids" && Array.isArray(normalized)) {
|
|
42
|
+
normalized.forEach(iid => {
|
|
43
|
+
url.searchParams.append("iids[]", String(iid));
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
url.searchParams.append(key, String(normalized));
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
const response = await fetch(url.toString(), {
|
|
51
|
+
...getFetchConfig(),
|
|
52
|
+
});
|
|
53
|
+
await handleGitLabError(response);
|
|
54
|
+
const data = await response.json();
|
|
55
|
+
return z.array(GitLabMilestonesSchema).parse(data);
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Get a single milestone in a GitLab project
|
|
59
|
+
* @param {string} projectId - The ID or URL-encoded path of the project
|
|
60
|
+
* @param {number} milestoneId - The ID of the milestone
|
|
61
|
+
* @returns {Promise<GitLabMilestones>} Milestone details
|
|
62
|
+
*/
|
|
63
|
+
async function getProjectMilestone(projectId, milestoneId) {
|
|
64
|
+
projectId = decodeURIComponent(projectId);
|
|
65
|
+
const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(getEffectiveProjectId(projectId))}/milestones/${encodeGitLabPathSegment(milestoneId)}`);
|
|
66
|
+
const response = await fetch(url.toString(), {
|
|
67
|
+
...getFetchConfig(),
|
|
68
|
+
});
|
|
69
|
+
await handleGitLabError(response);
|
|
70
|
+
const data = await response.json();
|
|
71
|
+
return GitLabMilestonesSchema.parse(data);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Create a new milestone in a GitLab project
|
|
75
|
+
* @param {string} projectId - The ID or URL-encoded path of the project
|
|
76
|
+
* @param {Object} options - Options for creating a milestone
|
|
77
|
+
* @returns {Promise<GitLabMilestones>} Created milestone
|
|
78
|
+
*/
|
|
79
|
+
async function createProjectMilestone(projectId, options) {
|
|
80
|
+
projectId = decodeURIComponent(projectId);
|
|
81
|
+
const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(getEffectiveProjectId(projectId))}/milestones`);
|
|
82
|
+
const response = await fetch(url.toString(), {
|
|
83
|
+
...getFetchConfig(),
|
|
84
|
+
method: "POST",
|
|
85
|
+
body: JSON.stringify(options),
|
|
86
|
+
});
|
|
87
|
+
await handleGitLabError(response);
|
|
88
|
+
const data = await response.json();
|
|
89
|
+
return GitLabMilestonesSchema.parse(data);
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Edit an existing milestone in a GitLab project
|
|
93
|
+
* @param {string} projectId - The ID or URL-encoded path of the project
|
|
94
|
+
* @param {number} milestoneId - The ID of the milestone
|
|
95
|
+
* @param {Object} options - Options for editing a milestone
|
|
96
|
+
* @returns {Promise<GitLabMilestones>} Updated milestone
|
|
97
|
+
*/
|
|
98
|
+
async function editProjectMilestone(projectId, milestoneId, options) {
|
|
99
|
+
projectId = decodeURIComponent(projectId);
|
|
100
|
+
const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(getEffectiveProjectId(projectId))}/milestones/${encodeGitLabPathSegment(milestoneId)}`);
|
|
101
|
+
const response = await fetch(url.toString(), {
|
|
102
|
+
...getFetchConfig(),
|
|
103
|
+
method: "PUT",
|
|
104
|
+
body: JSON.stringify(options),
|
|
105
|
+
});
|
|
106
|
+
await handleGitLabError(response);
|
|
107
|
+
const data = await response.json();
|
|
108
|
+
return GitLabMilestonesSchema.parse(data);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Delete a milestone from a GitLab project
|
|
112
|
+
* @param {string} projectId - The ID or URL-encoded path of the project
|
|
113
|
+
* @param {number} milestoneId - The ID of the milestone
|
|
114
|
+
* @returns {Promise<void>}
|
|
115
|
+
*/
|
|
116
|
+
async function deleteProjectMilestone(projectId, milestoneId) {
|
|
117
|
+
projectId = decodeURIComponent(projectId);
|
|
118
|
+
const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(getEffectiveProjectId(projectId))}/milestones/${encodeGitLabPathSegment(milestoneId)}`);
|
|
119
|
+
const response = await fetch(url.toString(), {
|
|
120
|
+
...getFetchConfig(),
|
|
121
|
+
method: "DELETE",
|
|
122
|
+
});
|
|
123
|
+
await handleGitLabError(response);
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Get all issues assigned to a single milestone
|
|
127
|
+
* @param {string} projectId - The ID or URL-encoded path of the project
|
|
128
|
+
* @param {number} milestoneId - The ID of the milestone
|
|
129
|
+
* @returns {Promise<GitLabIssue[]>} List of issues
|
|
130
|
+
*/
|
|
131
|
+
async function getMilestoneIssues(projectId, milestoneId, options = {}) {
|
|
132
|
+
projectId = decodeURIComponent(projectId);
|
|
133
|
+
const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(getEffectiveProjectId(projectId))}/milestones/${encodeGitLabPathSegment(milestoneId)}/issues`);
|
|
134
|
+
appendFilterParams(url.searchParams, options);
|
|
135
|
+
const response = await fetch(url.toString(), {
|
|
136
|
+
...getFetchConfig(),
|
|
137
|
+
});
|
|
138
|
+
await handleGitLabError(response);
|
|
139
|
+
const data = await response.json();
|
|
140
|
+
return z.array(GitLabIssueSchema).parse(data);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Get all merge requests assigned to a single milestone
|
|
144
|
+
* @param {string} projectId - The ID or URL-encoded path of the project
|
|
145
|
+
* @param {number} milestoneId - The ID of the milestone
|
|
146
|
+
* @returns {Promise<GitLabMergeRequest[]>} List of merge requests
|
|
147
|
+
*/
|
|
148
|
+
async function getMilestoneMergeRequests(projectId, milestoneId, options = {}) {
|
|
149
|
+
projectId = decodeURIComponent(projectId);
|
|
150
|
+
const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(getEffectiveProjectId(projectId))}/milestones/${encodeGitLabPathSegment(milestoneId)}/merge_requests`);
|
|
151
|
+
appendFilterParams(url.searchParams, options);
|
|
152
|
+
const response = await fetch(url.toString(), {
|
|
153
|
+
...getFetchConfig(),
|
|
154
|
+
});
|
|
155
|
+
await handleGitLabError(response);
|
|
156
|
+
const data = await response.json();
|
|
157
|
+
return z.array(GitLabMergeRequestSchema).parse(data);
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Promote a project milestone to a group milestone
|
|
161
|
+
* @param {string} projectId - The ID or URL-encoded path of the project
|
|
162
|
+
* @param {number} milestoneId - The ID of the milestone
|
|
163
|
+
* @returns {Promise<GitLabGroupMilestones>} Promoted milestone
|
|
164
|
+
*/
|
|
165
|
+
async function promoteProjectMilestone(projectId, milestoneId) {
|
|
166
|
+
projectId = decodeURIComponent(projectId);
|
|
167
|
+
const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(getEffectiveProjectId(projectId))}/milestones/${encodeGitLabPathSegment(milestoneId)}/promote`);
|
|
168
|
+
const response = await fetch(url.toString(), {
|
|
169
|
+
...getFetchConfig(),
|
|
170
|
+
method: "POST",
|
|
171
|
+
});
|
|
172
|
+
await handleGitLabError(response);
|
|
173
|
+
const data = await response.json();
|
|
174
|
+
return GitLabGroupMilestonesSchema.parse(data);
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Get all burndown chart events for a single milestone
|
|
178
|
+
* @param {string} projectId - The ID or URL-encoded path of the project
|
|
179
|
+
* @param {number} milestoneId - The ID of the milestone
|
|
180
|
+
* @returns {Promise<any[]>} Burndown chart events
|
|
181
|
+
*/
|
|
182
|
+
async function getMilestoneBurndownEvents(projectId, milestoneId, options = {}) {
|
|
183
|
+
projectId = decodeURIComponent(projectId);
|
|
184
|
+
const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(getEffectiveProjectId(projectId))}/milestones/${encodeGitLabPathSegment(milestoneId)}/burndown_events`);
|
|
185
|
+
appendFilterParams(url.searchParams, options);
|
|
186
|
+
const response = await fetch(url.toString(), {
|
|
187
|
+
...getFetchConfig(),
|
|
188
|
+
});
|
|
189
|
+
await handleGitLabError(response);
|
|
190
|
+
const data = await response.json();
|
|
191
|
+
return data;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* List milestones in a GitLab group
|
|
195
|
+
*/
|
|
196
|
+
async function listGroupMilestones(groupId, options) {
|
|
197
|
+
groupId = decodeURIComponent(groupId);
|
|
198
|
+
const url = new URL(`${getEffectiveApiUrl()}/groups/${encodeGitLabPathSegment(groupId)}/milestones`);
|
|
199
|
+
Object.entries(options).forEach(([key, value]) => {
|
|
200
|
+
// Drop blank entries inside arrays so they behave like the scalar blank guard below
|
|
201
|
+
const normalized = dropBlankArrayEntries(value);
|
|
202
|
+
if (isBlankFilterValue(normalized)) {
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
if (key === "iids" && Array.isArray(normalized)) {
|
|
206
|
+
normalized.forEach(iid => {
|
|
207
|
+
url.searchParams.append("iids[]", String(iid));
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
url.searchParams.append(key, String(normalized));
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
const response = await fetch(url.toString(), {
|
|
215
|
+
...getFetchConfig(),
|
|
216
|
+
});
|
|
217
|
+
await handleGitLabError(response);
|
|
218
|
+
const data = await response.json();
|
|
219
|
+
return z.array(GitLabGroupMilestonesSchema).parse(data);
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Get a single milestone in a GitLab group
|
|
223
|
+
*/
|
|
224
|
+
async function getGroupMilestone(groupId, milestoneId) {
|
|
225
|
+
groupId = decodeURIComponent(groupId);
|
|
226
|
+
const url = new URL(`${getEffectiveApiUrl()}/groups/${encodeGitLabPathSegment(groupId)}/milestones/${encodeGitLabPathSegment(milestoneId)}`);
|
|
227
|
+
const response = await fetch(url.toString(), {
|
|
228
|
+
...getFetchConfig(),
|
|
229
|
+
});
|
|
230
|
+
await handleGitLabError(response);
|
|
231
|
+
const data = await response.json();
|
|
232
|
+
return GitLabGroupMilestonesSchema.parse(data);
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Create a new milestone in a GitLab group
|
|
236
|
+
*/
|
|
237
|
+
async function createGroupMilestone(groupId, options) {
|
|
238
|
+
groupId = decodeURIComponent(groupId);
|
|
239
|
+
const url = new URL(`${getEffectiveApiUrl()}/groups/${encodeGitLabPathSegment(groupId)}/milestones`);
|
|
240
|
+
const response = await fetch(url.toString(), {
|
|
241
|
+
...getFetchConfig(),
|
|
242
|
+
method: "POST",
|
|
243
|
+
body: JSON.stringify(options),
|
|
244
|
+
});
|
|
245
|
+
await handleGitLabError(response);
|
|
246
|
+
const data = await response.json();
|
|
247
|
+
return GitLabGroupMilestonesSchema.parse(data);
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Edit an existing milestone in a GitLab group
|
|
251
|
+
*/
|
|
252
|
+
async function editGroupMilestone(groupId, milestoneId, options) {
|
|
253
|
+
groupId = decodeURIComponent(groupId);
|
|
254
|
+
const url = new URL(`${getEffectiveApiUrl()}/groups/${encodeGitLabPathSegment(groupId)}/milestones/${encodeGitLabPathSegment(milestoneId)}`);
|
|
255
|
+
const response = await fetch(url.toString(), {
|
|
256
|
+
...getFetchConfig(),
|
|
257
|
+
method: "PUT",
|
|
258
|
+
body: JSON.stringify(options),
|
|
259
|
+
});
|
|
260
|
+
await handleGitLabError(response);
|
|
261
|
+
const data = await response.json();
|
|
262
|
+
return GitLabGroupMilestonesSchema.parse(data);
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Delete a milestone from a GitLab group
|
|
266
|
+
*/
|
|
267
|
+
async function deleteGroupMilestone(groupId, milestoneId) {
|
|
268
|
+
groupId = decodeURIComponent(groupId);
|
|
269
|
+
const url = new URL(`${getEffectiveApiUrl()}/groups/${encodeGitLabPathSegment(groupId)}/milestones/${encodeGitLabPathSegment(milestoneId)}`);
|
|
270
|
+
const response = await fetch(url.toString(), {
|
|
271
|
+
...getFetchConfig(),
|
|
272
|
+
method: "DELETE",
|
|
273
|
+
});
|
|
274
|
+
await handleGitLabError(response);
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Get all issues assigned to a single group milestone
|
|
278
|
+
*/
|
|
279
|
+
async function getGroupMilestoneIssues(groupId, milestoneId, options = {}) {
|
|
280
|
+
groupId = decodeURIComponent(groupId);
|
|
281
|
+
const url = new URL(`${getEffectiveApiUrl()}/groups/${encodeGitLabPathSegment(groupId)}/milestones/${encodeGitLabPathSegment(milestoneId)}/issues`);
|
|
282
|
+
appendFilterParams(url.searchParams, options);
|
|
283
|
+
const response = await fetch(url.toString(), {
|
|
284
|
+
...getFetchConfig(),
|
|
285
|
+
});
|
|
286
|
+
await handleGitLabError(response);
|
|
287
|
+
const data = await response.json();
|
|
288
|
+
return z.array(GitLabIssueSchema).parse(data);
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Get all merge requests assigned to a single group milestone
|
|
292
|
+
*/
|
|
293
|
+
async function getGroupMilestoneMergeRequests(groupId, milestoneId, options = {}) {
|
|
294
|
+
groupId = decodeURIComponent(groupId);
|
|
295
|
+
const url = new URL(`${getEffectiveApiUrl()}/groups/${encodeGitLabPathSegment(groupId)}/milestones/${encodeGitLabPathSegment(milestoneId)}/merge_requests`);
|
|
296
|
+
appendFilterParams(url.searchParams, options);
|
|
297
|
+
const response = await fetch(url.toString(), {
|
|
298
|
+
...getFetchConfig(),
|
|
299
|
+
});
|
|
300
|
+
await handleGitLabError(response);
|
|
301
|
+
const data = await response.json();
|
|
302
|
+
return z.array(GitLabMergeRequestSchema).parse(data);
|
|
303
|
+
}
|
|
304
|
+
/**
|
|
305
|
+
* Get burndown chart events for a group milestone
|
|
306
|
+
*/
|
|
307
|
+
async function getGroupMilestoneBurndownEvents(groupId, milestoneId, options = {}) {
|
|
308
|
+
groupId = decodeURIComponent(groupId);
|
|
309
|
+
const url = new URL(`${getEffectiveApiUrl()}/groups/${encodeGitLabPathSegment(groupId)}/milestones/${encodeGitLabPathSegment(milestoneId)}/burndown_events`);
|
|
310
|
+
appendFilterParams(url.searchParams, options);
|
|
311
|
+
const response = await fetch(url.toString(), {
|
|
312
|
+
...getFetchConfig(),
|
|
313
|
+
});
|
|
314
|
+
await handleGitLabError(response);
|
|
315
|
+
const data = await response.json();
|
|
316
|
+
return data;
|
|
317
|
+
}
|
|
318
|
+
export async function handleMilestoneToolCall(params) {
|
|
319
|
+
switch (params.name) {
|
|
320
|
+
case "list_milestones": {
|
|
321
|
+
const { project_id, ...options } = ListProjectMilestonesSchema.parse(params.arguments);
|
|
322
|
+
const milestones = await listProjectMilestones(project_id, options);
|
|
323
|
+
return {
|
|
324
|
+
content: [
|
|
325
|
+
{
|
|
326
|
+
type: "text",
|
|
327
|
+
text: JSON.stringify(milestones),
|
|
328
|
+
},
|
|
329
|
+
],
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
case "get_milestone": {
|
|
333
|
+
const { project_id, milestone_id } = GetProjectMilestoneSchema.parse(params.arguments);
|
|
334
|
+
const milestone = await getProjectMilestone(project_id, milestone_id);
|
|
335
|
+
return {
|
|
336
|
+
content: [
|
|
337
|
+
{
|
|
338
|
+
type: "text",
|
|
339
|
+
text: JSON.stringify(milestone),
|
|
340
|
+
},
|
|
341
|
+
],
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
case "create_milestone": {
|
|
345
|
+
const { project_id, ...options } = CreateProjectMilestoneSchema.parse(params.arguments);
|
|
346
|
+
const milestone = await createProjectMilestone(project_id, options);
|
|
347
|
+
return {
|
|
348
|
+
content: [
|
|
349
|
+
{
|
|
350
|
+
type: "text",
|
|
351
|
+
text: JSON.stringify(milestone),
|
|
352
|
+
},
|
|
353
|
+
],
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
case "edit_milestone": {
|
|
357
|
+
const { project_id, milestone_id, ...options } = EditProjectMilestoneSchema.parse(params.arguments);
|
|
358
|
+
const milestone = await editProjectMilestone(project_id, milestone_id, options);
|
|
359
|
+
return {
|
|
360
|
+
content: [
|
|
361
|
+
{
|
|
362
|
+
type: "text",
|
|
363
|
+
text: JSON.stringify(milestone),
|
|
364
|
+
},
|
|
365
|
+
],
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
case "delete_milestone": {
|
|
369
|
+
const { project_id, milestone_id } = DeleteProjectMilestoneSchema.parse(params.arguments);
|
|
370
|
+
await deleteProjectMilestone(project_id, milestone_id);
|
|
371
|
+
return {
|
|
372
|
+
content: [
|
|
373
|
+
{
|
|
374
|
+
type: "text",
|
|
375
|
+
text: JSON.stringify({
|
|
376
|
+
status: "success",
|
|
377
|
+
message: "Milestone deleted successfully",
|
|
378
|
+
}),
|
|
379
|
+
},
|
|
380
|
+
],
|
|
381
|
+
};
|
|
382
|
+
}
|
|
383
|
+
case "get_milestone_issue": {
|
|
384
|
+
const { project_id, milestone_id, ...options } = GetMilestoneIssuesSchema.parse(params.arguments);
|
|
385
|
+
const issues = await getMilestoneIssues(project_id, milestone_id, options);
|
|
386
|
+
return {
|
|
387
|
+
content: [
|
|
388
|
+
{
|
|
389
|
+
type: "text",
|
|
390
|
+
text: JSON.stringify(issues),
|
|
391
|
+
},
|
|
392
|
+
],
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
case "get_milestone_merge_requests": {
|
|
396
|
+
const { project_id, milestone_id, ...options } = GetMilestoneMergeRequestsSchema.parse(params.arguments);
|
|
397
|
+
const mergeRequests = await getMilestoneMergeRequests(project_id, milestone_id, options);
|
|
398
|
+
return {
|
|
399
|
+
content: [
|
|
400
|
+
{
|
|
401
|
+
type: "text",
|
|
402
|
+
text: JSON.stringify(mergeRequests),
|
|
403
|
+
},
|
|
404
|
+
],
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
case "promote_milestone": {
|
|
408
|
+
const { project_id, milestone_id } = PromoteProjectMilestoneSchema.parse(params.arguments);
|
|
409
|
+
const milestone = await promoteProjectMilestone(project_id, milestone_id);
|
|
410
|
+
return {
|
|
411
|
+
content: [
|
|
412
|
+
{
|
|
413
|
+
type: "text",
|
|
414
|
+
text: JSON.stringify(milestone),
|
|
415
|
+
},
|
|
416
|
+
],
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
case "get_milestone_burndown_events": {
|
|
420
|
+
const { project_id, milestone_id, ...options } = GetMilestoneBurndownEventsSchema.parse(params.arguments);
|
|
421
|
+
const events = await getMilestoneBurndownEvents(project_id, milestone_id, options);
|
|
422
|
+
return {
|
|
423
|
+
content: [
|
|
424
|
+
{
|
|
425
|
+
type: "text",
|
|
426
|
+
text: JSON.stringify(events),
|
|
427
|
+
},
|
|
428
|
+
],
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
case "list_group_milestones": {
|
|
432
|
+
rejectIfStrictProjectScope("list_group_milestones");
|
|
433
|
+
const { group_id, ...options } = ListGroupMilestonesSchema.parse(params.arguments);
|
|
434
|
+
const milestones = await listGroupMilestones(group_id, options);
|
|
435
|
+
return {
|
|
436
|
+
content: [
|
|
437
|
+
{
|
|
438
|
+
type: "text",
|
|
439
|
+
text: JSON.stringify(milestones),
|
|
440
|
+
},
|
|
441
|
+
],
|
|
442
|
+
};
|
|
443
|
+
}
|
|
444
|
+
case "get_group_milestone": {
|
|
445
|
+
rejectIfStrictProjectScope("get_group_milestone");
|
|
446
|
+
const { group_id, milestone_id } = GetGroupMilestoneSchema.parse(params.arguments);
|
|
447
|
+
const milestone = await getGroupMilestone(group_id, milestone_id);
|
|
448
|
+
return {
|
|
449
|
+
content: [
|
|
450
|
+
{
|
|
451
|
+
type: "text",
|
|
452
|
+
text: JSON.stringify(milestone),
|
|
453
|
+
},
|
|
454
|
+
],
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
case "create_group_milestone": {
|
|
458
|
+
rejectIfStrictProjectScope("create_group_milestone");
|
|
459
|
+
const { group_id, ...options } = CreateGroupMilestoneSchema.parse(params.arguments);
|
|
460
|
+
const milestone = await createGroupMilestone(group_id, options);
|
|
461
|
+
return {
|
|
462
|
+
content: [
|
|
463
|
+
{
|
|
464
|
+
type: "text",
|
|
465
|
+
text: JSON.stringify(milestone),
|
|
466
|
+
},
|
|
467
|
+
],
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
case "edit_group_milestone": {
|
|
471
|
+
rejectIfStrictProjectScope("edit_group_milestone");
|
|
472
|
+
const { group_id, milestone_id, ...options } = EditGroupMilestoneSchema.parse(params.arguments);
|
|
473
|
+
const milestone = await editGroupMilestone(group_id, milestone_id, options);
|
|
474
|
+
return {
|
|
475
|
+
content: [
|
|
476
|
+
{
|
|
477
|
+
type: "text",
|
|
478
|
+
text: JSON.stringify(milestone),
|
|
479
|
+
},
|
|
480
|
+
],
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
case "delete_group_milestone": {
|
|
484
|
+
rejectIfStrictProjectScope("delete_group_milestone");
|
|
485
|
+
const { group_id, milestone_id } = DeleteGroupMilestoneSchema.parse(params.arguments);
|
|
486
|
+
await deleteGroupMilestone(group_id, milestone_id);
|
|
487
|
+
return {
|
|
488
|
+
content: [
|
|
489
|
+
{
|
|
490
|
+
type: "text",
|
|
491
|
+
text: JSON.stringify({
|
|
492
|
+
status: "success",
|
|
493
|
+
message: "Group milestone deleted successfully",
|
|
494
|
+
}),
|
|
495
|
+
},
|
|
496
|
+
],
|
|
497
|
+
};
|
|
498
|
+
}
|
|
499
|
+
case "get_group_milestone_issue": {
|
|
500
|
+
rejectIfStrictProjectScope("get_group_milestone_issue");
|
|
501
|
+
const { group_id, milestone_id, ...options } = GetGroupMilestoneIssuesSchema.parse(params.arguments);
|
|
502
|
+
const issues = await getGroupMilestoneIssues(group_id, milestone_id, options);
|
|
503
|
+
return {
|
|
504
|
+
content: [
|
|
505
|
+
{
|
|
506
|
+
type: "text",
|
|
507
|
+
text: JSON.stringify(issues),
|
|
508
|
+
},
|
|
509
|
+
],
|
|
510
|
+
};
|
|
511
|
+
}
|
|
512
|
+
case "get_group_milestone_merge_requests": {
|
|
513
|
+
rejectIfStrictProjectScope("get_group_milestone_merge_requests");
|
|
514
|
+
const { group_id, milestone_id, ...options } = GetGroupMilestoneMergeRequestsSchema.parse(params.arguments);
|
|
515
|
+
const mergeRequests = await getGroupMilestoneMergeRequests(group_id, milestone_id, options);
|
|
516
|
+
return {
|
|
517
|
+
content: [
|
|
518
|
+
{
|
|
519
|
+
type: "text",
|
|
520
|
+
text: JSON.stringify(mergeRequests),
|
|
521
|
+
},
|
|
522
|
+
],
|
|
523
|
+
};
|
|
524
|
+
}
|
|
525
|
+
case "get_group_milestone_burndown_events": {
|
|
526
|
+
rejectIfStrictProjectScope("get_group_milestone_burndown_events");
|
|
527
|
+
const { group_id, milestone_id, ...options } = GetGroupMilestoneBurndownEventsSchema.parse(params.arguments);
|
|
528
|
+
const events = await getGroupMilestoneBurndownEvents(group_id, milestone_id, options);
|
|
529
|
+
return {
|
|
530
|
+
content: [
|
|
531
|
+
{
|
|
532
|
+
type: "text",
|
|
533
|
+
text: JSON.stringify(events),
|
|
534
|
+
},
|
|
535
|
+
],
|
|
536
|
+
};
|
|
537
|
+
}
|
|
538
|
+
default:
|
|
539
|
+
throw new Error(`Unknown tool: ${params.name}`);
|
|
540
|
+
}
|
|
541
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zereight/mcp-gitlab",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.23-next.208",
|
|
4
4
|
"mcpName": "io.github.zereight/gitlab-mcp",
|
|
5
5
|
"description": "GitLab MCP server for projects, merge requests, issues, pipelines, wiki, releases, and more",
|
|
6
6
|
"keywords": [
|