From 85721bd873434af2530db754cdbbfe21ec2a3e44 Mon Sep 17 00:00:00 2001 From: Matt Glaman Date: Wed, 20 May 2026 14:03:02 -0500 Subject: [PATCH 1/2] feat: add issue:fork/assign/label commands for GitLab work item bot Wraps the new Drupal.org bot slash commands (/do:fork, /do:access, /do:assign, /do:unassign, /do:reassign, /do:label, /do:unlabel, /do:relabel) as drupalorg-cli commands. Each posts a comment on the target GitLab work item via the GitLab issue notes endpoint, which the upstream bot then acts on. Token resolution falls back to `glab config get token` when DRUPALORG_GITLAB_TOKEN is unset. drupalorg-work-on-issue and drupalorg-mr-review skills updated to use the new commands at the natural workflow points (fork creation, self assign, verdict label). Co-Authored-By: Claude Opus 4.7 (1M context) --- skill-data/drupalorg-cli/SKILL.md | 33 +++++ skill-data/drupalorg-work-on-issue/SKILL.md | 29 ++++ .../GitLab/PostWorkItemSlashCommandAction.php | 85 +++++++++++ src/Api/GitLab/Client.php | 63 +++++++- src/Api/GitLab/SlashCommand.php | 111 ++++++++++++++ src/Api/Result/Issue/SlashCommandResult.php | 38 +++++ src/Cli/Application.php | 8 + src/Cli/Command/Issue/Assign.php | 47 ++++++ src/Cli/Command/Issue/Fork.php | 43 ++++++ src/Cli/Command/Issue/GetAccess.php | 43 ++++++ src/Cli/Command/Issue/Label.php | 47 ++++++ src/Cli/Command/Issue/Reassign.php | 47 ++++++ src/Cli/Command/Issue/Relabel.php | 47 ++++++ src/Cli/Command/Issue/Unassign.php | 47 ++++++ src/Cli/Command/Issue/Unlabel.php | 47 ++++++ src/Cli/Formatter/AbstractFormatter.php | 3 + src/Cli/Formatter/LlmFormatter.php | 18 +++ src/Cli/Formatter/MarkdownFormatter.php | 13 ++ .../PostWorkItemSlashCommandActionTest.php | 139 ++++++++++++++++++ tests/src/GitLab/SlashCommandTest.php | 108 ++++++++++++++ 20 files changed, 1014 insertions(+), 2 deletions(-) create mode 100644 src/Api/Action/GitLab/PostWorkItemSlashCommandAction.php create mode 100644 src/Api/GitLab/SlashCommand.php create mode 100644 src/Api/Result/Issue/SlashCommandResult.php create mode 100644 src/Cli/Command/Issue/Assign.php create mode 100644 src/Cli/Command/Issue/Fork.php create mode 100644 src/Cli/Command/Issue/GetAccess.php create mode 100644 src/Cli/Command/Issue/Label.php create mode 100644 src/Cli/Command/Issue/Reassign.php create mode 100644 src/Cli/Command/Issue/Relabel.php create mode 100644 src/Cli/Command/Issue/Unassign.php create mode 100644 src/Cli/Command/Issue/Unlabel.php create mode 100644 tests/src/Action/GitLab/PostWorkItemSlashCommandActionTest.php create mode 100644 tests/src/GitLab/SlashCommandTest.php diff --git a/skill-data/drupalorg-cli/SKILL.md b/skill-data/drupalorg-cli/SKILL.md index 79a2275..c86a1c1 100644 --- a/skill-data/drupalorg-cli/SKILL.md +++ b/skill-data/drupalorg-cli/SKILL.md @@ -131,6 +131,39 @@ drupalorg mr:logs drupalorg mr:logs 'project/drupal!708' ``` +### Slash commands (GitLab work items only) + +These commands post Drupal.org bot quick-actions as comments on a GitLab work item. +They only work for projects whose issue queue lives at `git.drupalcode.org` (the bot +is not present on classic Drupal.org issue queues). + +The `` argument is a WorkItemRef — bare NID, `project_name#nid`, or full URL. + +Each command also accepts `--format=text|json|md|llm`. Posting is asynchronous: the +bot processes the comment after it lands, so re-fetch with `--no-cache` to confirm. + +```bash +# Create a fork (and a default-branch issue branch) for an issue without a fork +drupalorg issue:fork + +# Grant the current user push access to the existing fork +drupalorg issue:get-access + +# Assign one or more users (default: me) +drupalorg issue:assign [user...] +drupalorg issue:unassign [user...] +drupalorg issue:reassign [user...] + +# Manage labels (e.g. state::needsReview, state::rtbc, state::needsWork) +drupalorg issue:label