@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
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { i as PRESET_TOOLS, in as resolveGithubToken, kn as createOctokit, r as GITHUB_TOOL_NAMES, t as GITHUB_WRITE_TOOLS } from "./write-tools-Dx9LfYlU.mjs";
2
- import { A as removeLabel, B as createOrUpdateFile, C as addIssueComment, D as getIssue, E as createIssue, F as listPullRequestFiles, G as listBranches, H as forkRepository, I as listPullRequestReviews, L as listPullRequests, M as createPullRequest, N as createPullRequestReview, O as listIssues, P as getPullRequest, R as mergePullRequest, S as searchRepositories, T as closeIssue, U as getFileContent, V as createRepository, W as getRepository, _ as updateGist, a as getWorkflowRun, b as listCommits, c as listWorkflows, d as createGist, f as createGistComment, g as listGists, h as listGistComments, i as cancelWorkflowRun, j as addPullRequestComment, k as listLabels, l as rerunWorkflowRun, m as getGist, n as createGithubAgent, o as listWorkflowJobs, p as deleteGist, s as listWorkflowRuns, t as createGithubTools, u as triggerWorkflow, v as getBlame, w as addLabels, x as searchCode, y as getCommit, z as createBranch } from "./src-CfzZfU82.mjs";
3
- export { GITHUB_TOOL_NAMES, GITHUB_WRITE_TOOLS, PRESET_TOOLS, addIssueComment, addLabels, addPullRequestComment, cancelWorkflowRun, closeIssue, createBranch, createGist, createGistComment, createGithubAgent, createGithubTools, createIssue, createOctokit, createOrUpdateFile, createPullRequest, createPullRequestReview, createRepository, deleteGist, forkRepository, getBlame, getCommit, getFileContent, getGist, getIssue, getPullRequest, getRepository, getWorkflowRun, listBranches, listCommits, listGistComments, listGists, listIssues, listLabels, listPullRequestFiles, listPullRequestReviews, listPullRequests, listWorkflowJobs, listWorkflowRuns, listWorkflows, mergePullRequest, removeLabel, rerunWorkflowRun, resolveGithubToken, searchCode, searchRepositories, triggerWorkflow, updateGist };
1
+ import { Er as createOctokit, Xn as resolveGithubToken, i as PRESET_TOOLS, r as GITHUB_TOOL_NAMES, t as GITHUB_WRITE_TOOLS } from "./write-tools-cg_ialNd.mjs";
2
+ import { $ as createBranch, A as getCommit, B as listIssues, C as deleteGist, D as updateGist, E as listGists, F as addIssueComment, G as createPullRequest, H as removeAssignees, I as addLabels, J as listPullRequestFiles, K as createPullRequestReview, L as closeIssue, M as searchCode, N as searchRepositories, O as compareCommits, P as addAssignees, Q as requestReviewers, R as createIssue, S as createGistComment, T as listGistComments, U as removeLabel, V as listLabels, W as addPullRequestComment, X as listPullRequests, Y as listPullRequestReviews, Z as mergePullRequest, _ as listWorkflowRuns, a as getIssueContext, at as getRepositoryTree, b as triggerWorkflow, c as createRelease, d as listReleases, et as createOrUpdateFile, f as getCombinedStatus, g as listWorkflowJobs, h as getWorkflowRun, i as getCiFailureContext, it as getRepository, j as listCommits, k as getBlame, l as getLatestRelease, m as cancelWorkflowRun, n as createGithubAgent, nt as forkRepository, o as getPullRequestContext, ot as listBranches, p as listCheckRuns, q as getPullRequest, rt as getFileContent, s as getReleaseContext, t as createGithubTools, tt as createRepository, u as getRelease, v as listWorkflows, w as getGist, x as createGist, y as rerunWorkflowRun, z as getIssue } from "./src-D6vC3V8r.mjs";
3
+ export { GITHUB_TOOL_NAMES, GITHUB_WRITE_TOOLS, PRESET_TOOLS, addAssignees, addIssueComment, addLabels, addPullRequestComment, cancelWorkflowRun, closeIssue, compareCommits, createBranch, createGist, createGistComment, createGithubAgent, createGithubTools, createIssue, createOctokit, createOrUpdateFile, createPullRequest, createPullRequestReview, createRelease, createRepository, deleteGist, forkRepository, getBlame, getCiFailureContext, getCombinedStatus, getCommit, getFileContent, getGist, getIssue, getIssueContext, getLatestRelease, getPullRequest, getPullRequestContext, getRelease, getReleaseContext, getRepository, getRepositoryTree, getWorkflowRun, listBranches, listCheckRuns, listCommits, listGistComments, listGists, listIssues, listLabels, listPullRequestFiles, listPullRequestReviews, listPullRequests, listReleases, listWorkflowJobs, listWorkflowRuns, listWorkflows, mergePullRequest, removeAssignees, removeLabel, requestReviewers, rerunWorkflowRun, resolveGithubToken, searchCode, searchRepositories, triggerWorkflow, updateGist };
@@ -1,4 +1,4 @@
1
- import { $ as getCommitInputSchema, $t as listPullRequestsInputSchema, A as createGistCore, At as removeLabelCore, B as listGistCommentsDescription, Bt as createPullRequestReviewDescription, C as rerunWorkflowRunInputSchema, Cn as getRepositoryCore, Ct as getIssueInputSchema, D as createGistCommentCore, Dn as listBranchesDescription, Dt as listLabelsCore, E as triggerWorkflowInputSchema, En as listBranchesCore, Et as listIssuesInputSchema, F as deleteGistInputSchema, Ft as addPullRequestCommentInputSchema, G as updateGistCore, Gt as listPullRequestFilesCore, H as listGistsCore, Ht as getPullRequestCore, I as getGistCore, It as createPullRequestCore, J as getBlameCore, Jt as listPullRequestReviewsCore, K as updateGistDescription, Kt as listPullRequestFilesDescription, L as getGistDescription, Lt as createPullRequestDescription, M as createGistInputSchema, Mt as removeLabelInputSchema, N as deleteGistCore, Nt as addPullRequestCommentCore, O as createGistCommentDescription, On as listBranchesInputSchema, Ot as listLabelsDescription, P as deleteGistDescription, Pt as addPullRequestCommentDescription, Q as getCommitDescription, Qt as listPullRequestsDescription, R as getGistInputSchema, Rt as createPullRequestInputSchema, S as rerunWorkflowRunDescription, Sn as getFileContentInputSchema, St as getIssueDescription, T as triggerWorkflowDescription, Tn as getRepositoryInputSchema, Tt as listIssuesDescription, U as listGistsDescription, Ut as getPullRequestDescription, V as listGistCommentsInputSchema, Vt as createPullRequestReviewInputSchema, W as listGistsInputSchema, Wt as getPullRequestInputSchema, X as getBlameInputSchema, Xt as listPullRequestReviewsInputSchema, Y as getBlameDescription, Yt as listPullRequestReviewsDescription, Z as getCommitCore, Zt as listPullRequestsCore, _ as listWorkflowRunsInputSchema, _n as forkRepositoryCore, _t as closeIssueInputSchema, a as resolvePresetTools, an as getCommitToModelOutput, at as searchCodeInputSchema, b as listWorkflowsInputSchema, bn as getFileContentCore, bt as createIssueInputSchema, c as cancelWorkflowRunInputSchema, cn as createBranchCore, ct as searchRepositoriesInputSchema, d as getWorkflowRunInputSchema, dn as createOrUpdateFileCore, dt as addIssueCommentInputSchema, en as mergePullRequestCore, et as listCommitsCore, f as listWorkflowJobsCore, fn as createOrUpdateFileDescription, ft as addLabelsCore, g as listWorkflowRunsDescription, gn as createRepositoryInputSchema, gt as closeIssueDescription, h as listWorkflowRunsCore, hn as createRepositoryDescription, ht as closeIssueCore, in as resolveGithubToken, it as searchCodeDescription, j as createGistDescription, jt as removeLabelDescription, k as createGistCommentInputSchema, kt as listLabelsInputSchema, l as getWorkflowRunCore, ln as createBranchDescription, lt as addIssueCommentCore, m as listWorkflowJobsInputSchema, mn as createRepositoryCore, mt as addLabelsInputSchema, nn as mergePullRequestInputSchema, nt as listCommitsInputSchema, o as cancelWorkflowRunCore, on as getFileContentToModelOutput, ot as searchRepositoriesCore, p as listWorkflowJobsDescription, pn as createOrUpdateFileInputSchema, pt as addLabelsDescription, q as updateGistInputSchema, qt as listPullRequestFilesInputSchema, rn as createGithubTokenResolver, rt as searchCodeCore, s as cancelWorkflowRunDescription, sn as listPullRequestFilesToModelOutput, st as searchRepositoriesDescription, tn as mergePullRequestDescription, tt as listCommitsDescription, u as getWorkflowRunDescription, un as createBranchInputSchema, ut as addIssueCommentDescription, v as listWorkflowsCore, vn as forkRepositoryDescription, vt as createIssueCore, w as triggerWorkflowCore, wn as getRepositoryDescription, wt as listIssuesCore, x as rerunWorkflowRunCore, xn as getFileContentDescription, xt as getIssueCore, y as listWorkflowsDescription, yn as forkRepositoryInputSchema, yt as createIssueDescription, z as listGistCommentsCore, zt as createPullRequestReviewCore } from "./write-tools-Dx9LfYlU.mjs";
1
+ import { $ as listWorkflowsDescription, $n as getFileContentToModelOutput, $t as addLabelsDescription, A as getReleaseInputSchema, An as createPullRequestReviewInputSchema, At as compareCommitsInputSchema, B as cancelWorkflowRunCore, Bn as listPullRequestsCore, Bt as searchCodeCore, C as createReleaseDescription, Cn as addPullRequestCommentDescription, Cr as listBranchesCore, Ct as listGistsDescription, D as getLatestReleaseInputSchema, Dn as createPullRequestInputSchema, Dt as updateGistInputSchema, E as getLatestReleaseDescription, En as createPullRequestDescription, Et as updateGistDescription, F as getCombinedStatusDescription, Fn as listPullRequestFilesDescription, Ft as getCommitDescription, G as getWorkflowRunInputSchema, Gn as mergePullRequestInputSchema, Gt as searchRepositoriesInputSchema, H as cancelWorkflowRunInputSchema, Hn as listPullRequestsInputSchema, Ht as searchCodeInputSchema, I as getCombinedStatusInputSchema, In as listPullRequestFilesInputSchema, It as getCommitInputSchema, J as listWorkflowJobsInputSchema, Jn as requestReviewersInputSchema, Jt as addAssigneesInputSchema, K as listWorkflowJobsCore, Kn as requestReviewersCore, Kt as addAssigneesCore, L as listCheckRunsCore, Ln as listPullRequestReviewsCore, Lt as listCommitsCore, M as listReleasesDescription, Mn as getPullRequestDescription, Mt as getBlameDescription, N as listReleasesInputSchema, Nn as getPullRequestInputSchema, Nt as getBlameInputSchema, O as getReleaseCore, On as createPullRequestReviewCore, Ot as compareCommitsCore, P as getCombinedStatusCore, Pn as listPullRequestFilesCore, Pt as getCommitCore, Q as listWorkflowsCore, Qn as getCommitToModelOutput, Qt as addLabelsCore, R as listCheckRunsDescription, Rn as listPullRequestReviewsDescription, Rt as listCommitsDescription, S as createReleaseCore, Sn as addPullRequestCommentCore, Sr as getRepositoryTreeInputSchema, St as listGistsCore, T as getLatestReleaseCore, Tn as createPullRequestCore, Tr as listBranchesInputSchema, Tt as updateGistCore, U as getWorkflowRunCore, Un as mergePullRequestCore, Ut as searchRepositoriesCore, V as cancelWorkflowRunDescription, Vn as listPullRequestsDescription, Vt as searchCodeDescription, W as getWorkflowRunDescription, Wn as mergePullRequestDescription, Wt as searchRepositoriesDescription, X as listWorkflowRunsDescription, Xn as resolveGithubToken, Xt as addIssueCommentDescription, Y as listWorkflowRunsCore, Yn as createGithubTokenResolver, Yt as addIssueCommentCore, Z as listWorkflowRunsInputSchema, Zn as compareCommitsToModelOutput, Zt as addIssueCommentInputSchema, _ as getPullRequestContextDescription, _n as removeAssigneesDescription, _r as getRepositoryCore, _t as getGistDescription, a as resolvePresetTools, an as createIssueDescription, ar as createOrUpdateFileCore, at as triggerWorkflowDescription, b as getReleaseContextDescription, bn as removeLabelDescription, br as getRepositoryTreeCore, bt as listGistCommentsDescription, cn as getIssueDescription, cr as createRepositoryCore, ct as createGistCommentDescription, d as getCiFailureContextDescription, dn as listIssuesDescription, dr as forkRepositoryCore, dt as createGistDescription, en as addLabelsInputSchema, er as getPullRequestContextToModelOutput, et as listWorkflowsInputSchema, f as getCiFailureContextInputSchema, fn as listIssuesInputSchema, fr as forkRepositoryDescription, ft as createGistInputSchema, g as getPullRequestContextCore, gn as removeAssigneesCore, gr as getFileContentInputSchema, gt as getGistCore, h as getIssueContextInputSchema, hn as listLabelsInputSchema, hr as getFileContentDescription, ht as deleteGistInputSchema, in as createIssueCore, ir as createBranchInputSchema, it as triggerWorkflowCore, j as listReleasesCore, jn as getPullRequestCore, jt as getBlameCore, k as getReleaseDescription, kn as createPullRequestReviewDescription, kt as compareCommitsDescription, ln as getIssueInputSchema, lr as createRepositoryDescription, lt as createGistCommentInputSchema, m as getIssueContextDescription, mn as listLabelsDescription, mr as getFileContentCore, mt as deleteGistDescription, nn as closeIssueDescription, nr as createBranchCore, nt as rerunWorkflowRunDescription, o as bindToolsContext, on as createIssueInputSchema, or as createOrUpdateFileDescription, ot as triggerWorkflowInputSchema, p as getIssueContextCore, pn as listLabelsCore, pr as forkRepositoryInputSchema, pt as deleteGistCore, q as listWorkflowJobsDescription, qn as requestReviewersDescription, qt as addAssigneesDescription, rn as closeIssueInputSchema, rr as createBranchDescription, rt as rerunWorkflowRunInputSchema, s as formatContextInstructions, sn as getIssueCore, sr as createOrUpdateFileInputSchema, st as createGistCommentCore, tn as closeIssueCore, tr as listPullRequestFilesToModelOutput, tt as rerunWorkflowRunCore, u as getCiFailureContextCore, un as listIssuesCore, ur as createRepositoryInputSchema, ut as createGistCore, v as getPullRequestContextInputSchema, vn as removeAssigneesInputSchema, vr as getRepositoryDescription, vt as getGistInputSchema, w as createReleaseInputSchema, wn as addPullRequestCommentInputSchema, wr as listBranchesDescription, wt as listGistsInputSchema, x as getReleaseContextInputSchema, xn as removeLabelInputSchema, xr as getRepositoryTreeDescription, xt as listGistCommentsInputSchema, y as getReleaseContextCore, yn as removeLabelCore, yr as getRepositoryInputSchema, yt as listGistCommentsCore, z as listCheckRunsInputSchema, zn as listPullRequestReviewsInputSchema, zt as listCommitsInputSchema } from "./write-tools-cg_ialNd.mjs";
2
2
  import { ToolLoopAgent, tool } from "ai";
