Skip to content

feat: support GitLab work items for projects without a Drupal.org issue queue#338

Merged
mglaman merged 8 commits into
mainfrom
gitlab-work-items
May 18, 2026
Merged

feat: support GitLab work items for projects without a Drupal.org issue queue#338
mglaman merged 8 commits into
mainfrom
gitlab-work-items

Conversation

@mglaman
Copy link
Copy Markdown
Owner

@mglaman mglaman commented May 18, 2026

Summary

  • Detects projects that have migrated to GitLab work items via field_project_has_issue_queue: false on the D.o project node
  • project:issues delegates to glab issue list for these projects (shows a stderr notice)
  • issue:show accepts git.drupalcode.org/-/work_items/{id} and /-/issues/{id} URLs, fetching via glab issue view
  • Full --format=json|md|llm support via new GitLabIssueResult / GitLabIssuesResult types and formatter implementations
  • Two new MCP tools: gitlab_issue_show(workItemUrl) and gitlab_project_issues(machineName, state, limit)

Key detail: On drupalcode.org, the GitLab iid equals the Drupal.org NID, so the number in /-/work_items/3586157 maps directly to glab issue view 3586157.

Requires glab CLI installed and authenticated with git.drupalcode.org.

Closes #335
Closes #337

Test plan

  • ./drupalorg project:issues ai_context — uses glab path, prints notice to stderr
  • ./drupalorg project:issues drupal — still uses D.o API path
  • ./drupalorg issue:show https://git.drupalcode.org/project/ai_context/-/work_items/3586157
  • ./drupalorg project:issues ai_context --format=json
  • ./drupalorg issue:show https://git.drupalcode.org/project/ai_context/-/work_items/3586157 --format=llm
  • PHPStan + PHPCS + phpunit all pass

🤖 Generated with Claude Code

mglaman and others added 8 commits May 18, 2026 16:48
…he Drupal.org issue queue

Projects with `field_project_has_issue_queue: false` now route through
`glab` CLI instead of the Drupal.org API.

- Add `hasIssueQueue` to `Project` entity
- Add `WorkItemRef` to parse `git.drupalcode.org/-/work_items/{id}` URLs
- Add `GetGitLabIssueAction` and `ListGitLabIssuesAction` (glab subprocess)
- Add `GitLabIssueResult` / `GitLabIssuesResult` with full formatter support
- `issue:show` detects GitLab URLs and delegates to glab
- `project:issues` delegates to glab when project has no D.o issue queue
- Register `gitlab_issue_show` and `gitlab_project_issues` MCP tools

Closes #335, closes #337

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
GetGitLabIssueAction and ListGitLabIssuesAction now use the existing
GitLab\Client (Guzzle) instead of shelling out to glab. Public projects
on drupalcode.org require no auth; private projects use DRUPALORG_GITLAB_TOKEN
when set. This removes the glab dependency for all read operations.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ands

IssueCommandBase now detects work item URLs (git.drupalcode.org/-/work_items),
extracts the numeric NID and stores a WorkItemRef. GetIssueForkAction accepts
an optional project machine name to skip the D.o node lookup, which fails for
GitLab-native work items that have no field_project on drupal.org.

  issue:get-fork https://git.drupalcode.org/project/ai_context/-/work_items/3586157
  mr:list https://git.drupalcode.org/project/ai_context/-/work_items/3586157

Both now resolve the issue fork and project MRs correctly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…upport

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
WorkItemRef better matches MergeRequestRef's naming convention. Also adds
shorthand notation so users can reference work items without full URLs:

  ai_context#3586157            (project/ prefix assumed)
  project/ai_context#3586157   (explicit path)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- drupalorg-work-on-issue: accept WorkItemRef inputs (NID, shorthand, URL)
- drupalorg-cli: document WorkItemRef formats, GitLab project auto-detection,
  updated error table with GitLab-specific errors
- drupalorg-issue-search: detect GitLab work item projects and skip D.o channels
- drupalorg-issue-summary-update: early-exit with clear message for GitLab work items

Closes #337

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
mr:status, mr:diff, mr:files, and mr:logs all pass $this->mrRef to their
actions. When a WorkItemRef is parsed by IssueCommandBase, mrRef was never
set, so actions fell through to resolveGitLabProject() which fails for
GitLab work item projects (no field_project on the D.o node).

Synthesizing a MergeRequestRef from the WorkItemRef's projectPath causes
actions to use resolveFromRef() instead, which queries GitLab directly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@mglaman mglaman merged commit 4b90f01 into main May 18, 2026
4 checks passed
@mglaman mglaman deleted the gitlab-work-items branch May 18, 2026 22:17
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.

Have skill ignored git.drupalcode.org work items Figure out support for projects using GitLab issues

1 participant