Skip to content

feat(gitlab): add release and branch-compare tools, remove dead types#5475

Merged
waleedlatif1 merged 3 commits into
stagingfrom
gitlab-validate-audit
Jul 7, 2026
Merged

feat(gitlab): add release and branch-compare tools, remove dead types#5475
waleedlatif1 merged 3 commits into
stagingfrom
gitlab-validate-audit

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Ran a full validate-integration pass on GitLab tools/block against live GitLab API docs
  • Added 4 tools: gitlab_delete_branch, gitlab_compare_branches, gitlab_list_releases, gitlab_create_release (fills real coverage gaps - branch CRUD was create-only, no release support existed despite a "release publisher" BlockMeta template already referencing it)
  • Wired all 4 into the block (operation dropdown, subBlocks/conditions, tools.access, tools.config)
  • Removed 12 unexported, zero-consumer types left over from never-implemented tool ideas (labels, users, current-user, branch/notes listing) — confirmed dead via repo-wide grep at the pre-change commit, not referenced anywhere
  • Added filePath/branch block outputs that get_file/create_file/update_file already returned but weren't exposed
  • Broadened state/orderBy param descriptions on list_issues/list_merge_requests to list all documented GitLab values

Type of Change

  • New feature / integration coverage improvement

Testing

  • Independently re-verified with 3 parallel adversarial passes: live API-doc alignment (0 critical findings), backwards-compatibility (confirmed safe - all removed types were dead, all diffs additive except intentional dead-code removal), and lint/typecheck/tests
  • bun run lint, tsc --noEmit, bun run check:api-validation all pass clean
  • Existing gitlab test suite (7/7) passes

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

- 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
@vercel

vercel Bot commented Jul 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Jul 7, 2026 3:39pm

Request Review

@cursor

cursor Bot commented Jul 7, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
New write/delete GitLab API actions (delete branch, create release) can mutate repos if misconfigured, but changes follow existing PAT-based tool patterns with validation; type removals are dead code only.

Overview
Adds four GitLab operations end-to-end: Delete Branch, Compare Branches, List Releases, and Create Release, each with new tool implementations registered in the tool registry and exposed on the GitLab block (operation picker, conditional sub-blocks, param mapping, and outputs).

The block UI gains compare fields (compareFrom / compareTo / straight), release fields (tag, name, releasedAt, milestones), and wiring so Create Release can reuse description and optional Branch/Tag ref. A new draft-release-notes skill documents compare → summarize → create release. Several block outputs are added so existing tool results (file path/branch, compare diffs, releases, pagination total, etc.) are visible in workflows.

Types cleanup removes unused, never-exported GitLab param/response shapes (labels, users, notes listing, etc.) and introduces exported types for the new tools. Minor doc tweaks: MR /diffs deprecation note, broader orderBy / state descriptions on list issues/MRs.

Reviewed by Cursor Bugbot for commit aba2162. Configure here.

@greptile-apps

greptile-apps Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR extends the GitLab block with four new operations — delete_branch, compare_branches, list_releases, and create_release — and removes 12 dead, unexported types that were never wired to any tool. It also exposes previously-returned-but-undeclared block outputs (filePath, branch, commit, mergeRequestIid, etc.) and broadens orderBy/state param descriptions across list tools.

  • New tools: Each tool (delete_branch, compare_branches, list_releases, create_release) is fully implemented with correct URL construction, header/body setup, and transformResponse; all four are registered in the global tool registry and wired into the block's dropdown, subBlocks, conditions, tools.access, and tools.config switch cases.
  • Dead-code removal: 12 unexported interfaces (GitLabUser, GitLabLabel, GitLabMilestone, and related param/response types) confirmed zero-consumer at the pre-change commit are deleted; the GitLabResponse discriminated union is updated accordingly.
  • Additive outputs: Block-level output declarations expanded to surface fields already returned by existing tools (filePath, branch, changesCount, approvedBy, id, status, total), making them accessible in downstream blocks without any executor changes.

Confidence Score: 5/5

All changes are purely additive (new tools + dead-code removal); no existing tool logic is modified.

Every new tool follows the established pattern for URL encoding, headers, body serialization, and response transformation. The dead-type removal is confined to unexported, zero-consumer interfaces, so no compiled output changes. The block wiring is complete and internally consistent across dropdown, subBlocks, conditions, access list, and switch-case configs. The existing 7-test GitLab suite is unaffected.

No files require special attention.

Important Files Changed