3
3
  //#region src/tools/repository.ts
4
4
  async function getRepositoryStep(args) {
@@ -41,6 +41,19 @@ const getFileContent = (token) => tool({
41
41
  ...args
42
42
  })
43
43
  });
44
+ async function getRepositoryTreeStep(args) {
45
+ "use step";
46
+ return getRepositoryTreeCore(args);
47
+ }
48
+ /** List the file and directory structure of a repository at a given ref. */
49
+ const getRepositoryTree = (token) => tool({
50
+ description: getRepositoryTreeDescription,
51
+ inputSchema: getRepositoryTreeInputSchema,
52
+ execute: async (args) => getRepositoryTreeStep({
53
+ token: await resolveGithubToken(token),
54
+ ...args
55
+ })
56
+ });
44
57
  async function createBranchStep(args) {
45
58
  "use step";
46
59
  return createBranchCore(args);
@@ -175,7 +188,7 @@ async function listPullRequestFilesStep(args) {
175
188
  "use step";
176
189
  return listPullRequestFilesCore(args);
177
190
  }
178
- /** List files changed in a pull request, including diff status and patch content. */
191
+ /** List files changed in a pull request with status and stats. Patches omitted by default. */
179
192
  const listPullRequestFiles = (token) => tool({
180
193
  description: listPullRequestFilesDescription,
181
194
  inputSchema: listPullRequestFilesInputSchema,
@@ -212,6 +225,20 @@ const createPullRequestReview = (token, { needsApproval = true } = {}) => tool({
212
225
  ...args
213
226
  })
214
227
  });
228
+ async function requestReviewersStep(args) {
229
+ "use step";
230
+ return requestReviewersCore(args);
231
+ }
232
+ /** Request reviews from users or teams on a pull request. Requires approval by default. */
233
+ const requestReviewers = (token, { needsApproval = true } = {}) => tool({
234
+ description: requestReviewersDescription,
235
+ needsApproval,
236
+ inputSchema: requestReviewersInputSchema,
237
+ execute: async (args) => requestReviewersStep({
238
+ token: await resolveGithubToken(token),
239
+ ...args
240
+ })
241
+ });
215
242
  //#endregion
216
243
  //#region src/tools/issues.ts
217
244
  async function listIssuesStep(args) {
@@ -323,6 +350,34 @@ const removeLabel = (token, { needsApproval = true } = {}) => tool({
323
350
  ...args
324
351
  })
325
352
  });
