feat(gitlab): issue and merge request writeback parity
GitLab writeback parity for issues and merge requests
Problem
GitLab is advertised as a first-class Relayfile provider, but its writeback catalog previously exposed only merge-request discussions and issue notes. A GitLab-backed software factory could not create issues or merge requests through Relayfile.
Catalog
| Before | After |
|---|---|
comments, discussions | issues (create + update), merge-requests (create + update), refs, merge, close-merge-request, plus the existing comments and discussions |
New canonical writeback templates:
/gitlab/projects/{projectPath}/issues/gitlab/projects/{projectPath}/issues/{issueIid}__{slug}/meta.json/gitlab/projects/{projectPath}/merge-requests/gitlab/projects/{projectPath}/merge_requests/{mergeRequestIid}__{slug}/meta.json/gitlab/projects/{projectPath}/merge_requests/{mergeRequestIid}__{slug}/merge.json/gitlab/projects/{projectPath}/merge_requests/{mergeRequestIid}__{slug}/close.json/gitlab/projects/{projectPath}/refs
GitLab REST v4 endpoints
POST /projects/:id/issuesPUT /projects/:id/issues/:iidPOST /projects/:id/merge_requestsPUT /projects/:id/merge_requests/:iidPUT /projects/:id/merge_requests/:iid/mergePUT /projects/:id/merge_requests/:iidwithstate_event: close | reopenPOST /projects/:id/repository/branches
Payload validation rejects missing required fields, invalid lifecycle states, read-only fields, unknown fields, and unsupported paths. Label arrays are normalized to GitLab's comma-separated API representation.
Discovery and layout
Every new resource has non-empty JSON Schema and create-example contracts, is represented in the GitLab adapter discovery guide, layout manifest, LAYOUT prompt, mappings, and generated writeback catalog. The shared file-native router now supports nested GitLab projectPath segments when recognizing exact writeback sidecars.
Validation
npm test -w @relayfile/adapter-gitlab— 93 passingnpm run typecheck -w @relayfile/adapter-gitlabnpm run build -w @relayfile/adapter-gitlabnpm test(workspace gate)npm run typecheck(workspace gate)npm run test:writeback-discovery— 119 endpoints verifiednpm run test:digest-contracts- Veto diff review — PASS (one low-severity follow-up: restore explicit TypeScript payload/request types in
writeback.ts)
Scope
Nothing was skipped. refs is included because it is the GitLab equivalent of GitHub's branch-creation route and lets a flow create a branch before opening a merge request. f.gitlab was not changed.
Release note
@relayfile/adapter-gitlab is bumped from 0.4.2 to 0.5.0 for the new capability. Consumers that mount GitLab paths should resync to materialize the new discovery and catalog surface.
Reviewer notes (orchestrator)
- Rebased onto
mainafter relayfile-adapters#281 / the 0.2.1 publish; re-rannpm test -w packages/gitlab(93/93), rootnpm run typecheck(55/55 tasks) and rootnpm test(105/105 tasks) post-rebase. - One shared-runtime change to flag:
packages/core/src/runtime/file-native-router.tsreadExactFileResourceIdno longer requires equal segment counts, so a{projectPath}placeholder can span a nested GitLab namespace (group/subgroup/project). Fixed suffix segments are still matched from the right; only placeholder templates are affected. packages/coregained mapping + generated catalog entries but its version is not bumped here — the publish workflow's changed-package mode should pick it up; shout if you want an explicit core bump in this PR.- Follow-up (out of scope,
../flows): make thef.gitlabhelper's read/list gap visible or close it, per the "second-class provider" note that prompted this.
🤖 Generated with Claude Code
[!NOTE]
Medium Risk
Expands provider write surface (create branches, MRs, merges) and changes shared exact-file ID matching for nested GitLab project paths; mis-routing could affect non-GitLab adapters using similar templates.
Overview
Adds file-native GitLab writeback for issues, merge requests, branches, and merge-request lifecycle actions—beyond the prior discussions/notes-only surface.
Agents can draft creates under issues/, merge-requests/, and refs/, patch issue/MR meta.json, and drive merge and close/reopen via merge.json / close.json sidecars. GitLabWritebackHandler routes these to GitLab REST v4 with stricter payload validation (allowed fields, read-only rejection, label normalization, state_event checks).
Discovery and contracts are wired through mappings, generated writeback catalog, JSON schemas/examples, layout manifest, and LAYOUT.md. Path helpers and parseGitLabPath understand merge-requests vs merge_requests and new draft/sidecar paths.
In adapter-core, readExactFileResourceId no longer requires equal segment counts so nested {projectPath} namespaces match exact sidecar templates (e.g. group/subgroup/project).
Reviewed by Cursor Bugbot for commit 70de4fa998148f6c78bbee65cab72e75de0e8232. Bugbot is set up for automated code reviews on this repo. Configure here.
Agent Relay sessions
claudesession7fa0c082· opened viagh pr create· last active 2026-09-19