@zereight/mcp-gitlab 2.3.25 → 2.3.26-next.227
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/build/index.js +14 -0
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -1376,6 +1376,9 @@ const GROUP_NOT_FOUND_HINT = "check group_id (numeric ID or URL-encoded path suc
|
|
|
1376
1376
|
const WORK_ITEM_NOT_FOUND_HINT = "check project_id and the work item iid (the #number shown in GitLab, not the global ID).";
|
|
1377
1377
|
const WORK_ITEM_TYPE_NOT_FOUND_HINT = "this project does not offer that work item type (some types need a higher GitLab tier or are turned off); use another type, such as issue or task.";
|
|
1378
1378
|
const VULNERABILITY_NOT_FOUND_HINT = "check vulnerability_id; list_project_vulnerabilities lists the vulnerabilities the token can read.";
|
|
1379
|
+
// Unlike the generic getEffectiveProjectId hint, this one does not suggest setting
|
|
1380
|
+
// GITLAB_PROJECT_ID: fork_repository is rejected whenever GITLAB_PROJECT_ID is set.
|
|
1381
|
+
const FORK_PROJECT_ID_REQUIRED_HINT = "pass project_id (numeric ID or group%2Fproject).";
|
|
1379
1382
|
/**
|
|
1380
1383
|
* Utility function for handling GitLab API errors
|
|
1381
1384
|
* API 에러 처리를 위한 유틸리티 함수 (Utility function for handling API errors)
|
|
@@ -1485,6 +1488,12 @@ function rejectIfProjectScopedDeployment(toolName) {
|
|
|
1485
1488
|
*/
|
|
1486
1489
|
async function forkProject(projectId, namespace) {
|
|
1487
1490
|
projectId = decodeURIComponent(projectId); // Decode project ID
|
|
1491
|
+
// fork_repository has already rejected GITLAB_PROJECT_ID and allowlist setups, so there is
|
|
1492
|
+
// no default project to fall back to. Fail here with a fork-specific hint instead of the
|
|
1493
|
+
// generic getEffectiveProjectId one.
|
|
1494
|
+
if (!projectId) {
|
|
1495
|
+
throw new ToolInputError(withRecoveryHint("No project ID provided", FORK_PROJECT_ID_REQUIRED_HINT));
|
|
1496
|
+
}
|
|
1488
1497
|
const effectiveProjectId = getEffectiveProjectId(projectId);
|
|
1489
1498
|
const url = new URL(`${getEffectiveApiUrl()}/projects/${encodeGitLabPathSegment(effectiveProjectId)}/fork`);
|
|
1490
1499
|
if (namespace) {
|
|
@@ -8047,6 +8056,11 @@ async function handleToolCall(params) {
|
|
|
8047
8056
|
};
|
|
8048
8057
|
}
|
|
8049
8058
|
catch (forkError) {
|
|
8059
|
+
// Argument errors (e.g. an empty project_id) belong to the central handler, which
|
|
8060
|
+
// returns them as isError results with a Next: hint.
|
|
8061
|
+
if (forkError instanceof ToolInputError) {
|
|
8062
|
+
throw forkError;
|
|
8063
|
+
}
|
|
8050
8064
|
logger.error({ err: forkError }, "Error forking repository");
|
|
8051
8065
|
let forkErrorMessage = "Failed to fork repository";
|
|
8052
8066
|
if (forkError instanceof Error) {
|
package/package.json
CHANGED