353
+ async function addAssigneesStep(args) {
354
+ "use step";
355
+ return addAssigneesCore(args);
356
+ }
357
+ /** Assign users to an issue or pull request. Requires approval by default. */
358
+ const addAssignees = (token, { needsApproval = true } = {}) => tool({
359
+ description: addAssigneesDescription,
360
+ needsApproval,
361
+ inputSchema: addAssigneesInputSchema,
362
+ execute: async (args) => addAssigneesStep({
363
+ token: await resolveGithubToken(token),
364
+ ...args
365
+ })
366
+ });
367
+ async function removeAssigneesStep(args) {
368
+ "use step";
369
+ return removeAssigneesCore(args);
370
+ }
371
+ /** Remove assignees from an issue or pull request. Requires approval by default. */
372
+ const removeAssignees = (token, { needsApproval = true } = {}) => tool({
373
+ description: removeAssigneesDescription,
374
+ needsApproval,
375
+ inputSchema: removeAssigneesInputSchema,
376
+ execute: async (args) => removeAssigneesStep({
377
+ token: await resolveGithubToken(token),
378
+ ...args
379
+ })
380
+ });
326
381
  //#endregion
327
382
  //#region src/tools/search.ts
328
383
  async function searchCodeStep(args) {
@@ -370,7 +425,7 @@ async function getCommitStep(args) {
370
425
  "use step";
371
426
  return getCommitCore(args);
372
427
  }
373
- /** Get detailed information about a specific commit, including files changed with additions and deletions. */
428
+ /** Get detailed information about a specific commit. Patches omitted by default. */
374
429
  const getCommit = (token) => tool({
375
430
  description: getCommitDescription,
376
431
  inputSchema: getCommitInputSchema,
@@ -393,6 +448,20 @@ const getBlame = (token) => tool({
393
448
  ...args
394
449
  })
395
450
  });
451
+ async function compareCommitsStep(args) {
452
+ "use step";
453
+ return compareCommitsCore(args);
454
+ }
455
+ /** Compare two branches, tags, or commits. Patches omitted by default. */
456
+ const compareCommits = (token) => tool({
457
+ description: compareCommitsDescription,
458
+ inputSchema: compareCommitsInputSchema,
459
+ toModelOutput: compareCommitsToModelOutput,
460
+ execute: async (args) => compareCommitsStep({
461
+ token: await resolveGithubToken(token),
462
+ ...args
463
+ })
464
+ });
396
465
  //#endregion
397
466
  //#region src/tools/gists.ts
398
467
  async function listGistsStep(args) {
@@ -587,6 +656,144 @@ const rerunWorkflowRun = (token, { needsApproval = true } = {}) => tool({
587
656
  })
588
657
  });
