opencode-gitlab-dap 1.5.0 → 1.6.0

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
@@ -73,23 +73,67 @@ When multiple flows are mentioned:
73
73
 
74
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
75
 
76
- ### 13 DAP Tools
77
-
78
- | Tool | Description |
79
- | ------------------------------ | ------------------------------------------ |
80
- | `gitlab_list_agents` | Search agents in the global AI Catalog |
81
- | `gitlab_get_agent` | Get agent details by ID |
82
- | `gitlab_list_project_agents` | List agents enabled for a project |
83
- | `gitlab_enable_project_agent` | Enable an agent in a project |
84
- | `gitlab_disable_project_agent` | Disable an agent in a project |
85
- | `gitlab_list_flows` | Search flows in the global AI Catalog |
86
- | `gitlab_get_flow` | Get flow details by ID |
87
- | `gitlab_list_project_flows` | List flows enabled for a project |
88
- | `gitlab_enable_project_flow` | Enable a flow in a project |
89
- | `gitlab_disable_project_flow` | Disable a flow in a project |
90
- | `gitlab_execute_project_flow` | Execute a flow via DWS REST API |
91
- | `gitlab_get_flow_definition` | Get flow YAML config (inputs, components) |
92
- | `gitlab_get_workflow_status` | Monitor workflow execution status and logs |
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
+ ### Custom Flow Creation
95
+
96
+ Design and create custom flows interactively:
97
+
98
+ ```
99
+ Create a flow that fetches MR data, analyzes the changes, and posts a summary comment
100
+ ```
101
+
102
+ The plugin provides a multi-round design workflow:
103
+
104
+ 1. `gitlab_design_flow` with `action="get_schema"` returns the flow YAML schema reference, two annotated examples, and step-by-step instructions
105
+ 2. The LLM asks the user about the flow's purpose, resource type, and steps
106
+ 3. The LLM proposes a component architecture for user approval
107
+ 4. The LLM generates the full YAML, validates it client-side against the `flow_v2` JSON schema via `gitlab_design_flow` with `action="validate"`
108
+ 5. After user confirmation, `gitlab_create_flow` with `confirmed=true` submits it to GitLab
109
+ 6. After creation, offers to enable the flow on the current project via `gitlab_enable_project_flow`
110
+
111
+ The vendored `flow_v2.json` schema from GitLab Rails powers client-side validation using `ajv`, catching errors before hitting the API.
112
+
113
+ ### 20 DAP Tools
114
+
115
+ | Tool | Description |
116
+ | --------------------------------- | ------------------------------------------------------- |
117
+ | `gitlab_list_agents` | Search agents in the global AI Catalog |
118
+ | `gitlab_get_agent` | Get agent details by ID |
119
+ | `gitlab_list_project_agents` | List agents enabled for a project |
120
+ | `gitlab_enable_project_agent` | Enable an agent in a project |
121
+ | `gitlab_disable_project_agent` | Disable an agent in a project |
122
+ | `gitlab_create_agent` | Create a custom agent (interactive, confirmation-gated) |
123
+ | `gitlab_update_agent` | Update an existing custom agent |
124
+ | `gitlab_list_builtin_tools` | List available built-in tools for agent/flow config |
125
+ | `gitlab_design_flow` | Interactive flow design + YAML validation |
126
+ | `gitlab_create_flow` | Create a custom flow (confirmation-gated) |
127
+ | `gitlab_update_flow` | Update an existing custom flow |
128
+ | `gitlab_list_flows` | Search flows in the global AI Catalog |
129
+ | `gitlab_get_flow` | Get flow details by ID |
130
+ | `gitlab_list_project_flows` | List flows enabled for a project |
131
+ | `gitlab_enable_project_flow` | Enable a flow in a project |
132
+ | `gitlab_disable_project_flow` | Disable a flow in a project |
133
+ | `gitlab_execute_project_flow` | Execute a flow via DWS REST API |
134
+ | `gitlab_get_flow_definition` | Get flow YAML config (inputs, components) |
135
+ | `gitlab_get_workflow_status` | Monitor workflow execution status and logs |
136
+ | `gitlab_list_project_mcp_servers` | List MCP servers available for project agents |
93
137
 
94
138
  ### Dynamic Refresh
95
139
 
