opencode-gitlab-dap 1.4.3 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -49,30 +49,69 @@ Type `@Flow Name` followed by your goal to execute a flow:
49
49
 
50
50
  The plugin:
51
51
 
52
- 1. Intercepts the `@` mention via `chat.message` hook
53
- 2. Dispatches a subagent that fetches the flow definition
54
- 3. Gathers required inputs using available GitLab tools
55
- 4. Executes the flow via `POST /api/v4/ai/duo_workflows/workflows`
56
- 5. Monitors workflow status until it starts running
57
- 6. Reports the workflow URL for tracking in GitLab UI
58
-
59
- ### 13 DAP Tools
60
-
61
- | Tool | Description |
62
- | ------------------------------ | ------------------------------------------ |
63
- | `gitlab_list_agents` | Search agents in the global AI Catalog |
64
- | `gitlab_get_agent` | Get agent details by ID |
65
- | `gitlab_list_project_agents` | List agents enabled for a project |
66
- | `gitlab_enable_project_agent` | Enable an agent in a project |
67
- | `gitlab_disable_project_agent` | Disable an agent in a project |
68
- | `gitlab_list_flows` | Search flows in the global AI Catalog |
69
- | `gitlab_get_flow` | Get flow details by ID |
70
- | `gitlab_list_project_flows` | List flows enabled for a project |
71
- | `gitlab_enable_project_flow` | Enable a flow in a project |
72
- | `gitlab_disable_project_flow` | Disable a flow in a project |
73
- | `gitlab_execute_project_flow` | Execute a flow via DWS REST API |
74
- | `gitlab_get_flow_definition` | Get flow YAML config (inputs, components) |
75
- | `gitlab_get_workflow_status` | Monitor workflow execution status and logs |
52
+ 1. Registers the flow as a subagent with a built-in prompt containing flow execution instructions
53
+ 2. The subagent fetches the flow definition and parses what `context:goal` maps to (e.g., `merge_request_iid`, `pipeline_url`)
54
+ 3. Resolves the goal to the exact value the flow expects (e.g., just `14` for an MR IID, not a sentence)
55
+ 4. Gathers required additional inputs using available GitLab tools
56
+ 5. Executes the flow via `POST /api/v4/ai/duo_workflows/workflows`
57
+ 6. Monitors workflow status and reports the workflow URL for tracking in GitLab UI
58
+
59
+ ### Parallel Multi-Flow Dispatch
60
+
61
+ Mention multiple flows in a single message to execute them simultaneously:
62
+
63
+ ```
64
+ @AppSec Security MR Reviewer @Code Review 🦊 review all open MRs
65
+ ```
66
+
67
+ When multiple flows are mentioned:
68
+
69
+ 1. The `chat.message` hook detects multiple `@` mentions and produces a single combined dispatch instruction
70
+ 2. A single `general` subagent is dispatched via the Task tool
71
+ 3. The subagent executes all flows concurrently — it calls `gitlab_get_flow_definition` for all flows at once, then `gitlab_execute_project_flow` for all flow+resource combinations, then polls all statuses
72
+ 4. For batch operations ("for each MR", "all open MRs"), the main agent lists resources first, then the subagent dispatches N flows × M resources in parallel
73
+
74
+ The `experimental.chat.system.transform` hook injects system prompt guidelines that instruct the main agent on how to handle multi-flow and batch dispatch scenarios.
75
+
76
+ ### Custom Agent Creation
77
+
78
+ Create custom agents interactively:
79
+
80
+ ```
81
+ Create an agent that responds to prompts in the form of poems
82
+ ```
83
+
84
+ The plugin guides you through an interactive workflow:
85
+
86
+ 1. Discovers available built-in tools (`gitlab_list_builtin_tools`) and MCP servers (`gitlab_list_project_mcp_servers`)
87
+ 2. Asks for agent name, visibility, tool categories, and MCP servers via the question tool
88
+ 3. Generates a system prompt and shows the full configuration for approval
89
+ 4. Creates the agent via `gitlab_create_agent` (with `confirmed` gate to prevent accidental creation)
90
+ 5. Offers to enable the agent on the current project
91
+
92
+ The `confirmed` parameter on `gitlab_create_agent` enforces the interactive workflow — the tool returns instructions instead of creating the agent when called without explicit confirmation.
93
+
94
+ ### 17 DAP Tools
95
+
96
+ | Tool | Description |
97
+ | --------------------------------- | ------------------------------------------------------- |
98
+ | `gitlab_list_agents` | Search agents in the global AI Catalog |
99
+ | `gitlab_get_agent` | Get agent details by ID |
100
+ | `gitlab_list_project_agents` | List agents enabled for a project |
101
+ | `gitlab_enable_project_agent` | Enable an agent in a project |
102
+ | `gitlab_disable_project_agent` | Disable an agent in a project |
103
+ | `gitlab_create_agent` | Create a custom agent (interactive, confirmation-gated) |
104
+ | `gitlab_update_agent` | Update an existing custom agent |
105
+ | `gitlab_list_builtin_tools` | List available built-in tools for agent configuration |
106
+ | `gitlab_list_flows` | Search flows in the global AI Catalog |
107
+ | `gitlab_get_flow` | Get flow details by ID |
108
+ | `gitlab_list_project_flows` | List flows enabled for a project |
109
+ | `gitlab_enable_project_flow` | Enable a flow in a project |
110
+ | `gitlab_disable_project_flow` | Disable a flow in a project |
111
+ | `gitlab_execute_project_flow` | Execute a flow via DWS REST API |
112
+ | `gitlab_get_flow_definition` | Get flow YAML config (inputs, components) |
113
+ | `gitlab_get_workflow_status` | Monitor workflow execution status and logs |
114
+ | `gitlab_list_project_mcp_servers` | List MCP servers available for project agents |
76
115
 
