@structured-world/gitlab-mcp 6.5.0 → 6.7.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.
Files changed (32) hide show
  1. package/README.md +30 -11
  2. package/dist/src/config.d.ts +1 -0
  3. package/dist/src/config.js +2 -1
  4. package/dist/src/config.js.map +1 -1
  5. package/dist/src/entities/snippets/index.d.ts +7 -0
  6. package/dist/src/entities/snippets/index.js +31 -0
  7. package/dist/src/entities/snippets/index.js.map +1 -0
  8. package/dist/src/entities/snippets/registry.d.ts +5 -0
  9. package/dist/src/entities/snippets/registry.js +186 -0
  10. package/dist/src/entities/snippets/registry.js.map +1 -0
  11. package/dist/src/entities/snippets/schema-readonly.d.ts +26 -0
  12. package/dist/src/entities/snippets/schema-readonly.js +51 -0
  13. package/dist/src/entities/snippets/schema-readonly.js.map +1 -0
  14. package/dist/src/entities/snippets/schema.d.ts +60 -0
  15. package/dist/src/entities/snippets/schema.js +123 -0
  16. package/dist/src/entities/snippets/schema.js.map +1 -0
  17. package/dist/src/entities/variables/registry.js +61 -80
  18. package/dist/src/entities/variables/registry.js.map +1 -1
  19. package/dist/src/entities/variables/schema-readonly.d.ts +9 -9
  20. package/dist/src/entities/variables/schema-readonly.js +14 -11
  21. package/dist/src/entities/variables/schema-readonly.js.map +1 -1
  22. package/dist/src/entities/variables/schema.d.ts +8 -26
  23. package/dist/src/entities/variables/schema.js +20 -69
  24. package/dist/src/entities/variables/schema.js.map +1 -1
  25. package/dist/src/registry-manager.js +10 -0
  26. package/dist/src/registry-manager.js.map +1 -1
  27. package/dist/src/server.js +4 -2
  28. package/dist/src/server.js.map +1 -1
  29. package/dist/structured-world-gitlab-mcp-6.7.0.tgz +0 -0
  30. package/dist/tsconfig.build.tsbuildinfo +1 -1
  31. package/package.json +1 -1
  32. package/dist/structured-world-gitlab-mcp-6.5.0.tgz +0 -0
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DeleteSnippetSchema = exports.UpdateSnippetSchema = exports.CreateSnippetSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const flexibleVisibility = zod_1.z.preprocess(val => {
6
+ if (typeof val === "string") {
7
+ const normalized = val.toLowerCase().trim();
8
+ if (["private", "priv"].includes(normalized)) {
9
+ return "private";
10
+ }
11
+ if (["internal", "intern"].includes(normalized)) {
12
+ return "internal";
13
+ }
14
+ if (["public", "pub"].includes(normalized)) {
15
+ return "public";
16
+ }
17
+ }
18
+ return val;
19
+ }, zod_1.z.enum(["private", "internal", "public"]));
20
+ const SnippetFileSchema = zod_1.z.object({
21
+ file_path: zod_1.z
22
+ .string()
23
+ .min(1)
24
+ .describe("The path/name of the file within the snippet. Can include subdirectories (e.g., 'src/main.py'). Must be unique within the snippet"),
25
+ content: zod_1.z
26
+ .string()
27
+ .optional()
28
+ .describe("The content of the file. Required for 'create' and 'update' actions. Can be empty string for placeholder files. For binary content, use base64 encoding"),
29
+ action: zod_1.z
30
+ .enum(["create", "update", "delete", "move"])
31
+ .optional()
32
+ .describe("Action to perform on the file (only for update operations): 'create' adds a new file, 'update' modifies existing file, 'delete' removes file, 'move' renames file (requires previous_path)"),
33
+ previous_path: zod_1.z
34
+ .string()
35
+ .optional()
36
+ .describe("Original file path when using 'move' action to rename a file. Must match an existing file in the snippet"),
37
+ });
38
+ const CreateSnippetActionSchema = zod_1.z.literal("create");
39
+ exports.CreateSnippetSchema = zod_1.z
40
+ .object({
41
+ action: CreateSnippetActionSchema.describe("Must be 'create' for creating a new snippet"),
42
+ projectId: zod_1.z
43
+ .string()
44
+ .optional()
45
+ .describe("Project ID or URL-encoded path to create a project snippet. Leave empty for a personal snippet"),
46
+ title: zod_1.z
47
+ .string()
48
+ .min(1)
49
+ .max(255)
50
+ .describe("The title of the snippet. This is displayed in the snippet list and as the page title. Maximum 255 characters"),
51
+ description: zod_1.z
52
+ .string()
53
+ .optional()
54
+ .describe("Optional description explaining the purpose of the snippet. Supports markdown formatting"),
55
+ visibility: flexibleVisibility
56
+ .optional()
57
+ .default("private")
58
+ .describe("Visibility level: 'private' (only author), 'internal' (authenticated users), or 'public' (everyone). Defaults to 'private'"),
59
+ files: zod_1.z
60
+ .array(zod_1.z.object({
61
+ file_path: zod_1.z.string().min(1),
62
+ content: zod_1.z.string(),
63
+ }))
64
+ .min(1)
65
+ .describe("Array of files to include in the snippet. At least one file is required. Each file needs file_path and content"),
66
+ })
67
+ .refine(data => data.files.length > 0, {
68
+ message: "At least one file is required",
69
+ path: ["files"],
70
+ });
71
+ const UpdateSnippetActionSchema = zod_1.z.literal("update");
72
+ exports.UpdateSnippetSchema = zod_1.z
73
+ .object({
74
+ action: UpdateSnippetActionSchema.describe("Must be 'update' for updating an existing snippet"),
75
+ id: zod_1.z
76
+ .number()
77
+ .int()
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"),
97
+ files: zod_1.z
98
+ .array(SnippetFileSchema)
99
+ .optional()
100
+ .describe("Array of file operations to perform. Each file must specify an 'action': 'create' (add new file), 'update' (modify existing), 'delete' (remove file), or 'move' (rename file with previous_path)"),
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)",
109
+ });
110
+ const DeleteSnippetActionSchema = zod_1.z.literal("delete");
111
+ exports.DeleteSnippetSchema = zod_1.z.object({
112
+ action: DeleteSnippetActionSchema.describe("Must be 'delete' for deleting a snippet"),
113
+ id: zod_1.z
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"),
122
+ });
123
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../src/entities/snippets/schema.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAKxB,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,IAAI,EAAE,CAAC;QAC5C,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;YAC7C,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;YAChD,OAAO,UAAU,CAAC;QACpB,CAAC;QACD,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;YAC3C,OAAO,QAAQ,CAAC;QAClB,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC,EACD,OAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC,CAC1C,CAAC;AAGF,MAAM,iBAAiB,GAAG,OAAC,CAAC,MAAM,CAAC;IACjC,SAAS,EAAE,OAAC;SACT,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CACP,mI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C,CAAC,CACpD,CAAC;AACJ,CAAC,EACD;IACE,OAAO,EACL,0FAA0F;CAC7F,CACF,CAAC;AAGJ,MAAM,yBAAyB,GAAG,OAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AAGzC,QAAA,mBAAmB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC1C,MAAM,EAAE,yBAAyB,CAAC,QAAQ,CAAC,yCAAyC,CAAC;IACrF,EAAE,EAAE,OAAC;SACF,MAAM,EAAE;SACR,GAAG,EAAE;SACL,QAAQ,EAAE;SACV,QAAQ,CAAC,mFAAmF,CAAC;IAChG,SAAS,EAAE,OAAC;SACT,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,mGAAmG,CACpG;CACJ,CAAC,CAAC"}
@@ -42,103 +42,84 @@ 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 utils_1 = require("../utils");
45
46
  exports.variablesToolRegistry = new Map([
46
47
  [
47
- "list_variables",
48
+ "browse_variables",
48
49
  {
49
- name: "list_variables",
50
- description: "View all CI/CD environment variables configured for pipelines. Use to audit secrets, review configuration, or understand pipeline environment. Shows variable keys (values are masked for security). Returns protection status, masking, and environment scopes. Group variables are inherited by all projects.",
51
- inputSchema: z.toJSONSchema(schema_readonly_1.ListVariablesSchema),
50
+ name: "browse_variables",
51
+ description: 'BROWSE CI/CD variables. Actions: "list" shows all variables in project/group with pagination, "get" retrieves single variable details by key with optional environment scope filter.',
52
+ inputSchema: z.toJSONSchema(schema_readonly_1.BrowseVariablesSchema),
52
53
  handler: async (args) => {
53
- const options = schema_readonly_1.ListVariablesSchema.parse(args);
54
- const { entityType, encodedPath } = await (0, namespace_1.resolveNamespaceForAPI)(options.namespace);
55
- return gitlab_api_1.gitlab.get(`${entityType}/${encodedPath}/variables`, {
56
- query: (0, gitlab_api_1.toQuery)(options, ["namespace"]),
57
- });
58
- },
59
- },
60
- ],
61
- [
62
- "get_variable",
63
- {
64
- name: "get_variable",
65
- description: "Retrieve specific CI/CD variable details including value (if not masked), type, and security settings. Use for debugging pipeline issues, verifying configuration, or checking environment-specific values. Supports scoped variables for different environments (production/staging).",
66
- inputSchema: z.toJSONSchema(schema_readonly_1.GetVariableSchema),
67
- handler: async (args) => {
68
- const options = schema_readonly_1.GetVariableSchema.parse(args);
69
- const { entityType, encodedPath } = await (0, namespace_1.resolveNamespaceForAPI)(options.namespace);
70
- const query = {};
71
- if (options.filter?.environment_scope) {
72
- query["filter[environment_scope]"] = options.filter.environment_scope;
73
- }
74
- return gitlab_api_1.gitlab.get(`${entityType}/${encodedPath}/variables/${encodeURIComponent(options.key)}`, {
75
- query,
76
- });
77
- },
78
- },
79
- ],
80
- [
81
- "create_variable",
82
- {
83
- name: "create_variable",
84
- description: "Add new CI/CD environment variable for pipeline configuration, secrets, or deployment settings. Use for API keys, database URLs, feature flags. Supports masking sensitive values, protection for specific branches, environment scoping, and file type for certificates/configs. Group variables apply to all child projects.",
85
- inputSchema: z.toJSONSchema(schema_1.CreateVariableSchema),
86
- handler: async (args) => {
87
- const options = schema_1.CreateVariableSchema.parse(args);
88
- const { entityType, encodedPath } = await (0, namespace_1.resolveNamespaceForAPI)(options.namespace);
89
- const { namespace: _namespace, ...body } = options;
90
- return gitlab_api_1.gitlab.post(`${entityType}/${encodedPath}/variables`, {
91
- body,
92
- contentType: "json",
93
- });
94
- },
95
- },
96
- ],
97
- [
98
- "update_variable",
99
- {
100
- name: "update_variable",
101
- description: "Modify CI/CD variable value or configuration. Use to rotate secrets, update endpoints, change security settings, or adjust environment scopes. Can convert between env_var and file types. Changes take effect in next pipeline run. Be cautious with production variables.",
102
- inputSchema: z.toJSONSchema(schema_1.UpdateVariableSchema),
103
- handler: async (args) => {
104
- const options = schema_1.UpdateVariableSchema.parse(args);
105
- const { entityType, encodedPath } = await (0, namespace_1.resolveNamespaceForAPI)(options.namespace);
106
- const { namespace: _namespace, key, filter, ...body } = options;
107
- const query = {};
108
- if (filter?.environment_scope) {
109
- query["filter[environment_scope]"] = filter.environment_scope;
54
+ const input = schema_readonly_1.BrowseVariablesSchema.parse(args);
55
+ const { entityType, encodedPath } = await (0, namespace_1.resolveNamespaceForAPI)(input.namespace);
56
+ switch (input.action) {
57
+ case "list": {
58
+ const { action: _action, namespace: _namespace, key: _key, filter: _filter, ...rest } = input;
59
+ const query = (0, gitlab_api_1.toQuery)(rest, []);
60
+ return gitlab_api_1.gitlab.get(`${entityType}/${encodedPath}/variables`, { query });
61
+ }
62
+ case "get": {
63
+ (0, utils_1.assertDefined)(input.key, "key");
64
+ const query = {};
65
+ if (input.filter?.environment_scope) {
66
+ query["filter[environment_scope]"] = input.filter.environment_scope;
67
+ }
68
+ return gitlab_api_1.gitlab.get(`${entityType}/${encodedPath}/variables/${encodeURIComponent(input.key)}`, { query });
69
+ }
70
+ default:
71
+ throw new Error(`Unknown action: ${input.action}`);
110
72
  }
111
- return gitlab_api_1.gitlab.put(`${entityType}/${encodedPath}/variables/${encodeURIComponent(key)}`, {
112
- query,
113
- body,
114
- contentType: "json",
115
- });
116
73
  },
117
74
  },
118
75
  ],
119
76
  [
120
- "delete_variable",
77
+ "manage_variable",
121
78
  {
122
- name: "delete_variable",
123
- description: "Delete CI/CD variable permanently from configuration. Use to remove unused secrets, clean up after migrations, or revoke access. Can target specific environment-scoped variants. Warning: may break pipelines depending on the variable. Cannot be undone.",
124
- inputSchema: z.toJSONSchema(schema_1.DeleteVariableSchema),
79
+ name: "manage_variable",
80
+ description: 'MANAGE CI/CD variables. Actions: "create" adds new variable (requires key and value), "update" modifies existing variable, "delete" removes variable permanently. Supports environment scoping and protection settings.',
81
+ inputSchema: z.toJSONSchema(schema_1.ManageVariableSchema),
125
82
  handler: async (args) => {
126
- const options = schema_1.DeleteVariableSchema.parse(args);
127
- const { entityType, encodedPath } = await (0, namespace_1.resolveNamespaceForAPI)(options.namespace);
128
- const query = {};
129
- if (options.filter?.environment_scope) {
130
- query["filter[environment_scope]"] = options.filter.environment_scope;
83
+ const input = schema_1.ManageVariableSchema.parse(args);
84
+ const { entityType, encodedPath } = await (0, namespace_1.resolveNamespaceForAPI)(input.namespace);
85
+ switch (input.action) {
86
+ case "create": {
87
+ (0, utils_1.assertDefined)(input.value, "value");
88
+ const { action: _action, namespace: _namespace, filter: _filter, ...body } = input;
89
+ return gitlab_api_1.gitlab.post(`${entityType}/${encodedPath}/variables`, {
90
+ body,
91
+ contentType: "json",
92
+ });
93
+ }
94
+ case "update": {
95
+ const { action: _action, namespace: _namespace, key, filter, ...body } = input;
96
+ const query = {};
97
+ if (filter?.environment_scope) {
98
+ query["filter[environment_scope]"] = filter.environment_scope;
99
+ }
100
+ return gitlab_api_1.gitlab.put(`${entityType}/${encodedPath}/variables/${encodeURIComponent(key)}`, {
101
+ query,
102
+ body,
103
+ contentType: "json",
104
+ });
105
+ }
106
+ case "delete": {
107
+ const query = {};
108
+ if (input.filter?.environment_scope) {
109
+ query["filter[environment_scope]"] = input.filter.environment_scope;
110
+ }
111
+ await gitlab_api_1.gitlab.delete(`${entityType}/${encodedPath}/variables/${encodeURIComponent(input.key)}`, { query });
112
+ return { deleted: true };
113
+ }
114
+ default:
115
+ throw new Error(`Unknown action: ${input.action}`);
131
116
  }
132
- await gitlab_api_1.gitlab.delete(`${entityType}/${encodedPath}/variables/${encodeURIComponent(options.key)}`, {
133
- query,
134
- });
135
- return { deleted: true };
136
117
  },
137
118
  },
138
119
  ],
139
120
  ]);
140
121
  function getVariablesReadOnlyToolNames() {
141
- return ["list_variables", "get_variable"];
122
+ return ["browse_variables"];
142
123
  }
143
124
  function getVariablesToolDefinitions() {
144
125
  return Array.from(exports.variablesToolRegistry.values());
@@ -1 +1 @@
1
- {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../../src/entities/variables/registry.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6HA,sEAEC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kB,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,EACzE,EAAE,KAAK,EAAE,CACV,CAAC;wBACF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;oBAC3B,CAAC;oBAGD;wBACE,MAAM,IAAI,KAAK,CAAC,mBAAoB,KAA4B,CAAC,MAAM,EAAE,CAAC,CAAC;gBAC/E,CAAC;YACH,CAAC;SACF;KACF;CACF,CAAC,CAAC;AAKH,SAAgB,6BAA6B;IAC3C,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAC9B,CAAC;AAKD,SAAgB,2BAA2B;IACzC,OAAO,KAAK,CAAC,IAAI,CAAC,6BAAqB,CAAC,MAAM,EAAE,CAAC,CAAC;AACpD,CAAC;AAKD,SAAgB,yBAAyB,CAAC,eAAwB,KAAK;IACrE,IAAI,YAAY,EAAE,CAAC;QACjB,MAAM,aAAa,GAAG,6BAA6B,EAAE,CAAC;QACtD,OAAO,KAAK,CAAC,IAAI,CAAC,6BAAqB,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAC9D,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAClC,CAAC;IACJ,CAAC;IACD,OAAO,2BAA2B,EAAE,CAAC;AACvC,CAAC"}
@@ -1,15 +1,15 @@
1
1
  import { z } from "zod";
2
- export declare const ListVariablesSchema: z.ZodObject<{
2
+ export declare const BrowseVariablesSchema: z.ZodObject<{
3
+ action: z.ZodEnum<{
4
+ list: "list";
5
+ get: "get";
6
+ }>;
3
7
  namespace: z.ZodString;
4
- page: z.ZodOptional<z.ZodNumber>;
5
- per_page: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
6
- }, z.core.$strip>;
7
- export declare const GetVariableSchema: z.ZodObject<{
8
- namespace: z.ZodString;
9
- key: z.ZodString;
8
+ key: z.ZodOptional<z.ZodString>;
10
9
  filter: z.ZodOptional<z.ZodObject<{
11
10
  environment_scope: z.ZodOptional<z.ZodString>;
12
11
  }, z.core.$strip>>;
12
+ per_page: z.ZodOptional<z.ZodNumber>;
13
+ page: z.ZodOptional<z.ZodNumber>;
13
14
  }, z.core.$strip>;
14
- export type ListVariablesOptions = z.infer<typeof ListVariablesSchema>;
15
- export type GetVariableOptions = z.infer<typeof GetVariableSchema>;
15
+ export type BrowseVariablesInput = z.infer<typeof BrowseVariablesSchema>;
@@ -1,26 +1,29 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GetVariableSchema = exports.ListVariablesSchema = void 0;
3
+ exports.BrowseVariablesSchema = void 0;
4
4
  const zod_1 = require("zod");
5
- const shared_1 = require("../shared");
6
- exports.ListVariablesSchema = zod_1.z
5
+ exports.BrowseVariablesSchema = zod_1.z
7
6
  .object({
8
- namespace: zod_1.z.string().describe("Namespace path (group or project) to list variables from"),
9
- })
10
- .merge(shared_1.PaginationOptionsSchema);
11
- exports.GetVariableSchema = zod_1.z.object({
12
- namespace: zod_1.z.string().describe("Namespace path (group or project) containing the variable"),
7
+ action: zod_1.z.enum(["list", "get"]).describe("Action to perform"),
8
+ namespace: zod_1.z.string().describe("Namespace path (group or project)"),
13
9
  key: zod_1.z
14
10
  .string()
15
- .describe("The key of the CI/CD variable. Maximum 255 characters, alphanumeric and underscore only"),
11
+ .optional()
12
+ .describe("The key of the CI/CD variable. Required for 'get' action. Maximum 255 characters, alphanumeric and underscore only."),
16
13
  filter: zod_1.z
17
14
  .object({
18
15
  environment_scope: zod_1.z
19
16
  .string()
20
17
  .optional()
21
- .describe('The environment scope filter for the variable. Use "*" for all environments or specific environment name'),
18
+ .describe('The environment scope filter. Use "*" for all environments or specific environment name like "production".'),
22
19
  })
23
20
  .optional()
24
- .describe("Filter parameters for the variable lookup"),
21
+ .describe("Filter parameters for variable lookup (for 'get' action)"),
22
+ per_page: zod_1.z.number().optional().describe("Number of items per page"),
23
+ page: zod_1.z.number().optional().describe("Page number"),
24
+ })
25
+ .refine(data => data.action !== "get" || data.key !== undefined, {
26
+ message: "key is required for 'get' action",
27
+ path: ["key"],
25
28
  });
26
29
  //# sourceMappingURL=schema-readonly.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema-readonly.js","sourceRoot":"","sources":["../../../../src/entities/variables/schema-readonly.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,sCAAoD;AAKvC,QAAA,mBAAmB,GAAG,OAAC;KACjC,MAAM,CAAC;IACN,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,0DAA0D,CAAC;CAC3F,CAAC;KACD,KAAK,CAAC,gCAAuB,CAAC,CAAC;AAGrB,QAAA,iBAAiB,GAAG,OAAC,CAAC,MAAM,CAAC;IACxC,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,2DAA2D,CAAC;IAC3F,GAAG,EAAE,OAAC;SACH,MAAM,EAAE;SACR,QAAQ,CACP,yFAAyF,CAC1F;IACH,MAAM,EAAE,OAAC;SACN,MAAM,CAAC;QACN,iBAAiB,EAAE,OAAC;aACjB,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CACP,0GAA0G,CAC3G;KACJ,CAAC;SACD,QAAQ,EAAE;SACV,QAAQ,CAAC,2CAA2C,CAAC;CACzD,CAAC,CAAC"}
1
+ {"version":3,"file":"schema-readonly.js","sourceRoot":"","sources":["../../../../src/entities/variables/schema-readonly.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AASX,QAAA,qBAAqB,GAAG,OAAC;KACnC,MAAM,CAAC;IACN,MAAM,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,mBAAmB,CAAC;IAC7D,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC;IAEnE,GAAG,EAAE,OAAC;SACH,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,qHAAqH,CACtH;IAEH,MAAM,EAAE,OAAC;SACN,MAAM,CAAC;QACN,iBAAiB,EAAE,OAAC;aACjB,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,CACP,4GAA4G,CAC7G;KACJ,CAAC;SACD,QAAQ,EAAE;SACV,QAAQ,CAAC,0DAA0D,CAAC;IAEvE,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,0BAA0B,CAAC;IACpE,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,aAAa,CAAC;CACpD,CAAC;KACD,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,KAAK,KAAK,IAAI,IAAI,CAAC,GAAG,KAAK,SAAS,EAAE;IAC/D,OAAO,EAAE,kCAAkC;IAC3C,IAAI,EAAE,CAAC,KAAK,CAAC;CACd,CAAC,CAAC"}
@@ -1,22 +1,13 @@
1
1
  import { z } from "zod";
2
- export declare const CreateVariableSchema: z.ZodObject<{
3
- namespace: z.ZodString;
4
- key: z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodString>;
5
- value: z.ZodString;
6
- variable_type: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodEnum<{
7
- file: "file";
8
- env_var: "env_var";
9
- }>>>>;
10
- environment_scope: z.ZodDefault<z.ZodOptional<z.ZodString>>;
11
- protected: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodTransform<boolean, unknown>, z.ZodBoolean>>>;
12
- masked: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodTransform<boolean, unknown>, z.ZodBoolean>>>;
13
- raw: z.ZodDefault<z.ZodOptional<z.ZodPipe<z.ZodTransform<boolean, unknown>, z.ZodBoolean>>>;
14
- description: z.ZodOptional<z.ZodString>;
15
- }, z.core.$strip>;
16
- export declare const UpdateVariableSchema: z.ZodObject<{
2
+ export declare const ManageVariableSchema: z.ZodObject<{
3
+ action: z.ZodEnum<{
4
+ create: "create";
5
+ update: "update";
6
+ delete: "delete";
7
+ }>;
17
8
  namespace: z.ZodString;
18
9
  key: z.ZodString;
19
- value: z.ZodString;
10
+ value: z.ZodOptional<z.ZodString>;
20
11
  variable_type: z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodEnum<{
21
12
  file: "file";
22
13
  env_var: "env_var";
@@ -30,13 +21,4 @@ export declare const UpdateVariableSchema: z.ZodObject<{
30
21
  environment_scope: z.ZodOptional<z.ZodString>;
31
22
  }, z.core.$strip>>;
32
23
  }, z.core.$strip>;
33
- export declare const DeleteVariableSchema: z.ZodObject<{
34
- namespace: z.ZodString;
35
- key: z.ZodString;
36
- filter: z.ZodOptional<z.ZodObject<{
37
- environment_scope: z.ZodOptional<z.ZodString>;
38
- }, z.core.$strip>>;
39
- }, z.core.$strip>;
40
- export type CreateVariableOptions = z.infer<typeof CreateVariableSchema>;
41
- export type UpdateVariableOptions = z.infer<typeof UpdateVariableSchema>;
42
- export type DeleteVariableOptions = z.infer<typeof DeleteVariableSchema>;
24
+ export type ManageVariableInput = z.infer<typeof ManageVariableSchema>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DeleteVariableSchema = exports.UpdateVariableSchema = exports.CreateVariableSchema = void 0;
3
+ exports.ManageVariableSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const utils_1 = require("../utils");
6
6
  const flexibleVariableType = zod_1.z.preprocess(val => {
@@ -15,98 +15,49 @@ const flexibleVariableType = zod_1.z.preprocess(val => {
15
15
  }
16
16
  return val;
17
17
  }, zod_1.z.enum(["env_var", "file"]));
18
- const variableKey = zod_1.z.preprocess(val => {
19
- if (typeof val === "string") {
20
- return val.trim().replace(/[^a-zA-Z0-9_]/g, "");
21
- }
22
- return val;
23
- }, zod_1.z
24
- .string()
25
- .max(255)
26
- .regex(/^[a-zA-Z0-9_]+$/, "Key must contain only alphanumeric characters and underscores"));
27
- exports.CreateVariableSchema = zod_1.z.object({
28
- namespace: zod_1.z.string().describe("Namespace path (group or project) to create variable in"),
29
- key: variableKey.describe("The unique key for the CI/CD variable. Maximum 255 characters, only alphanumeric and underscore characters allowed. Used to reference the variable in CI/CD pipelines (e.g., $MY_API_KEY)"),
30
- value: zod_1.z
31
- .string()
32
- .describe("The value of the CI/CD variable. This is the actual content that will be available in your CI/CD pipeline. For file type variables, this should be the file content"),
33
- variable_type: flexibleVariableType
34
- .optional()
35
- .default("env_var")
36
- .describe('The type of variable: "env_var" for environment variables (default) or "file" for file variables. File variables create temporary files with the variable content during pipeline execution'),
37
- environment_scope: zod_1.z
38
- .string()
39
- .optional()
40
- .default("*")
41
- .describe('The environment scope for this variable. Use "*" for all environments (default), or specify environment names like "production", "staging", "review/*" for environment-specific values'),
42
- protected: utils_1.flexibleBoolean
43
- .optional()
44
- .default(false)
45
- .describe("Whether this variable is protected. Protected variables are only available to protected branches/tags (typically main/master). Enhances security for sensitive production variables"),
46
- masked: utils_1.flexibleBoolean
47
- .optional()
48
- .default(false)
49
- .describe("Whether this variable should be masked in job logs. MASKING REQUIREMENTS: Value must be (1) at least 8 characters, (2) single line with NO SPACES, (3) contain only these characters: A-Z a-z 0-9 + / = . ~ - _ @ : (tested on GitLab 18.4.0). FORBIDDEN characters include: spaces, commas, dollar signs, most special symbols. Common API keys, tokens, and UUIDs typically work. If masking fails with 400 error, set masked=false."),
50
- raw: utils_1.flexibleBoolean
51
- .optional()
52
- .default(false)
53
- .describe("Whether variable expansion is disabled. When true, variables like $OTHER_VAR in the value will NOT be expanded/substituted. Useful for values containing literal dollar signs"),
54
- description: zod_1.z
55
- .string()
56
- .optional()
57
- .describe("Optional description explaining the purpose and usage of this variable. Helps team members understand what this variable is for and how it should be used (Available in GitLab 16.2+)"),
58
- });
59
- exports.UpdateVariableSchema = zod_1.z.object({
60
- namespace: zod_1.z.string().describe("Namespace path (group or project) containing the variable"),
18
+ exports.ManageVariableSchema = zod_1.z
19
+ .object({
20
+ action: zod_1.z.enum(["create", "update", "delete"]).describe("Action to perform"),
21
+ namespace: zod_1.z.string().describe("Namespace path (group or project)"),
61
22
  key: zod_1.z
62
23
  .string()
63
- .describe("The key of the existing CI/CD variable to update. Must match an existing variable key exactly"),
24
+ .describe("The key of the CI/CD variable. Maximum 255 characters, only alphanumeric and underscore characters allowed."),
64
25
  value: zod_1.z
65
26
  .string()
66
- .describe("The new value for the CI/CD variable. This will replace the current value completely"),
27
+ .optional()
28
+ .describe("The value of the CI/CD variable. Required for 'create' action. For file type variables, this is the file content."),
67
29
  variable_type: flexibleVariableType
68
30
  .optional()
69
- .describe('Update the variable type: "env_var" for environment variables or "file" for file variables. Changing type may affect how the variable is used in pipelines'),
31
+ .describe('The type of variable: "env_var" for environment variables (default) or "file" for file variables.'),
70
32
  environment_scope: zod_1.z
71
33
  .string()
72
34
  .optional()
73
- .describe('Update the environment scope. Use "*" for all environments, or specify environment names. Changing scope may create a new variable instance'),
35
+ .describe('The environment scope. Use "*" for all environments (default), or specify like "production", "staging".'),
74
36
  protected: utils_1.flexibleBoolean
75
37
  .optional()
76
- .describe("Update the protected status. Protected variables are only available to protected branches/tags for enhanced security"),
38
+ .describe("Whether this variable is protected. Protected variables are only available to protected branches/tags."),
77
39
  masked: utils_1.flexibleBoolean
78
40
  .optional()
79
- .describe("Update the masked status. MASKING REQUIREMENTS: If enabling, value must be (1) at least 8 characters, (2) single line with NO SPACES, (3) contain only these characters: A-Z a-z 0-9 + / = . ~ - _ @ : (tested on GitLab 18.4.0). FORBIDDEN: spaces, commas, dollar signs. If current value has forbidden characters, this will fail with 400 error."),
41
+ .describe("Whether this variable should be masked in job logs. MASKING REQUIREMENTS: Value must be at least 8 characters, single line with no spaces, only A-Z a-z 0-9 + / = . ~ - _ @ : characters."),
80
42
  raw: utils_1.flexibleBoolean
81
43
  .optional()
82
- .describe("Update the raw status. When true, disables variable expansion (no substitution of $OTHER_VAR patterns)"),
44
+ .describe("Whether variable expansion is disabled. When true, variables like $OTHER_VAR in the value will NOT be expanded."),
83
45
  description: zod_1.z
84
46
  .string()
85
47
  .optional()
86
- .describe("Update the description of this variable to help team members understand its purpose (Available in GitLab 16.2+)"),
87
- filter: zod_1.z
88
- .object({
89
- environment_scope: zod_1.z
90
- .string()
91
- .optional()
92
- .describe("Filter to specify which environment scope variant to update when multiple variables exist with the same key"),
93
- })
94
- .optional()
95
- .describe("Filter parameters to identify the specific variable to update"),
96
- });
97
- exports.DeleteVariableSchema = zod_1.z.object({
98
- namespace: zod_1.z.string().describe("Namespace path (group or project) containing the variable"),
99
- key: zod_1.z
100
- .string()
101
- .describe("The key of the CI/CD variable to delete. This will permanently remove the variable from the project"),
48
+ .describe("Optional description explaining the purpose of this variable (GitLab 16.2+)."),
102
49
  filter: zod_1.z
103
50
  .object({
104
51
  environment_scope: zod_1.z
105
52
  .string()
106
53
  .optional()
107
- .describe('Filter to specify which environment scope variant to delete when multiple variables exist with the same key. If not specified, deletes the "*" (all environments) variant'),
54
+ .describe("Filter to specify which environment scope variant to update/delete when multiple variables exist with the same key."),
108
55
  })
109
56
  .optional()
110
- .describe("Filter parameters to identify the specific variable to delete"),
57
+ .describe("Filter parameters to identify the specific variable (for 'update' and 'delete' actions)"),
58
+ })
59
+ .refine(data => data.action !== "create" || data.value !== undefined, {
60
+ message: "value is required for 'create' action",
61
+ path: ["value"],
111
62
  });
112
63
  //# sourceMappingURL=schema.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../src/entities/variables/schema.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AACxB,oCAA2C;AAK3C,MAAM,oBAAoB,GAAG,OAAC,CAAC,UAAU,CACvC,GAAG,CAAC,EAAE;IACJ,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QAC5B,MAAM,UAAU,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC,IAAI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