@@ -102,6 +146,9 @@ Foundational flow definitions (from `gitlab-org/modelops/applied-ml/code-suggest
102
146
  are vendored and embedded at build time. This provides flow input schemas for
103
147
  foundational flows whose configs are not available via the GitLab API.
104
148
 
149
+ The `flow_v2.json` JSON schema is also vendored from GitLab Rails and bundled
150
+ inline for client-side YAML validation via `ajv`.
151
+
105
152
  ## Agent Types
106
153
 
107
154
  ### Foundational Agents
@@ -145,7 +192,7 @@ export GITLAB_INSTANCE_URL=https://your-instance.com
145
192
 
146
193
  ```bash
147
194
  npm install
148
- npm test # Run tests (58 tests)
195
+ npm test # Run tests (69 tests)
149
196
  npm run build # Build (auto-runs vendor:generate)
150
197
  npm run type-check
151
198
  ```
@@ -178,17 +225,17 @@ Plugin init
178
225
  │ └─ aiCatalogConfiguredItems custom agents + flows (GraphQL)
179
226
  │ └─ aiCatalogAgentFlowConfig flow config YAML (GraphQL)
180
227
  ├─ config hook injects agents (primary) + flows (subagent with prompt)
181
- ├─ chat.message hook intercepts multi-@flow → combined dispatch
182
- ├─ experimental.chat.system.transform injects flow dispatch guidelines
183
- └─ tool hook 13 DAP tools
228
+ ├─ chat.message hook intercepts @flow → general subagent dispatch
229
+ ├─ experimental.chat.system.transform injects flow dispatch + agent creation guidelines
230
+ └─ tool hook 20 DAP tools
184
231
 
185
232
  Single flow execution (@FlowName goal):
186
- ├─ Native subagent dispatch opencode routes to registered subagent
187
- ├─ Subagent Step 1 gitlab_get_flow_definition → parse context:goal mapping
188
- ├─ Subagent Step 2 Resolve goal to exact value (MR IID, URL, etc.)
189
- ├─ Subagent Step 3 Gather additional_context inputs via GitLab tools
190
- ├─ Subagent Step 4 gitlab_execute_project_flow → POST to DWS
191
- └─ Subagent Step 5 gitlab_get_workflow_status → report status + URL
233
+ ├─ chat.message hook rewrites @mention Task tool with general subagent
234
+ ├─ General subagent Step 1 gitlab_get_flow_definition → parse context:goal mapping
235
+ ├─ General subagent Step 2 Resolve goal to exact value (MR IID, URL, etc.)
236
+ ├─ General subagent Step 3 Gather additional_context inputs via GitLab tools
237
+ ├─ General subagent Step 4 gitlab_execute_project_flow → POST to DWS
238
+ └─ General subagent Step 5 gitlab_get_workflow_status → report status + URL
192
239
 
193
240
  Multi-flow execution (@Flow1 @Flow2 goal):
194
241
  ├─ chat.message hook detects multiple @mentions → combined dispatch
@@ -199,6 +246,26 @@ Multi-flow execution (@Flow1 @Flow2 goal):
199
246
  ├─ General subagent calls gitlab_get_workflow_status × N (concurrent)
200
247
  └─ General subagent presents summary table
201
248
 
249
+ Agent creation (interactive):
250
+ ├─ gitlab_create_agent called without confirmed → returns instructions
251
+ ├─ gitlab_list_builtin_tools discover available tools
252
+ ├─ gitlab_list_project_mcp_servers discover MCP servers
253
+ ├─ question tool ask user for name, visibility, tools, MCP servers
254
+ ├─ LLM generates system prompt → user confirms
255
+ ├─ gitlab_create_agent called with confirmed=true → creates agent
256
+ └─ gitlab_enable_project_agent optionally enable on project
257
+
258
+ Flow creation (interactive, multi-round):
259
+ ├─ gitlab_design_flow (get_schema) returns schema reference + examples + instructions
260
+ ├─ gitlab_list_builtin_tools discover available tool names for flow components
261
+ ├─ question tool ask user for name, visibility, purpose, steps
262
+ ├─ LLM proposes component architecture → user confirms
263
+ ├─ LLM generates flow YAML definition
264
+ ├─ gitlab_design_flow (validate) client-side validation against flow_v2.json via ajv
265
+ ├─ User confirms the generated YAML
266
+ ├─ gitlab_create_flow called with confirmed=true → creates flow
267
+ └─ gitlab_enable_project_flow optionally enable on project
268
+
202
269
  Enable/disable:
203
270
  └─ refreshAgents() clears cache, re-fetches, updates cfg.agent
204
271
  ```