77
116
  ### Dynamic Refresh
78
117
 
@@ -97,7 +136,7 @@ User-defined agents from the AI Catalog. Appear in `/agents` with `[GitLab Custo
97
136
 
98
137
  ### Flows (Foundational & Custom)
99
138
 
100
- Multi-step workflows. Appear in `@` menu with `[GitLab Flow]` label. Executed via subagent dispatch.
139
+ Multi-step workflows. Appear in `@` menu with `[GitLab Flow]` label. Each flow is registered as a subagent with a built-in prompt that handles flow definition parsing, goal resolution, and execution. Single flows dispatch natively; multiple flows are batched into a single `general` subagent for parallel execution.
101
140
 
102
141
  ### External Agents
103
142
 
@@ -128,7 +167,7 @@ export GITLAB_INSTANCE_URL=https://your-instance.com
128
167
 
129
168
  ```bash
130
169
  npm install
131
- npm test # Run tests (48 tests)
170
+ npm test # Run tests (62 tests)
132
171
  npm run build # Build (auto-runs vendor:generate)
133
172
  npm run type-check
134
173
  ```
@@ -154,26 +193,45 @@ git commit -m "chore: update vendored foundational flow definitions"
154
193
 
155
194
  ```
156
195
  Plugin init
157
- ├─ readAuth() reads ~/.local/share/opencode/auth.json
158
- ├─ GitLabModelCache reads model cache (no network call)
196
+ ├─ readAuth() reads ~/.local/share/opencode/auth.json
197
+ ├─ GitLabModelCache reads model cache (no network call)
159
198
  ├─ fetchCatalogAgents()
160
- │ ├─ aiFoundationalChatAgents (GraphQL) → foundational agents
161
- │ └─ aiCatalogConfiguredItems (GraphQL) → custom agents + flows
162
- │ └─ aiCatalogAgentFlowConfig (GraphQL) → flow config YAML
163
- ├─ config hook injects agents (primary) + flows (subagent)
164
- ├─ chat.message hook intercepts @flow mentions → subagent dispatch
165
- └─ tool hook 13 DAP tools
166
-
167
- Flow execution (@FlowName):
168
- ├─ chat.message hook replaces AgentPart with subagent instructions
169
- ├─ Primary agent dispatches Task subagent
170
- ├─ Subagent Step 1 gitlab_get_flow_definition → read inputs
171
- ├─ Subagent Step 2 GitLab tools gather input values
172
- ├─ Subagent Step 3 gitlab_execute_project_flow POST to DWS
173
- └─ Subagent Step 4 gitlab_get_workflow_statusconfirm started
199
+ │ ├─ aiFoundationalChatAgents foundational agents (GraphQL)
200
+ │ └─ aiCatalogConfiguredItems custom agents + flows (GraphQL)
201
+ │ └─ aiCatalogAgentFlowConfig flow config YAML (GraphQL)
202
+ ├─ config hook injects agents (primary) + flows (subagent with prompt)
203
+ ├─ chat.message hook intercepts @flow → general subagent dispatch
204
+ ├─ experimental.chat.system.transform injects flow dispatch + agent creation guidelines
205
+ └─ tool hook 17 DAP tools
206
+
207
+ Single flow execution (@FlowName goal):
208
+ ├─ chat.message hook rewrites @mention → Task tool with general subagent
209
+ ├─ General subagent Step 1 gitlab_get_flow_definition → parse context:goal mapping
210
+ ├─ General subagent Step 2 Resolve goal to exact value (MR IID, URL, etc.)
211
+ ├─ General subagent Step 3 Gather additional_context inputs via GitLab tools
212
+ ├─ General subagent Step 4 gitlab_execute_project_flowPOST to DWS
213
+ └─ General subagent Step 5 gitlab_get_workflow_status → report status + URL
214
+
215
+ Multi-flow execution (@Flow1 @Flow2 goal):
216
+ ├─ chat.message hook detects multiple @mentions → combined dispatch
217
+ ├─ Primary agent dispatches ONE general subagent via Task tool
218
+ ├─ General subagent calls gitlab_get_flow_definition for all flows (concurrent)
219
+ ├─ (if batch) lists resources via GitLab API
220
+ ├─ General subagent calls gitlab_execute_project_flow × N (concurrent)
221
+ ├─ General subagent calls gitlab_get_workflow_status × N (concurrent)
222
+ └─ General subagent presents summary table
223
+
224
+ Agent creation (interactive):
225
+ ├─ gitlab_create_agent called without confirmed → returns instructions
226
+ ├─ gitlab_list_builtin_tools discover available tools
227
+ ├─ gitlab_list_project_mcp_servers discover MCP servers
228
+ ├─ question tool ask user for name, visibility, tools, MCP servers
229
+ ├─ LLM generates system prompt → user confirms
230
+ ├─ gitlab_create_agent called with confirmed=true → creates agent
231
+ └─ gitlab_enable_project_agent optionally enable on project
174
232
 
175
233
  Enable/disable:
176
- └─ refreshAgents() clears cache, re-fetches, updates cfg.agent
234
+ └─ refreshAgents() clears cache, re-fetches, updates cfg.agent
177
235
  ```
178
236
 
179
237
  ## License