opencode-gitlab-plugin 2.3.0 → 2.4.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/CHANGELOG.md +7 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +344 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp-server.cjs +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [2.4.0](https://gitlab.com/vglafirov/opencode-gitlab-plugin/compare/v2.3.0...v2.4.0) (2026-05-19)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### ✨ Features
|
|
9
|
+
|
|
10
|
+
* **orbit:** add GitLab Orbit Knowledge Graph API tools ([17fd452](https://gitlab.com/vglafirov/opencode-gitlab-plugin/commit/17fd4521ec32f760b26a6596c5d023d7b55eed47))
|
|
11
|
+
|
|
5
12
|
## [2.3.0](https://gitlab.com/vglafirov/opencode-gitlab-plugin/compare/v2.2.0...v2.3.0) (2026-05-18)
|
|
6
13
|
|
|
7
14
|
|
package/dist/index.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ import { Plugin } from '@opencode-ai/plugin';
|
|
|
20
20
|
* - Discussions: unified tools for all resource types (list, get, create/reply, resolve)
|
|
21
21
|
* - Notes: list/get notes (flat view) for MR, issue, epic, snippet
|
|
22
22
|
* - Git: execute safe, read-only git commands in repository
|
|
23
|
+
* - Orbit: Knowledge Graph API (status, schema, query, neighbors)
|
|
23
24
|
*/
|
|
24
25
|
declare const gitlabPlugin: Plugin;
|
|
25
26
|
|
package/dist/index.js
CHANGED
|
@@ -5138,6 +5138,348 @@ Examples:
|
|
|
5138
5138
|
})
|
|
5139
5139
|
};
|
|
5140
5140
|
|
|
5141
|
+
// src/tools/orbit.ts
|
|
5142
|
+
import { tool as tool18 } from "@opencode-ai/plugin";
|
|
5143
|
+
var z18 = tool18.schema;
|
|
5144
|
+
var orbitTools = {
|
|
5145
|
+
gitlab_orbit_status: tool18({
|
|
5146
|
+
description: `Check GitLab Orbit Knowledge Graph API availability and health.
|
|
5147
|
+
|
|
5148
|
+
Returns the status of the Orbit API for the connected GitLab instance.
|
|
5149
|
+
Orbit is GitLab's Knowledge Graph API that provides rich SDLC graph data.
|
|
5150
|
+
|
|
5151
|
+
Note: Orbit is only available on Premium/Ultimate tiers and requires the feature flag to be enabled.
|
|
5152
|
+
If unavailable, returns an error with suggestions for REST API alternatives.`,
|
|
5153
|
+
args: {},
|
|
5154
|
+
execute: async (_args, _ctx) => {
|
|
5155
|
+
const client = getGitLabClient();
|
|
5156
|
+
try {
|
|
5157
|
+
const status = await client.fetch("GET", "/orbit/status");
|
|
5158
|
+
return JSON.stringify(
|
|
5159
|
+
{
|
|
5160
|
+
...status,
|
|
5161
|
+
available: true,
|
|
5162
|
+
message: "Orbit Knowledge Graph API is available"
|
|
5163
|
+
},
|
|
5164
|
+
null,
|
|
5165
|
+
2
|
|
5166
|
+
);
|
|
5167
|
+
} catch (error) {
|
|
5168
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
5169
|
+
if (errorMessage.includes("404") || errorMessage.includes("not found")) {
|
|
5170
|
+
return JSON.stringify(
|
|
5171
|
+
{
|
|
5172
|
+
available: false,
|
|
5173
|
+
error: "Orbit API not available",
|
|
5174
|
+
reason: "The Orbit Knowledge Graph API is not enabled on this GitLab instance. Orbit requires GitLab Premium/Ultimate tier and the feature flag to be enabled.",
|
|
5175
|
+
alternatives: [
|
|
5176
|
+
"Use REST API endpoints for MRs, issues, pipelines",
|
|
5177
|
+
"Use GraphQL API for complex queries",
|
|
5178
|
+
"Use gitlab_search for finding related entities"
|
|
5179
|
+
]
|
|
5180
|
+
},
|
|
5181
|
+
null,
|
|
5182
|
+
2
|
|
5183
|
+
);
|
|
5184
|
+
}
|
|
5185
|
+
if (errorMessage.includes("403") || errorMessage.includes("forbidden")) {
|
|
5186
|
+
return JSON.stringify(
|
|
5187
|
+
{
|
|
5188
|
+
available: false,
|
|
5189
|
+
error: "Orbit API access forbidden",
|
|
5190
|
+
reason: "Your access token does not have permission to use the Orbit API. This may require specific scopes or Premium/Ultimate tier.",
|
|
5191
|
+
alternatives: [
|
|
5192
|
+
"Check token scopes include api or read_api",
|
|
5193
|
+
"Verify your GitLab tier supports Orbit",
|
|
5194
|
+
"Use REST/GraphQL APIs as fallback"
|
|
5195
|
+
]
|
|
5196
|
+
},
|
|
5197
|
+
null,
|
|
5198
|
+
2
|
|
5199
|
+
);
|
|
5200
|
+
}
|
|
5201
|
+
if (errorMessage.includes("502")) {
|
|
5202
|
+
return JSON.stringify(
|
|
5203
|
+
{
|
|
5204
|
+
available: false,
|
|
5205
|
+
error: "Orbit API temporarily unavailable",
|
|
5206
|
+
reason: "The Orbit API returned a 502 error. This may be temporary.",
|
|
5207
|
+
suggestion: "Try again later or use REST/GraphQL APIs as fallback."
|
|
5208
|
+
},
|
|
5209
|
+
null,
|
|
5210
|
+
2
|
|
5211
|
+
);
|
|
5212
|
+
}
|
|
5213
|
+
return JSON.stringify(
|
|
5214
|
+
{
|
|
5215
|
+
available: false,
|
|
5216
|
+
error: "Orbit API error",
|
|
5217
|
+
message: errorMessage,
|
|
5218
|
+
alternatives: ["Use REST/GraphQL APIs as fallback"]
|
|
5219
|
+
},
|
|
5220
|
+
null,
|
|
5221
|
+
2
|
|
5222
|
+
);
|
|
5223
|
+
}
|
|
5224
|
+
}
|
|
5225
|
+
}),
|
|
5226
|
+
gitlab_orbit_schema: tool18({
|
|
5227
|
+
description: `Get the Orbit Knowledge Graph schema.
|
|
5228
|
+
|
|
5229
|
+
Returns the available node types, relationship types, and their properties.
|
|
5230
|
+
Use this to understand what entities and relationships can be queried.
|
|
5231
|
+
|
|
5232
|
+
Node type domains include:
|
|
5233
|
+
- Core: Project, Group, User
|
|
5234
|
+
- Source Code: File, Definition, Commit
|
|
5235
|
+
- Code Review: MergeRequest, Diff, Review
|
|
5236
|
+
- CI/CD: Pipeline, Job, Deployment
|
|
5237
|
+
- Planning: WorkItem (issues, epics, tasks)
|
|
5238
|
+
- Security: Vulnerability
|
|
5239
|
+
|
|
5240
|
+
Note: Requires Orbit API to be available (Premium/Ultimate tier).`,
|
|
5241
|
+
args: {},
|
|
5242
|
+
execute: async (_args, _ctx) => {
|
|
5243
|
+
const client = getGitLabClient();
|
|
5244
|
+
try {
|
|
5245
|
+
const schema = await client.fetch("GET", "/orbit/schema");
|
|
5246
|
+
return JSON.stringify(schema, null, 2);
|
|
5247
|
+
} catch (error) {
|
|
5248
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
5249
|
+
if (errorMessage.includes("404") || errorMessage.includes("not found")) {
|
|
5250
|
+
return JSON.stringify(
|
|
5251
|
+
{
|
|
5252
|
+
error: "Orbit API not available",
|
|
5253
|
+
suggestion: "Use gitlab_orbit_status to check API availability"
|
|
5254
|
+
},
|
|
5255
|
+
null,
|
|
5256
|
+
2
|
|
5257
|
+
);
|
|
5258
|
+
}
|
|
5259
|
+
if (errorMessage.includes("502")) {
|
|
5260
|
+
return JSON.stringify(
|
|
5261
|
+
{
|
|
5262
|
+
error: "Orbit API temporarily unavailable",
|
|
5263
|
+
suggestion: "The Orbit API returned a 502 error. This may be temporary - try again later."
|
|
5264
|
+
},
|
|
5265
|
+
null,
|
|
5266
|
+
2
|
|
5267
|
+
);
|
|
5268
|
+
}
|
|
5269
|
+
throw error;
|
|
5270
|
+
}
|
|
5271
|
+
}
|
|
5272
|
+
}),
|
|
5273
|
+
gitlab_orbit_query: tool18({
|
|
5274
|
+
description: `Execute a query against the Orbit Knowledge Graph.
|
|
5275
|
+
|
|
5276
|
+
Query types:
|
|
5277
|
+
- traversal: Walk the graph from a starting node
|
|
5278
|
+
- neighbors: Get immediate neighbors of a node
|
|
5279
|
+
|
|
5280
|
+
IMPORTANT: The query format uses variable names for node references.
|
|
5281
|
+
- "id" in node definition is a VARIABLE NAME (alias), not the actual entity ID
|
|
5282
|
+
- Actual IDs go in "filters" with {"field": {"op": "eq", "value": X}} format
|
|
5283
|
+
|
|
5284
|
+
Example neighbors query to get a project's connections:
|
|
5285
|
+
{
|
|
5286
|
+
"query_type": "neighbors",
|
|
5287
|
+
"node": {
|
|
5288
|
+
"entity": "Project",
|
|
5289
|
+
"id": "p",
|
|
5290
|
+
"filters": {"id": {"op": "eq", "value": 278964}}
|
|
5291
|
+
},
|
|
5292
|
+
"neighbors": {"node": "p", "direction": "incoming"},
|
|
5293
|
+
"aggregations": [],
|
|
5294
|
+
"path": {"type": "shortest", "from": "p", "to": "p", "max_depth": 1}
|
|
5295
|
+
}
|
|
5296
|
+
|
|
5297
|
+
Example traversal query:
|
|
5298
|
+
{
|
|
5299
|
+
"query_type": "traversal",
|
|
5300
|
+
"node": {
|
|
5301
|
+
"entity": "MergeRequest",
|
|
5302
|
+
"id": "mr",
|
|
5303
|
+
"filters": {"id": {"op": "eq", "value": 377844873}}
|
|
5304
|
+
},
|
|
5305
|
+
"neighbors": {"node": "mr", "direction": "both"},
|
|
5306
|
+
"aggregations": [],
|
|
5307
|
+
"path": {"type": "shortest", "from": "mr", "to": "mr", "max_depth": 1}
|
|
5308
|
+
}
|
|
5309
|
+
|
|
5310
|
+
Note: Use gitlab_get_merge_request to get the internal ID from an IID.
|
|
5311
|
+
Returns nodes array and edges array with relationship types.`,
|
|
5312
|
+
args: {
|
|
5313
|
+
// Using a JSON string rather than a structured zod schema because the Orbit query
|
|
5314
|
+
// format is still evolving. This allows flexibility as the API changes without
|
|
5315
|
+
// requiring schema updates for each iteration.
|
|
5316
|
+
query: z18.string().describe(
|
|
5317
|
+
"JSON string containing the full query object. Must include query_type, node, neighbors, aggregations, and path fields. See description for format details."
|
|
5318
|
+
),
|
|
5319
|
+
limit: z18.number().optional().describe("Maximum number of results (default: 30)")
|
|
5320
|
+
},
|
|
5321
|
+
execute: async (args, _ctx) => {
|
|
5322
|
+
const client = getGitLabClient();
|
|
5323
|
+
let queryObj;
|
|
5324
|
+
try {
|
|
5325
|
+
queryObj = JSON.parse(args.query);
|
|
5326
|
+
} catch {
|
|
5327
|
+
return JSON.stringify(
|
|
5328
|
+
{
|
|
5329
|
+
error: "Invalid JSON in query parameter",
|
|
5330
|
+
suggestion: "Ensure the query parameter is valid JSON"
|
|
5331
|
+
},
|
|
5332
|
+
null,
|
|
5333
|
+
2
|
|
5334
|
+
);
|
|
5335
|
+
}
|
|
5336
|
+
const requestBody = {
|
|
5337
|
+
query: queryObj
|
|
5338
|
+
};
|
|
5339
|
+
if (args.limit) {
|
|
5340
|
+
requestBody.limit = args.limit;
|
|
5341
|
+
}
|
|
5342
|
+
try {
|
|
5343
|
+
const result = await client.fetch("POST", "/orbit/query", requestBody);
|
|
5344
|
+
if (result.code) {
|
|
5345
|
+
return JSON.stringify(
|
|
5346
|
+
{
|
|
5347
|
+
error: "Query compilation error",
|
|
5348
|
+
code: result.code,
|
|
5349
|
+
message: result.message,
|
|
5350
|
+
suggestion: 'Check query structure. Node "id" is a variable name, actual IDs go in filters.'
|
|
5351
|
+
},
|
|
5352
|
+
null,
|
|
5353
|
+
2
|
|
5354
|
+
);
|
|
5355
|
+
}
|
|
5356
|
+
return JSON.stringify(result, null, 2);
|
|
5357
|
+
} catch (error) {
|
|
5358
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
5359
|
+
if (errorMessage.includes("404") || errorMessage.includes("not found")) {
|
|
5360
|
+
return JSON.stringify(
|
|
5361
|
+
{
|
|
5362
|
+
error: "Orbit API not available",
|
|
5363
|
+
suggestion: "Use gitlab_orbit_status to check API availability"
|
|
5364
|
+
},
|
|
5365
|
+
null,
|
|
5366
|
+
2
|
|
5367
|
+
);
|
|
5368
|
+
}
|
|
5369
|
+
if (errorMessage.includes("502")) {
|
|
5370
|
+
return JSON.stringify(
|
|
5371
|
+
{
|
|
5372
|
+
error: "Orbit query failed",
|
|
5373
|
+
message: "The Orbit API returned a 502 error. This is a known issue with some entity types (e.g., source_code domain).",
|
|
5374
|
+
suggestion: "Try a different entity type or use REST/GraphQL APIs as fallback."
|
|
5375
|
+
},
|
|
5376
|
+
null,
|
|
5377
|
+
2
|
|
5378
|
+
);
|
|
5379
|
+
}
|
|
5380
|
+
throw error;
|
|
5381
|
+
}
|
|
5382
|
+
}
|
|
5383
|
+
}),
|
|
5384
|
+
gitlab_orbit_neighbors: tool18({
|
|
5385
|
+
description: `Get immediate neighbors of a node in the Orbit Knowledge Graph.
|
|
5386
|
+
|
|
5387
|
+
This is a simplified wrapper that builds the query for you.
|
|
5388
|
+
Returns nodes directly connected to the specified node.
|
|
5389
|
+
|
|
5390
|
+
Common use cases:
|
|
5391
|
+
- Get all connections to a project (users, groups, pipelines, MRs)
|
|
5392
|
+
- Get pipelines for an MR
|
|
5393
|
+
- Get files changed in a commit
|
|
5394
|
+
- Get deployments from a pipeline
|
|
5395
|
+
|
|
5396
|
+
Note: Use GitLab internal numeric IDs (not IIDs).
|
|
5397
|
+
Example: For MR !123 in gitlab-org/gitlab, first get the internal ID via gitlab_get_merge_request,
|
|
5398
|
+
then use that ID (e.g., 377844873).`,
|
|
5399
|
+
args: {
|
|
5400
|
+
entity_type: z18.string().describe(
|
|
5401
|
+
"Type of the entity (e.g., Project, MergeRequest, User, Pipeline, Commit, WorkItem, Group)"
|
|
5402
|
+
),
|
|
5403
|
+
entity_id: z18.number().describe(
|
|
5404
|
+
"GitLab internal numeric ID (not IID). Get this from REST/GraphQL API responses."
|
|
5405
|
+
),
|
|
5406
|
+
direction: z18.enum(["incoming", "outgoing", "both"]).optional().describe("Direction of relationships to traverse (default: both)"),
|
|
5407
|
+
limit: z18.number().optional().describe("Maximum number of neighbors to return (default: 30)")
|
|
5408
|
+
},
|
|
5409
|
+
execute: async (args, _ctx) => {
|
|
5410
|
+
const client = getGitLabClient();
|
|
5411
|
+
const direction = args.direction || "both";
|
|
5412
|
+
const queryObj = {
|
|
5413
|
+
query_type: "neighbors",
|
|
5414
|
+
node: {
|
|
5415
|
+
entity: args.entity_type,
|
|
5416
|
+
id: "n",
|
|
5417
|
+
filters: {
|
|
5418
|
+
id: { op: "eq", value: args.entity_id }
|
|
5419
|
+
}
|
|
5420
|
+
},
|
|
5421
|
+
neighbors: {
|
|
5422
|
+
node: "n",
|
|
5423
|
+
direction
|
|
5424
|
+
},
|
|
5425
|
+
aggregations: [],
|
|
5426
|
+
path: { type: "shortest", from: "n", to: "n", max_depth: 1 }
|
|
5427
|
+
};
|
|
5428
|
+
const requestBody = {
|
|
5429
|
+
query: queryObj
|
|
5430
|
+
};
|
|
5431
|
+
if (args.limit) {
|
|
5432
|
+
requestBody.limit = args.limit;
|
|
5433
|
+
}
|
|
5434
|
+
try {
|
|
5435
|
+
const result = await client.fetch("POST", "/orbit/query", requestBody);
|
|
5436
|
+
if (result.code) {
|
|
5437
|
+
return JSON.stringify(
|
|
5438
|
+
{
|
|
5439
|
+
error: "Query error",
|
|
5440
|
+
code: result.code,
|
|
5441
|
+
message: result.message,
|
|
5442
|
+
entity_type: args.entity_type,
|
|
5443
|
+
entity_id: args.entity_id
|
|
5444
|
+
},
|
|
5445
|
+
null,
|
|
5446
|
+
2
|
|
5447
|
+
);
|
|
5448
|
+
}
|
|
5449
|
+
return JSON.stringify(result, null, 2);
|
|
5450
|
+
} catch (error) {
|
|
5451
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
5452
|
+
if (errorMessage.includes("404") || errorMessage.includes("not found")) {
|
|
5453
|
+
return JSON.stringify(
|
|
5454
|
+
{
|
|
5455
|
+
error: "Orbit API not available",
|
|
5456
|
+
entity_type: args.entity_type,
|
|
5457
|
+
entity_id: args.entity_id,
|
|
5458
|
+
suggestion: "Use gitlab_orbit_status to check API availability"
|
|
5459
|
+
},
|
|
5460
|
+
null,
|
|
5461
|
+
2
|
|
5462
|
+
);
|
|
5463
|
+
}
|
|
5464
|
+
if (errorMessage.includes("502")) {
|
|
5465
|
+
return JSON.stringify(
|
|
5466
|
+
{
|
|
5467
|
+
error: "Orbit query failed",
|
|
5468
|
+
entity_type: args.entity_type,
|
|
5469
|
+
entity_id: args.entity_id,
|
|
5470
|
+
message: "The Orbit API returned a 502 error. This is a known issue with some entity types.",
|
|
5471
|
+
suggestion: "Try a different entity type or use REST/GraphQL APIs as fallback."
|
|
5472
|
+
},
|
|
5473
|
+
null,
|
|
5474
|
+
2
|
|
5475
|
+
);
|
|
5476
|
+
}
|
|
5477
|
+
throw error;
|
|
5478
|
+
}
|
|
5479
|
+
}
|
|
5480
|
+
})
|
|
5481
|
+
};
|
|
5482
|
+
|
|
5141
5483
|
// src/index.ts
|
|
5142
5484
|
var gitlabPlugin = async (_input, options) => {
|
|
5143
5485
|
if (options?.tools === false) {
|
|
@@ -5169,7 +5511,8 @@ DAP tools (agents, flows, memory, skills) are on the "gitlab-dap" server instead
|
|
|
5169
5511
|
...notesUnifiedTools,
|
|
5170
5512
|
...gitTools,
|
|
5171
5513
|
...auditTools,
|
|
5172
|
-
...awardEmojiTools
|
|
5514
|
+
...awardEmojiTools,
|
|
5515
|
+
...orbitTools
|
|
5173
5516
|
}
|
|
5174
5517
|
};
|
|
5175
5518
|
};
|