589
658
  //#endregion
659
+ //#region src/tools/checks.ts
660
+ async function listCheckRunsStep(args) {
661
+ "use step";
662
+ return listCheckRunsCore(args);
663
+ }
664
+ /** List check runs (Checks API — GitHub Actions and other CI providers) for a commit, branch, or tag. */
665
+ const listCheckRuns = (token) => tool({
666
+ description: listCheckRunsDescription,
667
+ inputSchema: listCheckRunsInputSchema,
668
+ execute: async (args) => listCheckRunsStep({
669
+ token: await resolveGithubToken(token),
670
+ ...args
671
+ })
672
+ });
673
+ async function getCombinedStatusStep(args) {
674
+ "use step";
675
+ return getCombinedStatusCore(args);
676
+ }
677
+ /** Get the combined commit status (Statuses API — legacy CI integrations) for a commit, branch, or tag. */
678
+ const getCombinedStatus = (token) => tool({
679
+ description: getCombinedStatusDescription,
680
+ inputSchema: getCombinedStatusInputSchema,
681
+ execute: async (args) => getCombinedStatusStep({
682
+ token: await resolveGithubToken(token),
683
+ ...args
684
+ })
685
+ });
686
+ //#endregion
687
+ //#region src/tools/releases.ts
688
+ async function listReleasesStep(args) {
689
+ "use step";
690
+ return listReleasesCore(args);
691
+ }
692
+ /** List releases for a GitHub repository, newest first (includes drafts and prereleases). */
693
+ const listReleases = (token) => tool({
694
+ description: listReleasesDescription,
695
+ inputSchema: listReleasesInputSchema,
696
+ execute: async (args) => listReleasesStep({
697
+ token: await resolveGithubToken(token),
698
+ ...args
699
+ })
700
+ });
701
+ async function getLatestReleaseStep(args) {
702
+ "use step";
703
+ return getLatestReleaseCore(args);
704
+ }
705
+ /** Get the latest published release for a GitHub repository (excludes drafts and prereleases). */
706
+ const getLatestRelease = (token) => tool({
707
+ description: getLatestReleaseDescription,
708
+ inputSchema: getLatestReleaseInputSchema,
709
+ execute: async (args) => getLatestReleaseStep({
710
+ token: await resolveGithubToken(token),
711
+ ...args
712
+ })
713
+ });
714
+ async function getReleaseStep(args) {
715
+ "use step";
716
+ return getReleaseCore(args);
717
+ }
718
+ /** Get a specific release by ID, including its assets. */
719
+ const getRelease = (token) => tool({
720
+ description: getReleaseDescription,
721
+ inputSchema: getReleaseInputSchema,
722
+ execute: async (args) => getReleaseStep({
723
+ token: await resolveGithubToken(token),
724
+ ...args
725
+ })
726
+ });
727
+ async function createReleaseStep(args) {
728
+ "use step";
729
+ return createReleaseCore(args);
730
+ }
731
+ /** Create a new release (and its tag if needed) in a GitHub repository. Requires approval by default. */
732
+ const createRelease = (token, { needsApproval = true } = {}) => tool({
733
+ description: createReleaseDescription,
734
+ needsApproval,
735
+ inputSchema: createReleaseInputSchema,
736
+ execute: async (args) => createReleaseStep({
737
+ token: await resolveGithubToken(token),
738
+ ...args
739
+ })
740
+ });
741
+ //#endregion
742
+ //#region src/tools/bundles.ts
743
+ async function getPullRequestContextStep(args) {
744
+ "use step";
745
+ return getPullRequestContextCore(args);
746
+ }
747
+ /** Fetch pull request details plus files, reviews, and optional CI checks in one call. */
748
+ const getPullRequestContext = (token) => tool({
749
+ description: getPullRequestContextDescription,
750
+ inputSchema: getPullRequestContextInputSchema,
751
+ toModelOutput: getPullRequestContextToModelOutput,
752
+ execute: async (args) => getPullRequestContextStep({
753
+ token: await resolveGithubToken(token),
754
+ ...args
755
+ })
756
+ });
757
+ async function getIssueContextStep(args) {
758
+ "use step";
759
+ return getIssueContextCore(args);
760
+ }
761
+ /** Fetch an issue plus available labels and recent comments in one call. */
762
+ const getIssueContext = (token) => tool({
763
+ description: getIssueContextDescription,
764
+ inputSchema: getIssueContextInputSchema,
765
+ execute: async (args) => getIssueContextStep({
766
+ token: await resolveGithubToken(token),
767
+ ...args
768
+ })
769
+ });
770
+ async function getReleaseContextStep(args) {
771
+ "use step";
772
+ return getReleaseContextCore(args);
773
+ }
774
+ /** Fetch a release plus the previous release and tag comparison in one call. */
775
+ const getReleaseContext = (token) => tool({
776
+ description: getReleaseContextDescription,
777
+ inputSchema: getReleaseContextInputSchema,
778
+ execute: async (args) => getReleaseContextStep({
779
+ token: await resolveGithubToken(token),
780
+ ...args
781
+ })
782
+ });
783
+ async function getCiFailureContextStep(args) {
784
+ "use step";
785
+ return getCiFailureContextCore(args);
786
+ }
787
+ /** Diagnose CI failures for a ref — combined status, failing checks, and failed workflow jobs. */
788
+ const getCiFailureContext = (token) => tool({
789
+ description: getCiFailureContextDescription,
790
+ inputSchema: getCiFailureContextInputSchema,
791
+ execute: async (args) => getCiFailureContextStep({
792
+ token: await resolveGithubToken(token),
793
+ ...args
794
+ })
795
+ });
796
+ //#endregion
590
797
  //#region src/core/approval.ts
