@gitlab/opencode-gitlab-plugin 1.5.0 → 1.5.2
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 +14 -59
- package/README.md +97 -37
- package/dist/gitlab-opencode-gitlab-plugin-1.5.2.tgz +0 -0
- package/dist/index.js +4 -43
- package/package.json +1 -1
- package/dist/gitlab-opencode-gitlab-plugin-1.5.0.tgz +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
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
|
+
## [1.5.2](https://gitlab.com/gitlab-org/editor-extensions/opencode-gitlab-plugin/compare/v1.5.1...v1.5.2) (2026-02-02)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### 📚 Documentation
|
|
9
|
+
|
|
10
|
+
* update documentation to reflect GraphQL API migrations ([1b5aff1](https://gitlab.com/gitlab-org/editor-extensions/opencode-gitlab-plugin/commit/1b5aff1d630577d9ec05966e249a89fdb8a86b3f))
|
|
11
|
+
|
|
12
|
+
## [1.5.1](https://gitlab.com/gitlab-org/editor-extensions/opencode-gitlab-plugin/compare/v1.5.0...v1.5.1) (2026-02-02)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### 🐛 Bug Fixes
|
|
16
|
+
|
|
17
|
+
* remove unsupported GraphQL fields causing API errors ([6d6de6f](https://gitlab.com/gitlab-org/editor-extensions/opencode-gitlab-plugin/commit/6d6de6fff29609f3fc591a199055a752abe0fdcd))
|
|
18
|
+
|
|
5
19
|
## [1.5.0](https://gitlab.com/gitlab-org/editor-extensions/opencode-gitlab-plugin/compare/v1.4.0...v1.5.0) (2026-02-02)
|
|
6
20
|
|
|
7
21
|
|
|
@@ -196,65 +210,6 @@ All notable changes to this project will be documented in this file. See [Conven
|
|
|
196
210
|
|
|
197
211
|
* create release ([e74f8a7](https://gitlab.com/vglafirov/opencode-gitlab-plugin/commit/e74f8a7550a6d2a58b3fb551fe4ad3a2db56e0c7))
|
|
198
212
|
|
|
199
|
-
## [Unreleased]
|
|
200
|
-
|
|
201
|
-
### Added
|
|
202
|
-
- **GraphQL API Support** - Added `fetchGraphQL()` method to base `GitLabApiClient` class
|
|
203
|
-
- Enables GraphQL queries and mutations with proper error handling
|
|
204
|
-
- Supports variables and returns typed responses
|
|
205
|
-
- Foundation for advanced GitLab features
|
|
206
|
-
- Enhanced JSDoc documentation with `@template` parameter
|
|
207
|
-
- **Vulnerability Management Tools** - 6 new GraphQL-based security tools:
|
|
208
|
-
- `gitlab_create_vulnerability_issue` - Create issue linked to vulnerabilities
|
|
209
|
-
- `gitlab_dismiss_vulnerability` - Dismiss vulnerability with reason (ACCEPTABLE_RISK, FALSE_POSITIVE, etc.)
|
|
210
|
-
- `gitlab_confirm_vulnerability` - Confirm a security vulnerability
|
|
211
|
-
- `gitlab_revert_vulnerability_to_detected` - Revert vulnerability state back to detected
|
|
212
|
-
- `gitlab_update_vulnerability_severity` - Update vulnerability severity level (CRITICAL, HIGH, MEDIUM, LOW, INFO, UNKNOWN)
|
|
213
|
-
- `gitlab_link_vulnerability_to_issue` - Link existing issue to vulnerabilities
|
|
214
|
-
- All tools require Developer role or higher
|
|
215
|
-
- Comprehensive test coverage with 29 new tests (22 security + 7 validation)
|
|
216
|
-
- **GID Validation Utilities** - New validation module for GitLab Global IDs
|
|
217
|
-
- `isValidGid()` - Validates GID format with optional type checking
|
|
218
|
-
- `validateGid()` - Validates and throws descriptive errors for invalid GIDs
|
|
219
|
-
- Integrated into all security methods that accept GIDs
|
|
220
|
-
- Provides better error messages for incorrect GID formats
|
|
221
|
-
|
|
222
|
-
### Changed
|
|
223
|
-
- **Refactored Security Client** - Improved code maintainability
|
|
224
|
-
- Extracted all GraphQL mutation queries to constants
|
|
225
|
-
- Makes queries easier to update and maintain
|
|
226
|
-
- Improved code readability in security methods
|
|
227
|
-
- **Enhanced Type Safety** - Added validation for all GID parameters
|
|
228
|
-
- Validates vulnerability IDs format: `gid://gitlab/Vulnerability/{id}`
|
|
229
|
-
- Validates issue IDs format: `gid://gitlab/Issue/{id}`
|
|
230
|
-
- Prevents invalid GID formats from reaching GitLab API
|
|
231
|
-
- **Audit Events API** - 3 new tools for security and compliance monitoring:
|
|
232
|
-
- `gitlab_list_project_audit_events` - List audit events for a project (requires owner role)
|
|
233
|
-
- `gitlab_list_group_audit_events` - List audit events for a group (requires owner role)
|
|
234
|
-
- `gitlab_list_instance_audit_events` - List instance-level audit events (requires admin)
|
|
235
|
-
- Support for filtering by date range, entity type, entity ID, and author ID with pagination
|
|
236
|
-
- **Paginated MR Diffs** - `gitlab_list_merge_request_diffs` tool for handling large changesets
|
|
237
|
-
- Fetch merge request diffs with pagination support
|
|
238
|
-
- Useful for processing diffs in chunks when MRs have many changed files
|
|
239
|
-
- **Single Note Retrieval** - 3 new tools for granular comment access:
|
|
240
|
-
- `gitlab_get_epic_note` - Get a single note from an epic by ID
|
|
241
|
-
- `gitlab_get_issue_note` - Get a single note from an issue by ID
|
|
242
|
-
- `gitlab_get_commit_comments` - Get all comments on a specific commit
|
|
243
|
-
- Retrieve specific comments without fetching all notes
|
|
244
|
-
- **`gitlab_create_issue`** tool - Create new issues in GitLab projects with full support for:
|
|
245
|
-
- Required parameters: `project_id`, `title`
|
|
246
|
-
- Optional parameters: `description`, `assignee_ids`, `milestone_id`, `labels`, `due_date`, `confidential`, `weight`, `epic_id`, `issue_type`
|
|
247
|
-
- Support for different issue types: `issue`, `incident`, `test_case`, `task`
|
|
248
|
-
- Comprehensive test coverage for client and tool
|
|
249
|
-
- Detailed documentation in `docs/CREATE_ISSUE_TOOL.md`
|
|
250
|
-
|
|
251
|
-
### Changed
|
|
252
|
-
- Updated README.md with `gitlab_create_issue` tool documentation
|
|
253
|
-
- Added usage example for creating and managing issues
|
|
254
|
-
- Updated tool count from 60+ to 68+ tools (7 new tools added)
|
|
255
|
-
- Updated index.ts comment to reflect new audit, paginated diffs, and single note retrieval capabilities
|
|
256
|
-
- Integrated `AuditClient` into `UnifiedGitLabClient` via mixins
|
|
257
|
-
|
|
258
213
|
## [1.6.3](https://gitlab.com/vglafirov/opencode-gitlab-plugin/compare/v1.6.2...v1.6.3) (2025-12-14)
|
|
259
214
|
|
|
260
215
|
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
[](https://www.npmjs.com/package/@gitlab/opencode-gitlab-plugin)
|
|
5
5
|
[](https://opensource.org/licenses/MIT)
|
|
6
6
|
|
|
7
|
-
A comprehensive GitLab API plugin for OpenCode that provides AI-powered access to GitLab's REST
|
|
7
|
+
A comprehensive GitLab API plugin for OpenCode that provides AI-powered access to GitLab's REST and GraphQL APIs. This plugin enables seamless interaction with merge requests, issues, pipelines, repositories, epics, snippets, audit events, and more through natural language commands.
|
|
8
8
|
|
|
9
9
|
## 📋 Table of Contents
|
|
10
10
|
|
|
@@ -45,14 +45,27 @@ A comprehensive GitLab API plugin for OpenCode that provides AI-powered access t
|
|
|
45
45
|
- **TypeScript**: Full type safety with comprehensive type definitions
|
|
46
46
|
- **ESM Support**: Modern ES modules for optimal tree-shaking
|
|
47
47
|
- **Zod Validation**: Runtime schema validation for all API inputs
|
|
48
|
-
- **GraphQL Support**: Native GraphQL API support with type-safe mutations and queries
|
|
48
|
+
- **GraphQL Support**: Native GraphQL API support with type-safe mutations and queries for TODOs, Notes, Discussions, Auto-merge, and Security tools
|
|
49
|
+
- **Cursor-Based Pagination**: GraphQL-powered pagination with `first`/`after` and `last`/`before` cursors for efficient data fetching
|
|
49
50
|
- **GID Validation**: Automatic validation of GitLab Global IDs with descriptive error messages
|
|
50
51
|
- **Error Handling**: Robust error handling with detailed error messages
|
|
51
52
|
- **Authentication**: Multiple authentication methods (OAuth, API tokens)
|
|
52
53
|
- **Rate Limiting**: Built-in handling for GitLab API rate limits
|
|
53
54
|
- **Caching**: Efficient API response handling
|
|
54
55
|
- **Modular Architecture**: Clean separation of concerns with client and tool modules
|
|
55
|
-
- **Comprehensive Testing**:
|
|
56
|
+
- **Comprehensive Testing**: 181 tests with full coverage of all features
|
|
57
|
+
|
|
58
|
+
### GraphQL-Powered Tools
|
|
59
|
+
|
|
60
|
+
The following tools use GitLab's GraphQL API for enhanced functionality:
|
|
61
|
+
|
|
62
|
+
| Category | Tools | Benefits |
|
|
63
|
+
| --------------- | -------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------- |
|
|
64
|
+
| **TODOs** | `gitlab_list_todos`, `gitlab_get_todo_count` | Cursor-based pagination, rich filtering |
|
|
65
|
+
| **Notes** | `gitlab_list_mr_notes`, `gitlab_list_issue_notes`, `gitlab_list_epic_notes`, `gitlab_list_snippet_notes` | Efficient pagination, consistent response format |
|
|
66
|
+
| **Discussions** | `gitlab_list_mr_discussions`, `gitlab_list_issue_discussions`, `gitlab_list_epic_discussions`, `gitlab_list_snippet_discussions` | Cursor-based pagination, nested note support |
|
|
67
|
+
| **Auto-merge** | `gitlab_set_mr_auto_merge` | MWPS (Merge When Pipeline Succeeds), merge train support |
|
|
68
|
+
| **Security** | All vulnerability management tools | Type-safe GID validation, mutation support |
|
|
56
69
|
|
|
57
70
|
## 🏗️ Architecture
|
|
58
71
|
|
|
@@ -74,6 +87,7 @@ graph TB
|
|
|
74
87
|
|
|
75
88
|
subgraph "GitLab API"
|
|
76
89
|
REST[REST API v4]
|
|
90
|
+
GraphQL[GraphQL API]
|
|
77
91
|
MR[Merge Requests]
|
|
78
92
|
Issues[Issues]
|
|
79
93
|
Pipelines[Pipelines]
|
|
@@ -88,12 +102,14 @@ graph TB
|
|
|
88
102
|
Validator --> Client
|
|
89
103
|
Client --> Auth
|
|
90
104
|
Auth --> REST
|
|
105
|
+
Auth --> GraphQL
|
|
91
106
|
REST --> MR
|
|
92
107
|
REST --> Issues
|
|
93
108
|
REST --> Pipelines
|
|
94
109
|
REST --> Repos
|
|
95
110
|
REST --> Epics
|
|
96
|
-
|
|
111
|
+
GraphQL --> Security
|
|
112
|
+
GraphQL --> MR
|
|
97
113
|
```
|
|
98
114
|
|
|
99
115
|
### Plugin Structure
|
|
@@ -271,9 +287,9 @@ Or for API tokens:
|
|
|
271
287
|
|
|
272
288
|
## 🛠️ Available Tools
|
|
273
289
|
|
|
274
|
-
The plugin provides **
|
|
290
|
+
The plugin provides **102 tools** organized into the following categories:
|
|
275
291
|
|
|
276
|
-
### Merge Request Tools (
|
|
292
|
+
### Merge Request Tools (16 tools)
|
|
277
293
|
|
|
278
294
|
| Tool | Description |
|
|
279
295
|
| --------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
|
|
@@ -282,9 +298,9 @@ The plugin provides **104 tools** organized into the following categories:
|
|
|
282
298
|
| `gitlab_create_merge_request` | Create a new merge request |
|
|
283
299
|
| `gitlab_update_merge_request` | Update merge request title, description, state, assignees, reviewers, and labels |
|
|
284
300
|
| `gitlab_get_mr_changes` | Get file changes/diffs for a merge request |
|
|
285
|
-
| `gitlab_list_mr_discussions` | List discussion threads on a merge request with
|
|
301
|
+
| `gitlab_list_mr_discussions` | List discussion threads on a merge request (GraphQL with cursor-based pagination) |
|
|
286
302
|
| `gitlab_get_mr_discussion` | Get a specific discussion thread with all replies |
|
|
287
|
-
| `gitlab_list_mr_notes` | List all comments
|
|
303
|
+
| `gitlab_list_mr_notes` | List all comments with cursor-based pagination (GraphQL) |
|
|
288
304
|
| `gitlab_create_mr_note` | Add a comment or reply to a merge request discussion |
|
|
289
305
|
| `gitlab_create_mr_discussion` | Start a new discussion thread (optionally on specific code lines) |
|
|
290
306
|
| `gitlab_resolve_mr_discussion` | Mark a discussion as resolved after addressing feedback |
|
|
@@ -292,6 +308,7 @@ The plugin provides **104 tools** organized into the following categories:
|
|
|
292
308
|
| `gitlab_get_mr_commits` | Get all commits in a merge request |
|
|
293
309
|
| `gitlab_get_mr_pipelines` | Get all pipelines for a merge request |
|
|
294
310
|
| `gitlab_list_merge_request_diffs` | List file diffs with pagination support for large changesets |
|
|
311
|
+
| `gitlab_set_mr_auto_merge` | Enable auto-merge (MWPS) using GraphQL API when pipeline succeeds |
|
|
295
312
|
|
|
296
313
|
### Issue Tools (10 tools)
|
|
297
314
|
|
|
@@ -300,8 +317,8 @@ The plugin provides **104 tools** organized into the following categories:
|
|
|
300
317
|
| `gitlab_create_issue` | Create a new issue with title, description, labels, assignees, and milestone |
|
|
301
318
|
| `gitlab_get_issue` | Get issue details including state, author, assignees, labels, and comments |
|
|
302
319
|
| `gitlab_list_issues` | List issues with filtering by state, labels, assignee, and milestone |
|
|
303
|
-
| `gitlab_list_issue_notes` | List all comments
|
|
304
|
-
| `gitlab_list_issue_discussions` | List discussion threads with
|
|
320
|
+
| `gitlab_list_issue_notes` | List all comments with cursor-based pagination (GraphQL) |
|
|
321
|
+
| `gitlab_list_issue_discussions` | List discussion threads with cursor-based pagination (GraphQL) |
|
|
305
322
|
| `gitlab_get_issue_discussion` | Get a specific discussion thread with context |
|
|
306
323
|
| `gitlab_create_issue_note` | Add a comment or reply to an issue discussion |
|
|
307
324
|
| `gitlab_get_issue_note` | Get a specific note by ID with full details |
|
|
@@ -319,8 +336,8 @@ The plugin provides **104 tools** organized into the following categories:
|
|
|
319
336
|
| `gitlab_list_epic_issues` | Get all issues linked to an epic |
|
|
320
337
|
| `gitlab_add_issue_to_epic` | Link an issue to an epic |
|
|
321
338
|
| `gitlab_remove_issue_from_epic` | Unlink an issue from an epic |
|
|
322
|
-
| `gitlab_list_epic_notes` | List all comments
|
|
323
|
-
| `gitlab_list_epic_discussions` | List discussion threads
|
|
339
|
+
| `gitlab_list_epic_notes` | List all comments with cursor-based pagination (GraphQL) |
|
|
340
|
+
| `gitlab_list_epic_discussions` | List discussion threads with cursor-based pagination (GraphQL) |
|
|
324
341
|
| `gitlab_create_epic_note` | Add a comment or reply to an epic discussion |
|
|
325
342
|
| `gitlab_get_epic_discussion` | Get a specific epic discussion thread |
|
|
326
343
|
| `gitlab_get_epic_note` | Get a specific epic note by ID |
|
|
@@ -338,7 +355,7 @@ The plugin provides **104 tools** organized into the following categories:
|
|
|
338
355
|
| `gitlab_lint_ci_config` | Validate CI/CD YAML configuration with project context |
|
|
339
356
|
| `gitlab_lint_existing_ci_config` | Validate existing .gitlab-ci.yml from repository |
|
|
340
357
|
|
|
341
|
-
### Repository Tools (
|
|
358
|
+
### Repository Tools (12 tools)
|
|
342
359
|
|
|
343
360
|
| Tool | Description |
|
|
344
361
|
| --------------------------------- | ---------------------------------------------------------------------------- |
|
|
@@ -399,12 +416,12 @@ The plugin provides **104 tools** organized into the following categories:
|
|
|
399
416
|
|
|
400
417
|
### TODO Tools (4 tools)
|
|
401
418
|
|
|
402
|
-
| Tool | Description
|
|
403
|
-
| ---------------------------- |
|
|
404
|
-
| `gitlab_list_todos` | List TODO items
|
|
405
|
-
| `gitlab_mark_todo_done` | Mark a specific TODO as completed
|
|
406
|
-
| `gitlab_mark_all_todos_done` | Mark all pending TODOs as completed
|
|
407
|
-
| `gitlab_get_todo_count` | Get count of pending TODOs
|
|
419
|
+
| Tool | Description |
|
|
420
|
+
| ---------------------------- | ------------------------------------------------------ |
|
|
421
|
+
| `gitlab_list_todos` | List TODO items with cursor-based pagination (GraphQL) |
|
|
422
|
+
| `gitlab_mark_todo_done` | Mark a specific TODO as completed |
|
|
423
|
+
| `gitlab_mark_all_todos_done` | Mark all pending TODOs as completed |
|
|
424
|
+
| `gitlab_get_todo_count` | Get count of pending TODOs (GraphQL) |
|
|
408
425
|
|
|
409
426
|
### Project & User Tools (3 tools)
|
|
410
427
|
|
|
@@ -416,13 +433,13 @@ The plugin provides **104 tools** organized into the following categories:
|
|
|
416
433
|
|
|
417
434
|
### Snippet Tools (5 tools)
|
|
418
435
|
|
|
419
|
-
| Tool | Description
|
|
420
|
-
| ---------------------------------- |
|
|
421
|
-
| `gitlab_list_snippet_discussions` | List discussion threads
|
|
422
|
-
| `gitlab_get_snippet_discussion` | Get a specific snippet discussion thread
|
|
423
|
-
| `gitlab_list_snippet_notes` | List all comments
|
|
424
|
-
| `gitlab_create_snippet_note` | Add a comment or reply to a snippet discussion
|
|
425
|
-
| `gitlab_create_snippet_discussion` | Start a new discussion on a snippet
|
|
436
|
+
| Tool | Description |
|
|
437
|
+
| ---------------------------------- | -------------------------------------------------------------- |
|
|
438
|
+
| `gitlab_list_snippet_discussions` | List discussion threads with cursor-based pagination (GraphQL) |
|
|
439
|
+
| `gitlab_get_snippet_discussion` | Get a specific snippet discussion thread |
|
|
440
|
+
| `gitlab_list_snippet_notes` | List all comments with cursor-based pagination (GraphQL) |
|
|
441
|
+
| `gitlab_create_snippet_note` | Add a comment or reply to a snippet discussion |
|
|
442
|
+
| `gitlab_create_snippet_discussion` | Start a new discussion on a snippet |
|
|
426
443
|
|
|
427
444
|
### Discussion Tools (2 tools)
|
|
428
445
|
|
|
@@ -604,22 +621,32 @@ const fileContent = await plugin.tool.gitlab_get_file.execute({
|
|
|
604
621
|
});
|
|
605
622
|
```
|
|
606
623
|
|
|
607
|
-
### Example 6: Manage TODOs
|
|
624
|
+
### Example 6: Manage TODOs (GraphQL with Pagination)
|
|
608
625
|
|
|
609
626
|
```javascript
|
|
610
|
-
// Get TODO count
|
|
627
|
+
// Get TODO count (uses GraphQL)
|
|
611
628
|
const todoCount = await plugin.tool.gitlab_get_todo_count.execute({});
|
|
612
629
|
|
|
613
|
-
// List pending TODOs
|
|
614
|
-
const
|
|
630
|
+
// List pending TODOs with cursor-based pagination
|
|
631
|
+
const firstPage = await plugin.tool.gitlab_list_todos.execute({
|
|
615
632
|
state: 'pending',
|
|
616
633
|
type: 'MergeRequest',
|
|
617
|
-
|
|
634
|
+
first: 20,
|
|
618
635
|
});
|
|
619
636
|
|
|
637
|
+
// Get next page using cursor
|
|
638
|
+
if (firstPage.todos.pageInfo.hasNextPage) {
|
|
639
|
+
const nextPage = await plugin.tool.gitlab_list_todos.execute({
|
|
640
|
+
state: 'pending',
|
|
641
|
+
type: 'MergeRequest',
|
|
642
|
+
first: 20,
|
|
643
|
+
after: firstPage.todos.pageInfo.endCursor,
|
|
644
|
+
});
|
|
645
|
+
}
|
|
646
|
+
|
|
620
647
|
// Mark specific TODO as done
|
|
621
648
|
await plugin.tool.gitlab_mark_todo_done.execute({
|
|
622
|
-
todo_id: todos[0].id,
|
|
649
|
+
todo_id: firstPage.todos.nodes[0].id,
|
|
623
650
|
});
|
|
624
651
|
|
|
625
652
|
// Mark all TODOs as done
|
|
@@ -655,7 +682,27 @@ const commit = await plugin.tool.gitlab_create_commit.execute({
|
|
|
655
682
|
});
|
|
656
683
|
```
|
|
657
684
|
|
|
658
|
-
### Example 8:
|
|
685
|
+
### Example 8: Enable Auto-Merge (MWPS)
|
|
686
|
+
|
|
687
|
+
```javascript
|
|
688
|
+
// Get merge request to retrieve current HEAD SHA
|
|
689
|
+
const mr = await plugin.tool.gitlab_get_merge_request.execute({
|
|
690
|
+
project_id: 'my-group/my-project',
|
|
691
|
+
mr_iid: 123,
|
|
692
|
+
});
|
|
693
|
+
|
|
694
|
+
// Enable auto-merge when pipeline succeeds (GraphQL)
|
|
695
|
+
const result = await plugin.tool.gitlab_set_mr_auto_merge.execute({
|
|
696
|
+
project_id: 'my-group/my-project',
|
|
697
|
+
mr_iid: 123,
|
|
698
|
+
sha: mr.sha, // Required to prevent race conditions
|
|
699
|
+
strategy: 'MERGE_WHEN_CHECKS_PASS', // or 'ADD_TO_MERGE_TRAIN_WHEN_CHECKS_PASS'
|
|
700
|
+
});
|
|
701
|
+
|
|
702
|
+
console.log(`Auto-merge enabled: ${result.mergeRequest.autoMergeEnabled}`);
|
|
703
|
+
```
|
|
704
|
+
|
|
705
|
+
### Example 9: Manage Security Vulnerabilities
|
|
659
706
|
|
|
660
707
|
```javascript
|
|
661
708
|
// List vulnerabilities in a project
|
|
@@ -853,11 +900,11 @@ npm run test:coverage
|
|
|
853
900
|
|
|
854
901
|
**Test Coverage:**
|
|
855
902
|
|
|
856
|
-
- **
|
|
857
|
-
- Client tests for all API methods
|
|
903
|
+
- **181 tests** across 21 test files
|
|
904
|
+
- Client tests for all API methods (REST and GraphQL)
|
|
858
905
|
- Tool tests for all tool definitions
|
|
859
906
|
- Validation tests for GID utilities
|
|
860
|
-
- GraphQL method tests
|
|
907
|
+
- GraphQL method tests for Notes, Discussions, TODOs
|
|
861
908
|
- All tests passing ✅
|
|
862
909
|
|
|
863
910
|
## 🚀 CI/CD Pipeline
|
|
@@ -993,7 +1040,8 @@ async fetchGraphQL<T>(query: string, variables?: Record<string, unknown>): Promi
|
|
|
993
1040
|
- Full TypeScript type safety with generic return types
|
|
994
1041
|
- Automatic error handling for both HTTP and GraphQL errors
|
|
995
1042
|
- Support for query variables
|
|
996
|
-
-
|
|
1043
|
+
- Cursor-based pagination support for large result sets
|
|
1044
|
+
- Used by TODOs, Notes, Discussions, Auto-merge, and Security tools
|
|
997
1045
|
|
|
998
1046
|
**Example:**
|
|
999
1047
|
|
|
@@ -1009,6 +1057,18 @@ const result = await client.fetchGraphQL<{ vulnerability: { id: string } }>(
|
|
|
1009
1057
|
);
|
|
1010
1058
|
```
|
|
1011
1059
|
|
|
1060
|
+
**Pagination Example:**
|
|
1061
|
+
|
|
1062
|
+
```typescript
|
|
1063
|
+
// First page
|
|
1064
|
+
const page1 = await plugin.tool.gitlab_list_todos.execute({ first: 20 });
|
|
1065
|
+
// Navigate with cursor
|
|
1066
|
+
const page2 = await plugin.tool.gitlab_list_todos.execute({
|
|
1067
|
+
first: 20,
|
|
1068
|
+
after: page1.todos.pageInfo.endCursor,
|
|
1069
|
+
});
|
|
1070
|
+
```
|
|
1071
|
+
|
|
1012
1072
|
#### Project ID Encoding
|
|
1013
1073
|
|
|
1014
1074
|
```typescript
|
|
Binary file
|
package/dist/index.js
CHANGED
|
@@ -93,7 +93,6 @@ function buildPaginationVariables(options) {
|
|
|
93
93
|
if (options?.after) variables.after = options.after;
|
|
94
94
|
if (options?.last !== void 0) variables.last = options.last;
|
|
95
95
|
if (options?.before) variables.before = options.before;
|
|
96
|
-
if (options?.filter) variables.filter = options.filter;
|
|
97
96
|
return variables;
|
|
98
97
|
}
|
|
99
98
|
var NOTES_FRAGMENT = `
|
|
@@ -211,7 +210,6 @@ var LIST_MR_NOTES_QUERY = `
|
|
|
211
210
|
$after: String
|
|
212
211
|
$last: Int
|
|
213
212
|
$before: String
|
|
214
|
-
$filter: WorkItemNotesFilterType
|
|
215
213
|
) {
|
|
216
214
|
project(fullPath: $projectPath) {
|
|
217
215
|
mergeRequest(iid: $mrIid) {
|
|
@@ -220,7 +218,6 @@ var LIST_MR_NOTES_QUERY = `
|
|
|
220
218
|
after: $after
|
|
221
219
|
last: $last
|
|
222
220
|
before: $before
|
|
223
|
-
filter: $filter
|
|
224
221
|
) {
|
|
225
222
|
...NotesConnectionFields
|
|
226
223
|
}
|
|
@@ -469,7 +466,6 @@ var LIST_ISSUE_NOTES_QUERY = `
|
|
|
469
466
|
$after: String
|
|
470
467
|
$last: Int
|
|
471
468
|
$before: String
|
|
472
|
-
$filter: WorkItemNotesFilterType
|
|
473
469
|
) {
|
|
474
470
|
project(fullPath: $projectPath) {
|
|
475
471
|
issue(iid: $issueIid) {
|
|
@@ -478,7 +474,6 @@ var LIST_ISSUE_NOTES_QUERY = `
|
|
|
478
474
|
after: $after
|
|
479
475
|
last: $last
|
|
480
476
|
before: $before
|
|
481
|
-
filter: $filter
|
|
482
477
|
) {
|
|
483
478
|
...NotesConnectionFields
|
|
484
479
|
}
|
|
@@ -1402,36 +1397,6 @@ var LIST_TODOS_QUERY = `
|
|
|
1402
1397
|
name
|
|
1403
1398
|
avatarUrl
|
|
1404
1399
|
}
|
|
1405
|
-
targetEntity {
|
|
1406
|
-
__typename
|
|
1407
|
-
... on Issue {
|
|
1408
|
-
id
|
|
1409
|
-
title
|
|
1410
|
-
iid
|
|
1411
|
-
}
|
|
1412
|
-
... on MergeRequest {
|
|
1413
|
-
id
|
|
1414
|
-
title
|
|
1415
|
-
iid
|
|
1416
|
-
}
|
|
1417
|
-
... on Epic {
|
|
1418
|
-
id
|
|
1419
|
-
title
|
|
1420
|
-
iid
|
|
1421
|
-
}
|
|
1422
|
-
... on Commit {
|
|
1423
|
-
id
|
|
1424
|
-
title
|
|
1425
|
-
}
|
|
1426
|
-
... on DesignManagement__Design {
|
|
1427
|
-
id
|
|
1428
|
-
}
|
|
1429
|
-
... on AlertManagement__Alert {
|
|
1430
|
-
id
|
|
1431
|
-
title
|
|
1432
|
-
iid
|
|
1433
|
-
}
|
|
1434
|
-
}
|
|
1435
1400
|
}
|
|
1436
1401
|
}
|
|
1437
1402
|
}
|
|
@@ -2158,8 +2123,7 @@ Use 'before' with the 'startCursor' from pageInfo to get the previous page.`,
|
|
|
2158
2123
|
first: z.number().optional().describe("Number of items to return from the beginning (default: 20, max: 100)"),
|
|
2159
2124
|
after: z.string().optional().describe("Cursor for forward pagination - use endCursor from previous response"),
|
|
2160
2125
|
last: z.number().optional().describe("Number of items to return from the end (for backward pagination)"),
|
|
2161
|
-
before: z.string().optional().describe("Cursor for backward pagination - use startCursor from previous response")
|
|
2162
|
-
filter: z.enum(["ALL_NOTES", "ONLY_COMMENTS", "ONLY_ACTIVITY"]).optional().describe("Filter notes by type: ALL_NOTES (default), ONLY_COMMENTS, or ONLY_ACTIVITY")
|
|
2126
|
+
before: z.string().optional().describe("Cursor for backward pagination - use startCursor from previous response")
|
|
2163
2127
|
},
|
|
2164
2128
|
execute: async (args, _ctx) => {
|
|
2165
2129
|
const client = getGitLabClient();
|
|
@@ -2167,8 +2131,7 @@ Use 'before' with the 'startCursor' from pageInfo to get the previous page.`,
|
|
|
2167
2131
|
first: args.first,
|
|
2168
2132
|
after: args.after,
|
|
2169
2133
|
last: args.last,
|
|
2170
|
-
before: args.before
|
|
2171
|
-
filter: args.filter
|
|
2134
|
+
before: args.before
|
|
2172
2135
|
});
|
|
2173
2136
|
return JSON.stringify(result, null, 2);
|
|
2174
2137
|
}
|
|
@@ -2515,8 +2478,7 @@ Use 'before' with the 'startCursor' from pageInfo to get the previous page.`,
|
|
|
2515
2478
|
first: z2.number().optional().describe("Number of items to return from the beginning (default: 20, max: 100)"),
|
|
2516
2479
|
after: z2.string().optional().describe("Cursor for forward pagination - use endCursor from previous response"),
|
|
2517
2480
|
last: z2.number().optional().describe("Number of items to return from the end (for backward pagination)"),
|
|
2518
|
-
before: z2.string().optional().describe("Cursor for backward pagination - use startCursor from previous response")
|
|
2519
|
-
filter: z2.enum(["ALL_NOTES", "ONLY_COMMENTS", "ONLY_ACTIVITY"]).optional().describe("Filter notes by type: ALL_NOTES (default), ONLY_COMMENTS, or ONLY_ACTIVITY")
|
|
2481
|
+
before: z2.string().optional().describe("Cursor for backward pagination - use startCursor from previous response")
|
|
2520
2482
|
},
|
|
2521
2483
|
execute: async (args, _ctx) => {
|
|
2522
2484
|
const client = getGitLabClient();
|
|
@@ -2524,8 +2486,7 @@ Use 'before' with the 'startCursor' from pageInfo to get the previous page.`,
|
|
|
2524
2486
|
first: args.first,
|
|
2525
2487
|
after: args.after,
|
|
2526
2488
|
last: args.last,
|
|
2527
|
-
before: args.before
|
|
2528
|
-
filter: args.filter
|
|
2489
|
+
before: args.before
|
|
2529
2490
|
});
|
|
2530
2491
|
return JSON.stringify(result, null, 2);
|
|
2531
2492
|
}
|
package/package.json
CHANGED
|
Binary file
|