@structured-world/gitlab-mcp 6.8.0 → 6.10.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 -21
- package/LICENSE.MIT +21 -0
- package/README.md +169 -1
- package/dist/src/cli/list-tools.d.ts +2 -0
- package/dist/src/cli/list-tools.js +768 -0
- package/dist/src/cli/list-tools.js.map +1 -0
- package/dist/src/config.d.ts +7 -0
- package/dist/src/config.js +96 -1
- package/dist/src/config.js.map +1 -1
- package/dist/src/entities/core/registry.js +68 -63
- package/dist/src/entities/core/registry.js.map +1 -1
- package/dist/src/entities/core/schema-readonly.d.ts +93 -36
- package/dist/src/entities/core/schema-readonly.js +146 -121
- package/dist/src/entities/core/schema-readonly.js.map +1 -1
- package/dist/src/entities/core/schema.d.ts +33 -23
- package/dist/src/entities/core/schema.js +65 -60
- package/dist/src/entities/core/schema.js.map +1 -1
- package/dist/src/entities/files/registry.js +14 -21
- package/dist/src/entities/files/registry.js.map +1 -1
- package/dist/src/entities/files/schema-readonly.d.ts +8 -7
- package/dist/src/entities/files/schema-readonly.js +20 -25
- package/dist/src/entities/files/schema-readonly.js.map +1 -1
- package/dist/src/entities/files/schema.d.ts +22 -15
- package/dist/src/entities/files/schema.js +32 -73
- package/dist/src/entities/files/schema.js.map +1 -1
- package/dist/src/entities/integrations/registry.js +3 -0
- package/dist/src/entities/integrations/registry.js.map +1 -1
- package/dist/src/entities/integrations/schema.d.ts +114 -8
- package/dist/src/entities/integrations/schema.js +27 -9
- package/dist/src/entities/integrations/schema.js.map +1 -1
- package/dist/src/entities/labels/registry.js +8 -7
- package/dist/src/entities/labels/registry.js.map +1 -1
- package/dist/src/entities/labels/schema-readonly.d.ts +8 -7
- package/dist/src/entities/labels/schema-readonly.js +20 -18
- package/dist/src/entities/labels/schema-readonly.js.map +1 -1
- package/dist/src/entities/labels/schema.d.ts +15 -8
- package/dist/src/entities/labels/schema.js +36 -27
- package/dist/src/entities/labels/schema.js.map +1 -1
- package/dist/src/entities/milestones/registry.js +7 -8
- package/dist/src/entities/milestones/registry.js.map +1 -1
- package/dist/src/entities/milestones/schema-readonly.d.ts +25 -10
- package/dist/src/entities/milestones/schema-readonly.js +47 -26
- package/dist/src/entities/milestones/schema-readonly.js.map +1 -1
- package/dist/src/entities/milestones/schema.d.ts +19 -9
- package/dist/src/entities/milestones/schema.js +31 -20
- package/dist/src/entities/milestones/schema.js.map +1 -1
- package/dist/src/entities/mrs/registry.js +75 -79
- package/dist/src/entities/mrs/registry.js.map +1 -1
- package/dist/src/entities/mrs/schema-readonly.d.ts +36 -23
- package/dist/src/entities/mrs/schema-readonly.js +197 -338
- package/dist/src/entities/mrs/schema-readonly.js.map +1 -1
- package/dist/src/entities/mrs/schema.d.ts +113 -37
- package/dist/src/entities/mrs/schema.js +140 -258
- package/dist/src/entities/mrs/schema.js.map +1 -1
- package/dist/src/entities/pipelines/registry.js +10 -4
- package/dist/src/entities/pipelines/registry.js.map +1 -1
- package/dist/src/entities/pipelines/schema-readonly.d.ts +30 -14
- package/dist/src/entities/pipelines/schema-readonly.js +62 -52
- package/dist/src/entities/pipelines/schema-readonly.js.map +1 -1
- package/dist/src/entities/pipelines/schema.d.ts +23 -16
- package/dist/src/entities/pipelines/schema.js +44 -26
- package/dist/src/entities/pipelines/schema.js.map +1 -1
- package/dist/src/entities/snippets/registry.js +79 -67
- package/dist/src/entities/snippets/registry.js.map +1 -1
- package/dist/src/entities/snippets/schema-readonly.d.ts +8 -9
- package/dist/src/entities/snippets/schema-readonly.js +30 -35
- package/dist/src/entities/snippets/schema-readonly.js.map +1 -1
- package/dist/src/entities/snippets/schema.d.ts +7 -11
- package/dist/src/entities/snippets/schema.js +31 -65
- package/dist/src/entities/snippets/schema.js.map +1 -1
- package/dist/src/entities/variables/registry.js +9 -5
- package/dist/src/entities/variables/registry.js.map +1 -1
- package/dist/src/entities/variables/schema-readonly.d.ts +9 -9
- package/dist/src/entities/variables/schema-readonly.js +22 -18
- package/dist/src/entities/variables/schema-readonly.js.map +1 -1
- package/dist/src/entities/variables/schema.d.ts +24 -7
- package/dist/src/entities/variables/schema.js +67 -38
- package/dist/src/entities/variables/schema.js.map +1 -1
- package/dist/src/entities/webhooks/registry.js +48 -46
- package/dist/src/entities/webhooks/registry.js.map +1 -1
- package/dist/src/entities/webhooks/schema-readonly.d.ts +9 -8
- package/dist/src/entities/webhooks/schema-readonly.js +14 -9
- package/dist/src/entities/webhooks/schema-readonly.js.map +1 -1
- package/dist/src/entities/webhooks/schema.d.ts +79 -26
- package/dist/src/entities/webhooks/schema.js +70 -61
- package/dist/src/entities/webhooks/schema.js.map +1 -1
- package/dist/src/entities/wiki/registry.js +7 -4
- package/dist/src/entities/wiki/registry.js.map +1 -1
- package/dist/src/entities/wiki/schema-readonly.d.ts +7 -7
- package/dist/src/entities/wiki/schema-readonly.js +11 -15
- package/dist/src/entities/wiki/schema-readonly.js.map +1 -1
- package/dist/src/entities/wiki/schema.d.ts +19 -8
- package/dist/src/entities/wiki/schema.js +32 -29
- package/dist/src/entities/wiki/schema.js.map +1 -1
- package/dist/src/entities/workitems/registry.js +7 -8
- package/dist/src/entities/workitems/registry.js.map +1 -1
- package/dist/src/entities/workitems/schema-readonly.d.ts +7 -8
- package/dist/src/entities/workitems/schema-readonly.js +12 -14
- package/dist/src/entities/workitems/schema-readonly.js.map +1 -1
- package/dist/src/entities/workitems/schema.d.ts +17 -11
- package/dist/src/entities/workitems/schema.js +25 -25
- package/dist/src/entities/workitems/schema.js.map +1 -1
- package/dist/src/registry-manager.d.ts +1 -0
- package/dist/src/registry-manager.js +45 -11
- package/dist/src/registry-manager.js.map +1 -1
- package/dist/src/utils/schema-utils.d.ts +28 -0
- package/dist/src/utils/schema-utils.js +240 -0
- package/dist/src/utils/schema-utils.js.map +1 -0
- package/dist/structured-world-gitlab-mcp-6.10.0.tgz +0 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/dist/structured-world-gitlab-mcp-6.8.0.tgz +0 -0
|
@@ -41,77 +41,87 @@ const z = __importStar(require("zod"));
|
|
|
41
41
|
const schema_readonly_1 = require("./schema-readonly");
|
|
42
42
|
const schema_1 = require("./schema");
|
|
43
43
|
const gitlab_api_1 = require("../../utils/gitlab-api");
|
|
44
|
-
const
|
|
45
|
-
schema_readonly_1.GetSnippetSchema,
|
|
46
|
-
schema_1.CreateSnippetSchema,
|
|
47
|
-
schema_1.UpdateSnippetSchema,
|
|
48
|
-
schema_1.DeleteSnippetSchema,
|
|
49
|
-
]);
|
|
44
|
+
const config_1 = require("../../config");
|
|
50
45
|
exports.snippetsToolRegistry = new Map([
|
|
51
46
|
[
|
|
52
|
-
"
|
|
47
|
+
"browse_snippets",
|
|
53
48
|
{
|
|
54
|
-
name: "
|
|
55
|
-
description:
|
|
56
|
-
inputSchema: z.toJSONSchema(schema_readonly_1.
|
|
49
|
+
name: "browse_snippets",
|
|
50
|
+
description: 'BROWSE GitLab code snippets. Actions: "list" shows snippets by scope (personal/project/public) with filtering, "get" retrieves single snippet metadata or raw content. Snippets are reusable code blocks, configs, or text with versioning support.',
|
|
51
|
+
inputSchema: z.toJSONSchema(schema_readonly_1.BrowseSnippetsSchema),
|
|
57
52
|
handler: async (args) => {
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
path = "snippets";
|
|
62
|
-
}
|
|
63
|
-
else if (options.scope === "public") {
|
|
64
|
-
path = "snippets/public";
|
|
53
|
+
const input = schema_readonly_1.BrowseSnippetsSchema.parse(args);
|
|
54
|
+
if ((0, config_1.isActionDenied)("browse_snippets", input.action)) {
|
|
55
|
+
throw new Error(`Action '${input.action}' is not allowed for browse_snippets tool`);
|
|
65
56
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
57
|
+
switch (input.action) {
|
|
58
|
+
case "list": {
|
|
59
|
+
const { action: _action, scope, projectId, ...queryOptions } = input;
|
|
60
|
+
let path;
|
|
61
|
+
if (scope === "personal") {
|
|
62
|
+
path = "snippets";
|
|
63
|
+
}
|
|
64
|
+
else if (scope === "public") {
|
|
65
|
+
path = "snippets/public";
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
if (!projectId) {
|
|
69
|
+
throw new Error("projectId is required when scope is 'project'");
|
|
70
|
+
}
|
|
71
|
+
const encodedProjectId = encodeURIComponent(projectId);
|
|
72
|
+
path = `projects/${encodedProjectId}/snippets`;
|
|
73
|
+
}
|
|
74
|
+
return gitlab_api_1.gitlab.get(path, {
|
|
75
|
+
query: (0, gitlab_api_1.toQuery)(queryOptions, []),
|
|
76
|
+
});
|
|
69
77
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return gitlab_api_1.gitlab.get(path, {
|
|
74
|
-
query: (0, gitlab_api_1.toQuery)(options, ["scope", "projectId"]),
|
|
75
|
-
});
|
|
76
|
-
},
|
|
77
|
-
},
|
|
78
|
-
],
|
|
79
|
-
[
|
|
80
|
-
"manage_snippet",
|
|
81
|
-
{
|
|
82
|
-
name: "manage_snippet",
|
|
83
|
-
description: "Manage GitLab snippets with full CRUD operations via action parameter. action='read': retrieve snippet metadata or raw content. action='create': create new snippet with multiple files, visibility control. action='update': modify title, description, visibility, or files (supports create/update/delete/move file actions). action='delete': permanently remove snippet. Supports both personal and project snippets. Multi-file snippets enable organizing related code in one place.",
|
|
84
|
-
inputSchema: z.toJSONSchema(ManageSnippetSchema),
|
|
85
|
-
handler: async (args) => {
|
|
86
|
-
const options = ManageSnippetSchema.parse(args);
|
|
87
|
-
switch (options.action) {
|
|
88
|
-
case "read": {
|
|
89
|
-
const encodedId = options.id.toString();
|
|
78
|
+
case "get": {
|
|
79
|
+
const { id, projectId, raw } = input;
|
|
80
|
+
const encodedId = id.toString();
|
|
90
81
|
let path;
|
|
91
|
-
if (
|
|
92
|
-
const encodedProjectId = encodeURIComponent(
|
|
82
|
+
if (projectId) {
|
|
83
|
+
const encodedProjectId = encodeURIComponent(projectId);
|
|
93
84
|
path = `projects/${encodedProjectId}/snippets/${encodedId}`;
|
|
94
85
|
}
|
|
95
86
|
else {
|
|
96
87
|
path = `snippets/${encodedId}`;
|
|
97
88
|
}
|
|
98
|
-
if (
|
|
89
|
+
if (raw) {
|
|
99
90
|
path = `${path}/raw`;
|
|
100
91
|
}
|
|
101
92
|
return gitlab_api_1.gitlab.get(path);
|
|
102
93
|
}
|
|
94
|
+
default:
|
|
95
|
+
throw new Error(`Unknown action: ${input.action}`);
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
[
|
|
101
|
+
"manage_snippet",
|
|
102
|
+
{
|
|
103
|
+
name: "manage_snippet",
|
|
104
|
+
description: 'MANAGE GitLab snippets. Actions: "create" creates new snippet with multiple files and visibility control, "update" modifies title/description/visibility/files (supports file create/update/delete/move), "delete" permanently removes snippet. Supports personal and project snippets.',
|
|
105
|
+
inputSchema: z.toJSONSchema(schema_1.ManageSnippetSchema),
|
|
106
|
+
handler: async (args) => {
|
|
107
|
+
const input = schema_1.ManageSnippetSchema.parse(args);
|
|
108
|
+
if ((0, config_1.isActionDenied)("manage_snippet", input.action)) {
|
|
109
|
+
throw new Error(`Action '${input.action}' is not allowed for manage_snippet tool`);
|
|
110
|
+
}
|
|
111
|
+
switch (input.action) {
|
|
103
112
|
case "create": {
|
|
113
|
+
const { projectId, title, description, visibility, files } = input;
|
|
104
114
|
const body = {
|
|
105
|
-
title
|
|
106
|
-
visibility
|
|
107
|
-
files
|
|
115
|
+
title,
|
|
116
|
+
visibility,
|
|
117
|
+
files,
|
|
108
118
|
};
|
|
109
|
-
if (
|
|
110
|
-
body.description =
|
|
119
|
+
if (description) {
|
|
120
|
+
body.description = description;
|
|
111
121
|
}
|
|
112
122
|
let path;
|
|
113
|
-
if (
|
|
114
|
-
const encodedProjectId = encodeURIComponent(
|
|
123
|
+
if (projectId) {
|
|
124
|
+
const encodedProjectId = encodeURIComponent(projectId);
|
|
115
125
|
path = `projects/${encodedProjectId}/snippets`;
|
|
116
126
|
}
|
|
117
127
|
else {
|
|
@@ -123,23 +133,24 @@ exports.snippetsToolRegistry = new Map([
|
|
|
123
133
|
});
|
|
124
134
|
}
|
|
125
135
|
case "update": {
|
|
126
|
-
const
|
|
136
|
+
const { id, projectId, title, description, visibility, files } = input;
|
|
137
|
+
const encodedId = id.toString();
|
|
127
138
|
const body = {};
|
|
128
|
-
if (
|
|
129
|
-
body.title =
|
|
139
|
+
if (title !== undefined) {
|
|
140
|
+
body.title = title;
|
|
130
141
|
}
|
|
131
|
-
if (
|
|
132
|
-
body.description =
|
|
142
|
+
if (description !== undefined) {
|
|
143
|
+
body.description = description;
|
|
133
144
|
}
|
|
134
|
-
if (
|
|
135
|
-
body.visibility =
|
|
145
|
+
if (visibility !== undefined) {
|
|
146
|
+
body.visibility = visibility;
|
|
136
147
|
}
|
|
137
|
-
if (
|
|
138
|
-
body.files =
|
|
148
|
+
if (files !== undefined) {
|
|
149
|
+
body.files = files;
|
|
139
150
|
}
|
|
140
151
|
let path;
|
|
141
|
-
if (
|
|
142
|
-
const encodedProjectId = encodeURIComponent(
|
|
152
|
+
if (projectId) {
|
|
153
|
+
const encodedProjectId = encodeURIComponent(projectId);
|
|
143
154
|
path = `projects/${encodedProjectId}/snippets/${encodedId}`;
|
|
144
155
|
}
|
|
145
156
|
else {
|
|
@@ -151,27 +162,28 @@ exports.snippetsToolRegistry = new Map([
|
|
|
151
162
|
});
|
|
152
163
|
}
|
|
153
164
|
case "delete": {
|
|
154
|
-
const
|
|
165
|
+
const { id, projectId } = input;
|
|
166
|
+
const encodedId = id.toString();
|
|
155
167
|
let path;
|
|
156
|
-
if (
|
|
157
|
-
const encodedProjectId = encodeURIComponent(
|
|
168
|
+
if (projectId) {
|
|
169
|
+
const encodedProjectId = encodeURIComponent(projectId);
|
|
158
170
|
path = `projects/${encodedProjectId}/snippets/${encodedId}`;
|
|
159
171
|
}
|
|
160
172
|
else {
|
|
161
173
|
path = `snippets/${encodedId}`;
|
|
162
174
|
}
|
|
163
175
|
await gitlab_api_1.gitlab.delete(path);
|
|
164
|
-
return { deleted: true, id
|
|
176
|
+
return { deleted: true, id };
|
|
165
177
|
}
|
|
166
178
|
default:
|
|
167
|
-
throw new Error(`Unknown action: ${
|
|
179
|
+
throw new Error(`Unknown action: ${input.action}`);
|
|
168
180
|
}
|
|
169
181
|
},
|
|
170
182
|
},
|
|
171
183
|
],
|
|
172
184
|
]);
|
|
173
185
|
function getSnippetsReadOnlyToolNames() {
|
|
174
|
-
return ["
|
|
186
|
+
return ["browse_snippets"];
|
|
175
187
|
}
|
|
176
188
|
function getSnippetsToolDefinitions() {
|
|
177
189
|
return Array.from(exports.snippetsToolRegistry.values());
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../../src/entities/snippets/registry.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../../src/entities/snippets/registry.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqMA,oEAEC;AAKD,gEAEC;AAKD,4DAQC;AA3ND,uCAAyB;AACzB,uDAAyD;AACzD,qCAA+C;AAC/C,uDAAyD;AAEzD,yCAA8C;AAQjC,QAAA,oBAAoB,GAAiB,IAAI,GAAG,CAAiC;IAKxF;QACE,iBAAiB;QACjB;YACE,IAAI,EAAE,iBAAiB;YACvB,WAAW,EACT,qPAAqP;YACvP,WAAW,EAAE,CAAC,CAAC,YAAY,CAAC,sCAAoB,CAAC;YACjD,OAAO,EAAE,KAAK,EAAE,IAAa,EAAoB,EAAE;gBACjD,MAAM,KAAK,GAAG,sCAAoB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBAG/C,IAAI,IAAA,uBAAc,EAAC,iBAAiB,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;oBACpD,MA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
import { z } from "zod";
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const BrowseSnippetsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
3
|
+
action: z.ZodLiteral<"list">;
|
|
3
4
|
scope: z.ZodEnum<{
|
|
4
5
|
project: "project";
|
|
5
6
|
public: "public";
|
|
@@ -13,14 +14,12 @@ export declare const ListSnippetsSchema: z.ZodObject<{
|
|
|
13
14
|
}>>;
|
|
14
15
|
created_after: z.ZodOptional<z.ZodString>;
|
|
15
16
|
created_before: z.ZodOptional<z.ZodString>;
|
|
17
|
+
per_page: z.ZodOptional<z.ZodNumber>;
|
|
16
18
|
page: z.ZodOptional<z.ZodNumber>;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
action: z.ZodLiteral<"read">;
|
|
21
|
-
id: z.ZodNumber;
|
|
19
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
20
|
+
action: z.ZodLiteral<"get">;
|
|
21
|
+
id: z.ZodPipe<z.ZodTransform<{}, unknown>, z.ZodCoercedString<unknown>>;
|
|
22
22
|
projectId: z.ZodOptional<z.ZodString>;
|
|
23
23
|
raw: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
24
|
-
}, z.core.$strip>;
|
|
25
|
-
export type
|
|
26
|
-
export type GetSnippetOptions = z.infer<typeof GetSnippetSchema>;
|
|
24
|
+
}, z.core.$strip>], "action">;
|
|
25
|
+
export type BrowseSnippetsInput = z.infer<typeof BrowseSnippetsSchema>;
|
|
@@ -1,51 +1,46 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.BrowseSnippetsSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
const
|
|
6
|
-
const SnippetScopeSchema = zod_1.z
|
|
7
|
-
|
|
8
|
-
.
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
5
|
+
const utils_1 = require("../utils");
|
|
6
|
+
const SnippetScopeSchema = zod_1.z
|
|
7
|
+
.enum(["personal", "project", "public"])
|
|
8
|
+
.describe("The scope of snippets");
|
|
9
|
+
const SnippetVisibilitySchema = zod_1.z
|
|
10
|
+
.enum(["private", "internal", "public"])
|
|
11
|
+
.describe("Visibility level of snippets");
|
|
12
|
+
const projectIdField = zod_1.z
|
|
13
|
+
.string()
|
|
14
|
+
.optional()
|
|
15
|
+
.describe("Project ID or URL-encoded path (e.g., '123' or 'group/project')");
|
|
16
|
+
const ListSnippetsSchema = zod_1.z.object({
|
|
17
|
+
action: zod_1.z.literal("list").describe("List snippets with filtering by scope and visibility"),
|
|
18
|
+
scope: SnippetScopeSchema.describe('Scope of snippets: "personal" for current user, "project" for project-specific (requires projectId), "public" for all public snippets'),
|
|
19
|
+
projectId: projectIdField.describe("Project ID or URL-encoded path. Required when scope is 'project'"),
|
|
20
|
+
visibility: SnippetVisibilitySchema.optional().describe("Filter by visibility: private (author only), internal (authenticated users), public (everyone)"),
|
|
18
21
|
created_after: zod_1.z
|
|
19
22
|
.string()
|
|
20
23
|
.optional()
|
|
21
|
-
.describe("Return snippets created after this date (ISO 8601
|
|
24
|
+
.describe("Return snippets created after this date (ISO 8601). Example: '2024-01-01T00:00:00Z'"),
|
|
22
25
|
created_before: zod_1.z
|
|
23
26
|
.string()
|
|
24
27
|
.optional()
|
|
25
|
-
.describe("Return snippets created before this date (ISO 8601
|
|
26
|
-
|
|
27
|
-
.
|
|
28
|
-
.refine(data => data.scope !== "project" || data.projectId, {
|
|
29
|
-
message: "projectId is required when scope is 'project'",
|
|
30
|
-
path: ["projectId"],
|
|
28
|
+
.describe("Return snippets created before this date (ISO 8601). Example: '2024-12-31T23:59:59Z'"),
|
|
29
|
+
per_page: zod_1.z.number().optional().describe("Number of items per page"),
|
|
30
|
+
page: zod_1.z.number().optional().describe("Page number"),
|
|
31
31
|
});
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
.
|
|
35
|
-
|
|
36
|
-
id: zod_1.z.number().int().positive().describe("The ID of the snippet to retrieve"),
|
|
37
|
-
projectId: zod_1.z
|
|
38
|
-
.string()
|
|
39
|
-
.optional()
|
|
40
|
-
.describe("Project ID or URL-encoded path (required for project snippets). Leave empty for personal snippets"),
|
|
32
|
+
const GetSnippetSchema = zod_1.z.object({
|
|
33
|
+
action: zod_1.z.literal("get").describe("Get single snippet details or raw content"),
|
|
34
|
+
id: utils_1.requiredId.describe("The ID of the snippet to retrieve"),
|
|
35
|
+
projectId: projectIdField.describe("Project ID or URL-encoded path. Required for project snippets, leave empty for personal snippets"),
|
|
41
36
|
raw: zod_1.z
|
|
42
37
|
.boolean()
|
|
43
38
|
.optional()
|
|
44
39
|
.default(false)
|
|
45
|
-
.describe("Return raw content of
|
|
46
|
-
})
|
|
47
|
-
.refine(data => !data.projectId || typeof data.projectId === "string", {
|
|
48
|
-
message: "projectId must be a string when provided",
|
|
49
|
-
path: ["projectId"],
|
|
40
|
+
.describe("Return raw content of snippet files instead of metadata"),
|
|
50
41
|
});
|
|
42
|
+
exports.BrowseSnippetsSchema = zod_1.z.discriminatedUnion("action", [
|
|
43
|
+
ListSnippetsSchema,
|
|
44
|
+
GetSnippetSchema,
|
|
45
|
+
]);
|
|
51
46
|
//# sourceMappingURL=schema-readonly.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-readonly.js","sourceRoot":"","sources":["../../../../src/entities/snippets/schema-readonly.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,
|
|
1
|
+
{"version":3,"file":"schema-readonly.js","sourceRoot":"","sources":["../../../../src/entities/snippets/schema-readonly.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,oCAAsC;AAStC,MAAM,kBAAkB,GAAG,OAAC;KACzB,IAAI,CAAC,CAAC,UAAU,EAAE,SAAS,EAAE,QAAQ,C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E,cAAc,CAAC,QAAQ,CAChC,kGAAkG,CACnG;IACD,GAAG,EAAE,OAAC;SACH,OAAO,EAAE;SACT,QAAQ,EAAE;SACV,OAAO,CAAC,KAAK,CAAC;SACd,QAAQ,CAAC,yDAAyD,CAAC;CACvE,CAAC,CAAC;AAGU,QAAA,oBAAoB,GAAG,OAAC,CAAC,kBAAkB,CAAC,QAAQ,EAAE;IACjE,kBAAkB;IAClB,gBAAgB;CACjB,CAAC,CAAC"}
|
|
@@ -10,7 +10,7 @@ declare const SnippetFileSchema: z.ZodObject<{
|
|
|
10
10
|
}>>;
|
|
11
11
|
previous_path: z.ZodOptional<z.ZodString>;
|
|
12
12
|
}, z.core.$strip>;
|
|
13
|
-
export declare const
|
|
13
|
+
export declare const ManageSnippetSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
14
14
|
action: z.ZodLiteral<"create">;
|
|
15
15
|
projectId: z.ZodOptional<z.ZodString>;
|
|
16
16
|
title: z.ZodString;
|
|
@@ -24,10 +24,9 @@ export declare const CreateSnippetSchema: z.ZodObject<{
|
|
|
24
24
|
file_path: z.ZodString;
|
|
25
25
|
content: z.ZodString;
|
|
26
26
|
}, z.core.$strip>>;
|
|
27
|
-
}, z.core.$strip
|
|
28
|
-
export declare const UpdateSnippetSchema: z.ZodObject<{
|
|
27
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
29
28
|
action: z.ZodLiteral<"update">;
|
|
30
|
-
id: z.
|
|
29
|
+
id: z.ZodPipe<z.ZodTransform<{}, unknown>, z.ZodCoercedString<unknown>>;
|
|
31
30
|
projectId: z.ZodOptional<z.ZodString>;
|
|
32
31
|
title: z.ZodOptional<z.ZodString>;
|
|
33
32
|
description: z.ZodOptional<z.ZodString>;
|
|
@@ -47,14 +46,11 @@ export declare const UpdateSnippetSchema: z.ZodObject<{
|
|
|
47
46
|
}>>;
|
|
48
47
|
previous_path: z.ZodOptional<z.ZodString>;
|
|
49
48
|
}, z.core.$strip>>>;
|
|
50
|
-
}, z.core.$strip
|
|
51
|
-
export declare const DeleteSnippetSchema: z.ZodObject<{
|
|
49
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
52
50
|
action: z.ZodLiteral<"delete">;
|
|
53
|
-
id: z.
|
|
51
|
+
id: z.ZodPipe<z.ZodTransform<{}, unknown>, z.ZodCoercedString<unknown>>;
|
|
54
52
|
projectId: z.ZodOptional<z.ZodString>;
|
|
55
|
-
}, z.core.$strip>;
|
|
56
|
-
export type
|
|
57
|
-
export type UpdateSnippetOptions = z.infer<typeof UpdateSnippetSchema>;
|
|
58
|
-
export type DeleteSnippetOptions = z.infer<typeof DeleteSnippetSchema>;
|
|
53
|
+
}, z.core.$strip>], "action">;
|
|
54
|
+
export type ManageSnippetInput = z.infer<typeof ManageSnippetSchema>;
|
|
59
55
|
export type SnippetFile = z.infer<typeof SnippetFileSchema>;
|
|
60
56
|
export {};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ManageSnippetSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
const utils_1 = require("../utils");
|
|
5
6
|
const flexibleVisibility = zod_1.z.preprocess(val => {
|
|
6
7
|
if (typeof val === "string") {
|
|
7
8
|
const normalized = val.toLowerCase().trim();
|
|
@@ -25,7 +26,7 @@ const SnippetFileSchema = zod_1.z.object({
|
|
|
25
26
|
content: zod_1.z
|
|
26
27
|
.string()
|
|
27
28
|
.optional()
|
|
28
|
-
.describe("The content of the file. Required for 'create' and 'update' actions. Can be empty string for placeholder files
|
|
29
|
+
.describe("The content of the file. Required for 'create' and 'update' actions. Can be empty string for placeholder files"),
|
|
29
30
|
action: zod_1.z
|
|
30
31
|
.enum(["create", "update", "delete", "move"])
|
|
31
32
|
.optional()
|
|
@@ -35,89 +36,54 @@ const SnippetFileSchema = zod_1.z.object({
|
|
|
35
36
|
.optional()
|
|
36
37
|
.describe("Original file path when using 'move' action to rename a file. Must match an existing file in the snippet"),
|
|
37
38
|
});
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
.describe("Project ID or URL-encoded path to create a project snippet. Leave empty for a personal snippet"),
|
|
39
|
+
const projectIdField = zod_1.z
|
|
40
|
+
.string()
|
|
41
|
+
.optional()
|
|
42
|
+
.describe("Project ID or URL-encoded path. Leave empty for personal snippets");
|
|
43
|
+
const CreateSnippetSchema = zod_1.z.object({
|
|
44
|
+
action: zod_1.z.literal("create").describe("Create a new snippet with one or more files"),
|
|
45
|
+
projectId: projectIdField.describe("Project ID or URL-encoded path to create a project snippet. Leave empty for personal snippet"),
|
|
46
46
|
title: zod_1.z
|
|
47
47
|
.string()
|
|
48
48
|
.min(1)
|
|
49
49
|
.max(255)
|
|
50
|
-
.describe("The title of the snippet.
|
|
50
|
+
.describe("The title of the snippet. Displayed in snippet list and as page title. Max 255 chars"),
|
|
51
51
|
description: zod_1.z
|
|
52
52
|
.string()
|
|
53
53
|
.optional()
|
|
54
|
-
.describe("Optional description explaining the purpose
|
|
54
|
+
.describe("Optional description explaining the snippet purpose. Supports markdown"),
|
|
55
55
|
visibility: flexibleVisibility
|
|
56
56
|
.optional()
|
|
57
57
|
.default("private")
|
|
58
|
-
.describe("Visibility
|
|
58
|
+
.describe("Visibility: 'private' (author only), 'internal' (authenticated users), 'public' (everyone). Defaults to 'private'"),
|
|
59
59
|
files: zod_1.z
|
|
60
60
|
.array(zod_1.z.object({
|
|
61
61
|
file_path: zod_1.z.string().min(1),
|
|
62
62
|
content: zod_1.z.string(),
|
|
63
63
|
}))
|
|
64
64
|
.min(1)
|
|
65
|
-
.describe("Array of files to include
|
|
66
|
-
})
|
|
67
|
-
.refine(data => data.files.length > 0, {
|
|
68
|
-
message: "At least one file is required",
|
|
69
|
-
path: ["files"],
|
|
65
|
+
.describe("Array of files to include. At least one file required. Each needs file_path and content"),
|
|
70
66
|
});
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
.
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
.positive()
|
|
79
|
-
.describe("The ID of the snippet to update. Must be an existing snippet"),
|
|
80
|
-
projectId: zod_1.z
|
|
81
|
-
.string()
|
|
82
|
-
.optional()
|
|
83
|
-
.describe("Project ID or URL-encoded path (required for project snippets). Leave empty for personal snippets"),
|
|
84
|
-
title: zod_1.z
|
|
85
|
-
.string()
|
|
86
|
-
.min(1)
|
|
87
|
-
.max(255)
|
|
88
|
-
.optional()
|
|
89
|
-
.describe("Update the title of the snippet. Maximum 255 characters"),
|
|
90
|
-
description: zod_1.z
|
|
91
|
-
.string()
|
|
92
|
-
.optional()
|
|
93
|
-
.describe("Update the description of the snippet. Supports markdown formatting"),
|
|
94
|
-
visibility: flexibleVisibility
|
|
95
|
-
.optional()
|
|
96
|
-
.describe("Update the visibility level of the snippet"),
|
|
67
|
+
const UpdateSnippetSchema = zod_1.z.object({
|
|
68
|
+
action: zod_1.z.literal("update").describe("Update an existing snippet metadata or files"),
|
|
69
|
+
id: utils_1.requiredId.describe("The ID of the snippet to update"),
|
|
70
|
+
projectId: projectIdField.describe("Project ID or URL-encoded path. Required for project snippets, leave empty for personal"),
|
|
71
|
+
title: zod_1.z.string().min(1).max(255).optional().describe("Update the snippet title. Max 255 chars"),
|
|
72
|
+
description: zod_1.z.string().optional().describe("Update the snippet description. Supports markdown"),
|
|
73
|
+
visibility: flexibleVisibility.optional().describe("Update the visibility level"),
|
|
97
74
|
files: zod_1.z
|
|
98
75
|
.array(SnippetFileSchema)
|
|
99
76
|
.optional()
|
|
100
|
-
.describe("Array of file operations
|
|
101
|
-
})
|
|
102
|
-
.refine(data => {
|
|
103
|
-
return (data.title !== undefined ||
|
|
104
|
-
data.description !== undefined ||
|
|
105
|
-
data.visibility !== undefined ||
|
|
106
|
-
(data.files !== undefined && data.files.length > 0));
|
|
107
|
-
}, {
|
|
108
|
-
message: "At least one field must be provided to update (title, description, visibility, or files)",
|
|
77
|
+
.describe("Array of file operations. Each file must specify 'action': create/update/delete/move. Move requires previous_path"),
|
|
109
78
|
});
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
.number()
|
|
115
|
-
.int()
|
|
116
|
-
.positive()
|
|
117
|
-
.describe("The ID of the snippet to delete. This operation is permanent and cannot be undone"),
|
|
118
|
-
projectId: zod_1.z
|
|
119
|
-
.string()
|
|
120
|
-
.optional()
|
|
121
|
-
.describe("Project ID or URL-encoded path (required for project snippets). Leave empty for personal snippets"),
|
|
79
|
+
const DeleteSnippetSchema = zod_1.z.object({
|
|
80
|
+
action: zod_1.z.literal("delete").describe("Permanently delete a snippet"),
|
|
81
|
+
id: utils_1.requiredId.describe("The ID of the snippet to delete. This operation cannot be undone"),
|
|
82
|
+
projectId: projectIdField.describe("Project ID or URL-encoded path. Required for project snippets, leave empty for personal"),
|
|
122
83
|
});
|
|
84
|
+
exports.ManageSnippetSchema = zod_1.z.discriminatedUnion("action", [
|
|
85
|
+
CreateSnippetSchema,
|
|
86
|
+
UpdateSnippetSchema,
|
|
87
|
+
DeleteSnippetSchema,
|
|
88
|
+
]);
|
|
123
89
|
//# sourceMappingURL=schema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../src/entities/snippets/schema.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../src/entities/snippets/schema.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,oCAAsC;AAWtC,MAAM,kBAAkB,GAAG,OAAC,CAAC,UAAU,CACrC,GAAG,CAAC,EAAE;IACJ,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QAC5B,MAAM,UAAU,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC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AAkB,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,6BAA6B,CAAC;IACjF,KAAK,EAAE,OAAC;SACL,KAAK,CAAC,iBAAiB,CAAC;SACxB,QAAQ,EAAE;SACV,QAAQ,CACP,mHAAmH,CACpH;CACJ,CAAC,CAAC;AAGH,MAAM,mBAAmB,GAAG,OAAC,CAAC,MAAM,CAAC;IACnC,MAAM,EAAE,OAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,8BAA8B,CAAC;IACpE,EAAE,EAAE,kBAAU,CAAC,QAAQ,CAAC,kEAAkE,CAAC;IAC3F,SAAS,EAAE,cAAc,CAAC,QAAQ,CAChC,yFAAyF,CAC1F;CACF,CAAC,CAAC;AAGU,QAAA,mBAAmB,GAAG,OAAC,CAAC,kBAAkB,CAAC,QAAQ,EAAE;IAChE,mBAAmB;IACnB,mBAAmB;IACnB,mBAAmB;CACpB,CAAC,CAAC"}
|
|
@@ -42,7 +42,7 @@ const schema_readonly_1 = require("./schema-readonly");
|
|
|
42
42
|
const schema_1 = require("./schema");
|
|
43
43
|
const gitlab_api_1 = require("../../utils/gitlab-api");
|
|
44
44
|
const namespace_1 = require("../../utils/namespace");
|
|
45
|
-
const
|
|
45
|
+
const config_1 = require("../../config");
|
|
46
46
|
exports.variablesToolRegistry = new Map([
|
|
47
47
|
[
|
|
48
48
|
"browse_variables",
|
|
@@ -52,15 +52,17 @@ exports.variablesToolRegistry = new Map([
|
|
|
52
52
|
inputSchema: z.toJSONSchema(schema_readonly_1.BrowseVariablesSchema),
|
|
53
53
|
handler: async (args) => {
|
|
54
54
|
const input = schema_readonly_1.BrowseVariablesSchema.parse(args);
|
|
55
|
+
if ((0, config_1.isActionDenied)("browse_variables", input.action)) {
|
|
56
|
+
throw new Error(`Action '${input.action}' is not allowed for browse_variables tool`);
|
|
57
|
+
}
|
|
55
58
|
const { entityType, encodedPath } = await (0, namespace_1.resolveNamespaceForAPI)(input.namespace);
|
|
56
59
|
switch (input.action) {
|
|
57
60
|
case "list": {
|
|
58
|
-
const { action: _action, namespace: _namespace,
|
|
61
|
+
const { action: _action, namespace: _namespace, ...rest } = input;
|
|
59
62
|
const query = (0, gitlab_api_1.toQuery)(rest, []);
|
|
60
63
|
return gitlab_api_1.gitlab.get(`${entityType}/${encodedPath}/variables`, { query });
|
|
61
64
|
}
|
|
62
65
|
case "get": {
|
|
63
|
-
(0, utils_1.assertDefined)(input.key, "key");
|
|
64
66
|
const query = {};
|
|
65
67
|
if (input.filter?.environment_scope) {
|
|
66
68
|
query["filter[environment_scope]"] = input.filter.environment_scope;
|
|
@@ -81,11 +83,13 @@ exports.variablesToolRegistry = new Map([
|
|
|
81
83
|
inputSchema: z.toJSONSchema(schema_1.ManageVariableSchema),
|
|
82
84
|
handler: async (args) => {
|
|
83
85
|
const input = schema_1.ManageVariableSchema.parse(args);
|
|
86
|
+
if ((0, config_1.isActionDenied)("manage_variable", input.action)) {
|
|
87
|
+
throw new Error(`Action '${input.action}' is not allowed for manage_variable tool`);
|
|
88
|
+
}
|
|
84
89
|
const { entityType, encodedPath } = await (0, namespace_1.resolveNamespaceForAPI)(input.namespace);
|
|
85
90
|
switch (input.action) {
|
|
86
91
|
case "create": {
|
|
87
|
-
|
|
88
|
-
const { action: _action, namespace: _namespace, filter: _filter, ...body } = input;
|
|
92
|
+
const { action: _action, namespace: _namespace, ...body } = input;
|
|
89
93
|
return gitlab_api_1.gitlab.post(`${entityType}/${encodedPath}/variables`, {
|
|
90
94
|
body,
|
|
91
95
|
contentType: "json",
|