@github-tools/sdk 1.5.0 → 1.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,220 @@
1
+ import { _ as PresetToolName, c as GithubTool, h as GithubToolPreset, m as CombinedPresetToolNames, n as GithubToolsBaseOptions, o as CommitIdentity, s as CommitToolOptions, t as AllGithubTools, u as ToolOptions, y as GithubToolName } from "./tool-types-CuirBEc8.mjs";
2
+ import { ToolLoopAgent, ToolLoopAgentSettings, ToolSet } from "ai";
3
+ import { z } from "zod";
4
+ import { Octokit } from "octokit";
5
+
6
+ //#region src/client.d.ts
7
+ declare function createOctokit(token: string): Octokit;
8
+ //#endregion
9
+ //#region src/tools/repository.d.ts
10
+ /** Get information about a GitHub repository including description, stars, forks, language, and default branch. */
11
+ declare const getRepository: (token: string) => GithubTool;
12
+ /** List branches in a GitHub repository. */
13
+ declare const listBranches: (token: string) => GithubTool;
14
+ /** Get the content of a file from a GitHub repository. */
15
+ declare const getFileContent: (token: string) => GithubTool;
16
+ /** Create a new branch in a GitHub repository from an existing branch or commit SHA. Requires approval by default. */
17
+ declare const createBranch: (token: string, {
18
+ needsApproval
19
+ }?: ToolOptions) => GithubTool;
20
+ /** Fork a GitHub repository to the authenticated user account or a specified organization. Requires approval by default. */
21
+ declare const forkRepository: (token: string, {
22
+ needsApproval
23
+ }?: ToolOptions) => GithubTool;
24
+ /** Create a new GitHub repository for the authenticated user or a specified organization. Requires approval by default. */
25
+ declare const createRepository: (token: string, {
26
+ needsApproval
27
+ }?: ToolOptions) => GithubTool;
28
+ /** Create or update a file in a GitHub repository. Provide the SHA when updating an existing file. Requires approval by default. */
29
+ declare const createOrUpdateFile: (token: string, {
30
+ needsApproval,
31
+ author,
32
+ committer,
33
+ coAuthors
34
+ }?: CommitToolOptions) => GithubTool;
35
+ //#endregion
36
+ //#region src/tools/pull-requests.d.ts
37
+ type MergeToolOptions = ToolOptions & {
38
+ coAuthors?: CommitIdentity[];
39
+ };
40
+ /** List pull requests for a GitHub repository. */
41
+ declare const listPullRequests: (token: string) => GithubTool;
42
+ /** Get detailed information about a specific pull request. */
43
+ declare const getPullRequest: (token: string) => GithubTool;
44
+ /** Create a new pull request in a GitHub repository. Requires approval by default. */
45
+ declare const createPullRequest: (token: string, {
46
+ needsApproval
47
+ }?: ToolOptions) => GithubTool;
48
+ /** Merge a pull request. Requires approval by default. */
49
+ declare const mergePullRequest: (token: string, {
50
+ needsApproval,
51
+ coAuthors
52
+ }?: MergeToolOptions) => GithubTool;
53
+ /** Add a comment to a pull request. Requires approval by default. */
54
+ declare const addPullRequestComment: (token: string, {
55
+ needsApproval
56
+ }?: ToolOptions) => GithubTool;
57
+ /** List files changed in a pull request, including diff status and patch content. */
58
+ declare const listPullRequestFiles: (token: string) => GithubTool;
59
+ /** List reviews on a pull request (approvals, change requests, and comments). */
60
+ declare const listPullRequestReviews: (token: string) => GithubTool;
61
+ /** Submit a pull request review with optional inline comments. Requires approval by default. */
62
+ declare const createPullRequestReview: (token: string, {
63
+ needsApproval
64
+ }?: ToolOptions) => GithubTool;
65
+ //#endregion
66
+ //#region src/tools/issues.d.ts
67
+ /** List issues for a GitHub repository (excludes pull requests). */
68
+ declare const listIssues: (token: string) => GithubTool;
69
+ /** Get detailed information about a specific issue. */
70
+ declare const getIssue: (token: string) => GithubTool;
71
+ /** Create a new issue in a GitHub repository. Requires approval by default. */
72
+ declare const createIssue: (token: string, {
73
+ needsApproval
74
+ }?: ToolOptions) => GithubTool;
75
+ /** Add a comment to a GitHub issue. Requires approval by default. */
76
+ declare const addIssueComment: (token: string, {
77
+ needsApproval
78
+ }?: ToolOptions) => GithubTool;
79
+ /** Close an open GitHub issue. Requires approval by default. */
80
+ declare const closeIssue: (token: string, {
81
+ needsApproval
82
+ }?: ToolOptions) => GithubTool;
83
+ /** List labels available in a GitHub repository. */
84
+ declare const listLabels: (token: string) => GithubTool;
85
+ /** Add labels to an issue or pull request. Requires approval by default. */
86
+ declare const addLabels: (token: string, {
87
+ needsApproval
88
+ }?: ToolOptions) => GithubTool;
89
+ /** Remove a label from an issue or pull request. Requires approval by default. */
90
+ declare const removeLabel: (token: string, {
91
+ needsApproval
92
+ }?: ToolOptions) => GithubTool;
93
+ //#endregion
94
+ //#region src/tools/search.d.ts
95
+ /** Search for code in GitHub repositories. Use qualifiers like "repo:owner/name" to scope the search. */
96
+ declare const searchCode: (token: string) => GithubTool;
97
+ /** Search for GitHub repositories by keyword, topic, language, or other qualifiers. */
98
+ declare const searchRepositories: (token: string) => GithubTool;
99
+ //#endregion
100
+ //#region src/tools/commits.d.ts
101
+ /** List commits for a GitHub repository. Filter by file path to see commits that touched a file. */
102
+ declare const listCommits: (token: string) => GithubTool;
103
+ /** Get detailed information about a specific commit, including files changed with additions and deletions. */
104
+ declare const getCommit: (token: string) => GithubTool;
105
+ /** Line-level git blame for a file at a commit-like ref (branch, tag, or SHA). */
106
+ declare const getBlame: (token: string) => GithubTool;
107
+ //#endregion
108
+ //#region src/tools/gists.d.ts
109
+ /** List gists for the authenticated user or a specific user. */
110
+ declare const listGists: (token: string) => GithubTool;
111
+ /** Get a gist by ID, including file contents. */
112
+ declare const getGist: (token: string) => GithubTool;
113
+ /** List comments on a gist. */
114
+ declare const listGistComments: (token: string) => GithubTool;
115
+ /** Create a new gist with one or more files. Requires approval by default. */
116
+ declare const createGist: (token: string, {
117
+ needsApproval
118
+ }?: ToolOptions) => GithubTool;
119
+ /** Update an existing gist. Requires approval by default. */
120
+ declare const updateGist: (token: string, {
121
+ needsApproval
122
+ }?: ToolOptions) => GithubTool;
123
+ /** Delete a gist permanently. Requires approval by default. */
124
+ declare const deleteGist: (token: string, {
125
+ needsApproval
126
+ }?: ToolOptions) => GithubTool;
127
+ /** Add a comment to a gist. Requires approval by default. */
128
+ declare const createGistComment: (token: string, {
129
+ needsApproval
130
+ }?: ToolOptions) => GithubTool;
131
+ //#endregion
132
+ //#region src/tools/workflows.d.ts
133
+ /** List GitHub Actions workflows in a repository. */
134
+ declare const listWorkflows: (token: string) => GithubTool;
135
+ /** List workflow runs for a repository, optionally filtered by workflow, branch, status, or event. */
136
+ declare const listWorkflowRuns: (token: string) => GithubTool;
137
+ /** Get details of a specific workflow run including status, timing, and trigger info. */
138
+ declare const getWorkflowRun: (token: string) => GithubTool;
139
+ /** List jobs for a workflow run, including step-level status and timing. */
140
+ declare const listWorkflowJobs: (token: string) => GithubTool;
141
+ /** Trigger a workflow via workflow_dispatch event. Requires approval by default. */
142
+ declare const triggerWorkflow: (token: string, {
143
+ needsApproval
144
+ }?: ToolOptions) => GithubTool;
145
+ /** Cancel an in-progress workflow run. Requires approval by default. */
146
+ declare const cancelWorkflowRun: (token: string, {
147
+ needsApproval
148
+ }?: ToolOptions) => GithubTool;
149
+ /** Re-run a workflow run, optionally only the failed jobs. Requires approval by default. */
150
+ declare const rerunWorkflowRun: (token: string, {
151
+ needsApproval
152
+ }?: ToolOptions) => GithubTool;
153
+ //#endregion
154
+ //#region src/agents.d.ts
155
+ type AgentOptions = Omit<ToolLoopAgentSettings<ToolSet>, 'model' | 'tools' | 'instructions'>;
156
+ type CreateGithubAgentOptions = AgentOptions & GithubToolsBaseOptions & {
157
+ model: ToolLoopAgentSettings<ToolSet>['model'];
158
+ /**
159
+ * Restrict tools and system prompt to a predefined preset.
160
+ *
161
+ * Selects a subset of tools and, when a single preset is passed,
162
+ * sets a matching system prompt. Combine presets with an array to merge tool sets.
163
+ *
164
+ * @see {@link GithubToolPreset} for available presets and included tools.
165
+ */
166
+ preset?: GithubToolPreset | GithubToolPreset[];
167
+ /**
168
+ * Fully replace the default system prompt.
169
+ * When set, `preset` system prompts and `additionalInstructions` are ignored.
170
+ */
171
+ instructions?: string;
172
+ /**
173
+ * Append text to the preset-specific (or default) system prompt.
174
+ * Ignored when `instructions` is set.
175
+ */
176
+ additionalInstructions?: string;
177
+ };
178
+ declare function createGithubAgent(options: CreateGithubAgentOptions & {
179
+ preset?: undefined;
180
+ }): ToolLoopAgent<never, AllGithubTools>;
181
+ declare function createGithubAgent<P extends GithubToolPreset>(options: CreateGithubAgentOptions & {
182
+ preset: P;
183
+ }): ToolLoopAgent<never, Pick<AllGithubTools, PresetToolName<P>>>;
184
+ declare function createGithubAgent<P extends readonly GithubToolPreset[]>(options: CreateGithubAgentOptions & {
185
+ preset: P;
186
+ }): ToolLoopAgent<never, Pick<AllGithubTools, CombinedPresetToolNames<P>>>;
187
+ //#endregion
188
+ //#region src/index.d.ts
189
+ type GithubToolsOptions = GithubToolsBaseOptions & {
190
+ /**
191
+ * Restrict the returned tools to a predefined preset.
192
+ * Omit to get all tools.
193
+ *
194
+ * @see {@link GithubToolPreset} for available presets and included tools.
195
+ *
196
+ * @example
197
+ * ```ts
198
+ * // Only code-review tools
199
+ * createGithubTools({ token, preset: 'code-review' })
200
+ *
201
+ * // Combine presets
202
+ * createGithubTools({ token, preset: ['code-review', 'issue-triage'] })
203
+ * ```
204
+ */
205
+ preset?: GithubToolPreset | GithubToolPreset[];
206
+ };
207
+ declare function createGithubTools(options?: GithubToolsBaseOptions & {
208
+ preset?: undefined;
209
+ }): AllGithubTools;
210
+ declare function createGithubTools<P extends GithubToolPreset>(options: GithubToolsBaseOptions & {
211
+ preset: P;
212
+ }): Pick<AllGithubTools, PresetToolName<P>>;
213
+ declare function createGithubTools<P extends readonly GithubToolPreset[]>(options: GithubToolsBaseOptions & {
214
+ preset: P;
215
+ }): Pick<AllGithubTools, CombinedPresetToolNames<P>>;
216
+ declare function createGithubTools(options?: GithubToolsOptions): AllGithubTools | Pick<AllGithubTools, GithubToolName>;
217
+ type GithubTools = AllGithubTools & ToolSet;
218
+ //#endregion
219
+ export { listIssues as A, mergePullRequest as B, searchCode as C, closeIssue as D, addLabels as E, createPullRequestReview as F, getFileContent as G, createOrUpdateFile as H, getPullRequest as I, createOctokit as J, getRepository as K, listPullRequestFiles as L, removeLabel as M, addPullRequestComment as N, createIssue as O, createPullRequest as P, listPullRequestReviews as R, listCommits as S, addIssueComment as T, createRepository as U, createBranch as V, forkRepository as W, listGistComments as _, createGithubAgent as a, getBlame as b, listWorkflowJobs as c, rerunWorkflowRun as d, triggerWorkflow as f, getGist as g, deleteGist as h, CreateGithubAgentOptions as i, listLabels as j, getIssue as k, listWorkflowRuns as l, createGistComment as m, GithubToolsOptions as n, cancelWorkflowRun as o, createGist as p, listBranches as q, createGithubTools as r, getWorkflowRun as s, GithubTools as t, listWorkflows as u, listGists as v, searchRepositories as w, getCommit as x, updateGist as y, listPullRequests as z };
220
+ //# sourceMappingURL=index-BRUYe5q0.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-BRUYe5q0.d.mts","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/tools/gists.ts","../src/tools/workflows.ts","../src/agents.ts","../src/index.ts"],"mappings":";;;;;;iBAKgB,aAAA,CAAc,KAAA,WAAgB,OAAA;;;;cC+BjC,aAAA,GAAiB,KAAA,aAAgB,UAAA;;cAajC,YAAA,GAAgB,KAAA,aAAgB,UAAA;;cAahC,cAAA,GAAkB,KAAA,aAAgB,UAAA;;cAclC,YAAA,GAAgB,KAAA;EAAe;AAAA,IAA0B,WAAA,KAAmB,UAAA;;cAc5E,cAAA,GAAkB,KAAA;EAAe;AAAA,IAA0B,WAAA,KAAmB,UAAA;;cAc9E,gBAAA,GAAoB,KAAA;EAAe;AAAA,IAA0B,WAAA,KAAmB,UAAA;;cAchF,kBAAA,GACX,KAAA;EACA,aAAA;EAAA,MAAA;EAAA,SAAA;EAAA;AAAA,IAAwD,iBAAA,KACvD,UAAA;;;KC3FS,gBAAA,GAAmB,WAAA;EAC7B,SAAA,GAAY,cAAA;AAAA;;cASD,gBAAA,GAAoB,KAAA,aAAgB,UAAA;AFnCjD;AAAA,cEgDa,cAAA,GAAkB,KAAA,aAAgB,UAAA;;cAalC,iBAAA,GAAqB,KAAA;EAAe;AAAA,IAA0B,WAA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