591
798
  /**
592
799
  * Resolve whether a write tool requires approval for the AI SDK.
@@ -604,17 +811,22 @@ function resolveAiSdkApproval(toolName, config) {
604
811
  const SHARED_RULES = `When a tool execution is denied by the user, do not retry it. Briefly acknowledge the decision and move on.`;
605
812
  const DEFAULT_INSTRUCTIONS = `You are a helpful GitHub assistant. You can read and explore repositories, issues, pull requests, commits, code, gists, and workflows. You can also create issues, pull requests, comments, gists, trigger workflows, and update files when asked.
606
813
 
814
+ Prefer getPullRequestContext, getIssueContext, getReleaseContext, or getCiFailureContext when you need a full picture in one step instead of chaining several read tools. Bodies are truncated by default (detail: summary) — set detail full only when you need the complete text. Diff patches are omitted by default — set includePatch true (optionally with filenames) only when you need specific diffs. Prefer getFileContent with startLine/endLine or maxLines for large files. Call independent read tools in parallel in the same step when you already know owner/repo/numbers.
815
+
607
816
  ${SHARED_RULES}`;
608
817
  const PRESET_INSTRUCTIONS = {
609
818
  "code-review": `You are a code review assistant. Your job is to review pull requests thoroughly and provide constructive feedback.
610
819
 
611
820
  When reviewing a PR:
612
- - Read the PR description and changed files carefully
613
- - To trace why a specific line exists or who last touched it, use getBlame on the file path and ref (branch or merge commit), then follow up with getCommit if you need the full patch
821
+ - Prefer getPullRequestContext as the first call (files + reviews in one step). Set includeChecks true when CI status matters
822
+ - Diff patches are omitted by default — after the file list, call listPullRequestFiles with includePatch true and filenames for the files you need to inspect
823
+ - Prefer getFileContent with startLine/endLine or maxLines when inspecting large files
824
+ - Call independent reads in parallel in the same step when you already know owner/repo/pullNumber
825
+ - Bodies are truncated by default (detail: summary) — set detail full only when needed
826
+ - To trace why a specific line exists or who last touched it, use getBlame on the file path and ref (branch or merge commit), then follow up with getCommit if you need the full patch (includePatch true)
614
827
  - Check for bugs, logic errors, and edge cases
615
828
  - Suggest improvements when you spot issues
616
829
  - Be constructive — explain why something is a problem and how to fix it
617
- - Use listPullRequestFiles to see exactly which files changed before diving into details
618
830
  - Use createPullRequestReview to submit a formal review with inline comments on specific lines
619
831
  - Post your review as PR comments when asked
620
832
 
@@ -622,39 +834,69 @@ ${SHARED_RULES}`,
622
834
  "issue-triage": `You are an issue triage assistant. Your job is to help manage and organize GitHub issues.
623
835
 
624
836
  When triaging issues:
837
+ - Prefer getIssueContext as the first call (issue + labels + recent comments in one step)
625
838
  - Read issue descriptions carefully to understand the problem
626
839
  - Identify duplicates when possible
627
840
  - Help categorize and prioritize issues
628
841
  - Respond to users with clear, helpful information
629
- - Use listLabels to see available labels, then addLabels and removeLabel to categorize issues
842
+ - Use addLabels and removeLabel to categorize issues after you know available labels from getIssueContext
630
843
  - Create new issues when asked, with clear titles and descriptions
844
+ - Set detail full only when the truncated body is not enough
631
845
 
632
846
  ${SHARED_RULES}`,
633
847
  "ci-ops": `You are a CI/CD operations assistant. Your job is to help monitor and manage GitHub Actions workflows.
634
848
 
635
849
  When working with workflows:
636
- - Check workflow run status and report failures clearly
850
+ - Prefer getCiFailureContext as the first call when diagnosing a failing ref — it returns combined status, failing checks, and failed jobs/steps together
851
+ - Use listCheckRuns and getCombinedStatus for narrower follow-ups
637
852
  - Inspect job steps to identify exactly where a run failed
638
853
  - Re-run failed workflows when asked
639
854
  - Trigger workflow dispatches with the correct inputs and branch
640
855
  - Be careful with cancel and re-run operations — confirm the target run
641
856
  - Summarize run history and trends when asked
642
857
 
858
+ ${SHARED_RULES}`,
859
+ "security-audit": `You are a security audit assistant. Your job is to review repositories for security risks and report findings clearly — you never make destructive changes.
860
+
861
+ When auditing a repository:
862
+ - Use searchCode to look for hardcoded secrets, unsafe patterns, or known-vulnerable code
863
+ - Use getBlame and listCommits to trace when a risky pattern was introduced and by whom
864
+ - Prefer getCiFailureContext or getPullRequestContext when you need CI / PR context in one step
865
+ - Use listCheckRuns and getCombinedStatus to check the state of security scanning and CI checks on the branch or commit under review
866
+ - Use compareCommits to scope exactly what changed between two refs before flagging new risk (includePatch only when you need diffs)
867
+ - Report findings as issues with clear reproduction steps, impact, and severity, labeled appropriately
868
+ - This preset can only read, create issues, comment, and label — never assume you can fix the code directly
869
+
643
870
  ${SHARED_RULES}`,
644
871
  "repo-explorer": `You are a repository explorer. Your job is to help users understand codebases and find information across GitHub repositories.
645
872
 
646
873
  When exploring repos:
647
874
  - Answer questions about code structure and organization
875
+ - Prefer getPullRequestContext or getCiFailureContext when summarizing a PR or failing CI in one step
648
876
  - Use getBlame when the user asks about history or ownership of specific lines in a file
649
877
  - Summarize recent activity (commits, PRs, issues)
650
878
  - Find specific files, functions, or patterns in code
651
879
  - Explain how different parts of the codebase work together
652
880
  - You have read-only access — you cannot make changes
653
881
 
882
+ ${SHARED_RULES}`,
883
+ "release-manager": `You are a release management assistant. Your job is to help prepare and publish GitHub releases.
884
+
885
+ When preparing a release:
886
+ - Prefer getReleaseContext to load the current (or latest) release, the previous release, and the tag comparison in one step
887
+ - Use compareCommits and listCommits to summarize what changed since the last release when you need more detail
888
+ - Use listReleases and getLatestRelease to determine the next version and avoid duplicate tags
889
+ - Prefer getCiFailureContext when confirming CI health on the target ref
890
+ - Use listWorkflowRuns and getWorkflowRun to confirm CI is green on the target ref before releasing
891
+ - Use triggerWorkflow to kick off release pipelines when the repository automates releases that way
892
+ - Use createRelease with generateReleaseNotes when the repository doesn't maintain a manual changelog
893
+ - Double-check the target branch or commit SHA before creating a release — releases and their tags are hard to undo cleanly
894
+
654
895
  ${SHARED_RULES}`,
655
896
  "maintainer": `You are a repository maintainer assistant. You have full access to manage repositories, issues, pull requests, gists, and workflows.
656
897
 
657
898
  When maintaining repos:
899
+ - Prefer getPullRequestContext or getCiFailureContext for multi-part reads instead of chaining several tools
658
900
  - Be careful with write operations — review before acting
659
901
  - Create well-structured issues and PRs with clear descriptions
660
902
  - Use merge strategies appropriate for the repository
@@ -665,9 +907,13 @@ ${SHARED_RULES}`
665
907
  };
666
908
  function resolveInstructions(options) {
667
909
  const defaultPrompt = options.preset && !Array.isArray(options.preset) ? PRESET_INSTRUCTIONS[options.preset] : DEFAULT_INSTRUCTIONS;
668
- if (options.instructions) return options.instructions;
669
- if (options.additionalInstructions) return `${defaultPrompt}\n\n${options.additionalInstructions}`;
670
- return defaultPrompt;
910
+ let prompt;
911
+ if (options.instructions) prompt = options.instructions;
912
+ else if (options.additionalInstructions) prompt = `${defaultPrompt}\n\n${options.additionalInstructions}`;
913
+ else prompt = defaultPrompt;
914
+ const contextBlock = options.context ? formatContextInstructions(options.context) : "";
915
+ if (contextBlock) return `${prompt}\n\n${contextBlock}`;
916
+ return prompt;
671
917
  }
672
918
  /**
673
919
  * Create a pre-configured GitHub agent powered by the AI SDK's `ToolLoopAgent`.
@@ -682,16 +928,18 @@ function resolveInstructions(options) {
682
928
  * model: 'anthropic/claude-sonnet-4.6',
683
929
  * token: process.env.GITHUB_TOKEN!,
684
930
  * preset: 'code-review',
931
+ * context: { owner: 'vercel', repo: 'ai', pullNumber: 42 },
685
932
  * })
686
933
  *
687
- * const result = await agent.generate({ prompt: 'Review PR #42 on vercel/ai' })
934
+ * const result = await agent.generate({ prompt: 'Review this PR' })
688
935
  * ```
689
936
  */
