feat(flows): GitLab as a ticket source and repository host in onboarding

Merged
KJ
2mo ago
+227-25

Stacked on #98 (resilient checks), which owns the generator this changes.

Why

A GitLab flow could not be set up: the onboarding offered no GitLab source, and the generated flow always ended in gh pr create, which cannot open a GitLab merge request.

Cloud contract this targets (AgentWorkforce/cloud#3800 / #3801, not changed here)

  • Deploy handoff (flow-handoff.ts) accepts sources containing "gitlab" and sourceSettings.gitlab = { project: "namespace/project", labels?: "a, b" } (it also accepts events: "issues" | "merge_request"; not offered here, for parity with GitHub, whose onboarding has no events choice either).
  • With no GitHub source, Cloud infers the deploy target as the GitLab project from sourceSettings.gitlab.project.
  • A delivered GitLab issue reaches the flow as { source: "gitlab", title, body, labels, project }.
  • Hosted repository runs have relayflow-open-change on PATH: gh pr create with the same args/exit status on GitHub, a merge request on GitLab (--title, --body-file, --draft supported).

Changes

  • Source: GitLab (project, labels) in ISSUE_SOURCES; icon (SiGitlab) and colour in the picker; validation, summaries and the generated Issue type follow from the shared tables. repositoryHost(sources) mirrors Cloud's inference and drives the "Open PR" step's icon in the workflow picker and the handoff preview.
  • Generated flow: the change request opens through open_change() { relayflow-open-change "$@" if on PATH, else gh pr create "$@" } (FLOW_OPEN_CHANGE_COMMAND), keeping --draft for failing checks.
  • Local kit: the preflight stops a GitLab origin (gitlab.com or a gitlab.* host) before any agent runs and points at the Cloud deploy; START-HERE and the Run options copy say so.

Degrades on GitLab (noted, not fixed here)

Marking a PR back to draft after a failed review/check (gh pr ready --undo) and posting the report as a comment (gh pr comment) are GitHub-only. On GitLab those steps already exit 0 and print "could not convert / could not comment", and the report stays in review-blocked.md / .relayflow/check-report.md; the MR itself is opened as a draft up front when checks fail. The fixer's task text still suggests gh pr view --comments. A relayflow-open-change counterpart for draft/comment would close this in Cloud.

Verification

  • web vitest: 20 files / 197 tests pass (new flow-gitlab-source.test.ts: source fields, validation, host rule, Issue type, local project/label filtering incl. the kit's own prefill, preview icon; new FLOW_OPEN_CHANGE_COMMAND shell tests with fake relayflow-open-change/gh on PATH: helper used when present, gh pr create fallback with identical args, exit status kept; GitLab-origin preflight for SSH, HTTPS and self-managed hosts, with the existing example.com origin as positive control).
  • tsc --noEmit (web) clean.
  • Rendered GitLab flows (cloud + local × simple + traditional): flows check passes on all four with @relayflows/surface 2.0.18, and strict tsc against the surface types is clean (a deliberately broken copy fails, so the check is real).

🤖 Generated with Claude Code


[!NOTE]
Medium Risk
Touches generated flow publish steps and local preflight gates; mistakes in GitLab vs GitHub remote detection could block valid repos or allow unsupported local runs.

Overview
Adds GitLab as a flow ticket source in onboarding (project + labels), with picker icon/styling and the same validation and generated Issue shape Cloud expects.

Repository host inference (repositoryHost): when GitLab is selected without GitHub, the workflow preview and “Open PR” step show GitLab instead of GitHub, matching Cloud’s deploy target rules.

Generated flows no longer call gh pr create directly. They use FLOW_OPEN_CHANGE_COMMAND, which prefers hosted relayflow-open-change (GitHub PR or GitLab MR) and falls back to gh pr create locally.

Local kit preflight detects GitLab origin URLs (including self-managed hosts) and stops before agents run, with copy in START-HERE and Run options directing users to Cloud for GitLab repos.

Reviewed by Cursor Bugbot for commit db7adaa564d67d90ccadc6a9b389af39fa37a393. Bugbot is set up for automated code reviews on this repo. Configure here.