@github-tools/sdk 1.8.1 → 1.9.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.
Files changed (43) hide show
  1. package/README.md +195 -68
  2. package/dist/connect/eve.d.mts +11 -5
  3. package/dist/connect/eve.d.mts.map +1 -1
  4. package/dist/connect/eve.mjs +10 -2
  5. package/dist/connect/eve.mjs.map +1 -1
  6. package/dist/connect.d.mts +23 -11
  7. package/dist/connect.d.mts.map +1 -1
  8. package/dist/connect.mjs +6 -3
  9. package/dist/connect.mjs.map +1 -1
  10. package/dist/eve-DmiXBuli.mjs +864 -0
  11. package/dist/eve-DmiXBuli.mjs.map +1 -0
  12. package/dist/eve.d.mts +338 -90
  13. package/dist/eve.d.mts.map +1 -1
  14. package/dist/eve.mjs +3 -3
  15. package/dist/index-CtID5dUi.d.mts +606 -0
  16. package/dist/index-CtID5dUi.d.mts.map +1 -0
  17. package/dist/index.d.mts +2 -2
  18. package/dist/index.mjs +3 -3
  19. package/dist/{src-CfzZfU82.mjs → src-D6vC3V8r.mjs} +293 -20
  20. package/dist/src-D6vC3V8r.mjs.map +1 -0
  21. package/dist/{token-CW8lQBND.mjs → token-sbepWIkd.mjs} +45 -7
  22. package/dist/token-sbepWIkd.mjs.map +1 -0
  23. package/dist/{types-B0mvQgJf.d.mts → types-BOnJ0Rou.d.mts} +28 -8
  24. package/dist/types-BOnJ0Rou.d.mts.map +1 -0
  25. package/dist/types-BVLof-5R.d.mts +39 -0
  26. package/dist/types-BVLof-5R.d.mts.map +1 -0
  27. package/dist/workflow.d.mts +7 -7
  28. package/dist/workflow.d.mts.map +1 -1
  29. package/dist/workflow.mjs +6 -4
  30. package/dist/workflow.mjs.map +1 -1
  31. package/dist/{write-tools-Dx9LfYlU.mjs → write-tools-cg_ialNd.mjs} +1009 -107
  32. package/dist/write-tools-cg_ialNd.mjs.map +1 -0
  33. package/package.json +13 -13
  34. package/dist/eve-UPaHEGVi.mjs +0 -512
  35. package/dist/eve-UPaHEGVi.mjs.map +0 -1
  36. package/dist/index-Cs1Kebmt.d.mts +0 -463
  37. package/dist/index-Cs1Kebmt.d.mts.map +0 -1
  38. package/dist/src-CfzZfU82.mjs.map +0 -1
  39. package/dist/token-CW8lQBND.mjs.map +0 -1
  40. package/dist/types-B0mvQgJf.d.mts.map +0 -1
  41. package/dist/types-DwHrGKWO.d.mts +0 -27
  42. package/dist/types-DwHrGKWO.d.mts.map +0 -1
  43. package/dist/write-tools-Dx9LfYlU.mjs.map +0 -1
