Skip to content

Commit bdf3a94

Browse files
committed
feat(gitlab): add release and branch-compare tools, remove dead types
- Add gitlab_delete_branch, gitlab_compare_branches, gitlab_list_releases, gitlab_create_release tools + block wiring (fills gaps found during a full validate-integration pass against live GitLab API docs) - Remove 12 unexported, zero-consumer types left over from never-implemented tool ideas (labels, users, current-user, branch/notes listing) - Add filePath/branch block outputs that get_file/create_file/update_file already returned but weren't exposed - Broaden state/orderBy param descriptions to list all documented GitLab values
1 parent 3ddf254 commit bdf3a94

11 files changed

Lines changed: 709 additions & 105 deletions

File tree

apps/sim/blocks/blocks/gitlab.ts

Lines changed: 202 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,18 @@ export const GitLabBlock: BlockConfig<GitLabResponse> = {
5454
{ label: 'List Commits', id: 'gitlab_list_commits' },
5555
{ label: 'List Branches', id: 'gitlab_list_branches' },
5656
{ label: 'Create Branch', id: 'gitlab_create_branch' },
57+
{ label: 'Delete Branch', id: 'gitlab_delete_branch' },
58+
{ label: 'Compare Branches', id: 'gitlab_compare_branches' },
5759
// Additional Merge Request Operations
5860
{ label: 'Get MR Changes', id: 'gitlab_get_merge_request_changes' },
5961
{ label: 'Approve Merge Request', id: 'gitlab_approve_merge_request' },
6062
// Job Operations
6163
{ label: 'List Pipeline Jobs', id: 'gitlab_list_pipeline_jobs' },
6264
{ label: 'Get Job Log', id: 'gitlab_get_job_log' },
6365
{ label: 'Play Job', id: 'gitlab_play_job' },
66+
// Release Operations
67+
{ label: 'List Releases', id: 'gitlab_list_releases' },
68+
{ label: 'Create Release', id: 'gitlab_create_release' },
6469
],
6570
value: () => 'gitlab_list_projects',
6671
},
@@ -116,11 +121,15 @@ export const GitLabBlock: BlockConfig<GitLabResponse> = {
116121
'gitlab_list_commits',
117122
'gitlab_list_branches',
118123
'gitlab_create_branch',
124+
'gitlab_delete_branch',
125+
'gitlab_compare_branches',
119126
'gitlab_get_merge_request_changes',
120127
'gitlab_approve_merge_request',
121128
'gitlab_list_pipeline_jobs',
122129
'gitlab_get_job_log',
123130
'gitlab_play_job',
131+
'gitlab_list_releases',
132+
'gitlab_create_release',
124133
],
125134
},
126135
},
@@ -210,16 +219,18 @@ Return ONLY the title - no explanations, no extra text.`,
210219
'gitlab_update_issue',
211220
'gitlab_create_merge_request',
212221
'gitlab_update_merge_request',
222+
'gitlab_create_release',
213223
],
214224
},
215225
wandConfig: {
216226
enabled: true,
217-
prompt: `Generate a comprehensive description for a GitLab issue or merge request based on the user's request.
227+
prompt: `Generate a comprehensive description for a GitLab issue, merge request, or release based on the user's request.
218228
Include relevant sections as appropriate:
219229
- Summary of changes or problem
220230
- Context and motivation
221231
- Testing done (for MRs)
222232
- Steps to reproduce (for bugs)
233+
- Highlights and notable changes (for releases)
223234
224235
Use Markdown formatting for readability.
225236
@@ -278,11 +289,19 @@ Return ONLY the comment text - no explanations, no extra formatting.`,
278289
title: 'Branch/Tag',
279290
type: 'short-input',
280291
placeholder: 'Enter branch or tag name',
281-
required: true,
282-
condition: {
292+
required: {
283293
field: 'operation',
284294
value: ['gitlab_create_pipeline', 'gitlab_get_file', 'gitlab_create_branch'],
285295
},
296+
condition: {
297+
field: 'operation',
298+
value: [
299+
'gitlab_create_pipeline',
300+
'gitlab_get_file',
301+
'gitlab_create_branch',
302+
'gitlab_create_release',
303+
],
304+
},
286305
},
287306
// File Path
288307
{
@@ -305,7 +324,102 @@ Return ONLY the comment text - no explanations, no extra formatting.`,
305324
required: true,
306325
condition: {
307326
field: 'operation',
308-
value: ['gitlab_create_file', 'gitlab_update_file', 'gitlab_create_branch'],
327+
value: [
328+
'gitlab_create_file',
329+
'gitlab_update_file',
330+
'gitlab_create_branch',
331+
'gitlab_delete_branch',
332+
],
333+
},
334+
},
335+
// Compare from ref
336+
{
337+
id: 'compareFrom',
338+
title: 'From',
339+
type: 'short-input',
340+
placeholder: 'Branch, tag, or commit SHA to compare from',
341+
required: true,
342+
condition: {
343+
field: 'operation',
344+
value: ['gitlab_compare_branches'],
345+
},
346+
},
347+
// Compare to ref
348+
{
349+
id: 'compareTo',
350+
title: 'To',
351+
type: 'short-input',
352+
placeholder: 'Branch, tag, or commit SHA to compare to',
353+
required: true,
354+
condition: {
355+
field: 'operation',
356+
value: ['gitlab_compare_branches'],
357+
},
358+
},
359+
// Compare directly instead of using merge base
360+
{
361+
id: 'straight',
362+
title: 'Compare Directly',
363+
type: 'switch',
364+
mode: 'advanced',
365+
condition: {
366+
field: 'operation',
367+
value: ['gitlab_compare_branches'],
368+
},
369+
},
370+
// Release tag name
371+
{
372+
id: 'tagName',
373+
title: 'Tag Name',
374+
type: 'short-input',
375+
placeholder: 'Enter the Git tag for the release (e.g., v1.0.0)',
376+
required: true,
377+
condition: {
378+
field: 'operation',
379+
value: ['gitlab_create_release'],
380+
},
381+
},
382+
// Release name
383+
{
384+
id: 'releaseName',
385+
title: 'Release Name',
386+
type: 'short-input',
387+
placeholder: 'Enter release name (optional)',
388+
condition: {
389+
field: 'operation',
390+
value: ['gitlab_create_release'],
391+
},
392+
},
393+
// Release date
394+
{
395+
id: 'releasedAt',
396+
title: 'Released At',
397+
type: 'short-input',
398+
placeholder: 'ISO 8601 date for an upcoming or historical release (optional)',
399+
mode: 'advanced',
400+
condition: {
401+
field: 'operation',
402+
value: ['gitlab_create_release'],
403+
},
404+
wandConfig: {
405+
enabled: true,
406+
prompt: `Generate an ISO 8601 timestamp based on the user's description of when the release happened or will happen.
407+
408+
Return ONLY the timestamp string - no explanations, no extra text.`,
409+
generationType: 'timestamp',
410+
placeholder: 'Describe when the release happened...',
411+
},
412+
},
413+
// Release milestones
414+
{
415+
id: 'releaseMilestones',
416+
title: 'Milestones',
417+
type: 'short-input',
418+
placeholder: 'Milestone titles (comma-separated, optional)',
419+
mode: 'advanced',
420+
condition: {
421+
field: 'operation',
422+
value: ['gitlab_create_release'],
309423
},
310424
},
311425
// File Content
@@ -593,6 +707,7 @@ Return ONLY the commit message - no explanations, no extra text.`,
593707
'gitlab_list_branches',
594708
'gitlab_list_commits',
595709
'gitlab_list_pipeline_jobs',
710+
'gitlab_list_releases',
596711
],
597712
},
598713
},
@@ -614,6 +729,7 @@ Return ONLY the commit message - no explanations, no extra text.`,
614729
'gitlab_list_branches',
615730
'gitlab_list_commits',
616731
'gitlab_list_pipeline_jobs',
732+
'gitlab_list_releases',
617733
],
618734
},
619735
},
@@ -650,13 +766,17 @@ Return ONLY the commit message - no explanations, no extra text.`,
650766
'gitlab_create_file',
651767
'gitlab_update_file',
652768
'gitlab_create_branch',
769+
'gitlab_delete_branch',
770+
'gitlab_compare_branches',
653771
'gitlab_list_branches',
654772
'gitlab_list_commits',
655773
'gitlab_get_merge_request_changes',
656774
'gitlab_approve_merge_request',
657775
'gitlab_list_pipeline_jobs',
658776
'gitlab_get_job_log',
659777
'gitlab_play_job',
778+
'gitlab_list_releases',
779+
'gitlab_create_release',
660780
],
661781
config: {
662782
tool: (params) => {
@@ -960,6 +1080,32 @@ Return ONLY the commit message - no explanations, no extra text.`,
9601080
page: params.page ? Number(params.page) : undefined,
9611081
}
9621082

1083+
case 'gitlab_delete_branch':
1084+
if (!params.projectId?.trim() || !params.branch?.trim()) {
1085+
throw new Error('Project ID and branch name are required.')
1086+
}
1087+
return {
1088+
...baseParams,
1089+
projectId: params.projectId.trim(),
1090+
branch: params.branch.trim(),
1091+
}
1092+
1093+
case 'gitlab_compare_branches':
1094+
if (
1095+
!params.projectId?.trim() ||
1096+
!params.compareFrom?.trim() ||
1097+
!params.compareTo?.trim()
1098+
) {
1099+
throw new Error('Project ID, from ref, and to ref are required.')
1100+
}
1101+
return {
1102+
...baseParams,
1103+
projectId: params.projectId.trim(),
1104+
from: params.compareFrom.trim(),
1105+
to: params.compareTo.trim(),
1106+
straight: params.straight || undefined,
1107+
}
1108+
9631109
case 'gitlab_list_commits':
9641110
if (!params.projectId?.trim()) {
9651111
throw new Error('Project ID is required.')
@@ -1026,6 +1172,34 @@ Return ONLY the commit message - no explanations, no extra text.`,
10261172
jobId: Number(params.jobId),
10271173
}
10281174

1175+
case 'gitlab_list_releases':
1176+
if (!params.projectId?.trim()) {
1177+
throw new Error('Project ID is required.')
1178+
}
1179+
return {
1180+
...baseParams,
1181+
projectId: params.projectId.trim(),
1182+
perPage: params.perPage ? Number(params.perPage) : undefined,
1183+
page: params.page ? Number(params.page) : undefined,
1184+
}
1185+
1186+
case 'gitlab_create_release':
1187+
if (!params.projectId?.trim() || !params.tagName?.trim()) {
1188+
throw new Error('Project ID and tag name are required.')
1189+
}
1190+
return {
1191+
...baseParams,
1192+
projectId: params.projectId.trim(),
1193+
tagName: params.tagName.trim(),
1194+
name: params.releaseName?.trim() || undefined,
1195+
description: params.description?.trim() || undefined,
1196+
ref: params.ref?.trim() || undefined,
1197+
releasedAt: params.releasedAt?.trim() || undefined,
1198+
milestones: params.releaseMilestones
1199+
? params.releaseMilestones.split(',').map((title: string) => title.trim())
1200+
: undefined,
1201+
}
1202+
10291203
default:
10301204
return baseParams
10311205
}
@@ -1071,6 +1245,13 @@ Return ONLY the commit message - no explanations, no extra text.`,
10711245
refName: { type: 'string', description: 'Branch or tag name filter' },
10721246
scope: { type: 'string', description: 'Job scope filter' },
10731247
sha: { type: 'string', description: 'Commit SHA' },
1248+
compareFrom: { type: 'string', description: 'Branch, tag, or commit SHA to compare from' },
1249+
compareTo: { type: 'string', description: 'Branch, tag, or commit SHA to compare to' },
1250+
straight: { type: 'boolean', description: 'Compare directly instead of using the merge base' },
1251+
tagName: { type: 'string', description: 'Git tag for the release' },
1252+
releaseName: { type: 'string', description: 'Release name' },
1253+
releasedAt: { type: 'string', description: 'ISO 8601 date for the release' },
1254+
releaseMilestones: { type: 'string', description: 'Milestone titles (comma-separated)' },
10741255
},
10751256
outputs: {
10761257
// Project outputs
@@ -1091,8 +1272,11 @@ Return ONLY the commit message - no explanations, no extra text.`,
10911272
tree: { type: 'json', description: 'Repository tree entries' },
10921273
content: { type: 'string', description: 'File contents (decoded)' },
10931274
fileName: { type: 'string', description: 'File name' },
1275+
filePath: { type: 'string', description: 'Path to the file in the repository' },
1276+
branch: { type: 'string', description: 'Branch the file was committed to' },
10941277
branches: { type: 'json', description: 'List of branches' },
10951278
commits: { type: 'json', description: 'List of commits' },
1279+
commit: { type: 'json', description: 'A single commit (e.g. latest commit in a comparison)' },
10961280
name: { type: 'string', description: 'Created branch name' },
10971281
webUrl: { type: 'string', description: 'Web URL' },
10981282
// Merge request change outputs
@@ -1102,6 +1286,13 @@ Return ONLY the commit message - no explanations, no extra text.`,
11021286
// Job outputs
11031287
jobs: { type: 'json', description: 'Pipeline jobs' },
11041288
log: { type: 'string', description: 'Job log output' },
1289+
// Compare outputs
1290+
diffs: { type: 'json', description: 'File diffs between two compared references' },
1291+
compareTimeout: { type: 'boolean', description: 'Whether the comparison timed out' },
1292+
compareSameRef: { type: 'boolean', description: 'Whether both compared references match' },
1293+
// Release outputs
1294+
releases: { type: 'json', description: 'List of releases' },
1295+
release: { type: 'json', description: 'Release details' },
11051296
// Success indicator
11061297
success: { type: 'boolean', description: 'Operation success status' },
11071298
},
@@ -1213,5 +1404,12 @@ export const GitLabBlockMeta = {
12131404
content:
12141405
'# Monitor Pipeline Status\n\nUse GitLab to keep an eye on CI pipelines.\n\n## Steps\n1. List pipelines for the project and identify the most recent runs.\n2. Get the pipeline details for any that failed to read the status and reason.\n3. If a failure looks transient, use Retry Pipeline to re-run it.\n\n## Output\nReturn a summary of recent pipeline runs (ref, status, when) and call out any failures. If a retry was triggered, include the retried pipeline ID.',
12151406
},
1407+
{
1408+
name: 'draft-release-notes',
1409+
description:
1410+
'Compare two refs, summarize the merged changes, and publish a GitLab release with generated notes.',
1411+
content:
1412+
"# Draft Release Notes\n\nUse GitLab to publish a release with notes generated from the changes since the last tag.\n\n## Steps\n1. Compare Branches between the previous release tag and the target ref to list the commits and diffs.\n2. Summarize the changes into readable release notes, grouped by feature, fix, or chore.\n3. Use Create Release with the new tag name, the generated description, and the target ref.\n\n## Output\nReturn the created release's tag name and a confirmation that the notes were published, along with the release notes text.",
1413+
},
12161414
],
12171415
} as const satisfies BlockMeta

0 commit comments

Comments
 (0)