Switch GitLab MR creation from CLI to REST API #23

Closed
opened 2026-07-25 21:46:50 +00:00 by david · 1 comment
Owner

Summary

Switch GitLab MR creation from CLI (glab) to REST API calls, following the existing issue-fetching pattern.

Motivation

  • Remove the glab CLI dependency for GitLab-origin repos.
  • Make MR creation deterministic, unit-testable code.
  • Align with how issue fetching already works (REST via GitLabIssueClient).

Acceptance Criteria

  • New GitLabMrClient class in src/gitlab/services/gitLabMrClient.ts
  • Implements MrClient interface with createMr(input): Promise<CreateMrResult>
  • Uses POST /api/v4/projects/{id}/merge_requests endpoint
  • Reuses existing HttpFetch/withRetry infrastructure
  • Git operations (branch, commit, push) handled deterministically via gitRunner
  • runMrStage updated to use GitLabMrClient for gitlab platform
  • Unit tests for GitLabMrClient (success, 401, 403, 404, 429, 500, malformed response)
  • mr-result.json schema unchanged
  • No remaining references to glab CLI in the GitLab code path

Implementation Steps

  1. Create GitLabMrClient class mirroring GitLabIssueClient
  2. Update runMrStage to use deterministic git + REST for GitLab
  3. Remove GitLab CLI guidance from defaultMrSkillBody
  4. Add unit tests
  5. Verify npm test and npm run lint pass
  • Design doc: docs/design-rest-mr-creation.md
  • Implementation plan: docs/implementation-plan-rest-mr.md (Milestone M3)
  • See also: Forgejo (#21), GitHub (#22) sibling issues
## Summary Switch GitLab MR creation from CLI (`glab`) to REST API calls, following the existing issue-fetching pattern. ## Motivation - Remove the `glab` CLI dependency for GitLab-origin repos. - Make MR creation deterministic, unit-testable code. - Align with how issue fetching already works (REST via `GitLabIssueClient`). ## Acceptance Criteria - [ ] New `GitLabMrClient` class in `src/gitlab/services/gitLabMrClient.ts` - [ ] Implements `MrClient` interface with `createMr(input): Promise<CreateMrResult>` - [ ] Uses `POST /api/v4/projects/{id}/merge_requests` endpoint - [ ] Reuses existing `HttpFetch`/`withRetry` infrastructure - [ ] Git operations (branch, commit, push) handled deterministically via `gitRunner` - [ ] `runMrStage` updated to use `GitLabMrClient` for `gitlab` platform - [ ] Unit tests for `GitLabMrClient` (success, 401, 403, 404, 429, 500, malformed response) - [ ] `mr-result.json` schema unchanged - [ ] No remaining references to `glab` CLI in the GitLab code path ## Implementation Steps 1. Create `GitLabMrClient` class mirroring `GitLabIssueClient` 2. Update `runMrStage` to use deterministic git + REST for GitLab 3. Remove GitLab CLI guidance from `defaultMrSkillBody` 4. Add unit tests 5. Verify `npm test` and `npm run lint` pass ## Related - Design doc: `docs/design-rest-mr-creation.md` - Implementation plan: `docs/implementation-plan-rest-mr.md` (Milestone M3) - See also: Forgejo (#21), GitHub (#22) sibling issues
david closed this issue 2026-08-10 04:15:38 +00:00
Author
Owner

pi-loop opened and merged a pull request for this issue: #188

pi-loop opened and merged a pull request for this issue: https://git.excelera.net/david/pi-loop/pulls/188
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
david/pi-loop#23
No description provided.