@@ -17,7 +17,7 @@ function createOctokit(token) {
17
17
  //#region src/core/sha1.ts
18
18
  /** SHA-1 hex digest without Node.js `crypto` (safe in workflow bundles). */
19
19
  function sha1Hex(data) {
20
- const words = new Uint32Array(80);
20
+ const words = /* @__PURE__ */ new Uint32Array(80);
21
21
  const bitLength = data.length * 8;
22
22
  const padded = new Uint8Array(data.length + 9 + 63 >> 6 << 6);
23
23
  padded.set(data);
@@ -97,6 +97,7 @@ const CREATE_COMMIT_ON_BRANCH_MUTATION = `
97
97
  }
98
98
  `;
99
99
  var CreateCommitOnBranchError = class extends Error {
100
+ reason;
100
101
  constructor(message, reason) {
101
102
  super(message);
102
103
  this.reason = reason;
@@ -184,10 +185,13 @@ const getFileContentInputSchema = z.object({
184
185
  owner: z.string().describe("Repository owner"),
185
186
  repo: z.string().describe("Repository name"),
186
187
  path: z.string().describe("Path to the file in the repository"),
187
- ref: z.string().optional().describe("Branch, tag, or commit SHA (defaults to the default branch)")
188
+ ref: z.string().optional().describe("Branch, tag, or commit SHA (defaults to the default branch)"),
189
+ startLine: z.number().int().positive().optional().describe("1-based start line to return (inclusive). Use with endLine or maxLines to avoid loading large files"),
190
+ endLine: z.number().int().positive().optional().describe("1-based end line to return (inclusive). Defaults to startLine + maxLines - 1 when maxLines is set"),
191
+ maxLines: z.number().int().positive().optional().describe("Max number of lines to return from startLine (or from line 1). Prefer this over reading an entire large file")
188
192
  });
189
- const getFileContentDescription = "Get the content of a file from a GitHub repository";
190
- async function getFileContentCore({ token, owner, repo, path, ref }) {
193
+ const getFileContentDescription = "Get the content of a file from a GitHub repository. Prefer startLine/endLine or maxLines to read only the lines you need";
194
+ async function getFileContentCore({ token, owner, repo, path, ref, startLine, endLine, maxLines }) {
191
195
  const { data } = await createOctokit(token).rest.repos.getContent({
192
196
  owner,
193
197
  repo,
@@ -206,13 +210,62 @@ async function getFileContentCore({ token, owner, repo, path, ref }) {
206
210
  type: data.type,
207
211
  path: data.path
208
212
  };
209
- const content = Buffer.from(data.content, "base64").toString("utf-8");
213
+ const fullContent = Buffer.from(data.content, "base64").toString("utf-8");
214
+ const lines = fullContent.split("\n");
215
+ const totalLines = lines.length;
216
+ if (!(startLine != null || endLine != null || maxLines != null)) return {
217
+ type: "file",
218
+ path: data.path,
219
+ sha: data.sha,
220
+ size: data.size,
221
+ totalLines,
222
+ content: fullContent
223
+ };
224
+ const from = startLine ?? 1;
225
+ const to = endLine ?? (maxLines != null ? from + maxLines - 1 : totalLines);
226
+ const clampedFrom = Math.min(Math.max(from, 1), totalLines);
227
+ const clampedTo = Math.min(Math.max(to, clampedFrom), totalLines);
228
+ const slice = lines.slice(clampedFrom - 1, clampedTo);
210
229
  return {
211
230
  type: "file",
212
231
  path: data.path,
213
232
  sha: data.sha,
214
233
  size: data.size,
215
- content
234
+ totalLines,
235
+ startLine: clampedFrom,
236
+ endLine: clampedTo,
237
+ truncated: clampedFrom > 1 || clampedTo < totalLines,
238
+ content: slice.join("\n")
239
+ };
240
+ }
241
+ const getRepositoryTreeInputSchema = z.object({
242
+ owner: z.string().describe("Repository owner"),
243
+ repo: z.string().describe("Repository name"),
244
+ ref: z.string().optional().describe("Branch, tag, or commit SHA (defaults to the default branch)"),
245
+ recursive: z.boolean().optional().default(false).describe("Recursively list the entire tree instead of just the top level")
246
+ });
247
+ const getRepositoryTreeDescription = "List the file and directory structure of a repository at a given ref";
248
+ async function getRepositoryTreeCore({ token, owner, repo, ref, recursive }) {
249
+ const octokit = createOctokit(token);
250
+ const treeSha = ref || (await octokit.rest.repos.get({
251
+ owner,
252
+ repo
253
+ })).data.default_branch;
254
+ const { data } = await octokit.rest.git.getTree({
255
+ owner,
256
+ repo,
257
+ tree_sha: treeSha,
258
+ recursive: recursive ? "true" : void 0
259
+ });
260
+ return {
261
+ sha: data.sha,
262
+ truncated: data.truncated,
263
+ entries: data.tree.map((entry) => ({
264
+ path: entry.path,
265
+ type: entry.type,
266
+ size: entry.size,
267
+ sha: entry.sha
268
+ }))
216
269
  };
217
270
  }
218
271
  const createBranchInputSchema = z.object({
@@ -420,18 +473,21 @@ async function createOrUpdateFileCore({ token, owner, repo, path, message, conte
420
473
  //#endregion
421
474
  //#region src/core/model-output.ts
422
475
  const MAX_PATCH_LENGTH = 4e3;
423
- const MAX_CONTENT_LENGTH = 5e4;
476
+ const MAX_CONTENT_LENGTH = 2e4;
424
477
  function truncateText(text, maxLength) {
425
478
  if (text.length <= maxLength) return text;
426
479
  return `${text.slice(0, maxLength)}\n\n[truncated: ${text.length - maxLength} more characters]`;
427
480
  }
481
+ function truncatePatchFields(files) {
482
+ return files.map((file) => ({
483
+ ...file,
484
+ patch: file.patch ? truncateText(file.patch, MAX_PATCH_LENGTH) : file.patch
485
+ }));
486
+ }
428
487
  function listPullRequestFilesToModelOutput({ output }) {
429
488
  return {
430
489
  type: "json",
431
- value: output.map((file) => ({
432
- ...file,
433
- patch: file.patch ? truncateText(file.patch, MAX_PATCH_LENGTH) : file.patch
434
- }))
490
+ value: truncatePatchFields(output)
435
491
  };
436
492
  }
437
493
  function getCommitToModelOutput({ output }) {
@@ -440,10 +496,17 @@ function getCommitToModelOutput({ output }) {
440
496
  type: "json",
441
497
  value: {
442
498
  ...commit,
443
- files: commit.files?.map((file) => ({
444
- ...file,
445
- patch: file.patch ? truncateText(file.patch, MAX_PATCH_LENGTH) : file.patch
446
- }))
499
+ files: commit.files ? truncatePatchFields(commit.files) : commit.files
500
+ }
501
+ };
502
+ }
503
+ function compareCommitsToModelOutput({ output }) {
504
+ const comparison = output;
505
+ return {
506
+ type: "json",
507
+ value: {
508
+ ...comparison,
509
+ files: comparison.files ? truncatePatchFields(comparison.files) : comparison.files
447
510
  }
448
511
  };
449
512
  }
@@ -461,6 +524,16 @@ function getFileContentToModelOutput({ output }) {
461
524
  value: result
462
525
  };
463
526
  }
527
+ function getPullRequestContextToModelOutput({ output }) {
528
+ const result = output;
529
+ return {
530
+ type: "json",
531
+ value: {
532
+ ...result,
533
+ files: result.files ? truncatePatchFields(result.files) : result.files
534
+ }
535
+ };
536
+ }
464
537
  //#endregion
465
538
  //#region src/core/token.ts
466
539
  const TOKEN_REQUIRED_ERROR = "GitHub token is required. Pass it as `token` or set the GITHUB_TOKEN environment variable.";
@@ -485,6 +558,38 @@ function createGithubTokenResolver(token) {
485
558
  function resolveGithubToken(token) {
486
559
  return createGithubTokenResolver(token)();
487
560
  }
561
+ /**
562
+ * Controls how much text is returned for bodies/notes.
563
+ * - `summary` — truncate long bodies (~500 chars) to save tokens (default)
564
+ * - `full` — return the complete body
565
+ */
566
+ const detailSchema = z.enum(["summary", "full"]).optional().default("summary").describe("summary truncates long bodies (~500 chars) to save tokens; full returns the complete body");
567
+ /**
568
+ * Truncate a body/notes string when `detail` is `summary`.
569
+ * Returns the original value when `full`, null/undefined, or already short.
570
+ */
571
+ function applyDetailBody(body, detail, maxLength = 500) {
572
+ if (detail === "full" || body == null || body.length <= maxLength) return body;
573
+ return `${body.slice(0, maxLength)}\n\n[truncated: ${body.length - maxLength} more characters]`;
574
+ }
575
+ //#endregion
576
+ //#region src/core/pagination.ts
577
+ const maxPagesSchema = z.number().int().positive().max(20).optional().describe("Automatically fetch and combine up to this many pages on top of perPage. Omit to fetch a single page.");
578
+ /**
579
+ * Fetches a single page (`startPage`, default 1) by default. When `maxPages`
580
+ * is set, fetches pages sequentially starting at `startPage` and stops early
581
+ * once a page returns fewer than `perPage` items (the last page).
582
+ */
583
+ async function fetchAllPages(fetchPage, perPage, maxPages, startPage = 1) {
584
+ if (!maxPages || maxPages <= 1) return fetchPage(startPage);
585
+ const results = [];
586
+ for (let i = 0; i < maxPages; i++) {
587
+ const items = await fetchPage(startPage + i);
588
+ results.push(...items);
589
+ if (items.length < perPage) break;
590
+ }
591
+ return results;
592
+ }
488
593
  //#endregion
489
594
  //#region src/core/pull-requests.ts
490
595
  const listPullRequestsInputSchema = z.object({
@@ -495,17 +600,22 @@ const listPullRequestsInputSchema = z.object({
495
600
  "closed",
496
601
  "all"
497
602
  ]).optional().default("open").describe("Filter by state"),
498
- perPage: z.number().optional().default(30).describe("Number of results to return (max 100)")
603
+ perPage: z.number().optional().default(30).describe("Number of results to return per page (max 100)"),
604
+ maxPages: maxPagesSchema
499
605
  });
500
606
  const listPullRequestsDescription = "List pull requests for a GitHub repository";
501
- async function listPullRequestsCore({ token, owner, repo, state, perPage }) {
502
- const { data } = await createOctokit(token).rest.pulls.list({
503
- owner,
504
- repo,
505
- state,
506
- per_page: perPage
507
- });
508
- return data.map((pr) => ({
607
+ async function listPullRequestsCore({ token, owner, repo, state, perPage, maxPages }) {
608
+ const octokit = createOctokit(token);
609
+ return (await fetchAllPages(async (page) => {
610
+ const { data } = await octokit.rest.pulls.list({
611
+ owner,
612
+ repo,
613
+ state,
614
+ per_page: perPage,
615
+ page
616
+ });
617
+ return data;
618
+ }, perPage, maxPages)).map((pr) => ({
509
619
  number: pr.number,
510
620
  title: pr.title,
511
621
  state: pr.state,
@@ -521,10 +631,11 @@ async function listPullRequestsCore({ token, owner, repo, state, perPage }) {
521
631
  const getPullRequestInputSchema = z.object({
522
632
  owner: z.string().describe("Repository owner"),
523
633
  repo: z.string().describe("Repository name"),
524
- pullNumber: z.number().describe("Pull request number")
634
+ pullNumber: z.number().describe("Pull request number"),
635
+ detail: detailSchema
525
636
  });
526
- const getPullRequestDescription = "Get detailed information about a specific pull request";
527
- async function getPullRequestCore({ token, owner, repo, pullNumber }) {
637
+ const getPullRequestDescription = "Get detailed information about a specific pull request. Body is truncated by default (detail: summary) — set detail full for the complete description";
638
+ async function getPullRequestCore({ token, owner, repo, pullNumber, detail = "summary" }) {
528
639
  const { data } = await createOctokit(token).rest.pulls.get({
529
640
  owner,
530
641
  repo,
@@ -533,11 +644,12 @@ async function getPullRequestCore({ token, owner, repo, pullNumber }) {
533
644
  return {
534
645
  number: data.number,
535
646
  title: data.title,
536
- body: data.body,
647
+ body: applyDetailBody(data.body, detail),
537
648
  state: data.state,
538
649
  url: data.html_url,
539
650
  author: data.user?.login,
540
651
  branch: data.head.ref,
652
+ headSha: data.head.sha,
541
653
  base: data.base.ref,
542
654
  draft: data.draft,
543
655
  merged: data.merged,
@@ -639,11 +751,13 @@ const listPullRequestFilesInputSchema = z.object({
639
751
  owner: z.string().describe("Repository owner"),
640
752
  repo: z.string().describe("Repository name"),
641
753
  pullNumber: z.number().describe("Pull request number"),
754
+ includePatch: z.boolean().optional().default(false).describe("Include diff patches (token-heavy). Prefer false for an overview, then set true with filenames to fetch specific diffs"),
755
+ filenames: z.array(z.string()).optional().describe("If set, only return these file paths (useful with includePatch: true for targeted diffs)"),
642
756
  perPage: z.number().optional().default(30).describe("Number of results to return (max 100)"),
643
757
  page: z.number().optional().default(1).describe("Page number for pagination")
644
758
  });
645
- const listPullRequestFilesDescription = "List files changed in a pull request, including diff status and patch content";
646
- async function listPullRequestFilesCore({ token, owner, repo, pullNumber, perPage, page }) {
759
+ const listPullRequestFilesDescription = "List files changed in a pull request with status and stats. Patches are omitted by default — set includePatch true (optionally with filenames) to fetch diffs";
760
+ async function listPullRequestFilesCore({ token, owner, repo, pullNumber, includePatch, filenames, perPage, page }) {
647
761
  const { data } = await createOctokit(token).rest.pulls.listFiles({
648
762
  owner,
649
763
  repo,
@@ -651,13 +765,14 @@ async function listPullRequestFilesCore({ token, owner, repo, pullNumber, perPag
651
765
  per_page: perPage,
652
766
  page
653
767
  });
654
- return data.map((file) => ({
768
+ const filenameSet = filenames?.length ? new Set(filenames) : null;
769
+ return data.filter((file) => !filenameSet || filenameSet.has(file.filename)).map((file) => ({
655
770
  filename: file.filename,
656
771
  status: file.status,
657
772
  additions: file.additions,
658
773
  deletions: file.deletions,
659
774
  changes: file.changes,
660
- patch: file.patch
775
+ ...includePatch && file.patch != null ? { patch: file.patch } : {}
661
776
  }));
662
777
  }
663
778
  const listPullRequestReviewsInputSchema = z.object({
@@ -722,6 +837,30 @@ async function createPullRequestReviewCore({ token, owner, repo, pullNumber, bod
722
837
  submittedAt: data.submitted_at
723
838
  };
724
839
  }
840
+ const requestReviewersInputSchema = z.object({
841
+ owner: z.string().describe("Repository owner"),
842
+ repo: z.string().describe("Repository name"),
843
+ pullNumber: z.number().describe("Pull request number"),
844
+ reviewers: z.array(z.string()).optional().describe("GitHub usernames to request a review from"),
845
+ teamReviewers: z.array(z.string()).optional().describe("Team slugs to request a review from")
846
+ });
847
+ const requestReviewersDescription = "Request reviews from users or teams on a pull request";
848
+ /** Not idempotent — re-requesting an existing reviewer is a no-op on GitHub but still mutates. */
849
+ async function requestReviewersCore({ token, owner, repo, pullNumber, reviewers, teamReviewers }) {
850
+ const { data } = await createOctokit(token).rest.pulls.requestReviewers({
851
+ owner,
852
+ repo,
853
+ pull_number: pullNumber,
854
+ reviewers,
855
+ team_reviewers: teamReviewers
856
+ });
857
+ return {
858
+ number: data.number,
859
+ url: data.html_url,
860
+ requestedReviewers: data.requested_reviewers?.map((r) => r.login),
861
+ requestedTeams: data.requested_teams?.map((t) => t.slug)
862
+ };
863
+ }
725
864
  //#endregion
726
865
  //#region src/core/issues.ts
727
866
  const listIssuesInputSchema = z.object({
@@ -733,18 +872,23 @@ const listIssuesInputSchema = z.object({
733
872
  "all"
734
873
  ]).optional().default("open").describe("Filter by state"),
735
874
  labels: z.string().optional().describe("Comma-separated list of label names to filter by"),
736
- perPage: z.number().optional().default(30).describe("Number of results to return (max 100)")
875
+ perPage: z.number().optional().default(30).describe("Number of results to return per page (max 100)"),
876
+ maxPages: maxPagesSchema
737
877
  });
738
878
  const listIssuesDescription = "List issues for a GitHub repository (excludes pull requests)";
739
- async function listIssuesCore({ token, owner, repo, state, labels, perPage }) {
740
- const { data } = await createOctokit(token).rest.issues.listForRepo({
741
- owner,
742
- repo,
743
- state,
744
- labels,
745
- per_page: perPage
746
- });
747
- return data.filter((issue) => !issue.pull_request).map((issue) => ({
879
+ async function listIssuesCore({ token, owner, repo, state, labels, perPage, maxPages }) {
880
+ const octokit = createOctokit(token);
881
+ return (await fetchAllPages(async (page) => {
882
+ const { data } = await octokit.rest.issues.listForRepo({
883
+ owner,
884
+ repo,
885
+ state,
886
+ labels,
887
+ per_page: perPage,
888
+ page
889
+ });
890
+ return data;
891
+ }, perPage, maxPages)).filter((issue) => !issue.pull_request).map((issue) => ({
748
892
  number: issue.number,
749
893
  title: issue.title,
750
894
  state: issue.state,
@@ -758,10 +902,11 @@ async function listIssuesCore({ token, owner, repo, state, labels, perPage }) {
758
902
  const getIssueInputSchema = z.object({
759
903
  owner: z.string().describe("Repository owner"),
760
904
  repo: z.string().describe("Repository name"),
761
- issueNumber: z.number().describe("Issue number")
905
+ issueNumber: z.number().describe("Issue number"),
906
+ detail: detailSchema
762
907
  });
763
- const getIssueDescription = "Get detailed information about a specific issue";
764
- async function getIssueCore({ token, owner, repo, issueNumber }) {
908
+ const getIssueDescription = "Get detailed information about a specific issue. Body is truncated by default (detail: summary) — set detail full for the complete description";
909
+ async function getIssueCore({ token, owner, repo, issueNumber, detail = "summary" }) {
765
910
  const { data } = await createOctokit(token).rest.issues.get({
766
911
  owner,
767
912
  repo,
@@ -770,7 +915,7 @@ async function getIssueCore({ token, owner, repo, issueNumber }) {
770
915
  return {
771
916
  number: data.number,
772
917
  title: data.title,
773
- body: data.body,
918
+ body: applyDetailBody(data.body, detail),
774
919
  state: data.state,
775
920
  url: data.html_url,
776
921
  author: data.user?.login,
@@ -782,6 +927,31 @@ async function getIssueCore({ token, owner, repo, issueNumber }) {
782
927
  closedAt: data.closed_at
783
928
  };
784
929
  }
930
+ z.object({
931
+ owner: z.string().describe("Repository owner"),
932
+ repo: z.string().describe("Repository name"),
933
+ issueNumber: z.number().describe("Issue number"),
934
+ perPage: z.number().optional().default(30).describe("Number of comments to return (max 100)"),
935
+ page: z.number().optional().default(1).describe("Page number for pagination"),
936
+ detail: detailSchema
937
+ });
938
+ async function listIssueCommentsCore({ token, owner, repo, issueNumber, perPage, page, detail = "summary" }) {
939
+ const { data } = await createOctokit(token).rest.issues.listComments({
940
+ owner,
941
+ repo,
942
+ issue_number: issueNumber,
943
+ per_page: perPage,
944
+ page
945
+ });
946
+ return data.map((comment) => ({
947
+ id: comment.id,
948
+ url: comment.html_url,
949
+ body: applyDetailBody(comment.body, detail),
950
+ author: comment.user?.login,
951
+ createdAt: comment.created_at,
952
+ updatedAt: comment.updated_at
953
+ }));
954
+ }
785
955
  const createIssueInputSchema = z.object({
786
956
  owner: z.string().describe("Repository owner"),
787
957
  repo: z.string().describe("Repository name"),
@@ -931,6 +1101,46 @@ async function removeLabelCore({ token, owner, repo, issueNumber, label }) {
931
1101
  issueNumber
932
1102
  };
933
1103
  }
1104
+ const addAssigneesInputSchema = z.object({
1105
+ owner: z.string().describe("Repository owner"),
1106
+ repo: z.string().describe("Repository name"),
1107
+ issueNumber: z.number().describe("Issue or pull request number"),
1108
+ assignees: z.array(z.string()).describe("GitHub usernames to assign")
1109
+ });
1110
+ const addAssigneesDescription = "Assign users to an issue or pull request";
1111
+ /** Not idempotent — re-adding an existing assignee is a no-op on GitHub but still mutates. */
1112
+ async function addAssigneesCore({ token, owner, repo, issueNumber, assignees }) {
1113
+ const { data } = await createOctokit(token).rest.issues.addAssignees({
1114
+ owner,
1115
+ repo,
1116
+ issue_number: issueNumber,
1117
+ assignees
1118
+ });
1119
+ return {
1120
+ number: data.number,
1121
+ assignees: data.assignees?.map((a) => a.login)
1122
+ };
1123
+ }
1124
+ const removeAssigneesInputSchema = z.object({
1125
+ owner: z.string().describe("Repository owner"),
1126
+ repo: z.string().describe("Repository name"),
1127
+ issueNumber: z.number().describe("Issue or pull request number"),
1128
+ assignees: z.array(z.string()).describe("GitHub usernames to unassign")
1129
+ });
1130
+ const removeAssigneesDescription = "Remove assignees from an issue or pull request";
1131
+ /** Idempotent — removing an assignee that is not assigned is a no-op on GitHub. */
1132
+ async function removeAssigneesCore({ token, owner, repo, issueNumber, assignees }) {
1133
+ const { data } = await createOctokit(token).rest.issues.removeAssignees({
1134
+ owner,
1135
+ repo,
1136
+ issue_number: issueNumber,
1137
+ assignees
1138
+ });
1139
+ return {
1140
+ number: data.number,
1141
+ assignees: data.assignees?.map((a) => a.login)
1142
+ };
1143
+ }
934
1144
  //#endregion
935
1145
  //#region src/core/search.ts
936
1146
  const searchCodeInputSchema = z.object({
@@ -1029,21 +1239,26 @@ const listCommitsInputSchema = z.object({
1029
1239
  author: z.string().optional().describe("GitHub username or email to filter commits by"),
1030
1240
  since: z.string().optional().describe("Only commits after this date (ISO 8601 format)"),
1031
1241
  until: z.string().optional().describe("Only commits before this date (ISO 8601 format)"),
1032
- perPage: z.number().optional().default(30).describe("Number of results to return (max 100)")
1242
+ perPage: z.number().optional().default(30).describe("Number of results to return per page (max 100)"),
1243
+ maxPages: maxPagesSchema
1033
1244
  });
1034
1245
  const listCommitsDescription = "List commits for a GitHub repository. Filter by file path to see commits that touched a file. For line-by-line attribution at a given ref, use getBlame instead.";
1035
- async function listCommitsCore({ token, owner, repo, path, sha, author, since, until, perPage }) {
1036
- const { data } = await createOctokit(token).rest.repos.listCommits({
1037
- owner,
1038
- repo,
1039
- path,
1040
- sha,
1041
- author,
1042
- since,
1043
- until,
1044
- per_page: perPage
1045
- });
1046
- return data.map((commit) => ({
1246
+ async function listCommitsCore({ token, owner, repo, path, sha, author, since, until, perPage, maxPages }) {
1247
+ const octokit = createOctokit(token);
1248
+ return (await fetchAllPages(async (page) => {
1249
+ const { data } = await octokit.rest.repos.listCommits({
1250
+ owner,
1251
+ repo,
1252
+ path,
1253
+ sha,
1254
+ author,
1255
+ since,
1256
+ until,
1257
+ per_page: perPage,
1258
+ page
1259
+ });
1260
+ return data;
1261
+ }, perPage, maxPages)).map((commit) => ({
1047
1262
  sha: commit.sha,
1048
1263
  message: commit.commit.message,
1049
1264
  author: commit.commit.author?.name,
@@ -1055,10 +1270,11 @@ async function listCommitsCore({ token, owner, repo, path, sha, author, since, u
1055
1270
  const getCommitInputSchema = z.object({
1056
1271
  owner: z.string().describe("Repository owner"),
1057
1272
  repo: z.string().describe("Repository name"),
1058
- ref: z.string().describe("Commit SHA, branch name, or tag")
1273
+ ref: z.string().describe("Commit SHA, branch name, or tag"),
1274
+ includePatch: z.boolean().optional().default(false).describe("Include diff patches for changed files (token-heavy). Prefer false unless you need the diffs")
1059
1275
  });
1060
- const getCommitDescription = "Get detailed information about a specific commit, including the list of files changed with additions and deletions";
1061
- async function getCommitCore({ token, owner, repo, ref }) {
1276
+ const getCommitDescription = "Get detailed information about a specific commit, including the list of files changed with additions and deletions. Patches are omitted by default — set includePatch true to include diffs";
1277
+ async function getCommitCore({ token, owner, repo, ref, includePatch }) {
1062
1278
  const { data } = await createOctokit(token).rest.repos.getCommit({
1063
1279
  owner,
1064
1280
  repo,
@@ -1081,7 +1297,7 @@ async function getCommitCore({ token, owner, repo, ref }) {
1081
1297
  status: file.status,
1082
1298
  additions: file.additions,
1083
1299
  deletions: file.deletions,
1084
- patch: file.patch
1300
+ ...includePatch && file.patch != null ? { patch: file.patch } : {}
1085
1301
  }))
1086
1302
  };
1087
1303
  }
@@ -1143,6 +1359,41 @@ async function getBlameCore({ token, owner, repo, path, ref, line, lineStart, li
1143
1359
  ranges
1144
1360
  };
1145
1361
  }
1362
+ const compareCommitsInputSchema = z.object({
1363
+ owner: z.string().describe("Repository owner"),
1364
+ repo: z.string().describe("Repository name"),
1365
+ base: z.string().describe("Base branch, tag, or commit SHA"),
1366
+ head: z.string().describe("Head branch, tag, or commit SHA to compare against base"),
1367
+ includePatch: z.boolean().optional().default(false).describe("Include diff patches for changed files (token-heavy). Prefer false unless you need the diffs")
1368
+ });
1369
+ const compareCommitsDescription = "Compare two branches, tags, or commits — shows ahead/behind counts, the commits in between, and the files that differ. Patches are omitted by default — set includePatch true to include diffs";
1370
+ async function compareCommitsCore({ token, owner, repo, base, head, includePatch }) {
1371
+ const { data } = await createOctokit(token).rest.repos.compareCommitsWithBasehead({
1372
+ owner,
1373
+ repo,
1374
+ basehead: `${base}...${head}`
1375
+ });
1376
+ return {
1377
+ status: data.status,
1378
+ aheadBy: data.ahead_by,
1379
+ behindBy: data.behind_by,
1380
+ totalCommits: data.total_commits,
1381
+ url: data.html_url,
1382
+ commits: data.commits.map((commit) => ({
1383
+ sha: commit.sha,
1384
+ message: commit.commit.message,
1385
+ author: commit.commit.author?.name,
1386
+ authorLogin: commit.author?.login
1387
+ })),
1388
+ files: data.files?.map((file) => ({
1389
+ filename: file.filename,
1390
+ status: file.status,
1391
+ additions: file.additions,
1392
+ deletions: file.deletions,
1393
+ ...includePatch && file.patch != null ? { patch: file.patch } : {}
1394
+ }))
1395
+ };
1396
+ }
1146
1397
  //#endregion
1147
1398
  //#region src/core/gists.ts
1148
1399
  const listGistsInputSchema = z.object({
@@ -1342,33 +1593,39 @@ const listWorkflowRunsInputSchema = z.object({
1342
1593
  "waiting",
1343
1594
  "pending"
1344
1595
  ]).optional().describe("Status to filter by"),
1345
- perPage: z.number().optional().default(30).describe("Number of results to return (max 100)"),
1346
- page: z.number().optional().default(1).describe("Page number for pagination")
1596
+ perPage: z.number().optional().default(30).describe("Number of results to return per page (max 100)"),
1597
+ page: z.number().optional().default(1).describe("Page number for pagination"),
1598
+ maxPages: maxPagesSchema
1347
1599
  });
1348
1600
  const listWorkflowRunsDescription = "List workflow runs for a repository, optionally filtered by workflow, branch, status, or event";
1349
- async function listWorkflowRunsCore({ token, owner, repo, workflowId, branch, event, status, perPage, page }) {
1601
+ async function listWorkflowRunsCore({ token, owner, repo, workflowId, branch, event, status, perPage, page, maxPages }) {
1350
1602
  const octokit = createOctokit(token);
1351
- const { data } = workflowId ? await octokit.rest.actions.listWorkflowRuns({
1352
- owner,
1353
- repo,
1354
- workflow_id: workflowId,
1355
- per_page: perPage,
1356
- page,
1357
- ...branch && { branch },
1358
- ...event && { event },
1359
- ...status && { status }
1360
- }) : await octokit.rest.actions.listWorkflowRunsForRepo({
1361
- owner,
1362
- repo,
1363
- per_page: perPage,
1364
- page,
1365
- ...branch && { branch },
1366
- ...event && { event },
1367
- ...status && { status }
1368
- });
1603
+ let totalCount = 0;
1604
+ const runs = await fetchAllPages(async (currentPage) => {
1605
+ const { data } = workflowId ? await octokit.rest.actions.listWorkflowRuns({
1606
+ owner,
1607
+ repo,
1608
+ workflow_id: workflowId,
1609
+ per_page: perPage,
1610
+ page: currentPage,
1611
+ ...branch && { branch },
1612
+ ...event && { event },
1613
+ ...status && { status }
1614
+ }) : await octokit.rest.actions.listWorkflowRunsForRepo({
1615
+ owner,
1616
+ repo,
1617
+ per_page: perPage,
1618
+ page: currentPage,
1619
+ ...branch && { branch },
1620
+ ...event && { event },
1621
+ ...status && { status }
1622
+ });
1623
+ totalCount = data.total_count;
1624
+ return data.workflow_runs;
1625
+ }, perPage, maxPages, page);
1369
1626
  return {
1370
- totalCount: data.total_count,
1371
- runs: data.workflow_runs.map((run) => ({
1627
+ totalCount,
1628
+ runs: runs.map((run) => ({
1372
1629
  id: run.id,
1373
1630
  name: run.name,
1374
1631
  status: run.status,
@@ -1521,6 +1778,507 @@ async function rerunWorkflowRunCore({ token, owner, repo, runId, onlyFailedJobs
1521
1778
  };
1522
1779
  }
1523
1780
  //#endregion
1781
+ //#region src/core/checks.ts
1782
+ const listCheckRunsInputSchema = z.object({
1783
+ owner: z.string().describe("Repository owner"),
1784
+ repo: z.string().describe("Repository name"),
1785
+ ref: z.string().describe("Git ref: branch, tag, or commit SHA"),
1786
+ perPage: z.number().optional().default(30).describe("Number of results to return per page (max 100)"),
1787
+ maxPages: maxPagesSchema
1788
+ });
1789
+ const listCheckRunsDescription = "List check runs (Checks API — GitHub Actions and other CI providers) for a commit, branch, or tag";
1790
+ async function listCheckRunsCore({ token, owner, repo, ref, perPage, maxPages }) {
1791
+ const octokit = createOctokit(token);
1792
+ let totalCount = 0;
1793
+ const checkRuns = await fetchAllPages(async (page) => {
1794
+ const { data } = await octokit.rest.checks.listForRef({
1795
+ owner,
1796
+ repo,
1797
+ ref,
1798
+ per_page: perPage,
1799
+ page
1800
+ });
1801
+ totalCount = data.total_count;
1802
+ return data.check_runs;
1803
+ }, perPage, maxPages);
1804
+ return {
1805
+ totalCount,
1806
+ checkRuns: checkRuns.map((run) => ({
1807
+ id: run.id,
1808
+ name: run.name,
1809
+ status: run.status,
1810
+ conclusion: run.conclusion,
1811
+ url: run.html_url,
1812
+ startedAt: run.started_at,
1813
+ completedAt: run.completed_at
1814
+ }))
1815
+ };
1816
+ }
1817
+ const getCombinedStatusInputSchema = z.object({
1818
+ owner: z.string().describe("Repository owner"),
1819
+ repo: z.string().describe("Repository name"),
1820
+ ref: z.string().describe("Git ref: branch, tag, or commit SHA")
1821
+ });
1822
+ const getCombinedStatusDescription = "Get the combined commit status (Statuses API — legacy CI integrations) for a commit, branch, or tag";
1823
+ async function getCombinedStatusCore({ token, owner, repo, ref }) {
1824
+ const { data } = await createOctokit(token).rest.repos.getCombinedStatusForRef({
1825
+ owner,
1826
+ repo,
1827
+ ref
1828
+ });
1829
+ return {
1830
+ state: data.state,
1831
+ totalCount: data.total_count,
1832
+ statuses: data.statuses.map((status) => ({
1833
+ context: status.context,
1834
+ state: status.state,
1835
+ description: status.description,
1836
+ url: status.target_url
1837
+ }))
1838
+ };
1839
+ }
1840
+ //#endregion
1841
+ //#region src/core/releases.ts
1842
+ const listReleasesInputSchema = z.object({
1843
+ owner: z.string().describe("Repository owner"),
1844
+ repo: z.string().describe("Repository name"),
1845
+ perPage: z.number().optional().default(30).describe("Number of results to return per page (max 100)"),
1846
+ maxPages: maxPagesSchema,
1847
+ detail: detailSchema
1848
+ });
1849
+ const listReleasesDescription = "List releases for a GitHub repository, newest first (includes drafts and prereleases). Bodies truncated by default (detail: summary)";
1850
+ async function listReleasesCore({ token, owner, repo, perPage, maxPages, detail = "summary" }) {
1851
+ const octokit = createOctokit(token);
1852
+ return (await fetchAllPages(async (page) => {
1853
+ const { data } = await octokit.rest.repos.listReleases({
1854
+ owner,
1855
+ repo,
1856
+ per_page: perPage,
1857
+ page
1858
+ });
1859
+ return data;
1860
+ }, perPage, maxPages)).map((release) => ({
1861
+ id: release.id,
1862
+ tagName: release.tag_name,
1863
+ name: release.name,
1864
+ body: applyDetailBody(release.body, detail),
1865
+ draft: release.draft,
1866
+ prerelease: release.prerelease,
1867
+ url: release.html_url,
1868
+ author: release.author?.login,
1869
+ createdAt: release.created_at,
1870
+ publishedAt: release.published_at
1871
+ }));
1872
+ }
1873
+ const getLatestReleaseInputSchema = z.object({
1874
+ owner: z.string().describe("Repository owner"),
1875
+ repo: z.string().describe("Repository name"),
1876
+ detail: detailSchema
1877
+ });
1878
+ const getLatestReleaseDescription = "Get the latest published release for a GitHub repository (excludes drafts and prereleases). Body truncated by default (detail: summary)";
1879
+ async function getLatestReleaseCore({ token, owner, repo, detail = "summary" }) {
1880
+ const { data } = await createOctokit(token).rest.repos.getLatestRelease({
1881
+ owner,
1882
+ repo
1883
+ });
1884
+ return {
1885
+ id: data.id,
1886
+ tagName: data.tag_name,
1887
+ name: data.name,
1888
+ body: applyDetailBody(data.body, detail),
1889
+ url: data.html_url,
1890
+ author: data.author?.login,
1891
+ createdAt: data.created_at,
1892
+ publishedAt: data.published_at,
1893
+ assets: data.assets.map((asset) => ({
1894
+ name: asset.name,
1895
+ downloadUrl: asset.browser_download_url,
1896
+ size: asset.size,
1897
+ downloadCount: asset.download_count
1898
+ }))
1899
+ };
1900
+ }
1901
+ const getReleaseInputSchema = z.object({
1902
+ owner: z.string().describe("Repository owner"),
1903
+ repo: z.string().describe("Repository name"),
1904
+ releaseId: z.number().describe("Release ID (from listReleases or getLatestRelease)"),
1905
+ detail: detailSchema
1906
+ });
1907
+ const getReleaseDescription = "Get a specific release by ID, including its assets. Body truncated by default (detail: summary)";
1908
+ async function getReleaseCore({ token, owner, repo, releaseId, detail = "summary" }) {
1909
+ const { data } = await createOctokit(token).rest.repos.getRelease({
1910
+ owner,
1911
+ repo,
1912
+ release_id: releaseId
1913
+ });
1914
+ return {
1915
+ id: data.id,
1916
+ tagName: data.tag_name,
1917
+ name: data.name,
1918
+ body: applyDetailBody(data.body, detail),
1919
+ draft: data.draft,
1920
+ prerelease: data.prerelease,
1921
+ url: data.html_url,
1922
+ author: data.author?.login,
1923
+ createdAt: data.created_at,
1924
+ publishedAt: data.published_at,
1925
+ assets: data.assets.map((asset) => ({
1926
+ name: asset.name,
1927
+ downloadUrl: asset.browser_download_url,
1928
+ size: asset.size,
1929
+ downloadCount: asset.download_count
1930
+ }))
1931
+ };
1932
+ }
1933
+ const createReleaseInputSchema = z.object({
1934
+ owner: z.string().describe("Repository owner"),
1935
+ repo: z.string().describe("Repository name"),
1936
+ tagName: z.string().describe("Tag name for the release (created from target if it does not exist)"),
1937
+ target: z.string().optional().describe("Branch name or commit SHA to tag (defaults to the default branch)"),
1938
+ name: z.string().optional().describe("Release title (defaults to the tag name)"),
1939
+ body: z.string().optional().describe("Release notes (supports Markdown)"),
1940
+ draft: z.boolean().optional().default(false).describe("Create as a draft release"),
1941
+ prerelease: z.boolean().optional().default(false).describe("Mark as a prerelease"),
1942
+ generateReleaseNotes: z.boolean().optional().default(false).describe("Auto-generate release notes from merged pull requests since the last release")
1943
+ });
1944
+ const createReleaseDescription = "Create a new release (and its tag if needed) in a GitHub repository";
1945
+ /** Not idempotent — creating a release with an existing tag name returns an error from GitHub. */
1946
+ async function createReleaseCore({ token, owner, repo, tagName, target, name, body, draft, prerelease, generateReleaseNotes }) {
1947
+ const { data } = await createOctokit(token).rest.repos.createRelease({
1948
+ owner,
1949
+ repo,
1950
+ tag_name: tagName,
1951
+ target_commitish: target,
1952
+ name,
1953
+ body,
1954
+ draft,
1955
+ prerelease,
1956
+ generate_release_notes: generateReleaseNotes
1957
+ });
1958
+ return {
1959
+ id: data.id,
1960
+ tagName: data.tag_name,
1961
+ name: data.name,
1962
+ body: data.body,
1963
+ url: data.html_url,
1964
+ draft: data.draft,
1965
+ prerelease: data.prerelease,
1966
+ createdAt: data.created_at
1967
+ };
1968
+ }
1969
+ //#endregion
1970
+ //#region src/core/bundles.ts
1971
+ const getPullRequestContextInputSchema = z.object({
1972
+ owner: z.string().describe("Repository owner"),
1973
+ repo: z.string().describe("Repository name"),
1974
+ pullNumber: z.number().describe("Pull request number"),
1975
+ includeFiles: z.boolean().optional().default(true).describe("Include changed files metadata"),
1976
+ includeReviews: z.boolean().optional().default(true).describe("Include existing reviews"),
1977
+ includeChecks: z.boolean().optional().default(false).describe("Include check runs and combined status for the PR head SHA"),
1978
+ includePatch: z.boolean().optional().default(false).describe("Include diff patches in files (token-heavy; prefer false then fetch specific files with listPullRequestFiles)"),
1979
+ filesPerPage: z.number().optional().default(100).describe("Max files to return when includeFiles is true (max 100)"),
1980
+ detail: detailSchema
1981
+ });
1982
+ const getPullRequestContextDescription = "Fetch pull request details plus files, reviews, and optional CI checks in one call — prefer this over separate getPullRequest / listPullRequestFiles / listPullRequestReviews calls";
1983
+ async function getPullRequestContextCore({ token, owner, repo, pullNumber, includeFiles, includeReviews, includeChecks, includePatch, filesPerPage, detail = "summary" }) {
1984
+ const pullRequest = await getPullRequestCore({
1985
+ token,
1986
+ owner,
1987
+ repo,
1988
+ pullNumber,
1989
+ detail
1990
+ });
1991
+ const [files, reviews, checks] = await Promise.all([
1992
+ includeFiles ? listPullRequestFilesCore({
1993
+ token,
1994
+ owner,
1995
+ repo,
1996
+ pullNumber,
1997
+ includePatch,
1998
+ perPage: filesPerPage,
1999
+ page: 1
2000
+ }) : Promise.resolve(void 0),
2001
+ includeReviews ? listPullRequestReviewsCore({
2002
+ token,
2003
+ owner,
2004
+ repo,
2005
+ pullNumber,
2006
+ perPage: 30,
2007
+ page: 1
2008
+ }) : Promise.resolve(void 0),
2009
+ includeChecks ? Promise.all([listCheckRunsCore({
2010
+ token,
2011
+ owner,
2012
+ repo,
2013
+ ref: pullRequest.headSha,
2014
+ perPage: 100,
2015
+ maxPages: 1
2016
+ }), getCombinedStatusCore({
2017
+ token,
2018
+ owner,
2019
+ repo,
2020
+ ref: pullRequest.headSha
2021
+ })]).then(([checkRuns, combinedStatus]) => ({
2022
+ checkRuns,
2023
+ combinedStatus
2024
+ })) : Promise.resolve(void 0)
2025
+ ]);
2026
+ return {
2027
+ pullRequest,
2028
+ ...files !== void 0 ? { files } : {},
2029
+ ...reviews !== void 0 ? { reviews } : {},
2030
+ ...checks !== void 0 ? { checks } : {}
2031
+ };
2032
+ }
2033
+ const getIssueContextInputSchema = z.object({
2034
+ owner: z.string().describe("Repository owner"),
2035
+ repo: z.string().describe("Repository name"),
2036
+ issueNumber: z.number().describe("Issue number"),
2037
+ includeLabels: z.boolean().optional().default(true).describe("Include available repository labels for triage"),
2038
+ includeComments: z.boolean().optional().default(true).describe("Include recent issue comments"),
2039
+ maxComments: z.number().optional().default(20).describe("Max recent comments to include"),
2040
+ detail: detailSchema
2041
+ });
2042
+ const getIssueContextDescription = "Fetch an issue plus available labels and recent comments in one call — prefer this over separate getIssue / listLabels / comment calls when triaging";
2043
+ async function getIssueContextCore({ token, owner, repo, issueNumber, includeLabels, includeComments, maxComments, detail = "summary" }) {
2044
+ const [issue, labels, comments] = await Promise.all([
2045
+ getIssueCore({
2046
+ token,
2047
+ owner,
2048
+ repo,
2049
+ issueNumber,
2050
+ detail
2051
+ }),
2052
+ includeLabels ? listLabelsCore({
2053
+ token,
2054
+ owner,
2055
+ repo,
2056
+ perPage: 100,
2057
+ page: 1
2058
+ }) : Promise.resolve(void 0),
2059
+ includeComments ? listIssueCommentsCore({
2060
+ token,
2061
+ owner,
2062
+ repo,
2063
+ issueNumber,
2064
+ perPage: maxComments,
2065
+ page: 1,
2066
+ detail
2067
+ }) : Promise.resolve(void 0)
2068
+ ]);
2069
+ return {
2070
+ issue,
2071
+ ...labels !== void 0 ? { labels } : {},
2072
+ ...comments !== void 0 ? { comments } : {}
2073
+ };
2074
+ }
2075
+ const getReleaseContextInputSchema = z.object({
2076
+ owner: z.string().describe("Repository owner"),
2077
+ repo: z.string().describe("Repository name"),
2078
+ releaseId: z.number().optional().describe("Release ID — omit to use the latest published release"),
2079
+ includePrevious: z.boolean().optional().default(true).describe("Include the previous release for comparison"),
2080
+ includeCompare: z.boolean().optional().default(true).describe("Include a compare between the previous and current release tags"),
2081
+ detail: detailSchema
2082
+ });
2083
+ const getReleaseContextDescription = "Fetch a release (latest or by ID) plus the previous release and tag comparison in one call — prefer this when preparing or reviewing a release";
2084
+ async function getReleaseContextCore({ token, owner, repo, releaseId, includePrevious, includeCompare, detail = "summary" }) {
2085
+ const release = releaseId != null ? await getReleaseCore({
2086
+ token,
2087
+ owner,
2088
+ repo,
2089
+ releaseId,
2090
+ detail
2091
+ }) : await getLatestReleaseCore({
2092
+ token,
2093
+ owner,
2094
+ repo,
2095
+ detail
2096
+ });
2097
+ let previous;
2098
+ if (includePrevious || includeCompare) previous = (await listReleasesCore({
2099
+ token,
2100
+ owner,
2101
+ repo,
2102
+ perPage: 10,
2103
+ maxPages: 1,
2104
+ detail
2105
+ })).find((r) => r.id !== release.id && !r.draft);
2106
+ let comparison;
2107
+ if (includeCompare && previous) comparison = await compareCommitsCore({
2108
+ token,
2109
+ owner,
2110
+ repo,
2111
+ base: previous.tagName,
2112
+ head: release.tagName,
2113
+ includePatch: false
2114
+ });
2115
+ return {
2116
+ release,
2117
+ ...previous !== void 0 ? { previousRelease: previous } : {},
2118
+ ...comparison !== void 0 ? { comparison } : {}
2119
+ };
2120
+ }
2121
+ const getCiFailureContextInputSchema = z.object({
2122
+ owner: z.string().describe("Repository owner"),
2123
+ repo: z.string().describe("Repository name"),
2124
+ ref: z.string().describe("Branch, tag, or commit SHA to inspect"),
2125
+ maxFailedRuns: z.number().optional().default(5).describe("Max recent failed workflow runs to include"),
2126
+ maxFailedJobs: z.number().optional().default(10).describe("Max failed jobs (with failed steps) from the latest failed run")
2127
+ });
2128
+ const getCiFailureContextDescription = "Diagnose CI failures for a ref in one call — combined status, failing check runs, recent failed workflow runs, and failed jobs/steps from the latest failure";
2129
+ const FAILURE_CONCLUSIONS = /* @__PURE__ */ new Set([
2130
+ "failure",
2131
+ "timed_out",
2132
+ "action_required",
2133
+ "cancelled",
2134
+ "startup_failure"
2135
+ ]);
2136
+ async function getCiFailureContextCore({ token, owner, repo, ref, maxFailedRuns, maxFailedJobs }) {
2137
+ const [combinedStatus, checkRunsResult, failedRuns] = await Promise.all([
2138
+ getCombinedStatusCore({
2139
+ token,
2140
+ owner,
2141
+ repo,
2142
+ ref
2143
+ }),
2144
+ listCheckRunsCore({
2145
+ token,
2146
+ owner,
2147
+ repo,
2148
+ ref,
2149
+ perPage: 100,
2150
+ maxPages: 1
2151
+ }),
2152
+ listWorkflowRunsCore({
2153
+ token,
2154
+ owner,
2155
+ repo,
2156
+ branch: ref,
2157
+ status: "failure",
2158
+ perPage: maxFailedRuns,
2159
+ page: 1,
2160
+ maxPages: 1
2161
+ })
2162
+ ]);
2163
+ const failedCheckRuns = checkRunsResult.checkRuns.filter((run) => run.conclusion != null && FAILURE_CONCLUSIONS.has(run.conclusion));
2164
+ const latestFailedRun = failedRuns.runs[0];
2165
+ let latestFailure;
2166
+ if (latestFailedRun) latestFailure = {
2167
+ run: latestFailedRun,
2168
+ jobs: (await listWorkflowJobsCore({
2169
+ token,
2170
+ owner,
2171
+ repo,
2172
+ runId: latestFailedRun.id,
2173
+ filter: "latest",
2174
+ perPage: 100,
2175
+ page: 1
2176
+ })).jobs.filter((job) => job.conclusion != null && FAILURE_CONCLUSIONS.has(job.conclusion)).slice(0, maxFailedJobs).map((job) => ({
2177
+ id: job.id,
2178
+ name: job.name,
2179
+ status: job.status,
2180
+ conclusion: job.conclusion,
2181
+ url: job.url,
2182
+ startedAt: job.startedAt,
2183
+ completedAt: job.completedAt,
2184
+ steps: job.steps?.filter((step) => step.conclusion != null && FAILURE_CONCLUSIONS.has(step.conclusion))
2185
+ }))
2186
+ };
2187
+ return {
2188
+ ref,
2189
+ combinedStatus,
2190
+ failedCheckRuns,
2191
+ checkRunTotalCount: checkRunsResult.totalCount,
2192
+ recentFailedRuns: failedRuns.runs,
2193
+ ...latestFailure !== void 0 ? { latestFailure } : {}
2194
+ };
2195
+ }
2196
+ //#endregion
2197
+ //#region src/core/context.ts
2198
+ const CONTEXT_KEYS = [
2199
+ "owner",
2200
+ "repo",
2201
+ "pullNumber",
2202
+ "issueNumber",
2203
+ "ref"
2204
+ ];
2205
+ function hasContextValues(context) {
2206
+ return CONTEXT_KEYS.some((key) => context[key] !== void 0);
2207
+ }
2208
+ /**
2209
+ * Format a short system-prompt block describing the working context.
2210
+ * Returns an empty string when no context fields are set.
2211
+ */
2212
+ function formatContextInstructions(context) {
2213
+ if (!hasContextValues(context)) return "";
2214
+ const parts = [];
2215
+ if (context.owner && context.repo) parts.push(`repository ${context.owner}/${context.repo}`);
2216
+ else if (context.owner) parts.push(`owner ${context.owner}`);
2217
+ else if (context.repo) parts.push(`repository ${context.repo}`);
2218
+ if (context.pullNumber != null) parts.push(`pull request #${context.pullNumber}`);
2219
+ if (context.issueNumber != null) parts.push(`issue #${context.issueNumber}`);
2220
+ if (context.ref) parts.push(`ref ${context.ref}`);
2221
+ return `Working context: ${parts.join(", ")}. Prefer these values when calling tools — omit owner, repo, pullNumber, issueNumber, or ref when they match this context.`;
2222
+ }
2223
+ /**
2224
+ * Fill missing context fields on tool args from {@link GithubToolsContext}.
2225
+ * Explicit args always win over context defaults.
2226
+ */
2227
+ function mergeContextArgs(args, context) {
2228
+ const merged = { ...args };
2229
+ for (const key of CONTEXT_KEYS) if (merged[key] === void 0 && context[key] !== void 0) merged[key] = context[key];
2230
+ return merged;
2231
+ }
2232
+ function withContextDefault(field, value) {
2233
+ if (field instanceof z.ZodDefault) return withContextDefault(field.def.innerType, value);
2234
+ if (field instanceof z.ZodOptional) return withContextDefault(field.unwrap(), value);
2235
+ return field.default(value);
2236
+ }
2237
+ /**
2238
+ * Soften matching context fields on a Zod object schema so the model may omit them.
2239
+ * Fields present in `context` get a Zod `.default(value)`.
2240
+ */
2241
+ function softenContextSchema(schema, context) {
2242
+ if (!(schema instanceof z.ZodObject)) return schema;
2243
+ const shape = schema.shape;
2244
+ let changed = false;
2245
+ const nextShape = { ...shape };
2246
+ for (const key of CONTEXT_KEYS) {
2247
+ const value = context[key];
2248
+ if (value === void 0 || !(key in shape)) continue;
2249
+ nextShape[key] = withContextDefault(shape[key], value);
2250
+ changed = true;
2251
+ }
2252
+ return changed ? z.object(nextShape) : schema;
2253
+ }
2254
+ /**
2255
+ * Bind {@link GithubToolsContext} defaults onto a tool: softens matching input
2256
+ * fields and merges context into execute args when the model omits them.
2257
+ */
2258
+ function bindToolContext(tool, context) {
2259
+ if (!hasContextValues(context) || !tool.inputSchema) return tool;
2260
+ const inputSchema = softenContextSchema(tool.inputSchema, context);
2261
+ const originalExecute = tool.execute;
2262
+ if (!originalExecute) return {
2263
+ ...tool,
2264
+ inputSchema
2265
+ };
2266
+ return {
2267
+ ...tool,
2268
+ inputSchema,
2269
+ execute: async (args, options) => originalExecute(mergeContextArgs(args, context), options)
2270
+ };
2271
+ }
2272
+ /**
2273
+ * Apply {@link GithubToolsContext} to every tool in a set.
2274
+ */
2275
+ function bindToolsContext(tools, context) {
2276
+ if (!context || !hasContextValues(context)) return tools;
2277
+ const bound = {};
2278
+ for (const [name, tool] of Object.entries(tools)) bound[name] = bindToolContext(tool, context);
2279
+ return bound;
2280
+ }
2281
+ //#endregion
1524
2282
  //#region src/core/presets.ts
1525
2283
  /**
1526
2284
  * Predefined tool presets for common use cases.
@@ -1531,9 +2289,9 @@ const PRESET_TOOLS = {
1531
2289
  /**
1532
2290
  * **Code review** — review pull requests and submit feedback.
1533
2291
  *
1534
- * Tools: `getPullRequest`, `listPullRequests`, `listPullRequestFiles`, `listPullRequestReviews`,
1535
- * `getFileContent`, `listCommits`, `getCommit`, `getBlame`, `getRepository`, `listBranches`,
1536
- * `searchCode`, `addPullRequestComment`, `createPullRequestReview`.
2292
+ * Tools: `getPullRequest`, `listPullRequests`, `listPullRequestFiles`, `listPullRequestReviews`, `getPullRequestContext`,
2293
+ * `getFileContent`, `listCommits`, `getCommit`, `getBlame`, `compareCommits`, `getRepository`, `listBranches`,
2294
+ * `searchCode`, `listCheckRuns`, `getCombinedStatus`, `addPullRequestComment`, `createPullRequestReview`, `requestReviewers`.
1537
2295
  *
1538
2296
  * Agent prompt: optimized for thorough PR review with inline feedback.
1539
2297
  */
@@ -1542,33 +2300,41 @@ const PRESET_TOOLS = {
1542
2300
  "listPullRequests",
1543
2301
  "listPullRequestFiles",
1544
2302
  "listPullRequestReviews",
2303
+ "getPullRequestContext",
1545
2304
  "getFileContent",
1546
2305
  "listCommits",
1547
2306
  "getCommit",
1548
2307
  "getBlame",
2308
+ "compareCommits",
1549
2309
  "getRepository",
1550
2310
  "listBranches",
1551
2311
  "searchCode",
2312
+ "listCheckRuns",
2313
+ "getCombinedStatus",
1552
2314
  "addPullRequestComment",
1553
- "createPullRequestReview"
2315
+ "createPullRequestReview",
2316
+ "requestReviewers"
1554
2317
  ],
1555
2318
  /**
1556
2319
  * **Issue triage** — manage and organize GitHub issues.
1557
2320
  *
1558
- * Tools: `listIssues`, `getIssue`, `createIssue`, `addIssueComment`, `closeIssue`,
1559
- * `listLabels`, `addLabels`, `removeLabel`, `getRepository`, `searchRepositories`, `searchCode`.
2321
+ * Tools: `listIssues`, `getIssue`, `getIssueContext`, `createIssue`, `addIssueComment`, `closeIssue`,
2322
+ * `listLabels`, `addLabels`, `removeLabel`, `addAssignees`, `removeAssignees`, `getRepository`, `searchRepositories`, `searchCode`.
1560
2323
  *
1561
2324
  * Agent prompt: optimized for categorizing, labeling, and responding to issues.
1562
2325
  */
1563
2326
  "issue-triage": [
1564
2327
  "listIssues",
1565
2328
  "getIssue",
2329
+ "getIssueContext",
1566
2330
  "createIssue",
1567
2331
  "addIssueComment",
1568
2332
  "closeIssue",
1569
2333
  "listLabels",
1570
2334
  "addLabels",
1571
2335
  "removeLabel",
2336
+ "addAssignees",
2337
+ "removeAssignees",
1572
2338
  "getRepository",
1573
2339
  "searchRepositories",
1574
2340
  "searchCode"
@@ -1577,7 +2343,7 @@ const PRESET_TOOLS = {
1577
2343
  * **CI operations** — monitor and manage GitHub Actions workflows.
1578
2344
  *
1579
2345
  * Tools: `getRepository`, `listBranches`, `listCommits`, `getCommit`,
1580
- * `listWorkflows`, `listWorkflowRuns`, `getWorkflowRun`, `listWorkflowJobs`,
2346
+ * `listWorkflows`, `listWorkflowRuns`, `getWorkflowRun`, `listWorkflowJobs`, `listCheckRuns`, `getCombinedStatus`, `getCiFailureContext`,
1581
2347
  * `triggerWorkflow`, `cancelWorkflowRun`, `rerunWorkflowRun`.
1582
2348
  *
1583
2349
  * Agent prompt: optimized for diagnosing CI failures and managing workflow runs.
@@ -1591,6 +2357,9 @@ const PRESET_TOOLS = {
1591
2357
  "listWorkflowRuns",
1592
2358
  "getWorkflowRun",
1593
2359
  "listWorkflowJobs",
2360
+ "listCheckRuns",
2361
+ "getCombinedStatus",
2362
+ "getCiFailureContext",
1594
2363
  "triggerWorkflow",
1595
2364
  "cancelWorkflowRun",
1596
2365
  "rerunWorkflowRun"
@@ -1598,8 +2367,8 @@ const PRESET_TOOLS = {
1598
2367
  /**
1599
2368
  * **Repository explorer** — read-only access to browse codebases.
1600
2369
  *
1601
- * Tools: all read-only tools including repos, branches, PRs, issues, commits, blame,
1602
- * search, gists, and workflows. No write operations.
2370
+ * Tools: all read-only tools including repos, branches, PRs, issues, commits, blame, comparisons,
2371
+ * search, gists, workflows, checks, and releases. No write operations.
1603
2372
  *
1604
2373
  * Agent prompt: optimized for answering questions about code structure and history.
1605
2374
  */
@@ -1607,16 +2376,20 @@ const PRESET_TOOLS = {
1607
2376
  "getRepository",
1608
2377
  "listBranches",
1609
2378
  "getFileContent",
2379
+ "getRepositoryTree",
1610
2380
  "listPullRequests",
1611
2381
  "getPullRequest",
1612
2382
  "listPullRequestFiles",
1613
2383
  "listPullRequestReviews",
2384
+ "getPullRequestContext",
1614
2385
  "listIssues",
1615
2386
  "getIssue",
2387
+ "getIssueContext",
1616
2388
  "listLabels",
1617
2389
  "listCommits",
1618
2390
  "getCommit",
1619
2391
  "getBlame",
2392
+ "compareCommits",
1620
2393
  "searchCode",
1621
2394
  "searchRepositories",
1622
2395
  "listGists",
@@ -1625,12 +2398,88 @@ const PRESET_TOOLS = {
1625
2398
  "listWorkflows",
1626
2399
  "listWorkflowRuns",
1627
2400
  "getWorkflowRun",
1628
- "listWorkflowJobs"
2401
+ "listWorkflowJobs",
2402
+ "listCheckRuns",
2403
+ "getCombinedStatus",
2404
+ "getCiFailureContext",
2405
+ "listReleases",
2406
+ "getLatestRelease",
2407
+ "getRelease",
2408
+ "getReleaseContext"
2409
+ ],
2410
+ /**
2411
+ * **Security audit** — review repositories for security risks and report findings.
2412
+ *
2413
+ * Tools: read-only exploration (`getFileContent`, `getRepositoryTree`, `searchCode`, `listCommits`, `getCommit`,
2414
+ * `getBlame`, `compareCommits`), PR and CI visibility (`listPullRequests`, `getPullRequest`, `listPullRequestFiles`,
2415
+ * `getPullRequestContext`, `listCheckRuns`, `getCombinedStatus`, `getCiFailureContext`, `listWorkflows`, `listWorkflowRuns`,
2416
+ * `getWorkflowRun`, `listWorkflowJobs`), plus `createIssue`, `addIssueComment`, and `addLabels` to report findings.
2417
+ * No destructive writes.
2418
+ *
2419
+ * Agent prompt: optimized for finding and reporting security risks without making changes.
2420
+ */
2421
+ "security-audit": [
2422
+ "getRepository",
2423
+ "listBranches",
2424
+ "getFileContent",
2425
+ "getRepositoryTree",
2426
+ "listCommits",
2427
+ "getCommit",
2428
+ "getBlame",
2429
+ "compareCommits",
2430
+ "searchCode",
2431
+ "searchRepositories",
2432
+ "listPullRequests",
2433
+ "getPullRequest",
2434
+ "listPullRequestFiles",
2435
+ "getPullRequestContext",
2436
+ "listCheckRuns",
2437
+ "getCombinedStatus",
2438
+ "getCiFailureContext",
2439
+ "listWorkflows",
2440
+ "listWorkflowRuns",
2441
+ "getWorkflowRun",
2442
+ "listWorkflowJobs",
2443
+ "listIssues",
2444
+ "getIssue",
2445
+ "getIssueContext",
2446
+ "createIssue",
2447
+ "addIssueComment",
2448
+ "addLabels"
2449
+ ],
2450
+ /**
2451
+ * **Release manager** — prepare and publish GitHub releases.
2452
+ *
2453
+ * Tools: `getRepository`, `listBranches`, `listCommits`, `getCommit`, `compareCommits`,
2454
+ * `listReleases`, `getLatestRelease`, `getRelease`, `getReleaseContext`, `createRelease`,
2455
+ * `listWorkflows`, `listWorkflowRuns`, `getWorkflowRun`, `listWorkflowJobs`, `triggerWorkflow`,
2456
+ * `listPullRequests`, `getPullRequest`.
2457
+ *
2458
+ * Agent prompt: optimized for summarizing changes and cutting releases safely.
2459
+ */
2460
+ "release-manager": [
2461
+ "getRepository",
2462
+ "listBranches",
2463
+ "listCommits",
2464
+ "getCommit",
2465
+ "compareCommits",
2466
+ "listReleases",
2467
+ "getLatestRelease",
2468
+ "getRelease",
2469
+ "getReleaseContext",
2470
+ "createRelease",
2471
+ "listWorkflows",
2472
+ "listWorkflowRuns",
2473
+ "getWorkflowRun",
2474
+ "listWorkflowJobs",
2475
+ "triggerWorkflow",
2476
+ "listPullRequests",
2477
+ "getPullRequest"
1629
2478
  ],
1630
2479
  /**
1631
2480
  * **Maintainer** — full repository maintenance with all read and write tools.
1632
2481
  *
1633
- * Tools: all 42 tools (same as omitting `preset`).
2482
+ * Tools: all tools (same as omitting `preset`).
1634
2483
  *
1635
2484
  * Agent prompt: optimized for day-to-day repo maintenance with careful write operations.
1636
2485
  */
@@ -1638,6 +2487,7 @@ const PRESET_TOOLS = {
1638
2487
  "getRepository",
1639
2488
  "listBranches",
1640
2489
  "getFileContent",
2490
+ "getRepositoryTree",
1641
2491
  "createBranch",
1642
2492
  "forkRepository",
1643
2493
  "createRepository",
@@ -1646,21 +2496,27 @@ const PRESET_TOOLS = {
1646
2496
  "getPullRequest",
1647
2497
  "listPullRequestFiles",
1648
2498
  "listPullRequestReviews",
2499
+ "getPullRequestContext",
1649
2500
  "createPullRequest",
1650
2501
  "mergePullRequest",
1651
2502
  "addPullRequestComment",
1652
2503
  "createPullRequestReview",
2504
+ "requestReviewers",
1653
2505
  "listIssues",
1654
2506
  "getIssue",
2507
+ "getIssueContext",
1655
2508
  "createIssue",
1656
2509
  "addIssueComment",
1657
2510
  "closeIssue",
1658
2511
  "listLabels",
1659
2512
  "addLabels",
1660
2513
  "removeLabel",
2514
+ "addAssignees",
2515
+ "removeAssignees",
1661
2516
  "listCommits",
1662
2517
  "getCommit",
1663
2518
  "getBlame",
2519
+ "compareCommits",
1664
2520
  "searchCode",
1665
2521
  "searchRepositories",
1666
2522
  "listGists",
@@ -1676,7 +2532,15 @@ const PRESET_TOOLS = {
1676
2532
  "listWorkflowJobs",
1677
2533
  "triggerWorkflow",
1678
2534
  "cancelWorkflowRun",
1679
- "rerunWorkflowRun"
2535
+ "rerunWorkflowRun",
2536
+ "listCheckRuns",
2537
+ "getCombinedStatus",
2538
+ "getCiFailureContext",
2539
+ "listReleases",
2540
+ "getLatestRelease",
2541
+ "getRelease",
2542
+ "getReleaseContext",
2543
+ "createRelease"
1680
2544
  ]
1681
2545
  };
1682
2546
  /**
@@ -1703,8 +2567,10 @@ const GITHUB_TOOL_NAMES = {
1703
2567
  getRepository: "getRepository",
1704
2568
  /** List branches in a GitHub repository. */
1705
2569
  listBranches: "listBranches",
1706
- /** Get the content of a file from a GitHub repository. */
2570
+ /** Get the content of a file from a GitHub repository. Prefer startLine/endLine or maxLines for large files. */
1707
2571
  getFileContent: "getFileContent",
2572
+ /** List the file and directory structure of a repository at a given ref. */
2573
+ getRepositoryTree: "getRepositoryTree",
1708
2574
  /** Create a new branch in a GitHub repository from an existing branch or commit SHA. Requires approval by default. */
1709
2575
  createBranch: "createBranch",
1710
2576
  /** Fork a GitHub repository to the authenticated user account or a specified organization. Requires approval by default. */
@@ -1715,7 +2581,7 @@ const GITHUB_TOOL_NAMES = {
1715
2581
  createOrUpdateFile: "createOrUpdateFile",
1716
2582
  /** List pull requests for a GitHub repository. */
1717
2583
  listPullRequests: "listPullRequests",
1718
- /** Get detailed information about a specific pull request. */
2584
+ /** Get detailed information about a specific pull request. Body truncated by default (detail: summary). */
1719
2585
  getPullRequest: "getPullRequest",
1720
2586
  /** Create a new pull request in a GitHub repository. Requires approval by default. */
1721
2587
  createPullRequest: "createPullRequest",
@@ -1723,16 +2589,22 @@ const GITHUB_TOOL_NAMES = {
1723
2589
  mergePullRequest: "mergePullRequest",
1724
2590
  /** Add a comment to a pull request. Requires approval by default. */
1725
2591
  addPullRequestComment: "addPullRequestComment",
1726
- /** List files changed in a pull request, including diff status and patch content. */
2592
+ /** List files changed in a pull request with status and stats. Patches omitted by default — set includePatch true for diffs. */
1727
2593
  listPullRequestFiles: "listPullRequestFiles",
1728
2594
  /** List reviews on a pull request (approvals, change requests, and comments). */
1729
2595
  listPullRequestReviews: "listPullRequestReviews",
1730
2596
  /** Submit a pull request review — approve, request changes, or comment with optional inline comments on specific lines. Requires approval by default. */
1731
2597
  createPullRequestReview: "createPullRequestReview",
2598
+ /** Request reviews from users or teams on a pull request. Requires approval by default. */
2599
+ requestReviewers: "requestReviewers",
2600
+ /** Fetch pull request details plus files, reviews, and optional CI checks in one call. */
2601
+ getPullRequestContext: "getPullRequestContext",
1732
2602
  /** List issues for a GitHub repository (excludes pull requests). */
1733
2603
  listIssues: "listIssues",
1734
- /** Get detailed information about a specific issue. */
2604
+ /** Get detailed information about a specific issue. Body truncated by default (detail: summary). */
1735
2605
  getIssue: "getIssue",
2606
+ /** Fetch an issue plus available labels and recent comments in one call. */
2607
+ getIssueContext: "getIssueContext",
1736
2608
  /** Create a new issue in a GitHub repository. Requires approval by default. */
1737
2609
  createIssue: "createIssue",
1738
2610
  /** Add a comment to a GitHub issue. Requires approval by default. */
@@ -1745,16 +2617,22 @@ const GITHUB_TOOL_NAMES = {
1745
2617
  addLabels: "addLabels",
1746
2618
  /** Remove a label from an issue or pull request. Requires approval by default. */
1747
2619
  removeLabel: "removeLabel",
2620
+ /** Assign users to an issue or pull request. Requires approval by default. */
2621
+ addAssignees: "addAssignees",
2622
+ /** Remove assignees from an issue or pull request. Requires approval by default. */
2623
+ removeAssignees: "removeAssignees",
1748
2624
  /** Search for code in GitHub repositories. Use qualifiers like "repo:owner/name" to scope the search. */
1749
2625
  searchCode: "searchCode",
1750
2626
  /** Search for GitHub repositories by keyword, topic, language, or other qualifiers. */
1751
2627
  searchRepositories: "searchRepositories",
1752
2628
  /** List commits for a GitHub repository. Filter by file path to see commits that touched a file. For line-by-line attribution at a given ref, use getBlame instead. */
1753
2629
  listCommits: "listCommits",
1754
- /** Get detailed information about a specific commit, including the list of files changed with additions and deletions. */
2630
+ /** Get detailed information about a specific commit, including the list of files changed. Patches omitted by default. */
1755
2631
  getCommit: "getCommit",
1756
2632
  /** Line-level git blame for a file at a commit-like ref (branch, tag, or SHA). Returns contiguous ranges mapping lines to the commits that last modified them. */
1757
2633
  getBlame: "getBlame",
2634
+ /** Compare two branches, tags, or commits — ahead/behind counts, commits in between, and differing files. Patches omitted by default. */
2635
+ compareCommits: "compareCommits",
1758
2636
  /** List gists for the authenticated user or a specific user. */
1759
2637
  listGists: "listGists",
1760
2638
  /** Get a gist by ID, including file contents. */
@@ -1782,7 +2660,23 @@ const GITHUB_TOOL_NAMES = {
1782
2660
  /** Cancel an in-progress workflow run. Requires approval by default. */
1783
2661
  cancelWorkflowRun: "cancelWorkflowRun",
1784
2662
  /** Re-run a workflow run, optionally only the failed jobs. Requires approval by default. */
1785
- rerunWorkflowRun: "rerunWorkflowRun"
2663
+ rerunWorkflowRun: "rerunWorkflowRun",
2664
+ /** List check runs (Checks API — GitHub Actions and other CI providers) for a commit, branch, or tag. */
2665
+ listCheckRuns: "listCheckRuns",
2666
+ /** Get the combined commit status (Statuses API — legacy CI integrations) for a commit, branch, or tag. */
2667
+ getCombinedStatus: "getCombinedStatus",
2668
+ /** Diagnose CI failures for a ref — combined status, failing checks, and failed workflow jobs in one call. */
2669
+ getCiFailureContext: "getCiFailureContext",
2670
+ /** List releases for a GitHub repository, newest first (includes drafts and prereleases). */
2671
+ listReleases: "listReleases",
2672
+ /** Get the latest published release for a GitHub repository (excludes drafts and prereleases). Body truncated by default. */
2673
+ getLatestRelease: "getLatestRelease",
2674
+ /** Get a specific release by ID, including its assets. Body truncated by default. */
2675
+ getRelease: "getRelease",
2676
+ /** Fetch a release plus the previous release and tag comparison in one call. */
2677
+ getReleaseContext: "getReleaseContext",
2678
+ /** Create a new release (and its tag if needed) in a GitHub repository. Requires approval by default. */
2679
+ createRelease: "createRelease"
1786
2680
  };
1787
2681
  const ALL_GITHUB_TOOL_NAMES = Object.values(GITHUB_TOOL_NAMES);
1788
2682
  //#endregion
@@ -1808,6 +2702,8 @@ const GITHUB_WRITE_TOOLS = {
1808
2702
  addPullRequestComment: "addPullRequestComment",
1809
2703
  /** Submit a pull request review with optional inline comments. Requires approval by default. */
1810
2704
  createPullRequestReview: "createPullRequestReview",
2705
+ /** Request reviews from users or teams on a pull request. Requires approval by default. */
2706
+ requestReviewers: "requestReviewers",
1811
2707
  /** Create a new issue in a GitHub repository. Requires approval by default. */
1812
2708
  createIssue: "createIssue",
1813
2709
  /** Add a comment to a GitHub issue. Requires approval by default. */
@@ -1818,6 +2714,10 @@ const GITHUB_WRITE_TOOLS = {
1818
2714
  addLabels: "addLabels",
1819
2715
  /** Remove a label from an issue or pull request. Requires approval by default. */
1820
2716
  removeLabel: "removeLabel",
2717
+ /** Assign users to an issue or pull request. Requires approval by default. */
2718
+ addAssignees: "addAssignees",
2719
+ /** Remove assignees from an issue or pull request. Requires approval by default. */
2720
+ removeAssignees: "removeAssignees",
1821
2721
  /** Create a new gist with one or more files. Requires approval by default. */
1822
2722
  createGist: "createGist",
1823
2723
  /** Update an existing gist. Requires approval by default. */
@@ -1831,10 +2731,12 @@ const GITHUB_WRITE_TOOLS = {
1831
2731
  /** Cancel an in-progress workflow run. Requires approval by default. */
1832
2732
  cancelWorkflowRun: "cancelWorkflowRun",
1833
2733
  /** Re-run a workflow run, optionally only the failed jobs. Requires approval by default. */
1834
- rerunWorkflowRun: "rerunWorkflowRun"
2734
+ rerunWorkflowRun: "rerunWorkflowRun",
2735
+ /** Create a new release (and its tag if needed) in a GitHub repository. Requires approval by default. */
2736
+ createRelease: "createRelease"
1835
2737
  };
1836
2738
  Object.values(GITHUB_WRITE_TOOLS);
1837
2739
  //#endregion
1838
- export { getCommitInputSchema as $, listPullRequestsInputSchema as $t, createGistCore as A, removeLabelCore as At, listGistCommentsDescription as B, createPullRequestReviewDescription as Bt, rerunWorkflowRunInputSchema as C, getRepositoryCore as Cn, getIssueInputSchema as Ct, createGistCommentCore as D, listBranchesDescription as Dn, listLabelsCore as Dt, triggerWorkflowInputSchema as E, listBranchesCore as En, listIssuesInputSchema as Et, deleteGistInputSchema as F, addPullRequestCommentInputSchema as Ft, updateGistCore as G, listPullRequestFilesCore as Gt, listGistsCore as H, getPullRequestCore as Ht, getGistCore as I, createPullRequestCore as It, getBlameCore as J, listPullRequestReviewsCore as Jt, updateGistDescription as K, listPullRequestFilesDescription as Kt, getGistDescription as L, createPullRequestDescription as Lt, createGistInputSchema as M, removeLabelInputSchema as Mt, deleteGistCore as N, addPullRequestCommentCore as Nt, createGistCommentDescription as O, listBranchesInputSchema as On, listLabelsDescription as Ot, deleteGistDescription as P, addPullRequestCommentDescription as Pt, getCommitDescription as Q, listPullRequestsDescription as Qt, getGistInputSchema as R, createPullRequestInputSchema as Rt, rerunWorkflowRunDescription as S, getFileContentInputSchema as Sn, getIssueDescription as St, triggerWorkflowDescription as T, getRepositoryInputSchema as Tn, listIssuesDescription as Tt, listGistsDescription as U, getPullRequestDescription as Ut, listGistCommentsInputSchema as V, createPullRequestReviewInputSchema as Vt, listGistsInputSchema as W, getPullRequestInputSchema as Wt, getBlameInputSchema as X, listPullRequestReviewsInputSchema as Xt, getBlameDescription as Y, listPullRequestReviewsDescription as Yt, getCommitCore as Z, listPullRequestsCore as Zt, listWorkflowRunsInputSchema as _, forkRepositoryCore as _n, closeIssueInputSchema as _t, resolvePresetTools as a, getCommitToModelOutput as an, searchCodeInputSchema as at, listWorkflowsInputSchema as b, getFileContentCore as bn, createIssueInputSchema as bt, cancelWorkflowRunInputSchema as c, createBranchCore as cn, searchRepositoriesInputSchema as ct, getWorkflowRunInputSchema as d, createOrUpdateFileCore as dn, addIssueCommentInputSchema as dt, mergePullRequestCore as en, listCommitsCore as et, listWorkflowJobsCore as f, createOrUpdateFileDescription as fn, addLabelsCore as ft, listWorkflowRunsDescription as g, createRepositoryInputSchema as gn, closeIssueDescription as gt, listWorkflowRunsCore as h, createRepositoryDescription as hn, closeIssueCore as ht, PRESET_TOOLS as i, resolveGithubToken as in, searchCodeDescription as it, createGistDescription as j, removeLabelDescription as jt, createGistCommentInputSchema as k, createOctokit as kn, listLabelsInputSchema as kt, getWorkflowRunCore as l, createBranchDescription as ln, addIssueCommentCore as lt, listWorkflowJobsInputSchema as m, createRepositoryCore as mn, addLabelsInputSchema as mt, ALL_GITHUB_TOOL_NAMES as n, mergePullRequestInputSchema as nn, listCommitsInputSchema as nt, cancelWorkflowRunCore as o, getFileContentToModelOutput as on, searchRepositoriesCore as ot, listWorkflowJobsDescription as p, createOrUpdateFileInputSchema as pn, addLabelsDescription as pt, updateGistInputSchema as q, listPullRequestFilesInputSchema as qt, GITHUB_TOOL_NAMES as r, createGithubTokenResolver as rn, searchCodeCore as rt, cancelWorkflowRunDescription as s, listPullRequestFilesToModelOutput as sn, searchRepositoriesDescription as st, GITHUB_WRITE_TOOLS as t, mergePullRequestDescription as tn, listCommitsDescription as tt, getWorkflowRunDescription as u, createBranchInputSchema as un, addIssueCommentDescription as ut, listWorkflowsCore as v, forkRepositoryDescription as vn, createIssueCore as vt, triggerWorkflowCore as w, getRepositoryDescription as wn, listIssuesCore as wt, rerunWorkflowRunCore as x, getFileContentDescription as xn, getIssueCore as xt, listWorkflowsDescription as y, forkRepositoryInputSchema as yn, createIssueDescription as yt, listGistCommentsCore as z, createPullRequestReviewCore as zt };
2740
+ export { listWorkflowsDescription as $, getFileContentToModelOutput as $n, addLabelsDescription as $t, getReleaseInputSchema as A, createPullRequestReviewInputSchema as An, compareCommitsInputSchema as At, cancelWorkflowRunCore as B, listPullRequestsCore as Bn, searchCodeCore as Bt, createReleaseDescription as C, addPullRequestCommentDescription as Cn, listBranchesCore as Cr, listGistsDescription as Ct, getLatestReleaseInputSchema as D, createPullRequestInputSchema as Dn, updateGistInputSchema as Dt, getLatestReleaseDescription as E, createPullRequestDescription as En, createOctokit as Er, updateGistDescription as Et, getCombinedStatusDescription as F, listPullRequestFilesDescription as Fn, getCommitDescription as Ft, getWorkflowRunInputSchema as G, mergePullRequestInputSchema as Gn, searchRepositoriesInputSchema as Gt, cancelWorkflowRunInputSchema as H, listPullRequestsInputSchema as Hn, searchCodeInputSchema as Ht, getCombinedStatusInputSchema as I, listPullRequestFilesInputSchema as In, getCommitInputSchema as It, listWorkflowJobsInputSchema as J, requestReviewersInputSchema as Jn, addAssigneesInputSchema as Jt, listWorkflowJobsCore as K, requestReviewersCore as Kn, addAssigneesCore as Kt, listCheckRunsCore as L, listPullRequestReviewsCore as Ln, listCommitsCore as Lt, listReleasesDescription as M, getPullRequestDescription as Mn, getBlameDescription as Mt, listReleasesInputSchema as N, getPullRequestInputSchema as Nn, getBlameInputSchema as Nt, getReleaseCore as O, createPullRequestReviewCore as On, compareCommitsCore as Ot, getCombinedStatusCore as P, listPullRequestFilesCore as Pn, getCommitCore as Pt, listWorkflowsCore as Q, getCommitToModelOutput as Qn, addLabelsCore as Qt, listCheckRunsDescription as R, listPullRequestReviewsDescription as Rn, listCommitsDescription as Rt, createReleaseCore as S, addPullRequestCommentCore as Sn, getRepositoryTreeInputSchema as Sr, listGistsCore as St, getLatestReleaseCore as T, createPullRequestCore as Tn, listBranchesInputSchema as Tr, updateGistCore as Tt, getWorkflowRunCore as U, mergePullRequestCore as Un, searchRepositoriesCore as Ut, cancelWorkflowRunDescription as V, listPullRequestsDescription as Vn, searchCodeDescription as Vt, getWorkflowRunDescription as W, mergePullRequestDescription as Wn, searchRepositoriesDescription as Wt, listWorkflowRunsDescription as X, resolveGithubToken as Xn, addIssueCommentDescription as Xt, listWorkflowRunsCore as Y, createGithubTokenResolver as Yn, addIssueCommentCore as Yt, listWorkflowRunsInputSchema as Z, compareCommitsToModelOutput as Zn, addIssueCommentInputSchema as Zt, getPullRequestContextDescription as _, removeAssigneesDescription as _n, getRepositoryCore as _r, getGistDescription as _t, resolvePresetTools as a, createIssueDescription as an, createOrUpdateFileCore as ar, triggerWorkflowDescription as at, getReleaseContextDescription as b, removeLabelDescription as bn, getRepositoryTreeCore as br, listGistCommentsDescription as bt, mergeContextArgs as c, getIssueDescription as cn, createRepositoryCore as cr, createGistCommentDescription as ct, getCiFailureContextDescription as d, listIssuesDescription as dn, forkRepositoryCore as dr, createGistDescription as dt, addLabelsInputSchema as en, getPullRequestContextToModelOutput as er, listWorkflowsInputSchema as et, getCiFailureContextInputSchema as f, listIssuesInputSchema as fn, forkRepositoryDescription as fr, createGistInputSchema as ft, getPullRequestContextCore as g, removeAssigneesCore as gn, getFileContentInputSchema as gr, getGistCore as gt, getIssueContextInputSchema as h, listLabelsInputSchema as hn, getFileContentDescription as hr, deleteGistInputSchema as ht, PRESET_TOOLS as i, createIssueCore as in, createBranchInputSchema as ir, triggerWorkflowCore as it, listReleasesCore as j, getPullRequestCore as jn, getBlameCore as jt, getReleaseDescription as k, createPullRequestReviewDescription as kn, compareCommitsDescription as kt, softenContextSchema as l, getIssueInputSchema as ln, createRepositoryDescription as lr, createGistCommentInputSchema as lt, getIssueContextDescription as m, listLabelsDescription as mn, getFileContentCore as mr, deleteGistDescription as mt, ALL_GITHUB_TOOL_NAMES as n, closeIssueDescription as nn, createBranchCore as nr, rerunWorkflowRunDescription as nt, bindToolsContext as o, createIssueInputSchema as on, createOrUpdateFileDescription as or, triggerWorkflowInputSchema as ot, getIssueContextCore as p, listLabelsCore as pn, forkRepositoryInputSchema as pr, deleteGistCore as pt, listWorkflowJobsDescription as q, requestReviewersDescription as qn, addAssigneesDescription as qt, GITHUB_TOOL_NAMES as r, closeIssueInputSchema as rn, createBranchDescription as rr, rerunWorkflowRunInputSchema as rt, formatContextInstructions as s, getIssueCore as sn, createOrUpdateFileInputSchema as sr, createGistCommentCore as st, GITHUB_WRITE_TOOLS as t, closeIssueCore as tn, listPullRequestFilesToModelOutput as tr, rerunWorkflowRunCore as tt, getCiFailureContextCore as u, listIssuesCore as un, createRepositoryInputSchema as ur, createGistCore as ut, getPullRequestContextInputSchema as v, removeAssigneesInputSchema as vn, getRepositoryDescription as vr, getGistInputSchema as vt, createReleaseInputSchema as w, addPullRequestCommentInputSchema as wn, listBranchesDescription as wr, listGistsInputSchema as wt, getReleaseContextInputSchema as x, removeLabelInputSchema as xn, getRepositoryTreeDescription as xr, listGistCommentsInputSchema as xt, getReleaseContextCore as y, removeLabelCore as yn, getRepositoryInputSchema as yr, listGistCommentsCore as yt, listCheckRunsInputSchema as z, listPullRequestReviewsInputSchema as zn, listCommitsInputSchema as zt };
1839
2741
 
1840
- //# sourceMappingURL=write-tools-Dx9LfYlU.mjs.map
2742
+ //# sourceMappingURL=write-tools-cg_ialNd.mjs.map