@github-tools/sdk 1.6.0 → 1.7.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.
@@ -1,1961 +0,0 @@
1
- import { createHash } from "crypto";
2
- import { ToolLoopAgent, tool } from "ai";
3
- import { z } from "zod";
4
- import { Octokit } from "octokit";
5
- //#region src/client.ts
6
- function createOctokit(token) {
7
- return new Octokit({ auth: token });
8
- }
9
- //#endregion
10
- //#region src/tools/repository.ts
11
- const CREATE_COMMIT_ON_BRANCH_MUTATION = `
12
- mutation CreateCommitOnBranch($input: CreateCommitOnBranchInput!) {
13
- createCommitOnBranch(input: $input) { commit { oid url } }
14
- }
15
- `;
16
- var CreateCommitOnBranchError = class extends Error {
17
- constructor(message, reason) {
18
- super(message);
19
- this.reason = reason;
20
- this.name = "CreateCommitOnBranchError";
21
- }
22
- };
23
- async function createCommitOnBranch(octokit, input) {
24
- try {
25
- const result = await octokit.graphql(CREATE_COMMIT_ON_BRANCH_MUTATION, { input: {
26
- branch: {
27
- repositoryNameWithOwner: `${input.owner}/${input.repo}`,
28
- branchName: input.branch
29
- },
30
- expectedHeadOid: input.expectedHeadOid,
31
- message: input.body ? {
32
- headline: input.headline,
33
- body: input.body
34
- } : { headline: input.headline },
35
- fileChanges: {
36
- additions: input.additions,
37
- deletions: input.deletions
38
- }
39
- } });
40
- return {
41
- commitSha: result.createCommitOnBranch.commit.oid,
42
- commitUrl: result.createCommitOnBranch.commit.url
43
- };
44
- } catch (error) {
45
- const err = error;
46
- const types = new Set((err.errors ?? []).map((e) => e.type));
47
- if (types.has("STALE_DATA")) throw new CreateCommitOnBranchError(err.message ?? "Stale data", "stale_data");
48
- if (types.has("FORBIDDEN") || types.has("INSUFFICIENT_SCOPES") || err.status === 401 || err.status === 403) throw new CreateCommitOnBranchError(err.message ?? "Forbidden", "forbidden");
49
- throw error;
50
- }
51
- }
52
- /** Compute the git blob SHA (SHA-1 of "blob {size}\0{content}") for a given string. */
53
- function gitBlobSha(content) {
54
- const buf = Buffer.from(content);
55
- return createHash("sha1").update(`blob ${buf.length}\0`).update(buf).digest("hex");
56
- }
57
- function composeCommitMessage(message, coAuthors) {
58
- if (!coAuthors?.length) return message;
59
- const trailers = coAuthors.map(({ name, email }) => `Co-authored-by: ${name} <${email}>`).join("\n");
60
- return message ? `${message}\n\n${trailers}` : trailers;
61
- }
62
- async function getRepositoryStep({ token, owner, repo }) {
63
- "use step";
64
- const { data } = await createOctokit(token).rest.repos.get({
65
- owner,
66
- repo
67
- });
68
- return {
69
- name: data.name,
70
- fullName: data.full_name,
71
- description: data.description,
72
- url: data.html_url,
73
- defaultBranch: data.default_branch,
74
- stars: data.stargazers_count,
75
- forks: data.forks_count,
76
- openIssues: data.open_issues_count,
77
- language: data.language,
78
- private: data.private,
79
- createdAt: data.created_at,
80
- updatedAt: data.updated_at
81
- };
82
- }
83
- const getRepository = (token) => tool({
84
- description: "Get information about a GitHub repository including description, stars, forks, language, and default branch",
85
- inputSchema: z.object({
86
- owner: z.string().describe("Repository owner (user or organization)"),
87
- repo: z.string().describe("Repository name")
88
- }),
89
- execute: async (args) => getRepositoryStep({
90
- token,
91
- ...args
92
- })
93
- });
94
- async function listBranchesStep({ token, owner, repo, perPage }) {
95
- "use step";
96
- const { data } = await createOctokit(token).rest.repos.listBranches({
97
- owner,
98
- repo,
99
- per_page: perPage
100
- });
101
- return data.map((branch) => ({
102
- name: branch.name,
103
- sha: branch.commit.sha,
104
- protected: branch.protected
105
- }));
106
- }
107
- const listBranches = (token) => tool({
108
- description: "List branches in a GitHub repository",
109
- inputSchema: z.object({
110
- owner: z.string().describe("Repository owner"),
111
- repo: z.string().describe("Repository name"),
112
- perPage: z.number().optional().default(30).describe("Number of branches to return (max 100)")
113
- }),
114
- execute: async (args) => listBranchesStep({
115
- token,
116
- ...args
117
- })
118
- });
119
- async function getFileContentStep({ token, owner, repo, path, ref }) {
120
- "use step";
121
- const { data } = await createOctokit(token).rest.repos.getContent({
122
- owner,
123
- repo,
124
- path,
125
- ref
126
- });
127
- if (Array.isArray(data)) return {
128
- type: "directory",
129
- entries: data.map((e) => ({
130
- name: e.name,
131
- type: e.type,
132
- path: e.path
133
- }))
134
- };
135
- if (data.type !== "file") return {
136
- type: data.type,
137
- path: data.path
138
- };
139
- const content = Buffer.from(data.content, "base64").toString("utf-8");
140
- return {
141
- type: "file",
142
- path: data.path,
143
- sha: data.sha,
144
- size: data.size,
145
- content
146
- };
147
- }
148
- const getFileContent = (token) => tool({
149
- description: "Get the content of a file from a GitHub repository",
150
- inputSchema: z.object({
151
- owner: z.string().describe("Repository owner"),
152
- repo: z.string().describe("Repository name"),
153
- path: z.string().describe("Path to the file in the repository"),
154
- ref: z.string().optional().describe("Branch, tag, or commit SHA (defaults to the default branch)")
155
- }),
156
- execute: async (args) => getFileContentStep({
157
- token,
158
- ...args
159
- })
160
- });
161
- async function createBranchStep({ token, owner, repo, branch, from }) {
162
- "use step";
163
- const octokit = createOctokit(token);
164
- let sha = from;
165
- if (!sha || !sha.match(/^[0-9a-f]{40}$/i)) {
166
- const { data: ref } = await octokit.rest.git.getRef({
167
- owner,
168
- repo,
169
- ref: `heads/${from || (await octokit.rest.repos.get({
170
- owner,
171
- repo
172
- })).data.default_branch}`
173
- });
174
- sha = ref.object.sha;
175
- }
176
- const { data } = await octokit.rest.git.createRef({
177
- owner,
178
- repo,
179
- ref: `refs/heads/${branch}`,
180
- sha
181
- });
182
- return {
183
- ref: data.ref,
184
- sha: data.object.sha,
185
- url: data.url
186
- };
187
- }
188
- const createBranch = (token, { needsApproval = true } = {}) => tool({
189
- description: "Create a new branch in a GitHub repository from an existing branch or commit SHA",
190
- needsApproval,
191
- inputSchema: z.object({
192
- owner: z.string().describe("Repository owner"),
193
- repo: z.string().describe("Repository name"),
194
- branch: z.string().describe("Name for the new branch"),
195
- from: z.string().optional().describe("Source branch name or commit SHA to branch from (defaults to the default branch)")
196
- }),
197
- execute: async (args) => createBranchStep({
198
- token,
199
- ...args
200
- })
201
- });
202
- async function forkRepositoryStep({ token, owner, repo, organization, name }) {
203
- "use step";
204
- const { data } = await createOctokit(token).rest.repos.createFork({
205
- owner,
206
- repo,
207
- organization,
208
- name
209
- });
210
- return {
211
- name: data.name,
212
- fullName: data.full_name,
213
- url: data.html_url,
214
- cloneUrl: data.clone_url,
215
- sshUrl: data.ssh_url,
216
- defaultBranch: data.default_branch,
217
- private: data.private,
218
- parent: data.parent ? {
219
- fullName: data.parent.full_name,
220
- url: data.parent.html_url
221
- } : null
222
- };
223
- }
224
- const forkRepository = (token, { needsApproval = true } = {}) => tool({
225
- description: "Fork a GitHub repository to the authenticated user account or a specified organization",
226
- needsApproval,
227
- inputSchema: z.object({
228
- owner: z.string().describe("Repository owner to fork from"),
229
- repo: z.string().describe("Repository name to fork"),
230
- organization: z.string().optional().describe("Organization to fork into (omit to fork to your personal account)"),
231
- name: z.string().optional().describe("Name for the forked repository (defaults to the original name)")
232
- }),
233
- execute: async (args) => forkRepositoryStep({
234
- token,
235
- ...args
236
- })
237
- });
238
- async function createRepositoryStep({ token, name, description, isPrivate, autoInit, gitignoreTemplate, licenseTemplate, org }) {
239
- "use step";
240
- const octokit = createOctokit(token);
241
- const params = {
242
- name,
243
- description,
244
- private: isPrivate,
245
- auto_init: autoInit,
246
- gitignore_template: gitignoreTemplate,
247
- license_template: licenseTemplate
248
- };
249
- const { data } = org ? await octokit.rest.repos.createInOrg({
250
- org,
251
- ...params
252
- }) : await octokit.rest.repos.createForAuthenticatedUser(params);
253
- return {
254
- name: data.name,
255
- fullName: data.full_name,
256
- description: data.description,
257
- url: data.html_url,
258
- cloneUrl: data.clone_url,
259
- sshUrl: data.ssh_url,
260
- defaultBranch: data.default_branch,
261
- private: data.private,
262
- createdAt: data.created_at
263
- };
264
- }
265
- const createRepository = (token, { needsApproval = true } = {}) => tool({
266
- description: "Create a new GitHub repository for the authenticated user or a specified organization",
267
- needsApproval,
268
- inputSchema: z.object({
269
- name: z.string().describe("Repository name"),
270
- description: z.string().optional().describe("A short description of the repository"),
271
- isPrivate: z.boolean().optional().default(false).describe("Whether the repository is private"),
272
- autoInit: z.boolean().optional().default(false).describe("Create an initial commit with a README"),
273
- gitignoreTemplate: z.string().optional().describe("Gitignore template to use (e.g. \"Node\", \"Python\")"),
274
- licenseTemplate: z.string().optional().describe("License keyword (e.g. \"mit\", \"apache-2.0\")"),
275
- org: z.string().optional().describe("Organization to create the repository in (omit for personal repo)")
276
- }),
277
- execute: async (args) => createRepositoryStep({
278
- token,
279
- ...args
280
- })
281
- });
282
- async function createOrUpdateFileStep({ token, owner, repo, path, message, content, branch, sha, author, committer, coAuthors }) {
283
- "use step";
284
- const octokit = createOctokit(token);
285
- if (!author && !committer) try {
286
- const branchName = branch || (await octokit.rest.repos.get({
287
- owner,
288
- repo
289
- })).data.default_branch;
290
- const { data: ref } = await octokit.rest.git.getRef({
291
- owner,
292
- repo,
293
- ref: `heads/${branchName}`
294
- });
295
- const [headline, ...rest] = composeCommitMessage(message, coAuthors).split("\n");
296
- const body = rest.join("\n").replace(/^\n+/, "") || void 0;
297
- const result = await createCommitOnBranch(octokit, {
298
- owner,
299
- repo,
300
- branch: branchName,
301
- expectedHeadOid: ref.object.sha,
302
- headline,
303
- body,
304
- additions: [{
305
- path,
306
- contents: Buffer.from(content).toString("base64")
307
- }]
308
- });
309
- return {
310
- path,
311
- sha: gitBlobSha(content),
312
- commitSha: result.commitSha,
313
- commitUrl: result.commitUrl
314
- };
315
- } catch (error) {
316
- if (error instanceof CreateCommitOnBranchError && error.reason === "stale_data") throw error;
317
- const msg = error instanceof Error ? error.message : String(error);
318
- console.warn(`[github-tools] Signed commit failed, using REST API: ${msg}`);
319
- }
320
- const encoded = Buffer.from(content).toString("base64");
321
- const finalMessage = composeCommitMessage(message, coAuthors);
322
- const { data } = await octokit.rest.repos.createOrUpdateFileContents({
323
- owner,
324
- repo,
325
- path,
326
- message: finalMessage,
327
- content: encoded,
328
- branch,
329
- sha,
330
- author,
331
- committer
332
- });
333
- return {
334
- path: data.content?.path,
335
- sha: data.content?.sha,
336
- commitSha: data.commit.sha,
337
- commitUrl: data.commit.html_url
338
- };
339
- }
340
- const createOrUpdateFile = (token, { needsApproval = true, author, committer, coAuthors } = {}) => tool({
341
- description: "Create or update a file in a GitHub repository. Provide the SHA when updating an existing file.",
342
- needsApproval,
343
- inputSchema: z.object({
344
- owner: z.string().describe("Repository owner"),
345
- repo: z.string().describe("Repository name"),
346
- path: z.string().describe("Path to the file in the repository"),
347
- message: z.string().describe("Commit message"),
348
- content: z.string().describe("File content (plain text, will be base64-encoded automatically)"),
349
- branch: z.string().optional().describe("Branch to commit to (defaults to the default branch)"),
350
- sha: z.string().optional().describe("SHA of the file being replaced (required when updating an existing file)")
351
- }),
352
- execute: async (args) => createOrUpdateFileStep({
353
- token,
354
- author,
355
- committer,
356
- coAuthors,
357
- ...args
358
- })
359
- });
360
- //#endregion
361
- //#region src/tools/pull-requests.ts
362
- async function listPullRequestsStep({ token, owner, repo, state, perPage }) {
363
- "use step";
364
- const { data } = await createOctokit(token).rest.pulls.list({
365
- owner,
366
- repo,
367
- state,
368
- per_page: perPage
369
- });
370
- return data.map((pr) => ({
371
- number: pr.number,
372
- title: pr.title,
373
- state: pr.state,
374
- url: pr.html_url,
375
- author: pr.user?.login,
376
- branch: pr.head.ref,
377
- base: pr.base.ref,
378
- draft: pr.draft,
379
- createdAt: pr.created_at,
380
- updatedAt: pr.updated_at
381
- }));
382
- }
383
- const listPullRequests = (token) => tool({
384
- description: "List pull requests for a GitHub repository",
385
- inputSchema: z.object({
386
- owner: z.string().describe("Repository owner"),
387
- repo: z.string().describe("Repository name"),
388
- state: z.enum([
389
- "open",
390
- "closed",
391
- "all"
392
- ]).optional().default("open").describe("Filter by state"),
393
- perPage: z.number().optional().default(30).describe("Number of results to return (max 100)")
394
- }),
395
- execute: async (args) => listPullRequestsStep({
396
- token,
397
- ...args
398
- })
399
- });
400
- async function getPullRequestStep({ token, owner, repo, pullNumber }) {
401
- "use step";
402
- const { data } = await createOctokit(token).rest.pulls.get({
403
- owner,
404
- repo,
405
- pull_number: pullNumber
406
- });
407
- return {
408
- number: data.number,
409
- title: data.title,
410
- body: data.body,
411
- state: data.state,
412
- url: data.html_url,
413
- author: data.user?.login,
414
- branch: data.head.ref,
415
- base: data.base.ref,
416
- draft: data.draft,
417
- merged: data.merged,
418
- mergeable: data.mergeable,
419
- additions: data.additions,
420
- deletions: data.deletions,
421
- changedFiles: data.changed_files,
422
- createdAt: data.created_at,
423
- updatedAt: data.updated_at,
424
- mergedAt: data.merged_at
425
- };
426
- }
427
- const getPullRequest = (token) => tool({
428
- description: "Get detailed information about a specific pull request",
429
- inputSchema: z.object({
430
- owner: z.string().describe("Repository owner"),
431
- repo: z.string().describe("Repository name"),
432
- pullNumber: z.number().describe("Pull request number")
433
- }),
434
- execute: async (args) => getPullRequestStep({
435
- token,
436
- ...args
437
- })
438
- });
439
- async function createPullRequestStep({ token, owner, repo, title, body, head, base, draft }) {
440
- "use step";
441
- const { data } = await createOctokit(token).rest.pulls.create({
442
- owner,
443
- repo,
444
- title,
445
- body,
446
- head,
447
- base,
448
- draft
449
- });
450
- return {
451
- number: data.number,
452
- title: data.title,
453
- url: data.html_url,
454
- state: data.state,
455
- draft: data.draft,
456
- branch: data.head.ref,
457
- base: data.base.ref
458
- };
459
- }
460
- const createPullRequest = (token, { needsApproval = true } = {}) => tool({
461
- description: "Create a new pull request in a GitHub repository",
462
- needsApproval,
463
- inputSchema: z.object({
464
- owner: z.string().describe("Repository owner"),
465
- repo: z.string().describe("Repository name"),
466
- title: z.string().describe("Pull request title"),
467
- body: z.string().optional().describe("Pull request description (supports Markdown)"),
468
- head: z.string().describe("Branch containing the changes (format: branch or username:branch)"),
469
- base: z.string().describe("Branch to merge into"),
470
- draft: z.boolean().optional().default(false).describe("Create as draft pull request")
471
- }),
472
- execute: async (args) => createPullRequestStep({
473
- token,
474
- ...args
475
- })
476
- });
477
- async function mergePullRequestStep({ token, owner, repo, pullNumber, commitTitle, commitMessage, mergeMethod, coAuthors }) {
478
- "use step";
479
- const octokit = createOctokit(token);
480
- const finalMessage = composeCommitMessage(commitMessage ?? "", coAuthors) || void 0;
481
- const { data } = await octokit.rest.pulls.merge({
482
- owner,
483
- repo,
484
- pull_number: pullNumber,
485
- commit_title: commitTitle,
486
- commit_message: finalMessage,
487
- merge_method: mergeMethod
488
- });
489
- return {
490
- merged: data.merged,
491
- message: data.message,
492
- sha: data.sha
493
- };
494
- }
495
- const mergePullRequest = (token, { needsApproval = true, coAuthors } = {}) => tool({
496
- description: "Merge a pull request",
497
- needsApproval,
498
- inputSchema: z.object({
499
- owner: z.string().describe("Repository owner"),
500
- repo: z.string().describe("Repository name"),
501
- pullNumber: z.number().describe("Pull request number"),
502
- commitTitle: z.string().optional().describe("Title for the automatic merge commit"),
503
- commitMessage: z.string().optional().describe("Extra detail to append to automatic commit message"),
504
- mergeMethod: z.enum([
505
- "merge",
506
- "squash",
507
- "rebase"
508
- ]).optional().default("merge").describe("Merge strategy")
509
- }),
510
- execute: async (args) => mergePullRequestStep({
511
- token,
512
- coAuthors,
513
- ...args
514
- })
515
- });
516
- async function addPullRequestCommentStep({ token, owner, repo, pullNumber, body }) {
517
- "use step";
518
- const { data } = await createOctokit(token).rest.issues.createComment({
519
- owner,
520
- repo,
521
- issue_number: pullNumber,
522
- body
523
- });
524
- return {
525
- id: data.id,
526
- url: data.html_url,
527
- body: data.body,
528
- author: data.user?.login,
529
- createdAt: data.created_at
530
- };
531
- }
532
- const addPullRequestComment = (token, { needsApproval = true } = {}) => tool({
533
- description: "Add a comment to a pull request",
534
- needsApproval,
535
- inputSchema: z.object({
536
- owner: z.string().describe("Repository owner"),
537
- repo: z.string().describe("Repository name"),
538
- pullNumber: z.number().describe("Pull request number"),
539
- body: z.string().describe("Comment text (supports Markdown)")
540
- }),
541
- execute: async (args) => addPullRequestCommentStep({
542
- token,
543
- ...args
544
- })
545
- });
546
- async function listPullRequestFilesStep({ token, owner, repo, pullNumber, perPage, page }) {
547
- "use step";
548
- const { data } = await createOctokit(token).rest.pulls.listFiles({
549
- owner,
550
- repo,
551
- pull_number: pullNumber,
552
- per_page: perPage,
553
- page
554
- });
555
- return data.map((file) => ({
556
- filename: file.filename,
557
- status: file.status,
558
- additions: file.additions,
559
- deletions: file.deletions,
560
- changes: file.changes,
561
- patch: file.patch
562
- }));
563
- }
564
- const listPullRequestFiles = (token) => tool({
565
- description: "List files changed in a pull request, including diff status and patch content",
566
- inputSchema: z.object({
567
- owner: z.string().describe("Repository owner"),
568
- repo: z.string().describe("Repository name"),
569
- pullNumber: z.number().describe("Pull request number"),
570
- perPage: z.number().optional().default(30).describe("Number of results to return (max 100)"),
571
- page: z.number().optional().default(1).describe("Page number for pagination")
572
- }),
573
- execute: async (args) => listPullRequestFilesStep({
574
- token,
575
- ...args
576
- })
577
- });
578
- async function listPullRequestReviewsStep({ token, owner, repo, pullNumber, perPage, page }) {
579
- "use step";
580
- const { data } = await createOctokit(token).rest.pulls.listReviews({
581
- owner,
582
- repo,
583
- pull_number: pullNumber,
584
- per_page: perPage,
585
- page
586
- });
587
- return data.map((review) => ({
588
- id: review.id,
589
- state: review.state,
590
- body: review.body,
591
- author: review.user?.login,
592
- url: review.html_url,
593
- submittedAt: review.submitted_at
594
- }));
595
- }
596
- const listPullRequestReviews = (token) => tool({
597
- description: "List reviews on a pull request (approvals, change requests, and comments)",
598
- inputSchema: z.object({
599
- owner: z.string().describe("Repository owner"),
600
- repo: z.string().describe("Repository name"),
601
- pullNumber: z.number().describe("Pull request number"),
602
- perPage: z.number().optional().default(30).describe("Number of results to return (max 100)"),
603
- page: z.number().optional().default(1).describe("Page number for pagination")
604
- }),
605
- execute: async (args) => listPullRequestReviewsStep({
606
- token,
607
- ...args
608
- })
609
- });
610
- async function createPullRequestReviewStep({ token, owner, repo, pullNumber, body, event, comments }) {
611
- "use step";
612
- const { data } = await createOctokit(token).rest.pulls.createReview({
613
- owner,
614
- repo,
615
- pull_number: pullNumber,
616
- body,
617
- event,
618
- comments
619
- });
620
- return {
621
- id: data.id,
622
- state: data.state,
623
- body: data.body,
624
- url: data.html_url,
625
- author: data.user?.login,
626
- submittedAt: data.submitted_at
627
- };
628
- }
629
- const createPullRequestReview = (token, { needsApproval = true } = {}) => tool({
630
- description: "Submit a pull request review — approve, request changes, or comment with optional inline comments on specific lines",
631
- needsApproval,
632
- inputSchema: z.object({
633
- owner: z.string().describe("Repository owner"),
634
- repo: z.string().describe("Repository name"),
635
- pullNumber: z.number().describe("Pull request number"),
636
- body: z.string().optional().describe("Review body text (supports Markdown)"),
637
- event: z.enum([
638
- "APPROVE",
639
- "REQUEST_CHANGES",
640
- "COMMENT"
641
- ]).describe("Review action: approve, request changes, or comment"),
642
- comments: z.array(z.object({
643
- path: z.string().describe("File path relative to the repository root"),
644
- body: z.string().describe("Inline comment text"),
645
- line: z.number().optional().describe("Line number in the file to comment on"),
646
- side: z.enum(["LEFT", "RIGHT"]).optional().describe("Which side of the diff to comment on (LEFT = base, RIGHT = head)")
647
- })).optional().describe("Inline review comments on specific files and lines")
648
- }),
649
- execute: async (args) => createPullRequestReviewStep({
650
- token,
651
- ...args
652
- })
653
- });
654
- //#endregion
655
- //#region src/tools/issues.ts
656
- async function listIssuesStep({ token, owner, repo, state, labels, perPage }) {
657
- "use step";
658
- const { data } = await createOctokit(token).rest.issues.listForRepo({
659
- owner,
660
- repo,
661
- state,
662
- labels,
663
- per_page: perPage
664
- });
665
- return data.filter((issue) => !issue.pull_request).map((issue) => ({
666
- number: issue.number,
667
- title: issue.title,
668
- state: issue.state,
669
- url: issue.html_url,
670
- author: issue.user?.login,
671
- labels: issue.labels.map((l) => typeof l === "string" ? l : l.name),
672
- createdAt: issue.created_at,
673
- updatedAt: issue.updated_at
674
- }));
675
- }
676
- const listIssues = (token) => tool({
677
- description: "List issues for a GitHub repository (excludes pull requests)",
678
- inputSchema: z.object({
679
- owner: z.string().describe("Repository owner"),
680
- repo: z.string().describe("Repository name"),
681
- state: z.enum([
682
- "open",
683
- "closed",
684
- "all"
685
- ]).optional().default("open").describe("Filter by state"),
686
- labels: z.string().optional().describe("Comma-separated list of label names to filter by"),
687
- perPage: z.number().optional().default(30).describe("Number of results to return (max 100)")
688
- }),
689
- execute: async (args) => listIssuesStep({
690
- token,
691
- ...args
692
- })
693
- });
694
- async function getIssueStep({ token, owner, repo, issueNumber }) {
695
- "use step";
696
- const { data } = await createOctokit(token).rest.issues.get({
697
- owner,
698
- repo,
699
- issue_number: issueNumber
700
- });
701
- return {
702
- number: data.number,
703
- title: data.title,
704
- body: data.body,
705
- state: data.state,
706
- url: data.html_url,
707
- author: data.user?.login,
708
- assignees: data.assignees?.map((a) => a.login),
709
- labels: data.labels.map((l) => typeof l === "string" ? l : l.name),
710
- comments: data.comments,
711
- createdAt: data.created_at,
712
- updatedAt: data.updated_at,
713
- closedAt: data.closed_at
714
- };
715
- }
716
- const getIssue = (token) => tool({
717
- description: "Get detailed information about a specific issue",
718
- inputSchema: z.object({
719
- owner: z.string().describe("Repository owner"),
720
- repo: z.string().describe("Repository name"),
721
- issueNumber: z.number().describe("Issue number")
722
- }),
723
- execute: async (args) => getIssueStep({
724
- token,
725
- ...args
726
- })
727
- });
728
- async function createIssueStep({ token, owner, repo, title, body, labels, assignees }) {
729
- "use step";
730
- const { data } = await createOctokit(token).rest.issues.create({
731
- owner,
732
- repo,
733
- title,
734
- body,
735
- labels,
736
- assignees
737
- });
738
- return {
739
- number: data.number,
740
- title: data.title,
741
- url: data.html_url,
742
- state: data.state,
743
- labels: data.labels.map((l) => typeof l === "string" ? l : l.name)
744
- };
745
- }
746
- const createIssue = (token, { needsApproval = true } = {}) => tool({
747
- description: "Create a new issue in a GitHub repository",
748
- needsApproval,
749
- inputSchema: z.object({
750
- owner: z.string().describe("Repository owner"),
751
- repo: z.string().describe("Repository name"),
752
- title: z.string().describe("Issue title"),
753
- body: z.string().optional().describe("Issue description (supports Markdown)"),
754
- labels: z.array(z.string()).optional().describe("Labels to apply to the issue"),
755
- assignees: z.array(z.string()).optional().describe("GitHub usernames to assign to the issue")
756
- }),
757
- execute: async (args) => createIssueStep({
758
- token,
759
- ...args
760
- })
761
- });
762
- async function addIssueCommentStep({ token, owner, repo, issueNumber, body }) {
763
- "use step";
764
- const { data } = await createOctokit(token).rest.issues.createComment({
765
- owner,
766
- repo,
767
- issue_number: issueNumber,
768
- body
769
- });
770
- return {
771
- id: data.id,
772
- url: data.html_url,
773
- body: data.body,
774
- author: data.user?.login,
775
- createdAt: data.created_at
776
- };
777
- }
778
- const addIssueComment = (token, { needsApproval = true } = {}) => tool({
779
- description: "Add a comment to a GitHub issue",
780
- needsApproval,
781
- inputSchema: z.object({
782
- owner: z.string().describe("Repository owner"),
783
- repo: z.string().describe("Repository name"),
784
- issueNumber: z.number().describe("Issue number"),
785
- body: z.string().describe("Comment text (supports Markdown)")
786
- }),
787
- execute: async (args) => addIssueCommentStep({
788
- token,
789
- ...args
790
- })
791
- });
792
- async function closeIssueStep({ token, owner, repo, issueNumber, stateReason }) {
793
- "use step";
794
- const { data } = await createOctokit(token).rest.issues.update({
795
- owner,
796
- repo,
797
- issue_number: issueNumber,
798
- state: "closed",
799
- state_reason: stateReason
800
- });
801
- return {
802
- number: data.number,
803
- title: data.title,
804
- state: data.state,
805
- url: data.html_url,
806
- closedAt: data.closed_at
807
- };
808
- }
809
- const closeIssue = (token, { needsApproval = true } = {}) => tool({
810
- description: "Close an open GitHub issue",
811
- needsApproval,
812
- inputSchema: z.object({
813
- owner: z.string().describe("Repository owner"),
814
- repo: z.string().describe("Repository name"),
815
- issueNumber: z.number().describe("Issue number to close"),
816
- stateReason: z.enum(["completed", "not_planned"]).optional().default("completed").describe("Reason for closing")
817
- }),
818
- execute: async (args) => closeIssueStep({
819
- token,
820
- ...args
821
- })
822
- });
823
- async function listLabelsStep({ token, owner, repo, perPage, page }) {
824
- "use step";
825
- const { data } = await createOctokit(token).rest.issues.listLabelsForRepo({
826
- owner,
827
- repo,
828
- per_page: perPage,
829
- page
830
- });
831
- return data.map((label) => ({
832
- name: label.name,
833
- color: label.color,
834
- description: label.description
835
- }));
836
- }
837
- const listLabels = (token) => tool({
838
- description: "List labels available in a GitHub repository",
839
- inputSchema: z.object({
840
- owner: z.string().describe("Repository owner"),
841
- repo: z.string().describe("Repository name"),
842
- perPage: z.number().optional().default(30).describe("Number of results to return (max 100)"),
843
- page: z.number().optional().default(1).describe("Page number for pagination")
844
- }),
845
- execute: async (args) => listLabelsStep({
846
- token,
847
- ...args
848
- })
849
- });
850
- async function addLabelsStep({ token, owner, repo, issueNumber, labels }) {
851
- "use step";
852
- const { data } = await createOctokit(token).rest.issues.addLabels({
853
- owner,
854
- repo,
855
- issue_number: issueNumber,
856
- labels
857
- });
858
- return data.map((label) => ({
859
- name: label.name,
860
- color: label.color,
861
- description: label.description
862
- }));
863
- }
864
- const addLabels = (token, { needsApproval = true } = {}) => tool({
865
- description: "Add labels to an issue or pull request",
866
- needsApproval,
867
- inputSchema: z.object({
868
- owner: z.string().describe("Repository owner"),
869
- repo: z.string().describe("Repository name"),
870
- issueNumber: z.number().describe("Issue or pull request number"),
871
- labels: z.array(z.string()).describe("Label names to add")
872
- }),
873
- execute: async (args) => addLabelsStep({
874
- token,
875
- ...args
876
- })
877
- });
878
- async function removeLabelStep({ token, owner, repo, issueNumber, label }) {
879
- "use step";
880
- await createOctokit(token).rest.issues.removeLabel({
881
- owner,
882
- repo,
883
- issue_number: issueNumber,
884
- name: label
885
- });
886
- return {
887
- removed: true,
888
- label,
889
- issueNumber
890
- };
891
- }
892
- const removeLabel = (token, { needsApproval = true } = {}) => tool({
893
- description: "Remove a label from an issue or pull request",
894
- needsApproval,
895
- inputSchema: z.object({
896
- owner: z.string().describe("Repository owner"),
897
- repo: z.string().describe("Repository name"),
898
- issueNumber: z.number().describe("Issue or pull request number"),
899
- label: z.string().describe("Label name to remove")
900
- }),
901
- execute: async (args) => removeLabelStep({
902
- token,
903
- ...args
904
- })
905
- });
906
- //#endregion
907
- //#region src/tools/search.ts
908
- async function searchCodeStep({ token, query, perPage }) {
909
- "use step";
910
- const { data } = await createOctokit(token).rest.search.code({
911
- q: query,
912
- per_page: perPage
913
- });
914
- return {
915
- totalCount: data.total_count,
916
- items: data.items.map((item) => ({
917
- name: item.name,
918
- path: item.path,
919
- url: item.html_url,
920
- repository: item.repository.full_name,
921
- sha: item.sha
922
- }))
923
- };
924
- }
925
- const searchCode = (token) => tool({
926
- description: "Search for code in GitHub repositories. Use qualifiers like \"repo:owner/name\" to scope the search.",
927
- inputSchema: z.object({
928
- query: z.string().describe("Search query. Supports GitHub search qualifiers, e.g. \"useState repo:facebook/react\""),
929
- perPage: z.number().optional().default(10).describe("Number of results to return (max 30)")
930
- }),
931
- execute: async (args) => searchCodeStep({
932
- token,
933
- ...args
934
- })
935
- });
936
- async function searchRepositoriesStep({ token, query, perPage, sort, order }) {
937
- "use step";
938
- const { data } = await createOctokit(token).rest.search.repos({
939
- q: query,
940
- per_page: perPage,
941
- sort,
942
- order
943
- });
944
- return {
945
- totalCount: data.total_count,
946
- items: data.items.map((repo) => ({
947
- name: repo.name,
948
- fullName: repo.full_name,
949
- description: repo.description,
950
- url: repo.html_url,
951
- stars: repo.stargazers_count,
952
- forks: repo.forks_count,
953
- language: repo.language,
954
- topics: repo.topics
955
- }))
956
- };
957
- }
958
- const searchRepositories = (token) => tool({
959
- description: "Search for GitHub repositories by keyword, topic, language, or other qualifiers",
960
- inputSchema: z.object({
961
- query: z.string().describe("Search query. Supports GitHub search qualifiers, e.g. \"nuxt language:typescript stars:>1000\""),
962
- perPage: z.number().optional().default(10).describe("Number of results to return (max 30)"),
963
- sort: z.enum([
964
- "stars",
965
- "forks",
966
- "help-wanted-issues",
967
- "updated"
968
- ]).optional().describe("Sort field"),
969
- order: z.enum(["asc", "desc"]).optional().default("desc").describe("Sort order")
970
- }),
971
- execute: async (args) => searchRepositoriesStep({
972
- token,
973
- ...args
974
- })
975
- });
976
- //#endregion
977
- //#region src/tools/commits.ts
978
- const BLAME_QUERY = `
979
- query ($owner: String!, $name: String!, $expression: String!, $path: String!) {
980
- repository(owner: $owner, name: $name) {
981
- object(expression: $expression) {
982
- ... on Commit {
983
- oid
984
- blame(path: $path) {
985
- ranges {
986
- startingLine
987
- endingLine
988
- age
989
- commit {
990
- oid
991
- abbreviatedOid
992
- messageHeadline
993
- authoredDate
994
- url
995
- author {
996
- name
997
- email
998
- user {
999
- login
1000
- }
1001
- }
1002
- }
1003
- }
1004
- }
1005
- }
1006
- }
1007
- }
1008
- }
1009
- `;
1010
- async function listCommitsStep({ token, owner, repo, path, sha, author, since, until, perPage }) {
1011
- "use step";
1012
- const { data } = await createOctokit(token).rest.repos.listCommits({
1013
- owner,
1014
- repo,
1015
- path,
1016
- sha,
1017
- author,
1018
- since,
1019
- until,
1020
- per_page: perPage
1021
- });
1022
- return data.map((commit) => ({
1023
- sha: commit.sha,
1024
- message: commit.commit.message,
1025
- author: commit.commit.author?.name,
1026
- authorLogin: commit.author?.login,
1027
- date: commit.commit.author?.date,
1028
- url: commit.html_url
1029
- }));
1030
- }
1031
- const listCommits = (token) => tool({
1032
- description: "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.",
1033
- inputSchema: z.object({
1034
- owner: z.string().describe("Repository owner"),
1035
- repo: z.string().describe("Repository name"),
1036
- path: z.string().optional().describe("Only commits containing this file path"),
1037
- sha: z.string().optional().describe("Branch name or commit SHA to start listing from"),
1038
- author: z.string().optional().describe("GitHub username or email to filter commits by"),
1039
- since: z.string().optional().describe("Only commits after this date (ISO 8601 format)"),
1040
- until: z.string().optional().describe("Only commits before this date (ISO 8601 format)"),
1041
- perPage: z.number().optional().default(30).describe("Number of results to return (max 100)")
1042
- }),
1043
- execute: async (args) => listCommitsStep({
1044
- token,
1045
- ...args
1046
- })
1047
- });
1048
- async function getCommitStep({ token, owner, repo, ref }) {
1049
- "use step";
1050
- const { data } = await createOctokit(token).rest.repos.getCommit({
1051
- owner,
1052
- repo,
1053
- ref
1054
- });
1055
- return {
1056
- sha: data.sha,
1057
- message: data.commit.message,
1058
- author: data.commit.author?.name,
1059
- authorLogin: data.author?.login,
1060
- date: data.commit.author?.date,
1061
- url: data.html_url,
1062
- stats: data.stats ? {
1063
- additions: data.stats.additions,
1064
- deletions: data.stats.deletions,
1065
- total: data.stats.total
1066
- } : null,
1067
- files: data.files?.map((file) => ({
1068
- filename: file.filename,
1069
- status: file.status,
1070
- additions: file.additions,
1071
- deletions: file.deletions,
1072
- patch: file.patch
1073
- }))
1074
- };
1075
- }
1076
- const getCommit = (token) => tool({
1077
- description: "Get detailed information about a specific commit, including the list of files changed with additions and deletions",
1078
- inputSchema: z.object({
1079
- owner: z.string().describe("Repository owner"),
1080
- repo: z.string().describe("Repository name"),
1081
- ref: z.string().describe("Commit SHA, branch name, or tag")
1082
- }),
1083
- execute: async (args) => getCommitStep({
1084
- token,
1085
- ...args
1086
- })
1087
- });
1088
- async function getBlameStep({ token, owner, repo, path, ref, line, lineStart, lineEnd }) {
1089
- "use step";
1090
- const octokit = createOctokit(token);
1091
- let expression = ref;
1092
- if (!expression) {
1093
- const { data } = await octokit.rest.repos.get({
1094
- owner,
1095
- repo
1096
- });
1097
- expression = data.default_branch;
1098
- }
1099
- const data = await octokit.graphql(BLAME_QUERY, {
1100
- owner,
1101
- name: repo,
1102
- expression,
1103
- path
1104
- });
1105
- if (!data.repository) return { error: `Repository not found: ${owner}/${repo}` };
1106
- const obj = data.repository.object;
1107
- if (!obj?.oid || !obj?.blame) return { error: `Ref "${expression}" did not resolve to a commit for this repository (or the path is invalid). Pass a branch name, tag, or full commit SHA.` };
1108
- let ranges = obj.blame.ranges.map((r) => ({
1109
- startingLine: r.startingLine,
1110
- endingLine: r.endingLine,
1111
- age: r.age,
1112
- commit: {
1113
- sha: r.commit.oid,
1114
- abbreviatedSha: r.commit.abbreviatedOid,
1115
- messageHeadline: r.commit.messageHeadline,
1116
- authoredDate: r.commit.authoredDate,
1117
- url: r.commit.url,
1118
- authorName: r.commit.author?.name ?? null,
1119
- authorEmail: r.commit.author?.email ?? null,
1120
- authorLogin: r.commit.author?.user?.login ?? null
1121
- }
1122
- }));
1123
- if (line != null) ranges = ranges.filter((r) => line >= r.startingLine && line <= r.endingLine);
1124
- else if (lineStart != null || lineEnd != null) {
1125
- const start = lineStart ?? 1;
1126
- const end = lineEnd ?? Number.MAX_SAFE_INTEGER;
1127
- ranges = ranges.filter((r) => r.endingLine >= start && r.startingLine <= end);
1128
- }
1129
- return {
1130
- ref: expression,
1131
- tipSha: obj.oid,
1132
- path,
1133
- rangeCount: ranges.length,
1134
- ranges
1135
- };
1136
- }
1137
- const getBlame = (token) => tool({
1138
- description: "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 — use this to see who introduced a line and when (GitHub GraphQL API).",
1139
- inputSchema: z.object({
1140
- owner: z.string().describe("Repository owner"),
1141
- repo: z.string().describe("Repository name"),
1142
- path: z.string().describe("Path to the file in the repository"),
1143
- ref: z.string().optional().describe("Branch name, tag, or commit SHA (defaults to the repository default branch)"),
1144
- line: z.number().int().positive().optional().describe("If set, only return blame ranges that include this line number"),
1145
- lineStart: z.number().int().positive().optional().describe("When used with lineEnd, only return ranges overlapping this window"),
1146
- lineEnd: z.number().int().positive().optional().describe("When used with lineStart, only return ranges overlapping this window")
1147
- }),
1148
- execute: async (args) => getBlameStep({
1149
- token,
1150
- ...args
1151
- })
1152
- });
1153
- //#endregion
1154
- //#region src/tools/gists.ts
1155
- async function listGistsStep({ token, username, perPage, page }) {
1156
- "use step";
1157
- const octokit = createOctokit(token);
1158
- const { data } = username ? await octokit.rest.gists.listForUser({
1159
- username,
1160
- per_page: perPage,
1161
- page
1162
- }) : await octokit.rest.gists.list({
1163
- per_page: perPage,
1164
- page
1165
- });
1166
- return data.map((gist) => ({
1167
- id: gist.id,
1168
- description: gist.description,
1169
- public: gist.public,
1170
- url: gist.html_url,
1171
- files: Object.keys(gist.files ?? {}),
1172
- owner: gist.owner?.login,
1173
- comments: gist.comments,
1174
- createdAt: gist.created_at,
1175
- updatedAt: gist.updated_at
1176
- }));
1177
- }
1178
- const listGists = (token) => tool({
1179
- description: "List gists for the authenticated user or a specific user",
1180
- inputSchema: z.object({
1181
- username: z.string().optional().describe("GitHub username — omit to list your own gists"),
1182
- perPage: z.number().optional().default(30).describe("Number of results to return (max 100)"),
1183
- page: z.number().optional().default(1).describe("Page number for pagination")
1184
- }),
1185
- execute: async (args) => listGistsStep({
1186
- token,
1187
- ...args
1188
- })
1189
- });
1190
- async function getGistStep({ token, gistId }) {
1191
- "use step";
1192
- const { data } = await createOctokit(token).rest.gists.get({ gist_id: gistId });
1193
- return {
1194
- id: data.id,
1195
- description: data.description,
1196
- public: data.public,
1197
- url: data.html_url,
1198
- owner: data.owner?.login,
1199
- files: Object.values(data.files ?? {}).map((file) => ({
1200
- filename: file?.filename,
1201
- language: file?.language,
1202
- size: file?.size,
1203
- content: file?.content
1204
- })),
1205
- comments: data.comments,
1206
- createdAt: data.created_at,
1207
- updatedAt: data.updated_at
1208
- };
1209
- }
1210
- const getGist = (token) => tool({
1211
- description: "Get a gist by ID, including file contents",
1212
- inputSchema: z.object({ gistId: z.string().describe("Gist ID") }),
1213
- execute: async (args) => getGistStep({
1214
- token,
1215
- ...args
1216
- })
1217
- });
1218
- async function listGistCommentsStep({ token, gistId, perPage, page }) {
1219
- "use step";
1220
- const { data } = await createOctokit(token).rest.gists.listComments({
1221
- gist_id: gistId,
1222
- per_page: perPage,
1223
- page
1224
- });
1225
- return data.map((comment) => ({
1226
- id: comment.id,
1227
- body: comment.body,
1228
- author: comment.user?.login,
1229
- url: comment.url,
1230
- createdAt: comment.created_at,
1231
- updatedAt: comment.updated_at
1232
- }));
1233
- }
1234
- const listGistComments = (token) => tool({
1235
- description: "List comments on a gist",
1236
- inputSchema: z.object({
1237
- gistId: z.string().describe("Gist ID"),
1238
- perPage: z.number().optional().default(30).describe("Number of results to return (max 100)"),
1239
- page: z.number().optional().default(1).describe("Page number for pagination")
1240
- }),
1241
- execute: async (args) => listGistCommentsStep({
1242
- token,
1243
- ...args
1244
- })
1245
- });
1246
- async function createGistStep({ token, description, files, isPublic }) {
1247
- "use step";
1248
- const { data } = await createOctokit(token).rest.gists.create({
1249
- description,
1250
- files,
1251
- public: isPublic
1252
- });
1253
- return {
1254
- id: data.id,
1255
- description: data.description,
1256
- public: data.public,
1257
- url: data.html_url,
1258
- files: Object.keys(data.files ?? {}),
1259
- owner: data.owner?.login
1260
- };
1261
- }
1262
- const createGist = (token, { needsApproval = true } = {}) => tool({
1263
- description: "Create a new gist with one or more files",
1264
- needsApproval,
1265
- inputSchema: z.object({
1266
- description: z.string().optional().describe("Gist description"),
1267
- files: z.record(z.string(), z.object({ content: z.string().describe("File content") })).describe("Files to include, keyed by filename"),
1268
- isPublic: z.boolean().optional().default(false).describe("Whether the gist is public")
1269
- }),
1270
- execute: async (args) => createGistStep({
1271
- token,
1272
- ...args
1273
- })
1274
- });
1275
- async function updateGistStep({ token, gistId, description, files, filesToDelete }) {
1276
- "use step";
1277
- const octokit = createOctokit(token);
1278
- const fileUpdates = {};
1279
- if (files) Object.assign(fileUpdates, files);
1280
- if (filesToDelete) for (const name of filesToDelete) fileUpdates[name] = null;
1281
- const { data } = await octokit.rest.gists.update({
1282
- gist_id: gistId,
1283
- description,
1284
- files: fileUpdates
1285
- });
1286
- return {
1287
- id: data.id,
1288
- description: data.description,
1289
- url: data.html_url,
1290
- files: Object.keys(data.files ?? {})
1291
- };
1292
- }
1293
- const updateGist = (token, { needsApproval = true } = {}) => tool({
1294
- description: "Update an existing gist — edit description, update files, or remove files",
1295
- needsApproval,
1296
- inputSchema: z.object({
1297
- gistId: z.string().describe("Gist ID"),
1298
- description: z.string().optional().describe("New gist description"),
1299
- files: z.record(z.string(), z.object({ content: z.string().describe("New file content") })).optional().describe("Files to add or update, keyed by filename"),
1300
- filesToDelete: z.array(z.string()).optional().describe("Filenames to remove from the gist")
1301
- }),
1302
- execute: async (args) => updateGistStep({
1303
- token,
1304
- ...args
1305
- })
1306
- });
1307
- async function deleteGistStep({ token, gistId }) {
1308
- "use step";
1309
- await createOctokit(token).rest.gists.delete({ gist_id: gistId });
1310
- return {
1311
- deleted: true,
1312
- gistId
1313
- };
1314
- }
1315
- const deleteGist = (token, { needsApproval = true } = {}) => tool({
1316
- description: "Delete a gist permanently",
1317
- needsApproval,
1318
- inputSchema: z.object({ gistId: z.string().describe("Gist ID to delete") }),
1319
- execute: async (args) => deleteGistStep({
1320
- token,
1321
- ...args
1322
- })
1323
- });
1324
- async function createGistCommentStep({ token, gistId, body }) {
1325
- "use step";
1326
- const { data } = await createOctokit(token).rest.gists.createComment({
1327
- gist_id: gistId,
1328
- body
1329
- });
1330
- return {
1331
- id: data.id,
1332
- url: data.url,
1333
- body: data.body,
1334
- author: data.user?.login,
1335
- createdAt: data.created_at
1336
- };
1337
- }
1338
- const createGistComment = (token, { needsApproval = true } = {}) => tool({
1339
- description: "Add a comment to a gist",
1340
- needsApproval,
1341
- inputSchema: z.object({
1342
- gistId: z.string().describe("Gist ID"),
1343
- body: z.string().describe("Comment text (supports Markdown)")
1344
- }),
1345
- execute: async (args) => createGistCommentStep({
1346
- token,
1347
- ...args
1348
- })
1349
- });
1350
- //#endregion
1351
- //#region src/tools/workflows.ts
1352
- async function listWorkflowsStep({ token, owner, repo, perPage, page }) {
1353
- "use step";
1354
- const { data } = await createOctokit(token).rest.actions.listRepoWorkflows({
1355
- owner,
1356
- repo,
1357
- per_page: perPage,
1358
- page
1359
- });
1360
- return {
1361
- totalCount: data.total_count,
1362
- workflows: data.workflows.map((wf) => ({
1363
- id: wf.id,
1364
- name: wf.name,
1365
- path: wf.path,
1366
- state: wf.state,
1367
- url: wf.html_url,
1368
- createdAt: wf.created_at,
1369
- updatedAt: wf.updated_at
1370
- }))
1371
- };
1372
- }
1373
- const listWorkflows = (token) => tool({
1374
- description: "List GitHub Actions workflows in a repository",
1375
- inputSchema: z.object({
1376
- owner: z.string().describe("Repository owner"),
1377
- repo: z.string().describe("Repository name"),
1378
- perPage: z.number().optional().default(30).describe("Number of results to return (max 100)"),
1379
- page: z.number().optional().default(1).describe("Page number for pagination")
1380
- }),
1381
- execute: async (args) => listWorkflowsStep({
1382
- token,
1383
- ...args
1384
- })
1385
- });
1386
- async function listWorkflowRunsStep({ token, owner, repo, workflowId, branch, event, status, perPage, page }) {
1387
- "use step";
1388
- const octokit = createOctokit(token);
1389
- const { data } = workflowId ? await octokit.rest.actions.listWorkflowRuns({
1390
- owner,
1391
- repo,
1392
- workflow_id: workflowId,
1393
- per_page: perPage,
1394
- page,
1395
- ...branch && { branch },
1396
- ...event && { event },
1397
- ...status && { status }
1398
- }) : await octokit.rest.actions.listWorkflowRunsForRepo({
1399
- owner,
1400
- repo,
1401
- per_page: perPage,
1402
- page,
1403
- ...branch && { branch },
1404
- ...event && { event },
1405
- ...status && { status }
1406
- });
1407
- return {
1408
- totalCount: data.total_count,
1409
- runs: data.workflow_runs.map((run) => ({
1410
- id: run.id,
1411
- name: run.name,
1412
- status: run.status,
1413
- conclusion: run.conclusion,
1414
- branch: run.head_branch,
1415
- event: run.event,
1416
- url: run.html_url,
1417
- actor: run.actor?.login,
1418
- createdAt: run.created_at,
1419
- updatedAt: run.updated_at,
1420
- runNumber: run.run_number,
1421
- runAttempt: run.run_attempt
1422
- }))
1423
- };
1424
- }
1425
- const listWorkflowRuns = (token) => tool({
1426
- description: "List workflow runs for a repository, optionally filtered by workflow, branch, status, or event",
1427
- inputSchema: z.object({
1428
- owner: z.string().describe("Repository owner"),
1429
- repo: z.string().describe("Repository name"),
1430
- workflowId: z.union([z.string(), z.number()]).optional().describe("Workflow ID or filename (e.g. \"ci.yml\") to filter by"),
1431
- branch: z.string().optional().describe("Branch name to filter by"),
1432
- event: z.string().optional().describe("Event type to filter by (e.g. \"push\", \"pull_request\")"),
1433
- status: z.enum([
1434
- "completed",
1435
- "action_required",
1436
- "cancelled",
1437
- "failure",
1438
- "neutral",
1439
- "skipped",
1440
- "stale",
1441
- "success",
1442
- "timed_out",
1443
- "in_progress",
1444
- "queued",
1445
- "requested",
1446
- "waiting",
1447
- "pending"
1448
- ]).optional().describe("Status to filter by"),
1449
- perPage: z.number().optional().default(30).describe("Number of results to return (max 100)"),
1450
- page: z.number().optional().default(1).describe("Page number for pagination")
1451
- }),
1452
- execute: async (args) => listWorkflowRunsStep({
1453
- token,
1454
- ...args
1455
- })
1456
- });
1457
- async function getWorkflowRunStep({ token, owner, repo, runId }) {
1458
- "use step";
1459
- const { data } = await createOctokit(token).rest.actions.getWorkflowRun({
1460
- owner,
1461
- repo,
1462
- run_id: runId
1463
- });
1464
- return {
1465
- id: data.id,
1466
- name: data.name,
1467
- status: data.status,
1468
- conclusion: data.conclusion,
1469
- branch: data.head_branch,
1470
- sha: data.head_sha,
1471
- event: data.event,
1472
- url: data.html_url,
1473
- actor: data.actor?.login,
1474
- runNumber: data.run_number,
1475
- runAttempt: data.run_attempt,
1476
- createdAt: data.created_at,
1477
- updatedAt: data.updated_at,
1478
- runStartedAt: data.run_started_at
1479
- };
1480
- }
1481
- const getWorkflowRun = (token) => tool({
1482
- description: "Get details of a specific workflow run including status, timing, and trigger info",
1483
- inputSchema: z.object({
1484
- owner: z.string().describe("Repository owner"),
1485
- repo: z.string().describe("Repository name"),
1486
- runId: z.number().describe("Workflow run ID")
1487
- }),
1488
- execute: async (args) => getWorkflowRunStep({
1489
- token,
1490
- ...args
1491
- })
1492
- });
1493
- async function listWorkflowJobsStep({ token, owner, repo, runId, filter, perPage, page }) {
1494
- "use step";
1495
- const { data } = await createOctokit(token).rest.actions.listJobsForWorkflowRun({
1496
- owner,
1497
- repo,
1498
- run_id: runId,
1499
- filter,
1500
- per_page: perPage,
1501
- page
1502
- });
1503
- return {
1504
- totalCount: data.total_count,
1505
- jobs: data.jobs.map((job) => ({
1506
- id: job.id,
1507
- name: job.name,
1508
- status: job.status,
1509
- conclusion: job.conclusion,
1510
- url: job.html_url,
1511
- startedAt: job.started_at,
1512
- completedAt: job.completed_at,
1513
- runnerName: job.runner_name,
1514
- steps: job.steps?.map((step) => ({
1515
- name: step.name,
1516
- status: step.status,
1517
- conclusion: step.conclusion,
1518
- number: step.number,
1519
- startedAt: step.started_at,
1520
- completedAt: step.completed_at
1521
- }))
1522
- }))
1523
- };
1524
- }
1525
- const listWorkflowJobs = (token) => tool({
1526
- description: "List jobs for a workflow run, including step-level status and timing",
1527
- inputSchema: z.object({
1528
- owner: z.string().describe("Repository owner"),
1529
- repo: z.string().describe("Repository name"),
1530
- runId: z.number().describe("Workflow run ID"),
1531
- filter: z.enum(["latest", "all"]).optional().default("latest").describe("Filter by the latest attempt or all attempts"),
1532
- perPage: z.number().optional().default(30).describe("Number of results to return (max 100)"),
1533
- page: z.number().optional().default(1).describe("Page number for pagination")
1534
- }),
1535
- execute: async (args) => listWorkflowJobsStep({
1536
- token,
1537
- ...args
1538
- })
1539
- });
1540
- async function triggerWorkflowStep({ token, owner, repo, workflowId, ref, inputs }) {
1541
- "use step";
1542
- await createOctokit(token).rest.actions.createWorkflowDispatch({
1543
- owner,
1544
- repo,
1545
- workflow_id: workflowId,
1546
- ref,
1547
- inputs
1548
- });
1549
- return {
1550
- triggered: true,
1551
- workflowId,
1552
- ref
1553
- };
1554
- }
1555
- const triggerWorkflow = (token, { needsApproval = true } = {}) => tool({
1556
- description: "Trigger a workflow via workflow_dispatch event",
1557
- needsApproval,
1558
- inputSchema: z.object({
1559
- owner: z.string().describe("Repository owner"),
1560
- repo: z.string().describe("Repository name"),
1561
- workflowId: z.union([z.string(), z.number()]).describe("Workflow ID or filename (e.g. \"deploy.yml\")"),
1562
- ref: z.string().describe("Git ref (branch or tag) to run the workflow on"),
1563
- inputs: z.record(z.string(), z.string()).optional().describe("Input parameters defined in the workflow_dispatch trigger")
1564
- }),
1565
- execute: async (args) => triggerWorkflowStep({
1566
- token,
1567
- ...args
1568
- })
1569
- });
1570
- async function cancelWorkflowRunStep({ token, owner, repo, runId }) {
1571
- "use step";
1572
- await createOctokit(token).rest.actions.cancelWorkflowRun({
1573
- owner,
1574
- repo,
1575
- run_id: runId
1576
- });
1577
- return {
1578
- cancelled: true,
1579
- runId
1580
- };
1581
- }
1582
- const cancelWorkflowRun = (token, { needsApproval = true } = {}) => tool({
1583
- description: "Cancel an in-progress workflow run",
1584
- needsApproval,
1585
- inputSchema: z.object({
1586
- owner: z.string().describe("Repository owner"),
1587
- repo: z.string().describe("Repository name"),
1588
- runId: z.number().describe("Workflow run ID to cancel")
1589
- }),
1590
- execute: async (args) => cancelWorkflowRunStep({
1591
- token,
1592
- ...args
1593
- })
1594
- });
1595
- async function rerunWorkflowRunStep({ token, owner, repo, runId, onlyFailedJobs }) {
1596
- "use step";
1597
- const octokit = createOctokit(token);
1598
- if (onlyFailedJobs) await octokit.rest.actions.reRunWorkflowFailedJobs({
1599
- owner,
1600
- repo,
1601
- run_id: runId
1602
- });
1603
- else await octokit.rest.actions.reRunWorkflow({
1604
- owner,
1605
- repo,
1606
- run_id: runId
1607
- });
1608
- return {
1609
- rerun: true,
1610
- runId,
1611
- onlyFailedJobs
1612
- };
1613
- }
1614
- const rerunWorkflowRun = (token, { needsApproval = true } = {}) => tool({
1615
- description: "Re-run a workflow run, optionally only the failed jobs",
1616
- needsApproval,
1617
- inputSchema: z.object({
1618
- owner: z.string().describe("Repository owner"),
1619
- repo: z.string().describe("Repository name"),
1620
- runId: z.number().describe("Workflow run ID to re-run"),
1621
- onlyFailedJobs: z.boolean().optional().default(false).describe("Only re-run failed jobs instead of the entire workflow")
1622
- }),
1623
- execute: async (args) => rerunWorkflowRunStep({
1624
- token,
1625
- ...args
1626
- })
1627
- });
1628
- //#endregion
1629
- //#region src/agents.ts
1630
- const SHARED_RULES = `When a tool execution is denied by the user, do not retry it. Briefly acknowledge the decision and move on.`;
1631
- 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.
1632
-
1633
- ${SHARED_RULES}`;
1634
- const PRESET_INSTRUCTIONS = {
1635
- "code-review": `You are a code review assistant. Your job is to review pull requests thoroughly and provide constructive feedback.
1636
-
1637
- When reviewing a PR:
1638
- - Read the PR description and changed files carefully
1639
- - 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
1640
- - Check for bugs, logic errors, and edge cases
1641
- - Suggest improvements when you spot issues
1642
- - Be constructive — explain why something is a problem and how to fix it
1643
- - Use listPullRequestFiles to see exactly which files changed before diving into details
1644
- - Use createPullRequestReview to submit a formal review with inline comments on specific lines
1645
- - Post your review as PR comments when asked
1646
-
1647
- ${SHARED_RULES}`,
1648
- "issue-triage": `You are an issue triage assistant. Your job is to help manage and organize GitHub issues.
1649
-
1650
- When triaging issues:
1651
- - Read issue descriptions carefully to understand the problem
1652
- - Identify duplicates when possible
1653
- - Help categorize and prioritize issues
1654
- - Respond to users with clear, helpful information
1655
- - Use listLabels to see available labels, then addLabels and removeLabel to categorize issues
1656
- - Create new issues when asked, with clear titles and descriptions
1657
-
1658
- ${SHARED_RULES}`,
1659
- "ci-ops": `You are a CI/CD operations assistant. Your job is to help monitor and manage GitHub Actions workflows.
1660
-
1661
- When working with workflows:
1662
- - Check workflow run status and report failures clearly
1663
- - Inspect job steps to identify exactly where a run failed
1664
- - Re-run failed workflows when asked
1665
- - Trigger workflow dispatches with the correct inputs and branch
1666
- - Be careful with cancel and re-run operations — confirm the target run
1667
- - Summarize run history and trends when asked
1668
-
1669
- ${SHARED_RULES}`,
1670
- "repo-explorer": `You are a repository explorer. Your job is to help users understand codebases and find information across GitHub repositories.
1671
-
1672
- When exploring repos:
1673
- - Answer questions about code structure and organization
1674
- - Use getBlame when the user asks about history or ownership of specific lines in a file
1675
- - Summarize recent activity (commits, PRs, issues)
1676
- - Find specific files, functions, or patterns in code
1677
- - Explain how different parts of the codebase work together
1678
- - You have read-only access — you cannot make changes
1679
-
1680
- ${SHARED_RULES}`,
1681
- "maintainer": `You are a repository maintainer assistant. You have full access to manage repositories, issues, pull requests, gists, and workflows.
1682
-
1683
- When maintaining repos:
1684
- - Be careful with write operations — review before acting
1685
- - Create well-structured issues and PRs with clear descriptions
1686
- - Use merge strategies appropriate for the repository
1687
- - Keep commit messages clean and descriptive
1688
- - When closing issues, provide a clear reason
1689
-
1690
- ${SHARED_RULES}`
1691
- };
1692
- function resolveInstructions(options) {
1693
- const defaultPrompt = options.preset && !Array.isArray(options.preset) ? PRESET_INSTRUCTIONS[options.preset] : DEFAULT_INSTRUCTIONS;
1694
- if (options.instructions) return options.instructions;
1695
- if (options.additionalInstructions) return `${defaultPrompt}\n\n${options.additionalInstructions}`;
1696
- return defaultPrompt;
1697
- }
1698
- /**
1699
- * Create a pre-configured GitHub agent powered by the AI SDK's `ToolLoopAgent`.
1700
- *
1701
- * Returns a `ToolLoopAgent` instance with `.generate()` and `.stream()` methods.
1702
- *
1703
- * @example
1704
- * ```ts
1705
- * import { createGithubAgent } from '@github-tools/sdk'
1706
- *
1707
- * const agent = createGithubAgent({
1708
- * model: 'anthropic/claude-sonnet-4.6',
1709
- * token: process.env.GITHUB_TOKEN!,
1710
- * preset: 'code-review',
1711
- * })
1712
- *
1713
- * const result = await agent.generate({ prompt: 'Review PR #42 on vercel/ai' })
1714
- * ```
1715
- */
1716
- function createGithubAgent({ token, preset, requireApproval, instructions, additionalInstructions, author, committer, coAuthors, ...agentOptions }) {
1717
- const tools = createGithubTools({
1718
- token,
1719
- requireApproval,
1720
- preset,
1721
- author,
1722
- committer,
1723
- coAuthors
1724
- });
1725
- return new ToolLoopAgent({
1726
- ...agentOptions,
1727
- tools,
1728
- instructions: resolveInstructions({
1729
- preset,
1730
- instructions,
1731
- additionalInstructions
1732
- })
1733
- });
1734
- }
1735
- //#endregion
1736
- //#region src/index.ts
1737
- const PRESET_TOOLS = {
1738
- "code-review": [
1739
- "getPullRequest",
1740
- "listPullRequests",
1741
- "listPullRequestFiles",
1742
- "listPullRequestReviews",
1743
- "getFileContent",
1744
- "listCommits",
1745
- "getCommit",
1746
- "getBlame",
1747
- "getRepository",
1748
- "listBranches",
1749
- "searchCode",
1750
- "addPullRequestComment",
1751
- "createPullRequestReview"
1752
- ],
1753
- "issue-triage": [
1754
- "listIssues",
1755
- "getIssue",
1756
- "createIssue",
1757
- "addIssueComment",
1758
- "closeIssue",
1759
- "listLabels",
1760
- "addLabels",
1761
- "removeLabel",
1762
- "getRepository",
1763
- "searchRepositories",
1764
- "searchCode"
1765
- ],
1766
- "ci-ops": [
1767
- "getRepository",
1768
- "listBranches",
1769
- "listCommits",
1770
- "getCommit",
1771
- "listWorkflows",
1772
- "listWorkflowRuns",
1773
- "getWorkflowRun",
1774
- "listWorkflowJobs",
1775
- "triggerWorkflow",
1776
- "cancelWorkflowRun",
1777
- "rerunWorkflowRun"
1778
- ],
1779
- "repo-explorer": [
1780
- "getRepository",
1781
- "listBranches",
1782
- "getFileContent",
1783
- "listPullRequests",
1784
- "getPullRequest",
1785
- "listPullRequestFiles",
1786
- "listPullRequestReviews",
1787
- "listIssues",
1788
- "getIssue",
1789
- "listLabels",
1790
- "listCommits",
1791
- "getCommit",
1792
- "getBlame",
1793
- "searchCode",
1794
- "searchRepositories",
1795
- "listGists",
1796
- "getGist",
1797
- "listGistComments",
1798
- "listWorkflows",
1799
- "listWorkflowRuns",
1800
- "getWorkflowRun",
1801
- "listWorkflowJobs"
1802
- ],
1803
- "maintainer": [
1804
- "getRepository",
1805
- "listBranches",
1806
- "getFileContent",
1807
- "createBranch",
1808
- "forkRepository",
1809
- "createRepository",
1810
- "createOrUpdateFile",
1811
- "listPullRequests",
1812
- "getPullRequest",
1813
- "listPullRequestFiles",
1814
- "listPullRequestReviews",
1815
- "createPullRequest",
1816
- "mergePullRequest",
1817
- "addPullRequestComment",
1818
- "createPullRequestReview",
1819
- "listIssues",
1820
- "getIssue",
1821
- "createIssue",
1822
- "addIssueComment",
1823
- "closeIssue",
1824
- "listLabels",
1825
- "addLabels",
1826
- "removeLabel",
1827
- "listCommits",
1828
- "getCommit",
1829
- "getBlame",
1830
- "searchCode",
1831
- "searchRepositories",
1832
- "listGists",
1833
- "getGist",
1834
- "listGistComments",
1835
- "createGist",
1836
- "updateGist",
1837
- "deleteGist",
1838
- "createGistComment",
1839
- "listWorkflows",
1840
- "listWorkflowRuns",
1841
- "getWorkflowRun",
1842
- "listWorkflowJobs",
1843
- "triggerWorkflow",
1844
- "cancelWorkflowRun",
1845
- "rerunWorkflowRun"
1846
- ]
1847
- };
1848
- function resolveApproval(toolName, config) {
1849
- if (typeof config === "boolean") return config;
1850
- return config[toolName] ?? true;
1851
- }
1852
- function resolvePresetTools(preset) {
1853
- if (!preset) return null;
1854
- const presets = Array.isArray(preset) ? preset : [preset];
1855
- const tools = /* @__PURE__ */ new Set();
1856
- for (const p of presets) for (const t of PRESET_TOOLS[p]) tools.add(t);
1857
- return tools;
1858
- }
1859
- /**
1860
- * Create a set of GitHub tools for the Vercel AI SDK.
1861
- *
1862
- * Write operations require user approval by default.
1863
- * Control this globally or per-tool via `requireApproval`.
1864
- * Use `preset` to get only the tools you need.
1865
- *
1866
- * @example
1867
- * ```ts
1868
- * // All tools (default)
1869
- * createGithubTools({ token })
1870
- *
1871
- * // Code-review agent — only PR & commit tools
1872
- * createGithubTools({ token, preset: 'code-review' })
1873
- *
1874
- * // Combine presets
1875
- * createGithubTools({ token, preset: ['code-review', 'issue-triage'] })
1876
- *
1877
- * // Granular approval
1878
- * createGithubTools({
1879
- * token,
1880
- * preset: 'maintainer',
1881
- * requireApproval: {
1882
- * mergePullRequest: true,
1883
- * createOrUpdateFile: true,
1884
- * addPullRequestComment: false,
1885
- * }
1886
- * })
1887
- * ```
1888
- */
1889
- function createGithubTools({ token, requireApproval = true, preset, overrides, author, committer, coAuthors } = {}) {
1890
- const resolvedToken = token || process.env.GITHUB_TOKEN;
1891
- if (!resolvedToken) throw new Error("GitHub token is required. Pass it as `token` or set the GITHUB_TOKEN environment variable.");
1892
- const approval = (name) => ({ needsApproval: resolveApproval(name, requireApproval) });
1893
- const allowed = preset ? resolvePresetTools(preset) : null;
1894
- const allTools = {
1895
- getRepository: getRepository(resolvedToken),
1896
- listBranches: listBranches(resolvedToken),
1897
- getFileContent: getFileContent(resolvedToken),
1898
- listPullRequests: listPullRequests(resolvedToken),
1899
- getPullRequest: getPullRequest(resolvedToken),
1900
- listIssues: listIssues(resolvedToken),
1901
- getIssue: getIssue(resolvedToken),
1902
- searchCode: searchCode(resolvedToken),
1903
- searchRepositories: searchRepositories(resolvedToken),
1904
- listCommits: listCommits(resolvedToken),
1905
- getCommit: getCommit(resolvedToken),
1906
- getBlame: getBlame(resolvedToken),
1907
- createBranch: createBranch(resolvedToken, approval("createBranch")),
1908
- forkRepository: forkRepository(resolvedToken, approval("forkRepository")),
1909
- createRepository: createRepository(resolvedToken, approval("createRepository")),
1910
- createOrUpdateFile: createOrUpdateFile(resolvedToken, {
1911
- ...approval("createOrUpdateFile"),
1912
- author,
1913
- committer,
1914
- coAuthors
1915
- }),
1916
- createPullRequest: createPullRequest(resolvedToken, approval("createPullRequest")),
1917
- mergePullRequest: mergePullRequest(resolvedToken, {
1918
- ...approval("mergePullRequest"),
1919
- coAuthors
1920
- }),
1921
- addPullRequestComment: addPullRequestComment(resolvedToken, approval("addPullRequestComment")),
1922
- listPullRequestFiles: listPullRequestFiles(resolvedToken),
1923
- listPullRequestReviews: listPullRequestReviews(resolvedToken),
1924
- createPullRequestReview: createPullRequestReview(resolvedToken, approval("createPullRequestReview")),
1925
- createIssue: createIssue(resolvedToken, approval("createIssue")),
1926
- addIssueComment: addIssueComment(resolvedToken, approval("addIssueComment")),
1927
- closeIssue: closeIssue(resolvedToken, approval("closeIssue")),
1928
- listLabels: listLabels(resolvedToken),
1929
- addLabels: addLabels(resolvedToken, approval("addLabels")),
1930
- removeLabel: removeLabel(resolvedToken, approval("removeLabel")),
1931
- listGists: listGists(resolvedToken),
1932
- getGist: getGist(resolvedToken),
1933
- listGistComments: listGistComments(resolvedToken),
1934
- createGist: createGist(resolvedToken, approval("createGist")),
1935
- updateGist: updateGist(resolvedToken, approval("updateGist")),
1936
- deleteGist: deleteGist(resolvedToken, approval("deleteGist")),
1937
- createGistComment: createGistComment(resolvedToken, approval("createGistComment")),
1938
- listWorkflows: listWorkflows(resolvedToken),
1939
- listWorkflowRuns: listWorkflowRuns(resolvedToken),
1940
- getWorkflowRun: getWorkflowRun(resolvedToken),
1941
- listWorkflowJobs: listWorkflowJobs(resolvedToken),
1942
- triggerWorkflow: triggerWorkflow(resolvedToken, approval("triggerWorkflow")),
1943
- cancelWorkflowRun: cancelWorkflowRun(resolvedToken, approval("cancelWorkflowRun")),
1944
- rerunWorkflowRun: rerunWorkflowRun(resolvedToken, approval("rerunWorkflowRun"))
1945
- };
1946
- if (overrides) {
1947
- for (const [name, toolOverrides] of Object.entries(overrides)) if (name in allTools && toolOverrides) {
1948
- const key = name;
1949
- Object.assign(allTools, { [key]: {
1950
- ...allTools[key],
1951
- ...toolOverrides
1952
- } });
1953
- }
1954
- }
1955
- if (!allowed) return allTools;
1956
- return Object.fromEntries(Object.entries(allTools).filter(([name]) => allowed.has(name)));
1957
- }
1958
- //#endregion
1959
- 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, createOctokit as K, 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 };
1960
-
1961
- //# sourceMappingURL=src--pAdGYqY.mjs.map