690
- function createGithubAgent({ token, preset, requireApproval, instructions, additionalInstructions, author, committer, coAuthors, ...agentOptions }) {
937
+ function createGithubAgent({ token, preset, requireApproval, context, instructions, additionalInstructions, author, committer, coAuthors, ...agentOptions }) {
691
938
  const tools = createGithubTools({
692
939
  token,
693
940
  requireApproval,
694
941
  preset,
942
+ context,
695
943
  author,
696
944
  committer,
697
945
  coAuthors
@@ -702,7 +950,8 @@ function createGithubAgent({ token, preset, requireApproval, instructions, addit
702
950
  instructions: resolveInstructions({
703
951
  preset,
704
952
  instructions,
705
- additionalInstructions
953
+ additionalInstructions,
954
+ context
706
955
  })
707
956
  });
708
957
  }
@@ -714,6 +963,7 @@ function createGithubAgent({ token, preset, requireApproval, instructions, addit
714
963
  * Write operations require user approval by default.
715
964
  * Control this globally or per-tool via `requireApproval`.
716
965
  * Use `preset` to get only the tools you need.
966
+ * Pass `context` to default owner/repo/PR/issue/ref on tool inputs.
717
967
  *
718
968
  * @example
719
969
  * ```ts
@@ -723,6 +973,13 @@ function createGithubAgent({ token, preset, requireApproval, instructions, addit
723
973
  * // Code-review agent — only PR & commit tools
724
974
  * createGithubTools({ token, preset: 'code-review' })
725
975
  *
976
+ * // Scoped to a repo / PR
977
+ * createGithubTools({
978
+ * token,
979
+ * preset: 'code-review',
980
+ * context: { owner: 'vercel', repo: 'ai', pullNumber: 42 },
981
+ * })
982
+ *
726
983
  * // Combine presets
727
984
  * createGithubTools({ token, preset: ['code-review', 'issue-triage'] })
728
985
  *
@@ -738,7 +995,7 @@ function createGithubAgent({ token, preset, requireApproval, instructions, addit
738
995
  * })
739
996
  * ```
740
997
  */
741
- function createGithubTools({ token, requireApproval = true, preset, overrides, author, committer, coAuthors } = {}) {
998
+ function createGithubTools({ token, requireApproval = true, preset, context, overrides, author, committer, coAuthors } = {}) {
742
999
  const resolveToken = createGithubTokenResolver(token);
743
1000
  const approval = (name) => ({ needsApproval: resolveAiSdkApproval(name, requireApproval) });
744
1001
  const allowed = preset ? resolvePresetTools(preset) : null;
@@ -746,6 +1003,7 @@ function createGithubTools({ token, requireApproval = true, preset, overrides, a
746
1003
  getRepository: getRepository(resolveToken),
747
1004
  listBranches: listBranches(resolveToken),
748
1005
  getFileContent: getFileContent(resolveToken),
1006
+ getRepositoryTree: getRepositoryTree(resolveToken),
749
1007
  listPullRequests: listPullRequests(resolveToken),
750
1008
  getPullRequest: getPullRequest(resolveToken),
751
1009
  listIssues: listIssues(resolveToken),
@@ -755,6 +1013,7 @@ function createGithubTools({ token, requireApproval = true, preset, overrides, a
755
1013
  listCommits: listCommits(resolveToken),
756
1014
  getCommit: getCommit(resolveToken),
757
1015
  getBlame: getBlame(resolveToken),
1016
+ compareCommits: compareCommits(resolveToken),
758
1017
  createBranch: createBranch(resolveToken, approval("createBranch")),
759
1018
  forkRepository: forkRepository(resolveToken, approval("forkRepository")),
760
1019
  createRepository: createRepository(resolveToken, approval("createRepository")),
@@ -773,12 +1032,17 @@ function createGithubTools({ token, requireApproval = true, preset, overrides, a
773
1032
  listPullRequestFiles: listPullRequestFiles(resolveToken),
774
1033
  listPullRequestReviews: listPullRequestReviews(resolveToken),
775
1034
  createPullRequestReview: createPullRequestReview(resolveToken, approval("createPullRequestReview")),
1035
+ requestReviewers: requestReviewers(resolveToken, approval("requestReviewers")),
1036
+ getPullRequestContext: getPullRequestContext(resolveToken),
1037
+ getIssueContext: getIssueContext(resolveToken),
776
1038
  createIssue: createIssue(resolveToken, approval("createIssue")),
777
1039
  addIssueComment: addIssueComment(resolveToken, approval("addIssueComment")),
778
1040
  closeIssue: closeIssue(resolveToken, approval("closeIssue")),
779
1041
  listLabels: listLabels(resolveToken),
780
1042
  addLabels: addLabels(resolveToken, approval("addLabels")),
781
1043
  removeLabel: removeLabel(resolveToken, approval("removeLabel")),
1044
+ addAssignees: addAssignees(resolveToken, approval("addAssignees")),
1045
+ removeAssignees: removeAssignees(resolveToken, approval("removeAssignees")),
782
1046
  listGists: listGists(resolveToken),
783
1047
  getGist: getGist(resolveToken),
784
1048
  listGistComments: listGistComments(resolveToken),
@@ -792,7 +1056,15 @@ function createGithubTools({ token, requireApproval = true, preset, overrides, a
792
1056
  listWorkflowJobs: listWorkflowJobs(resolveToken),
793
1057
  triggerWorkflow: triggerWorkflow(resolveToken, approval("triggerWorkflow")),
794
1058
  cancelWorkflowRun: cancelWorkflowRun(resolveToken, approval("cancelWorkflowRun")),
795
- rerunWorkflowRun: rerunWorkflowRun(resolveToken, approval("rerunWorkflowRun"))
1059
+ rerunWorkflowRun: rerunWorkflowRun(resolveToken, approval("rerunWorkflowRun")),
1060
+ listCheckRuns: listCheckRuns(resolveToken),
1061
+ getCombinedStatus: getCombinedStatus(resolveToken),
1062
+ getCiFailureContext: getCiFailureContext(resolveToken),
1063
+ listReleases: listReleases(resolveToken),
1064
+ getLatestRelease: getLatestRelease(resolveToken),
1065
+ getRelease: getRelease(resolveToken),
1066
+ getReleaseContext: getReleaseContext(resolveToken),
1067
+ createRelease: createRelease(resolveToken, approval("createRelease"))
796
1068
  };
797
1069
  if (overrides) {
798
1070
  for (const [name, toolOverrides] of Object.entries(overrides)) if (name in allTools && toolOverrides) {
@@ -803,10 +1075,11 @@ function createGithubTools({ token, requireApproval = true, preset, overrides, a
803
1075
  } });
804
1076
  }
805
1077
  }
806
- if (!allowed) return allTools;
807
- return Object.fromEntries(Object.entries(allTools).filter(([name]) => allowed.has(name)));
1078
+ const scoped = bindToolsContext(allTools, context);
1079
+ if (!allowed) return scoped;
1080
+ return Object.fromEntries(Object.entries(scoped).filter(([name]) => allowed.has(name)));
808
1081
  }
809
1082
  //#endregion
810
- export { removeLabel as A, createOrUpdateFile as B, addIssueComment as C, getIssue as D, createIssue as E, listPullRequestFiles as F, listBranches as G, forkRepository as H, listPullRequestReviews as I, listPullRequests as L, createPullRequest as M, createPullRequestReview as N, listIssues as O, getPullRequest as P, mergePullRequest as R, searchRepositories as S, closeIssue as T, getFileContent as U, createRepository as V, getRepository as W, updateGist as _, getWorkflowRun as a, listCommits as b, listWorkflows as c, createGist as d, createGistComment as f, listGists as g, listGistComments as h, cancelWorkflowRun as i, addPullRequestComment as j, listLabels as k, rerunWorkflowRun as l, getGist as m, createGithubAgent as n, listWorkflowJobs as o, deleteGist as p, resolveInstructions as r, listWorkflowRuns as s, createGithubTools as t, triggerWorkflow as u, getBlame as v, addLabels as w, searchCode as x, getCommit as y, createBranch as z };
1083
+ export { createBranch as $, getCommit as A, listIssues as B, deleteGist as C, updateGist as D, listGists as E, addIssueComment as F, createPullRequest as G, removeAssignees as H, addLabels as I, listPullRequestFiles as J, createPullRequestReview as K, closeIssue as L, searchCode as M, searchRepositories as N, compareCommits as O, addAssignees as P, requestReviewers as Q, createIssue as R, createGistComment as S, listGistComments as T, removeLabel as U, listLabels as V, addPullRequestComment as W, listPullRequests as X, listPullRequestReviews as Y, mergePullRequest as Z, listWorkflowRuns as _, getIssueContext as a, getRepositoryTree as at, triggerWorkflow as b, createRelease as c, listReleases as d, createOrUpdateFile as et, getCombinedStatus as f, listWorkflowJobs as g, getWorkflowRun as h, getCiFailureContext as i, getRepository as it, listCommits as j, getBlame as k, getLatestRelease as l, cancelWorkflowRun as m, createGithubAgent as n, forkRepository as nt, getPullRequestContext as o, listBranches as ot, listCheckRuns as p, getPullRequest as q, resolveInstructions as r, getFileContent as rt, getReleaseContext as s, createGithubTools as t, createRepository as tt, getRelease as u, listWorkflows as v, getGist as w, createGist as x, rerunWorkflowRun as y, getIssue as z };
811
1084
 
812
- //# sourceMappingURL=src-CfzZfU82.mjs.map
1085
+ //# sourceMappingURL=src-D6vC3V8r.mjs.map