@github-tools/sdk 1.8.2 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +184 -70
- package/dist/connect/eve.d.mts +11 -5
- package/dist/connect/eve.d.mts.map +1 -1
- package/dist/connect/eve.mjs +10 -2
- package/dist/connect/eve.mjs.map +1 -1
- package/dist/connect.d.mts +23 -11
- package/dist/connect.d.mts.map +1 -1
- package/dist/connect.mjs +6 -3
- package/dist/connect.mjs.map +1 -1
- package/dist/eve-DmiXBuli.mjs +864 -0
- package/dist/eve-DmiXBuli.mjs.map +1 -0
- package/dist/eve.d.mts +338 -90
- package/dist/eve.d.mts.map +1 -1
- package/dist/eve.mjs +3 -3
- package/dist/index-CtID5dUi.d.mts +606 -0
- package/dist/index-CtID5dUi.d.mts.map +1 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +3 -3
- package/dist/{src-CfzZfU82.mjs → src-D6vC3V8r.mjs} +293 -20
- package/dist/src-D6vC3V8r.mjs.map +1 -0
- package/dist/{token-CW8lQBND.mjs → token-sbepWIkd.mjs} +45 -7
- package/dist/token-sbepWIkd.mjs.map +1 -0
- package/dist/{types-B0mvQgJf.d.mts → types-BOnJ0Rou.d.mts} +28 -8
- package/dist/types-BOnJ0Rou.d.mts.map +1 -0
- package/dist/types-BVLof-5R.d.mts +39 -0
- package/dist/types-BVLof-5R.d.mts.map +1 -0
- package/dist/workflow.d.mts +7 -7
- package/dist/workflow.d.mts.map +1 -1
- package/dist/workflow.mjs +6 -4
- package/dist/workflow.mjs.map +1 -1
- package/dist/{write-tools-Dx9LfYlU.mjs → write-tools-cg_ialNd.mjs} +1009 -107
- package/dist/write-tools-cg_ialNd.mjs.map +1 -0
- package/package.json +13 -13
- package/dist/eve-UPaHEGVi.mjs +0 -512
- package/dist/eve-UPaHEGVi.mjs.map +0 -1
- package/dist/index-Cs1Kebmt.d.mts +0 -463
- package/dist/index-Cs1Kebmt.d.mts.map +0 -1
- package/dist/src-CfzZfU82.mjs.map +0 -1
- package/dist/token-CW8lQBND.mjs.map +0 -1
- package/dist/types-B0mvQgJf.d.mts.map +0 -1
- package/dist/types-DwHrGKWO.d.mts +0 -27
- package/dist/types-DwHrGKWO.d.mts.map +0 -1
- package/dist/write-tools-Dx9LfYlU.mjs.map +0 -1
|
@@ -0,0 +1,606 @@
|
|
|
1
|
+
import { Tool, ToolLoopAgent, ToolLoopAgentSettings, ToolSet } from "ai";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { Octokit, Octokit as Octokit$1 } from "octokit";
|
|
4
|
+
//#region src/core/tool-names.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* All GitHub tool names available via {@link createGithubTools}.
|
|
7
|
+
* Each key maps to its own string literal for IDE autocomplete and hover docs.
|
|
8
|
+
*/
|
|
9
|
+
declare const GITHUB_TOOL_NAMES: {
|
|
10
|
+
/** Get information about a GitHub repository including description, stars, forks, language, and default branch. */
|
|
11
|
+
readonly getRepository: "getRepository";
|
|
12
|
+
/** List branches in a GitHub repository. */
|
|
13
|
+
readonly listBranches: "listBranches";
|
|
14
|
+
/** Get the content of a file from a GitHub repository. Prefer startLine/endLine or maxLines for large files. */
|
|
15
|
+
readonly getFileContent: "getFileContent";
|
|
16
|
+
/** List the file and directory structure of a repository at a given ref. */
|
|
17
|
+
readonly getRepositoryTree: "getRepositoryTree";
|
|
18
|
+
/** Create a new branch in a GitHub repository from an existing branch or commit SHA. Requires approval by default. */
|
|
19
|
+
readonly createBranch: "createBranch";
|
|
20
|
+
/** Fork a GitHub repository to the authenticated user account or a specified organization. Requires approval by default. */
|
|
21
|
+
readonly forkRepository: "forkRepository";
|
|
22
|
+
/** Create a new GitHub repository for the authenticated user or a specified organization. Requires approval by default. */
|
|
23
|
+
readonly createRepository: "createRepository";
|
|
24
|
+
/** Create or update a file in a GitHub repository. Provide the SHA when updating an existing file. Requires approval by default. */
|
|
25
|
+
readonly createOrUpdateFile: "createOrUpdateFile";
|
|
26
|
+
/** List pull requests for a GitHub repository. */
|
|
27
|
+
readonly listPullRequests: "listPullRequests";
|
|
28
|
+
/** Get detailed information about a specific pull request. Body truncated by default (detail: summary). */
|
|
29
|
+
readonly getPullRequest: "getPullRequest";
|
|
30
|
+
/** Create a new pull request in a GitHub repository. Requires approval by default. */
|
|
31
|
+
readonly createPullRequest: "createPullRequest";
|
|
32
|
+
/** Merge a pull request. Requires approval by default. */
|
|
33
|
+
readonly mergePullRequest: "mergePullRequest";
|
|
34
|
+
/** Add a comment to a pull request. Requires approval by default. */
|
|
35
|
+
readonly addPullRequestComment: "addPullRequestComment";
|
|
36
|
+
/** List files changed in a pull request with status and stats. Patches omitted by default — set includePatch true for diffs. */
|
|
37
|
+
readonly listPullRequestFiles: "listPullRequestFiles";
|
|
38
|
+
/** List reviews on a pull request (approvals, change requests, and comments). */
|
|
39
|
+
readonly listPullRequestReviews: "listPullRequestReviews";
|
|
40
|
+
/** Submit a pull request review — approve, request changes, or comment with optional inline comments on specific lines. Requires approval by default. */
|
|
41
|
+
readonly createPullRequestReview: "createPullRequestReview";
|
|
42
|
+
/** Request reviews from users or teams on a pull request. Requires approval by default. */
|
|
43
|
+
readonly requestReviewers: "requestReviewers";
|
|
44
|
+
/** Fetch pull request details plus files, reviews, and optional CI checks in one call. */
|
|
45
|
+
readonly getPullRequestContext: "getPullRequestContext";
|
|
46
|
+
/** List issues for a GitHub repository (excludes pull requests). */
|
|
47
|
+
readonly listIssues: "listIssues";
|
|
48
|
+
/** Get detailed information about a specific issue. Body truncated by default (detail: summary). */
|
|
49
|
+
readonly getIssue: "getIssue";
|
|
50
|
+
/** Fetch an issue plus available labels and recent comments in one call. */
|
|
51
|
+
readonly getIssueContext: "getIssueContext";
|
|
52
|
+
/** Create a new issue in a GitHub repository. Requires approval by default. */
|
|
53
|
+
readonly createIssue: "createIssue";
|
|
54
|
+
/** Add a comment to a GitHub issue. Requires approval by default. */
|
|
55
|
+
readonly addIssueComment: "addIssueComment";
|
|
56
|
+
/** Close an open GitHub issue. Requires approval by default. */
|
|
57
|
+
readonly closeIssue: "closeIssue";
|
|
58
|
+
/** List labels available in a GitHub repository. */
|
|
59
|
+
readonly listLabels: "listLabels";
|
|
60
|
+
/** Add labels to an issue or pull request. Requires approval by default. */
|
|
61
|
+
readonly addLabels: "addLabels";
|
|
62
|
+
/** Remove a label from an issue or pull request. Requires approval by default. */
|
|
63
|
+
readonly removeLabel: "removeLabel";
|
|
64
|
+
/** Assign users to an issue or pull request. Requires approval by default. */
|
|
65
|
+
readonly addAssignees: "addAssignees";
|
|
66
|
+
/** Remove assignees from an issue or pull request. Requires approval by default. */
|
|
67
|
+
readonly removeAssignees: "removeAssignees";
|
|
68
|
+
/** Search for code in GitHub repositories. Use qualifiers like "repo:owner/name" to scope the search. */
|
|
69
|
+
readonly searchCode: "searchCode";
|
|
70
|
+
/** Search for GitHub repositories by keyword, topic, language, or other qualifiers. */
|
|
71
|
+
readonly searchRepositories: "searchRepositories";
|
|
72
|
+
/** List commits for a GitHub repository. Filter by file path to see commits that touched a file. For line-by-line attribution at a given ref, use getBlame instead. */
|
|
73
|
+
readonly listCommits: "listCommits";
|
|
74
|
+
/** Get detailed information about a specific commit, including the list of files changed. Patches omitted by default. */
|
|
75
|
+
readonly getCommit: "getCommit";
|
|
76
|
+
/** Line-level git blame for a file at a commit-like ref (branch, tag, or SHA). Returns contiguous ranges mapping lines to the commits that last modified them. */
|
|
77
|
+
readonly getBlame: "getBlame";
|
|
78
|
+
/** Compare two branches, tags, or commits — ahead/behind counts, commits in between, and differing files. Patches omitted by default. */
|
|
79
|
+
readonly compareCommits: "compareCommits";
|
|
80
|
+
/** List gists for the authenticated user or a specific user. */
|
|
81
|
+
readonly listGists: "listGists";
|
|
82
|
+
/** Get a gist by ID, including file contents. */
|
|
83
|
+
readonly getGist: "getGist";
|
|
84
|
+
/** List comments on a gist. */
|
|
85
|
+
readonly listGistComments: "listGistComments";
|
|
86
|
+
/** Create a new gist with one or more files. Requires approval by default. */
|
|
87
|
+
readonly createGist: "createGist";
|
|
88
|
+
/** Update an existing gist — edit description, update files, or remove files. Requires approval by default. */
|
|
89
|
+
readonly updateGist: "updateGist";
|
|
90
|
+
/** Delete a gist permanently. Requires approval by default. */
|
|
91
|
+
readonly deleteGist: "deleteGist";
|
|
92
|
+
/** Add a comment to a gist. Requires approval by default. */
|
|
93
|
+
readonly createGistComment: "createGistComment";
|
|
94
|
+
/** List GitHub Actions workflows in a repository. */
|
|
95
|
+
readonly listWorkflows: "listWorkflows";
|
|
96
|
+
/** List workflow runs for a repository, optionally filtered by workflow, branch, status, or event. */
|
|
97
|
+
readonly listWorkflowRuns: "listWorkflowRuns";
|
|
98
|
+
/** Get details of a specific workflow run including status, timing, and trigger info. */
|
|
99
|
+
readonly getWorkflowRun: "getWorkflowRun";
|
|
100
|
+
/** List jobs for a workflow run, including step-level status and timing. */
|
|
101
|
+
readonly listWorkflowJobs: "listWorkflowJobs";
|
|
102
|
+
/** Trigger a workflow via workflow_dispatch event. Requires approval by default. */
|
|
103
|
+
readonly triggerWorkflow: "triggerWorkflow";
|
|
104
|
+
/** Cancel an in-progress workflow run. Requires approval by default. */
|
|
105
|
+
readonly cancelWorkflowRun: "cancelWorkflowRun";
|
|
106
|
+
/** Re-run a workflow run, optionally only the failed jobs. Requires approval by default. */
|
|
107
|
+
readonly rerunWorkflowRun: "rerunWorkflowRun";
|
|
108
|
+
/** List check runs (Checks API — GitHub Actions and other CI providers) for a commit, branch, or tag. */
|
|
109
|
+
readonly listCheckRuns: "listCheckRuns";
|
|
110
|
+
/** Get the combined commit status (Statuses API — legacy CI integrations) for a commit, branch, or tag. */
|
|
111
|
+
readonly getCombinedStatus: "getCombinedStatus";
|
|
112
|
+
/** Diagnose CI failures for a ref — combined status, failing checks, and failed workflow jobs in one call. */
|
|
113
|
+
readonly getCiFailureContext: "getCiFailureContext";
|
|
114
|
+
/** List releases for a GitHub repository, newest first (includes drafts and prereleases). */
|
|
115
|
+
readonly listReleases: "listReleases";
|
|
116
|
+
/** Get the latest published release for a GitHub repository (excludes drafts and prereleases). Body truncated by default. */
|
|
117
|
+
readonly getLatestRelease: "getLatestRelease";
|
|
118
|
+
/** Get a specific release by ID, including its assets. Body truncated by default. */
|
|
119
|
+
readonly getRelease: "getRelease";
|
|
120
|
+
/** Fetch a release plus the previous release and tag comparison in one call. */
|
|
121
|
+
readonly getReleaseContext: "getReleaseContext";
|
|
122
|
+
/** Create a new release (and its tag if needed) in a GitHub repository. Requires approval by default. */
|
|
123
|
+
readonly createRelease: "createRelease";
|
|
124
|
+
};
|
|
125
|
+
type GithubToolName = typeof GITHUB_TOOL_NAMES[keyof typeof GITHUB_TOOL_NAMES];
|
|
126
|
+
//#endregion
|
|
127
|
+
//#region src/core/presets.d.ts
|
|
128
|
+
/**
|
|
129
|
+
* Predefined tool presets for common use cases.
|
|
130
|
+
* Pass to {@link createGithubTools}, {@link createGithubAgent}, or {@link createDurableGithubAgent}.
|
|
131
|
+
* Presets can be combined by passing an array.
|
|
132
|
+
*/
|
|
133
|
+
declare const PRESET_TOOLS: {
|
|
134
|
+
/**
|
|
135
|
+
* **Code review** — review pull requests and submit feedback.
|
|
136
|
+
*
|
|
137
|
+
* Tools: `getPullRequest`, `listPullRequests`, `listPullRequestFiles`, `listPullRequestReviews`, `getPullRequestContext`,
|
|
138
|
+
* `getFileContent`, `listCommits`, `getCommit`, `getBlame`, `compareCommits`, `getRepository`, `listBranches`,
|
|
139
|
+
* `searchCode`, `listCheckRuns`, `getCombinedStatus`, `addPullRequestComment`, `createPullRequestReview`, `requestReviewers`.
|
|
140
|
+
*
|
|
141
|
+
* Agent prompt: optimized for thorough PR review with inline feedback.
|
|
142
|
+
*/
|
|
143
|
+
readonly 'code-review': readonly ["getPullRequest", "listPullRequests", "listPullRequestFiles", "listPullRequestReviews", "getPullRequestContext", "getFileContent", "listCommits", "getCommit", "getBlame", "compareCommits", "getRepository", "listBranches", "searchCode", "listCheckRuns", "getCombinedStatus", "addPullRequestComment", "createPullRequestReview", "requestReviewers"];
|
|
144
|
+
/**
|
|
145
|
+
* **Issue triage** — manage and organize GitHub issues.
|
|
146
|
+
*
|
|
147
|
+
* Tools: `listIssues`, `getIssue`, `getIssueContext`, `createIssue`, `addIssueComment`, `closeIssue`,
|
|
148
|
+
* `listLabels`, `addLabels`, `removeLabel`, `addAssignees`, `removeAssignees`, `getRepository`, `searchRepositories`, `searchCode`.
|
|
149
|
+
*
|
|
150
|
+
* Agent prompt: optimized for categorizing, labeling, and responding to issues.
|
|
151
|
+
*/
|
|
152
|
+
readonly 'issue-triage': readonly ["listIssues", "getIssue", "getIssueContext", "createIssue", "addIssueComment", "closeIssue", "listLabels", "addLabels", "removeLabel", "addAssignees", "removeAssignees", "getRepository", "searchRepositories", "searchCode"];
|
|
153
|
+
/**
|
|
154
|
+
* **CI operations** — monitor and manage GitHub Actions workflows.
|
|
155
|
+
*
|
|
156
|
+
* Tools: `getRepository`, `listBranches`, `listCommits`, `getCommit`,
|
|
157
|
+
* `listWorkflows`, `listWorkflowRuns`, `getWorkflowRun`, `listWorkflowJobs`, `listCheckRuns`, `getCombinedStatus`, `getCiFailureContext`,
|
|
158
|
+
* `triggerWorkflow`, `cancelWorkflowRun`, `rerunWorkflowRun`.
|
|
159
|
+
*
|
|
160
|
+
* Agent prompt: optimized for diagnosing CI failures and managing workflow runs.
|
|
161
|
+
*/
|
|
162
|
+
readonly 'ci-ops': readonly ["getRepository", "listBranches", "listCommits", "getCommit", "listWorkflows", "listWorkflowRuns", "getWorkflowRun", "listWorkflowJobs", "listCheckRuns", "getCombinedStatus", "getCiFailureContext", "triggerWorkflow", "cancelWorkflowRun", "rerunWorkflowRun"];
|
|
163
|
+
/**
|
|
164
|
+
* **Repository explorer** — read-only access to browse codebases.
|
|
165
|
+
*
|
|
166
|
+
* Tools: all read-only tools including repos, branches, PRs, issues, commits, blame, comparisons,
|
|
167
|
+
* search, gists, workflows, checks, and releases. No write operations.
|
|
168
|
+
*
|
|
169
|
+
* Agent prompt: optimized for answering questions about code structure and history.
|
|
170
|
+
*/
|
|
171
|
+
readonly 'repo-explorer': readonly ["getRepository", "listBranches", "getFileContent", "getRepositoryTree", "listPullRequests", "getPullRequest", "listPullRequestFiles", "listPullRequestReviews", "getPullRequestContext", "listIssues", "getIssue", "getIssueContext", "listLabels", "listCommits", "getCommit", "getBlame", "compareCommits", "searchCode", "searchRepositories", "listGists", "getGist", "listGistComments", "listWorkflows", "listWorkflowRuns", "getWorkflowRun", "listWorkflowJobs", "listCheckRuns", "getCombinedStatus", "getCiFailureContext", "listReleases", "getLatestRelease", "getRelease", "getReleaseContext"];
|
|
172
|
+
/**
|
|
173
|
+
* **Security audit** — review repositories for security risks and report findings.
|
|
174
|
+
*
|
|
175
|
+
* Tools: read-only exploration (`getFileContent`, `getRepositoryTree`, `searchCode`, `listCommits`, `getCommit`,
|
|
176
|
+
* `getBlame`, `compareCommits`), PR and CI visibility (`listPullRequests`, `getPullRequest`, `listPullRequestFiles`,
|
|
177
|
+
* `getPullRequestContext`, `listCheckRuns`, `getCombinedStatus`, `getCiFailureContext`, `listWorkflows`, `listWorkflowRuns`,
|
|
178
|
+
* `getWorkflowRun`, `listWorkflowJobs`), plus `createIssue`, `addIssueComment`, and `addLabels` to report findings.
|
|
179
|
+
* No destructive writes.
|
|
180
|
+
*
|
|
181
|
+
* Agent prompt: optimized for finding and reporting security risks without making changes.
|
|
182
|
+
*/
|
|
183
|
+
readonly 'security-audit': readonly ["getRepository", "listBranches", "getFileContent", "getRepositoryTree", "listCommits", "getCommit", "getBlame", "compareCommits", "searchCode", "searchRepositories", "listPullRequests", "getPullRequest", "listPullRequestFiles", "getPullRequestContext", "listCheckRuns", "getCombinedStatus", "getCiFailureContext", "listWorkflows", "listWorkflowRuns", "getWorkflowRun", "listWorkflowJobs", "listIssues", "getIssue", "getIssueContext", "createIssue", "addIssueComment", "addLabels"];
|
|
184
|
+
/**
|
|
185
|
+
* **Release manager** — prepare and publish GitHub releases.
|
|
186
|
+
*
|
|
187
|
+
* Tools: `getRepository`, `listBranches`, `listCommits`, `getCommit`, `compareCommits`,
|
|
188
|
+
* `listReleases`, `getLatestRelease`, `getRelease`, `getReleaseContext`, `createRelease`,
|
|
189
|
+
* `listWorkflows`, `listWorkflowRuns`, `getWorkflowRun`, `listWorkflowJobs`, `triggerWorkflow`,
|
|
190
|
+
* `listPullRequests`, `getPullRequest`.
|
|
191
|
+
*
|
|
192
|
+
* Agent prompt: optimized for summarizing changes and cutting releases safely.
|
|
193
|
+
*/
|
|
194
|
+
readonly 'release-manager': readonly ["getRepository", "listBranches", "listCommits", "getCommit", "compareCommits", "listReleases", "getLatestRelease", "getRelease", "getReleaseContext", "createRelease", "listWorkflows", "listWorkflowRuns", "getWorkflowRun", "listWorkflowJobs", "triggerWorkflow", "listPullRequests", "getPullRequest"];
|
|
195
|
+
/**
|
|
196
|
+
* **Maintainer** — full repository maintenance with all read and write tools.
|
|
197
|
+
*
|
|
198
|
+
* Tools: all tools (same as omitting `preset`).
|
|
199
|
+
*
|
|
200
|
+
* Agent prompt: optimized for day-to-day repo maintenance with careful write operations.
|
|
201
|
+
*/
|
|
202
|
+
readonly maintainer: readonly ["getRepository", "listBranches", "getFileContent", "getRepositoryTree", "createBranch", "forkRepository", "createRepository", "createOrUpdateFile", "listPullRequests", "getPullRequest", "listPullRequestFiles", "listPullRequestReviews", "getPullRequestContext", "createPullRequest", "mergePullRequest", "addPullRequestComment", "createPullRequestReview", "requestReviewers", "listIssues", "getIssue", "getIssueContext", "createIssue", "addIssueComment", "closeIssue", "listLabels", "addLabels", "removeLabel", "addAssignees", "removeAssignees", "listCommits", "getCommit", "getBlame", "compareCommits", "searchCode", "searchRepositories", "listGists", "getGist", "listGistComments", "createGist", "updateGist", "deleteGist", "createGistComment", "listWorkflows", "listWorkflowRuns", "getWorkflowRun", "listWorkflowJobs", "triggerWorkflow", "cancelWorkflowRun", "rerunWorkflowRun", "listCheckRuns", "getCombinedStatus", "getCiFailureContext", "listReleases", "getLatestRelease", "getRelease", "getReleaseContext", "createRelease"];
|
|
203
|
+
};
|
|
204
|
+
type GithubToolPreset = keyof typeof PRESET_TOOLS;
|
|
205
|
+
/** Tool names included in a single preset. */
|
|
206
|
+
type PresetToolName<P extends GithubToolPreset> = Extract<(typeof PRESET_TOOLS)[P][number], GithubToolName>;
|
|
207
|
+
/** Tool names included when combining multiple presets. */
|
|
208
|
+
type CombinedPresetToolNames<P extends readonly GithubToolPreset[]> = PresetToolName<P[number]>;
|
|
209
|
+
//#endregion
|
|
210
|
+
//#region src/core/write-tools.d.ts
|
|
211
|
+
/**
|
|
212
|
+
* Write tools that mutate GitHub state. All require user approval by default
|
|
213
|
+
* unless overridden via {@link ApprovalConfig}.
|
|
214
|
+
*/
|
|
215
|
+
declare const GITHUB_WRITE_TOOLS: {
|
|
216
|
+
/** Create a new branch in a GitHub repository from an existing branch or commit SHA. Requires approval by default. */
|
|
217
|
+
readonly createBranch: "createBranch";
|
|
218
|
+
/** Fork a GitHub repository to the authenticated user account or a specified organization. Requires approval by default. */
|
|
219
|
+
readonly forkRepository: "forkRepository";
|
|
220
|
+
/** Create a new GitHub repository for the authenticated user or a specified organization. Requires approval by default. */
|
|
221
|
+
readonly createRepository: "createRepository";
|
|
222
|
+
/** Create or update a file in a GitHub repository. Requires approval by default. */
|
|
223
|
+
readonly createOrUpdateFile: "createOrUpdateFile";
|
|
224
|
+
/** Create a new pull request in a GitHub repository. Requires approval by default. */
|
|
225
|
+
readonly createPullRequest: "createPullRequest";
|
|
226
|
+
/** Merge a pull request. Requires approval by default. */
|
|
227
|
+
readonly mergePullRequest: "mergePullRequest";
|
|
228
|
+
/** Add a comment to a pull request. Requires approval by default. */
|
|
229
|
+
readonly addPullRequestComment: "addPullRequestComment";
|
|
230
|
+
/** Submit a pull request review with optional inline comments. Requires approval by default. */
|
|
231
|
+
readonly createPullRequestReview: "createPullRequestReview";
|
|
232
|
+
/** Request reviews from users or teams on a pull request. Requires approval by default. */
|
|
233
|
+
readonly requestReviewers: "requestReviewers";
|
|
234
|
+
/** Create a new issue in a GitHub repository. Requires approval by default. */
|
|
235
|
+
readonly createIssue: "createIssue";
|
|
236
|
+
/** Add a comment to a GitHub issue. Requires approval by default. */
|
|
237
|
+
readonly addIssueComment: "addIssueComment";
|
|
238
|
+
/** Close an open GitHub issue. Requires approval by default. */
|
|
239
|
+
readonly closeIssue: "closeIssue";
|
|
240
|
+
/** Add labels to an issue or pull request. Requires approval by default. */
|
|
241
|
+
readonly addLabels: "addLabels";
|
|
242
|
+
/** Remove a label from an issue or pull request. Requires approval by default. */
|
|
243
|
+
readonly removeLabel: "removeLabel";
|
|
244
|
+
/** Assign users to an issue or pull request. Requires approval by default. */
|
|
245
|
+
readonly addAssignees: "addAssignees";
|
|
246
|
+
/** Remove assignees from an issue or pull request. Requires approval by default. */
|
|
247
|
+
readonly removeAssignees: "removeAssignees";
|
|
248
|
+
/** Create a new gist with one or more files. Requires approval by default. */
|
|
249
|
+
readonly createGist: "createGist";
|
|
250
|
+
/** Update an existing gist. Requires approval by default. */
|
|
251
|
+
readonly updateGist: "updateGist";
|
|
252
|
+
/** Delete a gist permanently. Requires approval by default. */
|
|
253
|
+
readonly deleteGist: "deleteGist";
|
|
254
|
+
/** Add a comment to a gist. Requires approval by default. */
|
|
255
|
+
readonly createGistComment: "createGistComment";
|
|
256
|
+
/** Trigger a workflow via workflow_dispatch event. Requires approval by default. */
|
|
257
|
+
readonly triggerWorkflow: "triggerWorkflow";
|
|
258
|
+
/** Cancel an in-progress workflow run. Requires approval by default. */
|
|
259
|
+
readonly cancelWorkflowRun: "cancelWorkflowRun";
|
|
260
|
+
/** Re-run a workflow run, optionally only the failed jobs. Requires approval by default. */
|
|
261
|
+
readonly rerunWorkflowRun: "rerunWorkflowRun";
|
|
262
|
+
/** Create a new release (and its tag if needed) in a GitHub repository. Requires approval by default. */
|
|
263
|
+
readonly createRelease: "createRelease";
|
|
264
|
+
};
|
|
265
|
+
type GithubWriteToolName = typeof GITHUB_WRITE_TOOLS[keyof typeof GITHUB_WRITE_TOOLS];
|
|
266
|
+
//#endregion
|
|
267
|
+
//#region src/core/approval.d.ts
|
|
268
|
+
/**
|
|
269
|
+
* Whether write operations require user approval.
|
|
270
|
+
*
|
|
271
|
+
* - `true` — all write tools need approval (default)
|
|
272
|
+
* - `false` — no approval needed for any write tool
|
|
273
|
+
* - object — per-tool override via {@link GithubWriteToolName}; unspecified write tools default to `true`
|
|
274
|
+
*
|
|
275
|
+
* @example Global disable
|
|
276
|
+
* ```ts
|
|
277
|
+
* createGithubTools({ token, requireApproval: false })
|
|
278
|
+
* ```
|
|
279
|
+
*
|
|
280
|
+
* @example Granular per write tool
|
|
281
|
+
* ```ts
|
|
282
|
+
* createGithubTools({
|
|
283
|
+
* token,
|
|
284
|
+
* requireApproval: {
|
|
285
|
+
* mergePullRequest: true,
|
|
286
|
+
* createOrUpdateFile: true,
|
|
287
|
+
* addPullRequestComment: false,
|
|
288
|
+
* },
|
|
289
|
+
* })
|
|
290
|
+
* ```
|
|
291
|
+
*/
|
|
292
|
+
type ApprovalConfig = boolean | Partial<Record<GithubWriteToolName, boolean>>;
|
|
293
|
+
//#endregion
|
|
294
|
+
//#region src/types.d.ts
|
|
295
|
+
type GithubTool = Tool<any, any>;
|
|
296
|
+
type ToolOptions = {
|
|
297
|
+
needsApproval?: boolean;
|
|
298
|
+
};
|
|
299
|
+
/**
|
|
300
|
+
* Identity for a commit author or committer on GitHub.
|
|
301
|
+
*
|
|
302
|
+
* - **Author** — the person who originally wrote the code patch.
|
|
303
|
+
* - **Committer** — the person who applied the commit to the repository.
|
|
304
|
+
*/
|
|
305
|
+
type CommitIdentity = {
|
|
306
|
+
name: string;
|
|
307
|
+
email: string;
|
|
308
|
+
};
|
|
309
|
+
/**
|
|
310
|
+
* Options for commit-creating tools (`createOrUpdateFile`, `mergePullRequest`).
|
|
311
|
+
*/
|
|
312
|
+
type CommitToolOptions = ToolOptions & {
|
|
313
|
+
/**
|
|
314
|
+
* The author of the commit — the person who wrote the code patch.
|
|
315
|
+
* Falls back to the authenticated user when omitted.
|
|
316
|
+
*/
|
|
317
|
+
author?: CommitIdentity;
|
|
318
|
+
/**
|
|
319
|
+
* The committer of the commit — the person who applied the commit.
|
|
320
|
+
* Falls back to the authenticated user when omitted.
|
|
321
|
+
*/
|
|
322
|
+
committer?: CommitIdentity;
|
|
323
|
+
/**
|
|
324
|
+
* Co-authors to attribute on commits.
|
|
325
|
+
* Added as "Co-authored-by" trailers to commit messages.
|
|
326
|
+
*/
|
|
327
|
+
coAuthors?: CommitIdentity[];
|
|
328
|
+
};
|
|
329
|
+
/**
|
|
330
|
+
* Per-tool overrides for customizing tool behavior without changing the underlying implementation.
|
|
331
|
+
*
|
|
332
|
+
* Overridable properties: `description`, `title`, `needsApproval`, `strict`, `providerOptions`,
|
|
333
|
+
* `toModelOutput`, and input lifecycle callbacks (`onInputStart`, `onInputDelta`, `onInputAvailable`).
|
|
334
|
+
*
|
|
335
|
+
* `execute`, `inputSchema`, and `outputSchema` cannot be overridden.
|
|
336
|
+
*
|
|
337
|
+
* @example
|
|
338
|
+
* ```ts
|
|
339
|
+
* createGithubTools({
|
|
340
|
+
* overrides: {
|
|
341
|
+
* mergePullRequest: { needsApproval: true, title: 'Merge PR' },
|
|
342
|
+
* listIssues: { description: 'List open bugs' },
|
|
343
|
+
* },
|
|
344
|
+
* })
|
|
345
|
+
* ```
|
|
346
|
+
*/
|
|
347
|
+
type ToolOverrides = Partial<Pick<Tool, 'description' | 'needsApproval' | 'onInputAvailable' | 'onInputDelta' | 'onInputStart' | 'providerOptions' | 'strict' | 'title' | 'toModelOutput'>>;
|
|
348
|
+
//#endregion
|
|
349
|
+
//#region src/core/context.d.ts
|
|
350
|
+
/**
|
|
351
|
+
* Default repository / issue / PR / ref values applied to tool inputs and
|
|
352
|
+
* injected into agent system prompts.
|
|
353
|
+
*
|
|
354
|
+
* When a field is set here, matching tool schema fields become optional and
|
|
355
|
+
* default to this value if the model omits them.
|
|
356
|
+
*/
|
|
357
|
+
type GithubToolsContext = {
|
|
358
|
+
owner?: string;
|
|
359
|
+
repo?: string;
|
|
360
|
+
pullNumber?: number;
|
|
361
|
+
issueNumber?: number;
|
|
362
|
+
ref?: string;
|
|
363
|
+
};
|
|
364
|
+
//#endregion
|
|
365
|
+
//#region src/core/token.d.ts
|
|
366
|
+
type GithubTokenInput = string | (() => Promise<string>);
|
|
367
|
+
/** Resolves a {@link GithubTokenInput} to a token string. */
|
|
368
|
+
declare function resolveGithubToken(token?: GithubTokenInput): Promise<string>;
|
|
369
|
+
//#endregion
|
|
370
|
+
//#region src/core/tool-types.d.ts
|
|
371
|
+
/** Full tool set returned when no `preset` is specified. */
|
|
372
|
+
type AllGithubTools = Record<GithubToolName, GithubTool>;
|
|
373
|
+
/** Base options shared by all {@link createGithubTools} overloads. */
|
|
374
|
+
type GithubToolsBaseOptions = {
|
|
375
|
+
/** GitHub token string or async provider. Falls back to `process.env.GITHUB_TOKEN` when omitted. */
|
|
376
|
+
token?: GithubTokenInput;
|
|
377
|
+
/** Control whether write operations require user approval. @see {@link ApprovalConfig} */
|
|
378
|
+
requireApproval?: ApprovalConfig;
|
|
379
|
+
/**
|
|
380
|
+
* Default owner / repo / PR / issue / ref values.
|
|
381
|
+
* Softens matching tool input fields and fills them when the model omits them.
|
|
382
|
+
* Also injected into agent system prompts via {@link createGithubAgent}.
|
|
383
|
+
*/
|
|
384
|
+
context?: GithubToolsContext;
|
|
385
|
+
/** Per-tool overrides for description, title, needsApproval, and related AI SDK tool fields. */
|
|
386
|
+
overrides?: Partial<Record<GithubToolName, ToolOverrides>>;
|
|
387
|
+
/** Default author for commit-creating tools. Falls back to the authenticated user when omitted. */
|
|
388
|
+
author?: CommitIdentity;
|
|
389
|
+
/** Default committer for commit-creating tools. Falls back to the authenticated user when omitted. */
|
|
390
|
+
committer?: CommitIdentity;
|
|
391
|
+
/** Co-authors to attribute on all commits created by tools. */
|
|
392
|
+
coAuthors?: CommitIdentity[];
|
|
393
|
+
};
|
|
394
|
+
/** Tool set shape for a given preset option (single, combined, or all tools). */
|
|
395
|
+
type GithubToolsForPreset<P extends GithubToolPreset | readonly GithubToolPreset[] | undefined> = P extends GithubToolPreset ? Pick<AllGithubTools, PresetToolName<P> & GithubToolName> : P extends readonly GithubToolPreset[] ? Pick<AllGithubTools, CombinedPresetToolNames<P> & GithubToolName> : AllGithubTools;
|
|
396
|
+
/** Pick a subset of GitHub tools by tool name. */
|
|
397
|
+
type PickGithubTools<T extends GithubToolName> = Pick<AllGithubTools, T>;
|
|
398
|
+
//#endregion
|
|
399
|
+
//#region src/client.d.ts
|
|
400
|
+
declare function createOctokit(token: string): Octokit;
|
|
401
|
+
//#endregion
|
|
402
|
+
//#region src/tools/repository.d.ts
|
|
403
|
+
/** Get information about a GitHub repository including description, stars, forks, language, and default branch. */
|
|
404
|
+
declare const getRepository: (token: GithubTokenInput) => GithubTool;
|
|
405
|
+
/** List branches in a GitHub repository. */
|
|
406
|
+
declare const listBranches: (token: GithubTokenInput) => GithubTool;
|
|
407
|
+
/** Get the content of a file from a GitHub repository. */
|
|
408
|
+
declare const getFileContent: (token: GithubTokenInput) => GithubTool;
|
|
409
|
+
/** List the file and directory structure of a repository at a given ref. */
|
|
410
|
+
declare const getRepositoryTree: (token: GithubTokenInput) => GithubTool;
|
|
411
|
+
/** Create a new branch in a GitHub repository from an existing branch or commit SHA. Requires approval by default. */
|
|
412
|
+
declare const createBranch: (token: GithubTokenInput, { needsApproval }?: ToolOptions) => GithubTool;
|
|
413
|
+
/** Fork a GitHub repository to the authenticated user account or a specified organization. Requires approval by default. */
|
|
414
|
+
declare const forkRepository: (token: GithubTokenInput, { needsApproval }?: ToolOptions) => GithubTool;
|
|
415
|
+
/** Create a new GitHub repository for the authenticated user or a specified organization. Requires approval by default. */
|
|
416
|
+
declare const createRepository: (token: GithubTokenInput, { needsApproval }?: ToolOptions) => GithubTool;
|
|
417
|
+
/** Create or update a file in a GitHub repository. Provide the SHA when updating an existing file. Requires approval by default. */
|
|
418
|
+
declare const createOrUpdateFile: (token: GithubTokenInput, { needsApproval, author, committer, coAuthors }?: CommitToolOptions) => GithubTool;
|
|
419
|
+
//#endregion
|
|
420
|
+
//#region src/tools/pull-requests.d.ts
|
|
421
|
+
type MergeToolOptions = ToolOptions & {
|
|
422
|
+
coAuthors?: CommitIdentity[];
|
|
423
|
+
};
|
|
424
|
+
/** List pull requests for a GitHub repository. */
|
|
425
|
+
declare const listPullRequests: (token: GithubTokenInput) => GithubTool;
|
|
426
|
+
/** Get detailed information about a specific pull request. */
|
|
427
|
+
declare const getPullRequest: (token: GithubTokenInput) => GithubTool;
|
|
428
|
+
/** Create a new pull request in a GitHub repository. Requires approval by default. */
|
|
429
|
+
declare const createPullRequest: (token: GithubTokenInput, { needsApproval }?: ToolOptions) => GithubTool;
|
|
430
|
+
/** Merge a pull request. Requires approval by default. */
|
|
431
|
+
declare const mergePullRequest: (token: GithubTokenInput, { needsApproval, coAuthors }?: MergeToolOptions) => GithubTool;
|
|
432
|
+
/** Add a comment to a pull request. Requires approval by default. */
|
|
433
|
+
declare const addPullRequestComment: (token: GithubTokenInput, { needsApproval }?: ToolOptions) => GithubTool;
|
|
434
|
+
/** List files changed in a pull request with status and stats. Patches omitted by default. */
|
|
435
|
+
declare const listPullRequestFiles: (token: GithubTokenInput) => GithubTool;
|
|
436
|
+
/** List reviews on a pull request (approvals, change requests, and comments). */
|
|
437
|
+
declare const listPullRequestReviews: (token: GithubTokenInput) => GithubTool;
|
|
438
|
+
/** Submit a pull request review with optional inline comments. Requires approval by default. */
|
|
439
|
+
declare const createPullRequestReview: (token: GithubTokenInput, { needsApproval }?: ToolOptions) => GithubTool;
|
|
440
|
+
/** Request reviews from users or teams on a pull request. Requires approval by default. */
|
|
441
|
+
declare const requestReviewers: (token: GithubTokenInput, { needsApproval }?: ToolOptions) => GithubTool;
|
|
442
|
+
//#endregion
|
|
443
|
+
//#region src/tools/issues.d.ts
|
|
444
|
+
/** List issues for a GitHub repository (excludes pull requests). */
|
|
445
|
+
declare const listIssues: (token: GithubTokenInput) => GithubTool;
|
|
446
|
+
/** Get detailed information about a specific issue. */
|
|
447
|
+
declare const getIssue: (token: GithubTokenInput) => GithubTool;
|
|
448
|
+
/** Create a new issue in a GitHub repository. Requires approval by default. */
|
|
449
|
+
declare const createIssue: (token: GithubTokenInput, { needsApproval }?: ToolOptions) => GithubTool;
|
|
450
|
+
/** Add a comment to a GitHub issue. Requires approval by default. */
|
|
451
|
+
declare const addIssueComment: (token: GithubTokenInput, { needsApproval }?: ToolOptions) => GithubTool;
|
|
452
|
+
/** Close an open GitHub issue. Requires approval by default. */
|
|
453
|
+
declare const closeIssue: (token: GithubTokenInput, { needsApproval }?: ToolOptions) => GithubTool;
|
|
454
|
+
/** List labels available in a GitHub repository. */
|
|
455
|
+
declare const listLabels: (token: GithubTokenInput) => GithubTool;
|
|
456
|
+
/** Add labels to an issue or pull request. Requires approval by default. */
|
|
457
|
+
declare const addLabels: (token: GithubTokenInput, { needsApproval }?: ToolOptions) => GithubTool;
|
|
458
|
+
/** Remove a label from an issue or pull request. Requires approval by default. */
|
|
459
|
+
declare const removeLabel: (token: GithubTokenInput, { needsApproval }?: ToolOptions) => GithubTool;
|
|
460
|
+
/** Assign users to an issue or pull request. Requires approval by default. */
|
|
461
|
+
declare const addAssignees: (token: GithubTokenInput, { needsApproval }?: ToolOptions) => GithubTool;
|
|
462
|
+
/** Remove assignees from an issue or pull request. Requires approval by default. */
|
|
463
|
+
declare const removeAssignees: (token: GithubTokenInput, { needsApproval }?: ToolOptions) => GithubTool;
|
|
464
|
+
//#endregion
|
|
465
|
+
//#region src/tools/search.d.ts
|
|
466
|
+
/** Search for code in GitHub repositories. Use qualifiers like "repo:owner/name" to scope the search. */
|
|
467
|
+
declare const searchCode: (token: GithubTokenInput) => GithubTool;
|
|
468
|
+
/** Search for GitHub repositories by keyword, topic, language, or other qualifiers. */
|
|
469
|
+
declare const searchRepositories: (token: GithubTokenInput) => GithubTool;
|
|
470
|
+
//#endregion
|
|
471
|
+
//#region src/tools/commits.d.ts
|
|
472
|
+
/** List commits for a GitHub repository. Filter by file path to see commits that touched a file. */
|
|
473
|
+
declare const listCommits: (token: GithubTokenInput) => GithubTool;
|
|
474
|
+
/** Get detailed information about a specific commit. Patches omitted by default. */
|
|
475
|
+
declare const getCommit: (token: GithubTokenInput) => GithubTool;
|
|
476
|
+
/** Line-level git blame for a file at a commit-like ref (branch, tag, or SHA). */
|
|
477
|
+
declare const getBlame: (token: GithubTokenInput) => GithubTool;
|
|
478
|
+
/** Compare two branches, tags, or commits. Patches omitted by default. */
|
|
479
|
+
declare const compareCommits: (token: GithubTokenInput) => GithubTool;
|
|
480
|
+
//#endregion
|
|
481
|
+
//#region src/tools/gists.d.ts
|
|
482
|
+
/** List gists for the authenticated user or a specific user. */
|
|
483
|
+
declare const listGists: (token: GithubTokenInput) => GithubTool;
|
|
484
|
+
/** Get a gist by ID, including file contents. */
|
|
485
|
+
declare const getGist: (token: GithubTokenInput) => GithubTool;
|
|
486
|
+
/** List comments on a gist. */
|
|
487
|
+
declare const listGistComments: (token: GithubTokenInput) => GithubTool;
|
|
488
|
+
/** Create a new gist with one or more files. Requires approval by default. */
|
|
489
|
+
declare const createGist: (token: GithubTokenInput, { needsApproval }?: ToolOptions) => GithubTool;
|
|
490
|
+
/** Update an existing gist. Requires approval by default. */
|
|
491
|
+
declare const updateGist: (token: GithubTokenInput, { needsApproval }?: ToolOptions) => GithubTool;
|
|
492
|
+
/** Delete a gist permanently. Requires approval by default. */
|
|
493
|
+
declare const deleteGist: (token: GithubTokenInput, { needsApproval }?: ToolOptions) => GithubTool;
|
|
494
|
+
/** Add a comment to a gist. Requires approval by default. */
|
|
495
|
+
declare const createGistComment: (token: GithubTokenInput, { needsApproval }?: ToolOptions) => GithubTool;
|
|
496
|
+
//#endregion
|
|
497
|
+
//#region src/tools/workflows.d.ts
|
|
498
|
+
/** List GitHub Actions workflows in a repository. */
|
|
499
|
+
declare const listWorkflows: (token: GithubTokenInput) => GithubTool;
|
|
500
|
+
/** List workflow runs for a repository, optionally filtered by workflow, branch, status, or event. */
|
|
501
|
+
declare const listWorkflowRuns: (token: GithubTokenInput) => GithubTool;
|
|
502
|
+
/** Get details of a specific workflow run including status, timing, and trigger info. */
|
|
503
|
+
declare const getWorkflowRun: (token: GithubTokenInput) => GithubTool;
|
|
504
|
+
/** List jobs for a workflow run, including step-level status and timing. */
|
|
505
|
+
declare const listWorkflowJobs: (token: GithubTokenInput) => GithubTool;
|
|
506
|
+
/** Trigger a workflow via workflow_dispatch event. Requires approval by default. */
|
|
507
|
+
declare const triggerWorkflow: (token: GithubTokenInput, { needsApproval }?: ToolOptions) => GithubTool;
|
|
508
|
+
/** Cancel an in-progress workflow run. Requires approval by default. */
|
|
509
|
+
declare const cancelWorkflowRun: (token: GithubTokenInput, { needsApproval }?: ToolOptions) => GithubTool;
|
|
510
|
+
/** Re-run a workflow run, optionally only the failed jobs. Requires approval by default. */
|
|
511
|
+
declare const rerunWorkflowRun: (token: GithubTokenInput, { needsApproval }?: ToolOptions) => GithubTool;
|
|
512
|
+
//#endregion
|
|
513
|
+
//#region src/tools/checks.d.ts
|
|
514
|
+
/** List check runs (Checks API — GitHub Actions and other CI providers) for a commit, branch, or tag. */
|
|
515
|
+
declare const listCheckRuns: (token: GithubTokenInput) => GithubTool;
|
|
516
|
+
/** Get the combined commit status (Statuses API — legacy CI integrations) for a commit, branch, or tag. */
|
|
517
|
+
declare const getCombinedStatus: (token: GithubTokenInput) => GithubTool;
|
|
518
|
+
//#endregion
|
|
519
|
+
//#region src/tools/releases.d.ts
|
|
520
|
+
/** List releases for a GitHub repository, newest first (includes drafts and prereleases). */
|
|
521
|
+
declare const listReleases: (token: GithubTokenInput) => GithubTool;
|
|
522
|
+
/** Get the latest published release for a GitHub repository (excludes drafts and prereleases). */
|
|
523
|
+
declare const getLatestRelease: (token: GithubTokenInput) => GithubTool;
|
|
524
|
+
/** Get a specific release by ID, including its assets. */
|
|
525
|
+
declare const getRelease: (token: GithubTokenInput) => GithubTool;
|
|
526
|
+
/** Create a new release (and its tag if needed) in a GitHub repository. Requires approval by default. */
|
|
527
|
+
declare const createRelease: (token: GithubTokenInput, { needsApproval }?: ToolOptions) => GithubTool;
|
|
528
|
+
//#endregion
|
|
529
|
+
//#region src/tools/bundles.d.ts
|
|
530
|
+
/** Fetch pull request details plus files, reviews, and optional CI checks in one call. */
|
|
531
|
+
declare const getPullRequestContext: (token: GithubTokenInput) => GithubTool;
|
|
532
|
+
/** Fetch an issue plus available labels and recent comments in one call. */
|
|
533
|
+
declare const getIssueContext: (token: GithubTokenInput) => GithubTool;
|
|
534
|
+
/** Fetch a release plus the previous release and tag comparison in one call. */
|
|
535
|
+
declare const getReleaseContext: (token: GithubTokenInput) => GithubTool;
|
|
536
|
+
/** Diagnose CI failures for a ref — combined status, failing checks, and failed workflow jobs. */
|
|
537
|
+
declare const getCiFailureContext: (token: GithubTokenInput) => GithubTool;
|
|
538
|
+
//#endregion
|
|
539
|
+
//#region src/agents.d.ts
|
|
540
|
+
type AgentOptions = Omit<ToolLoopAgentSettings<ToolSet>, 'model' | 'tools' | 'instructions'>;
|
|
541
|
+
type CreateGithubAgentOptions = AgentOptions & GithubToolsBaseOptions & {
|
|
542
|
+
model: ToolLoopAgentSettings<ToolSet>['model'];
|
|
543
|
+
/**
|
|
544
|
+
* Restrict tools and system prompt to a predefined preset.
|
|
545
|
+
*
|
|
546
|
+
* Selects a subset of tools and, when a single preset is passed,
|
|
547
|
+
* sets a matching system prompt. Combine presets with an array to merge tool sets.
|
|
548
|
+
*
|
|
549
|
+
* @see {@link GithubToolPreset} for available presets and included tools.
|
|
550
|
+
*/
|
|
551
|
+
preset?: GithubToolPreset | GithubToolPreset[];
|
|
552
|
+
/**
|
|
553
|
+
* Fully replace the default system prompt.
|
|
554
|
+
* When set, `preset` system prompts and `additionalInstructions` are ignored.
|
|
555
|
+
* `context` is still appended when provided.
|
|
556
|
+
*/
|
|
557
|
+
instructions?: string;
|
|
558
|
+
/**
|
|
559
|
+
* Append text to the preset-specific (or default) system prompt.
|
|
560
|
+
* Ignored when `instructions` is set.
|
|
561
|
+
*/
|
|
562
|
+
additionalInstructions?: string;
|
|
563
|
+
};
|
|
564
|
+
declare function createGithubAgent(options: CreateGithubAgentOptions & {
|
|
565
|
+
preset?: undefined;
|
|
566
|
+
}): ToolLoopAgent<never, AllGithubTools>;
|
|
567
|
+
declare function createGithubAgent<P extends GithubToolPreset>(options: CreateGithubAgentOptions & {
|
|
568
|
+
preset: P;
|
|
569
|
+
}): ToolLoopAgent<never, Pick<AllGithubTools, PresetToolName<P>>>;
|
|
570
|
+
declare function createGithubAgent<P extends readonly GithubToolPreset[]>(options: CreateGithubAgentOptions & {
|
|
571
|
+
preset: P;
|
|
572
|
+
}): ToolLoopAgent<never, Pick<AllGithubTools, CombinedPresetToolNames<P>>>;
|
|
573
|
+
//#endregion
|
|
574
|
+
//#region src/index.d.ts
|
|
575
|
+
type GithubToolsOptions = GithubToolsBaseOptions & {
|
|
576
|
+
/**
|
|
577
|
+
* Restrict the returned tools to a predefined preset.
|
|
578
|
+
* Omit to get all tools.
|
|
579
|
+
*
|
|
580
|
+
* @see {@link GithubToolPreset} for available presets and included tools.
|
|
581
|
+
*
|
|
582
|
+
* @example
|
|
583
|
+
* ```ts
|
|
584
|
+
* // Only code-review tools
|
|
585
|
+
* createGithubTools({ token, preset: 'code-review' })
|
|
586
|
+
*
|
|
587
|
+
* // Combine presets
|
|
588
|
+
* createGithubTools({ token, preset: ['code-review', 'issue-triage'] })
|
|
589
|
+
* ```
|
|
590
|
+
*/
|
|
591
|
+
preset?: GithubToolPreset | GithubToolPreset[];
|
|
592
|
+
};
|
|
593
|
+
declare function createGithubTools(options?: GithubToolsBaseOptions & {
|
|
594
|
+
preset?: undefined;
|
|
595
|
+
}): AllGithubTools;
|
|
596
|
+
declare function createGithubTools<P extends GithubToolPreset>(options: GithubToolsBaseOptions & {
|
|
597
|
+
preset: P;
|
|
598
|
+
}): Pick<AllGithubTools, PresetToolName<P>>;
|
|
599
|
+
declare function createGithubTools<P extends readonly GithubToolPreset[]>(options: GithubToolsBaseOptions & {
|
|
600
|
+
preset: P;
|
|
601
|
+
}): Pick<AllGithubTools, CombinedPresetToolNames<P>>;
|
|
602
|
+
declare function createGithubTools(options?: GithubToolsOptions): AllGithubTools | Pick<AllGithubTools, GithubToolName>;
|
|
603
|
+
type GithubTools = AllGithubTools & ToolSet;
|
|
604
|
+
//#endregion
|
|
605
|
+
export { mergePullRequest as $, compareCommits as A, GITHUB_TOOL_NAMES as At, createIssue as B, createGist as C, ApprovalConfig as Ct, listGistComments as D, GithubToolPreset as Dt, getGist as E, CombinedPresetToolNames as Et, searchRepositories as F, removeLabel as G, listIssues as H, addAssignees as I, createPullRequestReview as J, addPullRequestComment as K, addIssueComment as L, getCommit as M, listCommits as N, listGists as O, PRESET_TOOLS as Ot, searchCode as P, listPullRequests as Q, addLabels as R, triggerWorkflow as S, ToolOverrides as St, deleteGist as T, GithubWriteToolName as Tt, listLabels as U, getIssue as V, removeAssignees as W, listPullRequestFiles as X, getPullRequest as Y, listPullRequestReviews as Z, getWorkflowRun as _, CommitIdentity as _t, createGithubAgent as a, getFileContent as at, listWorkflows as b, Octokit$1 as bt, getPullRequestContext as c, listBranches as ct, getLatestRelease as d, GithubToolsBaseOptions as dt, requestReviewers as et, getRelease as f, GithubToolsForPreset as ft, cancelWorkflowRun as g, GithubToolsContext as gt, listCheckRuns as h, resolveGithubToken as ht, CreateGithubAgentOptions as i, forkRepository as it, getBlame as j, GithubToolName as jt, updateGist as k, PresetToolName as kt, getReleaseContext as l, createOctokit as lt, getCombinedStatus as m, GithubTokenInput as mt, GithubToolsOptions as n, createOrUpdateFile as nt, getCiFailureContext as o, getRepository as ot, listReleases as p, PickGithubTools as pt, createPullRequest as q, createGithubTools as r, createRepository as rt, getIssueContext as s, getRepositoryTree as st, GithubTools as t, createBranch as tt, createRelease as u, AllGithubTools as ut, listWorkflowJobs as v, CommitToolOptions as vt, createGistComment as w, GITHUB_WRITE_TOOLS as wt, rerunWorkflowRun as x, ToolOptions as xt, listWorkflowRuns as y, GithubTool as yt, closeIssue as z };
|
|
606
|
+
//# sourceMappingURL=index-CtID5dUi.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-CtID5dUi.d.mts","names":[],"sources":["../src/core/tool-names.ts","../src/core/presets.ts","../src/core/write-tools.ts","../src/core/approval.ts","../src/types.ts","../src/core/context.ts","../src/core/token.ts","../src/core/tool-types.ts","../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/tools/checks.ts","../src/tools/releases.ts","../src/tools/bundles.ts","../src/agents.ts","../src/index.ts"],"mappings":"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"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
export { AllGithubTools, ApprovalConfig, CombinedPresetToolNames, CommitIdentity, CommitToolOptions, CreateGithubAgentOptions, GITHUB_TOOL_NAMES, GITHUB_WRITE_TOOLS, GithubTokenInput, GithubTool, GithubToolName, GithubToolPreset, GithubTools, GithubToolsForPreset, GithubToolsOptions, GithubWriteToolName, Octokit, PRESET_TOOLS, PickGithubTools, PresetToolName, ToolOptions, ToolOverrides, addIssueComment, addLabels, addPullRequestComment, cancelWorkflowRun, closeIssue, createBranch, createGist, createGistComment, createGithubAgent, createGithubTools, createIssue, createOctokit, createOrUpdateFile, createPullRequest, createPullRequestReview, createRepository, deleteGist, forkRepository, getBlame, getCommit, getFileContent, getGist, getIssue, getPullRequest, getRepository, getWorkflowRun, listBranches, listCommits, listGistComments, listGists, listIssues, listLabels, listPullRequestFiles, listPullRequestReviews, listPullRequests, listWorkflowJobs, listWorkflowRuns, listWorkflows, mergePullRequest, removeLabel, rerunWorkflowRun, resolveGithubToken, searchCode, searchRepositories, triggerWorkflow, updateGist };
|
|
1
|
+
import { $ as mergePullRequest, A as compareCommits, At as GITHUB_TOOL_NAMES, B as createIssue, C as createGist, Ct as ApprovalConfig, D as listGistComments, Dt as GithubToolPreset, E as getGist, Et as CombinedPresetToolNames, F as searchRepositories, G as removeLabel, H as listIssues, I as addAssignees, J as createPullRequestReview, K as addPullRequestComment, L as addIssueComment, M as getCommit, N as listCommits, O as listGists, Ot as PRESET_TOOLS, P as searchCode, Q as listPullRequests, R as addLabels, S as triggerWorkflow, St as ToolOverrides, T as deleteGist, Tt as GithubWriteToolName, U as listLabels, V as getIssue, W as removeAssignees, X as listPullRequestFiles, Y as getPullRequest, Z as listPullRequestReviews, _ as getWorkflowRun, _t as CommitIdentity, a as createGithubAgent, at as getFileContent, b as listWorkflows, bt as Octokit, c as getPullRequestContext, ct as listBranches, d as getLatestRelease, et as requestReviewers, f as getRelease, ft as GithubToolsForPreset, g as cancelWorkflowRun, gt as GithubToolsContext, h as listCheckRuns, ht as resolveGithubToken, i as CreateGithubAgentOptions, it as forkRepository, j as getBlame, jt as GithubToolName, k as updateGist, kt as PresetToolName, l as getReleaseContext, lt as createOctokit, m as getCombinedStatus, mt as GithubTokenInput, n as GithubToolsOptions, nt as createOrUpdateFile, o as getCiFailureContext, ot as getRepository, p as listReleases, pt as PickGithubTools, q as createPullRequest, r as createGithubTools, rt as createRepository, s as getIssueContext, st as getRepositoryTree, t as GithubTools, tt as createBranch, u as createRelease, ut as AllGithubTools, v as listWorkflowJobs, vt as CommitToolOptions, w as createGistComment, wt as GITHUB_WRITE_TOOLS, x as rerunWorkflowRun, xt as ToolOptions, y as listWorkflowRuns, yt as GithubTool, z as closeIssue } from "./index-CtID5dUi.mjs";
|
|
2
|
+
export { type AllGithubTools, type ApprovalConfig, type CombinedPresetToolNames, type CommitIdentity, type CommitToolOptions, type CreateGithubAgentOptions, GITHUB_TOOL_NAMES, GITHUB_WRITE_TOOLS, type GithubTokenInput, type GithubTool, type GithubToolName, type GithubToolPreset, GithubTools, type GithubToolsContext, type GithubToolsForPreset, GithubToolsOptions, type GithubWriteToolName, type Octokit, PRESET_TOOLS, type PickGithubTools, type PresetToolName, type ToolOptions, type ToolOverrides, addAssignees, addIssueComment, addLabels, addPullRequestComment, cancelWorkflowRun, closeIssue, compareCommits, createBranch, createGist, createGistComment, createGithubAgent, createGithubTools, createIssue, createOctokit, createOrUpdateFile, createPullRequest, createPullRequestReview, createRelease, createRepository, deleteGist, forkRepository, getBlame, getCiFailureContext, getCombinedStatus, getCommit, getFileContent, getGist, getIssue, getIssueContext, getLatestRelease, getPullRequest, getPullRequestContext, getRelease, getReleaseContext, getRepository, getRepositoryTree, getWorkflowRun, listBranches, listCheckRuns, listCommits, listGistComments, listGists, listIssues, listLabels, listPullRequestFiles, listPullRequestReviews, listPullRequests, listReleases, listWorkflowJobs, listWorkflowRuns, listWorkflows, mergePullRequest, removeAssignees, removeLabel, requestReviewers, rerunWorkflowRun, resolveGithubToken, searchCode, searchRepositories, triggerWorkflow, updateGist };
|