Filename Overview
apps/sim/blocks/blocks/gitlab.ts Wires all 4 new operations into the block: dropdown labels, projectId condition, description wandConfig, new subBlocks, tools.access list, and switch-case configs. All case mappings align with their tool param definitions.
apps/sim/tools/gitlab/compare_branches.ts New tool wrapping the GitLab repository compare API. URL-encodes projectId and builds query params correctly. Response fields mapped snake_case to camelCase correctly.
apps/sim/tools/gitlab/create_release.ts New POST tool for creating a GitLab release. Body conditionally includes optional fields with Content-Type set correctly. Follows the same object-body pattern as other POST tools.
apps/sim/tools/gitlab/delete_branch.ts New DELETE tool. Properly URL-encodes both project ID and branch name. GitLab 204 No Content on success is captured correctly by response.ok.
apps/sim/tools/gitlab/list_releases.ts New GET list tool with pagination. Reads x-total from response headers and falls back to array length when absent.
apps/sim/tools/gitlab/types.ts Removes 12 dead unexported types and adds new exported param/response interfaces for the 4 new tools. The GitLabResponse union is updated accordingly.
apps/sim/tools/gitlab/index.ts Adds imports and re-exports for the 4 new tools, consistent with the existing alphabetical pattern.
apps/sim/tools/registry.ts Adds the 4 new tools to the global tool registry under the correct gitlab_* keys in alphabetical order.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant Block as GitLab Block
    participant Runner as Tool Runner
    participant API as GitLab REST API

    Note over Block,API: Delete Branch
    Block->>Runner: "gitlab_delete_branch {projectId, branch}"
    Runner->>API: DELETE /projects/:id/repository/branches/:branch
    API-->>Runner: 204 No Content
    Runner-->>Block: "{success: true}"

    Note over Block,API: Compare Branches
    Block->>Runner: "gitlab_compare_branches {projectId, from, to, straight?}"
    Runner->>API: GET /projects/:id/repository/compare
    API-->>Runner: "{commit, commits[], diffs[], compare_timeout, compare_same_ref}"
    Runner-->>Block: "{commit, commits, diffs, compareTimeout, compareSameRef, webUrl}"

    Note over Block,API: List Releases
    Block->>Runner: "gitlab_list_releases {projectId, orderBy?, sort?, perPage?, page?}"
    Runner->>API: GET /projects/:id/releases
    API-->>Runner: releases[] + x-total header
    Runner-->>Block: "{releases, total}"

    Note over Block,API: Create Release
    Block->>Runner: "gitlab_create_release {projectId, tagName, name?, description?, ref?, releasedAt?, milestones?}"
    Runner->>API: POST /projects/:id/releases
    API-->>Runner: release object
    Runner-->>Block: "{release}"
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant Block as GitLab Block
    participant Runner as Tool Runner
    participant API as GitLab REST API

    Note over Block,API: Delete Branch
    Block->>Runner: "gitlab_delete_branch {projectId, branch}"
    Runner->>API: DELETE /projects/:id/repository/branches/:branch
    API-->>Runner: 204 No Content
    Runner-->>Block: "{success: true}"

    Note over Block,API: Compare Branches
    Block->>Runner: "gitlab_compare_branches {projectId, from, to, straight?}"
    Runner->>API: GET /projects/:id/repository/compare
    API-->>Runner: "{commit, commits[], diffs[], compare_timeout, compare_same_ref}"
    Runner-->>Block: "{commit, commits, diffs, compareTimeout, compareSameRef, webUrl}"

    Note over Block,API: List Releases
    Block->>Runner: "gitlab_list_releases {projectId, orderBy?, sort?, perPage?, page?}"
    Runner->>API: GET /projects/:id/releases
    API-->>Runner: releases[] + x-total header
    Runner-->>Block: "{releases, total}"

    Note over Block,API: Create Release
    Block->>Runner: "gitlab_create_release {projectId, tagName, name?, description?, ref?, releasedAt?, milestones?}"
    Runner->>API: POST /projects/:id/releases
    API-->>Runner: release object
    Runner-->>Block: "{release}"
Loading

Reviews (3): Last reviewed commit: "fix(gitlab): drop empty entries when spl..." | Re-trigger Greptile

Comment thread apps/sim/blocks/blocks/gitlab.ts
- Add total, size, ref, blobId, lastCommitId, mergeRequestIid,
  changesCount, approvedBy, protected, id, status to the block outputs
  map — these fields are already returned by their respective tools
  but weren't declared as outputs
- Add missing 'title' value to list_issues orderBy description
Trailing/extra commas in the milestones input (e.g. "v1, ,v2") would
produce an empty string entry, which the GitLab API rejects.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile review

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit aba2162. Configure here.

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile review

@waleedlatif1 waleedlatif1 merged commit a5b8c7e into staging Jul 7, 2026
18 checks passed
@waleedlatif1 waleedlatif1 deleted the gitlab-validate-audit branch July 7, 2026 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant