@github-tools/sdk 1.1.0 → 1.2.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.
package/LICENSE CHANGED
@@ -1,201 +1,21 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for reasonable and customary use in describing the
141
- origin of the Work and reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS
177
-
178
- APPENDIX: How to apply the Apache License to your work.
179
-
180
- To apply the Apache License to your work, attach the following
181
- boilerplate notice, with the fields enclosed by brackets "[]"
182
- replaced with your own identifying information. (Don't include
183
- the brackets!) The text should be enclosed in the appropriate
184
- comment syntax for the file format. We also recommend that a
185
- file or class name and description of purpose be included on the
186
- same "printed page" as the copyright notice for easier
187
- identification within third-party archives.
188
-
189
- Copyright 2024-present Hugo Richard
190
-
191
- Licensed under the Apache License, Version 2.0 (the "License");
192
- you may not use this file except in compliance with the License.
193
- You may obtain a copy of the License at
194
-
195
- http://www.apache.org/licenses/LICENSE-2.0
196
-
197
- Unless required by applicable law or agreed to in writing, software
198
- distributed under the License is distributed on an "AS IS" BASIS,
199
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
- See the License for the specific language governing permissions and
201
- limitations under the License.
1
+ MIT License
2
+
3
+ Copyright (c) 2024-present Vercel, Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [![npm version](https://img.shields.io/npm/v/@github-tools/sdk?color=black)](https://npmjs.com/package/@github-tools/sdk)
4
4
  [![npm downloads](https://img.shields.io/npm/dm/@github-tools/sdk?color=black)](https://npm.chart.dev/@github-tools/sdk)
5
5
  [![TypeScript](https://img.shields.io/badge/TypeScript-black?logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
6
- [![license](https://img.shields.io/github/license/HugoRCD/github-tools?color=black)](https://github.com/HugoRCD/github-tools/blob/main/LICENSE)
6
+ [![license](https://img.shields.io/github/license/vercel-labs/github-tools?color=black)](https://github.com/vercel-labs/github-tools/blob/main/LICENSE)
7
7
 
8
8
  GitHub tools for the [AI SDK](https://ai-sdk.dev) — wrap GitHub's REST API as ready-to-use tools for any agent or `generateText` / `streamText` call.
9
9
 
@@ -209,20 +209,20 @@ import { createGithubAgent } from '@github-tools/sdk'
209
209
 
210
210
  // Minimal — all tools, generic prompt
211
211
  const agent = createGithubAgent({
212
- model: 'anthropic/claude-sonnet-4-6',
212
+ model: 'anthropic/claude-sonnet-4.6',
213
213
  token: process.env.GITHUB_TOKEN!,
214
214
  })
215
215
 
216
216
  // With preset — scoped tools + tailored prompt
217
217
  const reviewer = createGithubAgent({
218
- model: 'anthropic/claude-sonnet-4-6',
218
+ model: 'anthropic/claude-sonnet-4.6',
219
219
  token: process.env.GITHUB_TOKEN!,
220
220
  preset: 'code-review',
221
221
  })
222
222
 
223
223
  // Add context to the built-in prompt
224
224
  const triager = createGithubAgent({
225
- model: 'anthropic/claude-sonnet-4-6',
225
+ model: 'anthropic/claude-sonnet-4.6',
226
226
  token: process.env.GITHUB_TOKEN!,
227
227
  preset: 'issue-triage',
228
228
  additionalInstructions: 'Focus on the nuxt/ui repository. Always respond in French.',
@@ -230,7 +230,7 @@ const triager = createGithubAgent({
230
230
 
231
231
  // Full override — replace the built-in prompt entirely
232
232
  const custom = createGithubAgent({
233
- model: 'anthropic/claude-sonnet-4-6',
233
+ model: 'anthropic/claude-sonnet-4.6',
234
234
  token: process.env.GITHUB_TOKEN!,
235
235
  instructions: 'You are a security auditor. Only flag security-related issues.',
236
236
  })
@@ -242,7 +242,7 @@ const stream = reviewer.stream({ prompt: 'Review PR #42 on vercel/ai' })
242
242
 
243
243
  | Option | Description |
244
244
  |---|---|
245
- | `model` | Language model — string (`'anthropic/claude-sonnet-4-6'`) or provider instance |
245
+ | `model` | Language model — string (`'anthropic/claude-sonnet-4.6'`) or provider instance |
246
246
  | `token` | GitHub personal access token |
247
247
  | `preset` | Optional preset or array of presets to scope tools |
248
248
  | `requireApproval` | Approval config (same as `createGithubTools`) |
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { Octokit, Octokit as Octokit$1 } from "@octokit/rest";
1
+ import { Octokit, Octokit as Octokit$1 } from "octokit";
2
2
  import * as ai from "ai";
3
3
  import { ToolLoopAgent, ToolLoopAgentSettings } from "ai";
4
4
 
@@ -68,6 +68,59 @@ declare const getFileContent: (octokit: Octokit) => ai.Tool<{
68
68
  content: string;
69
69
  entries?: undefined;
70
70
  }>;
71
+ declare const createBranch: (octokit: Octokit, {
72
+ needsApproval
73
+ }?: ToolOptions) => ai.Tool<{
74
+ owner: string;
75
+ repo: string;
76
+ branch: string;
77
+ from?: string | undefined;
78
+ }, {
79
+ ref: string;
80
+ sha: string;
81
+ url: string;
82
+ }>;
83
+ declare const forkRepository: (octokit: Octokit, {
84
+ needsApproval
85
+ }?: ToolOptions) => ai.Tool<{
86
+ owner: string;
87
+ repo: string;
88
+ organization?: string | undefined;
89
+ name?: string | undefined;
90
+ }, {
91
+ name: string;
92
+ fullName: string;
93
+ url: string;
94
+ cloneUrl: string;
95
+ sshUrl: string;
96
+ defaultBranch: string;
97
+ private: boolean;
98
+ parent: {
99
+ fullName: string;
100
+ url: string;
101
+ } | null;
102
+ }>;
103
+ declare const createRepository: (octokit: Octokit, {
104
+ needsApproval
105
+ }?: ToolOptions) => ai.Tool<{
106
+ name: string;
107
+ isPrivate: boolean;
108
+ autoInit: boolean;
109
+ description?: string | undefined;
110
+ gitignoreTemplate?: string | undefined;
111
+ licenseTemplate?: string | undefined;
112
+ org?: string | undefined;
113
+ }, {
114
+ name: string;
115
+ fullName: string;
116
+ description: string | null;
117
+ url: string;
118
+ cloneUrl: string;
119
+ sshUrl: string;
120
+ defaultBranch: string;
121
+ private: boolean;
122
+ createdAt: string;
123
+ }>;
71
124
  declare const createOrUpdateFile: (octokit: Octokit, {
72
125
  needsApproval
73
126
  }?: ToolOptions) => ai.Tool<{
@@ -354,7 +407,7 @@ type CreateGithubAgentOptions = AgentOptions & {
354
407
  * import { createGithubAgent } from '@github-tools/sdk'
355
408
  *
356
409
  * const agent = createGithubAgent({
357
- * model: 'anthropic/claude-sonnet-4-6',
410
+ * model: 'anthropic/claude-sonnet-4.6',
358
411
  * token: process.env.GITHUB_TOKEN!,
359
412
  * preset: 'code-review',
360
413
  * })
@@ -372,7 +425,7 @@ declare function createGithubAgent({
372
425
  }: CreateGithubAgentOptions): ToolLoopAgent<never, {}, never>;
373
426
  //#endregion
374
427
  //#region src/index.d.ts
375
- type GithubWriteToolName = 'createOrUpdateFile' | 'createPullRequest' | 'mergePullRequest' | 'addPullRequestComment' | 'createIssue' | 'addIssueComment' | 'closeIssue';
428
+ type GithubWriteToolName = 'createBranch' | 'forkRepository' | 'createRepository' | 'createOrUpdateFile' | 'createPullRequest' | 'mergePullRequest' | 'addPullRequestComment' | 'createIssue' | 'addIssueComment' | 'closeIssue';
376
429
  /**
377
430
  * Whether write operations require user approval.
378
431
  * - `true` — all write tools need approval (default)
@@ -659,6 +712,53 @@ declare function createGithubTools({
659
712
  patch: string | undefined;
660
713
  }[] | undefined;
661
714
  }>;
715
+ createBranch: ai.Tool<{
716
+ owner: string;
717
+ repo: string;
718
+ branch: string;
719
+ from?: string | undefined;
720
+ }, {
721
+ ref: string;
722
+ sha: string;
723
+ url: string;
724
+ }>;
725
+ forkRepository: ai.Tool<{
726
+ owner: string;
727
+ repo: string;
728
+ organization?: string | undefined;
729
+ name?: string | undefined;
730
+ }, {
731
+ name: string;
732
+ fullName: string;
733
+ url: string;
734
+ cloneUrl: string;
735
+ sshUrl: string;
736
+ defaultBranch: string;
737
+ private: boolean;
738
+ parent: {
739
+ fullName: string;
740
+ url: string;
741
+ } | null;
742
+ }>;
743
+ createRepository: ai.Tool<{
744
+ name: string;
745
+ isPrivate: boolean;
746
+ autoInit: boolean;
747
+ description?: string | undefined;
748
+ gitignoreTemplate?: string | undefined;
749
+ licenseTemplate?: string | undefined;
750
+ org?: string | undefined;
751
+ }, {
752
+ name: string;
753
+ fullName: string;
754
+ description: string | null;
755
+ url: string;
756
+ cloneUrl: string;
757
+ sshUrl: string;
758
+ defaultBranch: string;
759
+ private: boolean;
760
+ createdAt: string;
761
+ }>;
662
762
  createOrUpdateFile: ai.Tool<{
663
763
  owner: string;
664
764
  repo: string;
@@ -755,5 +855,5 @@ declare function createGithubTools({
755
855
  }>;
756
856
  type GithubTools = ReturnType<typeof createGithubTools>;
757
857
  //#endregion
758
- export { ApprovalConfig, type CreateGithubAgentOptions, GithubToolPreset, GithubTools, GithubToolsOptions, GithubWriteToolName, type Octokit, type ToolOptions, addIssueComment, addPullRequestComment, closeIssue, createGithubAgent, createGithubTools, createIssue, createOctokit, createOrUpdateFile, createPullRequest, getCommit, getFileContent, getIssue, getPullRequest, getRepository, listBranches, listCommits, listIssues, listPullRequests, mergePullRequest, searchCode, searchRepositories };
858
+ export { ApprovalConfig, type CreateGithubAgentOptions, GithubToolPreset, GithubTools, GithubToolsOptions, GithubWriteToolName, type Octokit, type ToolOptions, addIssueComment, addPullRequestComment, closeIssue, createBranch, createGithubAgent, createGithubTools, createIssue, createOctokit, createOrUpdateFile, createPullRequest, createRepository, forkRepository, getCommit, getFileContent, getIssue, getPullRequest, getRepository, listBranches, listCommits, listIssues, listPullRequests, mergePullRequest, searchCode, searchRepositories };
759
859
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/client.ts","../src/types.ts","../src/tools/repository.ts","../src/tools/pull-requests.ts","../src/tools/issues.ts","../src/tools/search.ts","../src/tools/commits.ts","../src/agents.ts","../src/index.ts"],"mappings":";;;;;iBAEgB,aAAA,CAAc,KAAA,WAAgB,SAAA;;;KCAlC,WAAA;EAAgB,aAAA;AAAA;;;cCEf,aAAA,GAAiB,OAAA,EAAS,OAAA,KAAO,EAAA,CAAA,IAAA;;;;;;;;;;;;;;;;;cA0BjC,YAAA,GAAgB,OAAA,EAAS,OAAA,KAAO,EAAA,CAAA,IAAA;;;;;;;;;cAkBhC,cAAA,GAAkB,OAAA,EAAS,OAAA,KAAO,EAAA,CAAA,IAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA4BlC,kBAAA,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAqCxF,WAAA,GAAc,UAAA,QAAkB,iBAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/client.ts","../src/types.ts","../src/tools/repository.ts","../src/tools/pull-requests.ts","../src/tools/issues.ts","../src/tools/search.ts","../src/tools/commits.ts","../src/agents.ts","../src/index.ts"],"mappings":";;;;;iBAEgB,aAAA,CAAc,KAAA,WAAgB,SAAA;;;KCAlC,WAAA;EAAgB,aAAA;AAAA;;;cCEf,aAAA,GAAiB,OAAA,EAAS,OAAA,KAAO,EAAA,CAAA,IAAA;;;;;;;;;;;;;;;;;cA0BjC,YAAA,GAAgB,OAAA,EAAS,OAAA,KAAO,EAAA,CAAA,IAAA;;;;;;;;;cAkBhC,cAAA,GAAkB,OAAA,EAAS,OAAA,KAAO,EAAA,CAAA,IAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA4BlC,YAAA,GAAgB,OAAA,EAAS,OAAA;EAAS;AAAA,IAA0B,WAAA,KAAgB,EAAA,CAAA,IAAA;;;;;;;;;;cAkC5E,cAAA,GAAkB,OAAA,EAAS,OAAA;EAAS;AAAA,IAA0B,WAAA,KAAgB,EAAA,CAAA,IAAA;;;;;;;;;;;;;;;;;;cA8B9E,gBAAA,GAAoB,OAAA,EAAS,OAAA;EAAS;AAAA,IAA0B,WAAA,KAAgB,EAAA,CAAA,IAAA;;;;;;;;;;;;;;;;;;;cAyChF,kBAAA,GAAsB,OAAA,EAAS,OAAA;EAAS;AAAA,IAA0B,WAAA,KAAgB,EAAA,CAAA,IAAA;;;;;;;;;;;;;;;;cCjLlF,gBAAA,GAAoB,OAAA,EAAS,OAAA,KAAO,EAAA,CAAA,IAAA;;;;;;;;;;;;;;;;;cA0BpC,cAAA,GAAkB,OAAA,EAAS,OAAA,KAAO,EAAA,CAAA,IAAA;;;;;;;;;;;;;;;;;;;;;;;cAgCl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  import { ToolLoopAgent, tool } from "ai";
3
3
  import { z } from "zod";
4
4
 
@@ -16,7 +16,7 @@ const getRepository = (octokit) => tool({
16
16
  repo: z.string().describe("Repository name")
17
17
  }),
18
18
  execute: async ({ owner, repo }) => {
19
- const { data } = await octokit.repos.get({
19
+ const { data } = await octokit.rest.repos.get({
20
20
  owner,
21
21
  repo
22
22
  });
@@ -44,7 +44,7 @@ const listBranches = (octokit) => tool({
44
44
  perPage: z.number().optional().default(30).describe("Number of branches to return (max 100)")
45
45
  }),
46
46
  execute: async ({ owner, repo, perPage }) => {
47
- const { data } = await octokit.repos.listBranches({
47
+ const { data } = await octokit.rest.repos.listBranches({
48
48
  owner,
49
49
  repo,
50
50
  per_page: perPage
@@ -65,7 +65,7 @@ const getFileContent = (octokit) => tool({
65
65
  ref: z.string().optional().describe("Branch, tag, or commit SHA (defaults to the default branch)")
66
66
  }),
67
67
  execute: async ({ owner, repo, path, ref }) => {
68
- const { data } = await octokit.repos.getContent({
68
+ const { data } = await octokit.rest.repos.getContent({
69
69
  owner,
70
70
  repo,
71
71
  path,
@@ -93,6 +93,110 @@ const getFileContent = (octokit) => tool({
93
93
  };
94
94
  }
95
95
  });
96
+ const createBranch = (octokit, { needsApproval = true } = {}) => tool({
97
+ description: "Create a new branch in a GitHub repository from an existing branch or commit SHA",
98
+ needsApproval,
99
+ inputSchema: z.object({
100
+ owner: z.string().describe("Repository owner"),
101
+ repo: z.string().describe("Repository name"),
102
+ branch: z.string().describe("Name for the new branch"),
103
+ from: z.string().optional().describe("Source branch name or commit SHA to branch from (defaults to the default branch)")
104
+ }),
105
+ execute: async ({ owner, repo, branch, from }) => {
106
+ let sha = from;
107
+ if (!sha || !sha.match(/^[0-9a-f]{40}$/i)) {
108
+ const { data: ref } = await octokit.rest.git.getRef({
109
+ owner,
110
+ repo,
111
+ ref: `heads/${from || (await octokit.rest.repos.get({
112
+ owner,
113
+ repo
114
+ })).data.default_branch}`
115
+ });
116
+ sha = ref.object.sha;
117
+ }
118
+ const { data } = await octokit.rest.git.createRef({
119
+ owner,
120
+ repo,
121
+ ref: `refs/heads/${branch}`,
122
+ sha
123
+ });
124
+ return {
125
+ ref: data.ref,
126
+ sha: data.object.sha,
127
+ url: data.url
128
+ };
129
+ }
130
+ });
131
+ const forkRepository = (octokit, { needsApproval = true } = {}) => tool({
132
+ description: "Fork a GitHub repository to the authenticated user account or a specified organization",
133
+ needsApproval,
134
+ inputSchema: z.object({
135
+ owner: z.string().describe("Repository owner to fork from"),
136
+ repo: z.string().describe("Repository name to fork"),
137
+ organization: z.string().optional().describe("Organization to fork into (omit to fork to your personal account)"),
138
+ name: z.string().optional().describe("Name for the forked repository (defaults to the original name)")
139
+ }),
140
+ execute: async ({ owner, repo, organization, name }) => {
141
+ const { data } = await octokit.rest.repos.createFork({
142
+ owner,
143
+ repo,
144
+ organization,
145
+ name
146
+ });
147
+ return {
148
+ name: data.name,
149
+ fullName: data.full_name,
150
+ url: data.html_url,
151
+ cloneUrl: data.clone_url,
152
+ sshUrl: data.ssh_url,
153
+ defaultBranch: data.default_branch,
154
+ private: data.private,
155
+ parent: data.parent ? {
156
+ fullName: data.parent.full_name,
157
+ url: data.parent.html_url
158
+ } : null
159
+ };
160
+ }
161
+ });
162
+ const createRepository = (octokit, { needsApproval = true } = {}) => tool({
163
+ description: "Create a new GitHub repository for the authenticated user or a specified organization",
164
+ needsApproval,
165
+ inputSchema: z.object({
166
+ name: z.string().describe("Repository name"),
167
+ description: z.string().optional().describe("A short description of the repository"),
168
+ isPrivate: z.boolean().optional().default(false).describe("Whether the repository is private"),
169
+ autoInit: z.boolean().optional().default(false).describe("Create an initial commit with a README"),
170
+ gitignoreTemplate: z.string().optional().describe("Gitignore template to use (e.g. \"Node\", \"Python\")"),
171
+ licenseTemplate: z.string().optional().describe("License keyword (e.g. \"mit\", \"apache-2.0\")"),
172
+ org: z.string().optional().describe("Organization to create the repository in (omit for personal repo)")
173
+ }),
174
+ execute: async ({ name, description, isPrivate, autoInit, gitignoreTemplate, licenseTemplate, org }) => {
175
+ const params = {
176
+ name,
177
+ description,
178
+ private: isPrivate,
179
+ auto_init: autoInit,
180
+ gitignore_template: gitignoreTemplate,
181
+ license_template: licenseTemplate
182
+ };
183
+ const { data } = org ? await octokit.rest.repos.createInOrg({
184
+ org,
185
+ ...params
186
+ }) : await octokit.rest.repos.createForAuthenticatedUser(params);
187
+ return {
188
+ name: data.name,
189
+ fullName: data.full_name,
190
+ description: data.description,
191
+ url: data.html_url,
192
+ cloneUrl: data.clone_url,
193
+ sshUrl: data.ssh_url,
194
+ defaultBranch: data.default_branch,
195
+ private: data.private,
196
+ createdAt: data.created_at
197
+ };
198
+ }
199
+ });
96
200
  const createOrUpdateFile = (octokit, { needsApproval = true } = {}) => tool({
97
201
  description: "Create or update a file in a GitHub repository. Provide the SHA when updating an existing file.",
98
202
  needsApproval,
@@ -107,7 +211,7 @@ const createOrUpdateFile = (octokit, { needsApproval = true } = {}) => tool({
107
211
  }),
108
212
  execute: async ({ owner, repo, path, message, content, branch, sha }) => {
109
213
  const encoded = Buffer.from(content).toString("base64");
110
- const { data } = await octokit.repos.createOrUpdateFileContents({
214
+ const { data } = await octokit.rest.repos.createOrUpdateFileContents({
111
215
  owner,
112
216
  repo,
113
217
  path,
@@ -140,7 +244,7 @@ const listPullRequests = (octokit) => tool({
140
244
  perPage: z.number().optional().default(30).describe("Number of results to return (max 100)")
141
245
  }),
142
246
  execute: async ({ owner, repo, state, perPage }) => {
143
- const { data } = await octokit.pulls.list({
247
+ const { data } = await octokit.rest.pulls.list({
144
248
  owner,
145
249
  repo,
146
250
  state,
@@ -168,7 +272,7 @@ const getPullRequest = (octokit) => tool({
168
272
  pullNumber: z.number().describe("Pull request number")
169
273
  }),
170
274
  execute: async ({ owner, repo, pullNumber }) => {
171
- const { data } = await octokit.pulls.get({
275
+ const { data } = await octokit.rest.pulls.get({
172
276
  owner,
173
277
  repo,
174
278
  pull_number: pullNumber
@@ -207,7 +311,7 @@ const createPullRequest = (octokit, { needsApproval = true } = {}) => tool({
207
311
  draft: z.boolean().optional().default(false).describe("Create as draft pull request")
208
312
  }),
209
313
  execute: async ({ owner, repo, title, body, head, base, draft }) => {
210
- const { data } = await octokit.pulls.create({
314
+ const { data } = await octokit.rest.pulls.create({
211
315
  owner,
212
316
  repo,
213
317
  title,
@@ -243,7 +347,7 @@ const mergePullRequest = (octokit, { needsApproval = true } = {}) => tool({
243
347
  ]).optional().default("merge").describe("Merge strategy")
244
348
  }),
245
349
  execute: async ({ owner, repo, pullNumber, commitTitle, commitMessage, mergeMethod }) => {
246
- const { data } = await octokit.pulls.merge({
350
+ const { data } = await octokit.rest.pulls.merge({
247
351
  owner,
248
352
  repo,
249
353
  pull_number: pullNumber,
@@ -268,7 +372,7 @@ const addPullRequestComment = (octokit, { needsApproval = true } = {}) => tool({
268
372
  body: z.string().describe("Comment text (supports Markdown)")
269
373
  }),
270
374
  execute: async ({ owner, repo, pullNumber, body }) => {
271
- const { data } = await octokit.issues.createComment({
375
+ const { data } = await octokit.rest.issues.createComment({
272
376
  owner,
273
377
  repo,
274
378
  issue_number: pullNumber,
@@ -300,7 +404,7 @@ const listIssues = (octokit) => tool({
300
404
  perPage: z.number().optional().default(30).describe("Number of results to return (max 100)")
301
405
  }),
302
406
  execute: async ({ owner, repo, state, labels, perPage }) => {
303
- const { data } = await octokit.issues.listForRepo({
407
+ const { data } = await octokit.rest.issues.listForRepo({
304
408
  owner,
305
409
  repo,
306
410
  state,
@@ -327,7 +431,7 @@ const getIssue = (octokit) => tool({
327
431
  issueNumber: z.number().describe("Issue number")
328
432
  }),
329
433
  execute: async ({ owner, repo, issueNumber }) => {
330
- const { data } = await octokit.issues.get({
434
+ const { data } = await octokit.rest.issues.get({
331
435
  owner,
332
436
  repo,
333
437
  issue_number: issueNumber
@@ -360,7 +464,7 @@ const createIssue = (octokit, { needsApproval = true } = {}) => tool({
360
464
  assignees: z.array(z.string()).optional().describe("GitHub usernames to assign to the issue")
361
465
  }),
362
466
  execute: async ({ owner, repo, title, body, labels, assignees }) => {
363
- const { data } = await octokit.issues.create({
467
+ const { data } = await octokit.rest.issues.create({
364
468
  owner,
365
469
  repo,
366
470
  title,
@@ -387,7 +491,7 @@ const addIssueComment = (octokit, { needsApproval = true } = {}) => tool({
387
491
  body: z.string().describe("Comment text (supports Markdown)")
388
492
  }),
389
493
  execute: async ({ owner, repo, issueNumber, body }) => {
390
- const { data } = await octokit.issues.createComment({
494
+ const { data } = await octokit.rest.issues.createComment({
391
495
  owner,
392
496
  repo,
393
497
  issue_number: issueNumber,
@@ -412,7 +516,7 @@ const closeIssue = (octokit, { needsApproval = true } = {}) => tool({
412
516
  stateReason: z.enum(["completed", "not_planned"]).optional().default("completed").describe("Reason for closing")
413
517
  }),
414
518
  execute: async ({ owner, repo, issueNumber, stateReason }) => {
415
- const { data } = await octokit.issues.update({
519
+ const { data } = await octokit.rest.issues.update({
416
520
  owner,
417
521
  repo,
418
522
  issue_number: issueNumber,
@@ -438,7 +542,7 @@ const searchCode = (octokit) => tool({
438
542
  perPage: z.number().optional().default(10).describe("Number of results to return (max 30)")
439
543
  }),
440
544
  execute: async ({ query, perPage }) => {
441
- const { data } = await octokit.search.code({
545
+ const { data } = await octokit.rest.search.code({
442
546
  q: query,
443
547
  per_page: perPage
444
548
  });
@@ -468,7 +572,7 @@ const searchRepositories = (octokit) => tool({
468
572
  order: z.enum(["asc", "desc"]).optional().default("desc").describe("Sort order")
469
573
  }),
470
574
  execute: async ({ query, perPage, sort, order }) => {
471
- const { data } = await octokit.search.repos({
575
+ const { data } = await octokit.rest.search.repos({
472
576
  q: query,
473
577
  per_page: perPage,
474
578
  sort,
@@ -505,7 +609,7 @@ const listCommits = (octokit) => tool({
505
609
  perPage: z.number().optional().default(30).describe("Number of results to return (max 100)")
506
610
  }),
507
611
  execute: async ({ owner, repo, path, sha, author, since, until, perPage }) => {
508
- const { data } = await octokit.repos.listCommits({
612
+ const { data } = await octokit.rest.repos.listCommits({
509
613
  owner,
510
614
  repo,
511
615
  path,
@@ -533,7 +637,7 @@ const getCommit = (octokit) => tool({
533
637
  ref: z.string().describe("Commit SHA, branch name, or tag")
534
638
  }),
535
639
  execute: async ({ owner, repo, ref }) => {
536
- const { data } = await octokit.repos.getCommit({
640
+ const { data } = await octokit.rest.repos.getCommit({
537
641
  owner,
538
642
  repo,
539
643
  ref
@@ -619,7 +723,7 @@ ${SHARED_RULES}`
619
723
  * import { createGithubAgent } from '@github-tools/sdk'
620
724
  *
621
725
  * const agent = createGithubAgent({
622
- * model: 'anthropic/claude-sonnet-4-6',
726
+ * model: 'anthropic/claude-sonnet-4.6',
623
727
  * token: process.env.GITHUB_TOKEN!,
624
728
  * preset: 'code-review',
625
729
  * })
@@ -686,6 +790,9 @@ const PRESET_TOOLS = {
686
790
  "getRepository",
687
791
  "listBranches",
688
792
  "getFileContent",
793
+ "createBranch",
794
+ "forkRepository",
795
+ "createRepository",
689
796
  "createOrUpdateFile",
690
797
  "listPullRequests",
691
798
  "getPullRequest",
@@ -762,6 +869,9 @@ function createGithubTools({ token, requireApproval = true, preset } = {}) {
762
869
  searchRepositories: searchRepositories(octokit),
763
870
  listCommits: listCommits(octokit),
764
871
  getCommit: getCommit(octokit),
872
+ createBranch: createBranch(octokit, approval("createBranch")),
873
+ forkRepository: forkRepository(octokit, approval("forkRepository")),
874
+ createRepository: createRepository(octokit, approval("createRepository")),
765
875
  createOrUpdateFile: createOrUpdateFile(octokit, approval("createOrUpdateFile")),
766
876
  createPullRequest: createPullRequest(octokit, approval("createPullRequest")),
767
877
  mergePullRequest: mergePullRequest(octokit, approval("mergePullRequest")),
@@ -775,5 +885,5 @@ function createGithubTools({ token, requireApproval = true, preset } = {}) {
775
885
  }
776
886
 
777
887
  //#endregion
778
- export { addIssueComment, addPullRequestComment, closeIssue, createGithubAgent, createGithubTools, createIssue, createOctokit, createOrUpdateFile, createPullRequest, getCommit, getFileContent, getIssue, getPullRequest, getRepository, listBranches, listCommits, listIssues, listPullRequests, mergePullRequest, searchCode, searchRepositories };
888
+ export { addIssueComment, addPullRequestComment, closeIssue, createBranch, createGithubAgent, createGithubTools, createIssue, createOctokit, createOrUpdateFile, createPullRequest, createRepository, forkRepository, getCommit, getFileContent, getIssue, getPullRequest, getRepository, listBranches, listCommits, listIssues, listPullRequests, mergePullRequest, searchCode, searchRepositories };
779
889
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/client.ts","../src/tools/repository.ts","../src/tools/pull-requests.ts","../src/tools/issues.ts","../src/tools/search.ts","../src/tools/commits.ts","../src/agents.ts","../src/index.ts"],"sourcesContent":["import { Octokit } from '@octokit/rest'\n\nexport function createOctokit(token: string): Octokit {\n return new Octokit({ auth: token })\n}\n","import { tool } from 'ai'\nimport { z } from 'zod'\nimport type { Octokit, ToolOptions } from '../types'\n\nexport const getRepository = (octokit: Octokit) =>\n tool({\n description: 'Get information about a GitHub repository including description, stars, forks, language, and default branch',\n inputSchema: z.object({\n owner: z.string().describe('Repository owner (user or organization)'),\n repo: z.string().describe('Repository name'),\n }),\n execute: async ({ owner, repo }) => {\n const { data } = await octokit.repos.get({ owner, repo })\n return {\n name: data.name,\n fullName: data.full_name,\n description: data.description,\n url: data.html_url,\n defaultBranch: data.default_branch,\n stars: data.stargazers_count,\n forks: data.forks_count,\n openIssues: data.open_issues_count,\n language: data.language,\n private: data.private,\n createdAt: data.created_at,\n updatedAt: data.updated_at,\n }\n },\n })\n\nexport const listBranches = (octokit: Octokit) =>\n tool({\n description: 'List branches in a GitHub repository',\n inputSchema: z.object({\n owner: z.string().describe('Repository owner'),\n repo: z.string().describe('Repository name'),\n perPage: z.number().optional().default(30).describe('Number of branches to return (max 100)'),\n }),\n execute: async ({ owner, repo, perPage }) => {\n const { data } = await octokit.repos.listBranches({ owner, repo, per_page: perPage })\n return data.map(branch => ({\n name: branch.name,\n sha: branch.commit.sha,\n protected: branch.protected,\n }))\n },\n })\n\nexport const getFileContent = (octokit: Octokit) =>\n tool({\n description: 'Get the content of a file from a GitHub repository',\n inputSchema: z.object({\n owner: z.string().describe('Repository owner'),\n repo: z.string().describe('Repository name'),\n path: z.string().describe('Path to the file in the repository'),\n ref: z.string().optional().describe('Branch, tag, or commit SHA (defaults to the default branch)'),\n }),\n execute: async ({ owner, repo, path, ref }) => {\n const { data } = await octokit.repos.getContent({ owner, repo, path, ref })\n if (Array.isArray(data)) {\n return { type: 'directory', entries: data.map(e => ({ name: e.name, type: e.type, path: e.path })) }\n }\n if (data.type !== 'file') {\n return { type: data.type, path: data.path }\n }\n const content = Buffer.from(data.content, 'base64').toString('utf-8')\n return {\n type: 'file',\n path: data.path,\n sha: data.sha,\n size: data.size,\n content,\n }\n },\n })\n\nexport const createOrUpdateFile = (octokit: Octokit, { needsApproval = true }: ToolOptions = {}) =>\n tool({\n description: 'Create or update a file in a GitHub repository. Provide the SHA when updating an existing file.',\n needsApproval,\n inputSchema: z.object({\n owner: z.string().describe('Repository owner'),\n repo: z.string().describe('Repository name'),\n path: z.string().describe('Path to the file in the repository'),\n message: z.string().describe('Commit message'),\n content: z.string().describe('File content (plain text, will be base64-encoded automatically)'),\n branch: z.string().optional().describe('Branch to commit to (defaults to the default branch)'),\n sha: z.string().optional().describe('SHA of the file being replaced (required when updating an existing file)'),\n }),\n execute: async ({ owner, repo, path, message, content, branch, sha }) => {\n const encoded = Buffer.from(content).toString('base64')\n const { data } = await octokit.repos.createOrUpdateFileContents({\n owner,\n repo,\n path,\n message,\n content: encoded,\n branch,\n sha,\n })\n return {\n path: data.content?.path,\n sha: data.content?.sha,\n commitSha: data.commit.sha,\n commitUrl: data.commit.html_url,\n }\n },\n })\n","import { tool } from 'ai'\nimport { z } from 'zod'\nimport type { Octokit, ToolOptions } from '../types'\n\nexport const listPullRequests = (octokit: Octokit) =>\n tool({\n description: 'List pull requests for a GitHub repository',\n inputSchema: z.object({\n owner: z.string().describe('Repository owner'),\n repo: z.string().describe('Repository name'),\n state: z.enum(['open', 'closed', 'all']).optional().default('open').describe('Filter by state'),\n perPage: z.number().optional().default(30).describe('Number of results to return (max 100)'),\n }),\n execute: async ({ owner, repo, state, perPage }) => {\n const { data } = await octokit.pulls.list({ owner, repo, state, per_page: perPage })\n return data.map(pr => ({\n number: pr.number,\n title: pr.title,\n state: pr.state,\n url: pr.html_url,\n author: pr.user?.login,\n branch: pr.head.ref,\n base: pr.base.ref,\n draft: pr.draft,\n createdAt: pr.created_at,\n updatedAt: pr.updated_at,\n }))\n },\n })\n\nexport const getPullRequest = (octokit: Octokit) =>\n tool({\n description: 'Get detailed information about a specific pull request',\n inputSchema: z.object({\n owner: z.string().describe('Repository owner'),\n repo: z.string().describe('Repository name'),\n pullNumber: z.number().describe('Pull request number'),\n }),\n execute: async ({ owner, repo, pullNumber }) => {\n const { data } = await octokit.pulls.get({ owner, repo, pull_number: pullNumber })\n return {\n number: data.number,\n title: data.title,\n body: data.body,\n state: data.state,\n url: data.html_url,\n author: data.user?.login,\n branch: data.head.ref,\n base: data.base.ref,\n draft: data.draft,\n merged: data.merged,\n mergeable: data.mergeable,\n additions: data.additions,\n deletions: data.deletions,\n changedFiles: data.changed_files,\n createdAt: data.created_at,\n updatedAt: data.updated_at,\n mergedAt: data.merged_at,\n }\n },\n })\n\nexport const createPullRequest = (octokit: Octokit, { needsApproval = true }: ToolOptions = {}) =>\n tool({\n description: 'Create a new pull request in a GitHub repository',\n needsApproval,\n inputSchema: z.object({\n owner: z.string().describe('Repository owner'),\n repo: z.string().describe('Repository name'),\n title: z.string().describe('Pull request title'),\n body: z.string().optional().describe('Pull request description (supports Markdown)'),\n head: z.string().describe('Branch containing the changes (format: branch or username:branch)'),\n base: z.string().describe('Branch to merge into'),\n draft: z.boolean().optional().default(false).describe('Create as draft pull request'),\n }),\n execute: async ({ owner, repo, title, body, head, base, draft }) => {\n const { data } = await octokit.pulls.create({ owner, repo, title, body, head, base, draft })\n return {\n number: data.number,\n title: data.title,\n url: data.html_url,\n state: data.state,\n draft: data.draft,\n branch: data.head.ref,\n base: data.base.ref,\n }\n },\n })\n\nexport const mergePullRequest = (octokit: Octokit, { needsApproval = true }: ToolOptions = {}) =>\n tool({\n description: 'Merge a pull request',\n needsApproval,\n inputSchema: z.object({\n owner: z.string().describe('Repository owner'),\n repo: z.string().describe('Repository name'),\n pullNumber: z.number().describe('Pull request number'),\n commitTitle: z.string().optional().describe('Title for the automatic merge commit'),\n commitMessage: z.string().optional().describe('Extra detail to append to automatic commit message'),\n mergeMethod: z.enum(['merge', 'squash', 'rebase']).optional().default('merge').describe('Merge strategy'),\n }),\n execute: async ({ owner, repo, pullNumber, commitTitle, commitMessage, mergeMethod }) => {\n const { data } = await octokit.pulls.merge({\n owner,\n repo,\n pull_number: pullNumber,\n commit_title: commitTitle,\n commit_message: commitMessage,\n merge_method: mergeMethod,\n })\n return {\n merged: data.merged,\n message: data.message,\n sha: data.sha,\n }\n },\n })\n\nexport const addPullRequestComment = (octokit: Octokit, { needsApproval = true }: ToolOptions = {}) =>\n tool({\n description: 'Add a comment to a pull request',\n needsApproval,\n inputSchema: z.object({\n owner: z.string().describe('Repository owner'),\n repo: z.string().describe('Repository name'),\n pullNumber: z.number().describe('Pull request number'),\n body: z.string().describe('Comment text (supports Markdown)'),\n }),\n execute: async ({ owner, repo, pullNumber, body }) => {\n const { data } = await octokit.issues.createComment({ owner, repo, issue_number: pullNumber, body })\n return {\n id: data.id,\n url: data.html_url,\n body: data.body,\n author: data.user?.login,\n createdAt: data.created_at,\n }\n },\n })\n","import { tool } from 'ai'\nimport { z } from 'zod'\nimport type { Octokit, ToolOptions } from '../types'\n\nexport const listIssues = (octokit: Octokit) =>\n tool({\n description: 'List issues for a GitHub repository (excludes pull requests)',\n inputSchema: z.object({\n owner: z.string().describe('Repository owner'),\n repo: z.string().describe('Repository name'),\n state: z.enum(['open', 'closed', 'all']).optional().default('open').describe('Filter by state'),\n labels: z.string().optional().describe('Comma-separated list of label names to filter by'),\n perPage: z.number().optional().default(30).describe('Number of results to return (max 100)'),\n }),\n execute: async ({ owner, repo, state, labels, perPage }) => {\n const { data } = await octokit.issues.listForRepo({\n owner,\n repo,\n state,\n labels,\n per_page: perPage,\n })\n return data\n .filter(issue => !issue.pull_request)\n .map(issue => ({\n number: issue.number,\n title: issue.title,\n state: issue.state,\n url: issue.html_url,\n author: issue.user?.login,\n labels: issue.labels.map(l => (typeof l === 'string' ? l : l.name)),\n createdAt: issue.created_at,\n updatedAt: issue.updated_at,\n }))\n },\n })\n\nexport const getIssue = (octokit: Octokit) =>\n tool({\n description: 'Get detailed information about a specific issue',\n inputSchema: z.object({\n owner: z.string().describe('Repository owner'),\n repo: z.string().describe('Repository name'),\n issueNumber: z.number().describe('Issue number'),\n }),\n execute: async ({ owner, repo, issueNumber }) => {\n const { data } = await octokit.issues.get({ owner, repo, issue_number: issueNumber })\n return {\n number: data.number,\n title: data.title,\n body: data.body,\n state: data.state,\n url: data.html_url,\n author: data.user?.login,\n assignees: data.assignees?.map(a => a.login),\n labels: data.labels.map(l => (typeof l === 'string' ? l : l.name)),\n comments: data.comments,\n createdAt: data.created_at,\n updatedAt: data.updated_at,\n closedAt: data.closed_at,\n }\n },\n })\n\nexport const createIssue = (octokit: Octokit, { needsApproval = true }: ToolOptions = {}) =>\n tool({\n description: 'Create a new issue in a GitHub repository',\n needsApproval,\n inputSchema: z.object({\n owner: z.string().describe('Repository owner'),\n repo: z.string().describe('Repository name'),\n title: z.string().describe('Issue title'),\n body: z.string().optional().describe('Issue description (supports Markdown)'),\n labels: z.array(z.string()).optional().describe('Labels to apply to the issue'),\n assignees: z.array(z.string()).optional().describe('GitHub usernames to assign to the issue'),\n }),\n execute: async ({ owner, repo, title, body, labels, assignees }) => {\n const { data } = await octokit.issues.create({ owner, repo, title, body, labels, assignees })\n return {\n number: data.number,\n title: data.title,\n url: data.html_url,\n state: data.state,\n labels: data.labels.map(l => (typeof l === 'string' ? l : l.name)),\n }\n },\n })\n\nexport const addIssueComment = (octokit: Octokit, { needsApproval = true }: ToolOptions = {}) =>\n tool({\n description: 'Add a comment to a GitHub issue',\n needsApproval,\n inputSchema: z.object({\n owner: z.string().describe('Repository owner'),\n repo: z.string().describe('Repository name'),\n issueNumber: z.number().describe('Issue number'),\n body: z.string().describe('Comment text (supports Markdown)'),\n }),\n execute: async ({ owner, repo, issueNumber, body }) => {\n const { data } = await octokit.issues.createComment({ owner, repo, issue_number: issueNumber, body })\n return {\n id: data.id,\n url: data.html_url,\n body: data.body,\n author: data.user?.login,\n createdAt: data.created_at,\n }\n },\n })\n\nexport const closeIssue = (octokit: Octokit, { needsApproval = true }: ToolOptions = {}) =>\n tool({\n description: 'Close an open GitHub issue',\n needsApproval,\n inputSchema: z.object({\n owner: z.string().describe('Repository owner'),\n repo: z.string().describe('Repository name'),\n issueNumber: z.number().describe('Issue number to close'),\n stateReason: z.enum(['completed', 'not_planned']).optional().default('completed').describe('Reason for closing'),\n }),\n execute: async ({ owner, repo, issueNumber, stateReason }) => {\n const { data } = await octokit.issues.update({\n owner,\n repo,\n issue_number: issueNumber,\n state: 'closed',\n state_reason: stateReason,\n })\n return {\n number: data.number,\n title: data.title,\n state: data.state,\n url: data.html_url,\n closedAt: data.closed_at,\n }\n },\n })\n","import { tool } from 'ai'\nimport { z } from 'zod'\nimport type { Octokit } from '../types'\n\nexport const searchCode = (octokit: Octokit) =>\n tool({\n description: 'Search for code in GitHub repositories. Use qualifiers like \"repo:owner/name\" to scope the search.',\n inputSchema: z.object({\n query: z.string().describe('Search query. Supports GitHub search qualifiers, e.g. \"useState repo:facebook/react\"'),\n perPage: z.number().optional().default(10).describe('Number of results to return (max 30)'),\n }),\n execute: async ({ query, perPage }) => {\n const { data } = await octokit.search.code({ q: query, per_page: perPage })\n return {\n totalCount: data.total_count,\n items: data.items.map(item => ({\n name: item.name,\n path: item.path,\n url: item.html_url,\n repository: item.repository.full_name,\n sha: item.sha,\n })),\n }\n },\n })\n\nexport const searchRepositories = (octokit: Octokit) =>\n tool({\n description: 'Search for GitHub repositories by keyword, topic, language, or other qualifiers',\n inputSchema: z.object({\n query: z.string().describe('Search query. Supports GitHub search qualifiers, e.g. \"nuxt language:typescript stars:>1000\"'),\n perPage: z.number().optional().default(10).describe('Number of results to return (max 30)'),\n sort: z.enum(['stars', 'forks', 'help-wanted-issues', 'updated']).optional().describe('Sort field'),\n order: z.enum(['asc', 'desc']).optional().default('desc').describe('Sort order'),\n }),\n execute: async ({ query, perPage, sort, order }) => {\n const { data } = await octokit.search.repos({ q: query, per_page: perPage, sort, order })\n return {\n totalCount: data.total_count,\n items: data.items.map(repo => ({\n name: repo.name,\n fullName: repo.full_name,\n description: repo.description,\n url: repo.html_url,\n stars: repo.stargazers_count,\n forks: repo.forks_count,\n language: repo.language,\n topics: repo.topics,\n })),\n }\n },\n })\n","import { tool } from 'ai'\nimport { z } from 'zod'\nimport type { Octokit } from '../types'\n\nexport const listCommits = (octokit: Octokit) =>\n tool({\n description: 'List commits for a GitHub repository. Filter by file path to see who changed a specific file and when (git blame alternative). Filter by author, branch, or date range.',\n inputSchema: z.object({\n owner: z.string().describe('Repository owner'),\n repo: z.string().describe('Repository name'),\n path: z.string().optional().describe('Only commits containing this file path'),\n sha: z.string().optional().describe('Branch name or commit SHA to start listing from'),\n author: z.string().optional().describe('GitHub username or email to filter commits by'),\n since: z.string().optional().describe('Only commits after this date (ISO 8601 format)'),\n until: z.string().optional().describe('Only commits before this date (ISO 8601 format)'),\n perPage: z.number().optional().default(30).describe('Number of results to return (max 100)'),\n }),\n execute: async ({ owner, repo, path, sha, author, since, until, perPage }) => {\n const { data } = await octokit.repos.listCommits({\n owner,\n repo,\n path,\n sha,\n author,\n since,\n until,\n per_page: perPage,\n })\n return data.map(commit => ({\n sha: commit.sha,\n message: commit.commit.message,\n author: commit.commit.author?.name,\n authorLogin: commit.author?.login,\n date: commit.commit.author?.date,\n url: commit.html_url,\n }))\n },\n })\n\nexport const getCommit = (octokit: Octokit) =>\n tool({\n description: 'Get detailed information about a specific commit, including the list of files changed with additions and deletions',\n inputSchema: z.object({\n owner: z.string().describe('Repository owner'),\n repo: z.string().describe('Repository name'),\n ref: z.string().describe('Commit SHA, branch name, or tag'),\n }),\n execute: async ({ owner, repo, ref }) => {\n const { data } = await octokit.repos.getCommit({ owner, repo, ref })\n return {\n sha: data.sha,\n message: data.commit.message,\n author: data.commit.author?.name,\n authorLogin: data.author?.login,\n date: data.commit.author?.date,\n url: data.html_url,\n stats: data.stats ? {\n additions: data.stats.additions,\n deletions: data.stats.deletions,\n total: data.stats.total,\n } : null,\n files: data.files?.map(file => ({\n filename: file.filename,\n status: file.status,\n additions: file.additions,\n deletions: file.deletions,\n patch: file.patch,\n })),\n }\n },\n })\n","import { ToolLoopAgent } from 'ai'\nimport type { ToolLoopAgentSettings } from 'ai'\nimport { createGithubTools } from './index'\nimport type { GithubToolPreset, ApprovalConfig } from './index'\n\nconst SHARED_RULES = `When a tool execution is denied by the user, do not retry it. Briefly acknowledge the decision and move on.`\n\nconst DEFAULT_INSTRUCTIONS = `You are a helpful GitHub assistant. You can read and explore repositories, issues, pull requests, commits, and code. You can also create issues, pull requests, comments, and update files when asked.\n\n${SHARED_RULES}`\n\nconst PRESET_INSTRUCTIONS: Record<GithubToolPreset, string> = {\n 'code-review': `You are a code review assistant. Your job is to review pull requests thoroughly and provide constructive feedback.\n\nWhen reviewing a PR:\n- Read the PR description and changed files carefully\n- Check for bugs, logic errors, and edge cases\n- Suggest improvements when you spot issues\n- Be constructive — explain why something is a problem and how to fix it\n- Post your review as PR comments when asked\n\n${SHARED_RULES}`,\n\n 'issue-triage': `You are an issue triage assistant. Your job is to help manage and organize GitHub issues.\n\nWhen triaging issues:\n- Read issue descriptions carefully to understand the problem\n- Identify duplicates when possible\n- Help categorize and prioritize issues\n- Respond to users with clear, helpful information\n- Create new issues when asked, with clear titles and descriptions\n\n${SHARED_RULES}`,\n\n 'repo-explorer': `You are a repository explorer. Your job is to help users understand codebases and find information across GitHub repositories.\n\nWhen exploring repos:\n- Answer questions about code structure and organization\n- Summarize recent activity (commits, PRs, issues)\n- Find specific files, functions, or patterns in code\n- Explain how different parts of the codebase work together\n- You have read-only access — you cannot make changes\n\n${SHARED_RULES}`,\n\n 'maintainer': `You are a repository maintainer assistant. You have full access to manage repositories, issues, and pull requests.\n\nWhen maintaining repos:\n- Be careful with write operations — review before acting\n- Create well-structured issues and PRs with clear descriptions\n- Use merge strategies appropriate for the repository\n- Keep commit messages clean and descriptive\n- When closing issues, provide a clear reason\n\n${SHARED_RULES}`\n}\n\ntype AgentOptions = Omit<ToolLoopAgentSettings, 'model' | 'tools' | 'instructions'>\n\nexport type CreateGithubAgentOptions = AgentOptions & {\n model: ToolLoopAgentSettings['model']\n /**\n * GitHub personal access token.\n * Falls back to `process.env.GITHUB_TOKEN` when omitted.\n */\n token?: string\n preset?: GithubToolPreset | GithubToolPreset[]\n requireApproval?: ApprovalConfig\n instructions?: string\n additionalInstructions?: string\n}\n\n/**\n * Create a pre-configured GitHub agent powered by the AI SDK's `ToolLoopAgent`.\n *\n * Returns a `ToolLoopAgent` instance with `.generate()` and `.stream()` methods.\n *\n * @example\n * ```ts\n * import { createGithubAgent } from '@github-tools/sdk'\n *\n * const agent = createGithubAgent({\n * model: 'anthropic/claude-sonnet-4-6',\n * token: process.env.GITHUB_TOKEN!,\n * preset: 'code-review',\n * })\n *\n * const result = await agent.generate({ prompt: 'Review PR #42 on vercel/ai' })\n * ```\n */\nexport function createGithubAgent({\n token,\n preset,\n requireApproval,\n instructions,\n additionalInstructions,\n ...agentOptions\n}: CreateGithubAgentOptions) {\n const tools = createGithubTools({ token, requireApproval, preset })\n\n const defaultPrompt = preset && !Array.isArray(preset)\n ? PRESET_INSTRUCTIONS[preset]\n : DEFAULT_INSTRUCTIONS\n\n let resolvedInstructions: string\n if (instructions) {\n resolvedInstructions = instructions\n } else if (additionalInstructions) {\n resolvedInstructions = `${defaultPrompt}\\n\\n${additionalInstructions}`\n } else {\n resolvedInstructions = defaultPrompt\n }\n\n return new ToolLoopAgent({\n ...agentOptions,\n tools,\n instructions: resolvedInstructions\n })\n}\n","import { createOctokit } from './client'\nimport { getRepository, listBranches, getFileContent, createOrUpdateFile } from './tools/repository'\nimport { listPullRequests, getPullRequest, createPullRequest, mergePullRequest, addPullRequestComment } from './tools/pull-requests'\nimport { listIssues, getIssue, createIssue, addIssueComment, closeIssue } from './tools/issues'\nimport { searchCode, searchRepositories } from './tools/search'\nimport { listCommits, getCommit } from './tools/commits'\n\nexport type GithubWriteToolName =\n | 'createOrUpdateFile'\n | 'createPullRequest'\n | 'mergePullRequest'\n | 'addPullRequestComment'\n | 'createIssue'\n | 'addIssueComment'\n | 'closeIssue'\n\n/**\n * Whether write operations require user approval.\n * - `true` — all write tools need approval (default)\n * - `false` — no approval needed for any write tool\n * - object — per-tool override; unspecified write tools default to `true`\n *\n * @example\n * ```ts\n * requireApproval: {\n * mergePullRequest: true,\n * createOrUpdateFile: true,\n * addPullRequestComment: false,\n * addIssueComment: false,\n * }\n * ```\n */\nexport type ApprovalConfig = boolean | Partial<Record<GithubWriteToolName, boolean>>\n\n/**\n * Predefined tool presets for common use cases.\n *\n * - `'code-review'` — Review PRs: read PRs, file content, commits, and post comments\n * - `'issue-triage'` — Triage issues: read/create/close issues, search, and comment\n * - `'repo-explorer'` — Explore repos: read-only access to repos, branches, code, and search\n * - `'maintainer'` — Full maintenance: all read + create PRs, merge, manage issues\n */\nexport type GithubToolPreset = 'code-review' | 'issue-triage' | 'repo-explorer' | 'maintainer'\n\nconst PRESET_TOOLS: Record<GithubToolPreset, string[]> = {\n 'code-review': [\n 'getPullRequest', 'listPullRequests', 'getFileContent', 'listCommits', 'getCommit',\n 'getRepository', 'listBranches', 'searchCode',\n 'addPullRequestComment'\n ],\n 'issue-triage': [\n 'listIssues', 'getIssue', 'createIssue', 'addIssueComment', 'closeIssue',\n 'getRepository', 'searchRepositories', 'searchCode'\n ],\n 'repo-explorer': [\n 'getRepository', 'listBranches', 'getFileContent',\n 'listPullRequests', 'getPullRequest',\n 'listIssues', 'getIssue',\n 'listCommits', 'getCommit',\n 'searchCode', 'searchRepositories'\n ],\n 'maintainer': [\n 'getRepository', 'listBranches', 'getFileContent', 'createOrUpdateFile',\n 'listPullRequests', 'getPullRequest', 'createPullRequest', 'mergePullRequest', 'addPullRequestComment',\n 'listIssues', 'getIssue', 'createIssue', 'addIssueComment', 'closeIssue',\n 'listCommits', 'getCommit',\n 'searchCode', 'searchRepositories'\n ]\n}\n\nexport type GithubToolsOptions = {\n /**\n * GitHub personal access token.\n * Falls back to `process.env.GITHUB_TOKEN` when omitted.\n */\n token?: string\n requireApproval?: ApprovalConfig\n /**\n * Restrict the returned tools to a predefined preset.\n * Omit to get all tools.\n *\n * @example\n * ```ts\n * // Only code-review tools\n * createGithubTools({ token, preset: 'code-review' })\n *\n * // Combine presets\n * createGithubTools({ token, preset: ['code-review', 'issue-triage'] })\n * ```\n */\n preset?: GithubToolPreset | GithubToolPreset[]\n}\n\nfunction resolveApproval(toolName: GithubWriteToolName, config: ApprovalConfig): boolean {\n if (typeof config === 'boolean') return config\n return config[toolName] ?? true\n}\n\nfunction resolvePresetTools(preset: GithubToolPreset | GithubToolPreset[]): Set<string> | null {\n if (!preset) return null\n const presets = Array.isArray(preset) ? preset : [preset]\n const tools = new Set<string>()\n for (const p of presets) {\n for (const t of PRESET_TOOLS[p]) tools.add(t)\n }\n return tools\n}\n\n/**\n * Create a set of GitHub tools for the Vercel AI SDK.\n *\n * Write operations require user approval by default.\n * Control this globally or per-tool via `requireApproval`.\n * Use `preset` to get only the tools you need.\n *\n * @example\n * ```ts\n * // All tools (default)\n * createGithubTools({ token })\n *\n * // Code-review agent — only PR & commit tools\n * createGithubTools({ token, preset: 'code-review' })\n *\n * // Combine presets\n * createGithubTools({ token, preset: ['code-review', 'issue-triage'] })\n *\n * // Granular approval\n * createGithubTools({\n * token,\n * preset: 'maintainer',\n * requireApproval: {\n * mergePullRequest: true,\n * createOrUpdateFile: true,\n * addPullRequestComment: false,\n * }\n * })\n * ```\n */\nexport function createGithubTools({ token, requireApproval = true, preset }: GithubToolsOptions = {}) {\n const resolvedToken = token || process.env.GITHUB_TOKEN\n if (!resolvedToken) {\n throw new Error('GitHub token is required. Pass it as `token` or set the GITHUB_TOKEN environment variable.')\n }\n const octokit = createOctokit(resolvedToken)\n const approval = (name: GithubWriteToolName) => ({ needsApproval: resolveApproval(name, requireApproval) })\n const allowed = preset ? resolvePresetTools(preset) : null\n\n const allTools = {\n getRepository: getRepository(octokit),\n listBranches: listBranches(octokit),\n getFileContent: getFileContent(octokit),\n listPullRequests: listPullRequests(octokit),\n getPullRequest: getPullRequest(octokit),\n listIssues: listIssues(octokit),\n getIssue: getIssue(octokit),\n searchCode: searchCode(octokit),\n searchRepositories: searchRepositories(octokit),\n listCommits: listCommits(octokit),\n getCommit: getCommit(octokit),\n createOrUpdateFile: createOrUpdateFile(octokit, approval('createOrUpdateFile')),\n createPullRequest: createPullRequest(octokit, approval('createPullRequest')),\n mergePullRequest: mergePullRequest(octokit, approval('mergePullRequest')),\n addPullRequestComment: addPullRequestComment(octokit, approval('addPullRequestComment')),\n createIssue: createIssue(octokit, approval('createIssue')),\n addIssueComment: addIssueComment(octokit, approval('addIssueComment')),\n closeIssue: closeIssue(octokit, approval('closeIssue')),\n }\n\n if (!allowed) return allTools\n\n return Object.fromEntries(\n Object.entries(allTools).filter(([name]) => allowed.has(name))\n ) as Partial<typeof allTools>\n}\n\nexport type GithubTools = ReturnType<typeof createGithubTools>\n\n// Re-export individual tool factories for cherry-picking\nexport { createOctokit } from './client'\nexport { getRepository, listBranches, getFileContent, createOrUpdateFile } from './tools/repository'\nexport { listPullRequests, getPullRequest, createPullRequest, mergePullRequest, addPullRequestComment } from './tools/pull-requests'\nexport { listIssues, getIssue, createIssue, addIssueComment, closeIssue } from './tools/issues'\nexport { searchCode, searchRepositories } from './tools/search'\nexport { listCommits, getCommit } from './tools/commits'\nexport type { Octokit, ToolOptions } from './types'\nexport { createGithubAgent } from './agents'\nexport type { CreateGithubAgentOptions } from './agents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EAC/B,oBAAoB,mBAAmB,QAAQ;EAC/C,aAAa,YAAY,QAAQ;EACjC,WAAW,UAAU,QAAQ;EAC7B,oBAAoB,mBAAmB,SAAS,SAAS,qBAAqB,CAAC;EAC/E,mBAAmB,kBAAkB,SAAS,SAAS,oBAAoB,CAAC;EAC5E,kBAAkB,iBAAiB,SAAS,SAAS,mBAAmB,CAAC;EACzE,uBAAuB,sBAAsB,SAAS,SAAS,wBAAwB,CAAC;EACxF,aAAa,YAAY,SAAS,SAAS,cAAc,CAAC;EAC1D,iBAAiB,gBAAgB,SAAS,SAAS,kBAAkB,CAAC;EACtE,YAAY,WAAW,SAAS,SAAS,aAAa,CAAC;EACxD;AAED,KAAI,CAAC,QAAS,QAAO;AAErB,QAAO,OAAO,YACZ,OAAO,QAAQ,SAAS,CAAC,QAAQ,CAAC,UAAU,QAAQ,IAAI,KAAK,CAAC,CAC/D"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/client.ts","../src/tools/repository.ts","../src/tools/pull-requests.ts","../src/tools/issues.ts","../src/tools/search.ts","../src/tools/commits.ts","../src/agents.ts","../src/index.ts"],"sourcesContent":["import { Octokit } from 'octokit'\n\nexport function createOctokit(token: string): Octokit {\n return new Octokit({ auth: token })\n}\n","import { tool } from 'ai'\nimport { z } from 'zod'\nimport type { Octokit, ToolOptions } from '../types'\n\nexport const getRepository = (octokit: Octokit) =>\n tool({\n description: 'Get information about a GitHub repository including description, stars, forks, language, and default branch',\n inputSchema: z.object({\n owner: z.string().describe('Repository owner (user or organization)'),\n repo: z.string().describe('Repository name'),\n }),\n execute: async ({ owner, repo }) => {\n const { data } = await octokit.rest.repos.get({ owner, repo })\n return {\n name: data.name,\n fullName: data.full_name,\n description: data.description,\n url: data.html_url,\n defaultBranch: data.default_branch,\n stars: data.stargazers_count,\n forks: data.forks_count,\n openIssues: data.open_issues_count,\n language: data.language,\n private: data.private,\n createdAt: data.created_at,\n updatedAt: data.updated_at,\n }\n },\n })\n\nexport const listBranches = (octokit: Octokit) =>\n tool({\n description: 'List branches in a GitHub repository',\n inputSchema: z.object({\n owner: z.string().describe('Repository owner'),\n repo: z.string().describe('Repository name'),\n perPage: z.number().optional().default(30).describe('Number of branches to return (max 100)'),\n }),\n execute: async ({ owner, repo, perPage }) => {\n const { data } = await octokit.rest.repos.listBranches({ owner, repo, per_page: perPage })\n return data.map(branch => ({\n name: branch.name,\n sha: branch.commit.sha,\n protected: branch.protected,\n }))\n },\n })\n\nexport const getFileContent = (octokit: Octokit) =>\n tool({\n description: 'Get the content of a file from a GitHub repository',\n inputSchema: z.object({\n owner: z.string().describe('Repository owner'),\n repo: z.string().describe('Repository name'),\n path: z.string().describe('Path to the file in the repository'),\n ref: z.string().optional().describe('Branch, tag, or commit SHA (defaults to the default branch)'),\n }),\n execute: async ({ owner, repo, path, ref }) => {\n const { data } = await octokit.rest.repos.getContent({ owner, repo, path, ref })\n if (Array.isArray(data)) {\n return { type: 'directory', entries: data.map(e => ({ name: e.name, type: e.type, path: e.path })) }\n }\n if (data.type !== 'file') {\n return { type: data.type, path: data.path }\n }\n const content = Buffer.from(data.content, 'base64').toString('utf-8')\n return {\n type: 'file',\n path: data.path,\n sha: data.sha,\n size: data.size,\n content,\n }\n },\n })\n\nexport const createBranch = (octokit: Octokit, { needsApproval = true }: ToolOptions = {}) =>\n tool({\n description: 'Create a new branch in a GitHub repository from an existing branch or commit SHA',\n needsApproval,\n inputSchema: z.object({\n owner: z.string().describe('Repository owner'),\n repo: z.string().describe('Repository name'),\n branch: z.string().describe('Name for the new branch'),\n from: z.string().optional().describe('Source branch name or commit SHA to branch from (defaults to the default branch)'),\n }),\n execute: async ({ owner, repo, branch, from }) => {\n let sha = from\n if (!sha || !sha.match(/^[0-9a-f]{40}$/i)) {\n const { data: ref } = await octokit.rest.git.getRef({\n owner,\n repo,\n ref: `heads/${from || (await octokit.rest.repos.get({ owner, repo })).data.default_branch}`,\n })\n sha = ref.object.sha\n }\n const { data } = await octokit.rest.git.createRef({\n owner,\n repo,\n ref: `refs/heads/${branch}`,\n sha,\n })\n return {\n ref: data.ref,\n sha: data.object.sha,\n url: data.url,\n }\n },\n })\n\nexport const forkRepository = (octokit: Octokit, { needsApproval = true }: ToolOptions = {}) =>\n tool({\n description: 'Fork a GitHub repository to the authenticated user account or a specified organization',\n needsApproval,\n inputSchema: z.object({\n owner: z.string().describe('Repository owner to fork from'),\n repo: z.string().describe('Repository name to fork'),\n organization: z.string().optional().describe('Organization to fork into (omit to fork to your personal account)'),\n name: z.string().optional().describe('Name for the forked repository (defaults to the original name)'),\n }),\n execute: async ({ owner, repo, organization, name }) => {\n const { data } = await octokit.rest.repos.createFork({\n owner,\n repo,\n organization,\n name,\n })\n return {\n name: data.name,\n fullName: data.full_name,\n url: data.html_url,\n cloneUrl: data.clone_url,\n sshUrl: data.ssh_url,\n defaultBranch: data.default_branch,\n private: data.private,\n parent: data.parent ? { fullName: data.parent.full_name, url: data.parent.html_url } : null,\n }\n },\n })\n\nexport const createRepository = (octokit: Octokit, { needsApproval = true }: ToolOptions = {}) =>\n tool({\n description: 'Create a new GitHub repository for the authenticated user or a specified organization',\n needsApproval,\n inputSchema: z.object({\n name: z.string().describe('Repository name'),\n description: z.string().optional().describe('A short description of the repository'),\n isPrivate: z.boolean().optional().default(false).describe('Whether the repository is private'),\n autoInit: z.boolean().optional().default(false).describe('Create an initial commit with a README'),\n gitignoreTemplate: z.string().optional().describe('Gitignore template to use (e.g. \"Node\", \"Python\")'),\n licenseTemplate: z.string().optional().describe('License keyword (e.g. \"mit\", \"apache-2.0\")'),\n org: z.string().optional().describe('Organization to create the repository in (omit for personal repo)'),\n }),\n execute: async ({ name, description, isPrivate, autoInit, gitignoreTemplate, licenseTemplate, org }) => {\n const params = {\n name,\n description,\n private: isPrivate,\n auto_init: autoInit,\n gitignore_template: gitignoreTemplate,\n license_template: licenseTemplate,\n }\n\n const { data } = org\n ? await octokit.rest.repos.createInOrg({ org, ...params })\n : await octokit.rest.repos.createForAuthenticatedUser(params)\n\n return {\n name: data.name,\n fullName: data.full_name,\n description: data.description,\n url: data.html_url,\n cloneUrl: data.clone_url,\n sshUrl: data.ssh_url,\n defaultBranch: data.default_branch,\n private: data.private,\n createdAt: data.created_at,\n }\n },\n })\n\nexport const createOrUpdateFile = (octokit: Octokit, { needsApproval = true }: ToolOptions = {}) =>\n tool({\n description: 'Create or update a file in a GitHub repository. Provide the SHA when updating an existing file.',\n needsApproval,\n inputSchema: z.object({\n owner: z.string().describe('Repository owner'),\n repo: z.string().describe('Repository name'),\n path: z.string().describe('Path to the file in the repository'),\n message: z.string().describe('Commit message'),\n content: z.string().describe('File content (plain text, will be base64-encoded automatically)'),\n branch: z.string().optional().describe('Branch to commit to (defaults to the default branch)'),\n sha: z.string().optional().describe('SHA of the file being replaced (required when updating an existing file)'),\n }),\n execute: async ({ owner, repo, path, message, content, branch, sha }) => {\n const encoded = Buffer.from(content).toString('base64')\n const { data } = await octokit.rest.repos.createOrUpdateFileContents({\n owner,\n repo,\n path,\n message,\n content: encoded,\n branch,\n sha,\n })\n return {\n path: data.content?.path,\n sha: data.content?.sha,\n commitSha: data.commit.sha,\n commitUrl: data.commit.html_url,\n }\n },\n })\n","import { tool } from 'ai'\nimport { z } from 'zod'\nimport type { Octokit, ToolOptions } from '../types'\n\nexport const listPullRequests = (octokit: Octokit) =>\n tool({\n description: 'List pull requests for a GitHub repository',\n inputSchema: z.object({\n owner: z.string().describe('Repository owner'),\n repo: z.string().describe('Repository name'),\n state: z.enum(['open', 'closed', 'all']).optional().default('open').describe('Filter by state'),\n perPage: z.number().optional().default(30).describe('Number of results to return (max 100)'),\n }),\n execute: async ({ owner, repo, state, perPage }) => {\n const { data } = await octokit.rest.pulls.list({ owner, repo, state, per_page: perPage })\n return data.map(pr => ({\n number: pr.number,\n title: pr.title,\n state: pr.state,\n url: pr.html_url,\n author: pr.user?.login,\n branch: pr.head.ref,\n base: pr.base.ref,\n draft: pr.draft,\n createdAt: pr.created_at,\n updatedAt: pr.updated_at,\n }))\n },\n })\n\nexport const getPullRequest = (octokit: Octokit) =>\n tool({\n description: 'Get detailed information about a specific pull request',\n inputSchema: z.object({\n owner: z.string().describe('Repository owner'),\n repo: z.string().describe('Repository name'),\n pullNumber: z.number().describe('Pull request number'),\n }),\n execute: async ({ owner, repo, pullNumber }) => {\n const { data } = await octokit.rest.pulls.get({ owner, repo, pull_number: pullNumber })\n return {\n number: data.number,\n title: data.title,\n body: data.body,\n state: data.state,\n url: data.html_url,\n author: data.user?.login,\n branch: data.head.ref,\n base: data.base.ref,\n draft: data.draft,\n merged: data.merged,\n mergeable: data.mergeable,\n additions: data.additions,\n deletions: data.deletions,\n changedFiles: data.changed_files,\n createdAt: data.created_at,\n updatedAt: data.updated_at,\n mergedAt: data.merged_at,\n }\n },\n })\n\nexport const createPullRequest = (octokit: Octokit, { needsApproval = true }: ToolOptions = {}) =>\n tool({\n description: 'Create a new pull request in a GitHub repository',\n needsApproval,\n inputSchema: z.object({\n owner: z.string().describe('Repository owner'),\n repo: z.string().describe('Repository name'),\n title: z.string().describe('Pull request title'),\n body: z.string().optional().describe('Pull request description (supports Markdown)'),\n head: z.string().describe('Branch containing the changes (format: branch or username:branch)'),\n base: z.string().describe('Branch to merge into'),\n draft: z.boolean().optional().default(false).describe('Create as draft pull request'),\n }),\n execute: async ({ owner, repo, title, body, head, base, draft }) => {\n const { data } = await octokit.rest.pulls.create({ owner, repo, title, body, head, base, draft })\n return {\n number: data.number,\n title: data.title,\n url: data.html_url,\n state: data.state,\n draft: data.draft,\n branch: data.head.ref,\n base: data.base.ref,\n }\n },\n })\n\nexport const mergePullRequest = (octokit: Octokit, { needsApproval = true }: ToolOptions = {}) =>\n tool({\n description: 'Merge a pull request',\n needsApproval,\n inputSchema: z.object({\n owner: z.string().describe('Repository owner'),\n repo: z.string().describe('Repository name'),\n pullNumber: z.number().describe('Pull request number'),\n commitTitle: z.string().optional().describe('Title for the automatic merge commit'),\n commitMessage: z.string().optional().describe('Extra detail to append to automatic commit message'),\n mergeMethod: z.enum(['merge', 'squash', 'rebase']).optional().default('merge').describe('Merge strategy'),\n }),\n execute: async ({ owner, repo, pullNumber, commitTitle, commitMessage, mergeMethod }) => {\n const { data } = await octokit.rest.pulls.merge({\n owner,\n repo,\n pull_number: pullNumber,\n commit_title: commitTitle,\n commit_message: commitMessage,\n merge_method: mergeMethod,\n })\n return {\n merged: data.merged,\n message: data.message,\n sha: data.sha,\n }\n },\n })\n\nexport const addPullRequestComment = (octokit: Octokit, { needsApproval = true }: ToolOptions = {}) =>\n tool({\n description: 'Add a comment to a pull request',\n needsApproval,\n inputSchema: z.object({\n owner: z.string().describe('Repository owner'),\n repo: z.string().describe('Repository name'),\n pullNumber: z.number().describe('Pull request number'),\n body: z.string().describe('Comment text (supports Markdown)'),\n }),\n execute: async ({ owner, repo, pullNumber, body }) => {\n const { data } = await octokit.rest.issues.createComment({ owner, repo, issue_number: pullNumber, body })\n return {\n id: data.id,\n url: data.html_url,\n body: data.body,\n author: data.user?.login,\n createdAt: data.created_at,\n }\n },\n })\n","import { tool } from 'ai'\nimport { z } from 'zod'\nimport type { Octokit, ToolOptions } from '../types'\n\nexport const listIssues = (octokit: Octokit) =>\n tool({\n description: 'List issues for a GitHub repository (excludes pull requests)',\n inputSchema: z.object({\n owner: z.string().describe('Repository owner'),\n repo: z.string().describe('Repository name'),\n state: z.enum(['open', 'closed', 'all']).optional().default('open').describe('Filter by state'),\n labels: z.string().optional().describe('Comma-separated list of label names to filter by'),\n perPage: z.number().optional().default(30).describe('Number of results to return (max 100)'),\n }),\n execute: async ({ owner, repo, state, labels, perPage }) => {\n const { data } = await octokit.rest.issues.listForRepo({\n owner,\n repo,\n state,\n labels,\n per_page: perPage,\n })\n return data\n .filter(issue => !issue.pull_request)\n .map(issue => ({\n number: issue.number,\n title: issue.title,\n state: issue.state,\n url: issue.html_url,\n author: issue.user?.login,\n labels: issue.labels.map(l => (typeof l === 'string' ? l : l.name)),\n createdAt: issue.created_at,\n updatedAt: issue.updated_at,\n }))\n },\n })\n\nexport const getIssue = (octokit: Octokit) =>\n tool({\n description: 'Get detailed information about a specific issue',\n inputSchema: z.object({\n owner: z.string().describe('Repository owner'),\n repo: z.string().describe('Repository name'),\n issueNumber: z.number().describe('Issue number'),\n }),\n execute: async ({ owner, repo, issueNumber }) => {\n const { data } = await octokit.rest.issues.get({ owner, repo, issue_number: issueNumber })\n return {\n number: data.number,\n title: data.title,\n body: data.body,\n state: data.state,\n url: data.html_url,\n author: data.user?.login,\n assignees: data.assignees?.map(a => a.login),\n labels: data.labels.map(l => (typeof l === 'string' ? l : l.name)),\n comments: data.comments,\n createdAt: data.created_at,\n updatedAt: data.updated_at,\n closedAt: data.closed_at,\n }\n },\n })\n\nexport const createIssue = (octokit: Octokit, { needsApproval = true }: ToolOptions = {}) =>\n tool({\n description: 'Create a new issue in a GitHub repository',\n needsApproval,\n inputSchema: z.object({\n owner: z.string().describe('Repository owner'),\n repo: z.string().describe('Repository name'),\n title: z.string().describe('Issue title'),\n body: z.string().optional().describe('Issue description (supports Markdown)'),\n labels: z.array(z.string()).optional().describe('Labels to apply to the issue'),\n assignees: z.array(z.string()).optional().describe('GitHub usernames to assign to the issue'),\n }),\n execute: async ({ owner, repo, title, body, labels, assignees }) => {\n const { data } = await octokit.rest.issues.create({ owner, repo, title, body, labels, assignees })\n return {\n number: data.number,\n title: data.title,\n url: data.html_url,\n state: data.state,\n labels: data.labels.map(l => (typeof l === 'string' ? l : l.name)),\n }\n },\n })\n\nexport const addIssueComment = (octokit: Octokit, { needsApproval = true }: ToolOptions = {}) =>\n tool({\n description: 'Add a comment to a GitHub issue',\n needsApproval,\n inputSchema: z.object({\n owner: z.string().describe('Repository owner'),\n repo: z.string().describe('Repository name'),\n issueNumber: z.number().describe('Issue number'),\n body: z.string().describe('Comment text (supports Markdown)'),\n }),\n execute: async ({ owner, repo, issueNumber, body }) => {\n const { data } = await octokit.rest.issues.createComment({ owner, repo, issue_number: issueNumber, body })\n return {\n id: data.id,\n url: data.html_url,\n body: data.body,\n author: data.user?.login,\n createdAt: data.created_at,\n }\n },\n })\n\nexport const closeIssue = (octokit: Octokit, { needsApproval = true }: ToolOptions = {}) =>\n tool({\n description: 'Close an open GitHub issue',\n needsApproval,\n inputSchema: z.object({\n owner: z.string().describe('Repository owner'),\n repo: z.string().describe('Repository name'),\n issueNumber: z.number().describe('Issue number to close'),\n stateReason: z.enum(['completed', 'not_planned']).optional().default('completed').describe('Reason for closing'),\n }),\n execute: async ({ owner, repo, issueNumber, stateReason }) => {\n const { data } = await octokit.rest.issues.update({\n owner,\n repo,\n issue_number: issueNumber,\n state: 'closed',\n state_reason: stateReason,\n })\n return {\n number: data.number,\n title: data.title,\n state: data.state,\n url: data.html_url,\n closedAt: data.closed_at,\n }\n },\n })\n","import { tool } from 'ai'\nimport { z } from 'zod'\nimport type { Octokit } from '../types'\n\nexport const searchCode = (octokit: Octokit) =>\n tool({\n description: 'Search for code in GitHub repositories. Use qualifiers like \"repo:owner/name\" to scope the search.',\n inputSchema: z.object({\n query: z.string().describe('Search query. Supports GitHub search qualifiers, e.g. \"useState repo:facebook/react\"'),\n perPage: z.number().optional().default(10).describe('Number of results to return (max 30)'),\n }),\n execute: async ({ query, perPage }) => {\n const { data } = await octokit.rest.search.code({ q: query, per_page: perPage })\n return {\n totalCount: data.total_count,\n items: data.items.map(item => ({\n name: item.name,\n path: item.path,\n url: item.html_url,\n repository: item.repository.full_name,\n sha: item.sha,\n })),\n }\n },\n })\n\nexport const searchRepositories = (octokit: Octokit) =>\n tool({\n description: 'Search for GitHub repositories by keyword, topic, language, or other qualifiers',\n inputSchema: z.object({\n query: z.string().describe('Search query. Supports GitHub search qualifiers, e.g. \"nuxt language:typescript stars:>1000\"'),\n perPage: z.number().optional().default(10).describe('Number of results to return (max 30)'),\n sort: z.enum(['stars', 'forks', 'help-wanted-issues', 'updated']).optional().describe('Sort field'),\n order: z.enum(['asc', 'desc']).optional().default('desc').describe('Sort order'),\n }),\n execute: async ({ query, perPage, sort, order }) => {\n const { data } = await octokit.rest.search.repos({ q: query, per_page: perPage, sort, order })\n return {\n totalCount: data.total_count,\n items: data.items.map(repo => ({\n name: repo.name,\n fullName: repo.full_name,\n description: repo.description,\n url: repo.html_url,\n stars: repo.stargazers_count,\n forks: repo.forks_count,\n language: repo.language,\n topics: repo.topics,\n })),\n }\n },\n })\n","import { tool } from 'ai'\nimport { z } from 'zod'\nimport type { Octokit } from '../types'\n\nexport const listCommits = (octokit: Octokit) =>\n tool({\n description: 'List commits for a GitHub repository. Filter by file path to see who changed a specific file and when (git blame alternative). Filter by author, branch, or date range.',\n inputSchema: z.object({\n owner: z.string().describe('Repository owner'),\n repo: z.string().describe('Repository name'),\n path: z.string().optional().describe('Only commits containing this file path'),\n sha: z.string().optional().describe('Branch name or commit SHA to start listing from'),\n author: z.string().optional().describe('GitHub username or email to filter commits by'),\n since: z.string().optional().describe('Only commits after this date (ISO 8601 format)'),\n until: z.string().optional().describe('Only commits before this date (ISO 8601 format)'),\n perPage: z.number().optional().default(30).describe('Number of results to return (max 100)'),\n }),\n execute: async ({ owner, repo, path, sha, author, since, until, perPage }) => {\n const { data } = await octokit.rest.repos.listCommits({\n owner,\n repo,\n path,\n sha,\n author,\n since,\n until,\n per_page: perPage,\n })\n return data.map(commit => ({\n sha: commit.sha,\n message: commit.commit.message,\n author: commit.commit.author?.name,\n authorLogin: commit.author?.login,\n date: commit.commit.author?.date,\n url: commit.html_url,\n }))\n },\n })\n\nexport const getCommit = (octokit: Octokit) =>\n tool({\n description: 'Get detailed information about a specific commit, including the list of files changed with additions and deletions',\n inputSchema: z.object({\n owner: z.string().describe('Repository owner'),\n repo: z.string().describe('Repository name'),\n ref: z.string().describe('Commit SHA, branch name, or tag'),\n }),\n execute: async ({ owner, repo, ref }) => {\n const { data } = await octokit.rest.repos.getCommit({ owner, repo, ref })\n return {\n sha: data.sha,\n message: data.commit.message,\n author: data.commit.author?.name,\n authorLogin: data.author?.login,\n date: data.commit.author?.date,\n url: data.html_url,\n stats: data.stats ? {\n additions: data.stats.additions,\n deletions: data.stats.deletions,\n total: data.stats.total,\n } : null,\n files: data.files?.map(file => ({\n filename: file.filename,\n status: file.status,\n additions: file.additions,\n deletions: file.deletions,\n patch: file.patch,\n })),\n }\n },\n })\n","import { ToolLoopAgent } from 'ai'\nimport type { ToolLoopAgentSettings } from 'ai'\nimport { createGithubTools } from './index'\nimport type { GithubToolPreset, ApprovalConfig } from './index'\n\nconst SHARED_RULES = `When a tool execution is denied by the user, do not retry it. Briefly acknowledge the decision and move on.`\n\nconst DEFAULT_INSTRUCTIONS = `You are a helpful GitHub assistant. You can read and explore repositories, issues, pull requests, commits, and code. You can also create issues, pull requests, comments, and update files when asked.\n\n${SHARED_RULES}`\n\nconst PRESET_INSTRUCTIONS: Record<GithubToolPreset, string> = {\n 'code-review': `You are a code review assistant. Your job is to review pull requests thoroughly and provide constructive feedback.\n\nWhen reviewing a PR:\n- Read the PR description and changed files carefully\n- Check for bugs, logic errors, and edge cases\n- Suggest improvements when you spot issues\n- Be constructive — explain why something is a problem and how to fix it\n- Post your review as PR comments when asked\n\n${SHARED_RULES}`,\n\n 'issue-triage': `You are an issue triage assistant. Your job is to help manage and organize GitHub issues.\n\nWhen triaging issues:\n- Read issue descriptions carefully to understand the problem\n- Identify duplicates when possible\n- Help categorize and prioritize issues\n- Respond to users with clear, helpful information\n- Create new issues when asked, with clear titles and descriptions\n\n${SHARED_RULES}`,\n\n 'repo-explorer': `You are a repository explorer. Your job is to help users understand codebases and find information across GitHub repositories.\n\nWhen exploring repos:\n- Answer questions about code structure and organization\n- Summarize recent activity (commits, PRs, issues)\n- Find specific files, functions, or patterns in code\n- Explain how different parts of the codebase work together\n- You have read-only access — you cannot make changes\n\n${SHARED_RULES}`,\n\n 'maintainer': `You are a repository maintainer assistant. You have full access to manage repositories, issues, and pull requests.\n\nWhen maintaining repos:\n- Be careful with write operations — review before acting\n- Create well-structured issues and PRs with clear descriptions\n- Use merge strategies appropriate for the repository\n- Keep commit messages clean and descriptive\n- When closing issues, provide a clear reason\n\n${SHARED_RULES}`\n}\n\ntype AgentOptions = Omit<ToolLoopAgentSettings, 'model' | 'tools' | 'instructions'>\n\nexport type CreateGithubAgentOptions = AgentOptions & {\n model: ToolLoopAgentSettings['model']\n /**\n * GitHub personal access token.\n * Falls back to `process.env.GITHUB_TOKEN` when omitted.\n */\n token?: string\n preset?: GithubToolPreset | GithubToolPreset[]\n requireApproval?: ApprovalConfig\n instructions?: string\n additionalInstructions?: string\n}\n\n/**\n * Create a pre-configured GitHub agent powered by the AI SDK's `ToolLoopAgent`.\n *\n * Returns a `ToolLoopAgent` instance with `.generate()` and `.stream()` methods.\n *\n * @example\n * ```ts\n * import { createGithubAgent } from '@github-tools/sdk'\n *\n * const agent = createGithubAgent({\n * model: 'anthropic/claude-sonnet-4.6',\n * token: process.env.GITHUB_TOKEN!,\n * preset: 'code-review',\n * })\n *\n * const result = await agent.generate({ prompt: 'Review PR #42 on vercel/ai' })\n * ```\n */\nexport function createGithubAgent({\n token,\n preset,\n requireApproval,\n instructions,\n additionalInstructions,\n ...agentOptions\n}: CreateGithubAgentOptions) {\n const tools = createGithubTools({ token, requireApproval, preset })\n\n const defaultPrompt = preset && !Array.isArray(preset)\n ? PRESET_INSTRUCTIONS[preset]\n : DEFAULT_INSTRUCTIONS\n\n let resolvedInstructions: string\n if (instructions) {\n resolvedInstructions = instructions\n } else if (additionalInstructions) {\n resolvedInstructions = `${defaultPrompt}\\n\\n${additionalInstructions}`\n } else {\n resolvedInstructions = defaultPrompt\n }\n\n return new ToolLoopAgent({\n ...agentOptions,\n tools,\n instructions: resolvedInstructions\n })\n}\n","import { createOctokit } from './client'\nimport { getRepository, listBranches, getFileContent, createBranch, forkRepository, createRepository, createOrUpdateFile } from './tools/repository'\nimport { listPullRequests, getPullRequest, createPullRequest, mergePullRequest, addPullRequestComment } from './tools/pull-requests'\nimport { listIssues, getIssue, createIssue, addIssueComment, closeIssue } from './tools/issues'\nimport { searchCode, searchRepositories } from './tools/search'\nimport { listCommits, getCommit } from './tools/commits'\n\nexport type GithubWriteToolName =\n | 'createBranch'\n | 'forkRepository'\n | 'createRepository'\n | 'createOrUpdateFile'\n | 'createPullRequest'\n | 'mergePullRequest'\n | 'addPullRequestComment'\n | 'createIssue'\n | 'addIssueComment'\n | 'closeIssue'\n\n/**\n * Whether write operations require user approval.\n * - `true` — all write tools need approval (default)\n * - `false` — no approval needed for any write tool\n * - object — per-tool override; unspecified write tools default to `true`\n *\n * @example\n * ```ts\n * requireApproval: {\n * mergePullRequest: true,\n * createOrUpdateFile: true,\n * addPullRequestComment: false,\n * addIssueComment: false,\n * }\n * ```\n */\nexport type ApprovalConfig = boolean | Partial<Record<GithubWriteToolName, boolean>>\n\n/**\n * Predefined tool presets for common use cases.\n *\n * - `'code-review'` — Review PRs: read PRs, file content, commits, and post comments\n * - `'issue-triage'` — Triage issues: read/create/close issues, search, and comment\n * - `'repo-explorer'` — Explore repos: read-only access to repos, branches, code, and search\n * - `'maintainer'` — Full maintenance: all read + create PRs, merge, manage issues\n */\nexport type GithubToolPreset = 'code-review' | 'issue-triage' | 'repo-explorer' | 'maintainer'\n\nconst PRESET_TOOLS: Record<GithubToolPreset, string[]> = {\n 'code-review': [\n 'getPullRequest', 'listPullRequests', 'getFileContent', 'listCommits', 'getCommit',\n 'getRepository', 'listBranches', 'searchCode',\n 'addPullRequestComment'\n ],\n 'issue-triage': [\n 'listIssues', 'getIssue', 'createIssue', 'addIssueComment', 'closeIssue',\n 'getRepository', 'searchRepositories', 'searchCode'\n ],\n 'repo-explorer': [\n 'getRepository', 'listBranches', 'getFileContent',\n 'listPullRequests', 'getPullRequest',\n 'listIssues', 'getIssue',\n 'listCommits', 'getCommit',\n 'searchCode', 'searchRepositories'\n ],\n 'maintainer': [\n 'getRepository', 'listBranches', 'getFileContent', 'createBranch', 'forkRepository', 'createRepository', 'createOrUpdateFile',\n 'listPullRequests', 'getPullRequest', 'createPullRequest', 'mergePullRequest', 'addPullRequestComment',\n 'listIssues', 'getIssue', 'createIssue', 'addIssueComment', 'closeIssue',\n 'listCommits', 'getCommit',\n 'searchCode', 'searchRepositories'\n ]\n}\n\nexport type GithubToolsOptions = {\n /**\n * GitHub personal access token.\n * Falls back to `process.env.GITHUB_TOKEN` when omitted.\n */\n token?: string\n requireApproval?: ApprovalConfig\n /**\n * Restrict the returned tools to a predefined preset.\n * Omit to get all tools.\n *\n * @example\n * ```ts\n * // Only code-review tools\n * createGithubTools({ token, preset: 'code-review' })\n *\n * // Combine presets\n * createGithubTools({ token, preset: ['code-review', 'issue-triage'] })\n * ```\n */\n preset?: GithubToolPreset | GithubToolPreset[]\n}\n\nfunction resolveApproval(toolName: GithubWriteToolName, config: ApprovalConfig): boolean {\n if (typeof config === 'boolean') return config\n return config[toolName] ?? true\n}\n\nfunction resolvePresetTools(preset: GithubToolPreset | GithubToolPreset[]): Set<string> | null {\n if (!preset) return null\n const presets = Array.isArray(preset) ? preset : [preset]\n const tools = new Set<string>()\n for (const p of presets) {\n for (const t of PRESET_TOOLS[p]) tools.add(t)\n }\n return tools\n}\n\n/**\n * Create a set of GitHub tools for the Vercel AI SDK.\n *\n * Write operations require user approval by default.\n * Control this globally or per-tool via `requireApproval`.\n * Use `preset` to get only the tools you need.\n *\n * @example\n * ```ts\n * // All tools (default)\n * createGithubTools({ token })\n *\n * // Code-review agent — only PR & commit tools\n * createGithubTools({ token, preset: 'code-review' })\n *\n * // Combine presets\n * createGithubTools({ token, preset: ['code-review', 'issue-triage'] })\n *\n * // Granular approval\n * createGithubTools({\n * token,\n * preset: 'maintainer',\n * requireApproval: {\n * mergePullRequest: true,\n * createOrUpdateFile: true,\n * addPullRequestComment: false,\n * }\n * })\n * ```\n */\nexport function createGithubTools({ token, requireApproval = true, preset }: GithubToolsOptions = {}) {\n const resolvedToken = token || process.env.GITHUB_TOKEN\n if (!resolvedToken) {\n throw new Error('GitHub token is required. Pass it as `token` or set the GITHUB_TOKEN environment variable.')\n }\n const octokit = createOctokit(resolvedToken)\n const approval = (name: GithubWriteToolName) => ({ needsApproval: resolveApproval(name, requireApproval) })\n const allowed = preset ? resolvePresetTools(preset) : null\n\n const allTools = {\n getRepository: getRepository(octokit),\n listBranches: listBranches(octokit),\n getFileContent: getFileContent(octokit),\n listPullRequests: listPullRequests(octokit),\n getPullRequest: getPullRequest(octokit),\n listIssues: listIssues(octokit),\n getIssue: getIssue(octokit),\n searchCode: searchCode(octokit),\n searchRepositories: searchRepositories(octokit),\n listCommits: listCommits(octokit),\n getCommit: getCommit(octokit),\n createBranch: createBranch(octokit, approval('createBranch')),\n forkRepository: forkRepository(octokit, approval('forkRepository')),\n createRepository: createRepository(octokit, approval('createRepository')),\n createOrUpdateFile: createOrUpdateFile(octokit, approval('createOrUpdateFile')),\n createPullRequest: createPullRequest(octokit, approval('createPullRequest')),\n mergePullRequest: mergePullRequest(octokit, approval('mergePullRequest')),\n addPullRequestComment: addPullRequestComment(octokit, approval('addPullRequestComment')),\n createIssue: createIssue(octokit, approval('createIssue')),\n addIssueComment: addIssueComment(octokit, approval('addIssueComment')),\n closeIssue: closeIssue(octokit, approval('closeIssue')),\n }\n\n if (!allowed) return allTools\n\n return Object.fromEntries(\n Object.entries(allTools).filter(([name]) => allowed.has(name))\n ) as Partial<typeof allTools>\n}\n\nexport type GithubTools = ReturnType<typeof createGithubTools>\n\n// Re-export individual tool factories for cherry-picking\nexport { createOctokit } from './client'\nexport { getRepository, listBranches, getFileContent, createBranch, forkRepository, createRepository, createOrUpdateFile } from './tools/repository'\nexport { listPullRequests, getPullRequest, createPullRequest, mergePullRequest, addPullRequestComment } from './tools/pull-requests'\nexport { listIssues, getIssue, createIssue, addIssueComment, closeIssue } from './tools/issues'\nexport { searchCode, searchRepositories } from './tools/search'\nexport { listCommits, getCommit } from './tools/commits'\nexport type { Octokit, ToolOptions } from './types'\nexport { createGithubAgent } from './agents'\nexport type { CreateGithubAgentOptions } from './agents'\n"],"mappings":";;;;;AAEA,SAAgB,cAAc,OAAwB;AACp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Aa,QAAQ;EACnC,gBAAgB,eAAe,QAAQ;EACvC,kBAAkB,iBAAiB,QAAQ;EAC3C,gBAAgB,eAAe,QAAQ;EACvC,YAAY,WAAW,QAAQ;EAC/B,UAAU,SAAS,QAAQ;EAC3B,YAAY,WAAW,QAAQ;EAC/B,oBAAoB,mBAAmB,QAAQ;EAC/C,aAAa,YAAY,QAAQ;EACjC,WAAW,UAAU,QAAQ;EAC7B,cAAc,aAAa,SAAS,SAAS,eAAe,CAAC;EAC7D,gBAAgB,eAAe,SAAS,SAAS,iBAAiB,CAAC;EACnE,kBAAkB,iBAAiB,SAAS,SAAS,mBAAmB,CAAC;EACzE,oBAAoB,mBAAmB,SAAS,SAAS,qBAAqB,CAAC;EAC/E,mBAAmB,kBAAkB,SAAS,SAAS,oBAAoB,CAAC;EAC5E,kBAAkB,iBAAiB,SAAS,SAAS,mBAAmB,CAAC;EACzE,uBAAuB,sBAAsB,SAAS,SAAS,wBAAwB,CAAC;EACxF,aAAa,YAAY,SAAS,SAAS,cAAc,CAAC;EAC1D,iBAAiB,gBAAgB,SAAS,SAAS,kBAAkB,CAAC;EACtE,YAAY,WAAW,SAAS,SAAS,aAAa,CAAC;EACxD;AAED,KAAI,CAAC,QAAS,QAAO;AAErB,QAAO,OAAO,YACZ,OAAO,QAAQ,SAAS,CAAC,QAAQ,CAAC,UAAU,QAAQ,IAAI,KAAK,CAAC,CAC/D"}
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@github-tools/sdk",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "GitHub tools for the Vercel AI SDK, wrap GitHub's API as AI SDK tools ready to plug into any agent",
5
5
  "author": "HugoRCD <hugo.richard@vercel.com",
6
6
  "repository": {
7
7
  "type": "git",
8
- "url": "git+https://github.com/HugoRCD/github-tools.git",
8
+ "url": "git+https://github.com/vercel-labs/github-tools.git",
9
9
  "directory": "packages/github-tools"
10
10
  },
11
- "homepage": "https://github.com/HugoRCD/github-tools",
11
+ "homepage": "https://github.com/vercel-labs/github-tools",
12
12
  "bugs": {
13
- "url": "https://github.com/HugoRCD/github-tools/issues"
13
+ "url": "https://github.com/vercel-labs/github-tools/issues"
14
14
  },
15
15
  "type": "module",
16
16
  "sideEffects": false,
@@ -35,7 +35,7 @@
35
35
  ],
36
36
  "license": "MIT",
37
37
  "dependencies": {
38
- "@octokit/rest": "^22.0.1"
38
+ "octokit": "^5.0.5"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "ai": "^6.0.97",
@@ -43,8 +43,10 @@
43
43
  },
44
44
  "devDependencies": {
45
45
  "@types/node": "^24.10.13",
46
+ "eslint": "^9.19.0",
46
47
  "tsdown": "^0.20.3",
47
- "typescript": "^5.9.3"
48
+ "typescript": "^5.9.3",
49
+ "typescript-eslint": "^8.24.0"
48
50
  },
49
51
  "publishConfig": {
50
52
  "access": "public"
@@ -52,7 +54,8 @@
52
54
  "scripts": {
53
55
  "build": "tsdown",
54
56
  "dev": "tsdown --watch",
55
- "lint": "tsc --noEmit",
57
+ "lint": "eslint .",
58
+ "lint:fix": "eslint . --fix",
56
59
  "typecheck": "tsc --noEmit"
57
60
  }
58
61
  }