opencode-gitlab-plugin 2.8.1 → 2.8.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.
@@ -28893,19 +28893,45 @@ var GitLabApiClient = class {
28893
28893
  }
28894
28894
  };
28895
28895
 
28896
- // src/client/notes-types.ts
28897
- function buildPaginationVariables(options) {
28896
+ // src/client/connection-pagination.ts
28897
+ var DEFAULT_PAGE_SIZE = 20;
28898
+ var MAX_PAGE_SIZE = 100;
28899
+ function normalizePageSize(value) {
28900
+ if (value === void 0 || value === 0) return void 0;
28901
+ if (!Number.isFinite(value)) return DEFAULT_PAGE_SIZE;
28902
+ return Math.min(Math.max(Math.floor(value), 1), MAX_PAGE_SIZE);
28903
+ }
28904
+ function buildConnectionVariables(options) {
28898
28905
  const variables = {};
28899
- if (options?.first !== void 0) {
28900
- variables.first = options.first;
28901
- } else if (options?.last == null) {
28902
- variables.first = 20;
28906
+ const first = normalizePageSize(options?.first);
28907
+ const last = normalizePageSize(options?.last);
28908
+ if (first !== void 0 && last !== void 0) {
28909
+ throw new Error("Pagination accepts either 'first' or 'last', not both");
28910
+ }
28911
+ if (options?.after && last !== void 0) {
28912
+ throw new Error("Pagination cursor 'after' cannot be combined with 'last'");
28913
+ }
28914
+ if (options?.before && first !== void 0) {
28915
+ throw new Error("Pagination cursor 'before' cannot be combined with 'first'");
28916
+ }
28917
+ if (first !== void 0) {
28918
+ variables.first = first;
28919
+ } else if (last !== void 0) {
28920
+ variables.last = last;
28921
+ } else if (options?.before) {
28922
+ variables.last = DEFAULT_PAGE_SIZE;
28923
+ } else {
28924
+ variables.first = DEFAULT_PAGE_SIZE;
28903
28925
  }
28904
28926
  if (options?.after) variables.after = options.after;
28905
- if (options?.last !== void 0) variables.last = options.last;
28906
28927
  if (options?.before) variables.before = options.before;
28907
28928
  return variables;
28908
28929
  }
28930
+
28931
+ // src/client/notes-types.ts
28932
+ function buildPaginationVariables(options) {
28933
+ return buildConnectionVariables(options);
28934
+ }
28909
28935
  var NOTES_FRAGMENT = `
28910
28936
  fragment NoteFields on Note {
28911
28937
  id
@@ -28944,16 +28970,7 @@ var NOTES_CONNECTION_FRAGMENT = `
28944
28970
 
28945
28971
  // src/client/discussions-types.ts
28946
28972
  function buildDiscussionsPaginationVariables(options) {
28947
- const variables = {};
28948
- if (options?.first !== void 0) {
28949
- variables.first = options.first;
28950
- } else if (options?.last == null) {
28951
- variables.first = 20;
28952
- }
28953
- if (options?.after) variables.after = options.after;
28954
- if (options?.last !== void 0) variables.last = options.last;
28955
- if (options?.before) variables.before = options.before;
28956
- return variables;
28973
+ return buildConnectionVariables(options);
28957
28974
  }
28958
28975
  var DISCUSSION_NOTE_FRAGMENT = `
28959
28976
  fragment DiscussionNoteFields on Note {
@@ -30213,10 +30230,7 @@ var RepositoryClient = class extends GitLabApiClient {
30213
30230
  async getFile(projectId, filePath, ref) {
30214
30231
  const encodedProject = this.encodeProjectId(projectId);
30215
30232
  const encodedPath = encodeURIComponent(filePath);
30216
- let url2 = `/projects/${encodedProject}/repository/files/${encodedPath}`;
30217
- if (ref) {
30218
- url2 += `?ref=${encodeURIComponent(ref)}`;
30219
- }
30233
+ const url2 = `/projects/${encodedProject}/repository/files/${encodedPath}?ref=${encodeURIComponent(ref)}`;
30220
30234
  const file2 = await this.fetch("GET", url2);
30221
30235
  if (file2.encoding === "base64") {
30222
30236
  return Buffer.from(file2.content, "base64").toString("utf-8");
@@ -32312,13 +32326,13 @@ var repositoryTools = {
32312
32326
  gitlab_get_file: tool({
32313
32327
  description: `Get the contents of a file from a repository.
32314
32328
  Supports fetching files from any branch, tag, or commit SHA.
32315
- If ref is not specified, uses the project's default branch.
32329
+ An explicit ref is required by the GitLab repository files API.
32316
32330
  Note: Invalid refs will result in a 404 error from the GitLab API.`,
32317
32331
  args: {
32318
32332
  project_id: z5.string().describe("The project ID or URL-encoded path"),
32319
32333
  file_path: z5.string().describe("Path to the file in the repository"),
32320
- ref: z5.string().optional().describe(
32321
- `Branch name, tag, or commit SHA to fetch the file from. Supports full or short commit SHAs. If omitted, uses the project's default branch (e.g., "main" or "master").`
32334
+ ref: z5.string().trim().min(1).describe(
32335
+ "Branch name, tag, or commit SHA to fetch the file from. Supports full or short commit SHAs."
32322
32336
  )
32323
32337
  },
32324
32338
  execute: async (args, _ctx) => {
@@ -32495,6 +32509,8 @@ Scopes and their requirements:
32495
32509
  - wiki_blobs: Search wiki content (supports ref filter)
32496
32510
  - group_projects: Search projects within a group (requires group_id)
32497
32511
 
32512
+ For scopes other than milestones, state="all" is treated as omitted because it does not filter results.
32513
+
32498
32514
  Examples:
32499
32515
  - Issues: scope="issues", search="bug", project_id="my-group/my-project"
32500
32516
  - Code: scope="blobs", search="function calculateTotal"
@@ -32529,6 +32545,9 @@ Examples:
32529
32545
  state: z6.enum(["active", "closed", "all"]).optional().describe("Filter by state (for milestones scope)")
32530
32546
  },
32531
32547
  execute: async (args, _ctx) => {
32548
+ if (args.scope !== "milestones" && args.state === "all") {
32549
+ args.state = void 0;
32550
+ }
32532
32551
  validateSearchParams(args.scope, {
32533
32552
  project_id: args.project_id,
32534
32553
  group_id: args.group_id,
@@ -33230,10 +33249,10 @@ Examples:
33230
33249
  "Filter by resolved status: true for resolved, false for unresolved. Only returns resolvable discussions (excludes system notes). Client-side filtering."
33231
33250
  ),
33232
33251
  // Pagination
33233
- first: z13.number().optional().describe("Number of items to return (default: 20)"),
33252
+ first: z13.number().int().min(0).max(100).optional().describe("Number of items to return (default: 20, max: 100; 0 uses the default)"),
33234
33253
  after: z13.string().optional().describe("Cursor for pagination - use endCursor from previous response"),
33235
33254
  before: z13.string().optional().describe("Cursor for backward pagination"),
33236
- last: z13.number().optional().describe("Number of items from the end")
33255
+ last: z13.number().int().min(0).max(100).optional().describe("Number of items from the end (max: 100; 0 is omitted)")
33237
33256
  },
33238
33257
  execute: async (args, _ctx) => {
33239
33258
  validateResourceParams(args.resource_type, args);
@@ -33545,9 +33564,11 @@ Examples:
33545
33564
  "Filter by resolved status: true for resolved, false for unresolved. Only returns resolvable notes (excludes system notes). Client-side filtering."
33546
33565
  ),
33547
33566
  // Pagination
33548
- first: z14.number().optional().describe("Number of items to return from the beginning (default: 20, max: 100)"),
33567
+ first: z14.number().int().min(0).max(100).optional().describe(
33568
+ "Number of items to return from the beginning (default: 20, max: 100; 0 uses the default)"
33569
+ ),
33549
33570
  after: z14.string().optional().describe("Cursor for forward pagination - use endCursor from previous response"),
33550
- last: z14.number().optional().describe("Number of items to return from the end (for backward pagination)"),
33571
+ last: z14.number().int().min(0).max(100).optional().describe("Number of items to return from the end (max: 100; 0 is omitted)"),
33551
33572
  before: z14.string().optional().describe("Cursor for backward pagination - use startCursor from previous response")
33552
33573
  },
33553
33574
  execute: async (args, _ctx) => {
@@ -34222,7 +34243,7 @@ async function main() {
34222
34243
  ...auditTools,
34223
34244
  ...awardEmojiTools
34224
34245
  };
34225
- const version2 = true ? "2.8.1" : "0.0.0";
34246
+ const version2 = true ? "2.8.2" : "0.0.0";
34226
34247
  const server = new McpServer({ name: "gitlab", version: version2 });
34227
34248
  adaptToolsToMcp(server, allTools);
34228
34249
  const transport = new StdioServerTransport();